@kubb/plugin-faker 0.0.0-canary-20251209191624 → 0.0.0-canary-20251217084347

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.
Files changed (34) hide show
  1. package/dist/{components-BP20Parg.cjs → components-CYQi2D8d.cjs} +183 -129
  2. package/dist/components-CYQi2D8d.cjs.map +1 -0
  3. package/dist/components-omV0ciEl.js +358 -0
  4. package/dist/components-omV0ciEl.js.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +1 -1
  7. package/dist/components.d.ts +1 -1
  8. package/dist/components.js +1 -1
  9. package/dist/{fakerGenerator-APLVZFNv.cjs → fakerGenerator-B7NcLOvg.cjs} +3 -2
  10. package/dist/fakerGenerator-B7NcLOvg.cjs.map +1 -0
  11. package/dist/{fakerGenerator-CgXklxYJ.js → fakerGenerator-wJgFsJ4k.js} +3 -2
  12. package/dist/fakerGenerator-wJgFsJ4k.js.map +1 -0
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +4 -2
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +3 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-DgJG4t24.d.ts → types-CZCTeVpk.d.cts} +62 -29
  24. package/dist/{types-B1FgdqYL.d.cts → types-CfzJF-pQ.d.ts} +62 -29
  25. package/package.json +6 -6
  26. package/src/generators/__snapshots__/getPets.ts +5 -2
  27. package/src/generators/fakerGenerator.tsx +1 -0
  28. package/src/parser.ts +212 -181
  29. package/src/plugin.ts +2 -0
  30. package/dist/components-BP20Parg.cjs.map +0 -1
  31. package/dist/components-DUQvu8JV.js +0 -304
  32. package/dist/components-DUQvu8JV.js.map +0 -1
  33. package/dist/fakerGenerator-APLVZFNv.cjs.map +0 -1
  34. package/dist/fakerGenerator-CgXklxYJ.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as fakerGenerator } from "./fakerGenerator-CgXklxYJ.js";
1
+ import { t as fakerGenerator } from "./fakerGenerator-wJgFsJ4k.js";
2
2
  import path from "node:path";
3
3
  import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
4
4
  import { camelCase } from "@kubb/core/transformers";
