@kubb/agent 5.0.0-alpha.21 → 5.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +585 -714
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/base.js +2 -2
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/compiler/base.js +60 -1
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js +25 -17
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js +2 -2
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/helpers.js +3 -2
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js +17 -12
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/runtime.js +25 -18
- package/.output/server/node_modules/handlebars/package.json +5 -6
- package/.output/server/package.json +2 -2
- package/package.json +17 -17
- package/.output/server/node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js +0 -22
|
@@ -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, basename,
|
|
10
|
+
import path$2, { resolve, dirname, relative, join, basename, posix, extname } 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';
|
|
@@ -4595,65 +4595,7 @@ const visitorDepths = {
|
|
|
4595
4595
|
};
|
|
4596
4596
|
const schemaTypes = {
|
|
4597
4597
|
enum: "enum"};
|
|
4598
|
-
function
|
|
4599
|
-
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
4600
|
-
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
4601
|
-
if (i === 0 && true) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
4602
|
-
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
4603
|
-
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
4604
|
-
}
|
|
4605
|
-
function applyToFileParts$f(text, transformPart) {
|
|
4606
|
-
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
4607
|
-
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
4608
|
-
}
|
|
4609
|
-
function camelCase$f(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
4610
|
-
if (isFile) return applyToFileParts$f(text, (part, isLast) => camelCase$f(part, isLast ? {
|
|
4611
|
-
prefix,
|
|
4612
|
-
suffix
|
|
4613
|
-
} : {}));
|
|
4614
|
-
return toCamelOrPascal$f(`${prefix} ${text} ${suffix}`);
|
|
4615
|
-
}
|
|
4616
|
-
function isValidVarName$c(name) {
|
|
4617
|
-
try {
|
|
4618
|
-
new Function(`var ${name}`);
|
|
4619
|
-
} catch {
|
|
4620
|
-
return false;
|
|
4621
|
-
}
|
|
4622
|
-
return true;
|
|
4623
|
-
}
|
|
4624
|
-
function narrowSchema(node, type) {
|
|
4625
|
-
return (node == null ? void 0 : node.type) === type ? node : void 0;
|
|
4626
|
-
}
|
|
4627
|
-
function isKind(kind) {
|
|
4628
|
-
return (node) => node.kind === kind;
|
|
4629
|
-
}
|
|
4630
|
-
const isOperationNode = isKind("Operation");
|
|
4631
|
-
const isSchemaNode = isKind("Schema");
|
|
4632
|
-
const plainStringTypes = /* @__PURE__ */ new Set([
|
|
4633
|
-
"string",
|
|
4634
|
-
"uuid",
|
|
4635
|
-
"email",
|
|
4636
|
-
"url",
|
|
4637
|
-
"datetime"
|
|
4638
|
-
]);
|
|
4639
|
-
function isStringType(node) {
|
|
4640
|
-
var _a;
|
|
4641
|
-
if (plainStringTypes.has(node.type)) return true;
|
|
4642
|
-
const temporal = (_a = narrowSchema(node, "date")) != null ? _a : narrowSchema(node, "time");
|
|
4643
|
-
if (temporal) return temporal.representation !== "date";
|
|
4644
|
-
return false;
|
|
4645
|
-
}
|
|
4646
|
-
function caseParams(params, casing) {
|
|
4647
|
-
if (!casing) return params;
|
|
4648
|
-
return params.map((param) => {
|
|
4649
|
-
const transformed = casing === "camelcase" || !isValidVarName$c(param.name) ? camelCase$f(param.name) : param.name;
|
|
4650
|
-
return {
|
|
4651
|
-
...param,
|
|
4652
|
-
name: transformed
|
|
4653
|
-
};
|
|
4654
|
-
});
|
|
4655
|
-
}
|
|
4656
|
-
function syncOptionality(required, schema) {
|
|
4598
|
+
function syncOptionality(schema, required) {
|
|
4657
4599
|
var _a;
|
|
4658
4600
|
const nullable = (_a = schema.nullable) != null ? _a : false;
|
|
4659
4601
|
return {
|
|
@@ -4680,7 +4622,7 @@ function createProperty(props) {
|
|
|
4680
4622
|
...props,
|
|
4681
4623
|
kind: "Property",
|
|
4682
4624
|
required,
|
|
4683
|
-
schema: syncOptionality(
|
|
4625
|
+
schema: syncOptionality(props.schema, required)
|
|
4684
4626
|
};
|
|
4685
4627
|
}
|
|
4686
4628
|
function createParameter(props) {
|
|
@@ -4690,9 +4632,17 @@ function createParameter(props) {
|
|
|
4690
4632
|
...props,
|
|
4691
4633
|
kind: "Parameter",
|
|
4692
4634
|
required,
|
|
4693
|
-
schema: syncOptionality(
|
|
4635
|
+
schema: syncOptionality(props.schema, required)
|
|
4694
4636
|
};
|
|
4695
4637
|
}
|
|
4638
|
+
function narrowSchema(node, type) {
|
|
4639
|
+
return (node == null ? void 0 : node.type) === type ? node : void 0;
|
|
4640
|
+
}
|
|
4641
|
+
function isKind(kind) {
|
|
4642
|
+
return (node) => node.kind === kind;
|
|
4643
|
+
}
|
|
4644
|
+
const isOperationNode = isKind("Operation");
|
|
4645
|
+
const isSchemaNode = isKind("Schema");
|
|
4696
4646
|
function definePrinter(build) {
|
|
4697
4647
|
return createPrinterFactory((node) => node.type)(build);
|
|
4698
4648
|
}
|
|
@@ -4719,6 +4669,32 @@ function createPrinterFactory(getKey) {
|
|
|
4719
4669
|
};
|
|
4720
4670
|
};
|
|
4721
4671
|
}
|
|
4672
|
+
function toCamelOrPascal$f(text, pascal) {
|
|
4673
|
+
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
4674
|
+
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
4675
|
+
if (i === 0 && true) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
4676
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
4677
|
+
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
4678
|
+
}
|
|
4679
|
+
function applyToFileParts$f(text, transformPart) {
|
|
4680
|
+
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
4681
|
+
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
4682
|
+
}
|
|
4683
|
+
function camelCase$f(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
4684
|
+
if (isFile) return applyToFileParts$f(text, (part, isLast) => camelCase$f(part, isLast ? {
|
|
4685
|
+
prefix,
|
|
4686
|
+
suffix
|
|
4687
|
+
} : {}));
|
|
4688
|
+
return toCamelOrPascal$f(`${prefix} ${text} ${suffix}`);
|
|
4689
|
+
}
|
|
4690
|
+
function isValidVarName$c(name) {
|
|
4691
|
+
try {
|
|
4692
|
+
new Function(`var ${name}`);
|
|
4693
|
+
} catch {
|
|
4694
|
+
return false;
|
|
4695
|
+
}
|
|
4696
|
+
return true;
|
|
4697
|
+
}
|
|
4722
4698
|
function createLimit(concurrency) {
|
|
4723
4699
|
let active = 0;
|
|
4724
4700
|
const queue = [];
|
|
@@ -4767,8 +4743,9 @@ function getChildren(node, recurse) {
|
|
|
4767
4743
|
case "Response":
|
|
4768
4744
|
return node.schema ? [node.schema] : [];
|
|
4769
4745
|
case "FunctionParameter":
|
|
4770
|
-
case "
|
|
4746
|
+
case "ParameterGroup":
|
|
4771
4747
|
case "FunctionParameters":
|
|
4748
|
+
case "Type":
|
|
4772
4749
|
return [];
|
|
4773
4750
|
}
|
|
4774
4751
|
}
|
|
@@ -4915,8 +4892,9 @@ function transform(node, options) {
|
|
|
4915
4892
|
};
|
|
4916
4893
|
}
|
|
4917
4894
|
case "FunctionParameter":
|
|
4918
|
-
case "
|
|
4895
|
+
case "ParameterGroup":
|
|
4919
4896
|
case "FunctionParameters":
|
|
4897
|
+
case "Type":
|
|
4920
4898
|
return node;
|
|
4921
4899
|
}
|
|
4922
4900
|
}
|
|
@@ -4993,12 +4971,36 @@ function collect(node, options) {
|
|
|
4993
4971
|
})) results.push(item);
|
|
4994
4972
|
return results;
|
|
4995
4973
|
}
|
|
4974
|
+
const plainStringTypes = /* @__PURE__ */ new Set([
|
|
4975
|
+
"string",
|
|
4976
|
+
"uuid",
|
|
4977
|
+
"email",
|
|
4978
|
+
"url",
|
|
4979
|
+
"datetime"
|
|
4980
|
+
]);
|
|
4981
|
+
function isStringType(node) {
|
|
4982
|
+
var _a;
|
|
4983
|
+
if (plainStringTypes.has(node.type)) return true;
|
|
4984
|
+
const temporal = (_a = narrowSchema(node, "date")) != null ? _a : narrowSchema(node, "time");
|
|
4985
|
+
if (temporal) return temporal.representation !== "date";
|
|
4986
|
+
return false;
|
|
4987
|
+
}
|
|
4988
|
+
function caseParams(params, casing) {
|
|
4989
|
+
if (!casing) return params;
|
|
4990
|
+
return params.map((param) => {
|
|
4991
|
+
const transformed = casing === "camelcase" || !isValidVarName$c(param.name) ? camelCase$f(param.name) : param.name;
|
|
4992
|
+
return {
|
|
4993
|
+
...param,
|
|
4994
|
+
name: transformed
|
|
4995
|
+
};
|
|
4996
|
+
});
|
|
4997
|
+
}
|
|
4996
4998
|
|
|
4997
|
-
var __defProp$
|
|
4999
|
+
var __defProp$h = Object.defineProperty;
|
|
4998
5000
|
var __typeError$c = (msg) => {
|
|
4999
5001
|
throw TypeError(msg);
|
|
5000
5002
|
};
|
|
5001
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
5003
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5002
5004
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5003
5005
|
var __accessCheck$c = (obj, member, msg) => member.has(obj) || __typeError$c("Cannot " + msg);
|
|
5004
5006
|
var __privateGet$c = (obj, member, getter) => (__accessCheck$c(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -5013,9 +5015,7 @@ var __privateWrapper$1 = (obj, member, setter, getter) => ({
|
|
|
5013
5015
|
return __privateGet$c(obj, member, getter);
|
|
5014
5016
|
}
|
|
5015
5017
|
});
|
|
5016
|
-
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,
|
|
5017
|
-
var ValidationPluginError = class extends Error {
|
|
5018
|
-
};
|
|
5018
|
+
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, _PluginDriver_instances, emitProcessingEnd_fn, execute_fn, executeSync_fn, _d, _items, _FunctionParams_static, _e, orderItems_fn, addParams_fn, _cachedLeaves, _f;
|
|
5019
5019
|
function toError(value) {
|
|
5020
5020
|
return value instanceof Error ? value : new Error(String(value));
|
|
5021
5021
|
}
|
|
@@ -5190,15 +5190,6 @@ async function clean(path2) {
|
|
|
5190
5190
|
force: true
|
|
5191
5191
|
});
|
|
5192
5192
|
}
|
|
5193
|
-
function setUniqueName(originalName, data) {
|
|
5194
|
-
let used = data[originalName] || 0;
|
|
5195
|
-
if (used) {
|
|
5196
|
-
data[originalName] = ++used;
|
|
5197
|
-
return originalName;
|
|
5198
|
-
}
|
|
5199
|
-
data[originalName] = 1;
|
|
5200
|
-
return originalName;
|
|
5201
|
-
}
|
|
5202
5193
|
function isPromiseRejectedResult(result) {
|
|
5203
5194
|
return result.status === "rejected";
|
|
5204
5195
|
}
|
|
@@ -5674,8 +5665,10 @@ var PluginDriver = (_d = class {
|
|
|
5674
5665
|
__publicField$b(this, "rootNode");
|
|
5675
5666
|
__publicField$b(this, "adapter");
|
|
5676
5667
|
__privateAdd$c(this, _studioIsOpen, false);
|
|
5677
|
-
|
|
5678
|
-
|
|
5668
|
+
__publicField$b(this, "plugins", /* @__PURE__ */ new Map());
|
|
5669
|
+
/**
|
|
5670
|
+
* @deprecated use resolvers context instead
|
|
5671
|
+
*/
|
|
5679
5672
|
__publicField$b(this, "resolvePath", (params) => {
|
|
5680
5673
|
var _a2, _b2;
|
|
5681
5674
|
const defaultPath = resolve(resolve(this.config.root, this.config.output.path), params.baseName);
|
|
@@ -5697,42 +5690,46 @@ var PluginDriver = (_d = class {
|
|
|
5697
5690
|
]
|
|
5698
5691
|
})) == null ? void 0 : _b2.result) || defaultPath;
|
|
5699
5692
|
});
|
|
5693
|
+
/**
|
|
5694
|
+
* @deprecated use resolvers context instead
|
|
5695
|
+
*/
|
|
5700
5696
|
__publicField$b(this, "resolveName", (params) => {
|
|
5701
|
-
var _a2;
|
|
5702
|
-
if (params.pluginName) {
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
return transformReservedWord([...new Set(names)].at(0) || params.name);
|
|
5709
|
-
}
|
|
5710
|
-
const name = (_a2 = this.hookFirstSync({
|
|
5697
|
+
var _a2, _b2, _c2;
|
|
5698
|
+
if (params.pluginName) return transformReservedWord((_b2 = (_a2 = this.hookForPluginSync({
|
|
5699
|
+
pluginName: params.pluginName,
|
|
5700
|
+
hookName: "resolveName",
|
|
5701
|
+
parameters: [params.name.trim(), params.type]
|
|
5702
|
+
})) == null ? void 0 : _a2.at(0)) != null ? _b2 : params.name);
|
|
5703
|
+
const name = (_c2 = this.hookFirstSync({
|
|
5711
5704
|
hookName: "resolveName",
|
|
5712
5705
|
parameters: [params.name.trim(), params.type]
|
|
5713
|
-
})) == null ? void 0 :
|
|
5706
|
+
})) == null ? void 0 : _c2.result;
|
|
5714
5707
|
return transformReservedWord(name != null ? name : params.name);
|
|
5715
5708
|
});
|
|
5716
5709
|
this.config = config;
|
|
5717
5710
|
this.options = options;
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5711
|
+
config.plugins.map((plugin) => Object.assign({ install() {
|
|
5712
|
+
} }, plugin)).sort((a, b) => {
|
|
5713
|
+
var _a2, _b2;
|
|
5714
|
+
if ((_a2 = b.pre) == null ? void 0 : _a2.includes(a.name)) return 1;
|
|
5715
|
+
if ((_b2 = b.post) == null ? void 0 : _b2.includes(a.name)) return -1;
|
|
5716
|
+
return 0;
|
|
5717
|
+
}).forEach((plugin) => {
|
|
5718
|
+
this.plugins.set(plugin.name, plugin);
|
|
5721
5719
|
});
|
|
5722
5720
|
}
|
|
5723
5721
|
get events() {
|
|
5724
5722
|
return this.options.events;
|
|
5725
5723
|
}
|
|
5726
5724
|
getContext(plugin) {
|
|
5727
|
-
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5728
5725
|
const driver = this;
|
|
5729
5726
|
const baseContext = {
|
|
5730
|
-
fabric:
|
|
5731
|
-
config:
|
|
5727
|
+
fabric: driver.options.fabric,
|
|
5728
|
+
config: driver.config,
|
|
5732
5729
|
plugin,
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5730
|
+
getPlugin: driver.getPlugin.bind(driver),
|
|
5731
|
+
events: driver.options.events,
|
|
5732
|
+
driver,
|
|
5736
5733
|
addFile: async (...files) => {
|
|
5737
5734
|
await this.options.fabric.addFile(...files);
|
|
5738
5735
|
},
|
|
@@ -5745,6 +5742,9 @@ var PluginDriver = (_d = class {
|
|
|
5745
5742
|
get adapter() {
|
|
5746
5743
|
return driver.adapter;
|
|
5747
5744
|
},
|
|
5745
|
+
get resolver() {
|
|
5746
|
+
return plugin.resolver;
|
|
5747
|
+
},
|
|
5748
5748
|
openInStudio(options) {
|
|
5749
5749
|
var _a2, _b2;
|
|
5750
5750
|
if (!driver.config.devtools || __privateGet$c(driver, _studioIsOpen)) return;
|
|
@@ -5756,8 +5756,8 @@ var PluginDriver = (_d = class {
|
|
|
5756
5756
|
}
|
|
5757
5757
|
};
|
|
5758
5758
|
const mergedExtras = {};
|
|
5759
|
-
for (const
|
|
5760
|
-
const result =
|
|
5759
|
+
for (const plugin2 of this.plugins.values()) if (typeof plugin2.inject === "function") {
|
|
5760
|
+
const result = plugin2.inject.call(baseContext, baseContext);
|
|
5761
5761
|
if (result !== null && typeof result === "object") Object.assign(mergedExtras, result);
|
|
5762
5762
|
}
|
|
5763
5763
|
return {
|
|
@@ -5765,9 +5765,9 @@ var PluginDriver = (_d = class {
|
|
|
5765
5765
|
...mergedExtras
|
|
5766
5766
|
};
|
|
5767
5767
|
}
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5768
|
+
/**
|
|
5769
|
+
* @deprecated use resolvers context instead
|
|
5770
|
+
*/
|
|
5771
5771
|
getFile({ name, mode, extname: extname2, pluginName, options }) {
|
|
5772
5772
|
const resolvedName = mode ? mode === "single" ? "" : this.resolveName({
|
|
5773
5773
|
name,
|
|
@@ -5794,44 +5794,41 @@ var PluginDriver = (_d = class {
|
|
|
5794
5794
|
* Run a specific hookName for plugin x.
|
|
5795
5795
|
*/
|
|
5796
5796
|
async hookForPlugin({ pluginName, hookName, parameters }) {
|
|
5797
|
-
const
|
|
5797
|
+
const plugin = this.plugins.get(pluginName);
|
|
5798
|
+
if (!plugin) return [null];
|
|
5798
5799
|
this.events.emit("plugins:hook:progress:start", {
|
|
5799
5800
|
hookName,
|
|
5800
|
-
plugins
|
|
5801
|
+
plugins: [plugin]
|
|
5802
|
+
});
|
|
5803
|
+
const result = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5804
|
+
strategy: "hookFirst",
|
|
5805
|
+
hookName,
|
|
5806
|
+
parameters,
|
|
5807
|
+
plugin
|
|
5801
5808
|
});
|
|
5802
|
-
const items = [];
|
|
5803
|
-
for (const plugin of plugins) {
|
|
5804
|
-
const result = await __privateMethod$c(this, _PluginDriver_instances, execute_fn).call(this, {
|
|
5805
|
-
strategy: "hookFirst",
|
|
5806
|
-
hookName,
|
|
5807
|
-
parameters,
|
|
5808
|
-
plugin
|
|
5809
|
-
});
|
|
5810
|
-
if (result !== void 0 && result !== null) items.push(result);
|
|
5811
|
-
}
|
|
5812
5809
|
this.events.emit("plugins:hook:progress:end", { hookName });
|
|
5813
|
-
return
|
|
5810
|
+
return [result];
|
|
5814
5811
|
}
|
|
5815
5812
|
/**
|
|
5816
5813
|
* Run a specific hookName for plugin x.
|
|
5817
5814
|
*/
|
|
5818
5815
|
hookForPluginSync({ pluginName, hookName, parameters }) {
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
})
|
|
5816
|
+
const plugin = this.plugins.get(pluginName);
|
|
5817
|
+
if (!plugin) return null;
|
|
5818
|
+
const result = __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
5819
|
+
strategy: "hookFirst",
|
|
5820
|
+
hookName,
|
|
5821
|
+
parameters,
|
|
5822
|
+
plugin
|
|
5823
|
+
});
|
|
5824
|
+
return result !== null ? [result] : [];
|
|
5827
5825
|
}
|
|
5828
5826
|
/**
|
|
5829
5827
|
* Returns the first non-null result.
|
|
5830
5828
|
*/
|
|
5831
5829
|
async hookFirst({ hookName, parameters, skipped }) {
|
|
5832
|
-
const plugins =
|
|
5833
|
-
|
|
5834
|
-
});
|
|
5830
|
+
const plugins = [];
|
|
5831
|
+
for (const plugin of this.plugins.values()) if (hookName in plugin && (skipped ? !skipped.has(plugin) : true)) plugins.push(plugin);
|
|
5835
5832
|
this.events.emit("plugins:hook:progress:start", {
|
|
5836
5833
|
hookName,
|
|
5837
5834
|
plugins
|
|
@@ -5858,10 +5855,9 @@ var PluginDriver = (_d = class {
|
|
|
5858
5855
|
*/
|
|
5859
5856
|
hookFirstSync({ hookName, parameters, skipped }) {
|
|
5860
5857
|
let parseResult = null;
|
|
5861
|
-
const
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
for (const plugin of plugins) {
|
|
5858
|
+
for (const plugin of this.plugins.values()) {
|
|
5859
|
+
if (!(hookName in plugin)) continue;
|
|
5860
|
+
if (skipped == null ? void 0 : skipped.has(plugin)) continue;
|
|
5865
5861
|
parseResult = {
|
|
5866
5862
|
result: __privateMethod$c(this, _PluginDriver_instances, executeSync_fn).call(this, {
|
|
5867
5863
|
strategy: "hookFirst",
|
|
@@ -5871,7 +5867,7 @@ var PluginDriver = (_d = class {
|
|
|
5871
5867
|
}),
|
|
5872
5868
|
plugin
|
|
5873
5869
|
};
|
|
5874
|
-
if (
|
|
5870
|
+
if (parseResult.result != null) break;
|
|
5875
5871
|
}
|
|
5876
5872
|
return parseResult;
|
|
5877
5873
|
}
|
|
@@ -5879,7 +5875,8 @@ var PluginDriver = (_d = class {
|
|
|
5879
5875
|
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
5880
5876
|
*/
|
|
5881
5877
|
async hookParallel({ hookName, parameters }) {
|
|
5882
|
-
const plugins =
|
|
5878
|
+
const plugins = [];
|
|
5879
|
+
for (const plugin of this.plugins.values()) if (hookName in plugin) plugins.push(plugin);
|
|
5883
5880
|
this.events.emit("plugins:hook:progress:start", {
|
|
5884
5881
|
hookName,
|
|
5885
5882
|
plugins
|
|
@@ -5899,7 +5896,7 @@ var PluginDriver = (_d = class {
|
|
|
5899
5896
|
results.forEach((result, index) => {
|
|
5900
5897
|
var _a2;
|
|
5901
5898
|
if (isPromiseRejectedResult(result)) {
|
|
5902
|
-
const plugin =
|
|
5899
|
+
const plugin = plugins[index];
|
|
5903
5900
|
if (plugin) {
|
|
5904
5901
|
const startTime = (_a2 = pluginStartTimes.get(plugin)) != null ? _a2 : performance$1.now();
|
|
5905
5902
|
this.events.emit("error", result.reason, {
|
|
@@ -5922,7 +5919,8 @@ var PluginDriver = (_d = class {
|
|
|
5922
5919
|
* Chains plugins
|
|
5923
5920
|
*/
|
|
5924
5921
|
async hookSeq({ hookName, parameters }) {
|
|
5925
|
-
const plugins =
|
|
5922
|
+
const plugins = [];
|
|
5923
|
+
for (const plugin of this.plugins.values()) if (hookName in plugin) plugins.push(plugin);
|
|
5926
5924
|
this.events.emit("plugins:hook:progress:start", {
|
|
5927
5925
|
hookName,
|
|
5928
5926
|
plugins
|
|
@@ -5937,35 +5935,10 @@ var PluginDriver = (_d = class {
|
|
|
5937
5935
|
}));
|
|
5938
5936
|
this.events.emit("plugins:hook:progress:end", { hookName });
|
|
5939
5937
|
}
|
|
5940
|
-
|
|
5941
|
-
return
|
|
5938
|
+
getPlugin(pluginName) {
|
|
5939
|
+
return this.plugins.get(pluginName);
|
|
5942
5940
|
}
|
|
5943
|
-
|
|
5944
|
-
const plugins = [...this.plugins];
|
|
5945
|
-
const pluginByPluginName = plugins.filter((plugin) => hookName in plugin).filter((item) => item.name === pluginName);
|
|
5946
|
-
if (!(pluginByPluginName == null ? void 0 : pluginByPluginName.length)) {
|
|
5947
|
-
const corePlugin = plugins.find((plugin) => plugin.name === "core" && hookName in plugin);
|
|
5948
|
-
return corePlugin ? [corePlugin] : [];
|
|
5949
|
-
}
|
|
5950
|
-
return pluginByPluginName;
|
|
5951
|
-
}
|
|
5952
|
-
}, _studioIsOpen = new WeakMap(), _plugins = new WeakMap(), _usedPluginNames = new WeakMap(), _PluginDriver_instances = new WeakSet(), getSortedPlugins_fn = function(hookName) {
|
|
5953
|
-
const plugins = [...__privateGet$c(this, _plugins)];
|
|
5954
|
-
if (hookName) return plugins.filter((plugin) => hookName in plugin);
|
|
5955
|
-
return plugins.map((plugin) => {
|
|
5956
|
-
if (plugin.pre) {
|
|
5957
|
-
let missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName));
|
|
5958
|
-
if (missingPlugins.includes("plugin-oas") && this.adapter) missingPlugins = missingPlugins.filter((pluginName) => pluginName !== "plugin-oas");
|
|
5959
|
-
if (missingPlugins.length > 0) throw new ValidationPluginError(`The plugin '${plugin.name}' has a pre set that references missing plugins for '${missingPlugins.join(", ")}'`);
|
|
5960
|
-
}
|
|
5961
|
-
return plugin;
|
|
5962
|
-
}).sort((a, b) => {
|
|
5963
|
-
var _a2, _b2;
|
|
5964
|
-
if ((_a2 = b.pre) == null ? void 0 : _a2.includes(a.name)) return 1;
|
|
5965
|
-
if ((_b2 = b.post) == null ? void 0 : _b2.includes(a.name)) return -1;
|
|
5966
|
-
return 0;
|
|
5967
|
-
});
|
|
5968
|
-
}, /**
|
|
5941
|
+
}, _studioIsOpen = new WeakMap(), _PluginDriver_instances = new WeakSet(), /**
|
|
5969
5942
|
* Run an async plugin hook and return the result.
|
|
5970
5943
|
* @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
|
|
5971
5944
|
* @param args Arguments passed to the plugin hook.
|
|
@@ -6048,16 +6021,6 @@ executeSync_fn = function({ strategy, hookName, parameters, plugin }) {
|
|
|
6048
6021
|
});
|
|
6049
6022
|
return null;
|
|
6050
6023
|
}
|
|
6051
|
-
}, parse_fn = function(plugin) {
|
|
6052
|
-
const usedPluginNames = __privateGet$c(this, _usedPluginNames);
|
|
6053
|
-
setUniqueName(plugin.name, usedPluginNames);
|
|
6054
|
-
const usageCount = usedPluginNames[plugin.name];
|
|
6055
|
-
if (usageCount && usageCount > 1) throw new ValidationPluginError(`Duplicate plugin "${plugin.name}" detected. Each plugin can only be used once. Use a different configuration instead of adding multiple instances of the same plugin.`);
|
|
6056
|
-
return {
|
|
6057
|
-
install() {
|
|
6058
|
-
},
|
|
6059
|
-
...plugin
|
|
6060
|
-
};
|
|
6061
6024
|
}, _d);
|
|
6062
6025
|
function createStorage(build2) {
|
|
6063
6026
|
return (options) => build2(options != null ? options : {});
|
|
@@ -6108,7 +6071,7 @@ const fsStorage = createStorage(() => ({
|
|
|
6108
6071
|
await clean(resolve(base));
|
|
6109
6072
|
}
|
|
6110
6073
|
}));
|
|
6111
|
-
var version$1 = "5.0.0-alpha.
|
|
6074
|
+
var version$1 = "5.0.0-alpha.23";
|
|
6112
6075
|
function getDiagnosticInfo() {
|
|
6113
6076
|
return {
|
|
6114
6077
|
nodeVersion: version$2,
|
|
@@ -6252,7 +6215,7 @@ async function safeBuild(options, overrides) {
|
|
|
6252
6215
|
const pluginTimings = /* @__PURE__ */ new Map();
|
|
6253
6216
|
const config = driver.config;
|
|
6254
6217
|
try {
|
|
6255
|
-
for (const plugin of driver.plugins) {
|
|
6218
|
+
for (const plugin of driver.plugins.values()) {
|
|
6256
6219
|
const context = driver.getContext(plugin);
|
|
6257
6220
|
const hrStart = process.hrtime();
|
|
6258
6221
|
const installer = plugin.install.bind(context);
|
|
@@ -6362,7 +6325,7 @@ async function safeBuild(options, overrides) {
|
|
|
6362
6325
|
}
|
|
6363
6326
|
function buildBarrelExports({ barrelFiles, rootDir, existingExports, config, driver }) {
|
|
6364
6327
|
const pluginNameMap = /* @__PURE__ */ new Map();
|
|
6365
|
-
for (const plugin of driver.plugins) pluginNameMap.set(plugin.name, plugin);
|
|
6328
|
+
for (const plugin of driver.plugins.values()) pluginNameMap.set(plugin.name, plugin);
|
|
6366
6329
|
return barrelFiles.flatMap((file) => {
|
|
6367
6330
|
var _a2, _b2;
|
|
6368
6331
|
const containsOnlyTypes = (_a2 = file.sources) == null ? void 0 : _a2.every((source) => source.isTypeOnly);
|
|
@@ -6403,9 +6366,6 @@ function inputToAdapterSource(config) {
|
|
|
6403
6366
|
function createPlugin(build2) {
|
|
6404
6367
|
return (options) => build2(options != null ? options : {});
|
|
6405
6368
|
}
|
|
6406
|
-
function defineBuilder(build2) {
|
|
6407
|
-
return build2();
|
|
6408
|
-
}
|
|
6409
6369
|
function defineGenerator(generator) {
|
|
6410
6370
|
if (generator.type === "react") return {
|
|
6411
6371
|
version: "2",
|
|
@@ -6434,14 +6394,6 @@ function defineGenerator(generator) {
|
|
|
6434
6394
|
...generator
|
|
6435
6395
|
};
|
|
6436
6396
|
}
|
|
6437
|
-
function definePreset(name, { resolvers, transformers, generators }) {
|
|
6438
|
-
return {
|
|
6439
|
-
name,
|
|
6440
|
-
resolvers,
|
|
6441
|
-
transformers,
|
|
6442
|
-
generators
|
|
6443
|
-
};
|
|
6444
|
-
}
|
|
6445
6397
|
function definePresets(presets) {
|
|
6446
6398
|
return presets;
|
|
6447
6399
|
}
|
|
@@ -6500,13 +6452,7 @@ function defaultResolveOptions(node, { options, exclude = [], include, override
|
|
|
6500
6452
|
}
|
|
6501
6453
|
function defaultResolvePath({ baseName, pathMode, tag, path: groupPath }, { root, output, group }) {
|
|
6502
6454
|
if ((pathMode != null ? pathMode : getMode(path$2.resolve(root, output.path))) === "single") return path$2.resolve(root, output.path);
|
|
6503
|
-
if (group && (groupPath || tag)) {
|
|
6504
|
-
const groupName = group.name ? group.name : (ctx) => {
|
|
6505
|
-
if (group.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
6506
|
-
return `${camelCase$e(ctx.group)}Controller`;
|
|
6507
|
-
};
|
|
6508
|
-
return path$2.resolve(root, output.path, groupName({ group: group.type === "path" ? groupPath : tag }), baseName);
|
|
6509
|
-
}
|
|
6455
|
+
if (group && (groupPath || tag)) return path$2.resolve(root, output.path, group.name({ group: group.type === "path" ? groupPath : tag }), baseName);
|
|
6510
6456
|
return path$2.resolve(root, output.path, baseName);
|
|
6511
6457
|
}
|
|
6512
6458
|
function defaultResolveFile({ name, extname: extname2, tag, path: groupPath }, context) {
|
|
@@ -6582,19 +6528,15 @@ async function renderOperation$1(node, options) {
|
|
|
6582
6528
|
const { config, fabric, plugin, Component, adapter, driver } = options;
|
|
6583
6529
|
if (!Component) return;
|
|
6584
6530
|
const fabricChild = createReactFabric();
|
|
6585
|
-
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
node,
|
|
6595
|
-
options: options.options
|
|
6596
|
-
})
|
|
6597
|
-
}));
|
|
6531
|
+
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, { children: /* @__PURE__ */ jsx(Component, {
|
|
6532
|
+
config,
|
|
6533
|
+
plugin,
|
|
6534
|
+
driver,
|
|
6535
|
+
adapter,
|
|
6536
|
+
node,
|
|
6537
|
+
options: options.options,
|
|
6538
|
+
resolver: options.resolver
|
|
6539
|
+
}) }));
|
|
6598
6540
|
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
6599
6541
|
fabricChild.unmount();
|
|
6600
6542
|
}
|
|
@@ -6602,19 +6544,15 @@ async function renderSchema$1(node, options) {
|
|
|
6602
6544
|
const { config, fabric, plugin, Component, adapter, driver } = options;
|
|
6603
6545
|
if (!Component) return;
|
|
6604
6546
|
const fabricChild = createReactFabric();
|
|
6605
|
-
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, {
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
node,
|
|
6615
|
-
options: options.options
|
|
6616
|
-
})
|
|
6617
|
-
}));
|
|
6547
|
+
await fabricChild.render(/* @__PURE__ */ jsx(Fabric, { children: /* @__PURE__ */ jsx(Component, {
|
|
6548
|
+
config,
|
|
6549
|
+
plugin,
|
|
6550
|
+
driver,
|
|
6551
|
+
adapter,
|
|
6552
|
+
node,
|
|
6553
|
+
options: options.options,
|
|
6554
|
+
resolver: options.resolver
|
|
6555
|
+
}) }));
|
|
6618
6556
|
fabric.context.fileManager.upsert(...fabricChild.files);
|
|
6619
6557
|
fabricChild.unmount();
|
|
6620
6558
|
}
|
|
@@ -6780,24 +6718,39 @@ var TreeNode = (_f = class {
|
|
|
6780
6718
|
__privateSet$c(this, _cachedLeaves, leaves);
|
|
6781
6719
|
return leaves;
|
|
6782
6720
|
}
|
|
6721
|
+
/**
|
|
6722
|
+
* Visits this node and every descendant in depth-first order.
|
|
6723
|
+
*/
|
|
6783
6724
|
forEach(callback) {
|
|
6784
6725
|
if (typeof callback !== "function") throw new TypeError("forEach() callback must be a function");
|
|
6785
6726
|
callback(this);
|
|
6786
6727
|
for (const child of this.children) child.forEach(callback);
|
|
6787
6728
|
return this;
|
|
6788
6729
|
}
|
|
6730
|
+
/**
|
|
6731
|
+
* Finds the first leaf that satisfies `predicate`, or `undefined` when none match.
|
|
6732
|
+
*/
|
|
6789
6733
|
findDeep(predicate) {
|
|
6790
6734
|
if (typeof predicate !== "function") throw new TypeError("find() predicate must be a function");
|
|
6791
6735
|
return this.leaves.find(predicate);
|
|
6792
6736
|
}
|
|
6737
|
+
/**
|
|
6738
|
+
* Calls `callback` for every leaf of this node.
|
|
6739
|
+
*/
|
|
6793
6740
|
forEachDeep(callback) {
|
|
6794
6741
|
if (typeof callback !== "function") throw new TypeError("forEach() callback must be a function");
|
|
6795
6742
|
this.leaves.forEach(callback);
|
|
6796
6743
|
}
|
|
6744
|
+
/**
|
|
6745
|
+
* Returns all leaves that satisfy `callback`.
|
|
6746
|
+
*/
|
|
6797
6747
|
filterDeep(callback) {
|
|
6798
6748
|
if (typeof callback !== "function") throw new TypeError("filter() callback must be a function");
|
|
6799
6749
|
return this.leaves.filter(callback);
|
|
6800
6750
|
}
|
|
6751
|
+
/**
|
|
6752
|
+
* Maps every leaf through `callback` and returns the resulting array.
|
|
6753
|
+
*/
|
|
6801
6754
|
mapDeep(callback) {
|
|
6802
6755
|
if (typeof callback !== "function") throw new TypeError("map() callback must be a function");
|
|
6803
6756
|
return this.leaves.map(callback);
|
|
@@ -6952,7 +6905,10 @@ async function getBarrelFiles(files, { type, meta = {}, root, output }) {
|
|
|
6952
6905
|
}
|
|
6953
6906
|
async function getConfigs(config, args) {
|
|
6954
6907
|
const resolved = await (typeof config === "function" ? config(args) : config);
|
|
6955
|
-
return (Array.isArray(resolved) ? resolved : [resolved]).map((item) => ({
|
|
6908
|
+
return (Array.isArray(resolved) ? resolved : [resolved]).map((item) => ({
|
|
6909
|
+
plugins: [],
|
|
6910
|
+
...item
|
|
6911
|
+
}));
|
|
6956
6912
|
}
|
|
6957
6913
|
function mergeResolvers(...resolvers) {
|
|
6958
6914
|
return resolvers.reduce((acc, curr) => ({
|
|
@@ -6962,7 +6918,7 @@ function mergeResolvers(...resolvers) {
|
|
|
6962
6918
|
}
|
|
6963
6919
|
function getPreset(params) {
|
|
6964
6920
|
var _a2, _b2, _c2, _d2, _e2;
|
|
6965
|
-
const { preset: presetName, presets, resolvers, transformers: userTransformers, generators: userGenerators } = params;
|
|
6921
|
+
const { preset: presetName, presets, resolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = params;
|
|
6966
6922
|
const [defaultResolver2, ...userResolvers] = resolvers;
|
|
6967
6923
|
const preset = presets[presetName];
|
|
6968
6924
|
const resolver = mergeResolvers(mergeResolvers(defaultResolver2, ...(_a2 = preset == null ? void 0 : preset.resolvers) != null ? _a2 : []), ...userResolvers != null ? userResolvers : []);
|
|
@@ -7021,7 +6977,7 @@ function satisfiesDependency(dependency, version2, cwd) {
|
|
|
7021
6977
|
return satisfies(semVer, version2);
|
|
7022
6978
|
}
|
|
7023
6979
|
|
|
7024
|
-
var version = "5.0.0-alpha.
|
|
6980
|
+
var version = "5.0.0-alpha.23";
|
|
7025
6981
|
|
|
7026
6982
|
function isCommandMessage(msg) {
|
|
7027
6983
|
return msg.type === "command";
|
|
@@ -7212,8 +7168,8 @@ async function loadConfig(resolvedConfigPath) {
|
|
|
7212
7168
|
return configs[0];
|
|
7213
7169
|
}
|
|
7214
7170
|
|
|
7215
|
-
var __defProp$
|
|
7216
|
-
var __name$
|
|
7171
|
+
var __defProp$g = Object.defineProperty;
|
|
7172
|
+
var __name$5 = (target, value) => __defProp$g(target, "name", {
|
|
7217
7173
|
value,
|
|
7218
7174
|
configurable: true
|
|
7219
7175
|
});
|
|
@@ -7347,11 +7303,11 @@ function isKeyword(meta, keyword) {
|
|
|
7347
7303
|
return meta.keyword === keyword;
|
|
7348
7304
|
}
|
|
7349
7305
|
|
|
7350
|
-
var __defProp$
|
|
7306
|
+
var __defProp$f = Object.defineProperty;
|
|
7351
7307
|
var __typeError$b = (msg) => {
|
|
7352
7308
|
throw TypeError(msg);
|
|
7353
7309
|
};
|
|
7354
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$
|
|
7310
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7355
7311
|
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7356
7312
|
var __accessCheck$b = (obj, member, msg) => member.has(obj) || __typeError$b("Cannot " + msg);
|
|
7357
7313
|
var __privateGet$b = (obj, member, getter) => (__accessCheck$b(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -8091,11 +8047,11 @@ function resolveServerUrl(server, overrides) {
|
|
|
8091
8047
|
return url;
|
|
8092
8048
|
}
|
|
8093
8049
|
|
|
8094
|
-
var __defProp$
|
|
8050
|
+
var __defProp$e = Object.defineProperty;
|
|
8095
8051
|
var __typeError$a = (msg) => {
|
|
8096
8052
|
throw TypeError(msg);
|
|
8097
8053
|
};
|
|
8098
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$
|
|
8054
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8099
8055
|
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8100
8056
|
var __accessCheck$a = (obj, member, msg) => member.has(obj) || __typeError$a("Cannot " + msg);
|
|
8101
8057
|
var __privateGet$a = (obj, member, getter) => (__accessCheck$a(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -9329,11 +9285,11 @@ function withRequiredRequestBodySchema(operationSchema) {
|
|
|
9329
9285
|
};
|
|
9330
9286
|
}
|
|
9331
9287
|
|
|
9332
|
-
var __defProp$
|
|
9288
|
+
var __defProp$d = Object.defineProperty;
|
|
9333
9289
|
var __typeError$9 = (msg) => {
|
|
9334
9290
|
throw TypeError(msg);
|
|
9335
9291
|
};
|
|
9336
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$
|
|
9292
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9337
9293
|
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
|
9338
9294
|
var __accessCheck$9 = (obj, member, msg) => member.has(obj) || __typeError$9("Cannot " + msg);
|
|
9339
9295
|
var __privateGet$9 = (obj, member, getter) => (__accessCheck$9(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -9579,11 +9535,11 @@ function isParameterSchema(schemaName) {
|
|
|
9579
9535
|
return lowerName.includes("pathparams") || lowerName.includes("queryparams") || lowerName.includes("headerparams");
|
|
9580
9536
|
}
|
|
9581
9537
|
|
|
9582
|
-
var __defProp$
|
|
9538
|
+
var __defProp$c = Object.defineProperty;
|
|
9583
9539
|
var __typeError$8 = (msg) => {
|
|
9584
9540
|
throw TypeError(msg);
|
|
9585
9541
|
};
|
|
9586
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$
|
|
9542
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9587
9543
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
|
|
9588
9544
|
var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
|
|
9589
9545
|
var __privateGet$8 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
@@ -9787,7 +9743,7 @@ function getParams$1$5({ paramsType, paramsCasing, pathParamsType, typeSchemas }
|
|
|
9787
9743
|
default: getDefaultValue((_b = typeSchemas.pathParams) == null ? void 0 : _b.schema)
|
|
9788
9744
|
} : void 0 });
|
|
9789
9745
|
}
|
|
9790
|
-
__name$
|
|
9746
|
+
__name$5(getParams$1$5, "getParams");
|
|
9791
9747
|
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
9792
9748
|
const path = new URLPath$7(operation.path);
|
|
9793
9749
|
const params = getParams$1$5({
|
|
@@ -9968,7 +9924,7 @@ Client.getParams = getParams$d;
|
|
|
9968
9924
|
function buildHeaders$1(contentType, hasHeaderParams) {
|
|
9969
9925
|
return [contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0, hasHeaderParams ? "...headers" : void 0].filter(Boolean);
|
|
9970
9926
|
}
|
|
9971
|
-
__name$
|
|
9927
|
+
__name$5(buildHeaders$1, "buildHeaders");
|
|
9972
9928
|
function buildGenerics$1(typeSchemas) {
|
|
9973
9929
|
var _a2, _b;
|
|
9974
9930
|
const TError = `ResponseErrorConfig<${((_a2 = typeSchemas.errors) == null ? void 0 : _a2.map((item) => item.name).join(" | ")) || "Error"}>`;
|
|
@@ -9978,7 +9934,7 @@ function buildGenerics$1(typeSchemas) {
|
|
|
9978
9934
|
((_b = typeSchemas.request) == null ? void 0 : _b.name) || "unknown"
|
|
9979
9935
|
].filter(Boolean);
|
|
9980
9936
|
}
|
|
9981
|
-
__name$
|
|
9937
|
+
__name$5(buildGenerics$1, "buildGenerics");
|
|
9982
9938
|
function buildClientParams$1({ operation, path, baseURL, typeSchemas, isFormData, headers }) {
|
|
9983
9939
|
var _a2, _b;
|
|
9984
9940
|
return FunctionParams.factory({ config: {
|
|
@@ -9994,25 +9950,25 @@ function buildClientParams$1({ operation, path, baseURL, typeSchemas, isFormData
|
|
|
9994
9950
|
}
|
|
9995
9951
|
} });
|
|
9996
9952
|
}
|
|
9997
|
-
__name$
|
|
9953
|
+
__name$5(buildClientParams$1, "buildClientParams");
|
|
9998
9954
|
function buildRequestDataLine$1({ parser, zodSchemas, typeSchemas }) {
|
|
9999
9955
|
var _a2, _b;
|
|
10000
9956
|
if (parser === "zod" && ((_a2 = zodSchemas == null ? void 0 : zodSchemas.request) == null ? void 0 : _a2.name)) return `const requestData = ${zodSchemas.request.name}.parse(data)`;
|
|
10001
9957
|
if ((_b = typeSchemas == null ? void 0 : typeSchemas.request) == null ? void 0 : _b.name) return "const requestData = data";
|
|
10002
9958
|
return "";
|
|
10003
9959
|
}
|
|
10004
|
-
__name$
|
|
9960
|
+
__name$5(buildRequestDataLine$1, "buildRequestDataLine");
|
|
10005
9961
|
function buildFormDataLine$1(isFormData, hasRequest) {
|
|
10006
9962
|
return isFormData && hasRequest ? "const formData = buildFormData(requestData)" : "";
|
|
10007
9963
|
}
|
|
10008
|
-
__name$
|
|
9964
|
+
__name$5(buildFormDataLine$1, "buildFormDataLine");
|
|
10009
9965
|
function buildReturnStatement$1({ dataReturnType, parser, zodSchemas }) {
|
|
10010
9966
|
if (dataReturnType === "full" && parser === "zod" && zodSchemas) return `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`;
|
|
10011
9967
|
if (dataReturnType === "data" && parser === "zod" && zodSchemas) return `return ${zodSchemas.response.name}.parse(res.data)`;
|
|
10012
9968
|
if (dataReturnType === "full" && parser === "client") return "return res";
|
|
10013
9969
|
return "return res.data";
|
|
10014
9970
|
}
|
|
10015
|
-
__name$
|
|
9971
|
+
__name$5(buildReturnStatement$1, "buildReturnStatement");
|
|
10016
9972
|
function generateMethod$1({ operation, name, typeSchemas, zodSchemas, baseURL, dataReturnType, parser, paramsType, paramsCasing, pathParamsType }) {
|
|
10017
9973
|
var _a2, _b;
|
|
10018
9974
|
const path = new URLPath$7(operation.path, { casing: paramsCasing });
|
|
@@ -10059,7 +10015,7 @@ function generateMethod$1({ operation, name, typeSchemas, zodSchemas, baseURL, d
|
|
|
10059
10015
|
${methodBody}
|
|
10060
10016
|
}`;
|
|
10061
10017
|
}
|
|
10062
|
-
__name$
|
|
10018
|
+
__name$5(generateMethod$1, "generateMethod");
|
|
10063
10019
|
function ClassClient({ name, isExportable = true, isIndexable = true, operations, baseURL, dataReturnType, parser, paramsType, paramsCasing, pathParamsType, children }) {
|
|
10064
10020
|
const classCode = `export class ${name} {
|
|
10065
10021
|
#config: Partial<RequestConfig> & { client?: Client }
|
|
@@ -11436,157 +11392,6 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
11436
11392
|
})] });
|
|
11437
11393
|
}
|
|
11438
11394
|
|
|
11439
|
-
var __defProp$c = Object.defineProperty;
|
|
11440
|
-
var __name$5 = (target, value) => __defProp$c(target, "name", {
|
|
11441
|
-
value,
|
|
11442
|
-
configurable: true
|
|
11443
|
-
});
|
|
11444
|
-
|
|
11445
|
-
const builderTs = defineBuilder(() => ({
|
|
11446
|
-
name: "default",
|
|
11447
|
-
buildParams({ params, node, resolver }) {
|
|
11448
|
-
return createSchema({
|
|
11449
|
-
type: "object",
|
|
11450
|
-
properties: params.map((param) => createProperty({
|
|
11451
|
-
name: param.name,
|
|
11452
|
-
required: param.required,
|
|
11453
|
-
schema: createSchema({
|
|
11454
|
-
type: "ref",
|
|
11455
|
-
name: resolver.resolveParamName(node, param)
|
|
11456
|
-
})
|
|
11457
|
-
}))
|
|
11458
|
-
});
|
|
11459
|
-
},
|
|
11460
|
-
buildData({ node, resolver }) {
|
|
11461
|
-
var _a;
|
|
11462
|
-
const pathParams = node.parameters.filter((p) => p.in === "path");
|
|
11463
|
-
const queryParams = node.parameters.filter((p) => p.in === "query");
|
|
11464
|
-
const headerParams = node.parameters.filter((p) => p.in === "header");
|
|
11465
|
-
return createSchema({
|
|
11466
|
-
type: "object",
|
|
11467
|
-
deprecated: node.deprecated,
|
|
11468
|
-
properties: [
|
|
11469
|
-
createProperty({
|
|
11470
|
-
name: "data",
|
|
11471
|
-
schema: ((_a = node.requestBody) == null ? void 0 : _a.schema) ? createSchema({
|
|
11472
|
-
type: "ref",
|
|
11473
|
-
name: resolver.resolveDataTypedName(node),
|
|
11474
|
-
optional: true
|
|
11475
|
-
}) : createSchema({
|
|
11476
|
-
type: "never",
|
|
11477
|
-
optional: true
|
|
11478
|
-
})
|
|
11479
|
-
}),
|
|
11480
|
-
createProperty({
|
|
11481
|
-
name: "pathParams",
|
|
11482
|
-
required: pathParams.length > 0,
|
|
11483
|
-
schema: pathParams.length > 0 ? this.buildParams({
|
|
11484
|
-
params: pathParams,
|
|
11485
|
-
node,
|
|
11486
|
-
resolver
|
|
11487
|
-
}) : createSchema({ type: "never" })
|
|
11488
|
-
}),
|
|
11489
|
-
createProperty({
|
|
11490
|
-
name: "queryParams",
|
|
11491
|
-
schema: queryParams.length > 0 ? createSchema({
|
|
11492
|
-
...this.buildParams({
|
|
11493
|
-
params: queryParams,
|
|
11494
|
-
node,
|
|
11495
|
-
resolver
|
|
11496
|
-
}),
|
|
11497
|
-
optional: true
|
|
11498
|
-
}) : createSchema({
|
|
11499
|
-
type: "never",
|
|
11500
|
-
optional: true
|
|
11501
|
-
})
|
|
11502
|
-
}),
|
|
11503
|
-
createProperty({
|
|
11504
|
-
name: "headerParams",
|
|
11505
|
-
schema: headerParams.length > 0 ? createSchema({
|
|
11506
|
-
...this.buildParams({
|
|
11507
|
-
params: headerParams,
|
|
11508
|
-
node,
|
|
11509
|
-
resolver
|
|
11510
|
-
}),
|
|
11511
|
-
optional: true
|
|
11512
|
-
}) : createSchema({
|
|
11513
|
-
type: "never",
|
|
11514
|
-
optional: true
|
|
11515
|
-
})
|
|
11516
|
-
}),
|
|
11517
|
-
createProperty({
|
|
11518
|
-
name: "url",
|
|
11519
|
-
required: true,
|
|
11520
|
-
schema: createSchema({
|
|
11521
|
-
type: "url",
|
|
11522
|
-
path: node.path
|
|
11523
|
-
})
|
|
11524
|
-
})
|
|
11525
|
-
]
|
|
11526
|
-
});
|
|
11527
|
-
},
|
|
11528
|
-
buildResponses({ node, resolver }) {
|
|
11529
|
-
if (node.responses.length === 0) return null;
|
|
11530
|
-
return createSchema({
|
|
11531
|
-
type: "object",
|
|
11532
|
-
properties: node.responses.map((res) => createProperty({
|
|
11533
|
-
name: String(res.statusCode),
|
|
11534
|
-
required: true,
|
|
11535
|
-
schema: createSchema({
|
|
11536
|
-
type: "ref",
|
|
11537
|
-
name: resolver.resolveResponseStatusTypedName(node, res.statusCode)
|
|
11538
|
-
})
|
|
11539
|
-
}))
|
|
11540
|
-
});
|
|
11541
|
-
},
|
|
11542
|
-
buildResponseUnion({ node, resolver }) {
|
|
11543
|
-
const responsesWithSchema = node.responses.filter((res) => res.schema);
|
|
11544
|
-
if (responsesWithSchema.length === 0) return null;
|
|
11545
|
-
return createSchema({
|
|
11546
|
-
type: "union",
|
|
11547
|
-
members: responsesWithSchema.map((res) => createSchema({
|
|
11548
|
-
type: "ref",
|
|
11549
|
-
name: resolver.resolveResponseStatusTypedName(node, res.statusCode)
|
|
11550
|
-
}))
|
|
11551
|
-
});
|
|
11552
|
-
}
|
|
11553
|
-
}));
|
|
11554
|
-
|
|
11555
|
-
function toCamelOrPascal$a(text, pascal) {
|
|
11556
|
-
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
11557
|
-
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
11558
|
-
if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
11559
|
-
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
11560
|
-
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
11561
|
-
}
|
|
11562
|
-
function applyToFileParts$a(text, transformPart) {
|
|
11563
|
-
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
11564
|
-
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
11565
|
-
}
|
|
11566
|
-
function camelCase$a(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
11567
|
-
if (isFile) return applyToFileParts$a(text, (part, isLast) => camelCase$a(part, isLast ? {
|
|
11568
|
-
prefix,
|
|
11569
|
-
suffix
|
|
11570
|
-
} : {}));
|
|
11571
|
-
return toCamelOrPascal$a(`${prefix} ${text} ${suffix}`, false);
|
|
11572
|
-
}
|
|
11573
|
-
function pascalCase$6(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
11574
|
-
if (isFile) return applyToFileParts$a(text, (part, isLast) => isLast ? pascalCase$6(part, {
|
|
11575
|
-
prefix,
|
|
11576
|
-
suffix
|
|
11577
|
-
}) : camelCase$a(part));
|
|
11578
|
-
return toCamelOrPascal$a(`${prefix} ${text} ${suffix}`, true);
|
|
11579
|
-
}
|
|
11580
|
-
function snakeCase(text, { prefix = "", suffix = "" } = {}) {
|
|
11581
|
-
return `${prefix} ${text} ${suffix}`.trim().replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s\-.]+/g, "_").replace(/[^a-zA-Z0-9_]/g, "").toLowerCase().split("_").filter(Boolean).join("_");
|
|
11582
|
-
}
|
|
11583
|
-
function screamingSnakeCase(text, { prefix = "", suffix = "" } = {}) {
|
|
11584
|
-
return snakeCase(text, {
|
|
11585
|
-
prefix,
|
|
11586
|
-
suffix
|
|
11587
|
-
}).toUpperCase();
|
|
11588
|
-
}
|
|
11589
|
-
|
|
11590
11395
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : "undefined" !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
11591
11396
|
|
|
11592
11397
|
function getDefaultExportFromCjs (x) {
|
|
@@ -209471,6 +209276,40 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
209471
209276
|
var typescriptExports = typescript.exports;
|
|
209472
209277
|
const ts = /*@__PURE__*/getDefaultExportFromCjs(typescriptExports);
|
|
209473
209278
|
|
|
209279
|
+
function toCamelOrPascal$a(text, pascal) {
|
|
209280
|
+
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
209281
|
+
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
209282
|
+
if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
|
|
209283
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
209284
|
+
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
209285
|
+
}
|
|
209286
|
+
function applyToFileParts$a(text, transformPart) {
|
|
209287
|
+
const parts = text.split(/\.(?=[a-zA-Z])/);
|
|
209288
|
+
return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
|
|
209289
|
+
}
|
|
209290
|
+
function camelCase$a(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
209291
|
+
if (isFile) return applyToFileParts$a(text, (part, isLast) => camelCase$a(part, isLast ? {
|
|
209292
|
+
prefix,
|
|
209293
|
+
suffix
|
|
209294
|
+
} : {}));
|
|
209295
|
+
return toCamelOrPascal$a(`${prefix} ${text} ${suffix}`, false);
|
|
209296
|
+
}
|
|
209297
|
+
function pascalCase$6(text, { isFile, prefix = "", suffix = "" } = {}) {
|
|
209298
|
+
if (isFile) return applyToFileParts$a(text, (part, isLast) => isLast ? pascalCase$6(part, {
|
|
209299
|
+
prefix,
|
|
209300
|
+
suffix
|
|
209301
|
+
}) : camelCase$a(part));
|
|
209302
|
+
return toCamelOrPascal$a(`${prefix} ${text} ${suffix}`, true);
|
|
209303
|
+
}
|
|
209304
|
+
function snakeCase(text, { prefix = "", suffix = "" } = {}) {
|
|
209305
|
+
return `${prefix} ${text} ${suffix}`.trim().replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s\-.]+/g, "_").replace(/[^a-zA-Z0-9_]/g, "").toLowerCase().split("_").filter(Boolean).join("_");
|
|
209306
|
+
}
|
|
209307
|
+
function screamingSnakeCase(text, { prefix = "", suffix = "" } = {}) {
|
|
209308
|
+
return snakeCase(text, {
|
|
209309
|
+
prefix,
|
|
209310
|
+
suffix
|
|
209311
|
+
}).toUpperCase();
|
|
209312
|
+
}
|
|
209474
209313
|
function trimQuotes$1(text) {
|
|
209475
209314
|
if (text.length >= 2) {
|
|
209476
209315
|
const first = text[0];
|
|
@@ -209682,8 +209521,8 @@ const keywordTypeNodes = {
|
|
|
209682
209521
|
null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),
|
|
209683
209522
|
never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword)
|
|
209684
209523
|
};
|
|
209685
|
-
function createUrlTemplateType(
|
|
209686
|
-
const normalized =
|
|
209524
|
+
function createUrlTemplateType(path2) {
|
|
209525
|
+
const normalized = path2.replace(/:([^/]+)/g, "{$1}");
|
|
209687
209526
|
if (!normalized.includes("{")) return factory.createLiteralTypeNode(factory.createStringLiteral(normalized));
|
|
209688
209527
|
const segments = normalized.split(/(\{[^}]+\})/);
|
|
209689
209528
|
const parts = [];
|
|
@@ -209721,6 +209560,43 @@ const createFalse = factory.createFalse;
|
|
|
209721
209560
|
factory.createIndexedAccessTypeNode;
|
|
209722
209561
|
factory.createTypeOperatorNode;
|
|
209723
209562
|
const createPrefixUnaryExpression = factory.createPrefixUnaryExpression;
|
|
209563
|
+
function getEnumNames({ node, enumType, enumTypeSuffix, resolver }) {
|
|
209564
|
+
const resolved = resolver.default(node.name, "type");
|
|
209565
|
+
return {
|
|
209566
|
+
enumName: enumType === "asPascalConst" ? resolved : camelCase$a(node.name),
|
|
209567
|
+
typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyName(node, enumTypeSuffix) : resolved,
|
|
209568
|
+
refName: resolved
|
|
209569
|
+
};
|
|
209570
|
+
}
|
|
209571
|
+
function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
|
|
209572
|
+
var _a, _b, _c, _d;
|
|
209573
|
+
const { enumName, typeName } = getEnumNames({
|
|
209574
|
+
node,
|
|
209575
|
+
enumType,
|
|
209576
|
+
enumTypeSuffix,
|
|
209577
|
+
resolver
|
|
209578
|
+
});
|
|
209579
|
+
const [nameNode, typeNode] = createEnumDeclaration({
|
|
209580
|
+
name: enumName,
|
|
209581
|
+
typeName,
|
|
209582
|
+
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 : [],
|
|
209583
|
+
type: enumType,
|
|
209584
|
+
enumKeyCasing
|
|
209585
|
+
});
|
|
209586
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [nameNode && /* @__PURE__ */ jsx(File.Source, {
|
|
209587
|
+
name: enumName,
|
|
209588
|
+
isExportable: true,
|
|
209589
|
+
isIndexable: true,
|
|
209590
|
+
isTypeOnly: false,
|
|
209591
|
+
children: safePrint(nameNode)
|
|
209592
|
+
}), /* @__PURE__ */ jsx(File.Source, {
|
|
209593
|
+
name: typeName,
|
|
209594
|
+
isIndexable: true,
|
|
209595
|
+
isExportable: ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
|
|
209596
|
+
isTypeOnly: ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
|
|
209597
|
+
children: safePrint(typeNode)
|
|
209598
|
+
})] });
|
|
209599
|
+
}
|
|
209724
209600
|
function constToTypeNode(value, format) {
|
|
209725
209601
|
if (format === "boolean") return createLiteralTypeNode(value === true ? createTrue() : createFalse());
|
|
209726
209602
|
if (format === "number" && typeof value === "number") {
|
|
@@ -209824,8 +209700,7 @@ const printerTs = definePrinter((options) => {
|
|
|
209824
209700
|
withParentheses: true,
|
|
209825
209701
|
nodes: values.filter((v) => v !== null).map((value) => constToTypeNode(value, typeof value)).filter(Boolean)
|
|
209826
209702
|
})) != null ? _d : void 0;
|
|
209827
|
-
|
|
209828
|
-
return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) ? `${resolvedName}Key` : resolvedName, void 0);
|
|
209703
|
+
return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix ? this.options.resolver.resolveEnumKeyName(node, this.options.enumTypeSuffix) : this.options.resolver.default(node.name, "type"), void 0);
|
|
209829
209704
|
},
|
|
209830
209705
|
union(node) {
|
|
209831
209706
|
var _a, _b, _c;
|
|
@@ -209868,11 +209743,11 @@ const printerTs = definePrinter((options) => {
|
|
|
209868
209743
|
return buildTupleNode(node, this.transform);
|
|
209869
209744
|
},
|
|
209870
209745
|
object(node) {
|
|
209871
|
-
const { transform, options: options2 } = this;
|
|
209746
|
+
const { transform: transform2, options: options2 } = this;
|
|
209872
209747
|
const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options2.optionalType);
|
|
209873
209748
|
const propertyNodes = node.properties.map((prop) => {
|
|
209874
209749
|
var _a;
|
|
209875
|
-
const baseType = (_a =
|
|
209750
|
+
const baseType = (_a = transform2(prop.schema)) != null ? _a : keywordTypeNodes.unknown;
|
|
209876
209751
|
const type = buildPropertyType(prop.schema, baseType, options2.optionalType);
|
|
209877
209752
|
return appendJSDocToNode({
|
|
209878
209753
|
node: createPropertySignature({
|
|
@@ -209884,7 +209759,7 @@ const printerTs = definePrinter((options) => {
|
|
|
209884
209759
|
comments: buildPropertyJSDocComments(prop.schema)
|
|
209885
209760
|
});
|
|
209886
209761
|
});
|
|
209887
|
-
const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length,
|
|
209762
|
+
const allElements = [...propertyNodes, ...buildIndexSignatures(node, propertyNodes.length, transform2)];
|
|
209888
209763
|
if (!allElements.length) return keywordTypeNodes.object;
|
|
209889
209764
|
return createTypeLiteralNode(allElements);
|
|
209890
209765
|
}
|
|
@@ -209894,11 +209769,11 @@ const printerTs = definePrinter((options) => {
|
|
|
209894
209769
|
if (!type) return null;
|
|
209895
209770
|
if (node.nullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
|
|
209896
209771
|
if ((node.nullish || node.optional) && addsUndefined) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
|
|
209897
|
-
const {
|
|
209898
|
-
if (!
|
|
209772
|
+
const { name, syntaxType = "type", description, keysToOmit } = this.options;
|
|
209773
|
+
if (!name) return safePrint(type);
|
|
209899
209774
|
const useTypeGeneration = syntaxType === "type" || type.kind === syntaxKind.union || !!(keysToOmit == null ? void 0 : keysToOmit.length);
|
|
209900
209775
|
return safePrint(createTypeDeclaration({
|
|
209901
|
-
name
|
|
209776
|
+
name,
|
|
209902
209777
|
isExportable: true,
|
|
209903
209778
|
type: (keysToOmit == null ? void 0 : keysToOmit.length) ? createOmitDeclaration({
|
|
209904
209779
|
keys: keysToOmit,
|
|
@@ -209920,55 +209795,7 @@ const printerTs = definePrinter((options) => {
|
|
|
209920
209795
|
}
|
|
209921
209796
|
};
|
|
209922
209797
|
});
|
|
209923
|
-
|
|
209924
|
-
function getEnumNames({ node, enumType, resolver }) {
|
|
209925
|
-
const resolved = resolver.default(node.name, "type");
|
|
209926
|
-
return {
|
|
209927
|
-
enumName: enumType === "asPascalConst" ? resolved : camelCase$a(node.name),
|
|
209928
|
-
typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? `${resolved}Key` : resolved,
|
|
209929
|
-
refName: resolved
|
|
209930
|
-
};
|
|
209931
|
-
}
|
|
209932
|
-
function Enum({ node, enumType, enumKeyCasing, resolver }) {
|
|
209933
|
-
var _a, _b, _c, _d;
|
|
209934
|
-
const { enumName, typeName, refName } = getEnumNames({
|
|
209935
|
-
node,
|
|
209936
|
-
enumType,
|
|
209937
|
-
resolver
|
|
209938
|
-
});
|
|
209939
|
-
const [nameNode, typeNode] = createEnumDeclaration({
|
|
209940
|
-
name: enumName,
|
|
209941
|
-
typeName,
|
|
209942
|
-
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 : [],
|
|
209943
|
-
type: enumType,
|
|
209944
|
-
enumKeyCasing
|
|
209945
|
-
});
|
|
209946
|
-
const needsRefAlias = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName;
|
|
209947
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
209948
|
-
nameNode && /* @__PURE__ */ jsx(File.Source, {
|
|
209949
|
-
name: enumName,
|
|
209950
|
-
isExportable: true,
|
|
209951
|
-
isIndexable: true,
|
|
209952
|
-
isTypeOnly: false,
|
|
209953
|
-
children: safePrint(nameNode)
|
|
209954
|
-
}),
|
|
209955
|
-
/* @__PURE__ */ jsx(File.Source, {
|
|
209956
|
-
name: typeName,
|
|
209957
|
-
isIndexable: true,
|
|
209958
|
-
isExportable: ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
|
|
209959
|
-
isTypeOnly: ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
|
|
209960
|
-
children: safePrint(typeNode)
|
|
209961
|
-
}),
|
|
209962
|
-
needsRefAlias && /* @__PURE__ */ jsx(File.Source, {
|
|
209963
|
-
name: refName,
|
|
209964
|
-
isExportable: true,
|
|
209965
|
-
isIndexable: true,
|
|
209966
|
-
isTypeOnly: true,
|
|
209967
|
-
children: `export type ${refName} = ${typeName}`
|
|
209968
|
-
})
|
|
209969
|
-
] });
|
|
209970
|
-
}
|
|
209971
|
-
function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description, resolver }) {
|
|
209798
|
+
function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver }) {
|
|
209972
209799
|
const resolvedDescription = description || (node == null ? void 0 : node.description);
|
|
209973
209800
|
const enumSchemaNodes = collect(node, { schema(n) {
|
|
209974
209801
|
const enumNode = narrowSchema(n, schemaTypes.enum);
|
|
@@ -209978,7 +209805,8 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
|
|
|
209978
209805
|
optionalType,
|
|
209979
209806
|
arrayType,
|
|
209980
209807
|
enumType,
|
|
209981
|
-
|
|
209808
|
+
enumTypeSuffix,
|
|
209809
|
+
name,
|
|
209982
209810
|
syntaxType,
|
|
209983
209811
|
description: resolvedDescription,
|
|
209984
209812
|
keysToOmit,
|
|
@@ -209991,6 +209819,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
|
|
|
209991
209819
|
...getEnumNames({
|
|
209992
209820
|
node: node2,
|
|
209993
209821
|
enumType,
|
|
209822
|
+
enumTypeSuffix,
|
|
209994
209823
|
resolver
|
|
209995
209824
|
})
|
|
209996
209825
|
};
|
|
@@ -210000,159 +209829,129 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
|
|
|
210000
209829
|
return /* @__PURE__ */ jsxs(Fragment, { children: [shouldExportEnums && enums.map(({ node: node2 }) => /* @__PURE__ */ jsx(Enum, {
|
|
210001
209830
|
node: node2,
|
|
210002
209831
|
enumType,
|
|
209832
|
+
enumTypeSuffix,
|
|
210003
209833
|
enumKeyCasing,
|
|
210004
209834
|
resolver
|
|
210005
209835
|
})), shouldExportType && /* @__PURE__ */ jsx(File.Source, {
|
|
210006
|
-
name
|
|
209836
|
+
name,
|
|
210007
209837
|
isTypeOnly: true,
|
|
210008
209838
|
isExportable: true,
|
|
210009
209839
|
isIndexable: true,
|
|
210010
209840
|
children: output
|
|
210011
209841
|
})] });
|
|
210012
209842
|
}
|
|
210013
|
-
|
|
210014
|
-
|
|
210015
|
-
|
|
209843
|
+
function buildParams({ params, node, resolver }) {
|
|
209844
|
+
return createSchema({
|
|
209845
|
+
type: "object",
|
|
209846
|
+
properties: params.map((param) => createProperty({
|
|
209847
|
+
name: param.name,
|
|
209848
|
+
required: param.required,
|
|
209849
|
+
schema: createSchema({
|
|
209850
|
+
type: "ref",
|
|
209851
|
+
name: resolver.resolveParamName(node, param)
|
|
209852
|
+
})
|
|
209853
|
+
}))
|
|
209854
|
+
});
|
|
209855
|
+
}
|
|
209856
|
+
function buildData({ node, resolver }) {
|
|
209857
|
+
var _a;
|
|
209858
|
+
const pathParams = node.parameters.filter((p) => p.in === "path");
|
|
209859
|
+
const queryParams = node.parameters.filter((p) => p.in === "query");
|
|
209860
|
+
const headerParams = node.parameters.filter((p) => p.in === "header");
|
|
209861
|
+
return createSchema({
|
|
209862
|
+
type: "object",
|
|
209863
|
+
deprecated: node.deprecated,
|
|
209864
|
+
properties: [
|
|
209865
|
+
createProperty({
|
|
209866
|
+
name: "data",
|
|
209867
|
+
schema: ((_a = node.requestBody) == null ? void 0 : _a.schema) ? createSchema({
|
|
209868
|
+
type: "ref",
|
|
209869
|
+
name: resolver.resolveDataName(node),
|
|
209870
|
+
optional: true
|
|
209871
|
+
}) : createSchema({
|
|
209872
|
+
type: "never",
|
|
209873
|
+
optional: true
|
|
209874
|
+
})
|
|
209875
|
+
}),
|
|
209876
|
+
createProperty({
|
|
209877
|
+
name: "pathParams",
|
|
209878
|
+
required: pathParams.length > 0,
|
|
209879
|
+
schema: pathParams.length > 0 ? buildParams({
|
|
209880
|
+
params: pathParams,
|
|
209881
|
+
node,
|
|
209882
|
+
resolver
|
|
209883
|
+
}) : createSchema({ type: "never" })
|
|
209884
|
+
}),
|
|
209885
|
+
createProperty({
|
|
209886
|
+
name: "queryParams",
|
|
209887
|
+
schema: queryParams.length > 0 ? createSchema({
|
|
209888
|
+
...buildParams({
|
|
209889
|
+
params: queryParams,
|
|
209890
|
+
node,
|
|
209891
|
+
resolver
|
|
209892
|
+
}),
|
|
209893
|
+
optional: true
|
|
209894
|
+
}) : createSchema({
|
|
209895
|
+
type: "never",
|
|
209896
|
+
optional: true
|
|
209897
|
+
})
|
|
209898
|
+
}),
|
|
209899
|
+
createProperty({
|
|
209900
|
+
name: "headerParams",
|
|
209901
|
+
schema: headerParams.length > 0 ? createSchema({
|
|
209902
|
+
...buildParams({
|
|
209903
|
+
params: headerParams,
|
|
209904
|
+
node,
|
|
209905
|
+
resolver
|
|
209906
|
+
}),
|
|
209907
|
+
optional: true
|
|
209908
|
+
}) : createSchema({
|
|
209909
|
+
type: "never",
|
|
209910
|
+
optional: true
|
|
209911
|
+
})
|
|
209912
|
+
}),
|
|
209913
|
+
createProperty({
|
|
209914
|
+
name: "url",
|
|
209915
|
+
required: true,
|
|
209916
|
+
schema: createSchema({
|
|
209917
|
+
type: "url",
|
|
209918
|
+
path: node.path
|
|
209919
|
+
})
|
|
209920
|
+
})
|
|
209921
|
+
]
|
|
209922
|
+
});
|
|
209923
|
+
}
|
|
209924
|
+
function buildResponses({ node, resolver }) {
|
|
209925
|
+
if (node.responses.length === 0) return null;
|
|
209926
|
+
return createSchema({
|
|
209927
|
+
type: "object",
|
|
209928
|
+
properties: node.responses.map((res) => createProperty({
|
|
209929
|
+
name: String(res.statusCode),
|
|
209930
|
+
required: true,
|
|
209931
|
+
schema: createSchema({
|
|
209932
|
+
type: "ref",
|
|
209933
|
+
name: resolver.resolveResponseStatusName(node, res.statusCode)
|
|
209934
|
+
})
|
|
209935
|
+
}))
|
|
209936
|
+
});
|
|
209937
|
+
}
|
|
209938
|
+
function buildResponseUnion({ node, resolver }) {
|
|
209939
|
+
const responsesWithSchema = node.responses.filter((res) => res.schema);
|
|
209940
|
+
if (responsesWithSchema.length === 0) return null;
|
|
209941
|
+
return createSchema({
|
|
209942
|
+
type: "union",
|
|
209943
|
+
members: responsesWithSchema.map((res) => createSchema({
|
|
209944
|
+
type: "ref",
|
|
209945
|
+
name: resolver.resolveResponseStatusName(node, res.statusCode)
|
|
209946
|
+
}))
|
|
209947
|
+
});
|
|
210016
209948
|
}
|
|
210017
|
-
const resolverTs = defineResolver(() => {
|
|
210018
|
-
return {
|
|
210019
|
-
name: "default",
|
|
210020
|
-
pluginName: "plugin-ts",
|
|
210021
|
-
default(name, type) {
|
|
210022
|
-
return resolveName(name, type);
|
|
210023
|
-
},
|
|
210024
|
-
resolveName(name) {
|
|
210025
|
-
return this.default(name, "function");
|
|
210026
|
-
},
|
|
210027
|
-
resolveTypedName(name) {
|
|
210028
|
-
return this.default(name, "type");
|
|
210029
|
-
},
|
|
210030
|
-
resolvePathName(name, type) {
|
|
210031
|
-
return this.default(name, type);
|
|
210032
|
-
},
|
|
210033
|
-
resolveParamName(node, param) {
|
|
210034
|
-
return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
210035
|
-
},
|
|
210036
|
-
resolveParamTypedName(node, param) {
|
|
210037
|
-
return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
210038
|
-
},
|
|
210039
|
-
resolveResponseStatusName(node, statusCode) {
|
|
210040
|
-
return this.resolveName(`${node.operationId} Status ${statusCode}`);
|
|
210041
|
-
},
|
|
210042
|
-
resolveResponseStatusTypedName(node, statusCode) {
|
|
210043
|
-
return this.resolveTypedName(`${node.operationId} Status ${statusCode}`);
|
|
210044
|
-
},
|
|
210045
|
-
resolveDataName(node) {
|
|
210046
|
-
return this.resolveName(`${node.operationId} Data`);
|
|
210047
|
-
},
|
|
210048
|
-
resolveDataTypedName(node) {
|
|
210049
|
-
return this.resolveTypedName(`${node.operationId} Data`);
|
|
210050
|
-
},
|
|
210051
|
-
resolveRequestConfigName(node) {
|
|
210052
|
-
return this.resolveName(`${node.operationId} RequestConfig`);
|
|
210053
|
-
},
|
|
210054
|
-
resolveRequestConfigTypedName(node) {
|
|
210055
|
-
return this.resolveTypedName(`${node.operationId} RequestConfig`);
|
|
210056
|
-
},
|
|
210057
|
-
resolveResponsesName(node) {
|
|
210058
|
-
return this.resolveName(`${node.operationId} Responses`);
|
|
210059
|
-
},
|
|
210060
|
-
resolveResponsesTypedName(node) {
|
|
210061
|
-
return this.resolveTypedName(`${node.operationId} Responses`);
|
|
210062
|
-
},
|
|
210063
|
-
resolveResponseName(node) {
|
|
210064
|
-
return this.resolveName(`${node.operationId} Response`);
|
|
210065
|
-
},
|
|
210066
|
-
resolveResponseTypedName(node) {
|
|
210067
|
-
return this.resolveTypedName(`${node.operationId} Response`);
|
|
210068
|
-
},
|
|
210069
|
-
resolveEnumKeyTypedName(node) {
|
|
210070
|
-
var _a;
|
|
210071
|
-
return `${this.resolveTypedName((_a = node.name) != null ? _a : "")}Key`;
|
|
210072
|
-
},
|
|
210073
|
-
resolvePathParamsName(_node) {
|
|
210074
|
-
throw new Error("resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.");
|
|
210075
|
-
},
|
|
210076
|
-
resolvePathParamsTypedName(_node) {
|
|
210077
|
-
throw new Error("resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.");
|
|
210078
|
-
},
|
|
210079
|
-
resolveQueryParamsName(_node) {
|
|
210080
|
-
throw new Error("resolveQueryParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.");
|
|
210081
|
-
},
|
|
210082
|
-
resolveQueryParamsTypedName(_node) {
|
|
210083
|
-
throw new Error("resolveQueryParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.");
|
|
210084
|
-
},
|
|
210085
|
-
resolveHeaderParamsName(_node) {
|
|
210086
|
-
throw new Error("resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.");
|
|
210087
|
-
},
|
|
210088
|
-
resolveHeaderParamsTypedName(_node) {
|
|
210089
|
-
throw new Error("resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.");
|
|
210090
|
-
}
|
|
210091
|
-
};
|
|
210092
|
-
});
|
|
210093
|
-
const resolverTsLegacy = defineResolver(() => {
|
|
210094
|
-
return {
|
|
210095
|
-
...resolverTs,
|
|
210096
|
-
pluginName: "plugin-ts",
|
|
210097
|
-
resolveResponseStatusName(node, statusCode) {
|
|
210098
|
-
if (statusCode === "default") return this.resolveName(`${node.operationId} Error`);
|
|
210099
|
-
return this.resolveName(`${node.operationId} ${statusCode}`);
|
|
210100
|
-
},
|
|
210101
|
-
resolveResponseStatusTypedName(node, statusCode) {
|
|
210102
|
-
if (statusCode === "default") return this.resolveTypedName(`${node.operationId} Error`);
|
|
210103
|
-
return this.resolveTypedName(`${node.operationId} ${statusCode}`);
|
|
210104
|
-
},
|
|
210105
|
-
resolveDataName(node) {
|
|
210106
|
-
const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
|
|
210107
|
-
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
210108
|
-
},
|
|
210109
|
-
resolveDataTypedName(node) {
|
|
210110
|
-
const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
|
|
210111
|
-
return this.resolveTypedName(`${node.operationId} ${suffix}`);
|
|
210112
|
-
},
|
|
210113
|
-
resolveResponsesName(node) {
|
|
210114
|
-
const suffix = node.method === "GET" ? "Query" : "Mutation";
|
|
210115
|
-
return `${this.default(node.operationId, "function")}${suffix}`;
|
|
210116
|
-
},
|
|
210117
|
-
resolveResponsesTypedName(node) {
|
|
210118
|
-
const suffix = node.method === "GET" ? "Query" : "Mutation";
|
|
210119
|
-
return `${this.default(node.operationId, "type")}${suffix}`;
|
|
210120
|
-
},
|
|
210121
|
-
resolveResponseName(node) {
|
|
210122
|
-
const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
|
|
210123
|
-
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
210124
|
-
},
|
|
210125
|
-
resolveResponseTypedName(node) {
|
|
210126
|
-
const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
|
|
210127
|
-
return this.resolveTypedName(`${node.operationId} ${suffix}`);
|
|
210128
|
-
},
|
|
210129
|
-
resolvePathParamsName(node) {
|
|
210130
|
-
return this.resolveName(`${node.operationId} PathParams`);
|
|
210131
|
-
},
|
|
210132
|
-
resolvePathParamsTypedName(node) {
|
|
210133
|
-
return this.resolveTypedName(`${node.operationId} PathParams`);
|
|
210134
|
-
},
|
|
210135
|
-
resolveQueryParamsName(node) {
|
|
210136
|
-
return this.resolveName(`${node.operationId} QueryParams`);
|
|
210137
|
-
},
|
|
210138
|
-
resolveQueryParamsTypedName(node) {
|
|
210139
|
-
return this.resolveTypedName(`${node.operationId} QueryParams`);
|
|
210140
|
-
},
|
|
210141
|
-
resolveHeaderParamsName(node) {
|
|
210142
|
-
return this.resolveName(`${node.operationId} HeaderParams`);
|
|
210143
|
-
},
|
|
210144
|
-
resolveHeaderParamsTypedName(node) {
|
|
210145
|
-
return this.resolveTypedName(`${node.operationId} HeaderParams`);
|
|
210146
|
-
}
|
|
210147
|
-
};
|
|
210148
|
-
});
|
|
210149
|
-
|
|
210150
209949
|
const typeGenerator = defineGenerator({
|
|
210151
209950
|
name: "typescript",
|
|
210152
209951
|
type: "react",
|
|
210153
|
-
Operation({ node, adapter, options, config }) {
|
|
209952
|
+
Operation({ node, adapter, options, config, resolver }) {
|
|
210154
209953
|
var _a, _b, _c;
|
|
210155
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output,
|
|
209954
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, transformers = [] } = options;
|
|
210156
209955
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210157
209956
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210158
209957
|
const file = resolver.resolveFile({
|
|
@@ -210166,7 +209965,7 @@ const typeGenerator = defineGenerator({
|
|
|
210166
209965
|
group
|
|
210167
209966
|
});
|
|
210168
209967
|
const params = caseParams(node.parameters, paramsCasing);
|
|
210169
|
-
function renderSchemaType({ node: schemaNode, name,
|
|
209968
|
+
function renderSchemaType({ node: schemaNode, name, description, keysToOmit }) {
|
|
210170
209969
|
if (!schemaNode) return null;
|
|
210171
209970
|
const transformedNode = transform(schemaNode, composeTransformers(...transformers));
|
|
210172
209971
|
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
@@ -210191,10 +209990,10 @@ const typeGenerator = defineGenerator({
|
|
|
210191
209990
|
imp.isTypeOnly
|
|
210192
209991
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210193
209992
|
name,
|
|
210194
|
-
typedName,
|
|
210195
209993
|
node: transformedNode,
|
|
210196
209994
|
description,
|
|
210197
209995
|
enumType,
|
|
209996
|
+
enumTypeSuffix,
|
|
210198
209997
|
enumKeyCasing,
|
|
210199
209998
|
optionalType,
|
|
210200
209999
|
arrayType,
|
|
@@ -210205,49 +210004,43 @@ const typeGenerator = defineGenerator({
|
|
|
210205
210004
|
}
|
|
210206
210005
|
const paramTypes = params.map((param) => renderSchemaType({
|
|
210207
210006
|
node: param.schema,
|
|
210208
|
-
name: resolver.resolveParamName(node, param)
|
|
210209
|
-
typedName: resolver.resolveParamTypedName(node, param)
|
|
210007
|
+
name: resolver.resolveParamName(node, param)
|
|
210210
210008
|
}));
|
|
210211
210009
|
const requestType = ((_b = node.requestBody) == null ? void 0 : _b.schema) ? renderSchemaType({
|
|
210212
210010
|
node: node.requestBody.schema,
|
|
210213
210011
|
name: resolver.resolveDataName(node),
|
|
210214
|
-
typedName: resolver.resolveDataTypedName(node),
|
|
210215
210012
|
description: (_c = node.requestBody.description) != null ? _c : node.requestBody.schema.description,
|
|
210216
210013
|
keysToOmit: node.requestBody.keysToOmit
|
|
210217
210014
|
}) : null;
|
|
210218
210015
|
const responseTypes = node.responses.map((res) => renderSchemaType({
|
|
210219
210016
|
node: res.schema,
|
|
210220
210017
|
name: resolver.resolveResponseStatusName(node, res.statusCode),
|
|
210221
|
-
typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),
|
|
210222
210018
|
description: res.description,
|
|
210223
210019
|
keysToOmit: res.keysToOmit
|
|
210224
210020
|
}));
|
|
210225
210021
|
const dataType = renderSchemaType({
|
|
210226
|
-
node:
|
|
210022
|
+
node: buildData({
|
|
210227
210023
|
node: {
|
|
210228
210024
|
...node,
|
|
210229
210025
|
parameters: params
|
|
210230
210026
|
},
|
|
210231
210027
|
resolver
|
|
210232
210028
|
}),
|
|
210233
|
-
name: resolver.resolveRequestConfigName(node)
|
|
210234
|
-
typedName: resolver.resolveRequestConfigTypedName(node)
|
|
210029
|
+
name: resolver.resolveRequestConfigName(node)
|
|
210235
210030
|
});
|
|
210236
210031
|
const responsesType = renderSchemaType({
|
|
210237
|
-
node:
|
|
210032
|
+
node: buildResponses({
|
|
210238
210033
|
node,
|
|
210239
210034
|
resolver
|
|
210240
210035
|
}),
|
|
210241
|
-
name: resolver.resolveResponsesName(node)
|
|
210242
|
-
typedName: resolver.resolveResponsesTypedName(node)
|
|
210036
|
+
name: resolver.resolveResponsesName(node)
|
|
210243
210037
|
});
|
|
210244
210038
|
const responseType = renderSchemaType({
|
|
210245
|
-
node:
|
|
210039
|
+
node: buildResponseUnion({
|
|
210246
210040
|
node,
|
|
210247
210041
|
resolver
|
|
210248
210042
|
}),
|
|
210249
210043
|
name: resolver.resolveResponseName(node),
|
|
210250
|
-
typedName: resolver.resolveResponseTypedName(node),
|
|
210251
210044
|
description: "Union of all possible responses"
|
|
210252
210045
|
});
|
|
210253
210046
|
return /* @__PURE__ */ jsxs(File, {
|
|
@@ -210272,8 +210065,8 @@ const typeGenerator = defineGenerator({
|
|
|
210272
210065
|
]
|
|
210273
210066
|
});
|
|
210274
210067
|
},
|
|
210275
|
-
Schema({ node, adapter, options, config }) {
|
|
210276
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group,
|
|
210068
|
+
Schema({ node, adapter, options, config, resolver }) {
|
|
210069
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, transformers = [] } = options;
|
|
210277
210070
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210278
210071
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210279
210072
|
if (!node.name) return;
|
|
@@ -210290,10 +210083,8 @@ const typeGenerator = defineGenerator({
|
|
|
210290
210083
|
}).path
|
|
210291
210084
|
}));
|
|
210292
210085
|
const isEnumSchema = !!narrowSchema(node, schemaTypes.enum);
|
|
210293
|
-
const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name);
|
|
210294
210086
|
const type = {
|
|
210295
|
-
name: resolver.resolveName(node.name),
|
|
210296
|
-
typedName,
|
|
210087
|
+
name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(node, enumTypeSuffix) : resolver.resolveName(node.name),
|
|
210297
210088
|
file: resolver.resolveFile({
|
|
210298
210089
|
name: node.name,
|
|
210299
210090
|
extname: ".ts"
|
|
@@ -210326,9 +210117,9 @@ const typeGenerator = defineGenerator({
|
|
|
210326
210117
|
imp.isTypeOnly
|
|
210327
210118
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210328
210119
|
name: type.name,
|
|
210329
|
-
typedName: type.typedName,
|
|
210330
210120
|
node: transformedNode,
|
|
210331
210121
|
enumType,
|
|
210122
|
+
enumTypeSuffix,
|
|
210332
210123
|
enumKeyCasing,
|
|
210333
210124
|
optionalType,
|
|
210334
210125
|
arrayType,
|
|
@@ -210338,6 +210129,86 @@ const typeGenerator = defineGenerator({
|
|
|
210338
210129
|
});
|
|
210339
210130
|
}
|
|
210340
210131
|
});
|
|
210132
|
+
function resolveName(name, type) {
|
|
210133
|
+
return pascalCase$6(name, { isFile: type === "file" });
|
|
210134
|
+
}
|
|
210135
|
+
const resolverTs = defineResolver(() => {
|
|
210136
|
+
return {
|
|
210137
|
+
name: "default",
|
|
210138
|
+
pluginName: "plugin-ts",
|
|
210139
|
+
default(name, type) {
|
|
210140
|
+
return resolveName(name, type);
|
|
210141
|
+
},
|
|
210142
|
+
resolveName(name) {
|
|
210143
|
+
return this.default(name, "function");
|
|
210144
|
+
},
|
|
210145
|
+
resolvePathName(name, type) {
|
|
210146
|
+
return this.default(name, type);
|
|
210147
|
+
},
|
|
210148
|
+
resolveParamName(node, param) {
|
|
210149
|
+
return this.resolveName(`${node.operationId} ${param.in} ${param.name}`);
|
|
210150
|
+
},
|
|
210151
|
+
resolveResponseStatusName(node, statusCode) {
|
|
210152
|
+
return this.resolveName(`${node.operationId} Status ${statusCode}`);
|
|
210153
|
+
},
|
|
210154
|
+
resolveDataName(node) {
|
|
210155
|
+
return this.resolveName(`${node.operationId} Data`);
|
|
210156
|
+
},
|
|
210157
|
+
resolveRequestConfigName(node) {
|
|
210158
|
+
return this.resolveName(`${node.operationId} RequestConfig`);
|
|
210159
|
+
},
|
|
210160
|
+
resolveResponsesName(node) {
|
|
210161
|
+
return this.resolveName(`${node.operationId} Responses`);
|
|
210162
|
+
},
|
|
210163
|
+
resolveResponseName(node) {
|
|
210164
|
+
return this.resolveName(`${node.operationId} Response`);
|
|
210165
|
+
},
|
|
210166
|
+
resolveEnumKeyName(node, enumTypeSuffix = "key") {
|
|
210167
|
+
var _a;
|
|
210168
|
+
return `${this.resolveName((_a = node.name) != null ? _a : "")}${enumTypeSuffix}`;
|
|
210169
|
+
},
|
|
210170
|
+
resolvePathParamsName(node, param) {
|
|
210171
|
+
return this.resolveParamName(node, param);
|
|
210172
|
+
},
|
|
210173
|
+
resolveQueryParamsName(node, param) {
|
|
210174
|
+
return this.resolveParamName(node, param);
|
|
210175
|
+
},
|
|
210176
|
+
resolveHeaderParamsName(node, param) {
|
|
210177
|
+
return this.resolveParamName(node, param);
|
|
210178
|
+
}
|
|
210179
|
+
};
|
|
210180
|
+
});
|
|
210181
|
+
const resolverTsLegacy = defineResolver(() => {
|
|
210182
|
+
return {
|
|
210183
|
+
...resolverTs,
|
|
210184
|
+
pluginName: "plugin-ts",
|
|
210185
|
+
resolveResponseStatusName(node, statusCode) {
|
|
210186
|
+
if (statusCode === "default") return this.resolveName(`${node.operationId} Error`);
|
|
210187
|
+
return this.resolveName(`${node.operationId} ${statusCode}`);
|
|
210188
|
+
},
|
|
210189
|
+
resolveDataName(node) {
|
|
210190
|
+
const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
|
|
210191
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
210192
|
+
},
|
|
210193
|
+
resolveResponsesName(node) {
|
|
210194
|
+
const suffix = node.method === "GET" ? "Query" : "Mutation";
|
|
210195
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
210196
|
+
},
|
|
210197
|
+
resolveResponseName(node) {
|
|
210198
|
+
const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
|
|
210199
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
210200
|
+
},
|
|
210201
|
+
resolvePathParamsName(node, _param) {
|
|
210202
|
+
return this.resolveName(`${node.operationId} PathParams`);
|
|
210203
|
+
},
|
|
210204
|
+
resolveQueryParamsName(node, _param) {
|
|
210205
|
+
return this.resolveName(`${node.operationId} QueryParams`);
|
|
210206
|
+
},
|
|
210207
|
+
resolveHeaderParamsName(node, _param) {
|
|
210208
|
+
return this.resolveName(`${node.operationId} HeaderParams`);
|
|
210209
|
+
}
|
|
210210
|
+
};
|
|
210211
|
+
});
|
|
210341
210212
|
function buildGroupedParamsSchema({ params, parentName }) {
|
|
210342
210213
|
return createSchema({
|
|
210343
210214
|
type: "object",
|
|
@@ -210369,22 +210240,22 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
210369
210240
|
const errorResponses = node.responses.filter((res) => res.statusCode === "default" || Number(res.statusCode) >= 400);
|
|
210370
210241
|
const responseSchema = successResponses.length > 0 ? successResponses.length === 1 ? createSchema({
|
|
210371
210242
|
type: "ref",
|
|
210372
|
-
name: resolver.
|
|
210243
|
+
name: resolver.resolveResponseStatusName(node, successResponses[0].statusCode)
|
|
210373
210244
|
}) : createSchema({
|
|
210374
210245
|
type: "union",
|
|
210375
210246
|
members: successResponses.map((res) => createSchema({
|
|
210376
210247
|
type: "ref",
|
|
210377
|
-
name: resolver.
|
|
210248
|
+
name: resolver.resolveResponseStatusName(node, res.statusCode)
|
|
210378
210249
|
}))
|
|
210379
210250
|
}) : createSchema({ type: "any" });
|
|
210380
210251
|
const errorsSchema = errorResponses.length > 0 ? errorResponses.length === 1 ? createSchema({
|
|
210381
210252
|
type: "ref",
|
|
210382
|
-
name: resolver.
|
|
210253
|
+
name: resolver.resolveResponseStatusName(node, errorResponses[0].statusCode)
|
|
210383
210254
|
}) : createSchema({
|
|
210384
210255
|
type: "union",
|
|
210385
210256
|
members: errorResponses.map((res) => createSchema({
|
|
210386
210257
|
type: "ref",
|
|
210387
|
-
name: resolver.
|
|
210258
|
+
name: resolver.resolveResponseStatusName(node, res.statusCode)
|
|
210388
210259
|
}))
|
|
210389
210260
|
}) : createSchema({ type: "any" });
|
|
210390
210261
|
const properties = [createProperty({
|
|
@@ -210397,31 +210268,34 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
210397
210268
|
required: true,
|
|
210398
210269
|
schema: createSchema({
|
|
210399
210270
|
type: "ref",
|
|
210400
|
-
name: resolver.
|
|
210271
|
+
name: resolver.resolveDataName(node)
|
|
210401
210272
|
})
|
|
210402
210273
|
}));
|
|
210403
|
-
|
|
210274
|
+
const queryParam = node.parameters.find((p) => p.in === "query");
|
|
210275
|
+
if (queryParam) properties.push(createProperty({
|
|
210404
210276
|
name: "QueryParams",
|
|
210405
210277
|
required: true,
|
|
210406
210278
|
schema: createSchema({
|
|
210407
210279
|
type: "ref",
|
|
210408
|
-
name: resolver.
|
|
210280
|
+
name: resolver.resolveQueryParamsName(node, queryParam)
|
|
210409
210281
|
})
|
|
210410
210282
|
}));
|
|
210411
|
-
|
|
210283
|
+
const pathParam = node.parameters.find((p) => p.in === "path");
|
|
210284
|
+
if (pathParam) properties.push(createProperty({
|
|
210412
210285
|
name: "PathParams",
|
|
210413
210286
|
required: true,
|
|
210414
210287
|
schema: createSchema({
|
|
210415
210288
|
type: "ref",
|
|
210416
|
-
name: resolver.
|
|
210289
|
+
name: resolver.resolvePathParamsName(node, pathParam)
|
|
210417
210290
|
})
|
|
210418
210291
|
}));
|
|
210419
|
-
|
|
210292
|
+
const headerParam = node.parameters.find((p) => p.in === "header");
|
|
210293
|
+
if (headerParam) properties.push(createProperty({
|
|
210420
210294
|
name: "HeaderParams",
|
|
210421
210295
|
required: true,
|
|
210422
210296
|
schema: createSchema({
|
|
210423
210297
|
type: "ref",
|
|
210424
|
-
name: resolver.
|
|
210298
|
+
name: resolver.resolveHeaderParamsName(node, headerParam)
|
|
210425
210299
|
})
|
|
210426
210300
|
}));
|
|
210427
210301
|
properties.push(createProperty({
|
|
@@ -210442,13 +210316,13 @@ function buildLegacyResponseUnionSchemaNode({ node, resolver }) {
|
|
|
210442
210316
|
if (successResponses.length === 0) return createSchema({ type: "any" });
|
|
210443
210317
|
if (successResponses.length === 1) return createSchema({
|
|
210444
210318
|
type: "ref",
|
|
210445
|
-
name: resolver.
|
|
210319
|
+
name: resolver.resolveResponseStatusName(node, successResponses[0].statusCode)
|
|
210446
210320
|
});
|
|
210447
210321
|
return createSchema({
|
|
210448
210322
|
type: "union",
|
|
210449
210323
|
members: successResponses.map((res) => createSchema({
|
|
210450
210324
|
type: "ref",
|
|
210451
|
-
name: resolver.
|
|
210325
|
+
name: resolver.resolveResponseStatusName(node, res.statusCode)
|
|
210452
210326
|
}))
|
|
210453
210327
|
});
|
|
210454
210328
|
}
|
|
@@ -210480,9 +210354,9 @@ function nameUnnamedEnums(node, parentName) {
|
|
|
210480
210354
|
const typeGeneratorLegacy = defineGenerator({
|
|
210481
210355
|
name: "typescript-legacy",
|
|
210482
210356
|
type: "react",
|
|
210483
|
-
Operation({ node, adapter, options, config }) {
|
|
210357
|
+
Operation({ node, adapter, options, config, resolver }) {
|
|
210484
210358
|
var _a, _b, _c;
|
|
210485
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output,
|
|
210359
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, transformers = [] } = options;
|
|
210486
210360
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210487
210361
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210488
210362
|
const file = resolver.resolveFile({
|
|
@@ -210496,7 +210370,7 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210496
210370
|
group
|
|
210497
210371
|
});
|
|
210498
210372
|
const params = caseParams(node.parameters, paramsCasing);
|
|
210499
|
-
function renderSchemaType({ node: schemaNode, name,
|
|
210373
|
+
function renderSchemaType({ node: schemaNode, name, description, keysToOmit }) {
|
|
210500
210374
|
if (!schemaNode) return null;
|
|
210501
210375
|
const transformedNode = transform(schemaNode, composeTransformers(...transformers));
|
|
210502
210376
|
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
@@ -210521,10 +210395,10 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210521
210395
|
imp.isTypeOnly
|
|
210522
210396
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210523
210397
|
name,
|
|
210524
|
-
typedName,
|
|
210525
210398
|
node: transformedNode,
|
|
210526
210399
|
description,
|
|
210527
210400
|
enumType,
|
|
210401
|
+
enumTypeSuffix,
|
|
210528
210402
|
enumKeyCasing,
|
|
210529
210403
|
optionalType,
|
|
210530
210404
|
arrayType,
|
|
@@ -210542,7 +210416,6 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210542
210416
|
return renderSchemaType({
|
|
210543
210417
|
node: res.schema ? nameUnnamedEnums(res.schema, baseResponseName) : res.schema,
|
|
210544
210418
|
name: responseName,
|
|
210545
|
-
typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),
|
|
210546
210419
|
description: res.description,
|
|
210547
210420
|
keysToOmit: res.keysToOmit
|
|
210548
210421
|
});
|
|
@@ -210550,7 +210423,6 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210550
210423
|
const requestType = ((_b = node.requestBody) == null ? void 0 : _b.schema) ? renderSchemaType({
|
|
210551
210424
|
node: nameUnnamedEnums(node.requestBody.schema, resolverTsLegacy.resolveDataName(node)),
|
|
210552
210425
|
name: resolver.resolveDataName(node),
|
|
210553
|
-
typedName: resolver.resolveDataTypedName(node),
|
|
210554
210426
|
description: (_c = node.requestBody.description) != null ? _c : node.requestBody.schema.description,
|
|
210555
210427
|
keysToOmit: node.requestBody.keysToOmit
|
|
210556
210428
|
}) : null;
|
|
@@ -210558,26 +210430,23 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210558
210430
|
pathParams.length > 0 ? renderSchemaType({
|
|
210559
210431
|
node: buildGroupedParamsSchema({
|
|
210560
210432
|
params: pathParams,
|
|
210561
|
-
parentName: resolverTsLegacy.resolvePathParamsName(node)
|
|
210433
|
+
parentName: resolverTsLegacy.resolvePathParamsName(node, pathParams[0])
|
|
210562
210434
|
}),
|
|
210563
|
-
name: resolver.resolvePathParamsName(node)
|
|
210564
|
-
typedName: resolver.resolvePathParamsTypedName(node)
|
|
210435
|
+
name: resolver.resolvePathParamsName(node, pathParams[0])
|
|
210565
210436
|
}) : null,
|
|
210566
210437
|
queryParams.length > 0 ? renderSchemaType({
|
|
210567
210438
|
node: buildGroupedParamsSchema({
|
|
210568
210439
|
params: queryParams,
|
|
210569
|
-
parentName: resolverTsLegacy.resolveQueryParamsName(node)
|
|
210440
|
+
parentName: resolverTsLegacy.resolveQueryParamsName(node, queryParams[0])
|
|
210570
210441
|
}),
|
|
210571
|
-
name: resolver.resolveQueryParamsName(node)
|
|
210572
|
-
typedName: resolver.resolveQueryParamsTypedName(node)
|
|
210442
|
+
name: resolver.resolveQueryParamsName(node, queryParams[0])
|
|
210573
210443
|
}) : null,
|
|
210574
210444
|
headerParams.length > 0 ? renderSchemaType({
|
|
210575
210445
|
node: buildGroupedParamsSchema({
|
|
210576
210446
|
params: headerParams,
|
|
210577
|
-
parentName: resolverTsLegacy.resolveHeaderParamsName(node)
|
|
210447
|
+
parentName: resolverTsLegacy.resolveHeaderParamsName(node, headerParams[0])
|
|
210578
210448
|
}),
|
|
210579
|
-
name: resolver.resolveHeaderParamsName(node)
|
|
210580
|
-
typedName: resolver.resolveHeaderParamsTypedName(node)
|
|
210449
|
+
name: resolver.resolveHeaderParamsName(node, headerParams[0])
|
|
210581
210450
|
}) : null
|
|
210582
210451
|
];
|
|
210583
210452
|
const legacyResponsesType = renderSchemaType({
|
|
@@ -210585,16 +210454,14 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210585
210454
|
node,
|
|
210586
210455
|
resolver
|
|
210587
210456
|
}),
|
|
210588
|
-
name: resolver.resolveResponsesName(node)
|
|
210589
|
-
typedName: resolver.resolveResponsesTypedName(node)
|
|
210457
|
+
name: resolver.resolveResponsesName(node)
|
|
210590
210458
|
});
|
|
210591
210459
|
const legacyResponseType = renderSchemaType({
|
|
210592
210460
|
node: buildLegacyResponseUnionSchemaNode({
|
|
210593
210461
|
node,
|
|
210594
210462
|
resolver
|
|
210595
210463
|
}),
|
|
210596
|
-
name: resolver.resolveResponseName(node)
|
|
210597
|
-
typedName: resolver.resolveResponseTypedName(node)
|
|
210464
|
+
name: resolver.resolveResponseName(node)
|
|
210598
210465
|
});
|
|
210599
210466
|
return /* @__PURE__ */ jsxs(File, {
|
|
210600
210467
|
baseName: file.baseName,
|
|
@@ -210617,8 +210484,8 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210617
210484
|
]
|
|
210618
210485
|
});
|
|
210619
210486
|
},
|
|
210620
|
-
Schema({ node, adapter, options, config }) {
|
|
210621
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group,
|
|
210487
|
+
Schema({ node, adapter, options, config, resolver }) {
|
|
210488
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, transformers = [] } = options;
|
|
210622
210489
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210623
210490
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210624
210491
|
if (!node.name) return;
|
|
@@ -210635,10 +210502,8 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210635
210502
|
}).path
|
|
210636
210503
|
}));
|
|
210637
210504
|
const isEnumSchema = !!narrowSchema(node, schemaTypes.enum);
|
|
210638
|
-
const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name);
|
|
210639
210505
|
const type = {
|
|
210640
|
-
name: resolver.resolveName(node.name),
|
|
210641
|
-
typedName,
|
|
210506
|
+
name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyName(node, enumTypeSuffix) : resolver.resolveName(node.name),
|
|
210642
210507
|
file: resolver.resolveFile({
|
|
210643
210508
|
name: node.name,
|
|
210644
210509
|
extname: ".ts"
|
|
@@ -210671,9 +210536,9 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210671
210536
|
imp.isTypeOnly
|
|
210672
210537
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
210673
210538
|
name: type.name,
|
|
210674
|
-
typedName: type.typedName,
|
|
210675
210539
|
node: transformedNode,
|
|
210676
210540
|
enumType,
|
|
210541
|
+
enumTypeSuffix,
|
|
210677
210542
|
enumKeyCasing,
|
|
210678
210543
|
optionalType,
|
|
210679
210544
|
arrayType,
|
|
@@ -210683,34 +210548,27 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210683
210548
|
});
|
|
210684
210549
|
}
|
|
210685
210550
|
});
|
|
210686
|
-
|
|
210687
210551
|
const presets = definePresets({
|
|
210688
|
-
default:
|
|
210552
|
+
default: {
|
|
210553
|
+
name: "default",
|
|
210689
210554
|
resolvers: [resolverTs],
|
|
210690
210555
|
generators: [typeGenerator]
|
|
210691
|
-
}
|
|
210692
|
-
kubbV4:
|
|
210556
|
+
},
|
|
210557
|
+
kubbV4: {
|
|
210558
|
+
name: "kubbV4",
|
|
210693
210559
|
resolvers: [resolverTsLegacy],
|
|
210694
210560
|
generators: [typeGeneratorLegacy]
|
|
210695
|
-
}
|
|
210561
|
+
}
|
|
210696
210562
|
});
|
|
210697
|
-
function getPreset$1(preset, { resolvers, transformers, generators }) {
|
|
210698
|
-
return getPreset({
|
|
210699
|
-
preset,
|
|
210700
|
-
presets,
|
|
210701
|
-
resolvers: [resolverTs, ...resolvers != null ? resolvers : []],
|
|
210702
|
-
transformers,
|
|
210703
|
-
generators
|
|
210704
|
-
});
|
|
210705
|
-
}
|
|
210706
|
-
__name$5(getPreset$1, "getPreset");
|
|
210707
210563
|
const pluginTsName = "plugin-ts";
|
|
210708
210564
|
const pluginTs = createPlugin((options) => {
|
|
210709
210565
|
const { output = {
|
|
210710
210566
|
path: "types",
|
|
210711
210567
|
barrelType: "named"
|
|
210712
|
-
}, group, exclude = [], include, override = [], enumType = "asConst", enumKeyCasing = "none", optionalType = "questionToken", arrayType = "array", syntaxType = "type", paramsCasing, compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
|
|
210713
|
-
const
|
|
210568
|
+
}, group, exclude = [], include, override = [], enumType = "asConst", enumTypeSuffix = "Key", enumKeyCasing = "none", optionalType = "questionToken", arrayType = "array", syntaxType = "type", paramsCasing, compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
|
|
210569
|
+
const preset = getPreset({
|
|
210570
|
+
preset: compatibilityPreset,
|
|
210571
|
+
presets,
|
|
210714
210572
|
resolvers: userResolvers,
|
|
210715
210573
|
transformers: userTransformers,
|
|
210716
210574
|
generators: userGenerators
|
|
@@ -210719,25 +210577,37 @@ const pluginTs = createPlugin((options) => {
|
|
|
210719
210577
|
let resolvePathWarning = false;
|
|
210720
210578
|
return {
|
|
210721
210579
|
name: pluginTsName,
|
|
210722
|
-
|
|
210723
|
-
|
|
210724
|
-
|
|
210725
|
-
|
|
210726
|
-
|
|
210727
|
-
|
|
210728
|
-
|
|
210729
|
-
|
|
210730
|
-
|
|
210731
|
-
|
|
210732
|
-
|
|
210580
|
+
get resolver() {
|
|
210581
|
+
return preset.resolver;
|
|
210582
|
+
},
|
|
210583
|
+
get options() {
|
|
210584
|
+
return {
|
|
210585
|
+
output,
|
|
210586
|
+
optionalType,
|
|
210587
|
+
group: group ? {
|
|
210588
|
+
...options.group,
|
|
210589
|
+
name: (ctx) => {
|
|
210590
|
+
var _a;
|
|
210591
|
+
if (((_a = options.group) == null ? void 0 : _a.type) === "path") return `${ctx.group.split("/")[1]}`;
|
|
210592
|
+
return `${camelCase$a(ctx.group)}Controller`;
|
|
210593
|
+
}
|
|
210594
|
+
} : void 0,
|
|
210595
|
+
arrayType,
|
|
210596
|
+
enumType,
|
|
210597
|
+
enumTypeSuffix,
|
|
210598
|
+
enumKeyCasing,
|
|
210599
|
+
syntaxType,
|
|
210600
|
+
paramsCasing,
|
|
210601
|
+
transformers: preset.transformers
|
|
210602
|
+
};
|
|
210733
210603
|
},
|
|
210734
210604
|
resolvePath(baseName, pathMode, options2) {
|
|
210735
210605
|
var _a, _b;
|
|
210736
210606
|
if (!resolvePathWarning) {
|
|
210737
|
-
this.
|
|
210607
|
+
this.events.emit("warn", "Do not use resolvePath for pluginTs, use resolverTs.resolvePath instead");
|
|
210738
210608
|
resolvePathWarning = true;
|
|
210739
210609
|
}
|
|
210740
|
-
return resolver.resolvePath({
|
|
210610
|
+
return this.plugin.resolver.resolvePath({
|
|
210741
210611
|
baseName,
|
|
210742
210612
|
pathMode,
|
|
210743
210613
|
tag: (_a = options2 == null ? void 0 : options2.group) == null ? void 0 : _a.tag,
|
|
@@ -210745,26 +210615,26 @@ const pluginTs = createPlugin((options) => {
|
|
|
210745
210615
|
}, {
|
|
210746
210616
|
root: path$2.resolve(this.config.root, this.config.output.path),
|
|
210747
210617
|
output,
|
|
210748
|
-
group
|
|
210618
|
+
group: this.plugin.options.group
|
|
210749
210619
|
});
|
|
210750
210620
|
},
|
|
210751
210621
|
resolveName(name, type) {
|
|
210752
210622
|
if (!resolveNameWarning) {
|
|
210753
|
-
this.
|
|
210623
|
+
this.events.emit("warn", "Do not use resolveName for pluginTs, use resolverTs.default instead");
|
|
210754
210624
|
resolveNameWarning = true;
|
|
210755
210625
|
}
|
|
210756
|
-
return resolver.default(name, type);
|
|
210626
|
+
return this.plugin.resolver.default(name, type);
|
|
210757
210627
|
},
|
|
210758
210628
|
async install() {
|
|
210759
210629
|
var _a;
|
|
210760
|
-
const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this;
|
|
210630
|
+
const { config, fabric, plugin, adapter, rootNode, driver, openInStudio, resolver } = this;
|
|
210761
210631
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210762
210632
|
if (!adapter) throw new Error("Plugin cannot work without adapter being set");
|
|
210763
210633
|
await openInStudio({ ast: true });
|
|
210764
210634
|
await walk(rootNode, {
|
|
210765
210635
|
depth: "shallow",
|
|
210766
210636
|
async schema(schemaNode) {
|
|
210767
|
-
const writeTasks = generators.map(async (generator) => {
|
|
210637
|
+
const writeTasks = preset.generators.map(async (generator) => {
|
|
210768
210638
|
if (generator.type === "react" && generator.version === "2") {
|
|
210769
210639
|
const options2 = resolver.resolveOptions(schemaNode, {
|
|
210770
210640
|
options: plugin.options,
|
|
@@ -210775,6 +210645,7 @@ const pluginTs = createPlugin((options) => {
|
|
|
210775
210645
|
if (options2 === null) return;
|
|
210776
210646
|
await renderSchema$1(schemaNode, {
|
|
210777
210647
|
options: options2,
|
|
210648
|
+
resolver,
|
|
210778
210649
|
adapter,
|
|
210779
210650
|
config,
|
|
210780
210651
|
fabric,
|
|
@@ -210787,7 +210658,7 @@ const pluginTs = createPlugin((options) => {
|
|
|
210787
210658
|
await Promise.all(writeTasks);
|
|
210788
210659
|
},
|
|
210789
210660
|
async operation(operationNode) {
|
|
210790
|
-
const writeTasks = generators.map(async (generator) => {
|
|
210661
|
+
const writeTasks = preset.generators.map(async (generator) => {
|
|
210791
210662
|
if (generator.type === "react" && generator.version === "2") {
|
|
210792
210663
|
const options2 = resolver.resolveOptions(operationNode, {
|
|
210793
210664
|
options: plugin.options,
|
|
@@ -210798,6 +210669,7 @@ const pluginTs = createPlugin((options) => {
|
|
|
210798
210669
|
if (options2 === null) return;
|
|
210799
210670
|
await renderOperation$1(operationNode, {
|
|
210800
210671
|
options: options2,
|
|
210672
|
+
resolver,
|
|
210801
210673
|
adapter,
|
|
210802
210674
|
config,
|
|
210803
210675
|
fabric,
|
|
@@ -213693,7 +213565,7 @@ const serverGenerator = createReactGenerator({
|
|
|
213693
213565
|
"${((_b = oas.api.info) == null ? void 0 : _b.title) || "server"}": {
|
|
213694
213566
|
"type": "stdio",
|
|
213695
213567
|
"command": "npx",
|
|
213696
|
-
"args": ["tsx", "${file.path}"]
|
|
213568
|
+
"args": ["tsx", "${path$2.relative(path$2.dirname(jsonFile.path), file.path)}"]
|
|
213697
213569
|
}
|
|
213698
213570
|
}
|
|
213699
213571
|
}
|
|
@@ -213760,7 +213632,7 @@ const pluginMcp = createPlugin((options) => {
|
|
|
213760
213632
|
const oas = await this.getOas();
|
|
213761
213633
|
const baseURL = await this.getBaseURL();
|
|
213762
213634
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
213763
|
-
const hasClientPlugin = !!this.
|
|
213635
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
213764
213636
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.addFile({
|
|
213765
213637
|
baseName: "fetch.ts",
|
|
213766
213638
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -216126,7 +215998,7 @@ const infiniteQueryGenerator$1 = createReactGenerator({
|
|
|
216126
215998
|
suffix: "infinite"
|
|
216127
215999
|
})
|
|
216128
216000
|
};
|
|
216129
|
-
const shouldUseClientPlugin = !!driver.
|
|
216001
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
216130
216002
|
const client = {
|
|
216131
216003
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216132
216004
|
type: "function",
|
|
@@ -216380,7 +216252,7 @@ const mutationGenerator$4 = createReactGenerator({
|
|
|
216380
216252
|
type: "function"
|
|
216381
216253
|
})
|
|
216382
216254
|
};
|
|
216383
|
-
const shouldUseClientPlugin = !!driver.
|
|
216255
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
216384
216256
|
const client = {
|
|
216385
216257
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216386
216258
|
type: "function",
|
|
@@ -216576,7 +216448,7 @@ const queryGenerator$4 = createReactGenerator({
|
|
|
216576
216448
|
typeName: getName(operation, { type: "type" }),
|
|
216577
216449
|
file: getFile(operation, { prefix: "use" })
|
|
216578
216450
|
};
|
|
216579
|
-
const shouldUseClientPlugin = !!driver.
|
|
216451
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
216580
216452
|
const client = {
|
|
216581
216453
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216582
216454
|
type: "function",
|
|
@@ -216795,7 +216667,7 @@ const suspenseInfiniteQueryGenerator = createReactGenerator({
|
|
|
216795
216667
|
suffix: "suspenseInfinite"
|
|
216796
216668
|
})
|
|
216797
216669
|
};
|
|
216798
|
-
const shouldUseClientPlugin = !!driver.
|
|
216670
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
216799
216671
|
const client = {
|
|
216800
216672
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
216801
216673
|
type: "function",
|
|
@@ -217029,7 +216901,7 @@ const suspenseQueryGenerator = createReactGenerator({
|
|
|
217029
216901
|
suffix: "suspense"
|
|
217030
216902
|
})
|
|
217031
216903
|
};
|
|
217032
|
-
const shouldUseClientPlugin = !!driver.
|
|
216904
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
217033
216905
|
const client = {
|
|
217034
216906
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
217035
216907
|
type: "function",
|
|
@@ -217327,7 +217199,7 @@ const pluginReactQuery = createPlugin((options) => {
|
|
|
217327
217199
|
const oas = await this.getOas();
|
|
217328
217200
|
const baseURL = await this.getBaseURL();
|
|
217329
217201
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
217330
|
-
const hasClientPlugin = !!this.
|
|
217202
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
217331
217203
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
217332
217204
|
baseName: "fetch.ts",
|
|
217333
217205
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -218131,7 +218003,7 @@ const mutationGenerator$3 = createReactGenerator({
|
|
|
218131
218003
|
type: "function"
|
|
218132
218004
|
})
|
|
218133
218005
|
};
|
|
218134
|
-
const shouldUseClientPlugin = !!driver.
|
|
218006
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
218135
218007
|
const client = {
|
|
218136
218008
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
218137
218009
|
type: "function",
|
|
@@ -218306,7 +218178,7 @@ const queryGenerator$3 = createReactGenerator({
|
|
|
218306
218178
|
typeName: getName(operation, { type: "type" }),
|
|
218307
218179
|
file: getFile(operation, { prefix: "create" })
|
|
218308
218180
|
};
|
|
218309
|
-
const shouldUseClientPlugin = !!driver.
|
|
218181
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
218310
218182
|
const client = {
|
|
218311
218183
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
218312
218184
|
type: "function",
|
|
@@ -218575,7 +218447,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
218575
218447
|
const oas = await this.getOas();
|
|
218576
218448
|
const baseURL = await this.getBaseURL();
|
|
218577
218449
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
218578
|
-
const hasClientPlugin = !!this.
|
|
218450
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
218579
218451
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
218580
218452
|
baseName: "fetch.ts",
|
|
218581
218453
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -219325,7 +219197,7 @@ const mutationGenerator$2 = createReactGenerator({
|
|
|
219325
219197
|
type: "function"
|
|
219326
219198
|
})
|
|
219327
219199
|
};
|
|
219328
|
-
const shouldUseClientPlugin = !!driver.
|
|
219200
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
219329
219201
|
const client = {
|
|
219330
219202
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
219331
219203
|
type: "function",
|
|
@@ -219499,7 +219371,7 @@ const queryGenerator$2 = createReactGenerator({
|
|
|
219499
219371
|
typeName: getName(operation, { type: "type" }),
|
|
219500
219372
|
file: getFile(operation, { prefix: "create" })
|
|
219501
219373
|
};
|
|
219502
|
-
const shouldUseClientPlugin = !!driver.
|
|
219374
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
219503
219375
|
const client = {
|
|
219504
219376
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
219505
219377
|
type: "function",
|
|
@@ -219768,7 +219640,7 @@ const pluginSvelteQuery = createPlugin((options) => {
|
|
|
219768
219640
|
const oas = await this.getOas();
|
|
219769
219641
|
const baseURL = await this.getBaseURL();
|
|
219770
219642
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
219771
|
-
const hasClientPlugin = !!this.
|
|
219643
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
219772
219644
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
219773
219645
|
baseName: "fetch.ts",
|
|
219774
219646
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -220556,7 +220428,7 @@ const mutationGenerator$1 = createReactGenerator({
|
|
|
220556
220428
|
type: "function"
|
|
220557
220429
|
})
|
|
220558
220430
|
};
|
|
220559
|
-
const shouldUseClientPlugin = !!driver.
|
|
220431
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
220560
220432
|
const client = {
|
|
220561
220433
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
220562
220434
|
type: "function",
|
|
@@ -220726,7 +220598,7 @@ const queryGenerator$1 = createReactGenerator({
|
|
|
220726
220598
|
typeName: getName(operation, { type: "type" }),
|
|
220727
220599
|
file: getFile(operation, { prefix: "use" })
|
|
220728
220600
|
};
|
|
220729
|
-
const shouldUseClientPlugin = !!driver.
|
|
220601
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
220730
220602
|
const client = {
|
|
220731
220603
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
220732
220604
|
type: "function",
|
|
@@ -220983,7 +220855,7 @@ const pluginSwr = createPlugin((options) => {
|
|
|
220983
220855
|
const oas = await this.getOas();
|
|
220984
220856
|
const baseURL = await this.getBaseURL();
|
|
220985
220857
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
220986
|
-
const hasClientPlugin = !!this.
|
|
220858
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
220987
220859
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
220988
220860
|
baseName: "fetch.ts",
|
|
220989
220861
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -222078,7 +221950,7 @@ const infiniteQueryGenerator = createReactGenerator({
|
|
|
222078
221950
|
suffix: "infinite"
|
|
222079
221951
|
})
|
|
222080
221952
|
};
|
|
222081
|
-
const shouldUseClientPlugin = !!driver.
|
|
221953
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
222082
221954
|
const client = {
|
|
222083
221955
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
222084
221956
|
type: "function",
|
|
@@ -222323,7 +222195,7 @@ const mutationGenerator = createReactGenerator({
|
|
|
222323
222195
|
type: "function"
|
|
222324
222196
|
})
|
|
222325
222197
|
};
|
|
222326
|
-
const shouldUseClientPlugin = !!driver.
|
|
222198
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
222327
222199
|
const client = {
|
|
222328
222200
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
222329
222201
|
type: "function",
|
|
@@ -222498,7 +222370,7 @@ const queryGenerator = createReactGenerator({
|
|
|
222498
222370
|
typeName: getName(operation, { type: "type" }),
|
|
222499
222371
|
file: getFile(operation, { prefix: "use" })
|
|
222500
222372
|
};
|
|
222501
|
-
const shouldUseClientPlugin = !!driver.
|
|
222373
|
+
const shouldUseClientPlugin = !!driver.getPlugin(pluginClientName) && options.client.clientType !== "class";
|
|
222502
222374
|
const client = {
|
|
222503
222375
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
222504
222376
|
type: "function",
|
|
@@ -222788,7 +222660,7 @@ const pluginVueQuery = createPlugin((options) => {
|
|
|
222788
222660
|
const oas = await this.getOas();
|
|
222789
222661
|
const baseURL = await this.getBaseURL();
|
|
222790
222662
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
222791
|
-
const hasClientPlugin = !!this.
|
|
222663
|
+
const hasClientPlugin = !!this.getPlugin(pluginClientName);
|
|
222792
222664
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
222793
222665
|
baseName: "fetch.ts",
|
|
222794
222666
|
path: path$2.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -223038,13 +222910,12 @@ function setupEventsStream(ws, events, getSource) {
|
|
|
223038
222910
|
});
|
|
223039
222911
|
});
|
|
223040
222912
|
events.on("generation:start", (config) => {
|
|
223041
|
-
var _a;
|
|
223042
222913
|
sendDataMessage({
|
|
223043
222914
|
type: "generation:start",
|
|
223044
222915
|
data: [
|
|
223045
222916
|
{
|
|
223046
222917
|
name: config.name,
|
|
223047
|
-
plugins:
|
|
222918
|
+
plugins: config.plugins.length
|
|
223048
222919
|
}
|
|
223049
222920
|
],
|
|
223050
222921
|
timestamp: Date.now()
|
|
@@ -223151,7 +223022,7 @@ async function connectToStudio(options) {
|
|
|
223151
223022
|
heartbeatTimer = setInterval(() => sendAgentMessage(ws, { type: "ping" }), heartbeatInterval);
|
|
223152
223023
|
setupEventsStream(ws, events, () => currentSource);
|
|
223153
223024
|
ws.addEventListener("message", async (message) => {
|
|
223154
|
-
var _a2, _b, _c, _d, _e, _f
|
|
223025
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
223155
223026
|
try {
|
|
223156
223027
|
const data = JSON.parse(message.data);
|
|
223157
223028
|
logger.info(`[${maskedSessionId}] Received "${data.type}" from Studio`);
|
|
@@ -223213,7 +223084,7 @@ async function connectToStudio(options) {
|
|
|
223213
223084
|
configPath,
|
|
223214
223085
|
permissions: { allowAll: effectiveAllowAll, allowWrite: effectiveWrite, allowPublish: effectivePublish },
|
|
223215
223086
|
config: {
|
|
223216
|
-
plugins:
|
|
223087
|
+
plugins: config.plugins.map((plugin) => ({
|
|
223217
223088
|
name: `@kubb/${plugin.name}`,
|
|
223218
223089
|
options: serializePluginOptions(plugin.options)
|
|
223219
223090
|
}))
|
|
@@ -223230,7 +223101,7 @@ async function connectToStudio(options) {
|
|
|
223230
223101
|
}
|
|
223231
223102
|
currentSource = "publish";
|
|
223232
223103
|
const config = await loadConfig(resolvedConfigPath);
|
|
223233
|
-
const resolvedCommand = (
|
|
223104
|
+
const resolvedCommand = (_e = (_d = data.payload.command) != null ? _d : process.env.KUBB_AGENT_PUBLISH_COMMAND) != null ? _e : "npm publish";
|
|
223234
223105
|
await publish({
|
|
223235
223106
|
command: resolvedCommand,
|
|
223236
223107
|
outputPath: config.output.path,
|
|
@@ -223244,7 +223115,7 @@ async function connectToStudio(options) {
|
|
|
223244
223115
|
}
|
|
223245
223116
|
logger.warn(`[${maskedSessionId}] Unknown message type from Kubb Studio: ${message.data}`);
|
|
223246
223117
|
} catch (error) {
|
|
223247
|
-
logger.error(`[${maskedSessionId}] [unhandledRejection] ${(
|
|
223118
|
+
logger.error(`[${maskedSessionId}] [unhandledRejection] ${(_f = error == null ? void 0 : error.message) != null ? _f : error}`);
|
|
223248
223119
|
}
|
|
223249
223120
|
});
|
|
223250
223121
|
} catch (error) {
|