@kubb/plugin-faker 4.18.3 → 4.18.5
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/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-9jHhHEc_.d.ts → types-Dbb5nozm.d.ts} +69 -62
- package/dist/{types-BbUEWsa-.d.cts → types-DyfT4xCq.d.cts} +69 -62
- package/package.json +6 -6
- package/src/types.ts +20 -16
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { i as Schema, n as PluginFaker } from "./types-
|
|
2
|
+
import { i as Schema, n as PluginFaker } from "./types-Dbb5nozm.js";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Faker.d.ts
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginFaker, o as __name, r as ReactGenerator } from "./types-
|
|
1
|
+
import { n as PluginFaker, o as __name, r as ReactGenerator } from "./types-DyfT4xCq.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/fakerGenerator.d.ts
|
|
4
4
|
declare const fakerGenerator: ReactGenerator<PluginFaker>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as PluginFaker, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginFaker, r as ReactGenerator } from "./types-Dbb5nozm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/fakerGenerator.d.ts
|
|
5
5
|
declare const fakerGenerator: ReactGenerator<PluginFaker>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, o as __name, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, o as __name, t as Options } from "./types-DyfT4xCq.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginFakerName = "plugin-faker";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-
|
|
2
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-Dbb5nozm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginFakerName = "plugin-faker";
|
|
@@ -305,7 +305,7 @@ type Config<TInput = Input> = {
|
|
|
305
305
|
input: TInput;
|
|
306
306
|
output: {
|
|
307
307
|
/**
|
|
308
|
-
* The path where all generated files
|
|
308
|
+
* The path where all generated files receives exported.
|
|
309
309
|
* This can be an absolute path or a path relative to the specified root option.
|
|
310
310
|
*/
|
|
311
311
|
path: string;
|
|
@@ -320,41 +320,39 @@ type Config<TInput = Input> = {
|
|
|
320
320
|
write?: boolean;
|
|
321
321
|
/**
|
|
322
322
|
* Specifies the formatting tool to be used.
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* - '
|
|
327
|
-
* -
|
|
328
|
-
*
|
|
329
|
-
*
|
|
323
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
324
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
325
|
+
* - 'biome' uses Biome for code formatting.
|
|
326
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
327
|
+
* - false disables code formatting.
|
|
328
|
+
* @default 'prettier'
|
|
330
329
|
*/
|
|
331
330
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
332
331
|
/**
|
|
333
332
|
* Specifies the linter that should be used to analyze the code.
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
* - '
|
|
338
|
-
* -
|
|
339
|
-
*
|
|
340
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
341
|
-
*
|
|
333
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
334
|
+
* - 'eslint' uses ESLint for linting.
|
|
335
|
+
* - 'biome' uses Biome for linting.
|
|
336
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
337
|
+
* - false disables linting.
|
|
338
|
+
* @default 'auto'
|
|
342
339
|
*/
|
|
343
340
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
344
341
|
/**
|
|
345
|
-
*
|
|
342
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
346
343
|
* @default { '.ts': '.ts'}
|
|
347
344
|
*/
|
|
348
345
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
349
346
|
/**
|
|
350
|
-
*
|
|
347
|
+
* Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
|
|
351
348
|
* @default 'named'
|
|
352
349
|
*/
|
|
353
350
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
354
351
|
/**
|
|
355
|
-
*
|
|
356
|
-
* - 'simple'
|
|
357
|
-
* - 'full'
|
|
352
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
353
|
+
* - 'simple' adds banner with link to Kubb.
|
|
354
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
355
|
+
* - false disables banner generation.
|
|
358
356
|
* @default 'simple'
|
|
359
357
|
*/
|
|
360
358
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -367,17 +365,17 @@ type Config<TInput = Input> = {
|
|
|
367
365
|
override?: boolean;
|
|
368
366
|
};
|
|
369
367
|
/**
|
|
370
|
-
* An array of Kubb plugins that
|
|
368
|
+
* An array of Kubb plugins that used in the generation.
|
|
371
369
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
372
|
-
* If a plugin depends on another plugin, an error
|
|
370
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
373
371
|
*/
|
|
374
372
|
plugins?: Array<Plugin>;
|
|
375
373
|
/**
|
|
376
|
-
* Hooks
|
|
374
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
377
375
|
*/
|
|
378
376
|
hooks?: {
|
|
379
377
|
/**
|
|
380
|
-
* Hook that
|
|
378
|
+
* Hook that triggers at the end of all executions.
|
|
381
379
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
382
380
|
*/
|
|
383
381
|
done?: string | Array<string>;
|
|
@@ -406,7 +404,7 @@ TContext = any,
|
|
|
406
404
|
TResolvePathOptions extends object = object> = {
|
|
407
405
|
name: TName;
|
|
408
406
|
/**
|
|
409
|
-
* Same
|
|
407
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
410
408
|
*/
|
|
411
409
|
key: PluginKey<TName | string>;
|
|
412
410
|
options: TOptions;
|
|
@@ -427,12 +425,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
427
425
|
*/
|
|
428
426
|
options: TOptions['resolvedOptions'];
|
|
429
427
|
/**
|
|
430
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
428
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
431
429
|
* Can be used to validate dependent plugins.
|
|
432
430
|
*/
|
|
433
431
|
pre?: Array<string>;
|
|
434
432
|
/**
|
|
435
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
433
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
436
434
|
*/
|
|
437
435
|
post?: Array<string>;
|
|
438
436
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -450,12 +448,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
450
448
|
*/
|
|
451
449
|
key: TOptions['key'];
|
|
452
450
|
/**
|
|
453
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
451
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
454
452
|
* Can be used to validate dependent plugins.
|
|
455
453
|
*/
|
|
456
454
|
pre?: Array<string>;
|
|
457
455
|
/**
|
|
458
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
456
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
459
457
|
*/
|
|
460
458
|
post?: Array<string>;
|
|
461
459
|
/**
|
|
@@ -505,10 +503,12 @@ type ResolveNameParams = {
|
|
|
505
503
|
name: string;
|
|
506
504
|
pluginKey?: Plugin['key'];
|
|
507
505
|
/**
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
506
|
+
* Specifies the type of entity being named.
|
|
507
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
508
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
509
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
510
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
511
|
+
* @default undefined
|
|
512
512
|
*/
|
|
513
513
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
514
514
|
};
|
|
@@ -563,11 +563,14 @@ type GroupContext = {
|
|
|
563
563
|
};
|
|
564
564
|
type Group = {
|
|
565
565
|
/**
|
|
566
|
-
*
|
|
566
|
+
* Defines the type where to group the files.
|
|
567
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
568
|
+
* - 'path' groups files by OpenAPI paths.
|
|
569
|
+
* @default undefined
|
|
567
570
|
*/
|
|
568
571
|
type: 'tag' | 'path';
|
|
569
572
|
/**
|
|
570
|
-
* Return the name of a group based on the group name, this
|
|
573
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
571
574
|
*/
|
|
572
575
|
name?: (context: GroupContext) => string;
|
|
573
576
|
};
|
|
@@ -639,7 +642,7 @@ declare class PluginManager {
|
|
|
639
642
|
parameters: PluginParameter<H>;
|
|
640
643
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
641
644
|
/**
|
|
642
|
-
*
|
|
645
|
+
* Returns the first non-null result.
|
|
643
646
|
*/
|
|
644
647
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
645
648
|
hookName,
|
|
@@ -651,7 +654,7 @@ declare class PluginManager {
|
|
|
651
654
|
skipped?: ReadonlySet<Plugin> | null;
|
|
652
655
|
}): Promise<SafeParseResult<H>>;
|
|
653
656
|
/**
|
|
654
|
-
*
|
|
657
|
+
* Returns the first non-null result.
|
|
655
658
|
*/
|
|
656
659
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
657
660
|
hookName,
|
|
@@ -663,15 +666,15 @@ declare class PluginManager {
|
|
|
663
666
|
skipped?: ReadonlySet<Plugin> | null;
|
|
664
667
|
}): SafeParseResult<H>;
|
|
665
668
|
/**
|
|
666
|
-
*
|
|
669
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
667
670
|
*/
|
|
668
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
671
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
669
672
|
hookName,
|
|
670
673
|
parameters
|
|
671
674
|
}: {
|
|
672
675
|
hookName: H;
|
|
673
676
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
674
|
-
}): Promise<Awaited<
|
|
677
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
675
678
|
/**
|
|
676
679
|
* Chains plugins
|
|
677
680
|
*/
|
|
@@ -721,7 +724,7 @@ declare class Oas extends BaseOas {
|
|
|
721
724
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
722
725
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
723
726
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
724
|
-
|
|
727
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
725
728
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
726
729
|
}
|
|
727
730
|
//#endregion
|
|
@@ -974,8 +977,8 @@ type SchemaKeywordMapper = {
|
|
|
974
977
|
*/
|
|
975
978
|
path: KubbFile.Path;
|
|
976
979
|
/**
|
|
977
|
-
* When true `File.Import`
|
|
978
|
-
* When false a reference
|
|
980
|
+
* When true `File.Import` is used.
|
|
981
|
+
* When false a reference is used inside the current file.
|
|
979
982
|
*/
|
|
980
983
|
isImportable: boolean;
|
|
981
984
|
};
|
|
@@ -1107,7 +1110,7 @@ type SchemaGeneratorOptions = {
|
|
|
1107
1110
|
*/
|
|
1108
1111
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1109
1112
|
/**
|
|
1110
|
-
* Receive schema and name(
|
|
1113
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1111
1114
|
* TODO TODO add docs
|
|
1112
1115
|
* @beta
|
|
1113
1116
|
*/
|
|
@@ -1186,7 +1189,7 @@ type Options = {
|
|
|
1186
1189
|
output?: Output<Oas>;
|
|
1187
1190
|
/**
|
|
1188
1191
|
* Define which contentType should be used.
|
|
1189
|
-
* By default, the first JSON valid mediaType
|
|
1192
|
+
* By default, the first JSON valid mediaType is used
|
|
1190
1193
|
*/
|
|
1191
1194
|
contentType?: contentType;
|
|
1192
1195
|
/**
|
|
@@ -1206,36 +1209,40 @@ type Options = {
|
|
|
1206
1209
|
*/
|
|
1207
1210
|
override?: Array<Override<ResolvedOptions>>;
|
|
1208
1211
|
/**
|
|
1209
|
-
* Choose to use
|
|
1212
|
+
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
1213
|
+
* - 'string' represents dates as string values.
|
|
1214
|
+
* - 'date' represents dates as JavaScript Date objects.
|
|
1210
1215
|
* @default 'string'
|
|
1211
1216
|
*/
|
|
1212
1217
|
dateType?: 'string' | 'date';
|
|
1213
1218
|
/**
|
|
1214
|
-
* Which parser should be used when dateType is set to
|
|
1215
|
-
* -
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
* - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
|
|
1220
|
-
* - `undefined` will use `faker.date.anytime().toString()`
|
|
1221
|
-
* * @default 'faker'
|
|
1219
|
+
* Which parser should be used when dateType is set to string.
|
|
1220
|
+
* - 'faker' uses faker's built-in date formatting methods.
|
|
1221
|
+
* - 'dayjs' uses dayjs for date formatting with custom patterns.
|
|
1222
|
+
* - 'moment' uses moment for date formatting with custom patterns.
|
|
1223
|
+
* @default 'faker'
|
|
1222
1224
|
*/
|
|
1223
1225
|
dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {});
|
|
1224
1226
|
/**
|
|
1225
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information
|
|
1227
|
+
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
1228
|
+
* - 'any' allows any value.
|
|
1229
|
+
* - 'unknown' requires type narrowing before use.
|
|
1230
|
+
* - 'void' represents no value.
|
|
1226
1231
|
* @default 'any'
|
|
1227
1232
|
*/
|
|
1228
1233
|
unknownType?: 'any' | 'unknown' | 'void';
|
|
1229
1234
|
/**
|
|
1230
|
-
* Which type to use for empty schema values
|
|
1235
|
+
* Which type to use for empty schema values.
|
|
1236
|
+
* - 'any' allows any value.
|
|
1237
|
+
* - 'unknown' requires type narrowing before use.
|
|
1238
|
+
* - 'void' represents no value.
|
|
1231
1239
|
* @default `unknownType`
|
|
1232
1240
|
*/
|
|
1233
1241
|
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
1234
1242
|
/**
|
|
1235
1243
|
* Choose which generator to use when using Regexp.
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
* `'randexp'` will use `new RandExp(/test/).gen()`
|
|
1244
|
+
* - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
|
|
1245
|
+
* - 'randexp' uses RandExp library for generating values from regex patterns.
|
|
1239
1246
|
* @default 'faker'
|
|
1240
1247
|
*/
|
|
1241
1248
|
regexGenerator?: 'faker' | 'randexp';
|
|
@@ -1250,7 +1257,7 @@ type Options = {
|
|
|
1250
1257
|
*/
|
|
1251
1258
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1252
1259
|
/**
|
|
1253
|
-
* Receive schema and baseName(
|
|
1260
|
+
* Receive schema and baseName(propertyName) and return FakerMeta array
|
|
1254
1261
|
* TODO TODO add docs
|
|
1255
1262
|
* @beta
|
|
1256
1263
|
*/
|
|
@@ -1281,4 +1288,4 @@ type ResolvedOptions = {
|
|
|
1281
1288
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1282
1289
|
//#endregion
|
|
1283
1290
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options as t };
|
|
1284
|
-
//# sourceMappingURL=types-
|
|
1291
|
+
//# sourceMappingURL=types-Dbb5nozm.d.ts.map
|
|
@@ -306,7 +306,7 @@ type Config<TInput = Input> = {
|
|
|
306
306
|
input: TInput;
|
|
307
307
|
output: {
|
|
308
308
|
/**
|
|
309
|
-
* The path where all generated files
|
|
309
|
+
* The path where all generated files receives exported.
|
|
310
310
|
* This can be an absolute path or a path relative to the specified root option.
|
|
311
311
|
*/
|
|
312
312
|
path: string;
|
|
@@ -321,41 +321,39 @@ type Config<TInput = Input> = {
|
|
|
321
321
|
write?: boolean;
|
|
322
322
|
/**
|
|
323
323
|
* Specifies the formatting tool to be used.
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* - '
|
|
328
|
-
* -
|
|
329
|
-
*
|
|
330
|
-
*
|
|
324
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
325
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
326
|
+
* - 'biome' uses Biome for code formatting.
|
|
327
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
328
|
+
* - false disables code formatting.
|
|
329
|
+
* @default 'prettier'
|
|
331
330
|
*/
|
|
332
331
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
333
332
|
/**
|
|
334
333
|
* Specifies the linter that should be used to analyze the code.
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* - '
|
|
339
|
-
* -
|
|
340
|
-
*
|
|
341
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
342
|
-
*
|
|
334
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
335
|
+
* - 'eslint' uses ESLint for linting.
|
|
336
|
+
* - 'biome' uses Biome for linting.
|
|
337
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
338
|
+
* - false disables linting.
|
|
339
|
+
* @default 'auto'
|
|
343
340
|
*/
|
|
344
341
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
345
342
|
/**
|
|
346
|
-
*
|
|
343
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
347
344
|
* @default { '.ts': '.ts'}
|
|
348
345
|
*/
|
|
349
346
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
350
347
|
/**
|
|
351
|
-
*
|
|
348
|
+
* Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
|
|
352
349
|
* @default 'named'
|
|
353
350
|
*/
|
|
354
351
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
355
352
|
/**
|
|
356
|
-
*
|
|
357
|
-
* - 'simple'
|
|
358
|
-
* - 'full'
|
|
353
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
354
|
+
* - 'simple' adds banner with link to Kubb.
|
|
355
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
356
|
+
* - false disables banner generation.
|
|
359
357
|
* @default 'simple'
|
|
360
358
|
*/
|
|
361
359
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -368,17 +366,17 @@ type Config<TInput = Input> = {
|
|
|
368
366
|
override?: boolean;
|
|
369
367
|
};
|
|
370
368
|
/**
|
|
371
|
-
* An array of Kubb plugins that
|
|
369
|
+
* An array of Kubb plugins that used in the generation.
|
|
372
370
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
373
|
-
* If a plugin depends on another plugin, an error
|
|
371
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
374
372
|
*/
|
|
375
373
|
plugins?: Array<Plugin>;
|
|
376
374
|
/**
|
|
377
|
-
* Hooks
|
|
375
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
378
376
|
*/
|
|
379
377
|
hooks?: {
|
|
380
378
|
/**
|
|
381
|
-
* Hook that
|
|
379
|
+
* Hook that triggers at the end of all executions.
|
|
382
380
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
383
381
|
*/
|
|
384
382
|
done?: string | Array<string>;
|
|
@@ -407,7 +405,7 @@ TContext = any,
|
|
|
407
405
|
TResolvePathOptions extends object = object> = {
|
|
408
406
|
name: TName;
|
|
409
407
|
/**
|
|
410
|
-
* Same
|
|
408
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
411
409
|
*/
|
|
412
410
|
key: PluginKey<TName | string>;
|
|
413
411
|
options: TOptions;
|
|
@@ -428,12 +426,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
428
426
|
*/
|
|
429
427
|
options: TOptions['resolvedOptions'];
|
|
430
428
|
/**
|
|
431
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
429
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
432
430
|
* Can be used to validate dependent plugins.
|
|
433
431
|
*/
|
|
434
432
|
pre?: Array<string>;
|
|
435
433
|
/**
|
|
436
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
434
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
437
435
|
*/
|
|
438
436
|
post?: Array<string>;
|
|
439
437
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -451,12 +449,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
451
449
|
*/
|
|
452
450
|
key: TOptions['key'];
|
|
453
451
|
/**
|
|
454
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
452
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
455
453
|
* Can be used to validate dependent plugins.
|
|
456
454
|
*/
|
|
457
455
|
pre?: Array<string>;
|
|
458
456
|
/**
|
|
459
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
457
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
460
458
|
*/
|
|
461
459
|
post?: Array<string>;
|
|
462
460
|
/**
|
|
@@ -506,10 +504,12 @@ type ResolveNameParams = {
|
|
|
506
504
|
name: string;
|
|
507
505
|
pluginKey?: Plugin['key'];
|
|
508
506
|
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
507
|
+
* Specifies the type of entity being named.
|
|
508
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
509
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
510
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
511
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
512
|
+
* @default undefined
|
|
513
513
|
*/
|
|
514
514
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
515
515
|
};
|
|
@@ -564,11 +564,14 @@ type GroupContext = {
|
|
|
564
564
|
};
|
|
565
565
|
type Group = {
|
|
566
566
|
/**
|
|
567
|
-
*
|
|
567
|
+
* Defines the type where to group the files.
|
|
568
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
569
|
+
* - 'path' groups files by OpenAPI paths.
|
|
570
|
+
* @default undefined
|
|
568
571
|
*/
|
|
569
572
|
type: 'tag' | 'path';
|
|
570
573
|
/**
|
|
571
|
-
* Return the name of a group based on the group name, this
|
|
574
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
572
575
|
*/
|
|
573
576
|
name?: (context: GroupContext) => string;
|
|
574
577
|
};
|
|
@@ -640,7 +643,7 @@ declare class PluginManager {
|
|
|
640
643
|
parameters: PluginParameter<H>;
|
|
641
644
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
642
645
|
/**
|
|
643
|
-
*
|
|
646
|
+
* Returns the first non-null result.
|
|
644
647
|
*/
|
|
645
648
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
646
649
|
hookName,
|
|
@@ -652,7 +655,7 @@ declare class PluginManager {
|
|
|
652
655
|
skipped?: ReadonlySet<Plugin> | null;
|
|
653
656
|
}): Promise<SafeParseResult<H>>;
|
|
654
657
|
/**
|
|
655
|
-
*
|
|
658
|
+
* Returns the first non-null result.
|
|
656
659
|
*/
|
|
657
660
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
658
661
|
hookName,
|
|
@@ -664,15 +667,15 @@ declare class PluginManager {
|
|
|
664
667
|
skipped?: ReadonlySet<Plugin> | null;
|
|
665
668
|
}): SafeParseResult<H>;
|
|
666
669
|
/**
|
|
667
|
-
*
|
|
670
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
668
671
|
*/
|
|
669
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
672
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
670
673
|
hookName,
|
|
671
674
|
parameters
|
|
672
675
|
}: {
|
|
673
676
|
hookName: H;
|
|
674
677
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
675
|
-
}): Promise<Awaited<
|
|
678
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
676
679
|
/**
|
|
677
680
|
* Chains plugins
|
|
678
681
|
*/
|
|
@@ -722,7 +725,7 @@ declare class Oas extends BaseOas {
|
|
|
722
725
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
723
726
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
724
727
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
725
|
-
|
|
728
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
726
729
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
727
730
|
}
|
|
728
731
|
//#endregion
|
|
@@ -975,8 +978,8 @@ type SchemaKeywordMapper = {
|
|
|
975
978
|
*/
|
|
976
979
|
path: KubbFile.Path;
|
|
977
980
|
/**
|
|
978
|
-
* When true `File.Import`
|
|
979
|
-
* When false a reference
|
|
981
|
+
* When true `File.Import` is used.
|
|
982
|
+
* When false a reference is used inside the current file.
|
|
980
983
|
*/
|
|
981
984
|
isImportable: boolean;
|
|
982
985
|
};
|
|
@@ -1108,7 +1111,7 @@ type SchemaGeneratorOptions = {
|
|
|
1108
1111
|
*/
|
|
1109
1112
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1110
1113
|
/**
|
|
1111
|
-
* Receive schema and name(
|
|
1114
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1112
1115
|
* TODO TODO add docs
|
|
1113
1116
|
* @beta
|
|
1114
1117
|
*/
|
|
@@ -1187,7 +1190,7 @@ type Options = {
|
|
|
1187
1190
|
output?: Output<Oas>;
|
|
1188
1191
|
/**
|
|
1189
1192
|
* Define which contentType should be used.
|
|
1190
|
-
* By default, the first JSON valid mediaType
|
|
1193
|
+
* By default, the first JSON valid mediaType is used
|
|
1191
1194
|
*/
|
|
1192
1195
|
contentType?: contentType;
|
|
1193
1196
|
/**
|
|
@@ -1207,36 +1210,40 @@ type Options = {
|
|
|
1207
1210
|
*/
|
|
1208
1211
|
override?: Array<Override<ResolvedOptions>>;
|
|
1209
1212
|
/**
|
|
1210
|
-
* Choose to use
|
|
1213
|
+
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
1214
|
+
* - 'string' represents dates as string values.
|
|
1215
|
+
* - 'date' represents dates as JavaScript Date objects.
|
|
1211
1216
|
* @default 'string'
|
|
1212
1217
|
*/
|
|
1213
1218
|
dateType?: 'string' | 'date';
|
|
1214
1219
|
/**
|
|
1215
|
-
* Which parser should be used when dateType is set to
|
|
1216
|
-
* -
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
* - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
|
|
1221
|
-
* - `undefined` will use `faker.date.anytime().toString()`
|
|
1222
|
-
* * @default 'faker'
|
|
1220
|
+
* Which parser should be used when dateType is set to string.
|
|
1221
|
+
* - 'faker' uses faker's built-in date formatting methods.
|
|
1222
|
+
* - 'dayjs' uses dayjs for date formatting with custom patterns.
|
|
1223
|
+
* - 'moment' uses moment for date formatting with custom patterns.
|
|
1224
|
+
* @default 'faker'
|
|
1223
1225
|
*/
|
|
1224
1226
|
dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {});
|
|
1225
1227
|
/**
|
|
1226
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information
|
|
1228
|
+
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
1229
|
+
* - 'any' allows any value.
|
|
1230
|
+
* - 'unknown' requires type narrowing before use.
|
|
1231
|
+
* - 'void' represents no value.
|
|
1227
1232
|
* @default 'any'
|
|
1228
1233
|
*/
|
|
1229
1234
|
unknownType?: 'any' | 'unknown' | 'void';
|
|
1230
1235
|
/**
|
|
1231
|
-
* Which type to use for empty schema values
|
|
1236
|
+
* Which type to use for empty schema values.
|
|
1237
|
+
* - 'any' allows any value.
|
|
1238
|
+
* - 'unknown' requires type narrowing before use.
|
|
1239
|
+
* - 'void' represents no value.
|
|
1232
1240
|
* @default `unknownType`
|
|
1233
1241
|
*/
|
|
1234
1242
|
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
1235
1243
|
/**
|
|
1236
1244
|
* Choose which generator to use when using Regexp.
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* `'randexp'` will use `new RandExp(/test/).gen()`
|
|
1245
|
+
* - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
|
|
1246
|
+
* - 'randexp' uses RandExp library for generating values from regex patterns.
|
|
1240
1247
|
* @default 'faker'
|
|
1241
1248
|
*/
|
|
1242
1249
|
regexGenerator?: 'faker' | 'randexp';
|
|
@@ -1251,7 +1258,7 @@ type Options = {
|
|
|
1251
1258
|
*/
|
|
1252
1259
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1253
1260
|
/**
|
|
1254
|
-
* Receive schema and baseName(
|
|
1261
|
+
* Receive schema and baseName(propertyName) and return FakerMeta array
|
|
1255
1262
|
* TODO TODO add docs
|
|
1256
1263
|
* @beta
|
|
1257
1264
|
*/
|
|
@@ -1282,4 +1289,4 @@ type ResolvedOptions = {
|
|
|
1282
1289
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1283
1290
|
//#endregion
|
|
1284
1291
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, __name as o, ReactGenerator as r, Options as t };
|
|
1285
|
-
//# sourceMappingURL=types-
|
|
1292
|
+
//# sourceMappingURL=types-DyfT4xCq.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.5",
|
|
4
4
|
"description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@kubb/react-fabric": "0.
|
|
72
|
-
"@kubb/core": "4.18.
|
|
73
|
-
"@kubb/oas": "4.18.
|
|
74
|
-
"@kubb/plugin-oas": "4.18.
|
|
75
|
-
"@kubb/plugin-ts": "4.18.
|
|
71
|
+
"@kubb/react-fabric": "0.12.4",
|
|
72
|
+
"@kubb/core": "4.18.5",
|
|
73
|
+
"@kubb/oas": "4.18.5",
|
|
74
|
+
"@kubb/plugin-oas": "4.18.5",
|
|
75
|
+
"@kubb/plugin-ts": "4.18.5"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=20"
|
package/src/types.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type Options = {
|
|
|
12
12
|
output?: Output<Oas>
|
|
13
13
|
/**
|
|
14
14
|
* Define which contentType should be used.
|
|
15
|
-
* By default, the first JSON valid mediaType
|
|
15
|
+
* By default, the first JSON valid mediaType is used
|
|
16
16
|
*/
|
|
17
17
|
contentType?: contentType
|
|
18
18
|
/**
|
|
@@ -32,36 +32,40 @@ export type Options = {
|
|
|
32
32
|
*/
|
|
33
33
|
override?: Array<Override<ResolvedOptions>>
|
|
34
34
|
/**
|
|
35
|
-
* Choose to use
|
|
35
|
+
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
36
|
+
* - 'string' represents dates as string values.
|
|
37
|
+
* - 'date' represents dates as JavaScript Date objects.
|
|
36
38
|
* @default 'string'
|
|
37
39
|
*/
|
|
38
40
|
dateType?: 'string' | 'date'
|
|
39
41
|
/**
|
|
40
|
-
* Which parser should be used when dateType is set to
|
|
41
|
-
* -
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
|
|
46
|
-
* - `undefined` will use `faker.date.anytime().toString()`
|
|
47
|
-
* * @default 'faker'
|
|
42
|
+
* Which parser should be used when dateType is set to string.
|
|
43
|
+
* - 'faker' uses faker's built-in date formatting methods.
|
|
44
|
+
* - 'dayjs' uses dayjs for date formatting with custom patterns.
|
|
45
|
+
* - 'moment' uses moment for date formatting with custom patterns.
|
|
46
|
+
* @default 'faker'
|
|
48
47
|
*/
|
|
49
48
|
dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {})
|
|
50
49
|
/**
|
|
51
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information
|
|
50
|
+
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
51
|
+
* - 'any' allows any value.
|
|
52
|
+
* - 'unknown' requires type narrowing before use.
|
|
53
|
+
* - 'void' represents no value.
|
|
52
54
|
* @default 'any'
|
|
53
55
|
*/
|
|
54
56
|
unknownType?: 'any' | 'unknown' | 'void'
|
|
55
57
|
/**
|
|
56
|
-
* Which type to use for empty schema values
|
|
58
|
+
* Which type to use for empty schema values.
|
|
59
|
+
* - 'any' allows any value.
|
|
60
|
+
* - 'unknown' requires type narrowing before use.
|
|
61
|
+
* - 'void' represents no value.
|
|
57
62
|
* @default `unknownType`
|
|
58
63
|
*/
|
|
59
64
|
emptySchemaType?: 'any' | 'unknown' | 'void'
|
|
60
65
|
/**
|
|
61
66
|
* Choose which generator to use when using Regexp.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `'randexp'` will use `new RandExp(/test/).gen()`
|
|
67
|
+
* - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
|
|
68
|
+
* - 'randexp' uses RandExp library for generating values from regex patterns.
|
|
65
69
|
* @default 'faker'
|
|
66
70
|
*/
|
|
67
71
|
regexGenerator?: 'faker' | 'randexp'
|
|
@@ -77,7 +81,7 @@ export type Options = {
|
|
|
77
81
|
*/
|
|
78
82
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
|
|
79
83
|
/**
|
|
80
|
-
* Receive schema and baseName(
|
|
84
|
+
* Receive schema and baseName(propertyName) and return FakerMeta array
|
|
81
85
|
* TODO TODO add docs
|
|
82
86
|
* @beta
|
|
83
87
|
*/
|