@@ -62,6 +62,7 @@ const pluginFaker = definePlugin((options) => {
62
62
  fabric: this.fabric,
63
63
  oas,
64
64
  pluginManager: this.pluginManager,
65
+ logger: this.logger,
65
66
  plugin: this.plugin,
66
67
  contentType,
67
68
  include: void 0,
@@ -74,6 +75,7 @@ const pluginFaker = definePlugin((options) => {
74
75
  fabric: this.fabric,
75
76
  oas,
76
77
  pluginManager: this.pluginManager,
78
+ logger: this.logger,
77
79
  plugin: this.plugin,
78
80
  contentType,
79
81
  exclude,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']","transformers"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = definePlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n contentType,\n } = options\n\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n options: {\n output,\n transformers,\n seed,\n dateType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n regexGenerator,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;AAQA,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,MACA,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,+BAAe,EAAE,EACjB,SAAS,EAAE,EACX,cAAc,OACd,kBAAkB,aAClB,WAAW,UACX,aAAa,SACb,aAAa,CAAC,eAAe,CAAC,OAAO,QAAQ,EAC7C,iBAAiB,SACjB,gBACE;AAIJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,eAhBkB,EAAE;GAiBrB;EACD,KAAK,CAAC,eAAe,aAAa;EAClC,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM;IACnC,QAAQ,OAAO,WAAW;IAC1B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAOE,gBAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAc/B,MAAM,cAAc,MAZI,IAAI,gBAAgB,KAAK,OAAO,SAAS;IAC/D,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA,SAAS;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAcrC,MAAM,iBAAiB,MAZI,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']","transformers"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = definePlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n contentType,\n } = options\n\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n options: {\n output,\n transformers,\n seed,\n dateType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n regexGenerator,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;AAQA,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,MACA,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,+BAAe,EAAE,EACjB,SAAS,EAAE,EACX,cAAc,OACd,kBAAkB,aAClB,WAAW,UACX,aAAa,SACb,aAAa,CAAC,eAAe,CAAC,OAAO,QAAQ,EAC7C,iBAAiB,SACjB,gBACE;AAIJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,eAhBkB,EAAE;GAiBrB;EACD,KAAK,CAAC,eAAe,aAAa;EAClC,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM;IACnC,QAAQ,OAAO,WAAW;IAC1B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAOE,gBAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,cAAc,MAbI,IAAI,gBAAgB,KAAK,OAAO,SAAS;IAC/D,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA,SAAS;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAerC,MAAM,iBAAiB,MAbI,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
@@ -1,5 +1,5 @@
1
- import { Fabric } from "@kubb/react-fabric";
2
1
  import { KubbFile } from "@kubb/fabric-core/types";
2
+ import { Fabric } from "@kubb/react-fabric";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
  import * as OasTypes from "oas/types";
5
5
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
@@ -38,13 +38,35 @@ type DebugEvent = {
38
38
  date: Date;
39
39
  logs: string[];
40
40
  fileName?: string;
41
+ /**
42
+ * Category of the debug log, used for GitHub Actions grouping
43
+ * - 'setup': Initial configuration and environment setup
44
+ * - 'plugin': Plugin installation and execution
45
+ * - 'hook': Plugin hook execution details
46
+ * - 'schema': Schema parsing and generation
47
+ * - 'file': File operations (read/write/generate)
48
+ * - 'error': Error details and stack traces
49
+ * - undefined: Generic logs (always inline)
50
+ */
51
+ category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
52
+ /**
53
+ * Plugin name for grouping plugin-specific logs together
54
+ */
55
+ pluginName?: string;
56
+ /**
57
+ * Indicates if this is the start or end of a plugin's execution
58
+ * - 'start': Start of plugin execution group
59
+ * - 'end': End of plugin execution group
60
+ */
61
+ pluginGroupMarker?: 'start' | 'end';
41
62
  };
42
63
  type Events$1 = {
43
64
  start: [message: string];
44
65
  success: [message: string];
45
- error: [message: string, cause: Error];
66
+ error: [message: string, error: Error];
46
67
  warning: [message: string];
47
68
  debug: [DebugEvent];
69
+ verbose: [DebugEvent];
48
70
  info: [message: string];
49
71
  progress_start: [{
50
72
  id: string;
@@ -68,7 +90,7 @@ type Logger = {
68
90
  consola?: ConsolaInstance;
69
91
  on: EventEmitter<Events$1>['on'];
70
92
  emit: EventEmitter<Events$1>['emit'];
71
- writeLogs: () => Promise<string[]>;
93
+ writeLogs: () => Promise<void>;
72
94
  };
73
95
  //#endregion
74
96
  //#region ../core/src/utils/types.d.ts
@@ -379,14 +401,35 @@ type Group = {
379
401
  //#region ../core/src/PluginManager.d.ts
380
402
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
381
403
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
382
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
383
- message: string;
404
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
405
+ strategy: Strategy;
406
+ hookName: H;
407
+ plugin: Plugin;
408
+ parameters?: unknown[] | undefined;
409
+ output?: unknown;
410
+ };
411
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
412
+ duration: number;
384
413
  strategy: Strategy;
385
414
  hookName: H;
386
415
  plugin: Plugin;
387
416
  parameters?: unknown[] | undefined;
388
417
  output?: unknown;
389
418
  };
419
+ type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
420
+ hookName: H;
421
+ duration: number;
422
+ strategy: Strategy;
423
+ parameters?: unknown[] | undefined;
424
+ plugin: Plugin;
425
+ };
426
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
427
+ hookName: H;
428
+ plugins: Array<Plugin>;
429
+ };
430
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
431
+ hookName: H;
432
+ };
390
433
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
391
434
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
392
435
  result: Result;
@@ -401,9 +444,11 @@ type Options$2 = {
401
444
  concurrency?: number;
402
445
  };
403
446
  type Events = {
404
- executing: [executer: Executer];
405
- executed: [executer: Executer];
406
- error: [error: Error];
447
+ progress_start: [meta: ProgressStartMeta];
448
+ progress_stop: [meta: ProgressStopMeta];
449
+ executing: [meta: ExecutingMeta];
450
+ executed: [meta: ExecutedMeta];
451
+ error: [error: Error, meta: ErrorMeta];
407
452
  };
408
453
  type GetFileProps<TOptions = object> = {
409
454
  name: string;
@@ -416,8 +461,6 @@ declare class PluginManager {
416
461
  #private;
417
462
  readonly events: EventEmitter<Events>;
418
463
  readonly config: Config;
419
- readonly executed: Array<Executer>;
420
- readonly logger: Logger;
421
464
  readonly options: Options$2;
422
465
  constructor(config: Config, options: Options$2);
423
466
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
@@ -443,13 +486,11 @@ declare class PluginManager {
443
486
  hookForPlugin<H extends PluginLifecycleHooks>({
444
487
  pluginKey,
445
488
  hookName,
446
- parameters,
447
- message
489
+ parameters
448
490
  }: {
449
491
  pluginKey: Plugin['key'];
450
492
  hookName: H;
451
493
  parameters: PluginParameter<H>;
452
- message: string;
453
494
  }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
454
495
  /**
455
496
  * Run a specific hookName for plugin x.
@@ -457,13 +498,11 @@ declare class PluginManager {
457
498
  hookForPluginSync<H extends PluginLifecycleHooks>({
458
499
  pluginKey,
459
500
  hookName,
460
- parameters,
461
- message
501
+ parameters
462
502
  }: {
463
503
  pluginKey: Plugin['key'];
464
504
  hookName: H;
465
505
  parameters: PluginParameter<H>;
466
- message: string;
467
506
  }): Array<ReturnType<ParseResult<H>>> | null;
468
507
  /**
469
508
  * First non-null result stops and will return it's value.
@@ -471,13 +510,11 @@ declare class PluginManager {
471
510
  hookFirst<H extends PluginLifecycleHooks>({
472
511
  hookName,
473
512
  parameters,
474
- skipped,
475
- message
513
+ skipped
476
514
  }: {
477
515
  hookName: H;
478
516
  parameters: PluginParameter<H>;
479
517
  skipped?: ReadonlySet<Plugin> | null;
480
- message: string;
481
518
  }): Promise<SafeParseResult<H>>;
482
519
  /**
483
520
  * First non-null result stops and will return it's value.
@@ -485,37 +522,31 @@ declare class PluginManager {
485
522
  hookFirstSync<H extends PluginLifecycleHooks>({
486
523
  hookName,
487
524
  parameters,
488
- skipped,
489
- message
525
+ skipped
490
526
  }: {
491
527
  hookName: H;
492
528
  parameters: PluginParameter<H>;
493
529
  skipped?: ReadonlySet<Plugin> | null;
494
- message: string;
495
530
  }): SafeParseResult<H>;
496
531
  /**
497
532
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
498
533
  */
499
534
  hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
500
535
  hookName,
501
- parameters,
502
- message
536
+ parameters
503
537
  }: {
504
538
  hookName: H;
505
539
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
506
- message: string;
507
540
  }): Promise<Awaited<TOuput>[]>;
508
541
  /**
509
542
  * Chains plugins
510
543
  */
511
544
  hookSeq<H extends PluginLifecycleHooks>({
512
545
  hookName,
513
- parameters,
514
- message
546
+ parameters
515
547
  }: {
516
548
  hookName: H;
517
549
  parameters?: PluginParameter<H>;
518
- message: string;
519
550
  }): Promise<void>;
520
551
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
521
552
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
@@ -667,6 +698,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
667
698
  override: Array<Override<TOptions>> | undefined;
668
699
  contentType: contentType | undefined;
669
700
  pluginManager: PluginManager;
701
+ logger?: Logger;
670
702
  /**
671
703
  * Current plugin
672
704
  */
@@ -910,6 +942,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
910
942
  fabric: Fabric;
911
943
  oas: Oas;
912
944
  pluginManager: PluginManager;
945
+ logger?: Logger;
913
946
  /**
914
947
  * Current plugin
915
948
  */
@@ -1109,4 +1142,4 @@ type ResolvedOptions = {
1109
1142
  type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
1110
1143
  //#endregion
1111
1144
  export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options as t };
1112
- //# sourceMappingURL=types-DgJG4t24.d.ts.map
1145
+ //# sourceMappingURL=types-CZCTeVpk.d.cts.map
@@ -1,5 +1,5 @@
1
- import { KubbFile } from "@kubb/fabric-core/types";
2
1
  import { Fabric } from "@kubb/react-fabric";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
  import * as OasTypes from "oas/types";
5
5
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
@@ -38,13 +38,35 @@ type DebugEvent = {
38
38
  date: Date;
39
39
  logs: string[];
40
40
  fileName?: string;
41
+ /**
42
+ * Category of the debug log, used for GitHub Actions grouping
43
+ * - 'setup': Initial configuration and environment setup
44
+ * - 'plugin': Plugin installation and execution
45
+ * - 'hook': Plugin hook execution details
46
+ * - 'schema': Schema parsing and generation
47
+ * - 'file': File operations (read/write/generate)
48
+ * - 'error': Error details and stack traces
49
+ * - undefined: Generic logs (always inline)
50
+ */
51
+ category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
52
+ /**
53
+ * Plugin name for grouping plugin-specific logs together
54
+ */
55
+ pluginName?: string;
56
+ /**
57
+ * Indicates if this is the start or end of a plugin's execution
58
+ * - 'start': Start of plugin execution group
59
+ * - 'end': End of plugin execution group
60
+ */
61
+ pluginGroupMarker?: 'start' | 'end';
41
62
  };
42
63
  type Events$1 = {
43
64
  start: [message: string];
44
65
  success: [message: string];
45
- error: [message: string, cause: Error];
66
+ error: [message: string, error: Error];
46
67
  warning: [message: string];
47
68
  debug: [DebugEvent];
69
+ verbose: [DebugEvent];
48
70
  info: [message: string];
49
71
  progress_start: [{
50
72
  id: string;
@@ -68,7 +90,7 @@ type Logger = {
68
90
  consola?: ConsolaInstance;
69
91
  on: EventEmitter<Events$1>['on'];
70
92
  emit: EventEmitter<Events$1>['emit'];
71
- writeLogs: () => Promise<string[]>;
93
+ writeLogs: () => Promise<void>;
72
94
  };
73
95
  //#endregion
74
96
  //#region ../core/src/utils/types.d.ts
@@ -379,14 +401,35 @@ type Group = {
379
401
  //#region ../core/src/PluginManager.d.ts
380
402
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
381
403
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
382
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
383
- message: string;
404
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
405
+ strategy: Strategy;
406
+ hookName: H;
407
+ plugin: Plugin;
408
+ parameters?: unknown[] | undefined;
409
+ output?: unknown;
410
+ };
411
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
412
+ duration: number;
384
413
  strategy: Strategy;
385
414
  hookName: H;
386
415
  plugin: Plugin;
387
416
  parameters?: unknown[] | undefined;
388
417
  output?: unknown;
389
418
  };
419
+ type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
420
+ hookName: H;
421
+ duration: number;
422
+ strategy: Strategy;
423
+ parameters?: unknown[] | undefined;
424
+ plugin: Plugin;
425
+ };
426
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
427
+ hookName: H;
428
+ plugins: Array<Plugin>;
429
+ };
430
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
431
+ hookName: H;
432
+ };
390
433
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
391
434
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
392
435
  result: Result;
@@ -401,9 +444,11 @@ type Options$2 = {
401
444
  concurrency?: number;
402
445
  };
403
446
  type Events = {
404
- executing: [executer: Executer];
405
- executed: [executer: Executer];
406
- error: [error: Error];
447
+ progress_start: [meta: ProgressStartMeta];
448
+ progress_stop: [meta: ProgressStopMeta];
449
+ executing: [meta: ExecutingMeta];
450
+ executed: [meta: ExecutedMeta];
451
+ error: [error: Error, meta: ErrorMeta];
407
452
  };
408
453
  type GetFileProps<TOptions = object> = {
409
454
  name: string;
@@ -416,8 +461,6 @@ declare class PluginManager {
416
461
  #private;
417
462
  readonly events: EventEmitter<Events>;
418
463
  readonly config: Config;
419
- readonly executed: Array<Executer>;
420
- readonly logger: Logger;
421
464
  readonly options: Options$2;
422
465
  constructor(config: Config, options: Options$2);
423
466
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
@@ -443,13 +486,11 @@ declare class PluginManager {
443
486
  hookForPlugin<H extends PluginLifecycleHooks>({
444
487
  pluginKey,
445
488
  hookName,
446
- parameters,
447
- message
489
+ parameters
448
490
  }: {
449
491
  pluginKey: Plugin['key'];
450
492
  hookName: H;
451
493
  parameters: PluginParameter<H>;
452
- message: string;
453
494
  }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
454
495
  /**
455
496
  * Run a specific hookName for plugin x.
@@ -457,13 +498,11 @@ declare class PluginManager {
457
498
  hookForPluginSync<H extends PluginLifecycleHooks>({
458
499
  pluginKey,
459
500
  hookName,
460
- parameters,
461
- message
501
+ parameters
462
502
  }: {
463
503
  pluginKey: Plugin['key'];
464
504
  hookName: H;
465
505
  parameters: PluginParameter<H>;
466
- message: string;
467
506
  }): Array<ReturnType<ParseResult<H>>> | null;
468
507
  /**
469
508
  * First non-null result stops and will return it's value.
@@ -471,13 +510,11 @@ declare class PluginManager {
471
510
  hookFirst<H extends PluginLifecycleHooks>({
472
511
  hookName,
473
512
  parameters,
474
- skipped,
475
- message
513
+ skipped
476
514
  }: {
477
515
  hookName: H;
478
516
  parameters: PluginParameter<H>;
479
517
  skipped?: ReadonlySet<Plugin> | null;
480
- message: string;
481
518
  }): Promise<SafeParseResult<H>>;
482
519
  /**
483
520
  * First non-null result stops and will return it's value.
@@ -485,37 +522,31 @@ declare class PluginManager {
485
522
  hookFirstSync<H extends PluginLifecycleHooks>({
486
523
  hookName,
487
524
  parameters,
488
- skipped,
489
- message
525
+ skipped
490
526
  }: {
491
527
  hookName: H;
492
528
  parameters: PluginParameter<H>;
493
529
  skipped?: ReadonlySet<Plugin> | null;
494
- message: string;
495
530
  }): SafeParseResult<H>;
496
531
  /**
497
532
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
498
533
  */
499
534
  hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
500
535
  hookName,
501
- parameters,
502
- message
536
+ parameters
503
537
  }: {
504
538
  hookName: H;
505
539
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
506
- message: string;
507
540
  }): Promise<Awaited<TOuput>[]>;
508
541
  /**
509
542
  * Chains plugins
510
543
  */
511
544
  hookSeq<H extends PluginLifecycleHooks>({
512
545
  hookName,
513
- parameters,
514
- message
546
+ parameters
515
547
  }: {
516
548
  hookName: H;
517
549
  parameters?: PluginParameter<H>;
518
- message: string;
519
550
  }): Promise<void>;
520
551
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
521
552
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
@@ -667,6 +698,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
667
698
  override: Array<Override<TOptions>> | undefined;
668
699
  contentType: contentType | undefined;
669
700
  pluginManager: PluginManager;
701
+ logger?: Logger;
670
702
  /**
671
703
  * Current plugin
672
704
  */
@@ -910,6 +942,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
910
942
  fabric: Fabric;
911
943
  oas: Oas;
912
944
  pluginManager: PluginManager;
945
+ logger?: Logger;
913
946
  /**
914
947
  * Current plugin
915
948
  */
@@ -1109,4 +1142,4 @@ type ResolvedOptions = {
1109
1142
  type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
1110
1143
  //#endregion
1111
1144
  export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options as t };
1112
- //# sourceMappingURL=types-B1FgdqYL.d.cts.map
1145
+ //# sourceMappingURL=types-CfzJF-pQ.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-faker",
3
- "version": "0.0.0-canary-20251209191624",
3
+ "version": "0.0.0-canary-20251217084347",
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",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "@kubb/react-fabric": "0.5.4",
72
- "@kubb/core": "0.0.0-canary-20251209191624",
73
- "@kubb/oas": "0.0.0-canary-20251209191624",
74
- "@kubb/plugin-oas": "0.0.0-canary-20251209191624",
75
- "@kubb/plugin-ts": "0.0.0-canary-20251209191624"
72
+ "@kubb/core": "0.0.0-canary-20251217084347",
73
+ "@kubb/oas": "0.0.0-canary-20251217084347",
74
+ "@kubb/plugin-oas": "0.0.0-canary-20251217084347",
75
+ "@kubb/plugin-ts": "0.0.0-canary-20251217084347"
76
76
  },
77
77
  "devDependencies": {
78
- "@kubb/plugin-oas": "0.0.0-canary-20251209191624"
78
+ "@kubb/plugin-oas": "0.0.0-canary-20251217084347"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=20"
@@ -14,8 +14,11 @@ export function listPetsQueryParams(data?: Partial<ListPetsQueryParams>): ListPe
14
14
  /**
15
15
  * @description A paged array of pets
16
16
  */
17
- export function listPets200() {
18
- return pets()
17
+ export function listPets200(data?: Partial<ListPets200>): ListPets200 {
18
+ return {
19
+ ...{ ...pagination(), ...pets() },
20
+ ...(data || {}),
21
+ }
19
22
  }
20
23
 
21
24
  /**
@@ -28,6 +28,7 @@ export const fakerGenerator = createReactGenerator<PluginFaker>({
28
28
  fabric: generator.context.fabric,
29
29
  oas,
30
30
  plugin,
31
+ logger: generator.context.logger,
31
32
  pluginManager,
32
33
  mode,
33
34
  override: options.override,