@kubb/plugin-faker 4.5.13 → 4.5.15
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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-CizhRkz2.d.cts → types-C_EkJlBz.d.ts} +9 -2
- package/dist/{types-J_KepgB6.d.ts → types-uPoEoB49.d.cts} +9 -2
- package/package.json +7 -7
- package/src/plugin.ts +3 -3
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -71,7 +71,7 @@ const pluginFaker = (0, __kubb_core.definePlugin)((options) => {
|
|
|
71
71
|
mode,
|
|
72
72
|
output: output.path
|
|
73
73
|
}).build(...generators);
|
|
74
|
-
await this.
|
|
74
|
+
await this.upsertFile(...schemaFiles);
|
|
75
75
|
const operationFiles = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
|
|
76
76
|
fabric: this.fabric,
|
|
77
77
|
oas,
|
|
@@ -83,7 +83,7 @@ const pluginFaker = (0, __kubb_core.definePlugin)((options) => {
|
|
|
83
83
|
override,
|
|
84
84
|
mode
|
|
85
85
|
}).build(...generators);
|
|
86
|
-
await this.
|
|
86
|
+
await this.upsertFile(...operationFiles);
|
|
87
87
|
const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fabric.files, {
|
|
88
88
|
type: output.barrelType ?? "named",
|
|
89
89
|
root,
|
|
@@ -91,7 +91,7 @@ const pluginFaker = (0, __kubb_core.definePlugin)((options) => {
|
|
|
91
91
|
meta: { pluginKey: this.plugin.key },
|
|
92
92
|
logger: this.logger
|
|
93
93
|
});
|
|
94
|
-
await this.
|
|
94
|
+
await this.upsertFile(...barrelFiles);
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["fakerGenerator","pluginOasName","pluginTsName","path","options","groupName: Group['name']","SchemaGenerator","OperationGenerator"],"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.
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fakerGenerator","pluginOasName","pluginTsName","path","options","groupName: Group['name']","SchemaGenerator","OperationGenerator"],"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,6CAAyC,YAAY;CAChE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,MACA,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,SAAS,EAAE,EACX,cAAc,OACd,kBAAkB,aAClB,WAAW,UACX,aAAa,SACb,aAAa,CAACA,sCAAe,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,CAACC,iCAAeC,8BAAa;EAClC,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,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,2CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM;IACnC,QAAQ,OAAO,WAAW;IAC1B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAc/B,MAAM,cAAc,MAZI,IAAIG,kCAAgB,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,IAAIC,qCAAmB,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,sCAAqB,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"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-uPoEoB49.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginFakerName = "plugin-faker";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-C_EkJlBz.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginFakerName = "plugin-faker";
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ const pluginFaker = definePlugin((options) => {
|
|
|
70
70
|
mode,
|
|
71
71
|
output: output.path
|
|
72
72
|
}).build(...generators);
|
|
73
|
-
await this.
|
|
73
|
+
await this.upsertFile(...schemaFiles);
|
|
74
74
|
const operationFiles = await new OperationGenerator(this.plugin.options, {
|
|
75
75
|
fabric: this.fabric,
|
|
76
76
|
oas,
|
|
@@ -82,7 +82,7 @@ const pluginFaker = definePlugin((options) => {
|
|
|
82
82
|
override,
|
|
83
83
|
mode
|
|
84
84
|
}).build(...generators);
|
|
85
|
-
await this.
|
|
85
|
+
await this.upsertFile(...operationFiles);
|
|
86
86
|
const barrelFiles = await getBarrelFiles(this.fabric.files, {
|
|
87
87
|
type: output.barrelType ?? "named",
|
|
88
88
|
root,
|
|
@@ -90,7 +90,7 @@ const pluginFaker = definePlugin((options) => {
|
|
|
90
90
|
meta: { pluginKey: this.plugin.key },
|
|
91
91
|
logger: this.logger
|
|
92
92
|
});
|
|
93
|
-
await this.
|
|
93
|
+
await this.upsertFile(...barrelFiles);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
});
|
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.
|
|
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,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";
|
|
@@ -325,7 +325,14 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
325
325
|
fabric: Fabric;
|
|
326
326
|
config: Config;
|
|
327
327
|
pluginManager: PluginManager;
|
|
328
|
+
/**
|
|
329
|
+
* Only add when the file does not exist yet
|
|
330
|
+
*/
|
|
328
331
|
addFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* merging multiple sources into the same output file
|
|
334
|
+
*/
|
|
335
|
+
upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
329
336
|
logger: Logger;
|
|
330
337
|
mode: KubbFile.Mode;
|
|
331
338
|
/**
|
|
@@ -1102,4 +1109,4 @@ type ResolvedOptions = {
|
|
|
1102
1109
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1103
1110
|
//#endregion
|
|
1104
1111
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options$1 as t };
|
|
1105
|
-
//# sourceMappingURL=types-
|
|
1112
|
+
//# sourceMappingURL=types-C_EkJlBz.d.ts.map
|
|
@@ -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";
|
|
@@ -325,7 +325,14 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
325
325
|
fabric: Fabric;
|
|
326
326
|
config: Config;
|
|
327
327
|
pluginManager: PluginManager;
|
|
328
|
+
/**
|
|
329
|
+
* Only add when the file does not exist yet
|
|
330
|
+
*/
|
|
328
331
|
addFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* merging multiple sources into the same output file
|
|
334
|
+
*/
|
|
335
|
+
upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
329
336
|
logger: Logger;
|
|
330
337
|
mode: KubbFile.Mode;
|
|
331
338
|
/**
|
|
@@ -1102,4 +1109,4 @@ type ResolvedOptions = {
|
|
|
1102
1109
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1103
1110
|
//#endregion
|
|
1104
1111
|
export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options$1 as t };
|
|
1105
|
-
//# sourceMappingURL=types-
|
|
1112
|
+
//# sourceMappingURL=types-uPoEoB49.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.15",
|
|
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,14 +68,14 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@kubb/react-fabric": "0.5.
|
|
72
|
-
"@kubb/core": "4.5.
|
|
73
|
-
"@kubb/oas": "4.5.
|
|
74
|
-
"@kubb/plugin-oas": "4.5.
|
|
75
|
-
"@kubb/plugin-ts": "4.5.
|
|
71
|
+
"@kubb/react-fabric": "0.5.2",
|
|
72
|
+
"@kubb/core": "4.5.15",
|
|
73
|
+
"@kubb/oas": "4.5.15",
|
|
74
|
+
"@kubb/plugin-oas": "4.5.15",
|
|
75
|
+
"@kubb/plugin-ts": "4.5.15"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@kubb/plugin-oas": "4.5.
|
|
78
|
+
"@kubb/plugin-oas": "4.5.15"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=20"
|
package/src/plugin.ts
CHANGED
|
@@ -110,7 +110,7 @@ export const pluginFaker = definePlugin<PluginFaker>((options) => {
|
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
const schemaFiles = await schemaGenerator.build(...generators)
|
|
113
|
-
await this.
|
|
113
|
+
await this.upsertFile(...schemaFiles)
|
|
114
114
|
|
|
115
115
|
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
116
116
|
fabric: this.fabric,
|
|
@@ -125,7 +125,7 @@ export const pluginFaker = definePlugin<PluginFaker>((options) => {
|
|
|
125
125
|
})
|
|
126
126
|
|
|
127
127
|
const operationFiles = await operationGenerator.build(...generators)
|
|
128
|
-
await this.
|
|
128
|
+
await this.upsertFile(...operationFiles)
|
|
129
129
|
|
|
130
130
|
const barrelFiles = await getBarrelFiles(this.fabric.files, {
|
|
131
131
|
type: output.barrelType ?? 'named',
|
|
@@ -137,7 +137,7 @@ export const pluginFaker = definePlugin<PluginFaker>((options) => {
|
|
|
137
137
|
logger: this.logger,
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
-
await this.
|
|
140
|
+
await this.upsertFile(...barrelFiles)
|
|
141
141
|
},
|
|
142
142
|
}
|
|
143
143
|
})
|