@kubb/plugin-faker 5.0.0-alpha.9 → 5.0.0-beta.10
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 +25 -7
- package/dist/Faker-BMgoFj8b.d.ts +27 -0
- package/dist/Faker-CWtonujy.js +334 -0
- package/dist/Faker-CWtonujy.js.map +1 -0
- package/dist/Faker-D39THFJ-.cjs +418 -0
- package/dist/Faker-D39THFJ-.cjs.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-B-QnVz9o.d.ts +9 -0
- package/dist/fakerGenerator-B-XuVREg.cjs +570 -0
- package/dist/fakerGenerator-B-XuVREg.cjs.map +1 -0
- package/dist/fakerGenerator-DH6hN3yb.js +560 -0
- package/dist/fakerGenerator-DH6hN3yb.js.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -505
- package/dist/generators.js +1 -1
- package/dist/index.cjs +237 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +229 -83
- package/dist/index.js.map +1 -1
- package/dist/printerFaker-W0pLunAj.d.ts +213 -0
- package/extension.yaml +357 -0
- package/package.json +48 -51
- package/src/components/Faker.tsx +124 -78
- package/src/generators/fakerGenerator.tsx +233 -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 +85 -0
- package/src/types.ts +134 -81
- package/src/utils.ts +268 -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,418 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
let node_path = require("node:path");
|
|
28
|
+
let _kubb_core = require("@kubb/core");
|
|
29
|
+
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
30
|
+
let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
31
|
+
let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
32
|
+
//#region ../../internals/utils/src/string.ts
|
|
33
|
+
/**
|
|
34
|
+
* Strips a single matching pair of `"..."`, `'...'`, or `` `...` `` from both ends of `text`.
|
|
35
|
+
* Returns the string unchanged when no balanced quote pair is found.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* trimQuotes('"hello"') // 'hello'
|
|
39
|
+
* trimQuotes('hello') // 'hello'
|
|
40
|
+
*/
|
|
41
|
+
function trimQuotes(text) {
|
|
42
|
+
if (text.length >= 2) {
|
|
43
|
+
const first = text[0];
|
|
44
|
+
const last = text[text.length - 1];
|
|
45
|
+
if (first === "\"" && last === "\"" || first === "'" && last === "'" || first === "`" && last === "`") return text.slice(1, -1);
|
|
46
|
+
}
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Escapes characters that are not allowed inside JS string literals.
|
|
51
|
+
* Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).
|
|
52
|
+
*
|
|
53
|
+
* @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* jsStringEscape('say "hi"\nbye') // 'say \\"hi\\"\\nbye'
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
function jsStringEscape(input) {
|
|
61
|
+
return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
62
|
+
switch (character) {
|
|
63
|
+
case "\"":
|
|
64
|
+
case "'":
|
|
65
|
+
case "\\": return `\\${character}`;
|
|
66
|
+
case "\n": return "\\n";
|
|
67
|
+
case "\r": return "\\r";
|
|
68
|
+
case "\u2028": return "\\u2028";
|
|
69
|
+
case "\u2029": return "\\u2029";
|
|
70
|
+
default: return "";
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/utils.ts
|
|
76
|
+
/**
|
|
77
|
+
* Returns the `@faker-js/faker` named export for a locale code.
|
|
78
|
+
*
|
|
79
|
+
* Without a locale, returns `'faker'` for the default English instance.
|
|
80
|
+
* With a locale, the language code is converted to upper case and joined with any region suffix.
|
|
81
|
+
*
|
|
82
|
+
* @example Default
|
|
83
|
+
* `localeToFakerImport() // 'faker'`
|
|
84
|
+
*
|
|
85
|
+
* @example Simple locale
|
|
86
|
+
* `localeToFakerImport('de') // 'fakerDE'`
|
|
87
|
+
*
|
|
88
|
+
* @example Compound locale
|
|
89
|
+
* `localeToFakerImport('de_AT') // 'fakerDE_AT'`
|
|
90
|
+
*/
|
|
91
|
+
function localeToFakerImport(locale) {
|
|
92
|
+
if (!locale) return "faker";
|
|
93
|
+
const parts = locale.split("_");
|
|
94
|
+
parts[0] = parts[0].toUpperCase();
|
|
95
|
+
return `faker${parts.join("_")}`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Determines if a schema node can be overridden during faker generation.
|
|
99
|
+
*/
|
|
100
|
+
function canOverrideSchema(node) {
|
|
101
|
+
return new Set([
|
|
102
|
+
"array",
|
|
103
|
+
"tuple",
|
|
104
|
+
"object",
|
|
105
|
+
"intersection",
|
|
106
|
+
"union",
|
|
107
|
+
"enum",
|
|
108
|
+
"ref",
|
|
109
|
+
"string",
|
|
110
|
+
"email",
|
|
111
|
+
"url",
|
|
112
|
+
"uuid",
|
|
113
|
+
"number",
|
|
114
|
+
"integer",
|
|
115
|
+
"bigint",
|
|
116
|
+
"boolean",
|
|
117
|
+
"date",
|
|
118
|
+
"time",
|
|
119
|
+
"datetime",
|
|
120
|
+
"blob"
|
|
121
|
+
]).has(node.type);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolves a schema reference by looking up the referenced schema in the provided array.
|
|
125
|
+
* Returns the original node if it's not a reference.
|
|
126
|
+
*/
|
|
127
|
+
function resolveSchemaRef(node, schemas) {
|
|
128
|
+
if (node.type !== "ref") return node;
|
|
129
|
+
return schemas.find((schema) => schema.name === node.name && schema.type !== "ref") ?? node;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Resolves a parameter name based on its location (path, query, header, etc.) using the provided resolver.
|
|
133
|
+
*/
|
|
134
|
+
function resolveParamNameByLocation(resolver, node, param) {
|
|
135
|
+
switch (param.in) {
|
|
136
|
+
case "path": return resolver.resolvePathParamsName(node, param);
|
|
137
|
+
case "query": return resolver.resolveQueryParamsName(node, param);
|
|
138
|
+
case "header": return resolver.resolveHeaderParamsName(node, param);
|
|
139
|
+
default: return resolver.resolveParamName(node, param);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function shouldInlineSingleResponseSchema(schema) {
|
|
143
|
+
return new Set([
|
|
144
|
+
"any",
|
|
145
|
+
"unknown",
|
|
146
|
+
"void",
|
|
147
|
+
"null",
|
|
148
|
+
"array",
|
|
149
|
+
"tuple",
|
|
150
|
+
"string",
|
|
151
|
+
"email",
|
|
152
|
+
"url",
|
|
153
|
+
"uuid",
|
|
154
|
+
"number",
|
|
155
|
+
"integer",
|
|
156
|
+
"bigint",
|
|
157
|
+
"boolean",
|
|
158
|
+
"date",
|
|
159
|
+
"time",
|
|
160
|
+
"datetime",
|
|
161
|
+
"blob",
|
|
162
|
+
"enum",
|
|
163
|
+
"union"
|
|
164
|
+
]).has(schema.type);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Builds a response schema as a union of all response statuses.
|
|
168
|
+
* Returns null if no responses are provided, or embeds single simple responses inline.
|
|
169
|
+
*/
|
|
170
|
+
function buildResponseUnionSchema(node, resolver) {
|
|
171
|
+
const responses = node.responses.filter((response) => response.schema);
|
|
172
|
+
if (!responses.length) return null;
|
|
173
|
+
if (responses.length === 1) {
|
|
174
|
+
if (shouldInlineSingleResponseSchema(responses[0].schema)) return responses[0].schema;
|
|
175
|
+
return _kubb_core.ast.createSchema({
|
|
176
|
+
type: "ref",
|
|
177
|
+
name: resolver.resolveResponseStatusName(node, responses[0].statusCode)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return _kubb_core.ast.createSchema({
|
|
181
|
+
type: "union",
|
|
182
|
+
members: responses.map((response) => _kubb_core.ast.createSchema({
|
|
183
|
+
type: "ref",
|
|
184
|
+
name: resolver.resolveResponseStatusName(node, response.statusCode)
|
|
185
|
+
}))
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const SCALAR_TYPES$1 = new Set([
|
|
189
|
+
"string",
|
|
190
|
+
"email",
|
|
191
|
+
"url",
|
|
192
|
+
"uuid",
|
|
193
|
+
"number",
|
|
194
|
+
"integer",
|
|
195
|
+
"bigint",
|
|
196
|
+
"boolean",
|
|
197
|
+
"date",
|
|
198
|
+
"time",
|
|
199
|
+
"datetime",
|
|
200
|
+
"blob",
|
|
201
|
+
"enum"
|
|
202
|
+
]);
|
|
203
|
+
const ARRAY_TYPES$1 = new Set(["array"]);
|
|
204
|
+
function toRelativeImportPath(from, to) {
|
|
205
|
+
const relativePath = node_path.posix.relative(node_path.posix.dirname(from), to);
|
|
206
|
+
return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Resolves a type reference, determining if it needs an import statement or inline type reference.
|
|
210
|
+
* Takes into account whether the type can be overridden and the file paths.
|
|
211
|
+
*/
|
|
212
|
+
function resolveTypeReference({ node, canOverride, name, typeName, filePath, typeFilePath }) {
|
|
213
|
+
const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
214
|
+
if (!usesTypeName) return { typeName };
|
|
215
|
+
if (name === typeName) return { typeName: `import('${toRelativeImportPath(filePath, typeFilePath)}').${typeName}` };
|
|
216
|
+
return {
|
|
217
|
+
importPath: typeFilePath,
|
|
218
|
+
typeName
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Maps a schema node type to its corresponding scalar type representation.
|
|
223
|
+
* Returns the type name for enums or the base type (string, number, etc.) for primitives.
|
|
224
|
+
*/
|
|
225
|
+
function getScalarType(node, typeName) {
|
|
226
|
+
switch (node.type) {
|
|
227
|
+
case "string":
|
|
228
|
+
case "email":
|
|
229
|
+
case "url":
|
|
230
|
+
case "uuid": return "string";
|
|
231
|
+
case "number":
|
|
232
|
+
case "integer": return "number";
|
|
233
|
+
case "bigint": return "bigint";
|
|
234
|
+
case "boolean": return "boolean";
|
|
235
|
+
case "date":
|
|
236
|
+
case "time": return node.representation === "date" ? "Date" : "string";
|
|
237
|
+
case "datetime": return "string";
|
|
238
|
+
case "blob": return "Blob";
|
|
239
|
+
case "enum": return typeName;
|
|
240
|
+
default: return typeName;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Resolves faker type usage information for a schema.
|
|
245
|
+
* Determines the data type, return type, and whether it uses the type name.
|
|
246
|
+
*/
|
|
247
|
+
function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
248
|
+
const isArray = ARRAY_TYPES$1.has(node.type);
|
|
249
|
+
const isTuple = node.type === "tuple";
|
|
250
|
+
const isScalar = SCALAR_TYPES$1.has(node.type);
|
|
251
|
+
let dataType = `Partial<${typeName}>`;
|
|
252
|
+
if (isArray || isTuple || node.type === "union" || node.type === "enum") dataType = typeName;
|
|
253
|
+
if (isScalar) dataType = getScalarType(node, typeName);
|
|
254
|
+
let returnType = canOverride ? typeName : void 0;
|
|
255
|
+
if (isScalar) returnType = getScalarType(node, typeName);
|
|
256
|
+
return {
|
|
257
|
+
dataType,
|
|
258
|
+
returnType,
|
|
259
|
+
usesTypeName: dataType.includes(typeName) || Boolean(returnType?.includes(typeName))
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/components/Faker.tsx
|
|
264
|
+
const OBJECT_TYPES = new Set(["object", "intersection"]);
|
|
265
|
+
const ARRAY_TYPES = new Set(["array"]);
|
|
266
|
+
const SCALAR_TYPES = new Set([
|
|
267
|
+
"string",
|
|
268
|
+
"email",
|
|
269
|
+
"url",
|
|
270
|
+
"uuid",
|
|
271
|
+
"number",
|
|
272
|
+
"integer",
|
|
273
|
+
"bigint",
|
|
274
|
+
"boolean",
|
|
275
|
+
"date",
|
|
276
|
+
"time",
|
|
277
|
+
"datetime",
|
|
278
|
+
"blob",
|
|
279
|
+
"enum"
|
|
280
|
+
]);
|
|
281
|
+
const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
282
|
+
function Faker({ node, description, name, typeName, printer, seed, canOverride }) {
|
|
283
|
+
const fakerText = printer.print(node) ?? "undefined";
|
|
284
|
+
const isArray = ARRAY_TYPES.has(node.type);
|
|
285
|
+
const isObject = OBJECT_TYPES.has(node.type);
|
|
286
|
+
const isTuple = node.type === "tuple";
|
|
287
|
+
const isScalar = SCALAR_TYPES.has(node.type);
|
|
288
|
+
let fakerTextWithOverride = fakerText;
|
|
289
|
+
let useGenericOverride = false;
|
|
290
|
+
if (canOverride && isObject) useGenericOverride = true;
|
|
291
|
+
if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`;
|
|
292
|
+
if (canOverride && isArray) fakerTextWithOverride = `[
|
|
293
|
+
...${fakerText},
|
|
294
|
+
...(data || [])
|
|
295
|
+
]`;
|
|
296
|
+
if (canOverride && isScalar) fakerTextWithOverride = `data ?? ${fakerText}`;
|
|
297
|
+
const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
298
|
+
let functionSignature = "";
|
|
299
|
+
let functionBody = "";
|
|
300
|
+
if (useGenericOverride) {
|
|
301
|
+
functionSignature = `${description ? `/**\n * @description ${jsStringEscape(description)}\n */\n ` : ""}export function ${name}(data?: Partial<${typeName}>): Required<${typeName}>`;
|
|
302
|
+
const seedCode = seed ? `faker.seed(${JSON.stringify(seed)})\n ` : "";
|
|
303
|
+
const { cyclicSchemas, schemaName } = printer.options;
|
|
304
|
+
if (node.type === "object" && !!cyclicSchemas && (node.properties ?? []).some((p) => _kubb_core.ast.containsCircularRef(p.schema, {
|
|
305
|
+
circularSchemas: cyclicSchemas,
|
|
306
|
+
excludeName: schemaName
|
|
307
|
+
}))) functionBody = `{
|
|
308
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
309
|
+
if (data) {
|
|
310
|
+
for (const [key, value] of Object.entries(data)) {
|
|
311
|
+
Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return defaultFakeData as Required<${typeName}>
|
|
315
|
+
}`;
|
|
316
|
+
else functionBody = `{
|
|
317
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
318
|
+
return {
|
|
319
|
+
...defaultFakeData,
|
|
320
|
+
...(data || {}),
|
|
321
|
+
} as Required<${typeName}>
|
|
322
|
+
}`;
|
|
323
|
+
} else {
|
|
324
|
+
const dataParamName = /\bdata\b/.test(fakerTextWithOverride) ? "data" : "_data";
|
|
325
|
+
const params = _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
|
|
326
|
+
name: dataParamName,
|
|
327
|
+
type: _kubb_core.ast.createParamsType({
|
|
328
|
+
variant: "reference",
|
|
329
|
+
name: dataType
|
|
330
|
+
}),
|
|
331
|
+
optional: true
|
|
332
|
+
})] });
|
|
333
|
+
const paramsSignature = declarationPrinter.print(params) ?? "";
|
|
334
|
+
const returnType = resolvedReturnType;
|
|
335
|
+
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
336
|
+
name,
|
|
337
|
+
isExportable: true,
|
|
338
|
+
isIndexable: true,
|
|
339
|
+
children: /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx.Function, {
|
|
340
|
+
export: true,
|
|
341
|
+
name,
|
|
342
|
+
JSDoc: { comments: description ? [`@description ${jsStringEscape(description)}`] : [] },
|
|
343
|
+
params: canOverride ? paramsSignature : void 0,
|
|
344
|
+
returnType,
|
|
345
|
+
children: [seed ? /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx_jsx_runtime.Fragment, { children: [`faker.seed(${JSON.stringify(seed)})`, /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)("br", {})] }) : void 0, `return ${fakerTextWithOverride}`]
|
|
346
|
+
})
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx.File.Source, {
|
|
350
|
+
name,
|
|
351
|
+
isExportable: true,
|
|
352
|
+
isIndexable: true,
|
|
353
|
+
children: [functionSignature, functionBody]
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
Object.defineProperty(exports, "Faker", {
|
|
358
|
+
enumerable: true,
|
|
359
|
+
get: function() {
|
|
360
|
+
return Faker;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
Object.defineProperty(exports, "__name", {
|
|
364
|
+
enumerable: true,
|
|
365
|
+
get: function() {
|
|
366
|
+
return __name;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(exports, "__toESM", {
|
|
370
|
+
enumerable: true,
|
|
371
|
+
get: function() {
|
|
372
|
+
return __toESM;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
Object.defineProperty(exports, "buildResponseUnionSchema", {
|
|
376
|
+
enumerable: true,
|
|
377
|
+
get: function() {
|
|
378
|
+
return buildResponseUnionSchema;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
Object.defineProperty(exports, "canOverrideSchema", {
|
|
382
|
+
enumerable: true,
|
|
383
|
+
get: function() {
|
|
384
|
+
return canOverrideSchema;
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
Object.defineProperty(exports, "localeToFakerImport", {
|
|
388
|
+
enumerable: true,
|
|
389
|
+
get: function() {
|
|
390
|
+
return localeToFakerImport;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
Object.defineProperty(exports, "resolveParamNameByLocation", {
|
|
394
|
+
enumerable: true,
|
|
395
|
+
get: function() {
|
|
396
|
+
return resolveParamNameByLocation;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
Object.defineProperty(exports, "resolveSchemaRef", {
|
|
400
|
+
enumerable: true,
|
|
401
|
+
get: function() {
|
|
402
|
+
return resolveSchemaRef;
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
Object.defineProperty(exports, "resolveTypeReference", {
|
|
406
|
+
enumerable: true,
|
|
407
|
+
get: function() {
|
|
408
|
+
return resolveTypeReference;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
Object.defineProperty(exports, "trimQuotes", {
|
|
412
|
+
enumerable: true,
|
|
413
|
+
get: function() {
|
|
414
|
+
return trimQuotes;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
//# sourceMappingURL=Faker-D39THFJ-.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Faker-D39THFJ-.cjs","names":["ast","SCALAR_TYPES","ARRAY_TYPES","posix","ast","File","Function"],"sources":["../../../internals/utils/src/string.ts","../src/utils.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { posix } from 'node:path'\nimport { ast } from '@kubb/core'\nimport type { ResolverFaker } from './types.ts'\n\n/**\n * Returns the `@faker-js/faker` named export for a locale code.\n *\n * Without a locale, returns `'faker'` for the default English instance.\n * With a locale, the language code is converted to upper case and joined with any region suffix.\n *\n * @example Default\n * `localeToFakerImport() // 'faker'`\n *\n * @example Simple locale\n * `localeToFakerImport('de') // 'fakerDE'`\n *\n * @example Compound locale\n * `localeToFakerImport('de_AT') // 'fakerDE_AT'`\n */\nexport function localeToFakerImport(locale?: string): string {\n if (!locale) {\n return 'faker'\n }\n\n const parts = locale.split('_')\n parts[0] = parts[0]!.toUpperCase()\n return `faker${parts.join('_')}`\n}\n\n/**\n * Determines if a schema node can be overridden during faker generation.\n */\nexport function canOverrideSchema(node: ast.SchemaNode): boolean {\n return new Set<ast.SchemaNode['type']>([\n 'array',\n 'tuple',\n 'object',\n 'intersection',\n 'union',\n 'enum',\n 'ref',\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n ]).has(node.type)\n}\n\n/**\n * Resolves a schema reference by looking up the referenced schema in the provided array.\n * Returns the original node if it's not a reference.\n */\nexport function resolveSchemaRef(node: ast.SchemaNode, schemas: Array<ast.SchemaNode>): ast.SchemaNode {\n if (node.type !== 'ref') {\n return node\n }\n\n return schemas.find((schema) => schema.name === node.name && schema.type !== 'ref') ?? node\n}\n\n/**\n * Resolves a parameter name based on its location (path, query, header, etc.) using the provided resolver.\n */\nexport function resolveParamNameByLocation(\n resolver: Pick<ResolverFaker, 'resolvePathParamsName' | 'resolveQueryParamsName' | 'resolveHeaderParamsName' | 'resolveParamName'>,\n node: ast.OperationNode,\n param: ast.ParameterNode,\n): string {\n switch (param.in) {\n case 'path':\n return resolver.resolvePathParamsName(node, param)\n case 'query':\n return resolver.resolveQueryParamsName(node, param)\n case 'header':\n return resolver.resolveHeaderParamsName(node, param)\n default:\n return resolver.resolveParamName(node, param)\n }\n}\n\nfunction shouldInlineSingleResponseSchema(schema: ast.SchemaNode): boolean {\n return new Set<ast.SchemaNode['type']>([\n 'any',\n 'unknown',\n 'void',\n 'null',\n 'array',\n 'tuple',\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n 'union',\n ]).has(schema.type)\n}\n\n/**\n * Builds a response schema as a union of all response statuses.\n * Returns null if no responses are provided, or embeds single simple responses inline.\n */\nexport function buildResponseUnionSchema(node: ast.OperationNode, resolver: ResolverFaker): ast.SchemaNode | null {\n const responses = node.responses.filter((response) => response.schema)\n\n if (!responses.length) {\n return null\n }\n\n if (responses.length === 1) {\n if (shouldInlineSingleResponseSchema(responses[0]!.schema)) {\n return responses[0]!.schema\n }\n\n return ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, responses[0]!.statusCode) })\n }\n\n return ast.createSchema({\n type: 'union',\n members: responses.map((response) => ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, response.statusCode) })),\n })\n}\n\nconst SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst ARRAY_TYPES = new Set<ast.SchemaNode['type']>(['array'])\n\nfunction toRelativeImportPath(from: string, to: string): string {\n const relativePath = posix.relative(posix.dirname(from), to)\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Resolves a type reference, determining if it needs an import statement or inline type reference.\n * Takes into account whether the type can be overridden and the file paths.\n */\nexport function resolveTypeReference({\n node,\n canOverride,\n name,\n typeName,\n filePath,\n typeFilePath,\n}: {\n node: ast.SchemaNode\n canOverride: boolean\n name: string\n typeName: string\n filePath: string\n typeFilePath: string\n}): { importPath?: string; typeName: string } {\n const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!usesTypeName) {\n return { typeName }\n }\n\n if (name === typeName) {\n return {\n typeName: `import('${toRelativeImportPath(filePath, typeFilePath)}').${typeName}`,\n }\n }\n\n return {\n importPath: typeFilePath,\n typeName,\n }\n}\n\n/**\n * Maps a schema node type to its corresponding scalar type representation.\n * Returns the type name for enums or the base type (string, number, etc.) for primitives.\n */\nexport function getScalarType(node: ast.SchemaNode, typeName: string): string {\n switch (node.type) {\n case 'string':\n case 'email':\n case 'url':\n case 'uuid':\n return 'string'\n case 'number':\n case 'integer':\n return 'number'\n case 'bigint':\n return 'bigint'\n case 'boolean':\n return 'boolean'\n case 'date':\n case 'time':\n return node.representation === 'date' ? 'Date' : 'string'\n case 'datetime':\n return 'string'\n case 'blob':\n return 'Blob'\n case 'enum':\n return typeName\n default:\n return typeName\n }\n}\n\n/**\n * Resolves faker type usage information for a schema.\n * Determines the data type, return type, and whether it uses the type name.\n */\nexport function resolveFakerTypeUsage(\n node: ast.SchemaNode,\n typeName: string,\n canOverride: boolean,\n): {\n dataType: string\n returnType: string | undefined\n usesTypeName: boolean\n} {\n const isArray = ARRAY_TYPES.has(node.type)\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n\n let dataType = `Partial<${typeName}>`\n\n if (isArray || isTuple || node.type === 'union' || node.type === 'enum') {\n dataType = typeName\n }\n\n if (isScalar) {\n dataType = getScalarType(node, typeName)\n }\n\n let returnType = canOverride ? typeName : undefined\n\n if (isScalar) {\n returnType = getScalarType(node, typeName)\n }\n\n return {\n dataType,\n returnType,\n usesTypeName: dataType.includes(typeName) || Boolean(returnType?.includes(typeName)),\n }\n}\n","import { jsStringEscape } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterFakerFactory } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { resolveFakerTypeUsage } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.SchemaNode\n printer: ast.Printer<PrinterFakerFactory>\n seed?: PluginFaker['options']['seed']\n description?: string\n canOverride: boolean\n}\n\nconst OBJECT_TYPES = new Set<ast.SchemaNode['type']>(['object', 'intersection'])\nconst ARRAY_TYPES = new Set<ast.SchemaNode['type']>(['array'])\nconst SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function Faker({ node, description, name, typeName, printer, seed, canOverride }: Props): KubbReactNode {\n const fakerText = printer.print(node) ?? 'undefined'\n\n const isArray = ARRAY_TYPES.has(node.type)\n const isObject = OBJECT_TYPES.has(node.type)\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n\n let fakerTextWithOverride = fakerText\n let useGenericOverride = false\n\n if (canOverride && isObject) {\n useGenericOverride = true\n }\n\n if (canOverride && isTuple) {\n fakerTextWithOverride = `data || ${fakerText}`\n }\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...(data || [])\n]`\n }\n\n if (canOverride && isScalar) {\n fakerTextWithOverride = `data ?? ${fakerText}`\n }\n\n const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n let functionSignature = ''\n let functionBody = ''\n\n if (useGenericOverride) {\n // Generate function with defaultFakeData structure\n const jsdoc = description ? `/**\\n * @description ${jsStringEscape(description)}\\n */\\n ` : ''\n functionSignature = `${jsdoc}export function ${name}(data?: Partial<${typeName}>): Required<${typeName}>`\n\n const seedCode = seed ? `faker.seed(${JSON.stringify(seed)})\\n ` : ''\n\n // When the object node has properties that transitively reference a cyclic schema,\n // the printer emits memoizing getters for those properties. Spreading the object\n // literal would immediately invoke those getters, triggering recursive faker calls\n // and causing a stack overflow. Detect this upfront via ast helpers so we can\n // use Object.defineProperty-based merging instead of spread.\n const { cyclicSchemas, schemaName } = printer.options\n const hasGetters =\n node.type === 'object' &&\n !!cyclicSchemas &&\n (node.properties ?? []).some((p) => ast.containsCircularRef(p.schema, { circularSchemas: cyclicSchemas, excludeName: schemaName }))\n\n if (hasGetters) {\n functionBody = `{\n ${seedCode}const defaultFakeData = ${fakerText}\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })\n }\n }\n return defaultFakeData as Required<${typeName}>\n}`\n } else {\n functionBody = `{\n ${seedCode}const defaultFakeData = ${fakerText}\n return {\n ...defaultFakeData,\n ...(data || {}),\n } as Required<${typeName}>\n}`\n }\n } else {\n const usesData = /\\bdata\\b/.test(fakerTextWithOverride)\n const dataParamName = usesData ? 'data' : '_data'\n const params = ast.createFunctionParameters({\n params: [\n ast.createFunctionParameter({\n name: dataParamName,\n type: ast.createParamsType({ variant: 'reference', name: dataType }),\n optional: true,\n }),\n ],\n })\n const paramsSignature = declarationPrinter.print(params) ?? ''\n const returnType = resolvedReturnType\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsStringEscape(description)}`] : [] }}\n params={canOverride ? paramsSignature : undefined}\n returnType={returnType}\n >\n {seed ? (\n <>\n {`faker.seed(${JSON.stringify(seed)})`}\n <br />\n </>\n ) : undefined}\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {functionSignature}\n {functionBody}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;CAC/C,IAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;EAChC,IAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,KACnG,OAAO,KAAK,MAAM,GAAG,GAAG;;CAG5B,OAAO;;;;;;;;;;;;;AAcT,SAAgB,eAAe,OAAwB;CACrD,OAAO,GAAG,QAAQ,QAAQ,4BAA4B,cAAc;EAClE,QAAQ,WAAR;GACE,KAAK;GACL,KAAK;GACL,KAAK,MACH,OAAO,KAAK;GACd,KAAK,MACH,OAAO;GACT,KAAK,MACH,OAAO;GACT,KAAK,UACH,OAAO;GACT,KAAK,UACH,OAAO;GACT,SACE,OAAO;;GAEX;;;;;;;;;;;;;;;;;;;AC7BJ,SAAgB,oBAAoB,QAAyB;CAC3D,IAAI,CAAC,QACH,OAAO;CAGT,MAAM,QA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+BAAA,KAAC,MAAD,EAAM,CAAA,CACL,EAAA,CAAA,GACD,KAAA,GACH,UAAU,wBACF;;GACC,CAAA;;CAIlB,OACE,iBAAA,GAAA,+BAAA,MAACD,mBAAAA,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YAAtC,CACG,mBACA,aACW"}
|
package/dist/components.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
exports.Faker =
|
|
2
|
+
const require_Faker = require("./Faker-D39THFJ-.cjs");
|
|
3
|
+
exports.Faker = require_Faker.Faker;
|
package/dist/components.d.ts
CHANGED
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
import { Schema } from "@kubb/plugin-oas";
|
|
4
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
-
|
|
6
|
-
//#region src/components/Faker.d.ts
|
|
7
|
-
type Props = {
|
|
8
|
-
name: string;
|
|
9
|
-
typeName: string;
|
|
10
|
-
tree: Array<Schema>;
|
|
11
|
-
seed?: PluginFaker['options']['seed'];
|
|
12
|
-
description?: string;
|
|
13
|
-
regexGenerator?: PluginFaker['options']['regexGenerator'];
|
|
14
|
-
mapper?: PluginFaker['options']['mapper'];
|
|
15
|
-
dateParser?: PluginFaker['options']['dateParser'];
|
|
16
|
-
canOverride: boolean;
|
|
17
|
-
};
|
|
18
|
-
declare function Faker({
|
|
19
|
-
tree,
|
|
20
|
-
description,
|
|
21
|
-
name,
|
|
22
|
-
typeName,
|
|
23
|
-
seed,
|
|
24
|
-
regexGenerator,
|
|
25
|
-
canOverride,
|
|
26
|
-
mapper,
|
|
27
|
-
dateParser
|
|
28
|
-
}: Props): FabricReactNode;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { Faker };
|
|
31
|
-
//# sourceMappingURL=components.d.ts.map
|
|
1
|
+
import { t as Faker } from "./Faker-BMgoFj8b.js";
|
|
2
|
+
export { Faker };
|
package/dist/components.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Faker } from "./
|
|
1
|
+
import { t as Faker } from "./Faker-CWtonujy.js";
|
|
2
2
|
export { Faker };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { o as PluginFaker } from "./printerFaker-W0pLunAj.js";
|
|
3
|
+
import * as _$_kubb_core0 from "@kubb/core";
|
|
4
|
+
|
|
5
|
+
//#region src/generators/fakerGenerator.d.ts
|
|
6
|
+
declare const fakerGenerator: _$_kubb_core0.Generator<PluginFaker, unknown>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { fakerGenerator as t };
|
|
9
|
+
//# sourceMappingURL=fakerGenerator-B-QnVz9o.d.ts.map
|