@kubb/agent 5.0.0-alpha.23 → 5.0.0-alpha.24
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 +528 -181
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/lib/constants.js +4 -0
- package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/lib/parse.js +301 -0
- package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/lib/picomatch.js +11 -3
- package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/package.json +2 -3
- package/.output/server/node_modules/@redocly/config/lib/default-theme-config-schema.js +1 -0
- package/.output/server/node_modules/@redocly/config/lib/ex-theme-config-schemas.js +6 -1
- package/.output/server/node_modules/@redocly/config/lib/root-config-schema.js +1 -1
- package/.output/server/node_modules/@redocly/config/package.json +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle.js +2 -2
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/bundle-extends.js +1 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config-resolvers.js +14 -5
- package/.output/server/node_modules/@redocly/openapi-core/lib/lint.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/json-schema-draft7.shared.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas2.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/types/oas3.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/package.json +3 -3
- package/.output/server/package.json +3 -3
- package/package.json +16 -16
- /package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/index.js +0 -0
- /package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/lib/scan.js +0 -0
- /package/.output/server/node_modules/.nitro/{picomatch@4.0.3 → picomatch@4.0.4}/lib/utils.js +0 -0
|
@@ -4635,6 +4635,32 @@ function createParameter(props) {
|
|
|
4635
4635
|
schema: syncOptionality(props.schema, required)
|
|
4636
4636
|
};
|
|
4637
4637
|
}
|
|
4638
|
+
function createFunctionParameter(props) {
|
|
4639
|
+
return {
|
|
4640
|
+
optional: false,
|
|
4641
|
+
...props,
|
|
4642
|
+
kind: "FunctionParameter"
|
|
4643
|
+
};
|
|
4644
|
+
}
|
|
4645
|
+
function createTypeNode(props) {
|
|
4646
|
+
return {
|
|
4647
|
+
...props,
|
|
4648
|
+
kind: "Type"
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
function createParameterGroup(props) {
|
|
4652
|
+
return {
|
|
4653
|
+
...props,
|
|
4654
|
+
kind: "ParameterGroup"
|
|
4655
|
+
};
|
|
4656
|
+
}
|
|
4657
|
+
function createFunctionParameters(props = {}) {
|
|
4658
|
+
return {
|
|
4659
|
+
params: [],
|
|
4660
|
+
...props,
|
|
4661
|
+
kind: "FunctionParameters"
|
|
4662
|
+
};
|
|
4663
|
+
}
|
|
4638
4664
|
function narrowSchema(node, type) {
|
|
4639
4665
|
return (node == null ? void 0 : node.type) === type ? node : void 0;
|
|
4640
4666
|
}
|
|
@@ -4995,6 +5021,198 @@ function caseParams(params, casing) {
|
|
|
4995
5021
|
};
|
|
4996
5022
|
});
|
|
4997
5023
|
}
|
|
5024
|
+
function resolveType({ node, param, resolver }) {
|
|
5025
|
+
var _a;
|
|
5026
|
+
if (!resolver) return createTypeNode({
|
|
5027
|
+
variant: "reference",
|
|
5028
|
+
name: (_a = param.schema.primitive) != null ? _a : "unknown"
|
|
5029
|
+
});
|
|
5030
|
+
const individualName = resolver.resolveParamName(node, param);
|
|
5031
|
+
const groupLocation = param.in === "path" || param.in === "query" || param.in === "header" ? param.in : void 0;
|
|
5032
|
+
const groupResolvers = {
|
|
5033
|
+
path: resolver.resolvePathParamsName,
|
|
5034
|
+
query: resolver.resolveQueryParamsName,
|
|
5035
|
+
header: resolver.resolveHeaderParamsName
|
|
5036
|
+
};
|
|
5037
|
+
const groupName = groupLocation ? groupResolvers[groupLocation].call(resolver, node, param) : void 0;
|
|
5038
|
+
if (groupName && groupName !== individualName) return createTypeNode({
|
|
5039
|
+
variant: "member",
|
|
5040
|
+
base: groupName,
|
|
5041
|
+
key: param.name
|
|
5042
|
+
});
|
|
5043
|
+
return createTypeNode({
|
|
5044
|
+
variant: "reference",
|
|
5045
|
+
name: individualName
|
|
5046
|
+
});
|
|
5047
|
+
}
|
|
5048
|
+
function createOperationParams(node, options) {
|
|
5049
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5050
|
+
const { paramsType, pathParamsType, paramsCasing, resolver, pathParamsDefault, extraParams = [], paramNames, typeWrapper } = options;
|
|
5051
|
+
const dataName = (_a = paramNames == null ? void 0 : paramNames.data) != null ? _a : "data";
|
|
5052
|
+
const paramsName = (_b = paramNames == null ? void 0 : paramNames.params) != null ? _b : "params";
|
|
5053
|
+
const headersName = (_c = paramNames == null ? void 0 : paramNames.headers) != null ? _c : "headers";
|
|
5054
|
+
const pathName = (_d = paramNames == null ? void 0 : paramNames.path) != null ? _d : "pathParams";
|
|
5055
|
+
const wrapType = (type) => createTypeNode({
|
|
5056
|
+
variant: "reference",
|
|
5057
|
+
name: typeWrapper ? typeWrapper(type) : type
|
|
5058
|
+
});
|
|
5059
|
+
const wrapTypeNode = (type) => type.variant === "reference" ? wrapType(type.name) : type;
|
|
5060
|
+
const casedParams = caseParams(node.parameters, paramsCasing);
|
|
5061
|
+
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
5062
|
+
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
5063
|
+
const headerParams = casedParams.filter((p) => p.in === "header");
|
|
5064
|
+
const bodyType = ((_e = node.requestBody) == null ? void 0 : _e.schema) ? wrapType((_f = resolver == null ? void 0 : resolver.resolveDataName(node)) != null ? _f : "unknown") : void 0;
|
|
5065
|
+
const bodyRequired = (_h = (_g = node.requestBody) == null ? void 0 : _g.required) != null ? _h : false;
|
|
5066
|
+
const queryGroupType = resolver ? resolveGroupType({
|
|
5067
|
+
node,
|
|
5068
|
+
params: queryParams,
|
|
5069
|
+
groupMethod: resolver.resolveQueryParamsName,
|
|
5070
|
+
resolver
|
|
5071
|
+
}) : void 0;
|
|
5072
|
+
const headerGroupType = resolver ? resolveGroupType({
|
|
5073
|
+
node,
|
|
5074
|
+
params: headerParams,
|
|
5075
|
+
groupMethod: resolver.resolveHeaderParamsName,
|
|
5076
|
+
resolver
|
|
5077
|
+
}) : void 0;
|
|
5078
|
+
const params = [];
|
|
5079
|
+
if (paramsType === "object") {
|
|
5080
|
+
const children = [
|
|
5081
|
+
...pathParams.map((p) => {
|
|
5082
|
+
const type = resolveType({
|
|
5083
|
+
node,
|
|
5084
|
+
param: p,
|
|
5085
|
+
resolver
|
|
5086
|
+
});
|
|
5087
|
+
return createFunctionParameter({
|
|
5088
|
+
name: p.name,
|
|
5089
|
+
type: wrapTypeNode(type),
|
|
5090
|
+
optional: !p.required
|
|
5091
|
+
});
|
|
5092
|
+
}),
|
|
5093
|
+
...bodyType ? [createFunctionParameter({
|
|
5094
|
+
name: dataName,
|
|
5095
|
+
type: bodyType,
|
|
5096
|
+
optional: !bodyRequired
|
|
5097
|
+
})] : [],
|
|
5098
|
+
...buildGroupParam({
|
|
5099
|
+
name: paramsName,
|
|
5100
|
+
node,
|
|
5101
|
+
params: queryParams,
|
|
5102
|
+
groupType: queryGroupType,
|
|
5103
|
+
resolver,
|
|
5104
|
+
wrapType
|
|
5105
|
+
}),
|
|
5106
|
+
...buildGroupParam({
|
|
5107
|
+
name: headersName,
|
|
5108
|
+
node,
|
|
5109
|
+
params: headerParams,
|
|
5110
|
+
groupType: headerGroupType,
|
|
5111
|
+
resolver,
|
|
5112
|
+
wrapType
|
|
5113
|
+
})
|
|
5114
|
+
];
|
|
5115
|
+
if (children.length) params.push(createParameterGroup({
|
|
5116
|
+
properties: children,
|
|
5117
|
+
default: children.every((c) => c.optional) ? "{}" : void 0
|
|
5118
|
+
}));
|
|
5119
|
+
} else {
|
|
5120
|
+
if (pathParams.length) if (pathParamsType === "inlineSpread") {
|
|
5121
|
+
const spreadType = (_i = resolver == null ? void 0 : resolver.resolvePathParamsName(node, pathParams[0])) != null ? _i : void 0;
|
|
5122
|
+
params.push(createFunctionParameter({
|
|
5123
|
+
name: pathName,
|
|
5124
|
+
type: spreadType ? wrapType(spreadType) : void 0,
|
|
5125
|
+
rest: true
|
|
5126
|
+
}));
|
|
5127
|
+
} else {
|
|
5128
|
+
const pathChildren = pathParams.map((p) => {
|
|
5129
|
+
const type = resolveType({
|
|
5130
|
+
node,
|
|
5131
|
+
param: p,
|
|
5132
|
+
resolver
|
|
5133
|
+
});
|
|
5134
|
+
return createFunctionParameter({
|
|
5135
|
+
name: p.name,
|
|
5136
|
+
type: wrapTypeNode(type),
|
|
5137
|
+
optional: !p.required
|
|
5138
|
+
});
|
|
5139
|
+
});
|
|
5140
|
+
params.push(createParameterGroup({
|
|
5141
|
+
properties: pathChildren,
|
|
5142
|
+
inline: pathParamsType === "inline",
|
|
5143
|
+
default: pathParamsDefault != null ? pathParamsDefault : pathChildren.every((c) => c.optional) ? "{}" : void 0
|
|
5144
|
+
}));
|
|
5145
|
+
}
|
|
5146
|
+
if (bodyType) params.push(createFunctionParameter({
|
|
5147
|
+
name: dataName,
|
|
5148
|
+
type: bodyType,
|
|
5149
|
+
optional: !bodyRequired
|
|
5150
|
+
}));
|
|
5151
|
+
params.push(...buildGroupParam({
|
|
5152
|
+
name: paramsName,
|
|
5153
|
+
node,
|
|
5154
|
+
params: queryParams,
|
|
5155
|
+
groupType: queryGroupType,
|
|
5156
|
+
resolver,
|
|
5157
|
+
wrapType
|
|
5158
|
+
}));
|
|
5159
|
+
params.push(...buildGroupParam({
|
|
5160
|
+
name: headersName,
|
|
5161
|
+
node,
|
|
5162
|
+
params: headerParams,
|
|
5163
|
+
groupType: headerGroupType,
|
|
5164
|
+
resolver,
|
|
5165
|
+
wrapType
|
|
5166
|
+
}));
|
|
5167
|
+
}
|
|
5168
|
+
params.push(...extraParams);
|
|
5169
|
+
return createFunctionParameters({ params });
|
|
5170
|
+
}
|
|
5171
|
+
function buildGroupParam({ name, node, params, groupType, resolver, wrapType }) {
|
|
5172
|
+
if (groupType) return [createFunctionParameter({
|
|
5173
|
+
name,
|
|
5174
|
+
type: groupType.type.variant === "reference" ? wrapType(groupType.type.name) : groupType.type,
|
|
5175
|
+
optional: groupType.optional
|
|
5176
|
+
})];
|
|
5177
|
+
if (params.length) return [createFunctionParameter({
|
|
5178
|
+
name,
|
|
5179
|
+
type: toStructType({
|
|
5180
|
+
node,
|
|
5181
|
+
params,
|
|
5182
|
+
resolver
|
|
5183
|
+
}),
|
|
5184
|
+
optional: params.every((p) => !p.required)
|
|
5185
|
+
})];
|
|
5186
|
+
return [];
|
|
5187
|
+
}
|
|
5188
|
+
function resolveGroupType({ node, params, groupMethod, resolver }) {
|
|
5189
|
+
if (!params.length) return;
|
|
5190
|
+
const firstParam = params[0];
|
|
5191
|
+
const groupName = groupMethod.call(resolver, node, firstParam);
|
|
5192
|
+
if (groupName === resolver.resolveParamName(node, firstParam)) return;
|
|
5193
|
+
const allOptional = params.every((p) => !p.required);
|
|
5194
|
+
return {
|
|
5195
|
+
type: createTypeNode({
|
|
5196
|
+
variant: "reference",
|
|
5197
|
+
name: groupName
|
|
5198
|
+
}),
|
|
5199
|
+
optional: allOptional
|
|
5200
|
+
};
|
|
5201
|
+
}
|
|
5202
|
+
function toStructType({ node, params, resolver }) {
|
|
5203
|
+
return createTypeNode({
|
|
5204
|
+
variant: "struct",
|
|
5205
|
+
properties: params.map((p) => ({
|
|
5206
|
+
name: p.name,
|
|
5207
|
+
optional: !p.required,
|
|
5208
|
+
type: resolveType({
|
|
5209
|
+
node,
|
|
5210
|
+
param: p,
|
|
5211
|
+
resolver
|
|
5212
|
+
})
|
|
5213
|
+
}))
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
4998
5216
|
|
|
4999
5217
|
var __defProp$h = Object.defineProperty;
|
|
5000
5218
|
var __typeError$c = (msg) => {
|
|
@@ -6071,7 +6289,7 @@ const fsStorage = createStorage(() => ({
|
|
|
6071
6289
|
await clean(resolve(base));
|
|
6072
6290
|
}
|
|
6073
6291
|
}));
|
|
6074
|
-
var version$1 = "5.0.0-alpha.
|
|
6292
|
+
var version$1 = "5.0.0-alpha.24";
|
|
6075
6293
|
function getDiagnosticInfo() {
|
|
6076
6294
|
return {
|
|
6077
6295
|
nodeVersion: version$2,
|
|
@@ -6977,7 +7195,7 @@ function satisfiesDependency(dependency, version2, cwd) {
|
|
|
6977
7195
|
return satisfies(semVer, version2);
|
|
6978
7196
|
}
|
|
6979
7197
|
|
|
6980
|
-
var version = "5.0.0-alpha.
|
|
7198
|
+
var version = "5.0.0-alpha.24";
|
|
6981
7199
|
|
|
6982
7200
|
function isCommandMessage(msg) {
|
|
6983
7201
|
return msg.type === "command";
|
|
@@ -209564,8 +209782,7 @@ function getEnumNames({ node, enumType, enumTypeSuffix, resolver }) {
|
|
|
209564
209782
|
const resolved = resolver.default(node.name, "type");
|
|
209565
209783
|
return {
|
|
209566
209784
|
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
|
|
209785
|
+
typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyName(node, enumTypeSuffix) : resolved
|
|
209569
209786
|
};
|
|
209570
209787
|
}
|
|
209571
209788
|
function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
|
|
@@ -209688,10 +209905,10 @@ const printerTs = definePrinter((options) => {
|
|
|
209688
209905
|
date: dateOrStringNode,
|
|
209689
209906
|
time: dateOrStringNode,
|
|
209690
209907
|
ref(node) {
|
|
209691
|
-
var _a;
|
|
209908
|
+
var _a, _b;
|
|
209692
209909
|
if (!node.name) return;
|
|
209693
209910
|
const refName = node.ref ? (_a = node.ref.split("/").at(-1)) != null ? _a : node.name : node.name;
|
|
209694
|
-
return createTypeReferenceNode(node.ref ? this.options.resolver.default(refName, "type") : refName, void 0);
|
|
209911
|
+
return createTypeReferenceNode(node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix && ((_b = this.options.enumSchemaNames) == null ? void 0 : _b.has(refName)) ? this.options.resolver.resolveEnumKeyName({ name: refName }, this.options.enumTypeSuffix) : node.ref ? this.options.resolver.default(refName, "type") : refName, void 0);
|
|
209695
209912
|
},
|
|
209696
209913
|
enum(node) {
|
|
209697
209914
|
var _a, _b, _c, _d;
|
|
@@ -209795,7 +210012,7 @@ const printerTs = definePrinter((options) => {
|
|
|
209795
210012
|
}
|
|
209796
210013
|
};
|
|
209797
210014
|
});
|
|
209798
|
-
function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver }) {
|
|
210015
|
+
function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver, enumSchemaNames }) {
|
|
209799
210016
|
const resolvedDescription = description || (node == null ? void 0 : node.description);
|
|
209800
210017
|
const enumSchemaNodes = collect(node, { schema(n) {
|
|
209801
210018
|
const enumNode = narrowSchema(n, schemaTypes.enum);
|
|
@@ -209810,7 +210027,8 @@ function Type({ name, node, keysToOmit, optionalType, arrayType, syntaxType, enu
|
|
|
209810
210027
|
syntaxType,
|
|
209811
210028
|
description: resolvedDescription,
|
|
209812
210029
|
keysToOmit,
|
|
209813
|
-
resolver
|
|
210030
|
+
resolver,
|
|
210031
|
+
enumSchemaNames
|
|
209814
210032
|
}).print(node);
|
|
209815
210033
|
if (!output) return;
|
|
209816
210034
|
const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node2) => {
|
|
@@ -209950,7 +210168,7 @@ const typeGenerator = defineGenerator({
|
|
|
209950
210168
|
name: "typescript",
|
|
209951
210169
|
type: "react",
|
|
209952
210170
|
Operation({ node, adapter, options, config, resolver }) {
|
|
209953
|
-
var _a, _b, _c;
|
|
210171
|
+
var _a, _b, _c, _d, _e;
|
|
209954
210172
|
const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, transformers = [] } = options;
|
|
209955
210173
|
const root = path$2.resolve(config.root, config.output.path);
|
|
209956
210174
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
@@ -209965,11 +210183,16 @@ const typeGenerator = defineGenerator({
|
|
|
209965
210183
|
group
|
|
209966
210184
|
});
|
|
209967
210185
|
const params = caseParams(node.parameters, paramsCasing);
|
|
210186
|
+
const enumSchemaNames = new Set(((_c = (_b = adapter.rootNode) == null ? void 0 : _b.schemas) != null ? _c : []).filter((s) => narrowSchema(s, schemaTypes.enum) && s.name).map((s) => s.name));
|
|
210187
|
+
function resolveImportName(schemaName) {
|
|
210188
|
+
if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && enumTypeSuffix && enumSchemaNames.has(schemaName)) return resolver.resolveEnumKeyName({ name: schemaName }, enumTypeSuffix);
|
|
210189
|
+
return resolver.default(schemaName, "type");
|
|
210190
|
+
}
|
|
209968
210191
|
function renderSchemaType({ node: schemaNode, name, description, keysToOmit }) {
|
|
209969
210192
|
if (!schemaNode) return null;
|
|
209970
210193
|
const transformedNode = transform(schemaNode, composeTransformers(...transformers));
|
|
209971
210194
|
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
209972
|
-
name:
|
|
210195
|
+
name: resolveImportName(schemaName),
|
|
209973
210196
|
path: resolver.resolveFile({
|
|
209974
210197
|
name: schemaName,
|
|
209975
210198
|
extname: ".ts"
|
|
@@ -209999,17 +210222,18 @@ const typeGenerator = defineGenerator({
|
|
|
209999
210222
|
arrayType,
|
|
210000
210223
|
syntaxType,
|
|
210001
210224
|
resolver,
|
|
210002
|
-
keysToOmit
|
|
210225
|
+
keysToOmit,
|
|
210226
|
+
enumSchemaNames
|
|
210003
210227
|
})] });
|
|
210004
210228
|
}
|
|
210005
210229
|
const paramTypes = params.map((param) => renderSchemaType({
|
|
210006
210230
|
node: param.schema,
|
|
210007
210231
|
name: resolver.resolveParamName(node, param)
|
|
210008
210232
|
}));
|
|
210009
|
-
const requestType = ((
|
|
210233
|
+
const requestType = ((_d = node.requestBody) == null ? void 0 : _d.schema) ? renderSchemaType({
|
|
210010
210234
|
node: node.requestBody.schema,
|
|
210011
210235
|
name: resolver.resolveDataName(node),
|
|
210012
|
-
description: (
|
|
210236
|
+
description: (_e = node.requestBody.description) != null ? _e : node.requestBody.schema.description,
|
|
210013
210237
|
keysToOmit: node.requestBody.keysToOmit
|
|
210014
210238
|
}) : null;
|
|
210015
210239
|
const responseTypes = node.responses.map((res) => renderSchemaType({
|
|
@@ -210066,13 +210290,19 @@ const typeGenerator = defineGenerator({
|
|
|
210066
210290
|
});
|
|
210067
210291
|
},
|
|
210068
210292
|
Schema({ node, adapter, options, config, resolver }) {
|
|
210293
|
+
var _a, _b;
|
|
210069
210294
|
const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, transformers = [] } = options;
|
|
210070
210295
|
const root = path$2.resolve(config.root, config.output.path);
|
|
210071
210296
|
const mode = getMode(path$2.resolve(root, output.path));
|
|
210072
210297
|
if (!node.name) return;
|
|
210073
210298
|
const transformedNode = transform(node, composeTransformers(...transformers));
|
|
210299
|
+
const enumSchemaNames = new Set(((_b = (_a = adapter.rootNode) == null ? void 0 : _a.schemas) != null ? _b : []).filter((s) => narrowSchema(s, schemaTypes.enum) && s.name).map((s) => s.name));
|
|
210300
|
+
function resolveImportName(schemaName) {
|
|
210301
|
+
if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && enumTypeSuffix && enumSchemaNames.has(schemaName)) return resolver.resolveEnumKeyName({ name: schemaName }, enumTypeSuffix);
|
|
210302
|
+
return resolver.default(schemaName, "type");
|
|
210303
|
+
}
|
|
210074
210304
|
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
210075
|
-
name:
|
|
210305
|
+
name: resolveImportName(schemaName),
|
|
210076
210306
|
path: resolver.resolveFile({
|
|
210077
210307
|
name: schemaName,
|
|
210078
210308
|
extname: ".ts"
|
|
@@ -210124,7 +210354,8 @@ const typeGenerator = defineGenerator({
|
|
|
210124
210354
|
optionalType,
|
|
210125
210355
|
arrayType,
|
|
210126
210356
|
syntaxType,
|
|
210127
|
-
resolver
|
|
210357
|
+
resolver,
|
|
210358
|
+
enumSchemaNames
|
|
210128
210359
|
})]
|
|
210129
210360
|
});
|
|
210130
210361
|
}
|
|
@@ -210548,7 +210779,7 @@ const typeGeneratorLegacy = defineGenerator({
|
|
|
210548
210779
|
});
|
|
210549
210780
|
}
|
|
210550
210781
|
});
|
|
210551
|
-
const presets = definePresets({
|
|
210782
|
+
const presets$1 = definePresets({
|
|
210552
210783
|
default: {
|
|
210553
210784
|
name: "default",
|
|
210554
210785
|
resolvers: [resolverTs],
|
|
@@ -210568,7 +210799,7 @@ const pluginTs = createPlugin((options) => {
|
|
|
210568
210799
|
}, 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
210800
|
const preset = getPreset({
|
|
210570
210801
|
preset: compatibilityPreset,
|
|
210571
|
-
presets,
|
|
210802
|
+
presets: presets$1,
|
|
210572
210803
|
resolvers: userResolvers,
|
|
210573
210804
|
transformers: userTransformers,
|
|
210574
210805
|
generators: userGenerators
|
|
@@ -210692,6 +210923,89 @@ const pluginTs = createPlugin((options) => {
|
|
|
210692
210923
|
}
|
|
210693
210924
|
};
|
|
210694
210925
|
});
|
|
210926
|
+
const kindToHandlerKey = {
|
|
210927
|
+
FunctionParameter: "functionParameter",
|
|
210928
|
+
ParameterGroup: "parameterGroup",
|
|
210929
|
+
FunctionParameters: "functionParameters",
|
|
210930
|
+
Type: "type"
|
|
210931
|
+
};
|
|
210932
|
+
const defineFunctionPrinter = createPrinterFactory((node) => kindToHandlerKey[node.kind]);
|
|
210933
|
+
function rank(param) {
|
|
210934
|
+
var _a;
|
|
210935
|
+
if (param.kind === "ParameterGroup") {
|
|
210936
|
+
if (param.default) return 2;
|
|
210937
|
+
return ((_a = param.optional) != null ? _a : param.properties.every((p) => p.optional || p.default !== void 0)) ? 1 : 0;
|
|
210938
|
+
}
|
|
210939
|
+
if (param.rest) return 3;
|
|
210940
|
+
if (param.default) return 2;
|
|
210941
|
+
return param.optional ? 1 : 0;
|
|
210942
|
+
}
|
|
210943
|
+
function sortParams(params) {
|
|
210944
|
+
return [...params].sort((a, b) => rank(a) - rank(b));
|
|
210945
|
+
}
|
|
210946
|
+
function sortChildParams(params) {
|
|
210947
|
+
return [...params].sort((a, b) => rank(a) - rank(b));
|
|
210948
|
+
}
|
|
210949
|
+
const functionPrinter = defineFunctionPrinter((options) => ({
|
|
210950
|
+
name: "functionParameters",
|
|
210951
|
+
options,
|
|
210952
|
+
nodes: {
|
|
210953
|
+
type(node) {
|
|
210954
|
+
if (node.variant === "member") return `${node.base}['${node.key}']`;
|
|
210955
|
+
if (node.variant === "struct") return `{ ${node.properties.map((p) => {
|
|
210956
|
+
const typeStr = this.transform(p.type);
|
|
210957
|
+
return p.optional ? `${p.name}?: ${typeStr}` : `${p.name}: ${typeStr}`;
|
|
210958
|
+
}).join("; ")} }`;
|
|
210959
|
+
if (node.variant === "reference") return node.name;
|
|
210960
|
+
return null;
|
|
210961
|
+
},
|
|
210962
|
+
functionParameter(node) {
|
|
210963
|
+
const { mode, transformName, transformType } = this.options;
|
|
210964
|
+
const name = transformName ? transformName(node.name) : node.name;
|
|
210965
|
+
const rawType = node.type ? this.transform(node.type) : void 0;
|
|
210966
|
+
const type = rawType != null && transformType ? transformType(rawType) : rawType;
|
|
210967
|
+
if (mode === "keys" || mode === "values") return node.rest ? `...${name}` : name;
|
|
210968
|
+
if (mode === "call") return node.rest ? `...${name}` : name;
|
|
210969
|
+
if (node.rest) return type ? `...${name}: ${type}` : `...${name}`;
|
|
210970
|
+
if (type) {
|
|
210971
|
+
if (node.optional) return `${name}?: ${type}`;
|
|
210972
|
+
return node.default ? `${name}: ${type} = ${node.default}` : `${name}: ${type}`;
|
|
210973
|
+
}
|
|
210974
|
+
return node.default ? `${name} = ${node.default}` : name;
|
|
210975
|
+
},
|
|
210976
|
+
parameterGroup(node) {
|
|
210977
|
+
var _a, _b, _c;
|
|
210978
|
+
const { mode, transformName, transformType } = this.options;
|
|
210979
|
+
const sorted = sortChildParams(node.properties);
|
|
210980
|
+
const isOptional = (_a = node.optional) != null ? _a : sorted.every((p) => p.optional || p.default !== void 0);
|
|
210981
|
+
if (node.inline) return sorted.map((p) => this.transform(p)).filter(Boolean).join(", ");
|
|
210982
|
+
if (mode === "keys" || mode === "values") return `{ ${sorted.map((p) => p.name).join(", ")} }`;
|
|
210983
|
+
if (mode === "call") return `{ ${sorted.map((p) => p.name).join(", ")} }`;
|
|
210984
|
+
const names = sorted.map((p) => {
|
|
210985
|
+
return transformName ? transformName(p.name) : p.name;
|
|
210986
|
+
});
|
|
210987
|
+
const nameStr = names.length ? `{ ${names.join(", ")} }` : void 0;
|
|
210988
|
+
if (!nameStr) return null;
|
|
210989
|
+
let typeAnnotation = node.type ? (_b = this.transform(node.type)) != null ? _b : void 0 : void 0;
|
|
210990
|
+
if (!typeAnnotation) {
|
|
210991
|
+
const typeParts = sorted.filter((p) => p.type).map((p) => {
|
|
210992
|
+
const rawT = p.type ? this.transform(p.type) : void 0;
|
|
210993
|
+
const t = rawT != null && transformType ? transformType(rawT) : rawT;
|
|
210994
|
+
return p.optional || p.default !== void 0 ? `${p.name}?: ${t}` : `${p.name}: ${t}`;
|
|
210995
|
+
});
|
|
210996
|
+
typeAnnotation = typeParts.length ? `{ ${typeParts.join("; ")} }` : void 0;
|
|
210997
|
+
}
|
|
210998
|
+
if (typeAnnotation) {
|
|
210999
|
+
if (isOptional) return `${nameStr}: ${typeAnnotation} = ${(_c = node.default) != null ? _c : "{}"}`;
|
|
211000
|
+
return node.default ? `${nameStr}: ${typeAnnotation} = ${node.default}` : `${nameStr}: ${typeAnnotation}`;
|
|
211001
|
+
}
|
|
211002
|
+
return node.default ? `${nameStr} = ${node.default}` : nameStr;
|
|
211003
|
+
},
|
|
211004
|
+
functionParameters(node) {
|
|
211005
|
+
return sortParams(node.params).map((p) => this.transform(p)).filter(Boolean).join(", ");
|
|
211006
|
+
}
|
|
211007
|
+
}
|
|
211008
|
+
}));
|
|
210695
211009
|
|
|
210696
211010
|
function useDriver() {
|
|
210697
211011
|
const { meta } = useFabric();
|
|
@@ -212142,14 +212456,14 @@ function isValidVarName$7(name) {
|
|
|
212142
212456
|
return true;
|
|
212143
212457
|
}
|
|
212144
212458
|
var URLPath$6 = (_a$6 = class {
|
|
212145
|
-
constructor(
|
|
212459
|
+
constructor(path2, options = {}) {
|
|
212146
212460
|
__privateAdd$6(this, _URLPath_instances$6);
|
|
212147
212461
|
/**
|
|
212148
212462
|
* The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
|
|
212149
212463
|
*/
|
|
212150
212464
|
__publicField$6(this, "path");
|
|
212151
212465
|
__privateAdd$6(this, _options$6);
|
|
212152
|
-
this.path =
|
|
212466
|
+
this.path = path2;
|
|
212153
212467
|
__privateSet$6(this, _options$6, options);
|
|
212154
212468
|
}
|
|
212155
212469
|
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
|
|
@@ -212276,80 +212590,63 @@ eachParam_fn$6 = function(fn) {
|
|
|
212276
212590
|
fn(raw, __privateMethod$6(this, _URLPath_instances$6, transformParam_fn$6).call(this, raw));
|
|
212277
212591
|
}
|
|
212278
212592
|
}, _a$6);
|
|
212279
|
-
|
|
212280
|
-
|
|
212281
|
-
|
|
212282
|
-
|
|
212283
|
-
|
|
212284
|
-
|
|
212285
|
-
|
|
212286
|
-
|
|
212287
|
-
|
|
212288
|
-
|
|
212289
|
-
|
|
212290
|
-
|
|
212291
|
-
|
|
212292
|
-
type: (_b = typeSchemas.request) == null ? void 0 : _b.name,
|
|
212293
|
-
optional: isOptional((_c = typeSchemas.request) == null ? void 0 : _c.schema)
|
|
212294
|
-
} : void 0,
|
|
212295
|
-
params: ((_d = typeSchemas.queryParams) == null ? void 0 : _d.name) ? {
|
|
212296
|
-
type: (_e = typeSchemas.queryParams) == null ? void 0 : _e.name,
|
|
212297
|
-
optional: isOptional((_f = typeSchemas.queryParams) == null ? void 0 : _f.schema)
|
|
212298
|
-
} : void 0,
|
|
212299
|
-
headers: ((_g = typeSchemas.headerParams) == null ? void 0 : _g.name) ? {
|
|
212300
|
-
type: (_h = typeSchemas.headerParams) == null ? void 0 : _h.name,
|
|
212301
|
-
optional: isOptional((_i = typeSchemas.headerParams) == null ? void 0 : _i.schema)
|
|
212302
|
-
} : void 0
|
|
212303
|
-
}
|
|
212304
|
-
},
|
|
212305
|
-
options: {
|
|
212306
|
-
type: "Partial<Cypress.RequestOptions>",
|
|
212307
|
-
default: "{}"
|
|
212308
|
-
}
|
|
212309
|
-
});
|
|
212310
|
-
}
|
|
212311
|
-
return FunctionParams.factory({
|
|
212312
|
-
pathParams: ((_j = typeSchemas.pathParams) == null ? void 0 : _j.name) ? {
|
|
212313
|
-
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
212314
|
-
children: getPathParams(typeSchemas.pathParams, {
|
|
212315
|
-
typed: true,
|
|
212316
|
-
casing: paramsCasing
|
|
212593
|
+
const declarationPrinter = functionPrinter({ mode: "declaration" });
|
|
212594
|
+
function getParams$c({ paramsType, pathParamsType, paramsCasing, resolver, node }) {
|
|
212595
|
+
var _a2;
|
|
212596
|
+
const paramsNode = createOperationParams(node, {
|
|
212597
|
+
paramsType,
|
|
212598
|
+
pathParamsType,
|
|
212599
|
+
paramsCasing,
|
|
212600
|
+
resolver,
|
|
212601
|
+
extraParams: [createFunctionParameter({
|
|
212602
|
+
name: "options",
|
|
212603
|
+
type: createTypeNode({
|
|
212604
|
+
variant: "reference",
|
|
212605
|
+
name: "Partial<Cypress.RequestOptions>"
|
|
212317
212606
|
}),
|
|
212318
|
-
default: isAllOptional((_k = typeSchemas.pathParams) == null ? void 0 : _k.schema) ? "{}" : void 0
|
|
212319
|
-
} : void 0,
|
|
212320
|
-
data: ((_l = typeSchemas.request) == null ? void 0 : _l.name) ? {
|
|
212321
|
-
type: (_m = typeSchemas.request) == null ? void 0 : _m.name,
|
|
212322
|
-
optional: isOptional((_n = typeSchemas.request) == null ? void 0 : _n.schema)
|
|
212323
|
-
} : void 0,
|
|
212324
|
-
params: ((_o = typeSchemas.queryParams) == null ? void 0 : _o.name) ? {
|
|
212325
|
-
type: (_p = typeSchemas.queryParams) == null ? void 0 : _p.name,
|
|
212326
|
-
optional: isOptional((_q = typeSchemas.queryParams) == null ? void 0 : _q.schema)
|
|
212327
|
-
} : void 0,
|
|
212328
|
-
headers: ((_r = typeSchemas.headerParams) == null ? void 0 : _r.name) ? {
|
|
212329
|
-
type: (_s = typeSchemas.headerParams) == null ? void 0 : _s.name,
|
|
212330
|
-
optional: isOptional((_t = typeSchemas.headerParams) == null ? void 0 : _t.schema)
|
|
212331
|
-
} : void 0,
|
|
212332
|
-
options: {
|
|
212333
|
-
type: "Partial<Cypress.RequestOptions>",
|
|
212334
212607
|
default: "{}"
|
|
212335
|
-
}
|
|
212608
|
+
})]
|
|
212336
212609
|
});
|
|
212610
|
+
return (_a2 = declarationPrinter.print(paramsNode)) != null ? _a2 : "";
|
|
212337
212611
|
}
|
|
212338
|
-
function Request({ baseURL = "", name, dataReturnType,
|
|
212339
|
-
var _a2
|
|
212340
|
-
const
|
|
212341
|
-
const params = getParams$c({
|
|
212612
|
+
function Request({ baseURL = "", name, dataReturnType, resolver, node, paramsType, pathParamsType, paramsCasing }) {
|
|
212613
|
+
var _a2;
|
|
212614
|
+
const paramsSignature = getParams$c({
|
|
212342
212615
|
paramsType,
|
|
212343
|
-
paramsCasing,
|
|
212344
212616
|
pathParamsType,
|
|
212345
|
-
|
|
212617
|
+
paramsCasing,
|
|
212618
|
+
resolver,
|
|
212619
|
+
node
|
|
212620
|
+
});
|
|
212621
|
+
const responseType = resolver.resolveResponseName(node);
|
|
212622
|
+
const returnType = dataReturnType === "data" ? `Cypress.Chainable<${responseType}>` : `Cypress.Chainable<Cypress.Response<${responseType}>>`;
|
|
212623
|
+
const casedPathParams = caseParams(node.parameters.filter((p) => p.in === "path"), paramsCasing);
|
|
212624
|
+
const pathParamNameMap = new Map(casedPathParams.map((p) => [camelCase$8(p.name), p.name]));
|
|
212625
|
+
const urlTemplate = new URLPath$6(node.path, { casing: paramsCasing }).toTemplateString({
|
|
212626
|
+
prefix: baseURL,
|
|
212627
|
+
replacer: (param) => {
|
|
212628
|
+
var _a3;
|
|
212629
|
+
return (_a3 = pathParamNameMap.get(camelCase$8(param))) != null ? _a3 : param;
|
|
212630
|
+
}
|
|
212346
212631
|
});
|
|
212347
|
-
const
|
|
212348
|
-
const
|
|
212349
|
-
|
|
212350
|
-
|
|
212351
|
-
|
|
212352
|
-
|
|
212632
|
+
const requestOptions = [`method: '${node.method}'`, `url: ${urlTemplate}`];
|
|
212633
|
+
const queryParams = node.parameters.filter((p) => p.in === "query");
|
|
212634
|
+
if (queryParams.length > 0) {
|
|
212635
|
+
const casedQueryParams = caseParams(queryParams, paramsCasing);
|
|
212636
|
+
if (casedQueryParams.some((p, i) => p.name !== queryParams[i].name)) {
|
|
212637
|
+
const pairs = queryParams.map((orig, i) => `${orig.name}: params.${casedQueryParams[i].name}`).join(", ");
|
|
212638
|
+
requestOptions.push(`qs: params ? { ${pairs} } : undefined`);
|
|
212639
|
+
} else requestOptions.push("qs: params");
|
|
212640
|
+
}
|
|
212641
|
+
const headerParams = node.parameters.filter((p) => p.in === "header");
|
|
212642
|
+
if (headerParams.length > 0) {
|
|
212643
|
+
const casedHeaderParams = caseParams(headerParams, paramsCasing);
|
|
212644
|
+
if (casedHeaderParams.some((p, i) => p.name !== headerParams[i].name)) {
|
|
212645
|
+
const pairs = headerParams.map((orig, i) => `'${orig.name}': headers.${casedHeaderParams[i].name}`).join(", ");
|
|
212646
|
+
requestOptions.push(`headers: headers ? { ${pairs} } : undefined`);
|
|
212647
|
+
} else requestOptions.push("headers");
|
|
212648
|
+
}
|
|
212649
|
+
if ((_a2 = node.requestBody) == null ? void 0 : _a2.schema) requestOptions.push("body: data");
|
|
212353
212650
|
requestOptions.push("...options");
|
|
212354
212651
|
return /* @__PURE__ */ jsx(File.Source, {
|
|
212355
212652
|
name,
|
|
@@ -212358,135 +212655,185 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method,
|
|
|
212358
212655
|
children: /* @__PURE__ */ jsx(Function$1, {
|
|
212359
212656
|
name,
|
|
212360
212657
|
export: true,
|
|
212361
|
-
params:
|
|
212658
|
+
params: paramsSignature,
|
|
212362
212659
|
returnType,
|
|
212363
|
-
children: dataReturnType === "data" ? `return cy.request<${
|
|
212660
|
+
children: dataReturnType === "data" ? `return cy.request<${responseType}>({
|
|
212364
212661
|
${requestOptions.join(",\n ")}
|
|
212365
|
-
}).then((res) => res.body)` : `return cy.request<${
|
|
212662
|
+
}).then((res) => res.body)` : `return cy.request<${responseType}>({
|
|
212366
212663
|
${requestOptions.join(",\n ")}
|
|
212367
212664
|
})`
|
|
212368
212665
|
})
|
|
212369
212666
|
});
|
|
212370
212667
|
}
|
|
212371
212668
|
Request.getParams = getParams$c;
|
|
212372
|
-
|
|
212373
|
-
const cypressGenerator = createReactGenerator({
|
|
212669
|
+
const cypressGenerator = defineGenerator({
|
|
212374
212670
|
name: "cypress",
|
|
212375
|
-
|
|
212376
|
-
|
|
212377
|
-
|
|
212378
|
-
const
|
|
212379
|
-
const
|
|
212380
|
-
const
|
|
212381
|
-
|
|
212382
|
-
|
|
212383
|
-
|
|
212384
|
-
|
|
212385
|
-
|
|
212386
|
-
|
|
212387
|
-
|
|
212388
|
-
|
|
212389
|
-
|
|
212390
|
-
|
|
212391
|
-
};
|
|
212671
|
+
type: "react",
|
|
212672
|
+
Operation({ node, adapter, options, config, driver, resolver }) {
|
|
212673
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
212674
|
+
const { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType, group } = options;
|
|
212675
|
+
const root = path$2.resolve(config.root, config.output.path);
|
|
212676
|
+
const pluginTs = driver.getPlugin(pluginTsName);
|
|
212677
|
+
if (!pluginTs) return null;
|
|
212678
|
+
const file = resolver.resolveFile({
|
|
212679
|
+
name: node.operationId,
|
|
212680
|
+
extname: ".ts",
|
|
212681
|
+
tag: (_a2 = node.tags[0]) != null ? _a2 : "default",
|
|
212682
|
+
path: node.path
|
|
212683
|
+
}, {
|
|
212684
|
+
root,
|
|
212685
|
+
output,
|
|
212686
|
+
group
|
|
212687
|
+
});
|
|
212688
|
+
const tsFile = pluginTs.resolver.resolveFile({
|
|
212689
|
+
name: node.operationId,
|
|
212690
|
+
extname: ".ts",
|
|
212691
|
+
tag: (_b = node.tags[0]) != null ? _b : "default",
|
|
212692
|
+
path: node.path
|
|
212693
|
+
}, {
|
|
212694
|
+
root,
|
|
212695
|
+
output: (_d = (_c = pluginTs.options) == null ? void 0 : _c.output) != null ? _d : output,
|
|
212696
|
+
group: (_e = pluginTs.options) == null ? void 0 : _e.group
|
|
212697
|
+
});
|
|
212698
|
+
const name = resolver.resolveName(node.operationId);
|
|
212699
|
+
const casedParams = caseParams(node.parameters, paramsCasing);
|
|
212700
|
+
const tsResolver = pluginTs.resolver;
|
|
212701
|
+
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
212702
|
+
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
212703
|
+
const headerParams = casedParams.filter((p) => p.in === "header");
|
|
212704
|
+
const importedTypeNames = [
|
|
212705
|
+
...pathParams.length && tsResolver.resolvePathParamsName ? pathParams.map((p) => tsResolver.resolvePathParamsName(node, p)) : pathParams.map((p) => tsResolver.resolveParamName(node, p)),
|
|
212706
|
+
...queryParams.length && tsResolver.resolveQueryParamsName ? queryParams.map((p) => tsResolver.resolveQueryParamsName(node, p)) : queryParams.map((p) => tsResolver.resolveParamName(node, p)),
|
|
212707
|
+
...headerParams.length && tsResolver.resolveHeaderParamsName ? headerParams.map((p) => tsResolver.resolveHeaderParamsName(node, p)) : headerParams.map((p) => tsResolver.resolveParamName(node, p)),
|
|
212708
|
+
((_f = node.requestBody) == null ? void 0 : _f.schema) ? tsResolver.resolveDataName(node) : void 0,
|
|
212709
|
+
tsResolver.resolveResponseName(node)
|
|
212710
|
+
].filter(Boolean);
|
|
212392
212711
|
return /* @__PURE__ */ jsxs(File, {
|
|
212393
|
-
baseName:
|
|
212394
|
-
path:
|
|
212395
|
-
meta:
|
|
212396
|
-
banner:
|
|
212397
|
-
oas,
|
|
212712
|
+
baseName: file.baseName,
|
|
212713
|
+
path: file.path,
|
|
212714
|
+
meta: file.meta,
|
|
212715
|
+
banner: resolver.resolveBanner(adapter.rootNode, {
|
|
212398
212716
|
output,
|
|
212399
|
-
config
|
|
212717
|
+
config
|
|
212400
212718
|
}),
|
|
212401
|
-
footer:
|
|
212402
|
-
|
|
212403
|
-
|
|
212719
|
+
footer: resolver.resolveFooter(adapter.rootNode, {
|
|
212720
|
+
output,
|
|
212721
|
+
config
|
|
212404
212722
|
}),
|
|
212405
|
-
children: [/* @__PURE__ */ jsx(File.Import, {
|
|
212406
|
-
name:
|
|
212407
|
-
|
|
212408
|
-
|
|
212409
|
-
(_b = type.schemas.pathParams) == null ? void 0 : _b.name,
|
|
212410
|
-
(_c = type.schemas.queryParams) == null ? void 0 : _c.name,
|
|
212411
|
-
(_d = type.schemas.headerParams) == null ? void 0 : _d.name,
|
|
212412
|
-
...((_e = type.schemas.statusCodes) == null ? void 0 : _e.map((item) => item.name)) || []
|
|
212413
|
-
].filter(Boolean),
|
|
212414
|
-
root: request.file.path,
|
|
212415
|
-
path: type.file.path,
|
|
212723
|
+
children: [tsFile && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
212724
|
+
name: Array.from(new Set(importedTypeNames)),
|
|
212725
|
+
root: file.path,
|
|
212726
|
+
path: tsFile.path,
|
|
212416
212727
|
isTypeOnly: true
|
|
212417
212728
|
}), /* @__PURE__ */ jsx(Request, {
|
|
212418
|
-
name
|
|
212729
|
+
name,
|
|
212730
|
+
node,
|
|
212731
|
+
resolver: tsResolver,
|
|
212419
212732
|
dataReturnType,
|
|
212420
212733
|
paramsCasing,
|
|
212421
212734
|
paramsType,
|
|
212422
212735
|
pathParamsType,
|
|
212423
|
-
|
|
212424
|
-
method: operation.method,
|
|
212425
|
-
baseURL,
|
|
212426
|
-
url: operation.path
|
|
212736
|
+
baseURL
|
|
212427
212737
|
})]
|
|
212428
212738
|
});
|
|
212429
212739
|
}
|
|
212430
212740
|
});
|
|
212431
|
-
|
|
212741
|
+
const resolverCypress = defineResolver(() => ({
|
|
212742
|
+
name: "default",
|
|
212743
|
+
pluginName: "plugin-cypress",
|
|
212744
|
+
default(name, type) {
|
|
212745
|
+
return camelCase$8(name, { isFile: type === "file" });
|
|
212746
|
+
},
|
|
212747
|
+
resolveName(name) {
|
|
212748
|
+
return this.default(name, "function");
|
|
212749
|
+
}
|
|
212750
|
+
}));
|
|
212751
|
+
const presets = definePresets({
|
|
212752
|
+
default: {
|
|
212753
|
+
name: "default",
|
|
212754
|
+
resolvers: [resolverCypress],
|
|
212755
|
+
generators: [cypressGenerator]
|
|
212756
|
+
},
|
|
212757
|
+
kubbV4: {
|
|
212758
|
+
name: "kubbV4",
|
|
212759
|
+
resolvers: [resolverCypress],
|
|
212760
|
+
generators: [cypressGenerator]
|
|
212761
|
+
}
|
|
212762
|
+
});
|
|
212432
212763
|
const pluginCypressName = "plugin-cypress";
|
|
212433
212764
|
const pluginCypress = createPlugin((options) => {
|
|
212434
212765
|
const { output = {
|
|
212435
212766
|
path: "cypress",
|
|
212436
212767
|
barrelType: "named"
|
|
212437
|
-
}, group, dataReturnType = "data", exclude = [], include, override = [],
|
|
212768
|
+
}, group, dataReturnType = "data", exclude = [], include, override = [], baseURL, paramsCasing, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", compatibilityPreset = "default", resolvers: userResolvers = [], transformers: userTransformers = [], generators: userGenerators = [] } = options;
|
|
212769
|
+
const preset = getPreset({
|
|
212770
|
+
preset: compatibilityPreset,
|
|
212771
|
+
presets,
|
|
212772
|
+
resolvers: [resolverCypress, ...userResolvers],
|
|
212773
|
+
transformers: userTransformers,
|
|
212774
|
+
generators: userGenerators
|
|
212775
|
+
});
|
|
212438
212776
|
return {
|
|
212439
212777
|
name: pluginCypressName,
|
|
212440
|
-
|
|
212441
|
-
|
|
212442
|
-
dataReturnType,
|
|
212443
|
-
group,
|
|
212444
|
-
baseURL,
|
|
212445
|
-
paramsCasing,
|
|
212446
|
-
paramsType,
|
|
212447
|
-
pathParamsType
|
|
212448
|
-
},
|
|
212449
|
-
pre: [pluginOasName, pluginTsName].filter(Boolean),
|
|
212450
|
-
resolvePath(baseName, pathMode, options2) {
|
|
212451
|
-
var _a, _b;
|
|
212452
|
-
const root = path$2.resolve(this.config.root, this.config.output.path);
|
|
212453
|
-
if ((pathMode != null ? pathMode : getMode(path$2.resolve(root, output.path))) === "single")
|
|
212454
|
-
return path$2.resolve(root, output.path);
|
|
212455
|
-
if (group && (((_a = options2 == null ? void 0 : options2.group) == null ? void 0 : _a.path) || ((_b = options2 == null ? void 0 : options2.group) == null ? void 0 : _b.tag))) {
|
|
212456
|
-
const groupName = (group == null ? void 0 : group.name) ? group.name : (ctx) => {
|
|
212457
|
-
if ((group == null ? void 0 : group.type) === "path") return `${ctx.group.split("/")[1]}`;
|
|
212458
|
-
return `${camelCase$8(ctx.group)}Requests`;
|
|
212459
|
-
};
|
|
212460
|
-
return path$2.resolve(root, output.path, groupName({ group: group.type === "path" ? options2.group.path : options2.group.tag }), baseName);
|
|
212461
|
-
}
|
|
212462
|
-
return path$2.resolve(root, output.path, baseName);
|
|
212778
|
+
get resolver() {
|
|
212779
|
+
return preset.resolver;
|
|
212463
212780
|
},
|
|
212464
|
-
|
|
212465
|
-
var
|
|
212466
|
-
|
|
212467
|
-
|
|
212468
|
-
|
|
212781
|
+
get options() {
|
|
212782
|
+
var _a2;
|
|
212783
|
+
return {
|
|
212784
|
+
output,
|
|
212785
|
+
dataReturnType,
|
|
212786
|
+
group: group ? {
|
|
212787
|
+
...options.group,
|
|
212788
|
+
name: ((_a2 = options.group) == null ? void 0 : _a2.name) ? options.group.name : (ctx) => {
|
|
212789
|
+
if (group.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
212790
|
+
return `${camelCase$8(ctx.group)}Requests`;
|
|
212791
|
+
}
|
|
212792
|
+
} : void 0,
|
|
212793
|
+
baseURL,
|
|
212794
|
+
paramsCasing,
|
|
212795
|
+
paramsType,
|
|
212796
|
+
pathParamsType,
|
|
212797
|
+
resolver: preset.resolver,
|
|
212798
|
+
transformers: preset.transformers
|
|
212799
|
+
};
|
|
212469
212800
|
},
|
|
212801
|
+
pre: [pluginTsName].filter(Boolean),
|
|
212470
212802
|
async install() {
|
|
212471
|
-
var
|
|
212472
|
-
const
|
|
212473
|
-
const
|
|
212474
|
-
const
|
|
212475
|
-
|
|
212476
|
-
|
|
212477
|
-
|
|
212478
|
-
|
|
212479
|
-
|
|
212480
|
-
|
|
212481
|
-
|
|
212482
|
-
|
|
212483
|
-
|
|
212484
|
-
|
|
212485
|
-
|
|
212486
|
-
|
|
212487
|
-
|
|
212803
|
+
var _a2;
|
|
212804
|
+
const { config, fabric, plugin, adapter, rootNode, driver } = this;
|
|
212805
|
+
const root = path$2.resolve(config.root, config.output.path);
|
|
212806
|
+
const resolver = preset.resolver;
|
|
212807
|
+
if (!adapter) throw new Error("Plugin cannot work without adapter being set");
|
|
212808
|
+
await walk(rootNode, {
|
|
212809
|
+
depth: "shallow",
|
|
212810
|
+
async operation(operationNode) {
|
|
212811
|
+
const writeTasks = preset.generators.map(async (generator) => {
|
|
212812
|
+
if (generator.type === "react" && generator.version === "2") {
|
|
212813
|
+
const resolvedOptions = resolver.resolveOptions(operationNode, {
|
|
212814
|
+
options: plugin.options,
|
|
212815
|
+
exclude,
|
|
212816
|
+
include,
|
|
212817
|
+
override
|
|
212818
|
+
});
|
|
212819
|
+
if (resolvedOptions === null) return;
|
|
212820
|
+
await renderOperation$1(operationNode, {
|
|
212821
|
+
options: resolvedOptions,
|
|
212822
|
+
adapter,
|
|
212823
|
+
config,
|
|
212824
|
+
fabric,
|
|
212825
|
+
Component: generator.Operation,
|
|
212826
|
+
plugin,
|
|
212827
|
+
driver,
|
|
212828
|
+
resolver
|
|
212829
|
+
});
|
|
212830
|
+
}
|
|
212831
|
+
});
|
|
212832
|
+
await Promise.all(writeTasks);
|
|
212833
|
+
}
|
|
212834
|
+
});
|
|
212488
212835
|
const barrelFiles = await getBarrelFiles(this.fabric.files, {
|
|
212489
|
-
type: (
|
|
212836
|
+
type: (_a2 = output.barrelType) != null ? _a2 : "named",
|
|
212490
212837
|
root,
|
|
212491
212838
|
output,
|
|
212492
212839
|
meta: { pluginName: this.plugin.name }
|