@kubb/agent 5.0.0-alpha.5 → 5.0.0-alpha.7
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.
|
@@ -4681,19 +4681,19 @@ const isOperationNode = isKind("Operation");
|
|
|
4681
4681
|
const isSchemaNode = isKind("Schema");
|
|
4682
4682
|
function definePrinter(build) {
|
|
4683
4683
|
return (options) => {
|
|
4684
|
-
const { name, options: resolvedOptions, nodes } = build(options != null ? options : {});
|
|
4684
|
+
const { name, options: resolvedOptions, nodes, print: printOverride } = build(options != null ? options : {});
|
|
4685
4685
|
const context = {
|
|
4686
4686
|
options: resolvedOptions,
|
|
4687
4687
|
print: (node) => {
|
|
4688
4688
|
const handler = nodes[node.type];
|
|
4689
|
-
|
|
4689
|
+
if (!handler) return void 0;
|
|
4690
|
+
return handler.call(context, node);
|
|
4690
4691
|
}
|
|
4691
4692
|
};
|
|
4692
4693
|
return {
|
|
4693
4694
|
name,
|
|
4694
4695
|
options: resolvedOptions,
|
|
4695
|
-
print: context.print
|
|
4696
|
-
for: (nodes2) => nodes2.map(context.print)
|
|
4696
|
+
print: printOverride ? printOverride.bind(context) : context.print
|
|
4697
4697
|
};
|
|
4698
4698
|
};
|
|
4699
4699
|
}
|
|
@@ -4906,7 +4906,7 @@ var __privateWrapper$1 = (obj, member, setter, getter) => ({
|
|
|
4906
4906
|
return __privateGet$c(obj, member, getter);
|
|
4907
4907
|
}
|
|
4908
4908
|
});
|
|
4909
|
-
var _emitter, _a$c, _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _b$2, _head$1, _tail$1, _size$1, _c,
|
|
4909
|
+
var _emitter, _a$c, _options$c, _URLPath_instances$a, transformParam_fn$a, eachParam_fn$a, _b$2, _head$1, _tail$1, _size$1, _c, _studioIsOpen, _plugins, _usedPluginNames, _PluginDriver_instances, getSortedPlugins_fn, emitProcessingEnd_fn, execute_fn, executeSync_fn, parse_fn, _d, _e, _cache, _cwd, _PackageManager_instances, match_fn, _items, _FunctionParams_static, _f, orderItems_fn, addParams_fn, _cachedLeaves, _g;
|
|
4910
4910
|
var ValidationPluginError = class extends Error {
|
|
4911
4911
|
};
|
|
4912
4912
|
function toError(value) {
|
|
@@ -5073,6 +5073,9 @@ function setUniqueName(originalName, data) {
|
|
|
5073
5073
|
data[originalName] = 1;
|
|
5074
5074
|
return originalName;
|
|
5075
5075
|
}
|
|
5076
|
+
function isPromiseRejectedResult(result) {
|
|
5077
|
+
return result.status === "rejected";
|
|
5078
|
+
}
|
|
5076
5079
|
const reservedWords = [
|
|
5077
5080
|
"abstract",
|
|
5078
5081
|
"arguments",
|
|
@@ -5486,28 +5489,14 @@ function hookParallel(promises, concurrency = Number.POSITIVE_INFINITY) {
|
|
|
5486
5489
|
const tasks = promises.filter(Boolean).map((promise) => limit(() => promise()));
|
|
5487
5490
|
return Promise.allSettled(tasks);
|
|
5488
5491
|
}
|
|
5489
|
-
var PromiseManager = (_d = class {
|
|
5490
|
-
constructor(options = {}) {
|
|
5491
|
-
__privateAdd$c(this, _options2$1, {});
|
|
5492
|
-
__privateSet$c(this, _options2$1, options);
|
|
5493
|
-
}
|
|
5494
|
-
run(strategy, promises, { concurrency = Number.POSITIVE_INFINITY } = {}) {
|
|
5495
|
-
if (strategy === "seq") return hookSeq(promises);
|
|
5496
|
-
if (strategy === "first") return hookFirst(promises, __privateGet$c(this, _options2$1).nullCheck);
|
|
5497
|
-
if (strategy === "parallel") return hookParallel(promises, concurrency);
|
|
5498
|
-
throw new Error(`${strategy} not implemented`);
|
|
5499
|
-
}
|
|
5500
|
-
}, _options2$1 = new WeakMap(), _d);
|
|
5501
|
-
function isPromiseRejectedResult(result) {
|
|
5502
|
-
return result.status === "rejected";
|
|
5503
|
-
}
|
|
5504
5492
|
function getMode(fileOrFolder) {
|
|
5505
5493
|
if (!fileOrFolder) return "split";
|
|
5506
5494
|
return extname(fileOrFolder) ? "single" : "split";
|
|
5507
5495
|
}
|
|
5508
|
-
|
|
5496
|
+
const hookFirstNullCheck = (state) => !!(state == null ? void 0 : state.result);
|
|
5497
|
+
var PluginDriver = (_d = class {
|
|
5509
5498
|
constructor(config, options) {
|
|
5510
|
-
__privateAdd$c(this,
|
|
5499
|
+
__privateAdd$c(this, _PluginDriver_instances);
|
|
5511
5500
|
__publicField$b(this, "config");
|
|
5512
5501
|
__publicField$b(this, "options");
|
|
5513
5502
|
/**
|
|
@@ -5519,7 +5508,6 @@ var PluginManager = (_e = class {
|
|
|
5519
5508
|
__privateAdd$c(this, _studioIsOpen, false);
|
|
5520
5509
|
__privateAdd$c(this, _plugins, /* @__PURE__ */ new Set());
|
|
5521
5510
|
__privateAdd$c(this, _usedPluginNames, {});
|
|
5522
|
-
__privateAdd$c(this, _promiseManager);
|
|
5523
5511
|
__publicField$b(this, "resolvePath", (params) => {
|
|
5524
5512
|
var _a2, _b2;
|
|
5525
5513
|
const defaultPath = resolve(resolve(this.config.root, this.config.output.path), params.baseName);
|
|
@@ -5559,9 +5547,8 @@ var PluginManager = (_e = class {
|
|
|
5559
5547
|
});
|
|
5560
5548
|
this.config = config;
|
|
5561
5549
|
this.options = options;
|
|
5562
|
-
__privateSet$c(this, _promiseManager, new PromiseManager({ nullCheck: (state) => !!(state == null ? void 0 : state.result) }));
|
|
5563
5550
|
[...config.plugins || []].forEach((plugin) => {
|
|
5564
|
-
const parsedPlugin = __privateMethod$c(this,
|
|
5551
|
+
const parsedPlugin = __privateMethod$c(this, _PluginDriver_instances, parse_fn).call(this, plugin);
|
|
5565
5552
|
__privateGet$c(this, _plugins).add(parsedPlugin);
|
|
5566
5553
|
});
|
|
5567
5554
|
}
|
|
@@ -5570,13 +5557,13 @@ var PluginManager = (_e = class {
|
|
|
5570
5557
|
}
|
|
5571
5558
|
getContext(plugin) {
|
|
5572
5559
|
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5573
|
-
const
|
|
5560
|
+
const driver = this;
|
|
5574
5561
|
const baseContext = {
|
|
5575
5562
|
fabric: this.options.fabric,
|
|
5576
5563
|
config: this.config,
|
|
5577
5564
|
plugin,
|
|
5578
5565
|
events: this.options.events,
|
|
5579
|
-
|
|
5566
|
+
driver: this,
|
|
5580
5567
|
mode: getMode(resolve(this.config.root, this.config.output.path)),
|
|
5581
5568
|
addFile: async (...files) => {
|
|
5582
5569
|
await this.options.fabric.addFile(...files);
|
|
@@ -5585,19 +5572,19 @@ var PluginManager = (_e = class {
|
|
|
5585
5572
|
await this.options.fabric.upsertFile(...files);
|
|
5586
5573
|
},
|
|
5587
5574
|
get rootNode() {
|
|
5588
|
-
return
|
|
5575
|
+
return driver.rootNode;
|
|
5589
5576
|
},
|
|
5590
5577
|
get adapter() {
|
|
5591
|
-
return
|
|
5578
|
+
return driver.adapter;
|
|
5592
5579
|
},
|
|
5593
5580
|
openInStudio(options) {
|
|
5594
5581
|
var _a2, _b2;
|
|
5595
|
-
if (!
|
|
5596
|
-
if (typeof
|
|
5597
|
-
if (!
|
|
5598
|
-
__privateSet$c(
|
|
5599
|
-
const studioUrl = (_b2 = (_a2 =
|
|
5600
|
-
return openInStudio(
|
|
5582
|
+
if (!driver.config.devtools || __privateGet$c(driver, _studioIsOpen)) return;
|
|
5583
|
+
if (typeof driver.config.devtools !== "object") throw new Error("Devtools must be an object");
|
|
5584
|
+
if (!driver.rootNode || !driver.adapter) throw new Error("adapter is not defined, make sure you have set the parser in kubb.config.ts");
|
|
5585
|
+
__privateSet$c(driver, _studioIsOpen, true);
|
|
5586
|
+
const studioUrl = (_b2 = (_a2 = driver.config.devtools) == null ? void 0 : _a2.studioUrl) != null ? _b2 : "https://studio.kubb.dev";
|
|
5587
|
+
return openInStudio(driver.rootNode, studioUrl, options);
|
|
5601
5588
|
}
|
|
5602
5589
|
};
|
|
5603
5590
|
const mergedExtras = {};
|
|
@@ -5611,7 +5598,7 @@ var PluginManager = (_e = class {
|
|
|
5611
5598
|
};
|
|
5612
5599
|
}
|
|
5613
5600
|
get plugins() {
|
|
5614
|
-
return __privateMethod$c(this,
|
|
5601
|
+
return __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this);
|
|
5615
5602
|
}
|
|
5616
5603
|
getFile({ name, mode, extname: extname2, pluginName, options }) {
|
|
5617
5604
|
const resolvedName = mode ? mode === "single" ? "" : this.resolveName({
|
|
@@ -5646,7 +5633,7 @@ var PluginManager = (_e = class {
|
|
|
5646
5633
|
});
|
|
5647
5634
|
const items = [];
|
|
5648
5635
|
for (const plugin of plugins) {
|
|
5649
|
-
const result = await __privateMethod$c(this,
|
|
5636
|
+
const result = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5650
5637
|
strategy: "hookFirst",
|
|
5651
5638
|
hookName,
|
|
5652
5639
|
parameters,
|
|
@@ -5662,7 +5649,7 @@ var PluginManager = (_e = class {
|
|
|
5662
5649
|
*/
|
|
5663
5650
|
hookForPluginSync({ pluginName, hookName, parameters }) {
|
|
5664
5651
|
return this.getPluginsByName(hookName, pluginName).map((plugin) => {
|
|
5665
|
-
return __privateMethod$c(this,
|
|
5652
|
+
return __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
5666
5653
|
strategy: "hookFirst",
|
|
5667
5654
|
hookName,
|
|
5668
5655
|
parameters,
|
|
@@ -5674,16 +5661,16 @@ var PluginManager = (_e = class {
|
|
|
5674
5661
|
* Returns the first non-null result.
|
|
5675
5662
|
*/
|
|
5676
5663
|
async hookFirst({ hookName, parameters, skipped }) {
|
|
5677
|
-
const plugins = __privateMethod$c(this,
|
|
5664
|
+
const plugins = __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
|
|
5678
5665
|
return skipped ? !skipped.has(plugin) : true;
|
|
5679
5666
|
});
|
|
5680
5667
|
this.events.emit("plugins:hook:progress:start", {
|
|
5681
5668
|
hookName,
|
|
5682
5669
|
plugins
|
|
5683
5670
|
});
|
|
5684
|
-
const
|
|
5671
|
+
const result = await hookFirst(plugins.map((plugin) => {
|
|
5685
5672
|
return async () => {
|
|
5686
|
-
const value = await __privateMethod$c(this,
|
|
5673
|
+
const value = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5687
5674
|
strategy: "hookFirst",
|
|
5688
5675
|
hookName,
|
|
5689
5676
|
parameters,
|
|
@@ -5694,8 +5681,7 @@ var PluginManager = (_e = class {
|
|
|
5694
5681
|
result: value
|
|
5695
5682
|
});
|
|
5696
5683
|
};
|
|
5697
|
-
});
|
|
5698
|
-
const result = await __privateGet$c(this, _promiseManager).run("first", promises);
|
|
5684
|
+
}), hookFirstNullCheck);
|
|
5699
5685
|
this.events.emit("plugins:hook:progress:end", { hookName });
|
|
5700
5686
|
return result;
|
|
5701
5687
|
}
|
|
@@ -5704,12 +5690,12 @@ var PluginManager = (_e = class {
|
|
|
5704
5690
|
*/
|
|
5705
5691
|
hookFirstSync({ hookName, parameters, skipped }) {
|
|
5706
5692
|
let parseResult = null;
|
|
5707
|
-
const plugins = __privateMethod$c(this,
|
|
5693
|
+
const plugins = __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
|
|
5708
5694
|
return skipped ? !skipped.has(plugin) : true;
|
|
5709
5695
|
});
|
|
5710
5696
|
for (const plugin of plugins) {
|
|
5711
5697
|
parseResult = {
|
|
5712
|
-
result: __privateMethod$c(this,
|
|
5698
|
+
result: __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
5713
5699
|
strategy: "hookFirst",
|
|
5714
5700
|
hookName,
|
|
5715
5701
|
parameters,
|
|
@@ -5725,28 +5711,27 @@ var PluginManager = (_e = class {
|
|
|
5725
5711
|
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
5726
5712
|
*/
|
|
5727
5713
|
async hookParallel({ hookName, parameters }) {
|
|
5728
|
-
const plugins = __privateMethod$c(this,
|
|
5714
|
+
const plugins = __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this, hookName);
|
|
5729
5715
|
this.events.emit("plugins:hook:progress:start", {
|
|
5730
5716
|
hookName,
|
|
5731
5717
|
plugins
|
|
5732
5718
|
});
|
|
5733
5719
|
const pluginStartTimes = /* @__PURE__ */ new Map();
|
|
5734
|
-
const
|
|
5720
|
+
const results = await hookParallel(plugins.map((plugin) => {
|
|
5735
5721
|
return () => {
|
|
5736
5722
|
pluginStartTimes.set(plugin, performance$1.now());
|
|
5737
|
-
return __privateMethod$c(this,
|
|
5723
|
+
return __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5738
5724
|
strategy: "hookParallel",
|
|
5739
5725
|
hookName,
|
|
5740
5726
|
parameters,
|
|
5741
5727
|
plugin
|
|
5742
5728
|
});
|
|
5743
5729
|
};
|
|
5744
|
-
});
|
|
5745
|
-
const results = await __privateGet$c(this, _promiseManager).run("parallel", promises, { concurrency: this.options.concurrency });
|
|
5730
|
+
}), this.options.concurrency);
|
|
5746
5731
|
results.forEach((result, index) => {
|
|
5747
5732
|
var _a2;
|
|
5748
5733
|
if (isPromiseRejectedResult(result)) {
|
|
5749
|
-
const plugin = __privateMethod$c(this,
|
|
5734
|
+
const plugin = __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this, hookName)[index];
|
|
5750
5735
|
if (plugin) {
|
|
5751
5736
|
const startTime = (_a2 = pluginStartTimes.get(plugin)) != null ? _a2 : performance$1.now();
|
|
5752
5737
|
this.events.emit("error", result.reason, {
|
|
@@ -5769,20 +5754,19 @@ var PluginManager = (_e = class {
|
|
|
5769
5754
|
* Chains plugins
|
|
5770
5755
|
*/
|
|
5771
5756
|
async hookSeq({ hookName, parameters }) {
|
|
5772
|
-
const plugins = __privateMethod$c(this,
|
|
5757
|
+
const plugins = __privateMethod$c(this, _PluginDriver_instances, getSortedPlugins_fn).call(this, hookName);
|
|
5773
5758
|
this.events.emit("plugins:hook:progress:start", {
|
|
5774
5759
|
hookName,
|
|
5775
5760
|
plugins
|
|
5776
5761
|
});
|
|
5777
|
-
|
|
5778
|
-
return () => __privateMethod$c(this,
|
|
5762
|
+
await hookSeq(plugins.map((plugin) => {
|
|
5763
|
+
return () => __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5779
5764
|
strategy: "hookSeq",
|
|
5780
5765
|
hookName,
|
|
5781
5766
|
parameters,
|
|
5782
5767
|
plugin
|
|
5783
5768
|
});
|
|
5784
|
-
});
|
|
5785
|
-
await __privateGet$c(this, _promiseManager).run("seq", promises);
|
|
5769
|
+
}));
|
|
5786
5770
|
this.events.emit("plugins:hook:progress:end", { hookName });
|
|
5787
5771
|
}
|
|
5788
5772
|
getPluginByName(pluginName) {
|
|
@@ -5797,7 +5781,7 @@ var PluginManager = (_e = class {
|
|
|
5797
5781
|
}
|
|
5798
5782
|
return pluginByPluginName;
|
|
5799
5783
|
}
|
|
5800
|
-
}, _studioIsOpen = new WeakMap(), _plugins = new WeakMap(), _usedPluginNames = new WeakMap(),
|
|
5784
|
+
}, _studioIsOpen = new WeakMap(), _plugins = new WeakMap(), _usedPluginNames = new WeakMap(), _PluginDriver_instances = new WeakSet(), getSortedPlugins_fn = function(hookName) {
|
|
5801
5785
|
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5802
5786
|
if (hookName) return plugins.filter((plugin) => hookName in plugin);
|
|
5803
5787
|
return plugins.map((plugin) => {
|
|
@@ -5841,7 +5825,7 @@ emitProcessingEnd_fn = function({ startTime, output, strategy, hookName, plugin,
|
|
|
5841
5825
|
return (async () => {
|
|
5842
5826
|
try {
|
|
5843
5827
|
const output = typeof hook === "function" ? await Promise.resolve(hook.apply(this.getContext(plugin), parameters != null ? parameters : [])) : hook;
|
|
5844
|
-
__privateMethod$c(this,
|
|
5828
|
+
__privateMethod$c(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
|
|
5845
5829
|
startTime,
|
|
5846
5830
|
output,
|
|
5847
5831
|
strategy,
|
|
@@ -5878,7 +5862,7 @@ executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
|
5878
5862
|
const startTime = performance$1.now();
|
|
5879
5863
|
try {
|
|
5880
5864
|
const output = typeof hook === "function" ? hook.apply(this.getContext(plugin), parameters) : hook;
|
|
5881
|
-
__privateMethod$c(this,
|
|
5865
|
+
__privateMethod$c(this, _PluginDriver_instances, emitProcessingEnd_fn).call(this, {
|
|
5882
5866
|
startTime,
|
|
5883
5867
|
output,
|
|
5884
5868
|
strategy,
|
|
@@ -5906,7 +5890,7 @@ executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
|
5906
5890
|
},
|
|
5907
5891
|
...plugin
|
|
5908
5892
|
};
|
|
5909
|
-
},
|
|
5893
|
+
}, _d);
|
|
5910
5894
|
function defineStorage(build2) {
|
|
5911
5895
|
return (options) => build2(options != null ? options : {});
|
|
5912
5896
|
}
|
|
@@ -5956,7 +5940,7 @@ const fsStorage = defineStorage(() => ({
|
|
|
5956
5940
|
await clean(resolve(base));
|
|
5957
5941
|
}
|
|
5958
5942
|
}));
|
|
5959
|
-
var version$1 = "5.0.0-alpha.
|
|
5943
|
+
var version$1 = "5.0.0-alpha.7";
|
|
5960
5944
|
function getDiagnosticInfo() {
|
|
5961
5945
|
return {
|
|
5962
5946
|
nodeVersion: version$2,
|
|
@@ -6064,7 +6048,7 @@ async function setup(options) {
|
|
|
6064
6048
|
` \u2022 Barrel type: ${definedConfig.output.barrelType || "none"}`
|
|
6065
6049
|
]
|
|
6066
6050
|
});
|
|
6067
|
-
const
|
|
6051
|
+
const pluginDriver = new PluginDriver(definedConfig, {
|
|
6068
6052
|
fabric,
|
|
6069
6053
|
events,
|
|
6070
6054
|
concurrency: 15
|
|
@@ -6075,33 +6059,33 @@ async function setup(options) {
|
|
|
6075
6059
|
date: /* @__PURE__ */ new Date(),
|
|
6076
6060
|
logs: [`Running adapter: ${definedConfig.adapter.name}`]
|
|
6077
6061
|
});
|
|
6078
|
-
|
|
6079
|
-
|
|
6062
|
+
pluginDriver.adapter = definedConfig.adapter;
|
|
6063
|
+
pluginDriver.rootNode = await definedConfig.adapter.parse(source);
|
|
6080
6064
|
await events.emit("debug", {
|
|
6081
6065
|
date: /* @__PURE__ */ new Date(),
|
|
6082
6066
|
logs: [
|
|
6083
6067
|
`\u2713 Adapter '${definedConfig.adapter.name}' resolved RootNode`,
|
|
6084
|
-
` \u2022 Schemas: ${
|
|
6085
|
-
` \u2022 Operations: ${
|
|
6068
|
+
` \u2022 Schemas: ${pluginDriver.rootNode.schemas.length}`,
|
|
6069
|
+
` \u2022 Operations: ${pluginDriver.rootNode.operations.length}`
|
|
6086
6070
|
]
|
|
6087
6071
|
});
|
|
6088
6072
|
}
|
|
6089
6073
|
return {
|
|
6090
6074
|
events,
|
|
6091
6075
|
fabric,
|
|
6092
|
-
|
|
6076
|
+
driver: pluginDriver,
|
|
6093
6077
|
sources
|
|
6094
6078
|
};
|
|
6095
6079
|
}
|
|
6096
6080
|
async function safeBuild(options, overrides) {
|
|
6097
6081
|
var _a2, _b2, _c2;
|
|
6098
|
-
const { fabric,
|
|
6082
|
+
const { fabric, driver, events, sources } = overrides ? overrides : await setup(options);
|
|
6099
6083
|
const failedPlugins = /* @__PURE__ */ new Set();
|
|
6100
6084
|
const pluginTimings = /* @__PURE__ */ new Map();
|
|
6101
|
-
const config =
|
|
6085
|
+
const config = driver.config;
|
|
6102
6086
|
try {
|
|
6103
|
-
for (const plugin of
|
|
6104
|
-
const context =
|
|
6087
|
+
for (const plugin of driver.plugins) {
|
|
6088
|
+
const context = driver.getContext(plugin);
|
|
6105
6089
|
const hrStart = process.hrtime();
|
|
6106
6090
|
const installer = plugin.install.bind(context);
|
|
6107
6091
|
try {
|
|
@@ -6174,7 +6158,7 @@ async function safeBuild(options, overrides) {
|
|
|
6174
6158
|
rootDir,
|
|
6175
6159
|
existingExports: new Set((_b2 = (_a2 = existingBarrel == null ? void 0 : existingBarrel.exports) == null ? void 0 : _a2.flatMap((e) => Array.isArray(e.name) ? e.name : [e.name]).filter((n) => Boolean(n))) != null ? _b2 : []),
|
|
6176
6160
|
config,
|
|
6177
|
-
|
|
6161
|
+
driver
|
|
6178
6162
|
}),
|
|
6179
6163
|
sources: [],
|
|
6180
6164
|
imports: [],
|
|
@@ -6192,7 +6176,7 @@ async function safeBuild(options, overrides) {
|
|
|
6192
6176
|
failedPlugins,
|
|
6193
6177
|
fabric,
|
|
6194
6178
|
files,
|
|
6195
|
-
|
|
6179
|
+
driver,
|
|
6196
6180
|
pluginTimings,
|
|
6197
6181
|
sources
|
|
6198
6182
|
};
|
|
@@ -6201,16 +6185,16 @@ async function safeBuild(options, overrides) {
|
|
|
6201
6185
|
failedPlugins,
|
|
6202
6186
|
fabric,
|
|
6203
6187
|
files: [],
|
|
6204
|
-
|
|
6188
|
+
driver,
|
|
6205
6189
|
pluginTimings,
|
|
6206
6190
|
error,
|
|
6207
6191
|
sources
|
|
6208
6192
|
};
|
|
6209
6193
|
}
|
|
6210
6194
|
}
|
|
6211
|
-
function buildBarrelExports({ barrelFiles, rootDir, existingExports, config,
|
|
6195
|
+
function buildBarrelExports({ barrelFiles, rootDir, existingExports, config, driver }) {
|
|
6212
6196
|
const pluginNameMap = /* @__PURE__ */ new Map();
|
|
6213
|
-
for (const plugin of
|
|
6197
|
+
for (const plugin of driver.plugins) pluginNameMap.set(plugin.name, plugin);
|
|
6214
6198
|
return barrelFiles.flatMap((file) => {
|
|
6215
6199
|
var _a2, _b2;
|
|
6216
6200
|
const containsOnlyTypes = (_a2 = file.sources) == null ? void 0 : _a2.every((source) => source.isTypeOnly);
|
|
@@ -6275,7 +6259,7 @@ function defineGenerator(generator) {
|
|
|
6275
6259
|
function definePlugin(build2) {
|
|
6276
6260
|
return (options) => build2(options != null ? options : {});
|
|
6277
6261
|
}
|
|
6278
|
-
var PackageManager = (
|
|
6262
|
+
var PackageManager = (_e = class {
|
|
6279
6263
|
constructor(workspace) {
|
|
6280
6264
|
__privateAdd$c(this, _PackageManager_instances);
|
|
6281
6265
|
__privateAdd$c(this, _cwd);
|
|
@@ -6317,16 +6301,16 @@ var PackageManager = (_f = class {
|
|
|
6317
6301
|
return JSON.parse(json);
|
|
6318
6302
|
}
|
|
6319
6303
|
static setVersion(dependency, version2) {
|
|
6320
|
-
__privateGet$c(
|
|
6304
|
+
__privateGet$c(_e, _cache)[dependency] = version2;
|
|
6321
6305
|
}
|
|
6322
6306
|
async getVersion(dependency) {
|
|
6323
|
-
if (typeof dependency === "string" && __privateGet$c(
|
|
6307
|
+
if (typeof dependency === "string" && __privateGet$c(_e, _cache)[dependency]) return __privateGet$c(_e, _cache)[dependency];
|
|
6324
6308
|
const packageJSON = await this.getPackageJSON();
|
|
6325
6309
|
if (!packageJSON) return;
|
|
6326
6310
|
return __privateMethod$c(this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
|
|
6327
6311
|
}
|
|
6328
6312
|
getVersionSync(dependency) {
|
|
6329
|
-
if (typeof dependency === "string" && __privateGet$c(
|
|
6313
|
+
if (typeof dependency === "string" && __privateGet$c(_e, _cache)[dependency]) return __privateGet$c(_e, _cache)[dependency];
|
|
6330
6314
|
const packageJSON = this.getPackageJSONSync();
|
|
6331
6315
|
if (!packageJSON) return;
|
|
6332
6316
|
return __privateMethod$c(this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
|
|
@@ -6355,7 +6339,7 @@ var PackageManager = (_f = class {
|
|
|
6355
6339
|
if (typeof dependency === "string" && dependencies[dependency]) return dependencies[dependency];
|
|
6356
6340
|
const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
|
|
6357
6341
|
return matchedDependency ? dependencies[matchedDependency] : void 0;
|
|
6358
|
-
}, __privateAdd$c(
|
|
6342
|
+
}, __privateAdd$c(_e, _cache, {}), _e);
|
|
6359
6343
|
const memoryStorage = defineStorage(() => {
|
|
6360
6344
|
const store = /* @__PURE__ */ new Map();
|
|
6361
6345
|
return {
|
|
@@ -6386,7 +6370,7 @@ const memoryStorage = defineStorage(() => {
|
|
|
6386
6370
|
}
|
|
6387
6371
|
};
|
|
6388
6372
|
});
|
|
6389
|
-
(
|
|
6373
|
+
(_f = class {
|
|
6390
6374
|
constructor() {
|
|
6391
6375
|
__privateAdd$c(this, _items, []);
|
|
6392
6376
|
}
|
|
@@ -6412,11 +6396,11 @@ const memoryStorage = defineStorage(() => {
|
|
|
6412
6396
|
const required = (_b2 = items.every((item) => item.required)) != null ? _b2 : true;
|
|
6413
6397
|
items.forEach((item) => {
|
|
6414
6398
|
var _a3, _b3;
|
|
6415
|
-
name = __privateMethod$c(_a3 =
|
|
6399
|
+
name = __privateMethod$c(_a3 = _f, _FunctionParams_static, addParams_fn).call(_a3, name, {
|
|
6416
6400
|
...item,
|
|
6417
6401
|
type: void 0
|
|
6418
6402
|
});
|
|
6419
|
-
if (items.some((item2) => item2.type)) type = __privateMethod$c(_b3 =
|
|
6403
|
+
if (items.some((item2) => item2.type)) type = __privateMethod$c(_b3 = _f, _FunctionParams_static, addParams_fn).call(_b3, type, item);
|
|
6420
6404
|
});
|
|
6421
6405
|
return {
|
|
6422
6406
|
name: `{ ${name.join(", ")} }`,
|
|
@@ -6427,26 +6411,26 @@ const memoryStorage = defineStorage(() => {
|
|
|
6427
6411
|
}
|
|
6428
6412
|
toObject() {
|
|
6429
6413
|
var _a2;
|
|
6430
|
-
const items = __privateMethod$c(_a2 =
|
|
6431
|
-
return
|
|
6414
|
+
const items = __privateMethod$c(_a2 = _f, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$c(this, _items)).flat();
|
|
6415
|
+
return _f.toObject(items);
|
|
6432
6416
|
}
|
|
6433
6417
|
static toString(items) {
|
|
6434
6418
|
var _a2;
|
|
6435
|
-
return __privateMethod$c(_a2 =
|
|
6419
|
+
return __privateMethod$c(_a2 = _f, _FunctionParams_static, orderItems_fn).call(_a2, items).reduce((acc, item) => {
|
|
6436
6420
|
var _a3, _b2, _c2;
|
|
6437
6421
|
if (Array.isArray(item)) {
|
|
6438
6422
|
if (item.length <= 0) return acc;
|
|
6439
|
-
const subItems = __privateMethod$c(_a3 =
|
|
6440
|
-
const objectItem =
|
|
6441
|
-
return __privateMethod$c(_b2 =
|
|
6423
|
+
const subItems = __privateMethod$c(_a3 = _f, _FunctionParams_static, orderItems_fn).call(_a3, item);
|
|
6424
|
+
const objectItem = _f.toObject(subItems);
|
|
6425
|
+
return __privateMethod$c(_b2 = _f, _FunctionParams_static, addParams_fn).call(_b2, acc, objectItem);
|
|
6442
6426
|
}
|
|
6443
|
-
return __privateMethod$c(_c2 =
|
|
6427
|
+
return __privateMethod$c(_c2 = _f, _FunctionParams_static, addParams_fn).call(_c2, acc, item);
|
|
6444
6428
|
}, []).join(", ");
|
|
6445
6429
|
}
|
|
6446
6430
|
toString() {
|
|
6447
6431
|
var _a2;
|
|
6448
|
-
const items = __privateMethod$c(_a2 =
|
|
6449
|
-
return
|
|
6432
|
+
const items = __privateMethod$c(_a2 = _f, _FunctionParams_static, orderItems_fn).call(_a2, __privateGet$c(this, _items));
|
|
6433
|
+
return _f.toString(items);
|
|
6450
6434
|
}
|
|
6451
6435
|
}, _items = new WeakMap(), _FunctionParams_static = new WeakSet(), orderItems_fn = function(items) {
|
|
6452
6436
|
return sortBy(items.filter(Boolean), [(item) => Array.isArray(item), "desc"], [(item) => !Array.isArray(item) && item.default !== void 0, "asc"], [(item) => {
|
|
@@ -6465,7 +6449,7 @@ const memoryStorage = defineStorage(() => {
|
|
|
6465
6449
|
else acc.push(`${parameterName}?: ${type}`);
|
|
6466
6450
|
else acc.push(`${parameterName}`);
|
|
6467
6451
|
return acc;
|
|
6468
|
-
}, __privateAdd$c(
|
|
6452
|
+
}, __privateAdd$c(_f, _FunctionParams_static), _f);
|
|
6469
6453
|
async function isFormatterAvailable(formatter) {
|
|
6470
6454
|
try {
|
|
6471
6455
|
await x(formatter, ["--version"], { nodeOptions: { stdio: "ignore" } });
|
|
@@ -6481,7 +6465,7 @@ async function detectFormatter() {
|
|
|
6481
6465
|
"prettier"
|
|
6482
6466
|
]) if (await isFormatterAvailable(formatter)) return formatter;
|
|
6483
6467
|
}
|
|
6484
|
-
var TreeNode = (
|
|
6468
|
+
var TreeNode = (_g = class {
|
|
6485
6469
|
constructor(data, parent) {
|
|
6486
6470
|
__publicField$b(this, "data");
|
|
6487
6471
|
__publicField$b(this, "parent");
|
|
@@ -6491,7 +6475,7 @@ var TreeNode = (_h = class {
|
|
|
6491
6475
|
this.parent = parent;
|
|
6492
6476
|
}
|
|
6493
6477
|
addChild(data) {
|
|
6494
|
-
const child = new
|
|
6478
|
+
const child = new _g(data, this);
|
|
6495
6479
|
if (!this.children) this.children = [];
|
|
6496
6480
|
this.children.push(child);
|
|
6497
6481
|
return child;
|
|
@@ -6535,7 +6519,7 @@ var TreeNode = (_h = class {
|
|
|
6535
6519
|
try {
|
|
6536
6520
|
const filteredTree = buildDirectoryTree(files, root);
|
|
6537
6521
|
if (!filteredTree) return null;
|
|
6538
|
-
const treeNode = new
|
|
6522
|
+
const treeNode = new _g({
|
|
6539
6523
|
name: filteredTree.name,
|
|
6540
6524
|
path: filteredTree.path,
|
|
6541
6525
|
file: filteredTree.file,
|
|
@@ -6561,7 +6545,7 @@ var TreeNode = (_h = class {
|
|
|
6561
6545
|
throw new Error("Something went wrong with creating barrel files with the TreeNode class", { cause: error });
|
|
6562
6546
|
}
|
|
6563
6547
|
}
|
|
6564
|
-
}, _cachedLeaves = new WeakMap(),
|
|
6548
|
+
}, _cachedLeaves = new WeakMap(), _g);
|
|
6565
6549
|
const normalizePath = (p) => p.replaceAll("\\", "/");
|
|
6566
6550
|
function buildDirectoryTree(files, rootFolder = "") {
|
|
6567
6551
|
const normalizedRootFolder = normalizePath(rootFolder);
|
|
@@ -6601,50 +6585,48 @@ function buildDirectoryTree(files, rootFolder = "") {
|
|
|
6601
6585
|
});
|
|
6602
6586
|
return root;
|
|
6603
6587
|
}
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
isIndexable: false
|
|
6637
|
-
});
|
|
6588
|
+
function getBarrelFilesByRoot(root, files) {
|
|
6589
|
+
var _a2;
|
|
6590
|
+
const cachedFiles = /* @__PURE__ */ new Map();
|
|
6591
|
+
(_a2 = TreeNode.build(files, root)) == null ? void 0 : _a2.forEach((treeNode) => {
|
|
6592
|
+
var _a3, _b2, _c2;
|
|
6593
|
+
if (!treeNode || !treeNode.children || !((_a3 = treeNode.parent) == null ? void 0 : _a3.data.path)) return;
|
|
6594
|
+
const barrelFile = {
|
|
6595
|
+
path: join((_b2 = treeNode.parent) == null ? void 0 : _b2.data.path, "index.ts"),
|
|
6596
|
+
baseName: "index.ts",
|
|
6597
|
+
exports: [],
|
|
6598
|
+
imports: [],
|
|
6599
|
+
sources: []
|
|
6600
|
+
};
|
|
6601
|
+
const previousBarrelFile = cachedFiles.get(barrelFile.path);
|
|
6602
|
+
treeNode.leaves.forEach((item) => {
|
|
6603
|
+
var _a4;
|
|
6604
|
+
if (!item.data.name) return;
|
|
6605
|
+
(((_a4 = item.data.file) == null ? void 0 : _a4.sources) || []).forEach((source) => {
|
|
6606
|
+
var _a5, _b3;
|
|
6607
|
+
if (!((_a5 = item.data.file) == null ? void 0 : _a5.path) || !source.isIndexable || !source.name) return;
|
|
6608
|
+
if (previousBarrelFile == null ? void 0 : previousBarrelFile.sources.some((item2) => item2.name === source.name && item2.isTypeOnly === source.isTypeOnly)) return;
|
|
6609
|
+
barrelFile.exports.push({
|
|
6610
|
+
name: [source.name],
|
|
6611
|
+
path: getRelativePath((_b3 = treeNode.parent) == null ? void 0 : _b3.data.path, item.data.path),
|
|
6612
|
+
isTypeOnly: source.isTypeOnly
|
|
6613
|
+
});
|
|
6614
|
+
barrelFile.sources.push({
|
|
6615
|
+
name: source.name,
|
|
6616
|
+
isTypeOnly: source.isTypeOnly,
|
|
6617
|
+
value: "",
|
|
6618
|
+
isExportable: false,
|
|
6619
|
+
isIndexable: false
|
|
6638
6620
|
});
|
|
6639
6621
|
});
|
|
6640
|
-
if (previousBarrelFile) {
|
|
6641
|
-
previousBarrelFile.sources.push(...barrelFile.sources);
|
|
6642
|
-
(_c2 = previousBarrelFile.exports) == null ? void 0 : _c2.push(...barrelFile.exports || []);
|
|
6643
|
-
} else cachedFiles.set(barrelFile.path, barrelFile);
|
|
6644
6622
|
});
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6623
|
+
if (previousBarrelFile) {
|
|
6624
|
+
previousBarrelFile.sources.push(...barrelFile.sources);
|
|
6625
|
+
(_c2 = previousBarrelFile.exports) == null ? void 0 : _c2.push(...barrelFile.exports || []);
|
|
6626
|
+
} else cachedFiles.set(barrelFile.path, barrelFile);
|
|
6627
|
+
});
|
|
6628
|
+
return [...cachedFiles.values()];
|
|
6629
|
+
}
|
|
6648
6630
|
function trimExtName$1(text) {
|
|
6649
6631
|
const dotIndex = text.lastIndexOf(".");
|
|
6650
6632
|
if (dotIndex > 0 && !text.includes("/", dotIndex)) return text.slice(0, dotIndex);
|
|
@@ -6652,14 +6634,9 @@ function trimExtName$1(text) {
|
|
|
6652
6634
|
}
|
|
6653
6635
|
async function getBarrelFiles(files, { type, meta = {}, root, output }) {
|
|
6654
6636
|
if (!type || type === "propagate") return [];
|
|
6655
|
-
const barrelManager = new BarrelManager();
|
|
6656
6637
|
const pathToBuildFrom = join(root, output.path);
|
|
6657
6638
|
if (trimExtName$1(pathToBuildFrom).endsWith("index")) return [];
|
|
6658
|
-
const barrelFiles =
|
|
6659
|
-
files,
|
|
6660
|
-
root: pathToBuildFrom,
|
|
6661
|
-
meta
|
|
6662
|
-
});
|
|
6639
|
+
const barrelFiles = getBarrelFilesByRoot(pathToBuildFrom, files);
|
|
6663
6640
|
if (type === "all") return barrelFiles.map((file) => {
|
|
6664
6641
|
var _a2;
|
|
6665
6642
|
return {
|
|
@@ -6766,7 +6743,7 @@ function resolveOptions(node, { options, exclude = [], include, override = [] })
|
|
|
6766
6743
|
return options;
|
|
6767
6744
|
}
|
|
6768
6745
|
|
|
6769
|
-
var version = "5.0.0-alpha.
|
|
6746
|
+
var version = "5.0.0-alpha.7";
|
|
6770
6747
|
|
|
6771
6748
|
function isCommandMessage(msg) {
|
|
6772
6749
|
return msg.type === "command";
|
|
@@ -6820,7 +6797,7 @@ async function executeHooks({ hooks, events }) {
|
|
|
6820
6797
|
async function generate({ config, events }) {
|
|
6821
6798
|
await events.emit("generation:start", config);
|
|
6822
6799
|
await events.emit("info", config.name ? `Setup generation ${config.name}` : "Setup generation");
|
|
6823
|
-
const { sources, fabric,
|
|
6800
|
+
const { sources, fabric, driver } = await setup({
|
|
6824
6801
|
config,
|
|
6825
6802
|
events
|
|
6826
6803
|
});
|
|
@@ -6830,7 +6807,7 @@ async function generate({ config, events }) {
|
|
|
6830
6807
|
config,
|
|
6831
6808
|
events
|
|
6832
6809
|
},
|
|
6833
|
-
{
|
|
6810
|
+
{ driver, fabric, events, sources }
|
|
6834
6811
|
);
|
|
6835
6812
|
await events.emit("info", "Load summary");
|
|
6836
6813
|
const hasFailures = failedPlugins.size > 0 || error;
|
|
@@ -7977,10 +7954,10 @@ async function buildOperations(operationsOrNodes, options) {
|
|
|
7977
7954
|
const fabricChild = createReactFabric();
|
|
7978
7955
|
if (isBuildOperationsV1Options(options)) {
|
|
7979
7956
|
const { generator, Component } = options;
|
|
7980
|
-
const {
|
|
7957
|
+
const { driver, oas, mode } = generator.context;
|
|
7981
7958
|
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
7982
7959
|
meta: {
|
|
7983
|
-
|
|
7960
|
+
driver,
|
|
7984
7961
|
plugin,
|
|
7985
7962
|
mode,
|
|
7986
7963
|
oas
|
|
@@ -8017,10 +7994,10 @@ async function buildOperation(operationOrNode, options) {
|
|
|
8017
7994
|
const fabricChild = createReactFabric();
|
|
8018
7995
|
if (isBuildOperationV1Options(options)) {
|
|
8019
7996
|
const { generator, Component } = options;
|
|
8020
|
-
const {
|
|
7997
|
+
const { driver, oas, mode } = generator.context;
|
|
8021
7998
|
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
8022
7999
|
meta: {
|
|
8023
|
-
|
|
8000
|
+
driver,
|
|
8024
8001
|
plugin,
|
|
8025
8002
|
mode,
|
|
8026
8003
|
oas
|
|
@@ -8033,11 +8010,11 @@ async function buildOperation(operationOrNode, options) {
|
|
|
8033
8010
|
})
|
|
8034
8011
|
}));
|
|
8035
8012
|
} else {
|
|
8036
|
-
const { Component, adapter,
|
|
8013
|
+
const { Component, adapter, driver, mode } = options;
|
|
8037
8014
|
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
8038
8015
|
meta: {
|
|
8039
8016
|
plugin,
|
|
8040
|
-
|
|
8017
|
+
driver,
|
|
8041
8018
|
mode
|
|
8042
8019
|
},
|
|
8043
8020
|
children: /* @__PURE__ */ jsx(Component, {
|
|
@@ -8061,10 +8038,10 @@ async function buildSchema(schema, options) {
|
|
|
8061
8038
|
const fabricChild = createReactFabric();
|
|
8062
8039
|
if (isBuildSchemaV1Options(options)) {
|
|
8063
8040
|
const { generator, Component } = options;
|
|
8064
|
-
const {
|
|
8041
|
+
const { driver, oas, mode } = generator.context;
|
|
8065
8042
|
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
8066
8043
|
meta: {
|
|
8067
|
-
|
|
8044
|
+
driver,
|
|
8068
8045
|
plugin,
|
|
8069
8046
|
mode,
|
|
8070
8047
|
oas
|
|
@@ -8077,11 +8054,11 @@ async function buildSchema(schema, options) {
|
|
|
8077
8054
|
})
|
|
8078
8055
|
}));
|
|
8079
8056
|
} else {
|
|
8080
|
-
const { Component, adapter,
|
|
8057
|
+
const { Component, adapter, driver, mode } = options;
|
|
8081
8058
|
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
8082
8059
|
meta: {
|
|
8083
8060
|
plugin,
|
|
8084
|
-
|
|
8061
|
+
driver,
|
|
8085
8062
|
mode
|
|
8086
8063
|
},
|
|
8087
8064
|
children: /* @__PURE__ */ jsx(Component, {
|
|
@@ -8401,17 +8378,17 @@ getRefAlias_fn = function(schemaObject, name) {
|
|
|
8401
8378
|
__privateMethod$a(this, _SchemaGenerator_instances, ensureNameMapping_fn).call(this);
|
|
8402
8379
|
const originalName = $ref.replace(/.+\//, "");
|
|
8403
8380
|
const resolvedName = __privateGet$a(this, _schemaNameMapping).get($ref) || originalName;
|
|
8404
|
-
const propertyName = this.context.
|
|
8381
|
+
const propertyName = this.context.driver.resolveName({
|
|
8405
8382
|
name: resolvedName,
|
|
8406
8383
|
pluginName: this.context.plugin.name,
|
|
8407
8384
|
type: "function"
|
|
8408
8385
|
});
|
|
8409
|
-
const fileName = this.context.
|
|
8386
|
+
const fileName = this.context.driver.resolveName({
|
|
8410
8387
|
name: resolvedName,
|
|
8411
8388
|
pluginName: this.context.plugin.name,
|
|
8412
8389
|
type: "file"
|
|
8413
8390
|
});
|
|
8414
|
-
const file = this.context.
|
|
8391
|
+
const file = this.context.driver.getFile({
|
|
8415
8392
|
name: fileName,
|
|
8416
8393
|
pluginName: this.context.plugin.name,
|
|
8417
8394
|
extname: ".ts"
|
|
@@ -8721,7 +8698,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
8721
8698
|
options.enumSuffix
|
|
8722
8699
|
];
|
|
8723
8700
|
const enumName = useCollisionDetection ? pascalCase$9(enumNameParts.join(" ")) : getUniqueName(pascalCase$9(enumNameParts.join(" ")), this.options.usedEnumNames || {});
|
|
8724
|
-
const typeName = this.context.
|
|
8701
|
+
const typeName = this.context.driver.resolveName({
|
|
8725
8702
|
name: enumName,
|
|
8726
8703
|
pluginName: this.context.plugin.name,
|
|
8727
8704
|
type: "type"
|
|
@@ -9035,7 +9012,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
9035
9012
|
value: schemaObject,
|
|
9036
9013
|
tree
|
|
9037
9014
|
}, {
|
|
9038
|
-
config: this.context.
|
|
9015
|
+
config: this.context.driver.config,
|
|
9039
9016
|
fabric: this.context.fabric,
|
|
9040
9017
|
Component: v1Generator.Schema,
|
|
9041
9018
|
generator: this,
|
|
@@ -9050,7 +9027,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
9050
9027
|
return [];
|
|
9051
9028
|
}
|
|
9052
9029
|
return (_b2 = await ((_a2 = v1Generator.schema) == null ? void 0 : _a2.call(v1Generator, {
|
|
9053
|
-
config: this.context.
|
|
9030
|
+
config: this.context.driver.config,
|
|
9054
9031
|
generator: this,
|
|
9055
9032
|
schema: {
|
|
9056
9033
|
name,
|
|
@@ -9935,9 +9912,9 @@ function createReactGenerator(generator) {
|
|
|
9935
9912
|
const jsonGenerator = createGenerator({
|
|
9936
9913
|
name: "plugin-oas",
|
|
9937
9914
|
async schema({ schema, generator }) {
|
|
9938
|
-
const {
|
|
9915
|
+
const { driver, plugin } = generator.context;
|
|
9939
9916
|
return [{
|
|
9940
|
-
...
|
|
9917
|
+
...driver.getFile({
|
|
9941
9918
|
name: camelCase$d(schema.name),
|
|
9942
9919
|
extname: ".json",
|
|
9943
9920
|
mode: "split",
|
|
@@ -9952,7 +9929,7 @@ const jsonGenerator = createGenerator({
|
|
|
9952
9929
|
banner: getBanner({
|
|
9953
9930
|
oas: generator.context.oas,
|
|
9954
9931
|
output: plugin.options.output,
|
|
9955
|
-
config:
|
|
9932
|
+
config: driver.config
|
|
9956
9933
|
}),
|
|
9957
9934
|
format: getFooter({
|
|
9958
9935
|
oas: generator.context.oas,
|
|
@@ -10131,7 +10108,7 @@ var OperationGenerator = (_a$7 = class {
|
|
|
10131
10108
|
const options = this.getOptions(operation, method);
|
|
10132
10109
|
if (v1Generator.type === "react") {
|
|
10133
10110
|
await buildOperation(operation, {
|
|
10134
|
-
config: this.context.
|
|
10111
|
+
config: this.context.driver.config,
|
|
10135
10112
|
fabric: this.context.fabric,
|
|
10136
10113
|
Component: v1Generator.Operation,
|
|
10137
10114
|
generator: this,
|
|
@@ -10147,7 +10124,7 @@ var OperationGenerator = (_a$7 = class {
|
|
|
10147
10124
|
}
|
|
10148
10125
|
return (_b = await ((_a4 = v1Generator.operation) == null ? void 0 : _a4.call(v1Generator, {
|
|
10149
10126
|
generator: this,
|
|
10150
|
-
config: this.context.
|
|
10127
|
+
config: this.context.driver.config,
|
|
10151
10128
|
operation,
|
|
10152
10129
|
plugin: {
|
|
10153
10130
|
...this.context.plugin,
|
|
@@ -10162,7 +10139,7 @@ var OperationGenerator = (_a$7 = class {
|
|
|
10162
10139
|
if (v1Generator.type === "react") {
|
|
10163
10140
|
await buildOperations(operations.map((op) => op.operation), {
|
|
10164
10141
|
fabric: this.context.fabric,
|
|
10165
|
-
config: this.context.
|
|
10142
|
+
config: this.context.driver.config,
|
|
10166
10143
|
Component: v1Generator.Operations,
|
|
10167
10144
|
generator: this,
|
|
10168
10145
|
plugin: this.context.plugin
|
|
@@ -10171,7 +10148,7 @@ var OperationGenerator = (_a$7 = class {
|
|
|
10171
10148
|
}
|
|
10172
10149
|
const operationsResult = await ((_a3 = v1Generator.operations) == null ? void 0 : _a3.call(v1Generator, {
|
|
10173
10150
|
generator: this,
|
|
10174
|
-
config: this.context.
|
|
10151
|
+
config: this.context.driver.config,
|
|
10175
10152
|
operations: operations.map((op) => op.operation),
|
|
10176
10153
|
plugin: this.context.plugin
|
|
10177
10154
|
}));
|
|
@@ -10287,7 +10264,7 @@ const pluginOas = definePlugin((options) => {
|
|
|
10287
10264
|
}, {
|
|
10288
10265
|
fabric: this.fabric,
|
|
10289
10266
|
oas,
|
|
10290
|
-
|
|
10267
|
+
driver: this.driver,
|
|
10291
10268
|
events: this.events,
|
|
10292
10269
|
plugin: this.plugin,
|
|
10293
10270
|
contentType,
|
|
@@ -10300,7 +10277,7 @@ const pluginOas = definePlugin((options) => {
|
|
|
10300
10277
|
const operationFiles = await new OperationGenerator(this.plugin.options, {
|
|
10301
10278
|
fabric: this.fabric,
|
|
10302
10279
|
oas,
|
|
10303
|
-
|
|
10280
|
+
driver: this.driver,
|
|
10304
10281
|
events: this.events,
|
|
10305
10282
|
plugin: this.plugin,
|
|
10306
10283
|
contentType,
|
|
@@ -209411,7 +209388,6 @@ const parse$1 = createParser({
|
|
|
209411
209388
|
}).map(([name2, schemas]) => {
|
|
209412
209389
|
var _a2, _b2, _c2, _d2, _e2;
|
|
209413
209390
|
const mappedName = ((_a2 = schemas.find((schema2) => schema2.keyword === schemaKeywords.name)) == null ? void 0 : _a2.args) || name2;
|
|
209414
|
-
if (options.mapper && Object.hasOwn(options.mapper, mappedName)) return options.mapper[mappedName];
|
|
209415
209391
|
const isNullish = schemas.some((schema2) => schema2.keyword === schemaKeywords.nullish);
|
|
209416
209392
|
const isNullable = schemas.some((schema2) => schema2.keyword === schemaKeywords.nullable);
|
|
209417
209393
|
const isOptional = schemas.some((schema2) => schema2.keyword === schemaKeywords.optional);
|
|
@@ -209499,7 +209475,7 @@ const parse$1 = createParser({
|
|
|
209499
209475
|
}
|
|
209500
209476
|
}
|
|
209501
209477
|
});
|
|
209502
|
-
function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, arrayType, syntaxType, enumType, enumKeyCasing,
|
|
209478
|
+
function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description }) {
|
|
209503
209479
|
const typeNodes = [];
|
|
209504
209480
|
if (!tree.length) return "";
|
|
209505
209481
|
const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema);
|
|
@@ -209513,8 +209489,7 @@ function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, array
|
|
|
209513
209489
|
}, {
|
|
209514
209490
|
optionalType,
|
|
209515
209491
|
arrayType,
|
|
209516
|
-
enumType
|
|
209517
|
-
mapper
|
|
209492
|
+
enumType
|
|
209518
209493
|
})).filter(Boolean).at(0) || typeKeywordMapper.undefined();
|
|
209519
209494
|
if (["asConst", "asPascalConst"].includes(enumType) && enumSchemas.length > 0) {
|
|
209520
209495
|
const isDirectEnum = schema.type === "array" && schema.items !== void 0;
|
|
@@ -209609,26 +209584,68 @@ function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, array
|
|
|
209609
209584
|
})] });
|
|
209610
209585
|
}
|
|
209611
209586
|
|
|
209587
|
+
function buildDefaultBanner({ title, description, version, config }) {
|
|
209588
|
+
try {
|
|
209589
|
+
let source = "";
|
|
209590
|
+
if (Array.isArray(config.input)) {
|
|
209591
|
+
const first = config.input[0];
|
|
209592
|
+
if (first && "path" in first) source = path$2.basename(first.path);
|
|
209593
|
+
} else if ("path" in config.input) source = path$2.basename(config.input.path);
|
|
209594
|
+
else if ("data" in config.input) source = "text content";
|
|
209595
|
+
let banner = "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n";
|
|
209596
|
+
if (config.output.defaultBanner === "simple") {
|
|
209597
|
+
banner += "*/\n";
|
|
209598
|
+
return banner;
|
|
209599
|
+
}
|
|
209600
|
+
if (source) banner += `* Source: ${source}
|
|
209601
|
+
`;
|
|
209602
|
+
if (title) banner += `* Title: ${title}
|
|
209603
|
+
`;
|
|
209604
|
+
if (description) {
|
|
209605
|
+
const formattedDescription = description.replace(/\n/gm, "\n* ");
|
|
209606
|
+
banner += `* Description: ${formattedDescription}
|
|
209607
|
+
`;
|
|
209608
|
+
}
|
|
209609
|
+
if (version) banner += `* OpenAPI spec version: ${version}
|
|
209610
|
+
`;
|
|
209611
|
+
banner += "*/\n";
|
|
209612
|
+
return banner;
|
|
209613
|
+
} catch (_error) {
|
|
209614
|
+
return "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/";
|
|
209615
|
+
}
|
|
209616
|
+
}
|
|
209612
209617
|
function useKubb() {
|
|
209618
|
+
var _a;
|
|
209613
209619
|
const { meta } = useFabric();
|
|
209620
|
+
const config = meta.driver.config;
|
|
209614
209621
|
const defaultPluginName = meta.plugin.name;
|
|
209622
|
+
const output = (_a = meta.plugin.options) == null ? void 0 : _a.output;
|
|
209615
209623
|
return {
|
|
209616
209624
|
plugin: meta.plugin,
|
|
209617
209625
|
mode: meta.mode,
|
|
209618
|
-
config
|
|
209619
|
-
getPluginByName: (pluginName = defaultPluginName) => meta.
|
|
209620
|
-
getFile: ({ pluginName = defaultPluginName, ...rest }) => meta.
|
|
209626
|
+
config,
|
|
209627
|
+
getPluginByName: (pluginName = defaultPluginName) => meta.driver.getPluginByName.call(meta.driver, pluginName),
|
|
209628
|
+
getFile: ({ pluginName = defaultPluginName, ...rest }) => meta.driver.getFile.call(meta.driver, {
|
|
209621
209629
|
pluginName,
|
|
209622
209630
|
...rest
|
|
209623
209631
|
}),
|
|
209624
|
-
resolveName: ({ pluginName = defaultPluginName, ...rest }) => meta.
|
|
209632
|
+
resolveName: ({ pluginName = defaultPluginName, ...rest }) => meta.driver.resolveName.call(meta.driver, {
|
|
209625
209633
|
pluginName,
|
|
209626
209634
|
...rest
|
|
209627
209635
|
}),
|
|
209628
|
-
resolvePath: ({ pluginName = defaultPluginName, ...rest }) => meta.
|
|
209636
|
+
resolvePath: ({ pluginName = defaultPluginName, ...rest }) => meta.driver.resolvePath.call(meta.driver, {
|
|
209629
209637
|
pluginName,
|
|
209630
209638
|
...rest
|
|
209631
|
-
})
|
|
209639
|
+
}),
|
|
209640
|
+
resolveBanner: (node) => {
|
|
209641
|
+
if (typeof (output == null ? void 0 : output.banner) === "function") return output.banner(node);
|
|
209642
|
+
if (typeof (output == null ? void 0 : output.banner) === "string") return output.banner;
|
|
209643
|
+
return buildDefaultBanner({ config });
|
|
209644
|
+
},
|
|
209645
|
+
resolveFooter: (node) => {
|
|
209646
|
+
if (typeof (output == null ? void 0 : output.footer) === "function") return output.footer(node);
|
|
209647
|
+
if (typeof (output == null ? void 0 : output.footer) === "string") return output.footer;
|
|
209648
|
+
}
|
|
209632
209649
|
};
|
|
209633
209650
|
}
|
|
209634
209651
|
function useMode() {
|
|
@@ -209639,9 +209656,9 @@ function usePlugin() {
|
|
|
209639
209656
|
const { meta } = useFabric();
|
|
209640
209657
|
return meta.plugin;
|
|
209641
209658
|
}
|
|
209642
|
-
function
|
|
209659
|
+
function usePluginDriver() {
|
|
209643
209660
|
const { meta } = useFabric();
|
|
209644
|
-
return meta.
|
|
209661
|
+
return meta.driver;
|
|
209645
209662
|
}
|
|
209646
209663
|
|
|
209647
209664
|
function useOas() {
|
|
@@ -209650,9 +209667,9 @@ function useOas() {
|
|
|
209650
209667
|
}
|
|
209651
209668
|
function useOperationManager(generator) {
|
|
209652
209669
|
const plugin = usePlugin();
|
|
209653
|
-
const
|
|
209670
|
+
const driver = usePluginDriver();
|
|
209654
209671
|
const getName = (operation, { prefix = "", suffix = "", pluginName = plugin.name, type }) => {
|
|
209655
|
-
return
|
|
209672
|
+
return driver.resolveName({
|
|
209656
209673
|
name: `${prefix} ${operation.getOperationId()} ${suffix}`,
|
|
209657
209674
|
pluginName,
|
|
209658
209675
|
type
|
|
@@ -209667,7 +209684,7 @@ function useOperationManager(generator) {
|
|
|
209667
209684
|
};
|
|
209668
209685
|
const getSchemas = (operation, params) => {
|
|
209669
209686
|
if (!generator) throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`);
|
|
209670
|
-
return generator.getSchemas(operation, { resolveName: (name) =>
|
|
209687
|
+
return generator.getSchemas(operation, { resolveName: (name) => driver.resolveName({
|
|
209671
209688
|
name,
|
|
209672
209689
|
pluginName: params == null ? void 0 : params.pluginName,
|
|
209673
209690
|
type: params == null ? void 0 : params.type
|
|
@@ -209681,7 +209698,7 @@ function useOperationManager(generator) {
|
|
|
209681
209698
|
suffix
|
|
209682
209699
|
});
|
|
209683
209700
|
const group = getGroup(operation);
|
|
209684
|
-
const file =
|
|
209701
|
+
const file = driver.getFile({
|
|
209685
209702
|
name,
|
|
209686
209703
|
extname,
|
|
209687
209704
|
pluginName,
|
|
@@ -209707,7 +209724,7 @@ function useOperationManager(generator) {
|
|
|
209707
209724
|
const schemas = generator.getSchemas(operation);
|
|
209708
209725
|
const errors = (schemas.errors || []).reduce((prev, acc) => {
|
|
209709
209726
|
if (!acc.statusCode) return prev;
|
|
209710
|
-
prev[acc.statusCode] =
|
|
209727
|
+
prev[acc.statusCode] = driver.resolveName({
|
|
209711
209728
|
name: acc.name,
|
|
209712
209729
|
pluginName,
|
|
209713
209730
|
type
|
|
@@ -209716,7 +209733,7 @@ function useOperationManager(generator) {
|
|
|
209716
209733
|
}, {});
|
|
209717
209734
|
const responses = (schemas.responses || []).reduce((prev, acc) => {
|
|
209718
209735
|
if (!acc.statusCode) return prev;
|
|
209719
|
-
prev[acc.statusCode] =
|
|
209736
|
+
prev[acc.statusCode] = driver.resolveName({
|
|
209720
209737
|
name: acc.name,
|
|
209721
209738
|
pluginName,
|
|
209722
209739
|
type
|
|
@@ -209724,23 +209741,23 @@ function useOperationManager(generator) {
|
|
|
209724
209741
|
return prev;
|
|
209725
209742
|
}, {});
|
|
209726
209743
|
return {
|
|
209727
|
-
request: ((_a = schemas.request) == null ? void 0 : _a.name) ?
|
|
209744
|
+
request: ((_a = schemas.request) == null ? void 0 : _a.name) ? driver.resolveName({
|
|
209728
209745
|
name: schemas.request.name,
|
|
209729
209746
|
pluginName,
|
|
209730
209747
|
type
|
|
209731
209748
|
}) : void 0,
|
|
209732
209749
|
parameters: {
|
|
209733
|
-
path: ((_b = schemas.pathParams) == null ? void 0 : _b.name) ?
|
|
209750
|
+
path: ((_b = schemas.pathParams) == null ? void 0 : _b.name) ? driver.resolveName({
|
|
209734
209751
|
name: schemas.pathParams.name,
|
|
209735
209752
|
pluginName,
|
|
209736
209753
|
type
|
|
209737
209754
|
}) : void 0,
|
|
209738
|
-
query: ((_c = schemas.queryParams) == null ? void 0 : _c.name) ?
|
|
209755
|
+
query: ((_c = schemas.queryParams) == null ? void 0 : _c.name) ? driver.resolveName({
|
|
209739
209756
|
name: schemas.queryParams.name,
|
|
209740
209757
|
pluginName,
|
|
209741
209758
|
type
|
|
209742
209759
|
}) : void 0,
|
|
209743
|
-
header: ((_d = schemas.headerParams) == null ? void 0 : _d.name) ?
|
|
209760
|
+
header: ((_d = schemas.headerParams) == null ? void 0 : _d.name) ? driver.resolveName({
|
|
209744
209761
|
name: schemas.headerParams.name,
|
|
209745
209762
|
pluginName,
|
|
209746
209763
|
type
|
|
@@ -209748,7 +209765,7 @@ function useOperationManager(generator) {
|
|
|
209748
209765
|
},
|
|
209749
209766
|
responses: {
|
|
209750
209767
|
...responses,
|
|
209751
|
-
["default"]:
|
|
209768
|
+
["default"]: driver.resolveName({
|
|
209752
209769
|
name: schemas.response.name,
|
|
209753
209770
|
pluginName,
|
|
209754
209771
|
type
|
|
@@ -209768,9 +209785,9 @@ function useOperationManager(generator) {
|
|
|
209768
209785
|
}
|
|
209769
209786
|
function useSchemaManager() {
|
|
209770
209787
|
const plugin = usePlugin();
|
|
209771
|
-
const
|
|
209788
|
+
const driver = usePluginDriver();
|
|
209772
209789
|
const getName = (name, { pluginName = plugin.name, type }) => {
|
|
209773
|
-
return
|
|
209790
|
+
return driver.resolveName({
|
|
209774
209791
|
name,
|
|
209775
209792
|
pluginName,
|
|
209776
209793
|
type
|
|
@@ -209781,7 +209798,7 @@ function useSchemaManager() {
|
|
|
209781
209798
|
type: "file",
|
|
209782
209799
|
pluginName
|
|
209783
209800
|
});
|
|
209784
|
-
const file =
|
|
209801
|
+
const file = driver.getFile({
|
|
209785
209802
|
name: resolvedName,
|
|
209786
209803
|
extname,
|
|
209787
209804
|
pluginName,
|
|
@@ -209810,37 +209827,37 @@ function stringify$1(value) {
|
|
|
209810
209827
|
if (value === void 0 || value === null) return '""';
|
|
209811
209828
|
return JSON.stringify(trimQuotes$1(value.toString()));
|
|
209812
209829
|
}
|
|
209813
|
-
function printCombinedSchema({ name, schemas,
|
|
209830
|
+
function printCombinedSchema({ name, schemas, driver }) {
|
|
209814
209831
|
const properties = {};
|
|
209815
209832
|
if (schemas.response) properties["response"] = createUnionDeclaration({ nodes: schemas.responses.map((res) => {
|
|
209816
|
-
return createTypeReferenceNode(createIdentifier(
|
|
209833
|
+
return createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209817
209834
|
name: res.name,
|
|
209818
209835
|
pluginName: pluginTsName,
|
|
209819
209836
|
type: "function"
|
|
209820
209837
|
})), void 0);
|
|
209821
209838
|
}) });
|
|
209822
|
-
if (schemas.request) properties["request"] = createTypeReferenceNode(createIdentifier(
|
|
209839
|
+
if (schemas.request) properties["request"] = createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209823
209840
|
name: schemas.request.name,
|
|
209824
209841
|
pluginName: pluginTsName,
|
|
209825
209842
|
type: "function"
|
|
209826
209843
|
})), void 0);
|
|
209827
|
-
if (schemas.pathParams) properties["pathParams"] = createTypeReferenceNode(createIdentifier(
|
|
209844
|
+
if (schemas.pathParams) properties["pathParams"] = createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209828
209845
|
name: schemas.pathParams.name,
|
|
209829
209846
|
pluginName: pluginTsName,
|
|
209830
209847
|
type: "function"
|
|
209831
209848
|
})), void 0);
|
|
209832
|
-
if (schemas.queryParams) properties["queryParams"] = createTypeReferenceNode(createIdentifier(
|
|
209849
|
+
if (schemas.queryParams) properties["queryParams"] = createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209833
209850
|
name: schemas.queryParams.name,
|
|
209834
209851
|
pluginName: pluginTsName,
|
|
209835
209852
|
type: "function"
|
|
209836
209853
|
})), void 0);
|
|
209837
|
-
if (schemas.headerParams) properties["headerParams"] = createTypeReferenceNode(createIdentifier(
|
|
209854
|
+
if (schemas.headerParams) properties["headerParams"] = createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209838
209855
|
name: schemas.headerParams.name,
|
|
209839
209856
|
pluginName: pluginTsName,
|
|
209840
209857
|
type: "function"
|
|
209841
209858
|
})), void 0);
|
|
209842
209859
|
if (schemas.errors) properties["errors"] = createUnionDeclaration({ nodes: schemas.errors.map((error) => {
|
|
209843
|
-
return createTypeReferenceNode(createIdentifier(
|
|
209860
|
+
return createTypeReferenceNode(createIdentifier(driver.resolveName({
|
|
209844
209861
|
name: error.name,
|
|
209845
209862
|
pluginName: pluginTsName,
|
|
209846
209863
|
type: "function"
|
|
@@ -209859,8 +209876,8 @@ function printCombinedSchema({ name, schemas, pluginManager }) {
|
|
|
209859
209876
|
modifiers: [modifiers.export]
|
|
209860
209877
|
}));
|
|
209861
209878
|
}
|
|
209862
|
-
function printRequestSchema({ baseName, operation, schemas,
|
|
209863
|
-
const name =
|
|
209879
|
+
function printRequestSchema({ baseName, operation, schemas, driver }) {
|
|
209880
|
+
const name = driver.resolveName({
|
|
209864
209881
|
name: `${baseName} Request`,
|
|
209865
209882
|
pluginName: pluginTsName,
|
|
209866
209883
|
type: "type"
|
|
@@ -209868,7 +209885,7 @@ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
|
|
|
209868
209885
|
const results = [];
|
|
209869
209886
|
const dataRequestProperties = [];
|
|
209870
209887
|
if (schemas.request) {
|
|
209871
|
-
const identifier =
|
|
209888
|
+
const identifier = driver.resolveName({
|
|
209872
209889
|
name: schemas.request.name,
|
|
209873
209890
|
pluginName: pluginTsName,
|
|
209874
209891
|
type: "type"
|
|
@@ -209884,7 +209901,7 @@ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
|
|
|
209884
209901
|
type: keywordTypeNodes.never
|
|
209885
209902
|
}));
|
|
209886
209903
|
if (schemas.pathParams) {
|
|
209887
|
-
const identifier =
|
|
209904
|
+
const identifier = driver.resolveName({
|
|
209888
209905
|
name: schemas.pathParams.name,
|
|
209889
209906
|
pluginName: pluginTsName,
|
|
209890
209907
|
type: "type"
|
|
@@ -209899,7 +209916,7 @@ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
|
|
|
209899
209916
|
type: keywordTypeNodes.never
|
|
209900
209917
|
}));
|
|
209901
209918
|
if (schemas.queryParams) {
|
|
209902
|
-
const identifier =
|
|
209919
|
+
const identifier = driver.resolveName({
|
|
209903
209920
|
name: schemas.queryParams.name,
|
|
209904
209921
|
pluginName: pluginTsName,
|
|
209905
209922
|
type: "type"
|
|
@@ -209915,7 +209932,7 @@ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
|
|
|
209915
209932
|
type: keywordTypeNodes.never
|
|
209916
209933
|
}));
|
|
209917
209934
|
if (schemas.headerParams) {
|
|
209918
|
-
const identifier =
|
|
209935
|
+
const identifier = driver.resolveName({
|
|
209919
209936
|
name: schemas.headerParams.name,
|
|
209920
209937
|
pluginName: pluginTsName,
|
|
209921
209938
|
type: "type"
|
|
@@ -209942,9 +209959,9 @@ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
|
|
|
209942
209959
|
results.push(safePrint(dataRequestNode));
|
|
209943
209960
|
return results.join("\n\n");
|
|
209944
209961
|
}
|
|
209945
|
-
function printResponseSchema({ baseName, schemas,
|
|
209962
|
+
function printResponseSchema({ baseName, schemas, driver, unknownType }) {
|
|
209946
209963
|
const results = [];
|
|
209947
|
-
const name =
|
|
209964
|
+
const name = driver.resolveName({
|
|
209948
209965
|
name: `${baseName} ResponseData`,
|
|
209949
209966
|
pluginName: pluginTsName,
|
|
209950
209967
|
type: "type"
|
|
@@ -209952,7 +209969,7 @@ function printResponseSchema({ baseName, schemas, pluginManager, unknownType })
|
|
|
209952
209969
|
if (schemas.responses && schemas.responses.length > 0) {
|
|
209953
209970
|
const responsesProperties = schemas.responses.map((res) => {
|
|
209954
209971
|
var _a, _b;
|
|
209955
|
-
const identifier =
|
|
209972
|
+
const identifier = driver.resolveName({
|
|
209956
209973
|
name: res.name,
|
|
209957
209974
|
pluginName: pluginTsName,
|
|
209958
209975
|
type: "type"
|
|
@@ -209987,9 +210004,9 @@ function printResponseSchema({ baseName, schemas, pluginManager, unknownType })
|
|
|
209987
210004
|
const typeGenerator$1 = createReactGenerator({
|
|
209988
210005
|
name: "typescript",
|
|
209989
210006
|
Operation({ operation, generator, plugin }) {
|
|
209990
|
-
const { options, options: {
|
|
210007
|
+
const { options, options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
|
|
209991
210008
|
const mode = useMode();
|
|
209992
|
-
const
|
|
210009
|
+
const driver = usePluginDriver();
|
|
209993
210010
|
const oas = useOas();
|
|
209994
210011
|
const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator);
|
|
209995
210012
|
const schemaManager = useSchemaManager();
|
|
@@ -210004,7 +210021,7 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210004
210021
|
oas,
|
|
210005
210022
|
events: generator.context.events,
|
|
210006
210023
|
plugin,
|
|
210007
|
-
|
|
210024
|
+
driver,
|
|
210008
210025
|
mode,
|
|
210009
210026
|
override: options.override
|
|
210010
210027
|
});
|
|
@@ -210046,7 +210063,6 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210046
210063
|
description,
|
|
210047
210064
|
tree,
|
|
210048
210065
|
schema: transformedSchema,
|
|
210049
|
-
mapper,
|
|
210050
210066
|
enumType,
|
|
210051
210067
|
enumKeyCasing,
|
|
210052
210068
|
optionalType,
|
|
@@ -210064,7 +210080,7 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210064
210080
|
banner: getBanner({
|
|
210065
210081
|
oas,
|
|
210066
210082
|
output: plugin.options.output,
|
|
210067
|
-
config:
|
|
210083
|
+
config: driver.config
|
|
210068
210084
|
}),
|
|
210069
210085
|
footer: getFooter({
|
|
210070
210086
|
oas,
|
|
@@ -210079,7 +210095,7 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210079
210095
|
baseName: name,
|
|
210080
210096
|
operation,
|
|
210081
210097
|
schemas,
|
|
210082
|
-
|
|
210098
|
+
driver
|
|
210083
210099
|
})
|
|
210084
210100
|
}), /* @__PURE__ */ jsx(File.Source, {
|
|
210085
210101
|
name: responseName,
|
|
@@ -210089,7 +210105,7 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210089
210105
|
children: printResponseSchema({
|
|
210090
210106
|
baseName: name,
|
|
210091
210107
|
schemas,
|
|
210092
|
-
|
|
210108
|
+
driver,
|
|
210093
210109
|
unknownType
|
|
210094
210110
|
})
|
|
210095
210111
|
})] }) : /* @__PURE__ */ jsx(File.Source, {
|
|
@@ -210100,16 +210116,16 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210100
210116
|
children: printCombinedSchema({
|
|
210101
210117
|
name: combinedSchemaName,
|
|
210102
210118
|
schemas,
|
|
210103
|
-
|
|
210119
|
+
driver
|
|
210104
210120
|
})
|
|
210105
210121
|
})]
|
|
210106
210122
|
});
|
|
210107
210123
|
},
|
|
210108
210124
|
Schema({ schema, plugin }) {
|
|
210109
|
-
const { options: {
|
|
210125
|
+
const { options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output } } = plugin;
|
|
210110
210126
|
const mode = useMode();
|
|
210111
210127
|
const oas = useOas();
|
|
210112
|
-
const
|
|
210128
|
+
const driver = usePluginDriver();
|
|
210113
210129
|
const { getName, getFile } = useSchemaManager();
|
|
210114
210130
|
const imports = getImports(schema.tree);
|
|
210115
210131
|
const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema);
|
|
@@ -210127,7 +210143,7 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210127
210143
|
banner: getBanner({
|
|
210128
210144
|
oas,
|
|
210129
210145
|
output,
|
|
210130
|
-
config:
|
|
210146
|
+
config: driver.config
|
|
210131
210147
|
}),
|
|
210132
210148
|
footer: getFooter({
|
|
210133
210149
|
oas,
|
|
@@ -210148,7 +210164,6 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210148
210164
|
description: schema.value.description,
|
|
210149
210165
|
tree: schema.tree,
|
|
210150
210166
|
schema: schema.value,
|
|
210151
|
-
mapper,
|
|
210152
210167
|
enumType,
|
|
210153
210168
|
enumKeyCasing,
|
|
210154
210169
|
optionalType,
|
|
@@ -210158,6 +210173,23 @@ const typeGenerator$1 = createReactGenerator({
|
|
|
210158
210173
|
});
|
|
210159
210174
|
}
|
|
210160
210175
|
});
|
|
210176
|
+
const OPTIONAL_ADDS_UNDEFINED = /* @__PURE__ */ new Set(["undefined", "questionTokenAndUndefined"]);
|
|
210177
|
+
const OPTIONAL_ADDS_QUESTION_TOKEN = /* @__PURE__ */ new Set(["questionToken", "questionTokenAndUndefined"]);
|
|
210178
|
+
const ENUM_TYPES_WITH_KEY_SUFFIX = /* @__PURE__ */ new Set(["asConst", "asPascalConst"]);
|
|
210179
|
+
const ENUM_TYPES_WITH_RUNTIME_VALUE = /* @__PURE__ */ new Set([
|
|
210180
|
+
"enum",
|
|
210181
|
+
"asConst",
|
|
210182
|
+
"asPascalConst",
|
|
210183
|
+
"constEnum",
|
|
210184
|
+
"literal",
|
|
210185
|
+
void 0
|
|
210186
|
+
]);
|
|
210187
|
+
const ENUM_TYPES_WITH_TYPE_ONLY = /* @__PURE__ */ new Set([
|
|
210188
|
+
"asConst",
|
|
210189
|
+
"asPascalConst",
|
|
210190
|
+
"literal",
|
|
210191
|
+
void 0
|
|
210192
|
+
]);
|
|
210161
210193
|
function constToTypeNode(value, format) {
|
|
210162
210194
|
if (format === "boolean") return createLiteralTypeNode(value === true ? createTrue() : createFalse());
|
|
210163
210195
|
if (format === "number" && typeof value === "number") {
|
|
@@ -210186,7 +210218,7 @@ function buildTupleNode(node, print) {
|
|
|
210186
210218
|
return createTupleTypeNode(items);
|
|
210187
210219
|
}
|
|
210188
210220
|
function buildPropertyType(schema, baseType, optionalType) {
|
|
210189
|
-
const addsUndefined =
|
|
210221
|
+
const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(optionalType);
|
|
210190
210222
|
let type = baseType;
|
|
210191
210223
|
if (schema.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
210192
210224
|
if ((schema.nullish || schema.optional) && addsUndefined) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
@@ -210221,202 +210253,200 @@ function buildIndexSignatures(node, propertyCount, print) {
|
|
|
210221
210253
|
}
|
|
210222
210254
|
return elements;
|
|
210223
210255
|
}
|
|
210224
|
-
const printerTs = definePrinter((options) =>
|
|
210225
|
-
|
|
210226
|
-
|
|
210227
|
-
|
|
210228
|
-
|
|
210229
|
-
|
|
210230
|
-
|
|
210231
|
-
|
|
210232
|
-
|
|
210233
|
-
|
|
210234
|
-
|
|
210235
|
-
|
|
210236
|
-
|
|
210237
|
-
|
|
210238
|
-
|
|
210239
|
-
|
|
210240
|
-
|
|
210241
|
-
|
|
210242
|
-
|
|
210243
|
-
|
|
210244
|
-
|
|
210245
|
-
|
|
210246
|
-
|
|
210247
|
-
|
|
210248
|
-
|
|
210249
|
-
|
|
210250
|
-
|
|
210251
|
-
|
|
210252
|
-
|
|
210253
|
-
|
|
210254
|
-
|
|
210255
|
-
|
|
210256
|
-
|
|
210257
|
-
|
|
210258
|
-
|
|
210259
|
-
|
|
210260
|
-
|
|
210261
|
-
|
|
210262
|
-
|
|
210263
|
-
|
|
210264
|
-
|
|
210265
|
-
|
|
210266
|
-
|
|
210267
|
-
|
|
210268
|
-
|
|
210269
|
-
|
|
210270
|
-
|
|
210271
|
-
|
|
210272
|
-
|
|
210273
|
-
|
|
210274
|
-
|
|
210275
|
-
|
|
210276
|
-
|
|
210277
|
-
|
|
210278
|
-
|
|
210279
|
-
|
|
210280
|
-
|
|
210281
|
-
|
|
210282
|
-
|
|
210283
|
-
|
|
210284
|
-
|
|
210285
|
-
nodes: buildMemberNodes(node.members, this.print)
|
|
210286
|
-
})) != null ? _a : void 0;
|
|
210287
|
-
},
|
|
210288
|
-
array(node) {
|
|
210289
|
-
var _a, _b;
|
|
210290
|
-
return (_b = createArrayDeclaration({
|
|
210291
|
-
nodes: ((_a = node.items) != null ? _a : []).map((item) => this.print(item)).filter(Boolean),
|
|
210292
|
-
arrayType: this.options.arrayType
|
|
210293
|
-
})) != null ? _b : void 0;
|
|
210294
|
-
},
|
|
210295
|
-
tuple(node) {
|
|
210296
|
-
return buildTupleNode(node, this.print);
|
|
210297
|
-
},
|
|
210298
|
-
object(node) {
|
|
210299
|
-
const addsQuestionToken = ["questionToken", "questionTokenAndUndefined"].includes(this.options.optionalType);
|
|
210300
|
-
const { print } = this;
|
|
210301
|
-
const propertyNodes = node.properties.map((prop) => {
|
|
210256
|
+
const printerTs = definePrinter((options) => {
|
|
210257
|
+
const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(options.optionalType);
|
|
210258
|
+
return {
|
|
210259
|
+
name: "typescript",
|
|
210260
|
+
options,
|
|
210261
|
+
nodes: {
|
|
210262
|
+
any: () => keywordTypeNodes.any,
|
|
210263
|
+
unknown: () => keywordTypeNodes.unknown,
|
|
210264
|
+
void: () => keywordTypeNodes.void,
|
|
210265
|
+
never: () => keywordTypeNodes.never,
|
|
210266
|
+
boolean: () => keywordTypeNodes.boolean,
|
|
210267
|
+
null: () => keywordTypeNodes.null,
|
|
210268
|
+
blob: () => createTypeReferenceNode("Blob", []),
|
|
210269
|
+
string: () => keywordTypeNodes.string,
|
|
210270
|
+
uuid: () => keywordTypeNodes.string,
|
|
210271
|
+
email: () => keywordTypeNodes.string,
|
|
210272
|
+
url: (node) => {
|
|
210273
|
+
if (node.path) return createUrlTemplateType(node.path);
|
|
210274
|
+
return keywordTypeNodes.string;
|
|
210275
|
+
},
|
|
210276
|
+
datetime: () => keywordTypeNodes.string,
|
|
210277
|
+
number: () => keywordTypeNodes.number,
|
|
210278
|
+
integer: () => keywordTypeNodes.number,
|
|
210279
|
+
bigint: () => keywordTypeNodes.bigint,
|
|
210280
|
+
date: dateOrStringNode,
|
|
210281
|
+
time: dateOrStringNode,
|
|
210282
|
+
ref(node) {
|
|
210283
|
+
if (!node.name) return;
|
|
210284
|
+
return createTypeReferenceNode(node.name, void 0);
|
|
210285
|
+
},
|
|
210286
|
+
enum(node) {
|
|
210287
|
+
var _a, _b, _c, _d;
|
|
210288
|
+
const values = (_c = (_b = (_a = node.namedEnumValues) == null ? void 0 : _a.map((v) => v.value)) != null ? _b : node.enumValues) != null ? _c : [];
|
|
210289
|
+
if (this.options.enumType === "inlineLiteral" || !node.name) return (_d = createUnionDeclaration({
|
|
210290
|
+
withParentheses: true,
|
|
210291
|
+
nodes: values.filter((v) => v !== null).map((value) => constToTypeNode(value, typeof value)).filter(Boolean)
|
|
210292
|
+
})) != null ? _d : void 0;
|
|
210293
|
+
const resolvedName = pascalCase$6(node.name);
|
|
210294
|
+
return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) ? `${resolvedName}Key` : resolvedName, void 0);
|
|
210295
|
+
},
|
|
210296
|
+
union(node) {
|
|
210297
|
+
var _a, _b, _c;
|
|
210298
|
+
const members = (_a = node.members) != null ? _a : [];
|
|
210299
|
+
const hasStringLiteral = members.some((m) => m.type === "enum" && m.enumType === "string");
|
|
210300
|
+
const hasPlainString = members.some((m) => isPlainStringType(m));
|
|
210301
|
+
if (hasStringLiteral && hasPlainString) return (_b = createUnionDeclaration({
|
|
210302
|
+
withParentheses: true,
|
|
210303
|
+
nodes: members.map((m) => {
|
|
210304
|
+
if (isPlainStringType(m)) return createIntersectionDeclaration({
|
|
210305
|
+
nodes: [keywordTypeNodes.string, createTypeLiteralNode([])],
|
|
210306
|
+
withParentheses: true
|
|
210307
|
+
});
|
|
210308
|
+
return this.print(m);
|
|
210309
|
+
}).filter(Boolean)
|
|
210310
|
+
})) != null ? _b : void 0;
|
|
210311
|
+
return (_c = createUnionDeclaration({
|
|
210312
|
+
withParentheses: true,
|
|
210313
|
+
nodes: buildMemberNodes(members, this.print)
|
|
210314
|
+
})) != null ? _c : void 0;
|
|
210315
|
+
},
|
|
210316
|
+
intersection(node) {
|
|
210302
210317
|
var _a;
|
|
210303
|
-
|
|
210304
|
-
|
|
210305
|
-
|
|
210306
|
-
|
|
210307
|
-
|
|
210308
|
-
|
|
210309
|
-
|
|
210310
|
-
|
|
210311
|
-
|
|
210312
|
-
|
|
210313
|
-
|
|
210318
|
+
return (_a = createIntersectionDeclaration({
|
|
210319
|
+
withParentheses: true,
|
|
210320
|
+
nodes: buildMemberNodes(node.members, this.print)
|
|
210321
|
+
})) != null ? _a : void 0;
|
|
210322
|
+
},
|
|
210323
|
+
array(node) {
|
|
210324
|
+
var _a, _b;
|
|
210325
|
+
return (_b = createArrayDeclaration({
|
|
210326
|
+
nodes: ((_a = node.items) != null ? _a : []).map((item) => this.print(item)).filter(Boolean),
|
|
210327
|
+
arrayType: this.options.arrayType
|
|
210328
|
+
})) != null ? _b : void 0;
|
|
210329
|
+
},
|
|
210330
|
+
tuple(node) {
|
|
210331
|
+
return buildTupleNode(node, this.print);
|
|
210332
|
+
},
|
|
210333
|
+
object(node) {
|
|
210334
|
+
const { print, options: options2 } = this;
|
|
210335
|
+
const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options2.optionalType);
|
|
210336
|
+
const propertyNodes = node.properties.map((prop) => {
|
|
210337
|
+
var _a;
|
|
210338
|
+
const baseType = (_a = print(prop.schema)) != null ? _a : keywordTypeNodes.unknown;
|
|
210339
|
+
const type = buildPropertyType(prop.schema, baseType, options2.optionalType);
|
|
210340
|
+
return appendJSDocToNode({
|
|
210341
|
+
node: createPropertySignature({
|
|
210342
|
+
questionToken: prop.schema.optional || prop.schema.nullish ? addsQuestionToken : false,
|
|
210343
|
+
name: prop.name,
|
|
210344
|
+
type,
|
|
210345
|
+
readOnly: prop.schema.readOnly
|
|
210346
|
+
}),
|
|
210347
|
+
comments: buildPropertyJSDocComments(prop.schema)
|
|
210348
|
+
});
|
|
210314
210349
|
});
|
|
210350
|
+
const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, print)];
|
|
210351
|
+
if (!allElements.length) return keywordTypeNodes.object;
|
|
210352
|
+
return createTypeLiteralNode(allElements);
|
|
210353
|
+
}
|
|
210354
|
+
},
|
|
210355
|
+
print(node) {
|
|
210356
|
+
let type = this.print(node);
|
|
210357
|
+
if (!type) return;
|
|
210358
|
+
if (node.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
210359
|
+
if ((node.nullish || node.optional) && addsUndefined) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210360
|
+
const { typeName, syntaxType = "type", description, keysToOmit } = this.options;
|
|
210361
|
+
if (!typeName) return type;
|
|
210362
|
+
const useTypeGeneration = syntaxType === "type" || type.kind === syntaxKind.union || !!(keysToOmit == null ? void 0 : keysToOmit.length);
|
|
210363
|
+
return createTypeDeclaration({
|
|
210364
|
+
name: typeName,
|
|
210365
|
+
isExportable: true,
|
|
210366
|
+
type: (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
|
|
210367
|
+
keys: keysToOmit,
|
|
210368
|
+
type,
|
|
210369
|
+
nonNullable: true
|
|
210370
|
+
}) : type,
|
|
210371
|
+
syntax: useTypeGeneration ? "type" : "interface",
|
|
210372
|
+
comments: [
|
|
210373
|
+
(node == null ? void 0 : node.title) ? jsStringEscape$1(node.title) : void 0,
|
|
210374
|
+
description ? `@description ${jsStringEscape$1(description)}` : void 0,
|
|
210375
|
+
(node == null ? void 0 : node.deprecated) ? "@deprecated" : void 0,
|
|
210376
|
+
node && "min" in node && node.min !== void 0 ? `@minLength ${node.min}` : void 0,
|
|
210377
|
+
node && "max" in node && node.max !== void 0 ? `@maxLength ${node.max}` : void 0,
|
|
210378
|
+
node && "pattern" in node && node.pattern ? `@pattern ${node.pattern}` : void 0,
|
|
210379
|
+
(node == null ? void 0 : node.default) ? `@default ${node.default}` : void 0,
|
|
210380
|
+
(node == null ? void 0 : node.example) ? `@example ${node.example}` : void 0
|
|
210381
|
+
]
|
|
210315
210382
|
});
|
|
210316
|
-
const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, print)];
|
|
210317
|
-
if (!allElements.length) return keywordTypeNodes.object;
|
|
210318
|
-
return createTypeLiteralNode(allElements);
|
|
210319
210383
|
}
|
|
210320
|
-
}
|
|
210321
|
-
})
|
|
210322
|
-
function
|
|
210323
|
-
const
|
|
210324
|
-
|
|
210384
|
+
};
|
|
210385
|
+
});
|
|
210386
|
+
function getEnumNames(node, enumType) {
|
|
210387
|
+
const resolved = pascalCase$6(node.name);
|
|
210388
|
+
return {
|
|
210389
|
+
enumName: enumType === "asPascalConst" ? resolved : camelCase$a(node.name),
|
|
210390
|
+
typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? `${resolved}Key` : resolved
|
|
210391
|
+
};
|
|
210392
|
+
}
|
|
210393
|
+
function Enum({ node, enumType, enumKeyCasing }) {
|
|
210394
|
+
var _a, _b, _c, _d;
|
|
210395
|
+
const { enumName, typeName } = getEnumNames(node, enumType);
|
|
210396
|
+
const [nameNode, typeNode] = createEnumDeclaration({
|
|
210397
|
+
name: enumName,
|
|
210398
|
+
typeName,
|
|
210399
|
+
enums: (_d = (_c = (_a = node.namedEnumValues) == null ? void 0 : _a.map((v) => [trimQuotes$1(v.name.toString()), v.value])) != null ? _c : (_b = node.enumValues) == null ? void 0 : _b.filter((v) => v !== null && v !== void 0).map((v) => [trimQuotes$1(v.toString()), v])) != null ? _d : [],
|
|
210400
|
+
type: enumType,
|
|
210401
|
+
enumKeyCasing
|
|
210402
|
+
});
|
|
210403
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [nameNode && /* @__PURE__ */ jsx(File.Source, {
|
|
210404
|
+
name: enumName,
|
|
210405
|
+
isExportable: true,
|
|
210406
|
+
isIndexable: true,
|
|
210407
|
+
isTypeOnly: false,
|
|
210408
|
+
children: safePrint(nameNode)
|
|
210409
|
+
}), /* @__PURE__ */ jsx(File.Source, {
|
|
210410
|
+
name: typeName,
|
|
210411
|
+
isIndexable: true,
|
|
210412
|
+
isExportable: ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
|
|
210413
|
+
isTypeOnly: ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
|
|
210414
|
+
children: safePrint(typeNode)
|
|
210415
|
+
})] });
|
|
210416
|
+
}
|
|
210417
|
+
function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description }) {
|
|
210418
|
+
const resolvedDescription = description || (node == null ? void 0 : node.description);
|
|
210325
210419
|
const enumSchemaNodes = collect(node, { schema(n) {
|
|
210326
210420
|
if (n.type === "enum" && n.name) return n;
|
|
210327
210421
|
} });
|
|
210328
|
-
|
|
210422
|
+
const typeNode = printerTs({
|
|
210329
210423
|
optionalType,
|
|
210330
210424
|
arrayType,
|
|
210331
210425
|
enumType,
|
|
210332
|
-
|
|
210426
|
+
typeName: name,
|
|
210427
|
+
syntaxType,
|
|
210428
|
+
description: resolvedDescription,
|
|
210429
|
+
keysToOmit
|
|
210333
210430
|
}).print(node);
|
|
210334
|
-
if (!
|
|
210335
|
-
|
|
210336
|
-
const isDirectEnum = node.type === "array" && node.items !== void 0;
|
|
210337
|
-
const isEnumOnly = "enum" in node && node.enum;
|
|
210338
|
-
if (isDirectEnum || isEnumOnly) {
|
|
210339
|
-
type = createTypeReferenceNode(`${enumSchemaNodes[0].name}Key`);
|
|
210340
|
-
if (isDirectEnum) if (arrayType === "generic") type = createTypeReferenceNode(createIdentifier("Array"), [type]);
|
|
210341
|
-
else type = createArrayTypeNode(type);
|
|
210342
|
-
}
|
|
210343
|
-
}
|
|
210344
|
-
if (node) {
|
|
210345
|
-
if (node.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
210346
|
-
if (node.nullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210347
|
-
if (node.optional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210348
|
-
}
|
|
210349
|
-
const useTypeGeneration = syntaxType === "type" || [syntaxKind.union].includes(type.kind) || !!(keysToOmit == null ? void 0 : keysToOmit.length);
|
|
210350
|
-
typeNodes.push(createTypeDeclaration({
|
|
210351
|
-
name,
|
|
210352
|
-
isExportable: true,
|
|
210353
|
-
type: (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
|
|
210354
|
-
keys: keysToOmit,
|
|
210355
|
-
type,
|
|
210356
|
-
nonNullable: true
|
|
210357
|
-
}) : type,
|
|
210358
|
-
syntax: useTypeGeneration ? "type" : "interface",
|
|
210359
|
-
comments: [
|
|
210360
|
-
(node == null ? void 0 : node.title) ? `${jsStringEscape$1(node.title)}` : void 0,
|
|
210361
|
-
description ? `@description ${jsStringEscape$1(description)}` : void 0,
|
|
210362
|
-
(node == null ? void 0 : node.deprecated) ? "@deprecated" : void 0,
|
|
210363
|
-
node && "min" in node && node.min !== void 0 ? `@minLength ${node.min}` : void 0,
|
|
210364
|
-
node && "max" in node && node.max !== void 0 ? `@maxLength ${node.max}` : void 0,
|
|
210365
|
-
node && "pattern" in node && node.pattern ? `@pattern ${node.pattern}` : void 0,
|
|
210366
|
-
(node == null ? void 0 : node.default) ? `@default ${node.default}` : void 0,
|
|
210367
|
-
(node == null ? void 0 : node.example) ? `@example ${node.example}` : void 0
|
|
210368
|
-
]
|
|
210369
|
-
}));
|
|
210370
|
-
const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((enumSchemaNode) => {
|
|
210371
|
-
var _a, _b, _c, _d;
|
|
210372
|
-
const enumName = enumType === "asPascalConst" ? pascalCase$6(enumSchemaNode.name) : camelCase$a(enumSchemaNode.name);
|
|
210373
|
-
const typeName = ["asConst", "asPascalConst"].includes(enumType) ? `${enumSchemaNode.name}Key` : enumSchemaNode.name;
|
|
210374
|
-
const [nameNode, typeNode] = createEnumDeclaration({
|
|
210375
|
-
name: enumName,
|
|
210376
|
-
typeName,
|
|
210377
|
-
enums: (_d = (_c = (_a = enumSchemaNode.namedEnumValues) == null ? void 0 : _a.map((v) => [trimQuotes$1(v.name.toString()), v.value])) != null ? _c : (_b = enumSchemaNode.enumValues) == null ? void 0 : _b.filter((v) => v !== null && v !== void 0).map((v) => [trimQuotes$1(v.toString()), v])) != null ? _d : [],
|
|
210378
|
-
type: enumType,
|
|
210379
|
-
enumKeyCasing
|
|
210380
|
-
});
|
|
210431
|
+
if (!typeNode) return;
|
|
210432
|
+
const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node2) => {
|
|
210381
210433
|
return {
|
|
210382
|
-
|
|
210383
|
-
|
|
210384
|
-
name: enumName,
|
|
210385
|
-
typeName
|
|
210434
|
+
node: node2,
|
|
210435
|
+
...getEnumNames(node2, enumType)
|
|
210386
210436
|
};
|
|
210387
210437
|
});
|
|
210388
210438
|
const shouldExportEnums = enumType !== "inlineLiteral";
|
|
210389
210439
|
const shouldExportType = enumType === "inlineLiteral" || enums.every((item) => item.typeName !== name);
|
|
210390
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [shouldExportEnums && enums.map(({
|
|
210391
|
-
|
|
210392
|
-
|
|
210393
|
-
|
|
210394
|
-
|
|
210395
|
-
children: safePrint(nameNode)
|
|
210396
|
-
}), /* @__PURE__ */ jsx(File.Source, {
|
|
210397
|
-
name: typeName,
|
|
210398
|
-
isIndexable: true,
|
|
210399
|
-
isExportable: [
|
|
210400
|
-
"enum",
|
|
210401
|
-
"asConst",
|
|
210402
|
-
"asPascalConst",
|
|
210403
|
-
"constEnum",
|
|
210404
|
-
"literal",
|
|
210405
|
-
void 0
|
|
210406
|
-
].includes(enumType),
|
|
210407
|
-
isTypeOnly: [
|
|
210408
|
-
"asConst",
|
|
210409
|
-
"asPascalConst",
|
|
210410
|
-
"literal",
|
|
210411
|
-
void 0
|
|
210412
|
-
].includes(enumType),
|
|
210413
|
-
children: safePrint(typeNode)
|
|
210414
|
-
})] })), shouldExportType && /* @__PURE__ */ jsx(File.Source, {
|
|
210440
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [shouldExportEnums && enums.map(({ node: node2 }) => /* @__PURE__ */ jsx(Enum, {
|
|
210441
|
+
node: node2,
|
|
210442
|
+
enumType,
|
|
210443
|
+
enumKeyCasing
|
|
210444
|
+
})), shouldExportType && /* @__PURE__ */ jsx(File.Source, {
|
|
210415
210445
|
name: typedName,
|
|
210416
210446
|
isTypeOnly: true,
|
|
210417
210447
|
isExportable: true,
|
|
210418
210448
|
isIndexable: true,
|
|
210419
|
-
children: safePrint(
|
|
210449
|
+
children: safePrint(typeNode)
|
|
210420
210450
|
})] });
|
|
210421
210451
|
}
|
|
210422
210452
|
function buildParamsSchema({ params, operationId, resolveName }) {
|
|
@@ -210427,7 +210457,7 @@ function buildParamsSchema({ params, operationId, resolveName }) {
|
|
|
210427
210457
|
schema: createSchema({
|
|
210428
210458
|
type: "ref",
|
|
210429
210459
|
name: resolveName({
|
|
210430
|
-
name: `${operationId} ${param.name}`,
|
|
210460
|
+
name: `${operationId} ${pascalCase$6(param.in)} ${param.name}`,
|
|
210431
210461
|
type: "function"
|
|
210432
210462
|
}),
|
|
210433
210463
|
optional: !param.required
|
|
@@ -210447,7 +210477,7 @@ function buildDataSchemaNode({ node, resolveName }) {
|
|
|
210447
210477
|
schema: node.requestBody ? createSchema({
|
|
210448
210478
|
type: "ref",
|
|
210449
210479
|
name: resolveName({
|
|
210450
|
-
name: `${node.operationId}
|
|
210480
|
+
name: `${node.operationId} Data`,
|
|
210451
210481
|
type: "function"
|
|
210452
210482
|
}),
|
|
210453
210483
|
optional: true
|
|
@@ -210515,7 +210545,7 @@ function buildResponsesSchemaNode({ node, resolveName }) {
|
|
|
210515
210545
|
schema: createSchema({
|
|
210516
210546
|
type: "ref",
|
|
210517
210547
|
name: resolveName({
|
|
210518
|
-
name: `${node.operationId} ${res.statusCode}`,
|
|
210548
|
+
name: `${node.operationId} Status ${res.statusCode}`,
|
|
210519
210549
|
type: "function"
|
|
210520
210550
|
})
|
|
210521
210551
|
})
|
|
@@ -210530,7 +210560,7 @@ function buildResponseUnionSchemaNode({ node, resolveName }) {
|
|
|
210530
210560
|
members: responsesWithSchema.map((res) => createSchema({
|
|
210531
210561
|
type: "ref",
|
|
210532
210562
|
name: resolveName({
|
|
210533
|
-
name: `${node.operationId} ${res.statusCode}`,
|
|
210563
|
+
name: `${node.operationId} Status ${res.statusCode}`,
|
|
210534
210564
|
type: "function"
|
|
210535
210565
|
})
|
|
210536
210566
|
}))
|
|
@@ -210540,12 +210570,13 @@ const typeGenerator = defineGenerator({
|
|
|
210540
210570
|
name: "typescript",
|
|
210541
210571
|
type: "react",
|
|
210542
210572
|
Operation({ node, adapter, options }) {
|
|
210543
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing,
|
|
210573
|
+
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group } = options;
|
|
210544
210574
|
const { mode, getFile, resolveName } = useKubb();
|
|
210545
210575
|
const file = getFile({
|
|
210546
210576
|
name: node.operationId,
|
|
210547
210577
|
extname: ".ts",
|
|
210548
|
-
mode
|
|
210578
|
+
mode,
|
|
210579
|
+
options: { group: group ? group.type === "tag" ? { tag: node.tags[0] } : { path: node.path } : void 0 }
|
|
210549
210580
|
});
|
|
210550
210581
|
const params = applyParamsCasing$1(node.parameters, paramsCasing);
|
|
210551
210582
|
function renderSchemaType({ node: schemaNode, name, typedName, description }) {
|
|
@@ -210579,29 +210610,28 @@ const typeGenerator = defineGenerator({
|
|
|
210579
210610
|
enumKeyCasing,
|
|
210580
210611
|
optionalType,
|
|
210581
210612
|
arrayType,
|
|
210582
|
-
syntaxType
|
|
210583
|
-
mapper
|
|
210613
|
+
syntaxType
|
|
210584
210614
|
})] });
|
|
210585
210615
|
}
|
|
210586
210616
|
const paramTypes = params.map((param) => renderSchemaType({
|
|
210587
210617
|
node: param.schema,
|
|
210588
210618
|
name: resolveName({
|
|
210589
|
-
name: `${node.operationId} ${param.name}`,
|
|
210619
|
+
name: `${node.operationId} ${pascalCase$6(param.in)} ${param.name}`,
|
|
210590
210620
|
type: "function"
|
|
210591
210621
|
}),
|
|
210592
210622
|
typedName: resolveName({
|
|
210593
|
-
name: `${node.operationId} ${param.name}`,
|
|
210623
|
+
name: `${node.operationId} ${pascalCase$6(param.in)} ${param.name}`,
|
|
210594
210624
|
type: "type"
|
|
210595
210625
|
})
|
|
210596
210626
|
}));
|
|
210597
210627
|
const responseTypes = node.responses.filter((res) => res.schema).map((res) => renderSchemaType({
|
|
210598
210628
|
node: res.schema,
|
|
210599
210629
|
name: resolveName({
|
|
210600
|
-
name: `${node.operationId} ${res.statusCode}`,
|
|
210630
|
+
name: `${node.operationId} Status ${res.statusCode}`,
|
|
210601
210631
|
type: "function"
|
|
210602
210632
|
}),
|
|
210603
210633
|
typedName: resolveName({
|
|
210604
|
-
name: `${node.operationId} ${res.statusCode}`,
|
|
210634
|
+
name: `${node.operationId} Status ${res.statusCode}`,
|
|
210605
210635
|
type: "type"
|
|
210606
210636
|
}),
|
|
210607
210637
|
description: res.description
|
|
@@ -210609,11 +210639,11 @@ const typeGenerator = defineGenerator({
|
|
|
210609
210639
|
const requestType = node.requestBody ? renderSchemaType({
|
|
210610
210640
|
node: node.requestBody,
|
|
210611
210641
|
name: resolveName({
|
|
210612
|
-
name: `${node.operationId}
|
|
210642
|
+
name: `${node.operationId} Data`,
|
|
210613
210643
|
type: "function"
|
|
210614
210644
|
}),
|
|
210615
210645
|
typedName: resolveName({
|
|
210616
|
-
name: `${node.operationId}
|
|
210646
|
+
name: `${node.operationId} Data`,
|
|
210617
210647
|
type: "type"
|
|
210618
210648
|
}),
|
|
210619
210649
|
description: node.requestBody.description
|
|
@@ -210627,11 +210657,11 @@ const typeGenerator = defineGenerator({
|
|
|
210627
210657
|
resolveName
|
|
210628
210658
|
}),
|
|
210629
210659
|
name: resolveName({
|
|
210630
|
-
name: `${node.operationId}
|
|
210660
|
+
name: `${node.operationId} RequestConfig`,
|
|
210631
210661
|
type: "function"
|
|
210632
210662
|
}),
|
|
210633
210663
|
typedName: resolveName({
|
|
210634
|
-
name: `${node.operationId}
|
|
210664
|
+
name: `${node.operationId} RequestConfig`,
|
|
210635
210665
|
type: "type"
|
|
210636
210666
|
})
|
|
210637
210667
|
});
|
|
@@ -210661,7 +210691,8 @@ const typeGenerator = defineGenerator({
|
|
|
210661
210691
|
typedName: resolveName({
|
|
210662
210692
|
name: `${node.operationId} Response`,
|
|
210663
210693
|
type: "type"
|
|
210664
|
-
})
|
|
210694
|
+
}),
|
|
210695
|
+
description: "Union of all possible responses"
|
|
210665
210696
|
});
|
|
210666
210697
|
return /* @__PURE__ */ jsxs(File, {
|
|
210667
210698
|
baseName: file.baseName,
|
|
@@ -210678,7 +210709,7 @@ const typeGenerator = defineGenerator({
|
|
|
210678
210709
|
});
|
|
210679
210710
|
},
|
|
210680
210711
|
Schema({ node, adapter, options }) {
|
|
210681
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType
|
|
210712
|
+
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType } = options;
|
|
210682
210713
|
const { mode, resolveName, getFile } = useKubb();
|
|
210683
210714
|
if (!node.name) return;
|
|
210684
210715
|
const imports = adapter.getImports(node, (schemaName) => ({
|
|
@@ -210697,7 +210728,7 @@ const typeGenerator = defineGenerator({
|
|
|
210697
210728
|
name: node.name,
|
|
210698
210729
|
type: "type"
|
|
210699
210730
|
});
|
|
210700
|
-
if (
|
|
210731
|
+
if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema) typedName += "Key";
|
|
210701
210732
|
const type = {
|
|
210702
210733
|
name: resolveName({
|
|
210703
210734
|
name: node.name,
|
|
@@ -210731,8 +210762,7 @@ const typeGenerator = defineGenerator({
|
|
|
210731
210762
|
enumKeyCasing,
|
|
210732
210763
|
optionalType,
|
|
210733
210764
|
arrayType,
|
|
210734
|
-
syntaxType
|
|
210735
|
-
mapper
|
|
210765
|
+
syntaxType
|
|
210736
210766
|
})]
|
|
210737
210767
|
});
|
|
210738
210768
|
}
|
|
@@ -210742,7 +210772,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210742
210772
|
const { output = {
|
|
210743
210773
|
path: "types",
|
|
210744
210774
|
barrelType: "named"
|
|
210745
|
-
}, group, exclude = [], include, override = [], enumType = "asConst", enumKeyCasing = "none", enumSuffix = "enum", dateType = "string", integerType = "number", unknownType = "any", optionalType = "questionToken", arrayType = "array", emptySchemaType = unknownType, syntaxType = "type", transformers = {},
|
|
210775
|
+
}, group, exclude = [], include, override = [], enumType = "asConst", enumKeyCasing = "none", enumSuffix = "enum", dateType = "string", integerType = "number", unknownType = "any", optionalType = "questionToken", arrayType = "array", emptySchemaType = unknownType, syntaxType = "type", transformers = {}, paramsCasing, generators = [typeGenerator$1, typeGenerator].filter(Boolean), contentType, UNSTABLE_NAMING } = options;
|
|
210746
210776
|
return {
|
|
210747
210777
|
name: pluginTsName,
|
|
210748
210778
|
options: {
|
|
@@ -210760,7 +210790,6 @@ const pluginTs = definePlugin((options) => {
|
|
|
210760
210790
|
syntaxType,
|
|
210761
210791
|
group,
|
|
210762
210792
|
override,
|
|
210763
|
-
mapper,
|
|
210764
210793
|
paramsCasing,
|
|
210765
210794
|
usedEnumNames: {}
|
|
210766
210795
|
},
|
|
@@ -210787,7 +210816,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210787
210816
|
},
|
|
210788
210817
|
async install() {
|
|
210789
210818
|
var _a, _b;
|
|
210790
|
-
const { config, fabric, plugin, adapter, rootNode,
|
|
210819
|
+
const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this;
|
|
210791
210820
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210792
210821
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210793
210822
|
if (adapter) {
|
|
@@ -210810,7 +210839,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210810
210839
|
fabric,
|
|
210811
210840
|
Component: generator.Schema,
|
|
210812
210841
|
plugin,
|
|
210813
|
-
|
|
210842
|
+
driver,
|
|
210814
210843
|
mode,
|
|
210815
210844
|
version: generator.version
|
|
210816
210845
|
});
|
|
@@ -210835,7 +210864,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210835
210864
|
fabric,
|
|
210836
210865
|
Component: generator.Operation,
|
|
210837
210866
|
plugin,
|
|
210838
|
-
|
|
210867
|
+
driver,
|
|
210839
210868
|
mode,
|
|
210840
210869
|
version: generator.version
|
|
210841
210870
|
});
|
|
@@ -210857,7 +210886,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210857
210886
|
const schemaFiles = await new SchemaGenerator(this.plugin.options, {
|
|
210858
210887
|
fabric: this.fabric,
|
|
210859
210888
|
oas,
|
|
210860
|
-
|
|
210889
|
+
driver: this.driver,
|
|
210861
210890
|
events: this.events,
|
|
210862
210891
|
plugin: this.plugin,
|
|
210863
210892
|
contentType,
|
|
@@ -210870,7 +210899,7 @@ const pluginTs = definePlugin((options) => {
|
|
|
210870
210899
|
const operationFiles = await new OperationGenerator(this.plugin.options, {
|
|
210871
210900
|
fabric: this.fabric,
|
|
210872
210901
|
oas,
|
|
210873
|
-
|
|
210902
|
+
driver: this.driver,
|
|
210874
210903
|
events: this.events,
|
|
210875
210904
|
plugin: this.plugin,
|
|
210876
210905
|
contentType,
|
|
@@ -210896,11 +210925,11 @@ const operationsGenerator$1 = createReactGenerator({
|
|
|
210896
210925
|
name: "operations",
|
|
210897
210926
|
Operations({ operations, generator, plugin }) {
|
|
210898
210927
|
const { name: pluginName, options: { output, importPath } } = plugin;
|
|
210899
|
-
const
|
|
210928
|
+
const driver = usePluginDriver();
|
|
210900
210929
|
const oas = useOas();
|
|
210901
210930
|
const { getFile, groupSchemasByName } = useOperationManager(generator);
|
|
210902
210931
|
const name = "operations";
|
|
210903
|
-
const file =
|
|
210932
|
+
const file = driver.getFile({
|
|
210904
210933
|
name,
|
|
210905
210934
|
extname: ".ts",
|
|
210906
210935
|
pluginName
|
|
@@ -210929,7 +210958,7 @@ const operationsGenerator$1 = createReactGenerator({
|
|
|
210929
210958
|
banner: getBanner({
|
|
210930
210959
|
oas,
|
|
210931
210960
|
output,
|
|
210932
|
-
config:
|
|
210961
|
+
config: driver.config
|
|
210933
210962
|
}),
|
|
210934
210963
|
footer: getFooter({
|
|
210935
210964
|
oas,
|
|
@@ -210956,7 +210985,7 @@ const zodGenerator = createReactGenerator({
|
|
|
210956
210985
|
Operation({ config, operation, generator, plugin }) {
|
|
210957
210986
|
const { options, options: { coercion: globalCoercion, inferred, typed, mapper, wrapOutput, version, guidType, mini } } = plugin;
|
|
210958
210987
|
const mode = useMode();
|
|
210959
|
-
const
|
|
210988
|
+
const driver = usePluginDriver();
|
|
210960
210989
|
const oas = useOas();
|
|
210961
210990
|
const { getSchemas, getFile, getGroup } = useOperationManager(generator);
|
|
210962
210991
|
const schemaManager = useSchemaManager();
|
|
@@ -210966,7 +210995,7 @@ const zodGenerator = createReactGenerator({
|
|
|
210966
210995
|
fabric: generator.context.fabric,
|
|
210967
210996
|
oas,
|
|
210968
210997
|
plugin,
|
|
210969
|
-
|
|
210998
|
+
driver,
|
|
210970
210999
|
events: generator.context.events,
|
|
210971
211000
|
mode,
|
|
210972
211001
|
override: options.override
|
|
@@ -211064,7 +211093,7 @@ const zodGenerator = createReactGenerator({
|
|
|
211064
211093
|
banner: getBanner({
|
|
211065
211094
|
oas,
|
|
211066
211095
|
output: plugin.options.output,
|
|
211067
|
-
config:
|
|
211096
|
+
config: driver.config
|
|
211068
211097
|
}),
|
|
211069
211098
|
footer: getFooter({
|
|
211070
211099
|
oas,
|
|
@@ -211089,7 +211118,7 @@ const zodGenerator = createReactGenerator({
|
|
|
211089
211118
|
Schema({ config, schema, plugin }) {
|
|
211090
211119
|
const { getName, getFile } = useSchemaManager();
|
|
211091
211120
|
const { options: { output, emptySchemaType, coercion, inferred, typed, mapper, importPath, wrapOutput, version, guidType, mini } } = plugin;
|
|
211092
|
-
const
|
|
211121
|
+
const driver = usePluginDriver();
|
|
211093
211122
|
const oas = useOas();
|
|
211094
211123
|
const imports = getImports(schema.tree);
|
|
211095
211124
|
const zod = {
|
|
@@ -211113,7 +211142,7 @@ const zodGenerator = createReactGenerator({
|
|
|
211113
211142
|
banner: getBanner({
|
|
211114
211143
|
oas,
|
|
211115
211144
|
output,
|
|
211116
|
-
config:
|
|
211145
|
+
config: driver.config
|
|
211117
211146
|
}),
|
|
211118
211147
|
footer: getFooter({
|
|
211119
211148
|
oas,
|
|
@@ -211267,7 +211296,7 @@ const pluginZod = definePlugin((options) => {
|
|
|
211267
211296
|
const schemaFiles = await new SchemaGenerator(this.plugin.options, {
|
|
211268
211297
|
fabric: this.fabric,
|
|
211269
211298
|
oas,
|
|
211270
|
-
|
|
211299
|
+
driver: this.driver,
|
|
211271
211300
|
events: this.events,
|
|
211272
211301
|
plugin: this.plugin,
|
|
211273
211302
|
contentType,
|
|
@@ -211280,7 +211309,7 @@ const pluginZod = definePlugin((options) => {
|
|
|
211280
211309
|
const operationFiles = await new OperationGenerator(this.plugin.options, {
|
|
211281
211310
|
fabric: this.fabric,
|
|
211282
211311
|
oas,
|
|
211283
|
-
|
|
211312
|
+
driver: this.driver,
|
|
211284
211313
|
events: this.events,
|
|
211285
211314
|
plugin: this.plugin,
|
|
211286
211315
|
contentType,
|
|
@@ -211320,7 +211349,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211320
211349
|
name: "classClient",
|
|
211321
211350
|
Operations({ operations, generator, plugin, config }) {
|
|
211322
211351
|
const { options, name: pluginName } = plugin;
|
|
211323
|
-
const
|
|
211352
|
+
const driver = usePluginDriver();
|
|
211324
211353
|
const oas = useOas();
|
|
211325
211354
|
const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator);
|
|
211326
211355
|
function buildOperationData(operation) {
|
|
@@ -211353,7 +211382,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211353
211382
|
const groupName = (group == null ? void 0 : group.tag) ? (_c = (_b = (_a = options.group) == null ? void 0 : _a.name) == null ? void 0 : _b.call(_a, { group: camelCase$b(group.tag) })) != null ? _c : pascalCase$7(group.tag) : "Client";
|
|
211354
211383
|
if (!(group == null ? void 0 : group.tag) && !options.group) {
|
|
211355
211384
|
const name = "ApiClient";
|
|
211356
|
-
const file =
|
|
211385
|
+
const file = driver.getFile({
|
|
211357
211386
|
name,
|
|
211358
211387
|
extname: ".ts",
|
|
211359
211388
|
pluginName
|
|
@@ -211368,7 +211397,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211368
211397
|
});
|
|
211369
211398
|
} else if (group == null ? void 0 : group.tag) {
|
|
211370
211399
|
const name = groupName;
|
|
211371
|
-
const file =
|
|
211400
|
+
const file = driver.getFile({
|
|
211372
211401
|
name,
|
|
211373
211402
|
extname: ".ts",
|
|
211374
211403
|
pluginName,
|
|
@@ -211439,7 +211468,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211439
211468
|
banner: getBanner({
|
|
211440
211469
|
oas,
|
|
211441
211470
|
output: options.output,
|
|
211442
|
-
config:
|
|
211471
|
+
config: driver.config
|
|
211443
211472
|
}),
|
|
211444
211473
|
footer: getFooter({
|
|
211445
211474
|
oas,
|
|
@@ -211528,7 +211557,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211528
211557
|
}, file.path);
|
|
211529
211558
|
});
|
|
211530
211559
|
if (options.wrapper) {
|
|
211531
|
-
const wrapperFile =
|
|
211560
|
+
const wrapperFile = driver.getFile({
|
|
211532
211561
|
name: options.wrapper.className,
|
|
211533
211562
|
extname: ".ts",
|
|
211534
211563
|
pluginName
|
|
@@ -211540,7 +211569,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
211540
211569
|
banner: getBanner({
|
|
211541
211570
|
oas,
|
|
211542
211571
|
output: options.output,
|
|
211543
|
-
config:
|
|
211572
|
+
config: driver.config
|
|
211544
211573
|
}),
|
|
211545
211574
|
footer: getFooter({
|
|
211546
211575
|
oas,
|
|
@@ -211576,7 +211605,7 @@ const clientGenerator = createReactGenerator({
|
|
|
211576
211605
|
name: "client",
|
|
211577
211606
|
Operation({ config, plugin, operation, generator }) {
|
|
211578
211607
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
211579
|
-
const
|
|
211608
|
+
const driver = usePluginDriver();
|
|
211580
211609
|
const { options, options: { output, urlType } } = plugin;
|
|
211581
211610
|
const oas = useOas();
|
|
211582
211611
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
@@ -211614,7 +211643,7 @@ const clientGenerator = createReactGenerator({
|
|
|
211614
211643
|
banner: getBanner({
|
|
211615
211644
|
oas,
|
|
211616
211645
|
output,
|
|
211617
|
-
config:
|
|
211646
|
+
config: driver.config
|
|
211618
211647
|
}),
|
|
211619
211648
|
footer: getFooter({
|
|
211620
211649
|
oas,
|
|
@@ -211701,7 +211730,7 @@ const groupedClientGenerator = createReactGenerator({
|
|
|
211701
211730
|
name: "groupedClient",
|
|
211702
211731
|
Operations({ operations, generator, plugin }) {
|
|
211703
211732
|
const { options, name: pluginName } = plugin;
|
|
211704
|
-
const
|
|
211733
|
+
const driver = usePluginDriver();
|
|
211705
211734
|
const oas = useOas();
|
|
211706
211735
|
const { getName, getFile, getGroup } = useOperationManager(generator);
|
|
211707
211736
|
return operations.reduce((acc, operation) => {
|
|
@@ -211710,7 +211739,7 @@ const groupedClientGenerator = createReactGenerator({
|
|
|
211710
211739
|
const group = getGroup(operation);
|
|
211711
211740
|
const name = (group == null ? void 0 : group.tag) ? (_c = (_b = options.group) == null ? void 0 : _b.name) == null ? void 0 : _c.call(_b, { group: camelCase$b(group.tag) }) : void 0;
|
|
211712
211741
|
if (!(group == null ? void 0 : group.tag) || !name) return acc;
|
|
211713
|
-
const file =
|
|
211742
|
+
const file = driver.getFile({
|
|
211714
211743
|
name,
|
|
211715
211744
|
extname: ".ts",
|
|
211716
211745
|
pluginName,
|
|
@@ -211737,7 +211766,7 @@ const groupedClientGenerator = createReactGenerator({
|
|
|
211737
211766
|
banner: getBanner({
|
|
211738
211767
|
oas,
|
|
211739
211768
|
output: options.output,
|
|
211740
|
-
config:
|
|
211769
|
+
config: driver.config
|
|
211741
211770
|
}),
|
|
211742
211771
|
footer: getFooter({
|
|
211743
211772
|
oas,
|
|
@@ -211765,10 +211794,10 @@ const operationsGenerator = createReactGenerator({
|
|
|
211765
211794
|
name: "client",
|
|
211766
211795
|
Operations({ operations, plugin }) {
|
|
211767
211796
|
const { name: pluginName, options: { output } } = plugin;
|
|
211768
|
-
const
|
|
211797
|
+
const driver = usePluginDriver();
|
|
211769
211798
|
const oas = useOas();
|
|
211770
211799
|
const name = "operations";
|
|
211771
|
-
const file =
|
|
211800
|
+
const file = driver.getFile({
|
|
211772
211801
|
name,
|
|
211773
211802
|
extname: ".ts",
|
|
211774
211803
|
pluginName
|
|
@@ -211780,7 +211809,7 @@ const operationsGenerator = createReactGenerator({
|
|
|
211780
211809
|
banner: getBanner({
|
|
211781
211810
|
oas,
|
|
211782
211811
|
output,
|
|
211783
|
-
config:
|
|
211812
|
+
config: driver.config
|
|
211784
211813
|
}),
|
|
211785
211814
|
footer: getFooter({
|
|
211786
211815
|
oas,
|
|
@@ -211797,7 +211826,7 @@ const staticClassClientGenerator = createReactGenerator({
|
|
|
211797
211826
|
name: "staticClassClient",
|
|
211798
211827
|
Operations({ operations, generator, plugin, config }) {
|
|
211799
211828
|
const { options, name: pluginName } = plugin;
|
|
211800
|
-
const
|
|
211829
|
+
const driver = usePluginDriver();
|
|
211801
211830
|
const oas = useOas();
|
|
211802
211831
|
const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator);
|
|
211803
211832
|
function buildOperationData(operation) {
|
|
@@ -211830,7 +211859,7 @@ const staticClassClientGenerator = createReactGenerator({
|
|
|
211830
211859
|
const groupName = (group == null ? void 0 : group.tag) ? (_c = (_b = (_a = options.group) == null ? void 0 : _a.name) == null ? void 0 : _b.call(_a, { group: camelCase$b(group.tag) })) != null ? _c : pascalCase$7(group.tag) : "Client";
|
|
211831
211860
|
if (!(group == null ? void 0 : group.tag) && !options.group) {
|
|
211832
211861
|
const name = "ApiClient";
|
|
211833
|
-
const file =
|
|
211862
|
+
const file = driver.getFile({
|
|
211834
211863
|
name,
|
|
211835
211864
|
extname: ".ts",
|
|
211836
211865
|
pluginName
|
|
@@ -211845,7 +211874,7 @@ const staticClassClientGenerator = createReactGenerator({
|
|
|
211845
211874
|
});
|
|
211846
211875
|
} else if (group == null ? void 0 : group.tag) {
|
|
211847
211876
|
const name = groupName;
|
|
211848
|
-
const file =
|
|
211877
|
+
const file = driver.getFile({
|
|
211849
211878
|
name,
|
|
211850
211879
|
extname: ".ts",
|
|
211851
211880
|
pluginName,
|
|
@@ -211916,7 +211945,7 @@ const staticClassClientGenerator = createReactGenerator({
|
|
|
211916
211945
|
banner: getBanner({
|
|
211917
211946
|
oas,
|
|
211918
211947
|
output: options.output,
|
|
211919
|
-
config:
|
|
211948
|
+
config: driver.config
|
|
211920
211949
|
}),
|
|
211921
211950
|
footer: getFooter({
|
|
211922
211951
|
oas,
|
|
@@ -212102,7 +212131,7 @@ const pluginClient = definePlugin((options) => {
|
|
|
212102
212131
|
} : this.plugin.options, {
|
|
212103
212132
|
fabric: this.fabric,
|
|
212104
212133
|
oas,
|
|
212105
|
-
|
|
212134
|
+
driver: this.driver,
|
|
212106
212135
|
events: this.events,
|
|
212107
212136
|
plugin: this.plugin,
|
|
212108
212137
|
contentType,
|
|
@@ -212352,7 +212381,7 @@ const cypressGenerator = createReactGenerator({
|
|
|
212352
212381
|
Operation({ operation, generator, plugin }) {
|
|
212353
212382
|
var _a, _b, _c, _d, _e;
|
|
212354
212383
|
const { options: { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType } } = plugin;
|
|
212355
|
-
const
|
|
212384
|
+
const driver = usePluginDriver();
|
|
212356
212385
|
const oas = useOas();
|
|
212357
212386
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
212358
212387
|
const request = {
|
|
@@ -212373,7 +212402,7 @@ const cypressGenerator = createReactGenerator({
|
|
|
212373
212402
|
banner: getBanner({
|
|
212374
212403
|
oas,
|
|
212375
212404
|
output,
|
|
212376
|
-
config:
|
|
212405
|
+
config: driver.config
|
|
212377
212406
|
}),
|
|
212378
212407
|
footer: getFooter({
|
|
212379
212408
|
oas,
|
|
@@ -212452,7 +212481,7 @@ const pluginCypress = definePlugin((options) => {
|
|
|
212452
212481
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
212453
212482
|
fabric: this.fabric,
|
|
212454
212483
|
oas,
|
|
212455
|
-
|
|
212484
|
+
driver: this.driver,
|
|
212456
212485
|
events: this.events,
|
|
212457
212486
|
plugin: this.plugin,
|
|
212458
212487
|
contentType,
|
|
@@ -212863,7 +212892,7 @@ const fakerGenerator = createReactGenerator({
|
|
|
212863
212892
|
Operation({ operation, generator, plugin }) {
|
|
212864
212893
|
const { options, options: { dateParser, regexGenerator, seed, mapper } } = plugin;
|
|
212865
212894
|
const mode = useMode();
|
|
212866
|
-
const
|
|
212895
|
+
const driver = usePluginDriver();
|
|
212867
212896
|
const oas = useOas();
|
|
212868
212897
|
const { getSchemas, getFile, getGroup } = useOperationManager(generator);
|
|
212869
212898
|
const schemaManager = useSchemaManager();
|
|
@@ -212874,7 +212903,7 @@ const fakerGenerator = createReactGenerator({
|
|
|
212874
212903
|
oas,
|
|
212875
212904
|
plugin,
|
|
212876
212905
|
events: generator.context.events,
|
|
212877
|
-
|
|
212906
|
+
driver,
|
|
212878
212907
|
mode,
|
|
212879
212908
|
override: options.override
|
|
212880
212909
|
});
|
|
@@ -212946,7 +212975,7 @@ const fakerGenerator = createReactGenerator({
|
|
|
212946
212975
|
banner: getBanner({
|
|
212947
212976
|
oas,
|
|
212948
212977
|
output: plugin.options.output,
|
|
212949
|
-
config:
|
|
212978
|
+
config: driver.config
|
|
212950
212979
|
}),
|
|
212951
212980
|
footer: getFooter({
|
|
212952
212981
|
oas,
|
|
@@ -212972,7 +213001,7 @@ const fakerGenerator = createReactGenerator({
|
|
|
212972
213001
|
Schema({ schema, plugin }) {
|
|
212973
213002
|
const { getName, getFile } = useSchemaManager();
|
|
212974
213003
|
const { options: { output, dateParser, regexGenerator, seed, mapper } } = plugin;
|
|
212975
|
-
const
|
|
213004
|
+
const driver = usePluginDriver();
|
|
212976
213005
|
const oas = useOas();
|
|
212977
213006
|
const imports = getImports(schema.tree);
|
|
212978
213007
|
const faker = {
|
|
@@ -212994,7 +213023,7 @@ const fakerGenerator = createReactGenerator({
|
|
|
212994
213023
|
banner: getBanner({
|
|
212995
213024
|
oas,
|
|
212996
213025
|
output,
|
|
212997
|
-
config:
|
|
213026
|
+
config: driver.config
|
|
212998
213027
|
}),
|
|
212999
213028
|
footer: getFooter({
|
|
213000
213029
|
oas,
|
|
@@ -213118,7 +213147,7 @@ const pluginFaker = definePlugin((options) => {
|
|
|
213118
213147
|
const schemaFiles = await new SchemaGenerator(this.plugin.options, {
|
|
213119
213148
|
fabric: this.fabric,
|
|
213120
213149
|
oas,
|
|
213121
|
-
|
|
213150
|
+
driver: this.driver,
|
|
213122
213151
|
events: this.events,
|
|
213123
213152
|
plugin: this.plugin,
|
|
213124
213153
|
contentType,
|
|
@@ -213131,7 +213160,7 @@ const pluginFaker = definePlugin((options) => {
|
|
|
213131
213160
|
const operationFiles = await new OperationGenerator(this.plugin.options, {
|
|
213132
213161
|
fabric: this.fabric,
|
|
213133
213162
|
oas,
|
|
213134
|
-
|
|
213163
|
+
driver: this.driver,
|
|
213135
213164
|
events: this.events,
|
|
213136
213165
|
plugin: this.plugin,
|
|
213137
213166
|
contentType,
|
|
@@ -213431,17 +213460,17 @@ const serverGenerator = createReactGenerator({
|
|
|
213431
213460
|
name: "operations",
|
|
213432
213461
|
Operations({ operations, generator, plugin }) {
|
|
213433
213462
|
var _a, _b;
|
|
213434
|
-
const
|
|
213463
|
+
const driver = usePluginDriver();
|
|
213435
213464
|
const { options } = plugin;
|
|
213436
213465
|
const oas = useOas();
|
|
213437
213466
|
const { getFile, getName, getSchemas } = useOperationManager(generator);
|
|
213438
213467
|
const name = "server";
|
|
213439
|
-
const file =
|
|
213468
|
+
const file = driver.getFile({
|
|
213440
213469
|
name,
|
|
213441
213470
|
extname: ".ts",
|
|
213442
213471
|
pluginName: plugin.name
|
|
213443
213472
|
});
|
|
213444
|
-
const jsonFile =
|
|
213473
|
+
const jsonFile = driver.getFile({
|
|
213445
213474
|
name: ".mcp",
|
|
213446
213475
|
extname: ".json",
|
|
213447
213476
|
pluginName: plugin.name
|
|
@@ -213502,7 +213531,7 @@ const serverGenerator = createReactGenerator({
|
|
|
213502
213531
|
banner: getBanner({
|
|
213503
213532
|
oas,
|
|
213504
213533
|
output: options.output,
|
|
213505
|
-
config:
|
|
213534
|
+
config: driver.config
|
|
213506
213535
|
}),
|
|
213507
213536
|
footer: getFooter({
|
|
213508
213537
|
oas,
|
|
@@ -213609,7 +213638,7 @@ const pluginMcp = definePlugin((options) => {
|
|
|
213609
213638
|
const oas = await this.getOas();
|
|
213610
213639
|
const baseURL = await this.getBaseURL();
|
|
213611
213640
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
213612
|
-
const hasClientPlugin = !!this.
|
|
213641
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
213613
213642
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.addFile({
|
|
213614
213643
|
baseName: "fetch.ts",
|
|
213615
213644
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -213637,7 +213666,7 @@ const pluginMcp = definePlugin((options) => {
|
|
|
213637
213666
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
213638
213667
|
fabric: this.fabric,
|
|
213639
213668
|
oas,
|
|
213640
|
-
|
|
213669
|
+
driver: this.driver,
|
|
213641
213670
|
events: this.events,
|
|
213642
213671
|
plugin: this.plugin,
|
|
213643
213672
|
contentType,
|
|
@@ -213902,10 +213931,10 @@ function Response$1({ name, typeName, operation, statusCode }) {
|
|
|
213902
213931
|
const handlersGenerator = createReactGenerator({
|
|
213903
213932
|
name: "plugin-msw",
|
|
213904
213933
|
Operations({ operations, generator, plugin }) {
|
|
213905
|
-
const
|
|
213934
|
+
const driver = usePluginDriver();
|
|
213906
213935
|
const oas = useOas();
|
|
213907
213936
|
const { getName, getFile } = useOperationManager(generator);
|
|
213908
|
-
const file =
|
|
213937
|
+
const file = driver.getFile({
|
|
213909
213938
|
name: "handlers",
|
|
213910
213939
|
extname: ".ts",
|
|
213911
213940
|
pluginName: plugin.name
|
|
@@ -213933,7 +213962,7 @@ const handlersGenerator = createReactGenerator({
|
|
|
213933
213962
|
banner: getBanner({
|
|
213934
213963
|
oas,
|
|
213935
213964
|
output: plugin.options.output,
|
|
213936
|
-
config:
|
|
213965
|
+
config: driver.config
|
|
213937
213966
|
}),
|
|
213938
213967
|
footer: getFooter({
|
|
213939
213968
|
oas,
|
|
@@ -213951,7 +213980,7 @@ const mswGenerator = createReactGenerator({
|
|
|
213951
213980
|
Operation({ operation, generator, plugin }) {
|
|
213952
213981
|
var _a;
|
|
213953
213982
|
const { options: { output, parser, baseURL } } = plugin;
|
|
213954
|
-
const
|
|
213983
|
+
const driver = usePluginDriver();
|
|
213955
213984
|
const oas = useOas();
|
|
213956
213985
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
213957
213986
|
const mock = {
|
|
@@ -213993,7 +214022,7 @@ const mswGenerator = createReactGenerator({
|
|
|
213993
214022
|
banner: getBanner({
|
|
213994
214023
|
oas,
|
|
213995
214024
|
output,
|
|
213996
|
-
config:
|
|
214025
|
+
config: driver.config
|
|
213997
214026
|
}),
|
|
213998
214027
|
footer: getFooter({
|
|
213999
214028
|
oas,
|
|
@@ -214095,7 +214124,7 @@ const pluginMsw = definePlugin((options) => {
|
|
|
214095
214124
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
214096
214125
|
fabric: this.fabric,
|
|
214097
214126
|
oas,
|
|
214098
|
-
|
|
214127
|
+
driver: this.driver,
|
|
214099
214128
|
events: this.events,
|
|
214100
214129
|
plugin: this.plugin,
|
|
214101
214130
|
contentType,
|
|
@@ -215588,7 +215617,7 @@ const customHookOptionsFileGenerator = createReactGenerator({
|
|
|
215588
215617
|
Operations({ operations, generator, plugin, config }) {
|
|
215589
215618
|
var _a, _b;
|
|
215590
215619
|
const { options, options: { output }, name: pluginName } = plugin;
|
|
215591
|
-
const
|
|
215620
|
+
const driver = usePluginDriver();
|
|
215592
215621
|
const { getFile } = useOperationManager(generator);
|
|
215593
215622
|
if (!options.customOptions) return null;
|
|
215594
215623
|
const override = (_b = (_a = output.override) != null ? _a : config.output.override) != null ? _b : false;
|
|
@@ -215598,7 +215627,7 @@ const customHookOptionsFileGenerator = createReactGenerator({
|
|
|
215598
215627
|
const getHookFilePath = (operations2) => {
|
|
215599
215628
|
const firstOperation = operations2[0];
|
|
215600
215629
|
if (firstOperation != null) return getFile(firstOperation, { prefix: "use" }).path;
|
|
215601
|
-
return
|
|
215630
|
+
return driver.getFile({
|
|
215602
215631
|
name: "index",
|
|
215603
215632
|
extname: ".ts",
|
|
215604
215633
|
pluginName
|
|
@@ -215672,12 +215701,12 @@ const hookOptionsGenerator = createReactGenerator({
|
|
|
215672
215701
|
name: "react-query-hook-options",
|
|
215673
215702
|
Operations({ operations, plugin, generator }) {
|
|
215674
215703
|
const { options, options: { output }, name: pluginName } = plugin;
|
|
215675
|
-
const
|
|
215704
|
+
const driver = usePluginDriver();
|
|
215676
215705
|
const oas = useOas();
|
|
215677
215706
|
const { getName, getFile } = useOperationManager(generator);
|
|
215678
215707
|
if (!options.customOptions) return null;
|
|
215679
215708
|
const name = "HookOptions";
|
|
215680
|
-
const file =
|
|
215709
|
+
const file = driver.getFile({
|
|
215681
215710
|
name,
|
|
215682
215711
|
extname: ".ts",
|
|
215683
215712
|
pluginName
|
|
@@ -215845,7 +215874,7 @@ const hookOptionsGenerator = createReactGenerator({
|
|
|
215845
215874
|
banner: getBanner({
|
|
215846
215875
|
oas,
|
|
215847
215876
|
output,
|
|
215848
|
-
config:
|
|
215877
|
+
config: driver.config
|
|
215849
215878
|
}),
|
|
215850
215879
|
footer: getFooter({
|
|
215851
215880
|
oas,
|
|
@@ -215870,7 +215899,7 @@ const infiniteQueryGenerator$1 = createReactGenerator({
|
|
|
215870
215899
|
Operation({ config, operation, generator, plugin }) {
|
|
215871
215900
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
215872
215901
|
const { options, options: { output } } = plugin;
|
|
215873
|
-
const
|
|
215902
|
+
const driver = usePluginDriver();
|
|
215874
215903
|
const oas = useOas();
|
|
215875
215904
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
215876
215905
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -215889,7 +215918,7 @@ const infiniteQueryGenerator$1 = createReactGenerator({
|
|
|
215889
215918
|
suffix: "infinite"
|
|
215890
215919
|
})
|
|
215891
215920
|
};
|
|
215892
|
-
const shouldUseClientPlugin = !!
|
|
215921
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
215893
215922
|
const client = {
|
|
215894
215923
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
215895
215924
|
type: "function",
|
|
@@ -215947,7 +215976,7 @@ const infiniteQueryGenerator$1 = createReactGenerator({
|
|
|
215947
215976
|
banner: getBanner({
|
|
215948
215977
|
oas,
|
|
215949
215978
|
output,
|
|
215950
|
-
config:
|
|
215979
|
+
config: driver.config
|
|
215951
215980
|
}),
|
|
215952
215981
|
footer: getFooter({
|
|
215953
215982
|
oas,
|
|
@@ -216115,7 +216144,7 @@ const mutationGenerator$4 = createReactGenerator({
|
|
|
216115
216144
|
Operation({ config, plugin, operation, generator }) {
|
|
216116
216145
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
216117
216146
|
const { options, options: { output } } = plugin;
|
|
216118
|
-
const
|
|
216147
|
+
const driver = usePluginDriver();
|
|
216119
216148
|
const oas = useOas();
|
|
216120
216149
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
216121
216150
|
const isQuery = !!options.query && ((_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method));
|
|
@@ -216143,7 +216172,7 @@ const mutationGenerator$4 = createReactGenerator({
|
|
|
216143
216172
|
type: "function"
|
|
216144
216173
|
})
|
|
216145
216174
|
};
|
|
216146
|
-
const shouldUseClientPlugin = !!
|
|
216175
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
216147
216176
|
const client = {
|
|
216148
216177
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216149
216178
|
type: "function",
|
|
@@ -216173,7 +216202,7 @@ const mutationGenerator$4 = createReactGenerator({
|
|
|
216173
216202
|
banner: getBanner({
|
|
216174
216203
|
oas,
|
|
216175
216204
|
output,
|
|
216176
|
-
config:
|
|
216205
|
+
config: driver.config
|
|
216177
216206
|
}),
|
|
216178
216207
|
footer: getFooter({
|
|
216179
216208
|
oas,
|
|
@@ -216325,7 +216354,7 @@ const queryGenerator$4 = createReactGenerator({
|
|
|
216325
216354
|
Operation({ config, plugin, operation, generator }) {
|
|
216326
216355
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
216327
216356
|
const { options, options: { output } } = plugin;
|
|
216328
|
-
const
|
|
216357
|
+
const driver = usePluginDriver();
|
|
216329
216358
|
const oas = useOas();
|
|
216330
216359
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
216331
216360
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -216339,7 +216368,7 @@ const queryGenerator$4 = createReactGenerator({
|
|
|
216339
216368
|
typeName: getName(operation, { type: "type" }),
|
|
216340
216369
|
file: getFile(operation, { prefix: "use" })
|
|
216341
216370
|
};
|
|
216342
|
-
const shouldUseClientPlugin = !!
|
|
216371
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
216343
216372
|
const client = {
|
|
216344
216373
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216345
216374
|
type: "function",
|
|
@@ -216383,7 +216412,7 @@ const queryGenerator$4 = createReactGenerator({
|
|
|
216383
216412
|
banner: getBanner({
|
|
216384
216413
|
oas,
|
|
216385
216414
|
output,
|
|
216386
|
-
config:
|
|
216415
|
+
config: driver.config
|
|
216387
216416
|
}),
|
|
216388
216417
|
footer: getFooter({
|
|
216389
216418
|
oas,
|
|
@@ -216538,7 +216567,7 @@ const suspenseInfiniteQueryGenerator = createReactGenerator({
|
|
|
216538
216567
|
Operation({ config, operation, generator, plugin }) {
|
|
216539
216568
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
216540
216569
|
const { options, options: { output } } = plugin;
|
|
216541
|
-
const
|
|
216570
|
+
const driver = usePluginDriver();
|
|
216542
216571
|
const oas = useOas();
|
|
216543
216572
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
216544
216573
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -216558,7 +216587,7 @@ const suspenseInfiniteQueryGenerator = createReactGenerator({
|
|
|
216558
216587
|
suffix: "suspenseInfinite"
|
|
216559
216588
|
})
|
|
216560
216589
|
};
|
|
216561
|
-
const shouldUseClientPlugin = !!
|
|
216590
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
216562
216591
|
const client = {
|
|
216563
216592
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216564
216593
|
type: "function",
|
|
@@ -216605,7 +216634,7 @@ const suspenseInfiniteQueryGenerator = createReactGenerator({
|
|
|
216605
216634
|
banner: getBanner({
|
|
216606
216635
|
oas,
|
|
216607
216636
|
output,
|
|
216608
|
-
config:
|
|
216637
|
+
config: driver.config
|
|
216609
216638
|
}),
|
|
216610
216639
|
footer: getFooter({
|
|
216611
216640
|
oas,
|
|
@@ -216773,7 +216802,7 @@ const suspenseQueryGenerator = createReactGenerator({
|
|
|
216773
216802
|
Operation({ config, operation, generator, plugin }) {
|
|
216774
216803
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
216775
216804
|
const { options, options: { output } } = plugin;
|
|
216776
|
-
const
|
|
216805
|
+
const driver = usePluginDriver();
|
|
216777
216806
|
const oas = useOas();
|
|
216778
216807
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
216779
216808
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -216792,7 +216821,7 @@ const suspenseQueryGenerator = createReactGenerator({
|
|
|
216792
216821
|
suffix: "suspense"
|
|
216793
216822
|
})
|
|
216794
216823
|
};
|
|
216795
|
-
const shouldUseClientPlugin = !!
|
|
216824
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
216796
216825
|
const client = {
|
|
216797
216826
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216798
216827
|
type: "function",
|
|
@@ -216839,7 +216868,7 @@ const suspenseQueryGenerator = createReactGenerator({
|
|
|
216839
216868
|
banner: getBanner({
|
|
216840
216869
|
oas,
|
|
216841
216870
|
output,
|
|
216842
|
-
config:
|
|
216871
|
+
config: driver.config
|
|
216843
216872
|
}),
|
|
216844
216873
|
footer: getFooter({
|
|
216845
216874
|
oas,
|
|
@@ -217090,7 +217119,7 @@ const pluginReactQuery = definePlugin((options) => {
|
|
|
217090
217119
|
const oas = await this.getOas();
|
|
217091
217120
|
const baseURL = await this.getBaseURL();
|
|
217092
217121
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
217093
|
-
const hasClientPlugin = !!this.
|
|
217122
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
217094
217123
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
217095
217124
|
baseName: "fetch.ts",
|
|
217096
217125
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -217118,7 +217147,7 @@ const pluginReactQuery = definePlugin((options) => {
|
|
|
217118
217147
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
217119
217148
|
fabric: this.fabric,
|
|
217120
217149
|
oas,
|
|
217121
|
-
|
|
217150
|
+
driver: this.driver,
|
|
217122
217151
|
events: this.events,
|
|
217123
217152
|
plugin: this.plugin,
|
|
217124
217153
|
contentType,
|
|
@@ -217820,7 +217849,7 @@ const mutationGenerator$3 = createReactGenerator({
|
|
|
217820
217849
|
Operation({ config, operation, generator, plugin }) {
|
|
217821
217850
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
217822
217851
|
const { options, options: { output } } = plugin;
|
|
217823
|
-
const
|
|
217852
|
+
const driver = usePluginDriver();
|
|
217824
217853
|
const oas = useOas();
|
|
217825
217854
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
217826
217855
|
const isQuery = !!options.query && ((_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method));
|
|
@@ -217848,7 +217877,7 @@ const mutationGenerator$3 = createReactGenerator({
|
|
|
217848
217877
|
type: "function"
|
|
217849
217878
|
})
|
|
217850
217879
|
};
|
|
217851
|
-
const shouldUseClientPlugin = !!
|
|
217880
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
217852
217881
|
const client = {
|
|
217853
217882
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
217854
217883
|
type: "function",
|
|
@@ -217874,7 +217903,7 @@ const mutationGenerator$3 = createReactGenerator({
|
|
|
217874
217903
|
banner: getBanner({
|
|
217875
217904
|
oas,
|
|
217876
217905
|
output,
|
|
217877
|
-
config:
|
|
217906
|
+
config: driver.config
|
|
217878
217907
|
}),
|
|
217879
217908
|
footer: getFooter({
|
|
217880
217909
|
oas,
|
|
@@ -218004,7 +218033,7 @@ const queryGenerator$3 = createReactGenerator({
|
|
|
218004
218033
|
Operation({ config, operation, generator, plugin }) {
|
|
218005
218034
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
218006
218035
|
const { options, options: { output } } = plugin;
|
|
218007
|
-
const
|
|
218036
|
+
const driver = usePluginDriver();
|
|
218008
218037
|
const oas = useOas();
|
|
218009
218038
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
218010
218039
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -218023,7 +218052,7 @@ const queryGenerator$3 = createReactGenerator({
|
|
|
218023
218052
|
typeName: getName(operation, { type: "type" }),
|
|
218024
218053
|
file: getFile(operation, { prefix: "create" })
|
|
218025
218054
|
};
|
|
218026
|
-
const shouldUseClientPlugin = !!
|
|
218055
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
218027
218056
|
const client = {
|
|
218028
218057
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
218029
218058
|
type: "function",
|
|
@@ -218067,7 +218096,7 @@ const queryGenerator$3 = createReactGenerator({
|
|
|
218067
218096
|
banner: getBanner({
|
|
218068
218097
|
oas,
|
|
218069
218098
|
output,
|
|
218070
|
-
config:
|
|
218099
|
+
config: driver.config
|
|
218071
218100
|
}),
|
|
218072
218101
|
footer: getFooter({
|
|
218073
218102
|
oas,
|
|
@@ -218292,7 +218321,7 @@ const pluginSolidQuery = definePlugin((options) => {
|
|
|
218292
218321
|
const oas = await this.getOas();
|
|
218293
218322
|
const baseURL = await this.getBaseURL();
|
|
218294
218323
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
218295
|
-
const hasClientPlugin = !!this.
|
|
218324
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
218296
218325
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
218297
218326
|
baseName: "fetch.ts",
|
|
218298
218327
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -218320,7 +218349,7 @@ const pluginSolidQuery = definePlugin((options) => {
|
|
|
218320
218349
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
218321
218350
|
fabric: this.fabric,
|
|
218322
218351
|
oas,
|
|
218323
|
-
|
|
218352
|
+
driver: this.driver,
|
|
218324
218353
|
events: this.events,
|
|
218325
218354
|
plugin: this.plugin,
|
|
218326
218355
|
contentType,
|
|
@@ -218971,7 +219000,7 @@ const mutationGenerator$2 = createReactGenerator({
|
|
|
218971
219000
|
Operation({ config, operation, generator, plugin }) {
|
|
218972
219001
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
218973
219002
|
const { options, options: { output } } = plugin;
|
|
218974
|
-
const
|
|
219003
|
+
const driver = usePluginDriver();
|
|
218975
219004
|
const oas = useOas();
|
|
218976
219005
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
218977
219006
|
const isQuery = !!options.query && ((_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method));
|
|
@@ -218999,7 +219028,7 @@ const mutationGenerator$2 = createReactGenerator({
|
|
|
218999
219028
|
type: "function"
|
|
219000
219029
|
})
|
|
219001
219030
|
};
|
|
219002
|
-
const shouldUseClientPlugin = !!
|
|
219031
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
219003
219032
|
const client = {
|
|
219004
219033
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
219005
219034
|
type: "function",
|
|
@@ -219025,7 +219054,7 @@ const mutationGenerator$2 = createReactGenerator({
|
|
|
219025
219054
|
banner: getBanner({
|
|
219026
219055
|
oas,
|
|
219027
219056
|
output,
|
|
219028
|
-
config:
|
|
219057
|
+
config: driver.config
|
|
219029
219058
|
}),
|
|
219030
219059
|
footer: getFooter({
|
|
219031
219060
|
oas,
|
|
@@ -219159,7 +219188,7 @@ const queryGenerator$2 = createReactGenerator({
|
|
|
219159
219188
|
Operation({ config, operation, generator, plugin }) {
|
|
219160
219189
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
219161
219190
|
const { options, options: { output } } = plugin;
|
|
219162
|
-
const
|
|
219191
|
+
const driver = usePluginDriver();
|
|
219163
219192
|
const oas = useOas();
|
|
219164
219193
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
219165
219194
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -219173,7 +219202,7 @@ const queryGenerator$2 = createReactGenerator({
|
|
|
219173
219202
|
typeName: getName(operation, { type: "type" }),
|
|
219174
219203
|
file: getFile(operation, { prefix: "create" })
|
|
219175
219204
|
};
|
|
219176
|
-
const shouldUseClientPlugin = !!
|
|
219205
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
219177
219206
|
const client = {
|
|
219178
219207
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
219179
219208
|
type: "function",
|
|
@@ -219217,7 +219246,7 @@ const queryGenerator$2 = createReactGenerator({
|
|
|
219217
219246
|
banner: getBanner({
|
|
219218
219247
|
oas,
|
|
219219
219248
|
output,
|
|
219220
|
-
config:
|
|
219249
|
+
config: driver.config
|
|
219221
219250
|
}),
|
|
219222
219251
|
footer: getFooter({
|
|
219223
219252
|
oas,
|
|
@@ -219442,7 +219471,7 @@ const pluginSvelteQuery = definePlugin((options) => {
|
|
|
219442
219471
|
const oas = await this.getOas();
|
|
219443
219472
|
const baseURL = await this.getBaseURL();
|
|
219444
219473
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
219445
|
-
const hasClientPlugin = !!this.
|
|
219474
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
219446
219475
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
219447
219476
|
baseName: "fetch.ts",
|
|
219448
219477
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -219470,7 +219499,7 @@ const pluginSvelteQuery = definePlugin((options) => {
|
|
|
219470
219499
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
219471
219500
|
fabric: this.fabric,
|
|
219472
219501
|
oas,
|
|
219473
|
-
|
|
219502
|
+
driver: this.driver,
|
|
219474
219503
|
events: this.events,
|
|
219475
219504
|
plugin: this.plugin,
|
|
219476
219505
|
contentType,
|
|
@@ -220159,7 +220188,7 @@ const mutationGenerator$1 = createReactGenerator({
|
|
|
220159
220188
|
Operation({ config, operation, generator, plugin }) {
|
|
220160
220189
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
220161
220190
|
const { options, options: { output } } = plugin;
|
|
220162
|
-
const
|
|
220191
|
+
const driver = usePluginDriver();
|
|
220163
220192
|
const oas = useOas();
|
|
220164
220193
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
220165
220194
|
const isQuery = !!options.query && ((_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method));
|
|
@@ -220187,7 +220216,7 @@ const mutationGenerator$1 = createReactGenerator({
|
|
|
220187
220216
|
type: "function"
|
|
220188
220217
|
})
|
|
220189
220218
|
};
|
|
220190
|
-
const shouldUseClientPlugin = !!
|
|
220219
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
220191
220220
|
const client = {
|
|
220192
220221
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
220193
220222
|
type: "function",
|
|
@@ -220213,7 +220242,7 @@ const mutationGenerator$1 = createReactGenerator({
|
|
|
220213
220242
|
banner: getBanner({
|
|
220214
220243
|
oas,
|
|
220215
220244
|
output,
|
|
220216
|
-
config:
|
|
220245
|
+
config: driver.config
|
|
220217
220246
|
}),
|
|
220218
220247
|
footer: getFooter({
|
|
220219
220248
|
oas,
|
|
@@ -220343,7 +220372,7 @@ const queryGenerator$1 = createReactGenerator({
|
|
|
220343
220372
|
Operation({ config, operation, generator, plugin }) {
|
|
220344
220373
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
220345
220374
|
const { options, options: { output } } = plugin;
|
|
220346
|
-
const
|
|
220375
|
+
const driver = usePluginDriver();
|
|
220347
220376
|
const oas = useOas();
|
|
220348
220377
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
220349
220378
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -220357,7 +220386,7 @@ const queryGenerator$1 = createReactGenerator({
|
|
|
220357
220386
|
typeName: getName(operation, { type: "type" }),
|
|
220358
220387
|
file: getFile(operation, { prefix: "use" })
|
|
220359
220388
|
};
|
|
220360
|
-
const shouldUseClientPlugin = !!
|
|
220389
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
220361
220390
|
const client = {
|
|
220362
220391
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
220363
220392
|
type: "function",
|
|
@@ -220401,7 +220430,7 @@ const queryGenerator$1 = createReactGenerator({
|
|
|
220401
220430
|
banner: getBanner({
|
|
220402
220431
|
oas,
|
|
220403
220432
|
output,
|
|
220404
|
-
config:
|
|
220433
|
+
config: driver.config
|
|
220405
220434
|
}),
|
|
220406
220435
|
footer: getFooter({
|
|
220407
220436
|
oas,
|
|
@@ -220614,7 +220643,7 @@ const pluginSwr = definePlugin((options) => {
|
|
|
220614
220643
|
const oas = await this.getOas();
|
|
220615
220644
|
const baseURL = await this.getBaseURL();
|
|
220616
220645
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
220617
|
-
const hasClientPlugin = !!this.
|
|
220646
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
220618
220647
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
220619
220648
|
baseName: "fetch.ts",
|
|
220620
220649
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -220642,7 +220671,7 @@ const pluginSwr = definePlugin((options) => {
|
|
|
220642
220671
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
220643
220672
|
fabric: this.fabric,
|
|
220644
220673
|
oas,
|
|
220645
|
-
|
|
220674
|
+
driver: this.driver,
|
|
220646
220675
|
events: this.events,
|
|
220647
220676
|
plugin: this.plugin,
|
|
220648
220677
|
contentType,
|
|
@@ -221647,7 +221676,7 @@ const infiniteQueryGenerator = createReactGenerator({
|
|
|
221647
221676
|
Operation({ config, operation, generator, plugin }) {
|
|
221648
221677
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
221649
221678
|
const { options, options: { output } } = plugin;
|
|
221650
|
-
const
|
|
221679
|
+
const driver = usePluginDriver();
|
|
221651
221680
|
const oas = useOas();
|
|
221652
221681
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
221653
221682
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -221666,7 +221695,7 @@ const infiniteQueryGenerator = createReactGenerator({
|
|
|
221666
221695
|
suffix: "infinite"
|
|
221667
221696
|
})
|
|
221668
221697
|
};
|
|
221669
|
-
const shouldUseClientPlugin = !!
|
|
221698
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
221670
221699
|
const client = {
|
|
221671
221700
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
221672
221701
|
type: "function",
|
|
@@ -221713,7 +221742,7 @@ const infiniteQueryGenerator = createReactGenerator({
|
|
|
221713
221742
|
banner: getBanner({
|
|
221714
221743
|
oas,
|
|
221715
221744
|
output,
|
|
221716
|
-
config:
|
|
221745
|
+
config: driver.config
|
|
221717
221746
|
}),
|
|
221718
221747
|
footer: getFooter({
|
|
221719
221748
|
oas,
|
|
@@ -221883,7 +221912,7 @@ const mutationGenerator = createReactGenerator({
|
|
|
221883
221912
|
Operation({ config, operation, generator, plugin }) {
|
|
221884
221913
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
221885
221914
|
const { options, options: { output } } = plugin;
|
|
221886
|
-
const
|
|
221915
|
+
const driver = usePluginDriver();
|
|
221887
221916
|
const oas = useOas();
|
|
221888
221917
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
221889
221918
|
const isQuery = !!options.query && ((_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method));
|
|
@@ -221911,7 +221940,7 @@ const mutationGenerator = createReactGenerator({
|
|
|
221911
221940
|
type: "function"
|
|
221912
221941
|
})
|
|
221913
221942
|
};
|
|
221914
|
-
const shouldUseClientPlugin = !!
|
|
221943
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
221915
221944
|
const client = {
|
|
221916
221945
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
221917
221946
|
type: "function",
|
|
@@ -221937,7 +221966,7 @@ const mutationGenerator = createReactGenerator({
|
|
|
221937
221966
|
banner: getBanner({
|
|
221938
221967
|
oas,
|
|
221939
221968
|
output,
|
|
221940
|
-
config:
|
|
221969
|
+
config: driver.config
|
|
221941
221970
|
}),
|
|
221942
221971
|
footer: getFooter({
|
|
221943
221972
|
oas,
|
|
@@ -222072,7 +222101,7 @@ const queryGenerator = createReactGenerator({
|
|
|
222072
222101
|
Operation({ config, operation, generator, plugin }) {
|
|
222073
222102
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
222074
222103
|
const { options, options: { output } } = plugin;
|
|
222075
|
-
const
|
|
222104
|
+
const driver = usePluginDriver();
|
|
222076
222105
|
const oas = useOas();
|
|
222077
222106
|
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
222078
222107
|
const isQuery = typeof options.query === "boolean" ? true : (_a = options.query) == null ? void 0 : _a.methods.some((method) => operation.method === method);
|
|
@@ -222086,7 +222115,7 @@ const queryGenerator = createReactGenerator({
|
|
|
222086
222115
|
typeName: getName(operation, { type: "type" }),
|
|
222087
222116
|
file: getFile(operation, { prefix: "use" })
|
|
222088
222117
|
};
|
|
222089
|
-
const shouldUseClientPlugin = !!
|
|
222118
|
+
const shouldUseClientPlugin = !!driver.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
222090
222119
|
const client = {
|
|
222091
222120
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
222092
222121
|
type: "function",
|
|
@@ -222130,7 +222159,7 @@ const queryGenerator = createReactGenerator({
|
|
|
222130
222159
|
banner: getBanner({
|
|
222131
222160
|
oas,
|
|
222132
222161
|
output,
|
|
222133
|
-
config:
|
|
222162
|
+
config: driver.config
|
|
222134
222163
|
}),
|
|
222135
222164
|
footer: getFooter({
|
|
222136
222165
|
oas,
|
|
@@ -222376,7 +222405,7 @@ const pluginVueQuery = definePlugin((options) => {
|
|
|
222376
222405
|
const oas = await this.getOas();
|
|
222377
222406
|
const baseURL = await this.getBaseURL();
|
|
222378
222407
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
222379
|
-
const hasClientPlugin = !!this.
|
|
222408
|
+
const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
|
|
222380
222409
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
222381
222410
|
baseName: "fetch.ts",
|
|
222382
222411
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -222404,7 +222433,7 @@ const pluginVueQuery = definePlugin((options) => {
|
|
|
222404
222433
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
222405
222434
|
fabric: this.fabric,
|
|
222406
222435
|
oas,
|
|
222407
|
-
|
|
222436
|
+
driver: this.driver,
|
|
222408
222437
|
events: this.events,
|
|
222409
222438
|
plugin: this.plugin,
|
|
222410
222439
|
contentType,
|