@kubb/agent 5.0.0-alpha.2 → 5.0.0-alpha.4
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.
|
@@ -7,7 +7,7 @@ import https, { Server as Server$1 } from 'node:https';
|
|
|
7
7
|
import { EventEmitter } from 'node:events';
|
|
8
8
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
9
9
|
import fs$1, { promises, existsSync, readFileSync } from 'node:fs';
|
|
10
|
-
import path$2, { resolve, dirname, relative, join, posix } from 'node:path';
|
|
10
|
+
import path$2, { resolve, dirname, relative, join, basename, extname, posix } from 'node:path';
|
|
11
11
|
import anymatch from 'anymatch';
|
|
12
12
|
import { createHash, randomBytes } from 'node:crypto';
|
|
13
13
|
import process$1, { version as version$2 } from 'node:process';
|
|
@@ -15,7 +15,7 @@ import { Logtail } from '@logtail/node';
|
|
|
15
15
|
import { consola } from 'consola';
|
|
16
16
|
import mod from 'node:module';
|
|
17
17
|
import { access, rm, readFile as readFile$1, readdir as readdir$1, mkdir, writeFile as writeFile$1 } from 'node:fs/promises';
|
|
18
|
-
import { createFabric, createReactFabric, App, File, Function as Function$1, Const, FunctionParams, Type as Type$
|
|
18
|
+
import { createFabric, createReactFabric, App, File, Function as Function$1, Const, FunctionParams, Type as Type$2, useApp } from '@kubb/react-fabric';
|
|
19
19
|
import { typescriptParser } from '@kubb/react-fabric/parsers';
|
|
20
20
|
import { fsPlugin } from '@kubb/react-fabric/plugins';
|
|
21
21
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
@@ -2470,7 +2470,7 @@ function isPureObject(value) {
|
|
|
2470
2470
|
const proto = Object.getPrototypeOf(value);
|
|
2471
2471
|
return !proto || proto.isPrototypeOf(Object);
|
|
2472
2472
|
}
|
|
2473
|
-
function stringify$
|
|
2473
|
+
function stringify$4(value) {
|
|
2474
2474
|
if (isPrimitive(value)) {
|
|
2475
2475
|
return String(value);
|
|
2476
2476
|
}
|
|
@@ -2478,7 +2478,7 @@ function stringify$3(value) {
|
|
|
2478
2478
|
return JSON.stringify(value);
|
|
2479
2479
|
}
|
|
2480
2480
|
if (typeof value.toJSON === "function") {
|
|
2481
|
-
return stringify$
|
|
2481
|
+
return stringify$4(value.toJSON());
|
|
2482
2482
|
}
|
|
2483
2483
|
throw new Error("[unstorage] Cannot stringify value!");
|
|
2484
2484
|
}
|
|
@@ -2800,7 +2800,7 @@ function createStorage(options = {}) {
|
|
|
2800
2800
|
if (!driver.setItem) {
|
|
2801
2801
|
return;
|
|
2802
2802
|
}
|
|
2803
|
-
await asyncCall(driver.setItem, relativeKey, stringify$
|
|
2803
|
+
await asyncCall(driver.setItem, relativeKey, stringify$4(value), opts);
|
|
2804
2804
|
if (!driver.watch) {
|
|
2805
2805
|
onChange("update", key);
|
|
2806
2806
|
}
|
|
@@ -2812,7 +2812,7 @@ function createStorage(options = {}) {
|
|
|
2812
2812
|
batch.driver.setItems,
|
|
2813
2813
|
batch.items.map((item) => ({
|
|
2814
2814
|
key: item.relativeKey,
|
|
2815
|
-
value: stringify$
|
|
2815
|
+
value: stringify$4(item.value),
|
|
2816
2816
|
options: item.options
|
|
2817
2817
|
})),
|
|
2818
2818
|
commonOptions
|
|
@@ -2826,7 +2826,7 @@ function createStorage(options = {}) {
|
|
|
2826
2826
|
return asyncCall(
|
|
2827
2827
|
batch.driver.setItem,
|
|
2828
2828
|
item.relativeKey,
|
|
2829
|
-
stringify$
|
|
2829
|
+
stringify$4(item.value),
|
|
2830
2830
|
item.options
|
|
2831
2831
|
);
|
|
2832
2832
|
})
|
|
@@ -4653,6 +4653,46 @@ async function disconnect({ sessionId, token, studioUrl }) {
|
|
|
4653
4653
|
const visitorDepths = {
|
|
4654
4654
|
deep: "deep"
|
|
4655
4655
|
};
|
|
4656
|
+
function narrowSchema(node, type) {
|
|
4657
|
+
return (node == null ? void 0 : node.type) === type ? node : void 0;
|
|
4658
|
+
}
|
|
4659
|
+
function isKind(kind) {
|
|
4660
|
+
return (node) => node.kind === kind;
|
|
4661
|
+
}
|
|
4662
|
+
const isOperationNode = isKind("Operation");
|
|
4663
|
+
const isSchemaNode = isKind("Schema");
|
|
4664
|
+
function definePrinter(build) {
|
|
4665
|
+
return (options) => {
|
|
4666
|
+
const { name, options: resolvedOptions, nodes } = build(options != null ? options : {});
|
|
4667
|
+
const context = {
|
|
4668
|
+
options: resolvedOptions,
|
|
4669
|
+
print: (node) => {
|
|
4670
|
+
const handler = nodes[node.type];
|
|
4671
|
+
return handler ? handler.call(context, node) : void 0;
|
|
4672
|
+
}
|
|
4673
|
+
};
|
|
4674
|
+
return {
|
|
4675
|
+
name,
|
|
4676
|
+
options: resolvedOptions,
|
|
4677
|
+
print: context.print,
|
|
4678
|
+
for: (nodes2) => nodes2.map(context.print)
|
|
4679
|
+
};
|
|
4680
|
+
};
|
|
4681
|
+
}
|
|
4682
|
+
const plainStringTypes = /* @__PURE__ */ new Set([
|
|
4683
|
+
"string",
|
|
4684
|
+
"uuid",
|
|
4685
|
+
"email",
|
|
4686
|
+
"url",
|
|
4687
|
+
"datetime"
|
|
4688
|
+
]);
|
|
4689
|
+
function isPlainStringType(node) {
|
|
4690
|
+
var _a;
|
|
4691
|
+
if (plainStringTypes.has(node.type)) return true;
|
|
4692
|
+
const temporal = (_a = narrowSchema(node, "date")) != null ? _a : narrowSchema(node, "time");
|
|
4693
|
+
if (temporal) return temporal.representation !== "date";
|
|
4694
|
+
return false;
|
|
4695
|
+
}
|
|
4656
4696
|
function createLimit(concurrency) {
|
|
4657
4697
|
let active = 0;
|
|
4658
4698
|
const queue = [];
|
|
@@ -4746,6 +4786,35 @@ async function _walk(node, visitor, recurse, limit) {
|
|
|
4746
4786
|
const children = getChildren(node, recurse);
|
|
4747
4787
|
await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit)));
|
|
4748
4788
|
}
|
|
4789
|
+
function collect(node, visitor, options = {}) {
|
|
4790
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4791
|
+
const recurse = ((_a = options.depth) != null ? _a : visitorDepths.deep) === visitorDepths.deep;
|
|
4792
|
+
const results = [];
|
|
4793
|
+
let v;
|
|
4794
|
+
switch (node.kind) {
|
|
4795
|
+
case "Root":
|
|
4796
|
+
v = (_b = visitor.root) == null ? void 0 : _b.call(visitor, node);
|
|
4797
|
+
break;
|
|
4798
|
+
case "Operation":
|
|
4799
|
+
v = (_c = visitor.operation) == null ? void 0 : _c.call(visitor, node);
|
|
4800
|
+
break;
|
|
4801
|
+
case "Schema":
|
|
4802
|
+
v = (_d = visitor.schema) == null ? void 0 : _d.call(visitor, node);
|
|
4803
|
+
break;
|
|
4804
|
+
case "Property":
|
|
4805
|
+
v = (_e = visitor.property) == null ? void 0 : _e.call(visitor, node);
|
|
4806
|
+
break;
|
|
4807
|
+
case "Parameter":
|
|
4808
|
+
v = (_f = visitor.parameter) == null ? void 0 : _f.call(visitor, node);
|
|
4809
|
+
break;
|
|
4810
|
+
case "Response":
|
|
4811
|
+
v = (_g = visitor.response) == null ? void 0 : _g.call(visitor, node);
|
|
4812
|
+
break;
|
|
4813
|
+
}
|
|
4814
|
+
if (v !== void 0) results.push(v);
|
|
4815
|
+
for (const child of getChildren(node, recurse)) for (const item of collect(child, visitor, options)) results.push(item);
|
|
4816
|
+
return results;
|
|
4817
|
+
}
|
|
4749
4818
|
|
|
4750
4819
|
var __defProp$h = Object.defineProperty;
|
|
4751
4820
|
var __typeError$c = (msg) => {
|
|
@@ -5363,7 +5432,7 @@ function isPromiseRejectedResult(result) {
|
|
|
5363
5432
|
}
|
|
5364
5433
|
function getMode(fileOrFolder) {
|
|
5365
5434
|
if (!fileOrFolder) return "split";
|
|
5366
|
-
return
|
|
5435
|
+
return extname(fileOrFolder) ? "single" : "split";
|
|
5367
5436
|
}
|
|
5368
5437
|
var PluginManager = (_e = class {
|
|
5369
5438
|
constructor(config, options) {
|
|
@@ -5375,14 +5444,14 @@ var PluginManager = (_e = class {
|
|
|
5375
5444
|
* the build pipeline after the adapter's `parse()` resolves.
|
|
5376
5445
|
*/
|
|
5377
5446
|
__publicField$b(this, "rootNode");
|
|
5447
|
+
__publicField$b(this, "adapter");
|
|
5378
5448
|
__privateAdd$c(this, _studioIsOpen, false);
|
|
5379
5449
|
__privateAdd$c(this, _plugins, /* @__PURE__ */ new Set());
|
|
5380
5450
|
__privateAdd$c(this, _usedPluginNames, {});
|
|
5381
5451
|
__privateAdd$c(this, _promiseManager);
|
|
5382
5452
|
__publicField$b(this, "resolvePath", (params) => {
|
|
5383
5453
|
var _a2, _b2;
|
|
5384
|
-
const
|
|
5385
|
-
const defaultPath = path$2.resolve(root, params.baseName);
|
|
5454
|
+
const defaultPath = resolve(resolve(this.config.root, this.config.output.path), params.baseName);
|
|
5386
5455
|
if (params.pluginName) return ((_a2 = this.hookForPluginSync({
|
|
5387
5456
|
pluginName: params.pluginName,
|
|
5388
5457
|
hookName: "resolvePath",
|
|
@@ -5437,7 +5506,7 @@ var PluginManager = (_e = class {
|
|
|
5437
5506
|
plugin,
|
|
5438
5507
|
events: this.options.events,
|
|
5439
5508
|
pluginManager: this,
|
|
5440
|
-
mode: getMode(
|
|
5509
|
+
mode: getMode(resolve(this.config.root, this.config.output.path)),
|
|
5441
5510
|
addFile: async (...files) => {
|
|
5442
5511
|
await this.options.fabric.addFile(...files);
|
|
5443
5512
|
},
|
|
@@ -5447,11 +5516,14 @@ var PluginManager = (_e = class {
|
|
|
5447
5516
|
get rootNode() {
|
|
5448
5517
|
return pluginManager.rootNode;
|
|
5449
5518
|
},
|
|
5519
|
+
get adapter() {
|
|
5520
|
+
return pluginManager.adapter;
|
|
5521
|
+
},
|
|
5450
5522
|
openInStudio(options) {
|
|
5451
5523
|
var _a2, _b2;
|
|
5524
|
+
if (!pluginManager.config.devtools || __privateGet$c(pluginManager, _studioIsOpen)) return;
|
|
5452
5525
|
if (typeof pluginManager.config.devtools !== "object") throw new Error("Devtools must be an object");
|
|
5453
|
-
if (!pluginManager.rootNode) throw new Error("
|
|
5454
|
-
if (__privateGet$c(pluginManager, _studioIsOpen)) return;
|
|
5526
|
+
if (!pluginManager.rootNode || !pluginManager.adapter) throw new Error("adapter is not defined, make sure you have set the parser in kubb.config.ts");
|
|
5455
5527
|
__privateSet$c(pluginManager, _studioIsOpen, true);
|
|
5456
5528
|
const studioUrl = (_b2 = (_a2 = pluginManager.config.devtools) == null ? void 0 : _a2.studioUrl) != null ? _b2 : "https://studio.kubb.dev";
|
|
5457
5529
|
return openInStudio(pluginManager.rootNode, studioUrl, options);
|
|
@@ -5470,18 +5542,22 @@ var PluginManager = (_e = class {
|
|
|
5470
5542
|
get plugins() {
|
|
5471
5543
|
return __privateMethod$c(this, _PluginManager_instances, getSortedPlugins_fn).call(this);
|
|
5472
5544
|
}
|
|
5473
|
-
getFile({ name, mode, extname, pluginName, options }) {
|
|
5474
|
-
const
|
|
5545
|
+
getFile({ name, mode, extname: extname2, pluginName, options }) {
|
|
5546
|
+
const resolvedName = mode ? mode === "single" ? "" : this.resolveName({
|
|
5547
|
+
name,
|
|
5548
|
+
pluginName,
|
|
5549
|
+
type: "file"
|
|
5550
|
+
}) : name;
|
|
5475
5551
|
const path2 = this.resolvePath({
|
|
5476
|
-
baseName
|
|
5552
|
+
baseName: `${resolvedName}${extname2}`,
|
|
5477
5553
|
mode,
|
|
5478
5554
|
pluginName,
|
|
5479
5555
|
options
|
|
5480
5556
|
});
|
|
5481
|
-
if (!path2) throw new Error(`Filepath should be defined for resolvedName "${
|
|
5557
|
+
if (!path2) throw new Error(`Filepath should be defined for resolvedName "${resolvedName}" and pluginName "${pluginName}"`);
|
|
5482
5558
|
return {
|
|
5483
5559
|
path: path2,
|
|
5484
|
-
baseName,
|
|
5560
|
+
baseName: basename(path2),
|
|
5485
5561
|
meta: { pluginName },
|
|
5486
5562
|
sources: [],
|
|
5487
5563
|
imports: [],
|
|
@@ -5655,7 +5731,8 @@ var PluginManager = (_e = class {
|
|
|
5655
5731
|
if (hookName) return plugins.filter((plugin) => hookName in plugin);
|
|
5656
5732
|
return plugins.map((plugin) => {
|
|
5657
5733
|
if (plugin.pre) {
|
|
5658
|
-
|
|
5734
|
+
let missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName));
|
|
5735
|
+
if (missingPlugins.includes("plugin-oas") && this.adapter) missingPlugins = missingPlugins.filter((pluginName) => pluginName !== "plugin-oas");
|
|
5659
5736
|
if (missingPlugins.length > 0) throw new ValidationPluginError(`The plugin '${plugin.name}' has a pre set that references missing plugins for '${missingPlugins.join(", ")}'`);
|
|
5660
5737
|
}
|
|
5661
5738
|
return plugin;
|
|
@@ -5808,7 +5885,7 @@ const fsStorage = defineStorage(() => ({
|
|
|
5808
5885
|
await clean(resolve(base));
|
|
5809
5886
|
}
|
|
5810
5887
|
}));
|
|
5811
|
-
var version$1 = "5.0.0-alpha.
|
|
5888
|
+
var version$1 = "5.0.0-alpha.4";
|
|
5812
5889
|
function getDiagnosticInfo() {
|
|
5813
5890
|
return {
|
|
5814
5891
|
nodeVersion: version$2,
|
|
@@ -5927,6 +6004,7 @@ async function setup(options) {
|
|
|
5927
6004
|
date: /* @__PURE__ */ new Date(),
|
|
5928
6005
|
logs: [`Running adapter: ${definedConfig.adapter.name}`]
|
|
5929
6006
|
});
|
|
6007
|
+
pluginManager.adapter = definedConfig.adapter;
|
|
5930
6008
|
pluginManager.rootNode = await definedConfig.adapter.parse(source);
|
|
5931
6009
|
await events.emit("debug", {
|
|
5932
6010
|
date: /* @__PURE__ */ new Date(),
|
|
@@ -6095,6 +6173,34 @@ function inputToAdapterSource(config) {
|
|
|
6095
6173
|
path: resolve(config.root, config.input.path)
|
|
6096
6174
|
};
|
|
6097
6175
|
}
|
|
6176
|
+
function defineGenerator(generator) {
|
|
6177
|
+
if (generator.type === "react") return {
|
|
6178
|
+
version: "2",
|
|
6179
|
+
Operations() {
|
|
6180
|
+
return null;
|
|
6181
|
+
},
|
|
6182
|
+
Operation() {
|
|
6183
|
+
return null;
|
|
6184
|
+
},
|
|
6185
|
+
Schema() {
|
|
6186
|
+
return null;
|
|
6187
|
+
},
|
|
6188
|
+
...generator
|
|
6189
|
+
};
|
|
6190
|
+
return {
|
|
6191
|
+
version: "2",
|
|
6192
|
+
async operations() {
|
|
6193
|
+
return [];
|
|
6194
|
+
},
|
|
6195
|
+
async operation() {
|
|
6196
|
+
return [];
|
|
6197
|
+
},
|
|
6198
|
+
async schema() {
|
|
6199
|
+
return [];
|
|
6200
|
+
},
|
|
6201
|
+
...generator
|
|
6202
|
+
};
|
|
6203
|
+
}
|
|
6098
6204
|
function definePlugin(build2) {
|
|
6099
6205
|
return (options) => build2(options != null ? options : {});
|
|
6100
6206
|
}
|
|
@@ -6541,8 +6647,55 @@ async function detectLinter() {
|
|
|
6541
6647
|
"eslint"
|
|
6542
6648
|
]) if (await isLinterAvailable(linter)) return linter;
|
|
6543
6649
|
}
|
|
6650
|
+
function matchesOperationPattern(node, type, pattern) {
|
|
6651
|
+
switch (type) {
|
|
6652
|
+
case "tag":
|
|
6653
|
+
return node.tags.some((tag) => !!tag.match(pattern));
|
|
6654
|
+
case "operationId":
|
|
6655
|
+
return !!node.operationId.match(pattern);
|
|
6656
|
+
case "path":
|
|
6657
|
+
return !!node.path.match(pattern);
|
|
6658
|
+
case "method":
|
|
6659
|
+
return !!node.method.toLowerCase().match(pattern);
|
|
6660
|
+
default:
|
|
6661
|
+
return false;
|
|
6662
|
+
}
|
|
6663
|
+
}
|
|
6664
|
+
function matchesSchemaPattern(node, type, pattern) {
|
|
6665
|
+
switch (type) {
|
|
6666
|
+
case "schemaName":
|
|
6667
|
+
return node.name ? !!node.name.match(pattern) : false;
|
|
6668
|
+
default:
|
|
6669
|
+
return null;
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
function resolveOptions(node, { options, exclude = [], include, override = [] }) {
|
|
6673
|
+
var _a2, _b2;
|
|
6674
|
+
if (isOperationNode(node)) {
|
|
6675
|
+
if (exclude.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
|
|
6676
|
+
if (include && !include.some(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) return null;
|
|
6677
|
+
const overrideOptions = (_a2 = override.find(({ type, pattern }) => matchesOperationPattern(node, type, pattern))) == null ? void 0 : _a2.options;
|
|
6678
|
+
return {
|
|
6679
|
+
...options,
|
|
6680
|
+
...overrideOptions
|
|
6681
|
+
};
|
|
6682
|
+
}
|
|
6683
|
+
if (isSchemaNode(node)) {
|
|
6684
|
+
if (exclude.some(({ type, pattern }) => matchesSchemaPattern(node, type, pattern) === true)) return null;
|
|
6685
|
+
if (include) {
|
|
6686
|
+
const applicable = include.map(({ type, pattern }) => matchesSchemaPattern(node, type, pattern)).filter((r) => r !== null);
|
|
6687
|
+
if (applicable.length > 0 && !applicable.includes(true)) return null;
|
|
6688
|
+
}
|
|
6689
|
+
const overrideOptions = (_b2 = override.find(({ type, pattern }) => matchesSchemaPattern(node, type, pattern) === true)) == null ? void 0 : _b2.options;
|
|
6690
|
+
return {
|
|
6691
|
+
...options,
|
|
6692
|
+
...overrideOptions
|
|
6693
|
+
};
|
|
6694
|
+
}
|
|
6695
|
+
return options;
|
|
6696
|
+
}
|
|
6544
6697
|
|
|
6545
|
-
var version = "5.0.0-alpha.
|
|
6698
|
+
var version = "5.0.0-alpha.4";
|
|
6546
6699
|
|
|
6547
6700
|
function isCommandMessage(msg) {
|
|
6548
6701
|
return msg.type === "command";
|
|
@@ -7606,7 +7759,7 @@ function trimQuotes$3(text) {
|
|
|
7606
7759
|
}
|
|
7607
7760
|
return text;
|
|
7608
7761
|
}
|
|
7609
|
-
function stringify$
|
|
7762
|
+
function stringify$3(value) {
|
|
7610
7763
|
if (value === void 0 || value === null) return '""';
|
|
7611
7764
|
return JSON.stringify(trimQuotes$3(value.toString()));
|
|
7612
7765
|
}
|
|
@@ -7769,17 +7922,18 @@ async function buildOperations(operationsOrNodes, options) {
|
|
|
7769
7922
|
})
|
|
7770
7923
|
}));
|
|
7771
7924
|
} else {
|
|
7772
|
-
const { Component } = options;
|
|
7925
|
+
const { Component, adapter } = options;
|
|
7773
7926
|
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7774
7927
|
meta: { plugin },
|
|
7775
7928
|
children: /* @__PURE__ */ jsx(Component, {
|
|
7776
7929
|
config,
|
|
7930
|
+
adapter,
|
|
7777
7931
|
nodes: operationsOrNodes,
|
|
7778
|
-
|
|
7932
|
+
options: options.options
|
|
7779
7933
|
})
|
|
7780
7934
|
}));
|
|
7781
7935
|
}
|
|
7782
|
-
|
|
7936
|
+
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
7783
7937
|
fabricChild.unmount();
|
|
7784
7938
|
}
|
|
7785
7939
|
function isBuildOperationV1Options(options) {
|
|
@@ -7808,17 +7962,22 @@ async function buildOperation(operationOrNode, options) {
|
|
|
7808
7962
|
})
|
|
7809
7963
|
}));
|
|
7810
7964
|
} else {
|
|
7811
|
-
const { Component } = options;
|
|
7965
|
+
const { Component, adapter, pluginManager, mode } = options;
|
|
7812
7966
|
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7813
|
-
meta: {
|
|
7967
|
+
meta: {
|
|
7968
|
+
plugin,
|
|
7969
|
+
pluginManager,
|
|
7970
|
+
mode
|
|
7971
|
+
},
|
|
7814
7972
|
children: /* @__PURE__ */ jsx(Component, {
|
|
7815
7973
|
config,
|
|
7974
|
+
adapter,
|
|
7816
7975
|
node: operationOrNode,
|
|
7817
|
-
|
|
7976
|
+
options: options.options
|
|
7818
7977
|
})
|
|
7819
7978
|
}));
|
|
7820
7979
|
}
|
|
7821
|
-
|
|
7980
|
+
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
7822
7981
|
fabricChild.unmount();
|
|
7823
7982
|
}
|
|
7824
7983
|
function isBuildSchemaV1Options(options) {
|
|
@@ -7847,17 +8006,22 @@ async function buildSchema(schema, options) {
|
|
|
7847
8006
|
})
|
|
7848
8007
|
}));
|
|
7849
8008
|
} else {
|
|
7850
|
-
const { Component } = options;
|
|
8009
|
+
const { Component, adapter, pluginManager, mode } = options;
|
|
7851
8010
|
await fabricChild.render(/* @__PURE__ */ jsx(App, {
|
|
7852
|
-
meta: {
|
|
8011
|
+
meta: {
|
|
8012
|
+
plugin,
|
|
8013
|
+
pluginManager,
|
|
8014
|
+
mode
|
|
8015
|
+
},
|
|
7853
8016
|
children: /* @__PURE__ */ jsx(Component, {
|
|
7854
8017
|
config,
|
|
8018
|
+
adapter,
|
|
7855
8019
|
node: schema,
|
|
7856
|
-
|
|
8020
|
+
options: options.options
|
|
7857
8021
|
})
|
|
7858
8022
|
}));
|
|
7859
8023
|
}
|
|
7860
|
-
|
|
8024
|
+
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
7861
8025
|
fabricChild.unmount();
|
|
7862
8026
|
}
|
|
7863
8027
|
const GENERATOR_CONCURRENCY = 3;
|
|
@@ -8275,7 +8439,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
8275
8439
|
const defaultNullAndNullable = schemaObject.default === null && nullable;
|
|
8276
8440
|
if (schemaObject.default !== void 0 && !defaultNullAndNullable && !Array.isArray(schemaObject.default)) if (typeof schemaObject.default === "string") baseItems.push({
|
|
8277
8441
|
keyword: schemaKeywords.default,
|
|
8278
|
-
args: stringify$
|
|
8442
|
+
args: stringify$3(schemaObject.default)
|
|
8279
8443
|
});
|
|
8280
8444
|
else if (typeof schemaObject.default === "boolean") baseItems.push({
|
|
8281
8445
|
keyword: schemaKeywords.default,
|
|
@@ -8503,7 +8667,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
8503
8667
|
items: [...new Set(schemaObject[extensionKey])].map((name2, index) => {
|
|
8504
8668
|
var _a3, _b3;
|
|
8505
8669
|
return {
|
|
8506
|
-
name: stringify$
|
|
8670
|
+
name: stringify$3(name2),
|
|
8507
8671
|
value: (_a3 = schemaObject.enum) == null ? void 0 : _a3[index],
|
|
8508
8672
|
format: isNumber((_b3 = schemaObject.enum) == null ? void 0 : _b3[index]) ? "number" : "string"
|
|
8509
8673
|
};
|
|
@@ -8563,7 +8727,7 @@ parseSchemaObject_fn = function({ schema: _schemaObject, name, parentName, rootN
|
|
|
8563
8727
|
typeName,
|
|
8564
8728
|
asConst: false,
|
|
8565
8729
|
items: [...new Set(filteredValues)].map((value) => ({
|
|
8566
|
-
name: stringify$
|
|
8730
|
+
name: stringify$3(value),
|
|
8567
8731
|
value,
|
|
8568
8732
|
format: isNumber(value) ? "number" : "string"
|
|
8569
8733
|
}))
|
|
@@ -9666,10 +9830,9 @@ ${operations.map(({ operation, name: methodName, typeSchemas, zodSchemas }) => g
|
|
|
9666
9830
|
StaticClassClient.getParams = Client.getParams;
|
|
9667
9831
|
|
|
9668
9832
|
function createGenerator(generator) {
|
|
9669
|
-
var _a;
|
|
9670
9833
|
return {
|
|
9671
9834
|
type: "core",
|
|
9672
|
-
version:
|
|
9835
|
+
version: "1",
|
|
9673
9836
|
async operations() {
|
|
9674
9837
|
return [];
|
|
9675
9838
|
},
|
|
@@ -9683,10 +9846,9 @@ function createGenerator(generator) {
|
|
|
9683
9846
|
};
|
|
9684
9847
|
}
|
|
9685
9848
|
function createReactGenerator(generator) {
|
|
9686
|
-
var _a;
|
|
9687
9849
|
return {
|
|
9688
9850
|
type: "react",
|
|
9689
|
-
version:
|
|
9851
|
+
version: "1",
|
|
9690
9852
|
Operations() {
|
|
9691
9853
|
return null;
|
|
9692
9854
|
},
|
|
@@ -10109,7 +10271,7 @@ function jsStringEscape$2(input) {
|
|
|
10109
10271
|
}
|
|
10110
10272
|
});
|
|
10111
10273
|
}
|
|
10112
|
-
function stringify$
|
|
10274
|
+
function stringify$2(value) {
|
|
10113
10275
|
if (value === void 0 || value === null) return '""';
|
|
10114
10276
|
return JSON.stringify(trimQuotes$2(value.toString()));
|
|
10115
10277
|
}
|
|
@@ -10149,7 +10311,7 @@ function Operations({ name, operations }) {
|
|
|
10149
10311
|
name: "OperationSchema",
|
|
10150
10312
|
isExportable: true,
|
|
10151
10313
|
isIndexable: true,
|
|
10152
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
10314
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
10153
10315
|
name: "OperationSchema",
|
|
10154
10316
|
export: true,
|
|
10155
10317
|
children: `{
|
|
@@ -10173,7 +10335,7 @@ function Operations({ name, operations }) {
|
|
|
10173
10335
|
name: "OperationsMap",
|
|
10174
10336
|
isExportable: true,
|
|
10175
10337
|
isIndexable: true,
|
|
10176
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
10338
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
10177
10339
|
name: "OperationsMap",
|
|
10178
10340
|
export: true,
|
|
10179
10341
|
children: "Record<string, OperationSchema>"
|
|
@@ -10586,9 +10748,9 @@ const parse$2 = createParser({
|
|
|
10586
10748
|
}).filter(Boolean));
|
|
10587
10749
|
}
|
|
10588
10750
|
return zodKeywordMapper.enum(current.args.items.map((schema2) => {
|
|
10589
|
-
if (schema2.format === "boolean") return stringify$
|
|
10590
|
-
if (schema2.format === "number") return stringify$
|
|
10591
|
-
return stringify$
|
|
10751
|
+
if (schema2.format === "boolean") return stringify$2(schema2.value);
|
|
10752
|
+
if (schema2.format === "number") return stringify$2(schema2.value);
|
|
10753
|
+
return stringify$2(schema2.value);
|
|
10592
10754
|
}));
|
|
10593
10755
|
},
|
|
10594
10756
|
ref(tree, options) {
|
|
@@ -10688,7 +10850,7 @@ const parse$2 = createParser({
|
|
|
10688
10850
|
const { current } = tree;
|
|
10689
10851
|
if (current.args.format === "number" && current.args.value !== void 0) return zodKeywordMapper.const(Number(current.args.value));
|
|
10690
10852
|
if (current.args.format === "boolean" && current.args.value !== void 0) return zodKeywordMapper.const(typeof current.args.value === "boolean" ? current.args.value : void 0);
|
|
10691
|
-
return zodKeywordMapper.const(stringify$
|
|
10853
|
+
return zodKeywordMapper.const(stringify$2(current.args.value));
|
|
10692
10854
|
},
|
|
10693
10855
|
matches(tree, options) {
|
|
10694
10856
|
const { current, siblings } = tree;
|
|
@@ -10706,7 +10868,7 @@ const parse$2 = createParser({
|
|
|
10706
10868
|
},
|
|
10707
10869
|
describe(tree, options) {
|
|
10708
10870
|
const { current } = tree;
|
|
10709
|
-
if (current.args) return zodKeywordMapper.describe(stringify$
|
|
10871
|
+
if (current.args) return zodKeywordMapper.describe(stringify$2(current.args.toString()), void 0, options.mini);
|
|
10710
10872
|
},
|
|
10711
10873
|
string(tree, options) {
|
|
10712
10874
|
const { siblings } = tree;
|
|
@@ -10840,11 +11002,11 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
10840
11002
|
isExportable: true,
|
|
10841
11003
|
isIndexable: true,
|
|
10842
11004
|
isTypeOnly: true,
|
|
10843
|
-
children: [typeName && /* @__PURE__ */ jsx(Type$
|
|
11005
|
+
children: [typeName && /* @__PURE__ */ jsx(Type$2, {
|
|
10844
11006
|
export: true,
|
|
10845
11007
|
name: inferTypeName,
|
|
10846
11008
|
children: typeName
|
|
10847
|
-
}), !typeName && /* @__PURE__ */ jsx(Type$
|
|
11009
|
+
}), !typeName && /* @__PURE__ */ jsx(Type$2, {
|
|
10848
11010
|
export: true,
|
|
10849
11011
|
name: inferTypeName,
|
|
10850
11012
|
children: `z.infer<typeof ${name}>`
|
|
@@ -208805,7 +208967,11 @@ const modifiers = {
|
|
|
208805
208967
|
const: factory.createModifier(ts.SyntaxKind.ConstKeyword),
|
|
208806
208968
|
static: factory.createModifier(ts.SyntaxKind.StaticKeyword)
|
|
208807
208969
|
};
|
|
208808
|
-
const syntaxKind = {
|
|
208970
|
+
const syntaxKind = {
|
|
208971
|
+
union: SyntaxKind.UnionType,
|
|
208972
|
+
literalType: SyntaxKind.LiteralType,
|
|
208973
|
+
stringLiteral: SyntaxKind.StringLiteral
|
|
208974
|
+
};
|
|
208809
208975
|
function getUnknownType(unknownType) {
|
|
208810
208976
|
if (unknownType === "any") return keywordTypeNodes.any;
|
|
208811
208977
|
if (unknownType === "void") return keywordTypeNodes.void;
|
|
@@ -208998,7 +209164,7 @@ const createTrue = factory.createTrue;
|
|
|
208998
209164
|
const createFalse = factory.createFalse;
|
|
208999
209165
|
const createIndexedAccessTypeNode = factory.createIndexedAccessTypeNode;
|
|
209000
209166
|
const createTypeOperatorNode = factory.createTypeOperatorNode;
|
|
209001
|
-
factory.createPrefixUnaryExpression;
|
|
209167
|
+
const createPrefixUnaryExpression = factory.createPrefixUnaryExpression;
|
|
209002
209168
|
const typeKeywordMapper = {
|
|
209003
209169
|
any: () => keywordTypeNodes.any,
|
|
209004
209170
|
unknown: () => keywordTypeNodes.unknown,
|
|
@@ -209261,7 +209427,7 @@ const parse$1 = createParser({
|
|
|
209261
209427
|
}
|
|
209262
209428
|
}
|
|
209263
209429
|
});
|
|
209264
|
-
function Type({ name, typedName, tree, keysToOmit, schema, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, mapper, description }) {
|
|
209430
|
+
function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, mapper, description }) {
|
|
209265
209431
|
const typeNodes = [];
|
|
209266
209432
|
if (!tree.length) return "";
|
|
209267
209433
|
const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema);
|
|
@@ -209371,6 +209537,18 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, arrayTy
|
|
|
209371
209537
|
})] });
|
|
209372
209538
|
}
|
|
209373
209539
|
|
|
209540
|
+
function useKubb() {
|
|
209541
|
+
const { meta } = useApp();
|
|
209542
|
+
return {
|
|
209543
|
+
plugin: meta.plugin,
|
|
209544
|
+
mode: meta.mode,
|
|
209545
|
+
config: meta.pluginManager.config,
|
|
209546
|
+
getPluginByName: meta.pluginManager.getPluginByName.bind(meta.pluginManager),
|
|
209547
|
+
getFile: meta.pluginManager.getFile.bind(meta.pluginManager),
|
|
209548
|
+
resolveName: meta.pluginManager.resolveName.bind(meta.pluginManager),
|
|
209549
|
+
resolvePath: meta.pluginManager.resolvePath.bind(meta.pluginManager)
|
|
209550
|
+
};
|
|
209551
|
+
}
|
|
209374
209552
|
function useMode() {
|
|
209375
209553
|
const { meta } = useApp();
|
|
209376
209554
|
return meta.mode;
|
|
@@ -209546,6 +209724,10 @@ function useSchemaManager() {
|
|
|
209546
209724
|
};
|
|
209547
209725
|
}
|
|
209548
209726
|
|
|
209727
|
+
function stringify$1(value) {
|
|
209728
|
+
if (value === void 0 || value === null) return '""';
|
|
209729
|
+
return JSON.stringify(trimQuotes$1(value.toString()));
|
|
209730
|
+
}
|
|
209549
209731
|
function printCombinedSchema({ name, schemas, pluginManager }) {
|
|
209550
209732
|
const properties = {};
|
|
209551
209733
|
if (schemas.response) properties["response"] = createUnionDeclaration({ nodes: schemas.responses.map((res) => {
|
|
@@ -209720,9 +209902,8 @@ function printResponseSchema({ baseName, schemas, pluginManager, unknownType })
|
|
|
209720
209902
|
}
|
|
209721
209903
|
return results.join("\n\n");
|
|
209722
209904
|
}
|
|
209723
|
-
const typeGenerator = createReactGenerator({
|
|
209905
|
+
const typeGenerator$1 = createReactGenerator({
|
|
209724
209906
|
name: "typescript",
|
|
209725
|
-
version: "1",
|
|
209726
209907
|
Operation({ operation, generator, plugin }) {
|
|
209727
209908
|
const { options, options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
|
|
209728
209909
|
const mode = useMode();
|
|
@@ -209777,7 +209958,7 @@ const typeGenerator = createReactGenerator({
|
|
|
209777
209958
|
imp.name,
|
|
209778
209959
|
imp.path,
|
|
209779
209960
|
imp.isTypeOnly
|
|
209780
|
-
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
209961
|
+
].join("-"))), /* @__PURE__ */ jsx(Type$1, {
|
|
209781
209962
|
name: type.name,
|
|
209782
209963
|
typedName: type.typedName,
|
|
209783
209964
|
description,
|
|
@@ -209879,7 +210060,7 @@ const typeGenerator = createReactGenerator({
|
|
|
209879
210060
|
schema.name,
|
|
209880
210061
|
imp.path,
|
|
209881
210062
|
imp.isTypeOnly
|
|
209882
|
-
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210063
|
+
].join("-"))), /* @__PURE__ */ jsx(Type$1, {
|
|
209883
210064
|
name: type.name,
|
|
209884
210065
|
typedName: type.typedName,
|
|
209885
210066
|
description: schema.value.description,
|
|
@@ -209895,12 +210076,443 @@ const typeGenerator = createReactGenerator({
|
|
|
209895
210076
|
});
|
|
209896
210077
|
}
|
|
209897
210078
|
});
|
|
210079
|
+
function constToTypeNode(value, format) {
|
|
210080
|
+
if (format === "boolean") return createLiteralTypeNode(value === true ? createTrue() : createFalse());
|
|
210081
|
+
if (format === "number" && typeof value === "number") {
|
|
210082
|
+
if (value < 0) return createLiteralTypeNode(createPrefixUnaryExpression(SyntaxKind.MinusToken, createNumericLiteral(Math.abs(value))));
|
|
210083
|
+
return createLiteralTypeNode(createNumericLiteral(value));
|
|
210084
|
+
}
|
|
210085
|
+
return createLiteralTypeNode(createStringLiteral(String(value)));
|
|
210086
|
+
}
|
|
210087
|
+
function dateOrStringNode(node) {
|
|
210088
|
+
return node.representation === "date" ? createTypeReferenceNode(createIdentifier("Date")) : keywordTypeNodes.string;
|
|
210089
|
+
}
|
|
210090
|
+
function buildMemberNodes(members, print) {
|
|
210091
|
+
return (members != null ? members : []).map(print).filter(Boolean);
|
|
210092
|
+
}
|
|
210093
|
+
function buildTupleNode(node, print) {
|
|
210094
|
+
var _a, _b;
|
|
210095
|
+
let items = ((_a = node.items) != null ? _a : []).map(print).filter(Boolean);
|
|
210096
|
+
const restNode = node.rest ? (_b = print(node.rest)) != null ? _b : void 0 : void 0;
|
|
210097
|
+
const { min, max } = node;
|
|
210098
|
+
if (max !== void 0) {
|
|
210099
|
+
items = items.slice(0, max);
|
|
210100
|
+
if (items.length < max && restNode) items = [...items, ...Array(max - items.length).fill(restNode)];
|
|
210101
|
+
}
|
|
210102
|
+
if (min !== void 0) items = items.map((item, i) => i >= min ? createOptionalTypeNode(item) : item);
|
|
210103
|
+
if (max === void 0 && restNode) items.push(createRestTypeNode(createArrayTypeNode(restNode)));
|
|
210104
|
+
return createTupleTypeNode(items);
|
|
210105
|
+
}
|
|
210106
|
+
function buildPropertyType(schema, baseType, optionalType) {
|
|
210107
|
+
const addsUndefined = ["undefined", "questionTokenAndUndefined"].includes(optionalType);
|
|
210108
|
+
let type = baseType;
|
|
210109
|
+
if (schema.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
210110
|
+
if ((schema.nullish || schema.optional) && addsUndefined) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210111
|
+
return type;
|
|
210112
|
+
}
|
|
210113
|
+
function buildPropertyJSDocComments(schema) {
|
|
210114
|
+
return [
|
|
210115
|
+
"description" in schema && schema.description ? `@description ${jsStringEscape$1(schema.description)}` : void 0,
|
|
210116
|
+
"deprecated" in schema && schema.deprecated ? "@deprecated" : void 0,
|
|
210117
|
+
"min" in schema && schema.min !== void 0 ? `@minLength ${schema.min}` : void 0,
|
|
210118
|
+
"max" in schema && schema.max !== void 0 ? `@maxLength ${schema.max}` : void 0,
|
|
210119
|
+
"pattern" in schema && schema.pattern ? `@pattern ${schema.pattern}` : void 0,
|
|
210120
|
+
"default" in schema && schema.default !== void 0 ? `@default ${"primitive" in schema && schema.primitive === "string" ? stringify$1(schema.default) : schema.default}` : void 0,
|
|
210121
|
+
"example" in schema && schema.example !== void 0 ? `@example ${schema.example}` : void 0,
|
|
210122
|
+
"primitive" in schema && schema.primitive ? [`@type ${schema.primitive || "unknown"}`, "optional" in schema && schema.optional ? " | undefined" : void 0].filter(Boolean).join("") : void 0
|
|
210123
|
+
];
|
|
210124
|
+
}
|
|
210125
|
+
function buildIndexSignatures(node, propertyCount, print) {
|
|
210126
|
+
var _a, _b;
|
|
210127
|
+
const elements = [];
|
|
210128
|
+
if (node.additionalProperties && node.additionalProperties !== true) {
|
|
210129
|
+
const additionalType = (_a = print(node.additionalProperties)) != null ? _a : keywordTypeNodes.unknown;
|
|
210130
|
+
elements.push(createIndexSignature(propertyCount > 0 ? keywordTypeNodes.unknown : additionalType));
|
|
210131
|
+
} else if (node.additionalProperties === true) elements.push(createIndexSignature(keywordTypeNodes.unknown));
|
|
210132
|
+
if (node.patternProperties) {
|
|
210133
|
+
const first = Object.values(node.patternProperties)[0];
|
|
210134
|
+
if (first) {
|
|
210135
|
+
let patternType = (_b = print(first)) != null ? _b : keywordTypeNodes.unknown;
|
|
210136
|
+
if (first.nullable) patternType = createUnionDeclaration({ nodes: [patternType, keywordTypeNodes.null] });
|
|
210137
|
+
elements.push(createIndexSignature(patternType));
|
|
210138
|
+
}
|
|
210139
|
+
}
|
|
210140
|
+
return elements;
|
|
210141
|
+
}
|
|
210142
|
+
const printerTs = definePrinter((options) => ({
|
|
210143
|
+
name: "typescript",
|
|
210144
|
+
options,
|
|
210145
|
+
nodes: {
|
|
210146
|
+
any: () => keywordTypeNodes.any,
|
|
210147
|
+
unknown: () => keywordTypeNodes.unknown,
|
|
210148
|
+
void: () => keywordTypeNodes.void,
|
|
210149
|
+
boolean: () => keywordTypeNodes.boolean,
|
|
210150
|
+
null: () => keywordTypeNodes.null,
|
|
210151
|
+
blob: () => createTypeReferenceNode("Blob", []),
|
|
210152
|
+
string: () => keywordTypeNodes.string,
|
|
210153
|
+
uuid: () => keywordTypeNodes.string,
|
|
210154
|
+
email: () => keywordTypeNodes.string,
|
|
210155
|
+
url: () => keywordTypeNodes.string,
|
|
210156
|
+
datetime: () => keywordTypeNodes.string,
|
|
210157
|
+
number: () => keywordTypeNodes.number,
|
|
210158
|
+
integer: () => keywordTypeNodes.number,
|
|
210159
|
+
bigint: () => keywordTypeNodes.bigint,
|
|
210160
|
+
date: (node) => dateOrStringNode(node),
|
|
210161
|
+
time: (node) => dateOrStringNode(node),
|
|
210162
|
+
ref(node) {
|
|
210163
|
+
if (!node.name) return;
|
|
210164
|
+
return createTypeReferenceNode(node.name, void 0);
|
|
210165
|
+
},
|
|
210166
|
+
enum(node) {
|
|
210167
|
+
var _a, _b, _c, _d;
|
|
210168
|
+
const values = (_c = (_b = (_a = node.namedEnumValues) == null ? void 0 : _a.map((v) => v.value)) != null ? _b : node.enumValues) != null ? _c : [];
|
|
210169
|
+
if (this.options.enumType === "inlineLiteral" || !node.name) return (_d = createUnionDeclaration({
|
|
210170
|
+
withParentheses: true,
|
|
210171
|
+
nodes: values.filter((v) => v !== null).map((value) => constToTypeNode(value, typeof value === "number" ? "number" : typeof value === "boolean" ? "boolean" : "string")).filter(Boolean)
|
|
210172
|
+
})) != null ? _d : void 0;
|
|
210173
|
+
return createTypeReferenceNode(["asConst", "asPascalConst"].includes(this.options.enumType) ? `${node.name}Key` : node.name, void 0);
|
|
210174
|
+
},
|
|
210175
|
+
union(node) {
|
|
210176
|
+
var _a, _b, _c;
|
|
210177
|
+
const members = (_a = node.members) != null ? _a : [];
|
|
210178
|
+
const hasStringLiteral = members.some((m) => m.type === "enum" && m.enumType === "string");
|
|
210179
|
+
const hasPlainString = members.some((m) => isPlainStringType(m));
|
|
210180
|
+
if (hasStringLiteral && hasPlainString) return (_b = createUnionDeclaration({
|
|
210181
|
+
withParentheses: true,
|
|
210182
|
+
nodes: members.map((m) => {
|
|
210183
|
+
if (isPlainStringType(m)) return createIntersectionDeclaration({
|
|
210184
|
+
nodes: [keywordTypeNodes.string, createTypeLiteralNode([])],
|
|
210185
|
+
withParentheses: true
|
|
210186
|
+
});
|
|
210187
|
+
return this.print(m);
|
|
210188
|
+
}).filter(Boolean)
|
|
210189
|
+
})) != null ? _b : void 0;
|
|
210190
|
+
return (_c = createUnionDeclaration({
|
|
210191
|
+
withParentheses: true,
|
|
210192
|
+
nodes: buildMemberNodes(members, this.print)
|
|
210193
|
+
})) != null ? _c : void 0;
|
|
210194
|
+
},
|
|
210195
|
+
intersection(node) {
|
|
210196
|
+
var _a;
|
|
210197
|
+
return (_a = createIntersectionDeclaration({
|
|
210198
|
+
withParentheses: true,
|
|
210199
|
+
nodes: buildMemberNodes(node.members, this.print)
|
|
210200
|
+
})) != null ? _a : void 0;
|
|
210201
|
+
},
|
|
210202
|
+
array(node) {
|
|
210203
|
+
var _a, _b;
|
|
210204
|
+
return (_b = createArrayDeclaration({
|
|
210205
|
+
nodes: ((_a = node.items) != null ? _a : []).map((item) => this.print(item)).filter(Boolean),
|
|
210206
|
+
arrayType: this.options.arrayType
|
|
210207
|
+
})) != null ? _b : void 0;
|
|
210208
|
+
},
|
|
210209
|
+
tuple(node) {
|
|
210210
|
+
return buildTupleNode(node, this.print);
|
|
210211
|
+
},
|
|
210212
|
+
object(node) {
|
|
210213
|
+
const addsQuestionToken = ["questionToken", "questionTokenAndUndefined"].includes(this.options.optionalType);
|
|
210214
|
+
const { print } = this;
|
|
210215
|
+
const propertyNodes = node.properties.map((prop) => {
|
|
210216
|
+
var _a;
|
|
210217
|
+
const baseType = (_a = print(prop.schema)) != null ? _a : keywordTypeNodes.unknown;
|
|
210218
|
+
const type = buildPropertyType(prop.schema, baseType, this.options.optionalType);
|
|
210219
|
+
return appendJSDocToNode({
|
|
210220
|
+
node: createPropertySignature({
|
|
210221
|
+
questionToken: prop.schema.optional || prop.schema.nullish ? addsQuestionToken : false,
|
|
210222
|
+
name: prop.name,
|
|
210223
|
+
type,
|
|
210224
|
+
readOnly: prop.schema.readOnly
|
|
210225
|
+
}),
|
|
210226
|
+
comments: buildPropertyJSDocComments(prop.schema)
|
|
210227
|
+
});
|
|
210228
|
+
});
|
|
210229
|
+
const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, print)];
|
|
210230
|
+
if (!allElements.length) return keywordTypeNodes.object;
|
|
210231
|
+
return createTypeLiteralNode(allElements);
|
|
210232
|
+
}
|
|
210233
|
+
}
|
|
210234
|
+
}));
|
|
210235
|
+
function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, ...rest }) {
|
|
210236
|
+
const typeNodes = [];
|
|
210237
|
+
const description = rest.description || (node == null ? void 0 : node.description);
|
|
210238
|
+
const enumSchemaNodes = collect(node, { schema(n) {
|
|
210239
|
+
if (n.type === "enum" && n.name) return n;
|
|
210240
|
+
} });
|
|
210241
|
+
let type = printerTs({
|
|
210242
|
+
optionalType,
|
|
210243
|
+
arrayType,
|
|
210244
|
+
enumType
|
|
210245
|
+
}).print(node);
|
|
210246
|
+
if (!type) return;
|
|
210247
|
+
if (["asConst", "asPascalConst"].includes(enumType) && enumSchemaNodes.length > 0) {
|
|
210248
|
+
const isDirectEnum = node.type === "array" && node.items !== void 0;
|
|
210249
|
+
const isEnumOnly = "enum" in node && node.enum;
|
|
210250
|
+
if (isDirectEnum || isEnumOnly) {
|
|
210251
|
+
type = createTypeReferenceNode(`${enumSchemaNodes[0].name}Key`);
|
|
210252
|
+
if (isDirectEnum) if (arrayType === "generic") type = createTypeReferenceNode(createIdentifier("Array"), [type]);
|
|
210253
|
+
else type = createArrayTypeNode(type);
|
|
210254
|
+
}
|
|
210255
|
+
}
|
|
210256
|
+
if (node) {
|
|
210257
|
+
if (node.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
210258
|
+
if (node.nullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210259
|
+
if (node.optional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
210260
|
+
}
|
|
210261
|
+
const useTypeGeneration = syntaxType === "type" || [syntaxKind.union].includes(type.kind) || !!(keysToOmit == null ? void 0 : keysToOmit.length);
|
|
210262
|
+
typeNodes.push(createTypeDeclaration({
|
|
210263
|
+
name,
|
|
210264
|
+
isExportable: true,
|
|
210265
|
+
type: (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
|
|
210266
|
+
keys: keysToOmit,
|
|
210267
|
+
type,
|
|
210268
|
+
nonNullable: true
|
|
210269
|
+
}) : type,
|
|
210270
|
+
syntax: useTypeGeneration ? "type" : "interface",
|
|
210271
|
+
comments: [
|
|
210272
|
+
(node == null ? void 0 : node.title) ? `${jsStringEscape$1(node.title)}` : void 0,
|
|
210273
|
+
description ? `@description ${jsStringEscape$1(description)}` : void 0,
|
|
210274
|
+
(node == null ? void 0 : node.deprecated) ? "@deprecated" : void 0,
|
|
210275
|
+
node && "min" in node && node.min !== void 0 ? `@minLength ${node.min}` : void 0,
|
|
210276
|
+
node && "max" in node && node.max !== void 0 ? `@maxLength ${node.max}` : void 0,
|
|
210277
|
+
node && "pattern" in node && node.pattern ? `@pattern ${node.pattern}` : void 0,
|
|
210278
|
+
(node == null ? void 0 : node.default) ? `@default ${node.default}` : void 0,
|
|
210279
|
+
(node == null ? void 0 : node.example) ? `@example ${node.example}` : void 0
|
|
210280
|
+
]
|
|
210281
|
+
}));
|
|
210282
|
+
const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((enumSchemaNode) => {
|
|
210283
|
+
var _a, _b, _c, _d;
|
|
210284
|
+
const enumName = enumType === "asPascalConst" ? pascalCase$6(enumSchemaNode.name) : camelCase$a(enumSchemaNode.name);
|
|
210285
|
+
const typeName = ["asConst", "asPascalConst"].includes(enumType) ? `${enumSchemaNode.name}Key` : enumSchemaNode.name;
|
|
210286
|
+
const [nameNode, typeNode] = createEnumDeclaration({
|
|
210287
|
+
name: enumName,
|
|
210288
|
+
typeName,
|
|
210289
|
+
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 : [],
|
|
210290
|
+
type: enumType,
|
|
210291
|
+
enumKeyCasing
|
|
210292
|
+
});
|
|
210293
|
+
return {
|
|
210294
|
+
nameNode,
|
|
210295
|
+
typeNode,
|
|
210296
|
+
name: enumName,
|
|
210297
|
+
typeName
|
|
210298
|
+
};
|
|
210299
|
+
});
|
|
210300
|
+
const shouldExportEnums = enumType !== "inlineLiteral";
|
|
210301
|
+
const shouldExportType = enumType === "inlineLiteral" || enums.every((item) => item.typeName !== name);
|
|
210302
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [shouldExportEnums && enums.map(({ name: enumName, nameNode, typeName, typeNode }) => /* @__PURE__ */ jsxs(Fragment, { children: [nameNode && /* @__PURE__ */ jsx(File.Source, {
|
|
210303
|
+
name: enumName,
|
|
210304
|
+
isExportable: true,
|
|
210305
|
+
isIndexable: true,
|
|
210306
|
+
isTypeOnly: false,
|
|
210307
|
+
children: safePrint(nameNode)
|
|
210308
|
+
}), /* @__PURE__ */ jsx(File.Source, {
|
|
210309
|
+
name: typeName,
|
|
210310
|
+
isIndexable: true,
|
|
210311
|
+
isExportable: [
|
|
210312
|
+
"enum",
|
|
210313
|
+
"asConst",
|
|
210314
|
+
"asPascalConst",
|
|
210315
|
+
"constEnum",
|
|
210316
|
+
"literal",
|
|
210317
|
+
void 0
|
|
210318
|
+
].includes(enumType),
|
|
210319
|
+
isTypeOnly: [
|
|
210320
|
+
"asConst",
|
|
210321
|
+
"asPascalConst",
|
|
210322
|
+
"literal",
|
|
210323
|
+
void 0
|
|
210324
|
+
].includes(enumType),
|
|
210325
|
+
children: safePrint(typeNode)
|
|
210326
|
+
})] })), shouldExportType && /* @__PURE__ */ jsx(File.Source, {
|
|
210327
|
+
name: typedName,
|
|
210328
|
+
isTypeOnly: true,
|
|
210329
|
+
isExportable: true,
|
|
210330
|
+
isIndexable: true,
|
|
210331
|
+
children: safePrint(...typeNodes)
|
|
210332
|
+
})] });
|
|
210333
|
+
}
|
|
210334
|
+
const typeGenerator = defineGenerator({
|
|
210335
|
+
name: "typescript",
|
|
210336
|
+
type: "react",
|
|
210337
|
+
Operation({ node, adapter, options }) {
|
|
210338
|
+
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType } = options;
|
|
210339
|
+
const { plugin, mode, getFile, resolveName } = useKubb();
|
|
210340
|
+
const file = getFile({
|
|
210341
|
+
name: node.operationId,
|
|
210342
|
+
pluginName: plugin.name,
|
|
210343
|
+
extname: ".ts",
|
|
210344
|
+
mode
|
|
210345
|
+
});
|
|
210346
|
+
function renderSchemaType({ node: schemaNode, name, typedName, description }) {
|
|
210347
|
+
const imports = adapter.getImports(schemaNode, (schemaName) => ({
|
|
210348
|
+
name: resolveName({
|
|
210349
|
+
name: schemaName,
|
|
210350
|
+
pluginName: plugin.name,
|
|
210351
|
+
type: "type"
|
|
210352
|
+
}),
|
|
210353
|
+
path: getFile({
|
|
210354
|
+
name: schemaName,
|
|
210355
|
+
pluginName: plugin.name,
|
|
210356
|
+
extname: ".ts",
|
|
210357
|
+
mode
|
|
210358
|
+
}).path
|
|
210359
|
+
}));
|
|
210360
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
|
|
210361
|
+
root: file.path,
|
|
210362
|
+
path: imp.path,
|
|
210363
|
+
name: imp.name,
|
|
210364
|
+
isTypeOnly: true
|
|
210365
|
+
}, [
|
|
210366
|
+
name,
|
|
210367
|
+
imp.path,
|
|
210368
|
+
imp.isTypeOnly
|
|
210369
|
+
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210370
|
+
name,
|
|
210371
|
+
typedName,
|
|
210372
|
+
node: schemaNode,
|
|
210373
|
+
description,
|
|
210374
|
+
enumType,
|
|
210375
|
+
enumKeyCasing,
|
|
210376
|
+
optionalType,
|
|
210377
|
+
arrayType,
|
|
210378
|
+
syntaxType
|
|
210379
|
+
})] });
|
|
210380
|
+
}
|
|
210381
|
+
const paramTypes = node.parameters.map((param) => {
|
|
210382
|
+
const name = resolveName({
|
|
210383
|
+
name: `${node.operationId} ${param.name}`,
|
|
210384
|
+
pluginName: plugin.name,
|
|
210385
|
+
type: "function"
|
|
210386
|
+
});
|
|
210387
|
+
const typedName = resolveName({
|
|
210388
|
+
name: `${node.operationId} ${param.name}`,
|
|
210389
|
+
pluginName: plugin.name,
|
|
210390
|
+
type: "type"
|
|
210391
|
+
});
|
|
210392
|
+
return renderSchemaType({
|
|
210393
|
+
node: param.schema,
|
|
210394
|
+
name,
|
|
210395
|
+
typedName
|
|
210396
|
+
});
|
|
210397
|
+
});
|
|
210398
|
+
const responseTypes = node.responses.filter((res) => res.schema).map((res) => {
|
|
210399
|
+
const schemaNode = res.schema;
|
|
210400
|
+
const responseName = `${node.operationId} ${res.statusCode}`;
|
|
210401
|
+
return renderSchemaType({
|
|
210402
|
+
node: schemaNode,
|
|
210403
|
+
name: resolveName({
|
|
210404
|
+
name: responseName,
|
|
210405
|
+
pluginName: plugin.name,
|
|
210406
|
+
type: "function"
|
|
210407
|
+
}),
|
|
210408
|
+
typedName: resolveName({
|
|
210409
|
+
name: responseName,
|
|
210410
|
+
pluginName: plugin.name,
|
|
210411
|
+
type: "type"
|
|
210412
|
+
}),
|
|
210413
|
+
description: res.description
|
|
210414
|
+
});
|
|
210415
|
+
});
|
|
210416
|
+
const requestType = node.requestBody ? (() => {
|
|
210417
|
+
const requestName = `${node.operationId} MutationRequest`;
|
|
210418
|
+
const resolvedName = resolveName({
|
|
210419
|
+
name: requestName,
|
|
210420
|
+
pluginName: plugin.name,
|
|
210421
|
+
type: "function"
|
|
210422
|
+
});
|
|
210423
|
+
const typedName = resolveName({
|
|
210424
|
+
name: requestName,
|
|
210425
|
+
pluginName: plugin.name,
|
|
210426
|
+
type: "type"
|
|
210427
|
+
});
|
|
210428
|
+
return renderSchemaType({
|
|
210429
|
+
node: node.requestBody,
|
|
210430
|
+
name: resolvedName,
|
|
210431
|
+
typedName,
|
|
210432
|
+
description: node.requestBody.description
|
|
210433
|
+
});
|
|
210434
|
+
})() : null;
|
|
210435
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
210436
|
+
baseName: file.baseName,
|
|
210437
|
+
path: file.path,
|
|
210438
|
+
meta: file.meta,
|
|
210439
|
+
children: [
|
|
210440
|
+
paramTypes,
|
|
210441
|
+
responseTypes,
|
|
210442
|
+
requestType
|
|
210443
|
+
]
|
|
210444
|
+
});
|
|
210445
|
+
},
|
|
210446
|
+
Schema({ node, adapter, options }) {
|
|
210447
|
+
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType } = options;
|
|
210448
|
+
const { plugin, mode, resolveName, getFile } = useKubb();
|
|
210449
|
+
if (!node.name) return;
|
|
210450
|
+
const imports = adapter.getImports(node, (schemaName) => ({
|
|
210451
|
+
name: resolveName({
|
|
210452
|
+
name: schemaName,
|
|
210453
|
+
pluginName: plugin.name,
|
|
210454
|
+
type: "type"
|
|
210455
|
+
}),
|
|
210456
|
+
path: getFile({
|
|
210457
|
+
name: schemaName,
|
|
210458
|
+
pluginName: plugin.name,
|
|
210459
|
+
extname: ".ts",
|
|
210460
|
+
mode
|
|
210461
|
+
}).path
|
|
210462
|
+
}));
|
|
210463
|
+
const isEnumSchema = node.type === "enum";
|
|
210464
|
+
let typedName = resolveName({
|
|
210465
|
+
name: node.name,
|
|
210466
|
+
pluginName: plugin.name,
|
|
210467
|
+
type: "type"
|
|
210468
|
+
});
|
|
210469
|
+
if (["asConst", "asPascalConst"].includes(enumType) && isEnumSchema) typedName = typedName += "Key";
|
|
210470
|
+
const type = {
|
|
210471
|
+
name: resolveName({
|
|
210472
|
+
name: node.name,
|
|
210473
|
+
pluginName: plugin.name,
|
|
210474
|
+
type: "function"
|
|
210475
|
+
}),
|
|
210476
|
+
typedName,
|
|
210477
|
+
file: getFile({
|
|
210478
|
+
name: node.name,
|
|
210479
|
+
pluginName: plugin.name,
|
|
210480
|
+
extname: ".ts",
|
|
210481
|
+
mode
|
|
210482
|
+
})
|
|
210483
|
+
};
|
|
210484
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
210485
|
+
baseName: type.file.baseName,
|
|
210486
|
+
path: type.file.path,
|
|
210487
|
+
meta: type.file.meta,
|
|
210488
|
+
children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
|
|
210489
|
+
root: type.file.path,
|
|
210490
|
+
path: imp.path,
|
|
210491
|
+
name: imp.name,
|
|
210492
|
+
isTypeOnly: true
|
|
210493
|
+
}, [
|
|
210494
|
+
node.name,
|
|
210495
|
+
imp.path,
|
|
210496
|
+
imp.isTypeOnly
|
|
210497
|
+
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210498
|
+
name: type.name,
|
|
210499
|
+
typedName: type.typedName,
|
|
210500
|
+
node,
|
|
210501
|
+
enumType,
|
|
210502
|
+
enumKeyCasing,
|
|
210503
|
+
optionalType,
|
|
210504
|
+
arrayType,
|
|
210505
|
+
syntaxType
|
|
210506
|
+
})]
|
|
210507
|
+
});
|
|
210508
|
+
}
|
|
210509
|
+
});
|
|
209898
210510
|
const pluginTsName = "plugin-ts";
|
|
209899
210511
|
const pluginTs = definePlugin((options) => {
|
|
209900
210512
|
const { output = {
|
|
209901
210513
|
path: "types",
|
|
209902
210514
|
barrelType: "named"
|
|
209903
|
-
}, 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 = {}, mapper = {}, paramsCasing, generators = [typeGenerator].filter(Boolean), contentType, UNSTABLE_NAMING } = options;
|
|
210515
|
+
}, 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 = {}, mapper = {}, paramsCasing, generators = [typeGenerator$1, typeGenerator].filter(Boolean), contentType, UNSTABLE_NAMING } = options;
|
|
209904
210516
|
return {
|
|
209905
210517
|
name: pluginTsName,
|
|
209906
210518
|
options: {
|
|
@@ -209945,22 +210557,63 @@ const pluginTs = definePlugin((options) => {
|
|
|
209945
210557
|
},
|
|
209946
210558
|
async install() {
|
|
209947
210559
|
var _a;
|
|
209948
|
-
const { config, fabric, plugin } = this;
|
|
210560
|
+
const { config, fabric, plugin, adapter, rootNode, pluginManager, openInStudio } = this;
|
|
209949
210561
|
const root = path$2.resolve(config.root, config.output.path);
|
|
209950
210562
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
209951
|
-
if (
|
|
209952
|
-
await
|
|
209953
|
-
await walk(
|
|
209954
|
-
|
|
209955
|
-
|
|
209956
|
-
|
|
209957
|
-
|
|
209958
|
-
|
|
209959
|
-
|
|
209960
|
-
|
|
210563
|
+
if (adapter) {
|
|
210564
|
+
await openInStudio({ ast: true });
|
|
210565
|
+
await walk(rootNode, {
|
|
210566
|
+
async schema(schemaNode) {
|
|
210567
|
+
const writeTasks = generators.map(async (generator) => {
|
|
210568
|
+
if (generator.type === "react" && generator.version === "2") {
|
|
210569
|
+
const options2 = resolveOptions(schemaNode, {
|
|
210570
|
+
options: plugin.options,
|
|
210571
|
+
exclude,
|
|
210572
|
+
include,
|
|
210573
|
+
override
|
|
210574
|
+
});
|
|
210575
|
+
if (options2 === null) return;
|
|
210576
|
+
await buildSchema(schemaNode, {
|
|
210577
|
+
options: options2,
|
|
210578
|
+
adapter,
|
|
210579
|
+
config,
|
|
210580
|
+
fabric,
|
|
210581
|
+
Component: generator.Schema,
|
|
210582
|
+
plugin,
|
|
210583
|
+
pluginManager,
|
|
210584
|
+
mode,
|
|
210585
|
+
version: generator.version
|
|
210586
|
+
});
|
|
210587
|
+
}
|
|
209961
210588
|
});
|
|
209962
|
-
|
|
209963
|
-
|
|
210589
|
+
await Promise.all(writeTasks);
|
|
210590
|
+
},
|
|
210591
|
+
async operation(operationNode) {
|
|
210592
|
+
const writeTasks = generators.map(async (generator) => {
|
|
210593
|
+
if (generator.type === "react" && generator.version === "2") {
|
|
210594
|
+
const options2 = resolveOptions(operationNode, {
|
|
210595
|
+
options: plugin.options,
|
|
210596
|
+
exclude,
|
|
210597
|
+
include,
|
|
210598
|
+
override
|
|
210599
|
+
});
|
|
210600
|
+
if (options2 === null) return;
|
|
210601
|
+
await buildOperation(operationNode, {
|
|
210602
|
+
options: options2,
|
|
210603
|
+
adapter,
|
|
210604
|
+
config,
|
|
210605
|
+
fabric,
|
|
210606
|
+
Component: generator.Operation,
|
|
210607
|
+
plugin,
|
|
210608
|
+
pluginManager,
|
|
210609
|
+
mode,
|
|
210610
|
+
version: generator.version
|
|
210611
|
+
});
|
|
210612
|
+
}
|
|
210613
|
+
});
|
|
210614
|
+
await Promise.all(writeTasks);
|
|
210615
|
+
}
|
|
210616
|
+
}, { depth: "shallow" });
|
|
209964
210617
|
return;
|
|
209965
210618
|
}
|
|
209966
210619
|
const oas = await this.getOas();
|
|
@@ -213405,7 +214058,7 @@ function MutationKey$4({ name, typeSchemas, pathParamsType, paramsCasing, operat
|
|
|
213405
214058
|
isExportable: true,
|
|
213406
214059
|
isIndexable: true,
|
|
213407
214060
|
isTypeOnly: true,
|
|
213408
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
214061
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
213409
214062
|
name: typeName,
|
|
213410
214063
|
export: true,
|
|
213411
214064
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -213473,7 +214126,7 @@ function QueryKey$4({ name, typeSchemas, paramsCasing, pathParamsType, operation
|
|
|
213473
214126
|
isExportable: true,
|
|
213474
214127
|
isIndexable: true,
|
|
213475
214128
|
isTypeOnly: true,
|
|
213476
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
214129
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
213477
214130
|
name: typeName,
|
|
213478
214131
|
export: true,
|
|
213479
214132
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -214966,7 +215619,7 @@ const hookOptionsGenerator = createReactGenerator({
|
|
|
214966
215619
|
isExportable: true,
|
|
214967
215620
|
isIndexable: true,
|
|
214968
215621
|
isTypeOnly: true,
|
|
214969
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
215622
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
214970
215623
|
export: true,
|
|
214971
215624
|
name,
|
|
214972
215625
|
children: `{ ${Object.keys(hookOptions).map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)} }`
|
|
@@ -216475,7 +217128,7 @@ function MutationKey$3({ name, typeSchemas, pathParamsType, paramsCasing, operat
|
|
|
216475
217128
|
isExportable: true,
|
|
216476
217129
|
isIndexable: true,
|
|
216477
217130
|
isTypeOnly: true,
|
|
216478
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
217131
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
216479
217132
|
name: typeName,
|
|
216480
217133
|
export: true,
|
|
216481
217134
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -216543,7 +217196,7 @@ function QueryKey$3({ name, typeSchemas, paramsCasing, pathParamsType, operation
|
|
|
216543
217196
|
isExportable: true,
|
|
216544
217197
|
isIndexable: true,
|
|
216545
217198
|
isTypeOnly: true,
|
|
216546
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
217199
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
216547
217200
|
name: typeName,
|
|
216548
217201
|
export: true,
|
|
216549
217202
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -217625,7 +218278,7 @@ function MutationKey$2({ name, typeSchemas, pathParamsType, paramsCasing, operat
|
|
|
217625
218278
|
isExportable: true,
|
|
217626
218279
|
isIndexable: true,
|
|
217627
218280
|
isTypeOnly: true,
|
|
217628
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
218281
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
217629
218282
|
name: typeName,
|
|
217630
218283
|
export: true,
|
|
217631
218284
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -217693,7 +218346,7 @@ function QueryKey$2({ name, typeSchemas, paramsCasing, pathParamsType, operation
|
|
|
217693
218346
|
isExportable: true,
|
|
217694
218347
|
isIndexable: true,
|
|
217695
218348
|
isTypeOnly: true,
|
|
217696
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
218349
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
217697
218350
|
name: typeName,
|
|
217698
218351
|
export: true,
|
|
217699
218352
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -218775,7 +219428,7 @@ function MutationKey$1({ name, typeSchemas, pathParamsType, paramsCasing, operat
|
|
|
218775
219428
|
isExportable: true,
|
|
218776
219429
|
isIndexable: true,
|
|
218777
219430
|
isTypeOnly: true,
|
|
218778
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
219431
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
218779
219432
|
name: typeName,
|
|
218780
219433
|
export: true,
|
|
218781
219434
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -218843,7 +219496,7 @@ function QueryKey$1({ name, typeSchemas, paramsCasing, pathParamsType, operation
|
|
|
218843
219496
|
isExportable: true,
|
|
218844
219497
|
isIndexable: true,
|
|
218845
219498
|
isTypeOnly: true,
|
|
218846
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
219499
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
218847
219500
|
name: typeName,
|
|
218848
219501
|
export: true,
|
|
218849
219502
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -218972,7 +219625,7 @@ function Mutation$1({ name, clientName, mutationKeyName, mutationKeyTypeName, pa
|
|
|
218972
219625
|
isExportable: true,
|
|
218973
219626
|
isIndexable: true,
|
|
218974
219627
|
isTypeOnly: true,
|
|
218975
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
219628
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
218976
219629
|
name: mutationArgTypeName,
|
|
218977
219630
|
export: true,
|
|
218978
219631
|
children: hasMutationParams ? `{${mutationArg}}` : "never"
|
|
@@ -219986,7 +220639,7 @@ function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation,
|
|
|
219986
220639
|
isExportable: true,
|
|
219987
220640
|
isIndexable: true,
|
|
219988
220641
|
isTypeOnly: true,
|
|
219989
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
220642
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
219990
220643
|
name: typeName,
|
|
219991
220644
|
export: true,
|
|
219992
220645
|
children: `ReturnType<typeof ${name}>`
|
|
@@ -220464,7 +221117,7 @@ function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operatio
|
|
|
220464
221117
|
isExportable: true,
|
|
220465
221118
|
isIndexable: true,
|
|
220466
221119
|
isTypeOnly: true,
|
|
220467
|
-
children: /* @__PURE__ */ jsx(Type$
|
|
221120
|
+
children: /* @__PURE__ */ jsx(Type$2, {
|
|
220468
221121
|
name: typeName,
|
|
220469
221122
|
export: true,
|
|
220470
221123
|
children: `ReturnType<typeof ${name}>`
|