@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
package/LICENSE
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2026 Kubb Labs
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
— see licenses/LICENSE-AGPL-3.0 for the full license text:
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1
|
|
2
|
+
<h1>@kubb/plugin-faker</h1>
|
|
3
3
|
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
4
|
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
5
|
</a>
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
[![npm version][npm-version-src]][npm-version-href]
|
|
9
8
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
10
9
|
[![Coverage][coverage-src]][coverage-href]
|
|
11
10
|
[![License][license-src]][license-href]
|
|
12
11
|
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
|
+
|
|
13
13
|
<h4>
|
|
14
|
-
<a href="https://codesandbox.io/s/github/kubb-labs/
|
|
14
|
+
<a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/faker" target="_blank">View Demo</a>
|
|
15
15
|
<span> · </span>
|
|
16
|
-
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
16
|
+
<a href="https://kubb.dev/plugins/faker" target="_blank">Documentation</a>
|
|
17
17
|
<span> · </span>
|
|
18
18
|
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
19
19
|
<span> · </span>
|
|
@@ -21,13 +21,32 @@
|
|
|
21
21
|
</h4>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
+
`@kubb/plugin-faker` generates Faker.js factory functions from your OpenAPI schemas. Each schema produces a function that returns realistic mock data matching the schema's structure.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Creates one factory function per schema with optional field overrides
|
|
29
|
+
- Uses Faker.js to produce realistic values for common field types
|
|
30
|
+
- Handles recursive schemas with lazy getters to avoid circular reference errors
|
|
31
|
+
- Works with `@kubb/plugin-msw` to serve mock responses in the browser or Node.js
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
## Installation
|
|
26
34
|
|
|
35
|
+
```bash
|
|
36
|
+
bun add @kubb/plugin-faker
|
|
37
|
+
# or
|
|
38
|
+
pnpm add @kubb/plugin-faker
|
|
39
|
+
# or
|
|
40
|
+
npm install @kubb/plugin-faker
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
See the [full documentation](https://kubb.dev/plugins/faker) for configuration options and examples.
|
|
27
46
|
|
|
28
47
|
## Supporting Kubb
|
|
29
48
|
|
|
30
|
-
Kubb
|
|
49
|
+
Kubb is an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
31
50
|
|
|
32
51
|
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
33
52
|
|
|
@@ -37,7 +56,6 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
|
|
|
37
56
|
</a>
|
|
38
57
|
</p>
|
|
39
58
|
|
|
40
|
-
|
|
41
59
|
<!-- Badges -->
|
|
42
60
|
|
|
43
61
|
[npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-faker?flat&colorA=18181B&colorB=f58517
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { o as PluginFaker, t as PrinterFakerFactory } from "./printerFaker-W0pLunAj.js";
|
|
3
|
+
import { ast } from "@kubb/core";
|
|
4
|
+
import { KubbReactNode } from "@kubb/renderer-jsx/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Faker.d.ts
|
|
7
|
+
type Props = {
|
|
8
|
+
name: string;
|
|
9
|
+
typeName: string;
|
|
10
|
+
node: ast.SchemaNode;
|
|
11
|
+
printer: ast.Printer<PrinterFakerFactory>;
|
|
12
|
+
seed?: PluginFaker['options']['seed'];
|
|
13
|
+
description?: string;
|
|
14
|
+
canOverride: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare function Faker({
|
|
17
|
+
node,
|
|
18
|
+
description,
|
|
19
|
+
name,
|
|
20
|
+
typeName,
|
|
21
|
+
printer,
|
|
22
|
+
seed,
|
|
23
|
+
canOverride
|
|
24
|
+
}: Props): KubbReactNode;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Faker as t };
|
|
27
|
+
//# sourceMappingURL=Faker-BMgoFj8b.d.ts.map
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import { ast } from "@kubb/core";
|
|
4
|
+
import { functionPrinter } from "@kubb/plugin-ts";
|
|
5
|
+
import { File, Function } from "@kubb/renderer-jsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
7
|
+
//#region ../../internals/utils/src/string.ts
|
|
8
|
+
/**
|
|
9
|
+
* Strips a single matching pair of `"..."`, `'...'`, or `` `...` `` from both ends of `text`.
|
|
10
|
+
* Returns the string unchanged when no balanced quote pair is found.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* trimQuotes('"hello"') // 'hello'
|
|
14
|
+
* trimQuotes('hello') // 'hello'
|
|
15
|
+
*/
|
|
16
|
+
function trimQuotes(text) {
|
|
17
|
+
if (text.length >= 2) {
|
|
18
|
+
const first = text[0];
|
|
19
|
+
const last = text[text.length - 1];
|
|
20
|
+
if (first === "\"" && last === "\"" || first === "'" && last === "'" || first === "`" && last === "`") return text.slice(1, -1);
|
|
21
|
+
}
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Escapes characters that are not allowed inside JS string literals.
|
|
26
|
+
* Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).
|
|
27
|
+
*
|
|
28
|
+
* @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* jsStringEscape('say "hi"\nbye') // 'say \\"hi\\"\\nbye'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
function jsStringEscape(input) {
|
|
36
|
+
return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
|
|
37
|
+
switch (character) {
|
|
38
|
+
case "\"":
|
|
39
|
+
case "'":
|
|
40
|
+
case "\\": return `\\${character}`;
|
|
41
|
+
case "\n": return "\\n";
|
|
42
|
+
case "\r": return "\\r";
|
|
43
|
+
case "\u2028": return "\\u2028";
|
|
44
|
+
case "\u2029": return "\\u2029";
|
|
45
|
+
default: return "";
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/utils.ts
|
|
51
|
+
/**
|
|
52
|
+
* Returns the `@faker-js/faker` named export for a locale code.
|
|
53
|
+
*
|
|
54
|
+
* Without a locale, returns `'faker'` for the default English instance.
|
|
55
|
+
* With a locale, the language code is converted to upper case and joined with any region suffix.
|
|
56
|
+
*
|
|
57
|
+
* @example Default
|
|
58
|
+
* `localeToFakerImport() // 'faker'`
|
|
59
|
+
*
|
|
60
|
+
* @example Simple locale
|
|
61
|
+
* `localeToFakerImport('de') // 'fakerDE'`
|
|
62
|
+
*
|
|
63
|
+
* @example Compound locale
|
|
64
|
+
* `localeToFakerImport('de_AT') // 'fakerDE_AT'`
|
|
65
|
+
*/
|
|
66
|
+
function localeToFakerImport(locale) {
|
|
67
|
+
if (!locale) return "faker";
|
|
68
|
+
const parts = locale.split("_");
|
|
69
|
+
parts[0] = parts[0].toUpperCase();
|
|
70
|
+
return `faker${parts.join("_")}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Determines if a schema node can be overridden during faker generation.
|
|
74
|
+
*/
|
|
75
|
+
function canOverrideSchema(node) {
|
|
76
|
+
return new Set([
|
|
77
|
+
"array",
|
|
78
|
+
"tuple",
|
|
79
|
+
"object",
|
|
80
|
+
"intersection",
|
|
81
|
+
"union",
|
|
82
|
+
"enum",
|
|
83
|
+
"ref",
|
|
84
|
+
"string",
|
|
85
|
+
"email",
|
|
86
|
+
"url",
|
|
87
|
+
"uuid",
|
|
88
|
+
"number",
|
|
89
|
+
"integer",
|
|
90
|
+
"bigint",
|
|
91
|
+
"boolean",
|
|
92
|
+
"date",
|
|
93
|
+
"time",
|
|
94
|
+
"datetime",
|
|
95
|
+
"blob"
|
|
96
|
+
]).has(node.type);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a schema reference by looking up the referenced schema in the provided array.
|
|
100
|
+
* Returns the original node if it's not a reference.
|
|
101
|
+
*/
|
|
102
|
+
function resolveSchemaRef(node, schemas) {
|
|
103
|
+
if (node.type !== "ref") return node;
|
|
104
|
+
return schemas.find((schema) => schema.name === node.name && schema.type !== "ref") ?? node;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolves a parameter name based on its location (path, query, header, etc.) using the provided resolver.
|
|
108
|
+
*/
|
|
109
|
+
function resolveParamNameByLocation(resolver, node, param) {
|
|
110
|
+
switch (param.in) {
|
|
111
|
+
case "path": return resolver.resolvePathParamsName(node, param);
|
|
112
|
+
case "query": return resolver.resolveQueryParamsName(node, param);
|
|
113
|
+
case "header": return resolver.resolveHeaderParamsName(node, param);
|
|
114
|
+
default: return resolver.resolveParamName(node, param);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function shouldInlineSingleResponseSchema(schema) {
|
|
118
|
+
return new Set([
|
|
119
|
+
"any",
|
|
120
|
+
"unknown",
|
|
121
|
+
"void",
|
|
122
|
+
"null",
|
|
123
|
+
"array",
|
|
124
|
+
"tuple",
|
|
125
|
+
"string",
|
|
126
|
+
"email",
|
|
127
|
+
"url",
|
|
128
|
+
"uuid",
|
|
129
|
+
"number",
|
|
130
|
+
"integer",
|
|
131
|
+
"bigint",
|
|
132
|
+
"boolean",
|
|
133
|
+
"date",
|
|
134
|
+
"time",
|
|
135
|
+
"datetime",
|
|
136
|
+
"blob",
|
|
137
|
+
"enum",
|
|
138
|
+
"union"
|
|
139
|
+
]).has(schema.type);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Builds a response schema as a union of all response statuses.
|
|
143
|
+
* Returns null if no responses are provided, or embeds single simple responses inline.
|
|
144
|
+
*/
|
|
145
|
+
function buildResponseUnionSchema(node, resolver) {
|
|
146
|
+
const responses = node.responses.filter((response) => response.schema);
|
|
147
|
+
if (!responses.length) return null;
|
|
148
|
+
if (responses.length === 1) {
|
|
149
|
+
if (shouldInlineSingleResponseSchema(responses[0].schema)) return responses[0].schema;
|
|
150
|
+
return ast.createSchema({
|
|
151
|
+
type: "ref",
|
|
152
|
+
name: resolver.resolveResponseStatusName(node, responses[0].statusCode)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return ast.createSchema({
|
|
156
|
+
type: "union",
|
|
157
|
+
members: responses.map((response) => ast.createSchema({
|
|
158
|
+
type: "ref",
|
|
159
|
+
name: resolver.resolveResponseStatusName(node, response.statusCode)
|
|
160
|
+
}))
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const SCALAR_TYPES$1 = new Set([
|
|
164
|
+
"string",
|
|
165
|
+
"email",
|
|
166
|
+
"url",
|
|
167
|
+
"uuid",
|
|
168
|
+
"number",
|
|
169
|
+
"integer",
|
|
170
|
+
"bigint",
|
|
171
|
+
"boolean",
|
|
172
|
+
"date",
|
|
173
|
+
"time",
|
|
174
|
+
"datetime",
|
|
175
|
+
"blob",
|
|
176
|
+
"enum"
|
|
177
|
+
]);
|
|
178
|
+
const ARRAY_TYPES$1 = new Set(["array"]);
|
|
179
|
+
function toRelativeImportPath(from, to) {
|
|
180
|
+
const relativePath = posix.relative(posix.dirname(from), to);
|
|
181
|
+
return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Resolves a type reference, determining if it needs an import statement or inline type reference.
|
|
185
|
+
* Takes into account whether the type can be overridden and the file paths.
|
|
186
|
+
*/
|
|
187
|
+
function resolveTypeReference({ node, canOverride, name, typeName, filePath, typeFilePath }) {
|
|
188
|
+
const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
189
|
+
if (!usesTypeName) return { typeName };
|
|
190
|
+
if (name === typeName) return { typeName: `import('${toRelativeImportPath(filePath, typeFilePath)}').${typeName}` };
|
|
191
|
+
return {
|
|
192
|
+
importPath: typeFilePath,
|
|
193
|
+
typeName
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Maps a schema node type to its corresponding scalar type representation.
|
|
198
|
+
* Returns the type name for enums or the base type (string, number, etc.) for primitives.
|
|
199
|
+
*/
|
|
200
|
+
function getScalarType(node, typeName) {
|
|
201
|
+
switch (node.type) {
|
|
202
|
+
case "string":
|
|
203
|
+
case "email":
|
|
204
|
+
case "url":
|
|
205
|
+
case "uuid": return "string";
|
|
206
|
+
case "number":
|
|
207
|
+
case "integer": return "number";
|
|
208
|
+
case "bigint": return "bigint";
|
|
209
|
+
case "boolean": return "boolean";
|
|
210
|
+
case "date":
|
|
211
|
+
case "time": return node.representation === "date" ? "Date" : "string";
|
|
212
|
+
case "datetime": return "string";
|
|
213
|
+
case "blob": return "Blob";
|
|
214
|
+
case "enum": return typeName;
|
|
215
|
+
default: return typeName;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Resolves faker type usage information for a schema.
|
|
220
|
+
* Determines the data type, return type, and whether it uses the type name.
|
|
221
|
+
*/
|
|
222
|
+
function resolveFakerTypeUsage(node, typeName, canOverride) {
|
|
223
|
+
const isArray = ARRAY_TYPES$1.has(node.type);
|
|
224
|
+
const isTuple = node.type === "tuple";
|
|
225
|
+
const isScalar = SCALAR_TYPES$1.has(node.type);
|
|
226
|
+
let dataType = `Partial<${typeName}>`;
|
|
227
|
+
if (isArray || isTuple || node.type === "union" || node.type === "enum") dataType = typeName;
|
|
228
|
+
if (isScalar) dataType = getScalarType(node, typeName);
|
|
229
|
+
let returnType = canOverride ? typeName : void 0;
|
|
230
|
+
if (isScalar) returnType = getScalarType(node, typeName);
|
|
231
|
+
return {
|
|
232
|
+
dataType,
|
|
233
|
+
returnType,
|
|
234
|
+
usesTypeName: dataType.includes(typeName) || Boolean(returnType?.includes(typeName))
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/components/Faker.tsx
|
|
239
|
+
const OBJECT_TYPES = new Set(["object", "intersection"]);
|
|
240
|
+
const ARRAY_TYPES = new Set(["array"]);
|
|
241
|
+
const SCALAR_TYPES = new Set([
|
|
242
|
+
"string",
|
|
243
|
+
"email",
|
|
244
|
+
"url",
|
|
245
|
+
"uuid",
|
|
246
|
+
"number",
|
|
247
|
+
"integer",
|
|
248
|
+
"bigint",
|
|
249
|
+
"boolean",
|
|
250
|
+
"date",
|
|
251
|
+
"time",
|
|
252
|
+
"datetime",
|
|
253
|
+
"blob",
|
|
254
|
+
"enum"
|
|
255
|
+
]);
|
|
256
|
+
const declarationPrinter = functionPrinter({ mode: "declaration" });
|
|
257
|
+
function Faker({ node, description, name, typeName, printer, seed, canOverride }) {
|
|
258
|
+
const fakerText = printer.print(node) ?? "undefined";
|
|
259
|
+
const isArray = ARRAY_TYPES.has(node.type);
|
|
260
|
+
const isObject = OBJECT_TYPES.has(node.type);
|
|
261
|
+
const isTuple = node.type === "tuple";
|
|
262
|
+
const isScalar = SCALAR_TYPES.has(node.type);
|
|
263
|
+
let fakerTextWithOverride = fakerText;
|
|
264
|
+
let useGenericOverride = false;
|
|
265
|
+
if (canOverride && isObject) useGenericOverride = true;
|
|
266
|
+
if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`;
|
|
267
|
+
if (canOverride && isArray) fakerTextWithOverride = `[
|
|
268
|
+
...${fakerText},
|
|
269
|
+
...(data || [])
|
|
270
|
+
]`;
|
|
271
|
+
if (canOverride && isScalar) fakerTextWithOverride = `data ?? ${fakerText}`;
|
|
272
|
+
const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride);
|
|
273
|
+
let functionSignature = "";
|
|
274
|
+
let functionBody = "";
|
|
275
|
+
if (useGenericOverride) {
|
|
276
|
+
functionSignature = `${description ? `/**\n * @description ${jsStringEscape(description)}\n */\n ` : ""}export function ${name}(data?: Partial<${typeName}>): Required<${typeName}>`;
|
|
277
|
+
const seedCode = seed ? `faker.seed(${JSON.stringify(seed)})\n ` : "";
|
|
278
|
+
const { cyclicSchemas, schemaName } = printer.options;
|
|
279
|
+
if (node.type === "object" && !!cyclicSchemas && (node.properties ?? []).some((p) => ast.containsCircularRef(p.schema, {
|
|
280
|
+
circularSchemas: cyclicSchemas,
|
|
281
|
+
excludeName: schemaName
|
|
282
|
+
}))) functionBody = `{
|
|
283
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
284
|
+
if (data) {
|
|
285
|
+
for (const [key, value] of Object.entries(data)) {
|
|
286
|
+
Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return defaultFakeData as Required<${typeName}>
|
|
290
|
+
}`;
|
|
291
|
+
else functionBody = `{
|
|
292
|
+
${seedCode}const defaultFakeData = ${fakerText}
|
|
293
|
+
return {
|
|
294
|
+
...defaultFakeData,
|
|
295
|
+
...(data || {}),
|
|
296
|
+
} as Required<${typeName}>
|
|
297
|
+
}`;
|
|
298
|
+
} else {
|
|
299
|
+
const dataParamName = /\bdata\b/.test(fakerTextWithOverride) ? "data" : "_data";
|
|
300
|
+
const params = ast.createFunctionParameters({ params: [ast.createFunctionParameter({
|
|
301
|
+
name: dataParamName,
|
|
302
|
+
type: ast.createParamsType({
|
|
303
|
+
variant: "reference",
|
|
304
|
+
name: dataType
|
|
305
|
+
}),
|
|
306
|
+
optional: true
|
|
307
|
+
})] });
|
|
308
|
+
const paramsSignature = declarationPrinter.print(params) ?? "";
|
|
309
|
+
const returnType = resolvedReturnType;
|
|
310
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
311
|
+
name,
|
|
312
|
+
isExportable: true,
|
|
313
|
+
isIndexable: true,
|
|
314
|
+
children: /* @__PURE__ */ jsxs(Function, {
|
|
315
|
+
export: true,
|
|
316
|
+
name,
|
|
317
|
+
JSDoc: { comments: description ? [`@description ${jsStringEscape(description)}`] : [] },
|
|
318
|
+
params: canOverride ? paramsSignature : void 0,
|
|
319
|
+
returnType,
|
|
320
|
+
children: [seed ? /* @__PURE__ */ jsxs(Fragment, { children: [`faker.seed(${JSON.stringify(seed)})`, /* @__PURE__ */ jsx("br", {})] }) : void 0, `return ${fakerTextWithOverride}`]
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return /* @__PURE__ */ jsxs(File.Source, {
|
|
325
|
+
name,
|
|
326
|
+
isExportable: true,
|
|
327
|
+
isIndexable: true,
|
|
328
|
+
children: [functionSignature, functionBody]
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
export { resolveParamNameByLocation as a, trimQuotes as c, localeToFakerImport as i, buildResponseUnionSchema as n, resolveSchemaRef as o, canOverrideSchema as r, resolveTypeReference as s, Faker as t };
|
|
333
|
+
|
|
334
|
+
//# sourceMappingURL=Faker-CWtonujy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Faker-CWtonujy.js","names":["SCALAR_TYPES","ARRAY_TYPES"],"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;;;;;;;;;;;;;;;;;;;AC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