@zimic/http 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OFNBRVSF.js → chunk-B2CEMX5F.js} +69 -51
- package/dist/chunk-B2CEMX5F.js.map +1 -0
- package/dist/{chunk-ZPOGWLJW.mjs → chunk-CGLPJU2K.mjs} +67 -49
- package/dist/chunk-CGLPJU2K.mjs.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/typegen.js +2 -2
- package/dist/typegen.mjs +1 -1
- package/package.json +5 -5
- package/src/typegen/openapi/generate.ts +11 -10
- package/src/typegen/openapi/transform/filters.ts +7 -3
- package/src/typegen/openapi/transform/io.ts +16 -10
- package/src/utils/files.ts +26 -0
- package/dist/chunk-OFNBRVSF.js.map +0 -1
- package/dist/chunk-ZPOGWLJW.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import filesystem from 'fs/promises';
|
|
2
1
|
import path from 'path';
|
|
3
2
|
import ts3 from 'typescript';
|
|
4
|
-
import
|
|
3
|
+
import color3 from 'picocolors';
|
|
4
|
+
import fs from 'fs';
|
|
5
5
|
|
|
6
6
|
// ../zimic-utils/dist/chunk-5UH44FTS.mjs
|
|
7
7
|
function isDefined(value) {
|
|
@@ -117,7 +117,7 @@ var Logger = class _Logger {
|
|
|
117
117
|
};
|
|
118
118
|
var Logger_default = Logger;
|
|
119
119
|
var logger = new Logger_default({
|
|
120
|
-
prefix:
|
|
120
|
+
prefix: color3.cyan("[@zimic/http]")
|
|
121
121
|
});
|
|
122
122
|
function createOperationsIdentifierText(serviceName) {
|
|
123
123
|
return `${serviceName}Operations`;
|
|
@@ -394,7 +394,7 @@ function normalizeResponse(response, context, options = {}) {
|
|
|
394
394
|
const mappedType = NON_NUMERIC_RESPONSE_STATUS_TO_MAPPED_TYPE[statusCode];
|
|
395
395
|
if (!mappedType) {
|
|
396
396
|
logger.warn(
|
|
397
|
-
`Warning: Response has a non-standard status code: ${
|
|
397
|
+
`Warning: Response has a non-standard status code: ${color3.yellow(response.name.text)}. Consider replacing it with a number (e.g. '200'), a pattern ('1xx', '2xx', '3xx', '4xx', or '5xx'), or 'default'.`
|
|
398
398
|
);
|
|
399
399
|
return void 0;
|
|
400
400
|
}
|
|
@@ -645,24 +645,24 @@ function isPath(node) {
|
|
|
645
645
|
function normalizePathNameWithParameters(pathName) {
|
|
646
646
|
return pathName.replace(/{([^}]+)}/g, ":$1");
|
|
647
647
|
}
|
|
648
|
-
function normalizePath(
|
|
648
|
+
function normalizePath(path3, context, options = {}) {
|
|
649
649
|
const { isComponent: isComponent2 = false } = options;
|
|
650
|
-
if (!isPath(
|
|
650
|
+
if (!isPath(path3)) {
|
|
651
651
|
return void 0;
|
|
652
652
|
}
|
|
653
|
-
const newPathName = isComponent2 ?
|
|
654
|
-
const newIdentifier = isComponent2 ?
|
|
653
|
+
const newPathName = isComponent2 ? path3.name.text : normalizePathNameWithParameters(path3.name.text);
|
|
654
|
+
const newIdentifier = isComponent2 ? path3.name : ts3.factory.createStringLiteral(newPathName);
|
|
655
655
|
let newType;
|
|
656
|
-
if (ts3.isTypeLiteralNode(
|
|
657
|
-
const newMethods =
|
|
656
|
+
if (ts3.isTypeLiteralNode(path3.type)) {
|
|
657
|
+
const newMethods = path3.type.members.map((method) => normalizeMethod(method, context, { pathName: newPathName })).filter(isDefined_default);
|
|
658
658
|
if (newMethods.length === 0) {
|
|
659
659
|
return void 0;
|
|
660
660
|
}
|
|
661
|
-
newType = ts3.factory.updateTypeLiteralNode(
|
|
661
|
+
newType = ts3.factory.updateTypeLiteralNode(path3.type, ts3.factory.createNodeArray(newMethods));
|
|
662
662
|
} else {
|
|
663
|
-
newType = renameComponentReferences(
|
|
663
|
+
newType = renameComponentReferences(path3.type, context);
|
|
664
664
|
}
|
|
665
|
-
return ts3.factory.updatePropertySignature(
|
|
665
|
+
return ts3.factory.updatePropertySignature(path3, path3.modifiers, newIdentifier, path3.questionToken, newType);
|
|
666
666
|
}
|
|
667
667
|
function wrapPathsType(type, context) {
|
|
668
668
|
context.typeImports.http.add("HttpSchema");
|
|
@@ -672,7 +672,7 @@ function wrapPathsType(type, context) {
|
|
|
672
672
|
function normalizePaths(pathsOrTypeAlias, context) {
|
|
673
673
|
const newIdentifier = createPathsIdentifier(context.serviceName);
|
|
674
674
|
const paths = ts3.isTypeAliasDeclaration(pathsOrTypeAlias) ? ts3.factory.createInterfaceDeclaration(pathsOrTypeAlias.modifiers, pathsOrTypeAlias.name, void 0, void 0, []) : pathsOrTypeAlias;
|
|
675
|
-
const newMembers = paths.members.map((
|
|
675
|
+
const newMembers = paths.members.map((path3) => normalizePath(path3, context)).filter(isDefined_default);
|
|
676
676
|
const newType = ts3.factory.createTypeLiteralNode(newMembers);
|
|
677
677
|
return ts3.factory.createTypeAliasDeclaration(
|
|
678
678
|
paths.modifiers,
|
|
@@ -977,9 +977,9 @@ var isNonEmpty_default = isNonEmpty;
|
|
|
977
977
|
function createPathCharactersToEscapeRegex() {
|
|
978
978
|
return /([.(){}+$])/g;
|
|
979
979
|
}
|
|
980
|
-
function preparePathForRegex(
|
|
981
|
-
const pathURLPrefix = `data:${
|
|
982
|
-
const pathAsURL = new URL(`${pathURLPrefix}${
|
|
980
|
+
function preparePathForRegex(path3) {
|
|
981
|
+
const pathURLPrefix = `data:${path3.startsWith("/") ? "" : "/"}`;
|
|
982
|
+
const pathAsURL = new URL(`${pathURLPrefix}${path3}`);
|
|
983
983
|
const encodedPath = pathAsURL.href.replace(pathURLPrefix, "");
|
|
984
984
|
return encodedPath.replace(/^\/+/g, "").replace(/\/+$/g, "").replace(createPathCharactersToEscapeRegex(), "\\$1");
|
|
985
985
|
}
|
|
@@ -994,8 +994,8 @@ function getDoubleWildcardPathRegex() {
|
|
|
994
994
|
function getTripleWildcardPathRegex() {
|
|
995
995
|
return /(?<escape>\\)?\*\*\/\*(?<wildcardSuffix>[^*]|$)/g;
|
|
996
996
|
}
|
|
997
|
-
function createWildcardRegexFromPath(
|
|
998
|
-
const pathRegexContent = preparePathForRegex(
|
|
997
|
+
function createWildcardRegexFromPath(path3) {
|
|
998
|
+
const pathRegexContent = preparePathForRegex(path3).replace(getTripleWildcardPathRegex(), (_match, escape, wildcardSuffix) => {
|
|
999
999
|
return escape === "\\" ? `\\*\\*/\\*${wildcardSuffix}` : `**${wildcardSuffix}`;
|
|
1000
1000
|
}).replace(
|
|
1001
1001
|
getSingleWildcardPathRegex(),
|
|
@@ -1008,6 +1008,27 @@ function createWildcardRegexFromPath(path4) {
|
|
|
1008
1008
|
return new RegExp(`^/?${pathRegexContent}/?$`);
|
|
1009
1009
|
}
|
|
1010
1010
|
var createWildcardRegexFromPath_default = createWildcardRegexFromPath;
|
|
1011
|
+
|
|
1012
|
+
// ../zimic-utils/dist/import/createCachedDynamicImport.mjs
|
|
1013
|
+
function createCachedDynamicImport(importModuleDynamically) {
|
|
1014
|
+
let cachedImportResult;
|
|
1015
|
+
return async function importModuleDynamicallyWithCache() {
|
|
1016
|
+
cachedImportResult ??= await importModuleDynamically();
|
|
1017
|
+
return cachedImportResult;
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
var createCachedDynamicImport_default = createCachedDynamicImport;
|
|
1021
|
+
async function ensurePathExists(path3, options) {
|
|
1022
|
+
try {
|
|
1023
|
+
await fs.promises.access(path3, fs.constants.R_OK);
|
|
1024
|
+
} catch (accessError) {
|
|
1025
|
+
const error = new Error(options.errorMessage);
|
|
1026
|
+
error.cause = accessError;
|
|
1027
|
+
throw error;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// src/typegen/openapi/transform/filters.ts
|
|
1011
1032
|
var HTTP_METHOD_OPTIONS = HTTP_METHODS.join("|");
|
|
1012
1033
|
var MODIFIER_GROUP = "(?<modifier>!?)";
|
|
1013
1034
|
var METHOD_FILTER_GROUP = `(?<method>(?:\\*|(?:${HTTP_METHOD_OPTIONS})(?:,\\s*(?:${HTTP_METHOD_OPTIONS}))*))`;
|
|
@@ -1018,7 +1039,7 @@ function parseRawFilter(rawFilter) {
|
|
|
1018
1039
|
const { modifier: filterModifier, method: filteredMethodsOrWildcard, path: filteredPath } = filterMatch?.groups ?? {};
|
|
1019
1040
|
const isValidFilter = !filteredMethodsOrWildcard || !filteredPath;
|
|
1020
1041
|
if (isValidFilter) {
|
|
1021
|
-
logger.warn(`Warning: Filter could not be parsed and was ignored: ${
|
|
1042
|
+
logger.warn(`Warning: Filter could not be parsed and was ignored: ${color3.yellow(rawFilter)}`);
|
|
1022
1043
|
return void 0;
|
|
1023
1044
|
}
|
|
1024
1045
|
return {
|
|
@@ -1043,7 +1064,10 @@ function groupParsedFiltersByMatch(parsedFilters) {
|
|
|
1043
1064
|
);
|
|
1044
1065
|
}
|
|
1045
1066
|
async function readPathFiltersFromFile(filePath) {
|
|
1046
|
-
|
|
1067
|
+
await ensurePathExists(filePath, {
|
|
1068
|
+
errorMessage: `Could not read filter file: ${color3.yellow(filePath)}`
|
|
1069
|
+
});
|
|
1070
|
+
const fileContent = await fs.promises.readFile(filePath, "utf-8");
|
|
1047
1071
|
const fileContentWithoutComments = fileContent.replace(/#.*$/gm, "");
|
|
1048
1072
|
const filters = fileContentWithoutComments.split("\n");
|
|
1049
1073
|
return filters;
|
|
@@ -1082,16 +1106,6 @@ function createImportDeclarations(context) {
|
|
|
1082
1106
|
const httpImportDeclaration = createImportDeclaration(httpTypeImports, TYPEGEN_HTTP_IMPORT_MODULE);
|
|
1083
1107
|
return [httpImportDeclaration];
|
|
1084
1108
|
}
|
|
1085
|
-
|
|
1086
|
-
// ../zimic-utils/dist/import/createCachedDynamicImport.mjs
|
|
1087
|
-
function createCachedDynamicImport(importModuleDynamically) {
|
|
1088
|
-
let cachedImportResult;
|
|
1089
|
-
return async function importModuleDynamicallyWithCache() {
|
|
1090
|
-
cachedImportResult ??= await importModuleDynamically();
|
|
1091
|
-
return cachedImportResult;
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
var createCachedDynamicImport_default = createCachedDynamicImport;
|
|
1095
1109
|
var importOpenapiTypeScript = createCachedDynamicImport_default(() => import('openapi-typescript'));
|
|
1096
1110
|
function transformSchemaObject(schemaObject) {
|
|
1097
1111
|
if (schemaObject.format === "binary") {
|
|
@@ -1133,25 +1147,29 @@ async function importTypesFromOpenAPI(filePathOrURL) {
|
|
|
1133
1147
|
}
|
|
1134
1148
|
async function convertTypesToString(nodes, options) {
|
|
1135
1149
|
const { astToString: convertTypeASTToString } = await importOpenapiTypeScript();
|
|
1136
|
-
const
|
|
1150
|
+
const typegenResult = convertTypeASTToString(nodes, {
|
|
1137
1151
|
formatOptions: { removeComments: !options.includeComments }
|
|
1138
1152
|
});
|
|
1139
|
-
return
|
|
1153
|
+
return typegenResult;
|
|
1140
1154
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1155
|
+
function formatTypegenResultToOutput(typegenResult) {
|
|
1156
|
+
const formattedResult = typegenResult.replace(/^export (\w+)/gm, "\nexport $1").replace(/^( {4})+/gm, (match) => match.replace(/ {4}/g, " "));
|
|
1157
|
+
return [
|
|
1144
1158
|
"// Auto-generated by @zimic/http.",
|
|
1145
1159
|
"// NOTE: Do not manually edit this file. Changes will be overridden.\n",
|
|
1146
|
-
|
|
1160
|
+
formattedResult
|
|
1147
1161
|
].join("\n");
|
|
1148
|
-
return formattedOutputWithPrefix;
|
|
1149
1162
|
}
|
|
1150
|
-
async function
|
|
1163
|
+
async function writeTypegenResultToStandardOutput(typegenResult) {
|
|
1151
1164
|
await new Promise((resolve) => {
|
|
1152
|
-
process.stdout.write(
|
|
1165
|
+
process.stdout.write(typegenResult, "utf-8", resolve);
|
|
1153
1166
|
});
|
|
1154
1167
|
}
|
|
1168
|
+
async function writeTypegenResultToFile(outputFilePath, formattedResult) {
|
|
1169
|
+
const outputDirectory = path.dirname(outputFilePath);
|
|
1170
|
+
await fs.promises.mkdir(outputDirectory, { recursive: true });
|
|
1171
|
+
await fs.promises.writeFile(outputFilePath, formattedResult);
|
|
1172
|
+
}
|
|
1155
1173
|
|
|
1156
1174
|
// src/typegen/openapi/generate.ts
|
|
1157
1175
|
var RESOURCES_TO_REMOVE_IF_NOT_NORMALIZED = ["paths", "webhooks", "operations", "components", "$defs"];
|
|
@@ -1188,7 +1206,7 @@ async function generateTypesFromOpenAPI({
|
|
|
1188
1206
|
filters: filtersFromArguments = [],
|
|
1189
1207
|
filterFile
|
|
1190
1208
|
}) {
|
|
1191
|
-
const filtersFromFile = filterFile ? await readPathFiltersFromFile(filterFile) : [];
|
|
1209
|
+
const filtersFromFile = filterFile ? await readPathFiltersFromFile(path.resolve(filterFile)) : [];
|
|
1192
1210
|
const filters = ignoreEmptyFilters([...filtersFromFile, ...filtersFromArguments]);
|
|
1193
1211
|
const rawNodes = await importTypesFromOpenAPI(inputFilePathOrURL);
|
|
1194
1212
|
const context = createTypeTransformationContext(serviceName, filters);
|
|
@@ -1197,13 +1215,13 @@ async function generateTypesFromOpenAPI({
|
|
|
1197
1215
|
for (const declaration of importDeclarations) {
|
|
1198
1216
|
nodes.unshift(declaration);
|
|
1199
1217
|
}
|
|
1200
|
-
const
|
|
1201
|
-
const
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
await
|
|
1218
|
+
const typegenResult = await convertTypesToString(nodes, { includeComments });
|
|
1219
|
+
const formattedTypegenResult = formatTypegenResultToOutput(typegenResult);
|
|
1220
|
+
const shouldWriteToStandardOutput = outputFilePath === void 0;
|
|
1221
|
+
if (shouldWriteToStandardOutput) {
|
|
1222
|
+
await writeTypegenResultToStandardOutput(formattedTypegenResult);
|
|
1205
1223
|
} else {
|
|
1206
|
-
await
|
|
1224
|
+
await writeTypegenResultToFile(path.resolve(outputFilePath), formattedTypegenResult);
|
|
1207
1225
|
}
|
|
1208
1226
|
}
|
|
1209
1227
|
var generate_default = generateTypesFromOpenAPI;
|
|
@@ -1248,5 +1266,5 @@ var generate_default = generateTypesFromOpenAPI;
|
|
|
1248
1266
|
* The root import module is defined at build time. The fallback is not expected to be used. */
|
|
1249
1267
|
|
|
1250
1268
|
export { generate_default, logger };
|
|
1251
|
-
//# sourceMappingURL=chunk-
|
|
1252
|
-
//# sourceMappingURL=chunk-
|
|
1269
|
+
//# sourceMappingURL=chunk-CGLPJU2K.mjs.map
|
|
1270
|
+
//# sourceMappingURL=chunk-CGLPJU2K.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../zimic-utils/src/data/isDefined.ts","../src/typegen/openapi/utils/types.ts","../src/types/schema.ts","../../zimic-utils/src/logging/Logger.ts","../src/utils/logging.ts","../src/typegen/openapi/transform/operations.ts","../src/typegen/openapi/transform/methods.ts","../src/typegen/openapi/transform/paths.ts","../src/typegen/openapi/transform/components.ts","../src/utils/strings.ts","../../zimic-utils/src/data/isNonEmpty.ts","../../zimic-utils/src/url/createRegexFromPath.ts","../../zimic-utils/src/url/createWildcardRegexFromPath.ts","../../zimic-utils/src/import/createCachedDynamicImport.ts","../src/utils/files.ts","../src/typegen/openapi/transform/filters.ts","../src/typegen/openapi/transform/context.ts","../src/typegen/openapi/transform/imports.ts","../src/typegen/openapi/transform/io.ts","../src/typegen/openapi/generate.ts"],"names":["ts","color","type","isComponent","path","node","componentPath","fs","generateTypesFromOpenAPI"],"mappings":";;;;;;AAAA,SAAS,UAAiB,KAAA,EAA2C;AACnE,EAAA,OAAO,KAAA,KAAU,UAAa,KAAA,KAAU,IAAA;AAC1C;AAEA,IAAO,iBAAA,GAAQ,SAAA;ACFR,SAAS,YAAY,IAAA,EAAmB;AAC7C,EAAA,OAAO,IAAA,CAAK,IAAA,KAASA,GAAA,CAAG,UAAA,CAAW,YAAA;AACrC;AAEO,SAAS,cAAc,IAAA,EAAmB;AAC/C,EAAA,OAAO,IAAA,CAAK,IAAA,KAASA,GAAA,CAA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MAAM,UAAU,kBAAA,CAAmB,CAAC,GAAG,eAAA,EAAiB,GAAG,oBAAoB,CAAC,CAAA;AAEhF,EAAA,MAAM,QAAA,GAAW,MAAM,sBAAA,CAAuB,kBAAkB,CAAA;AAChE,EAAA,MAAM,OAAA,GAAU,+BAAA,CAAgC,WAAA,EAAa,OAAO,CAAA;AACpE,EAAA,MAAM,QAAQ,iBAAA,CAAkB,QAAA,EAAU,OAAA,EAAS,EAAE,OAAO,CAAA;AAE5D,EAAA,MAAM,kBAAA,GAAqB,yBAAyB,OAAO,CAAA;AAE3D,EAAA,KAAA,MAAW,eAAe,kBAAA,EAAoB;AAC5C,IAAA,KAAA,CAAM,QAAQ,WAAW,CAAA;AAAA;AAG3B,EAAA,MAAM,gBAAgB,MAAM,oBAAA,CAAqB,KAAA,EAAO,EAAE,iBAAiB,CAAA;AAC3E,EAAA,MAAM,sBAAA,GAAyB,4BAA4B,aAAa,CAAA;AAExE,EAAA,MAAM,8BAA8B,cAAA,KAAmB,MAAA;AAEvD,EAAA,IAAI,2BAAA,EAA6B;AAC/B,IAAA,MAAM,mCAAmC,sBAAsB,CAAA;AAAA,GACjE,MAAO;AACL,IAAA,MAAM,wBAAA,CAAyBA,IAAAA,CAAK,OAAA,CAAQ,cAAc,GAAG,sBAAsB,CAAA;AAAA;AAEvF;AAEA,IAAO,gBAAA,GAAQ","file":"chunk-CGLPJU2K.mjs","sourcesContent":["function isDefined<Value>(value: Value): value is NonNullable<Value> {\n return value !== undefined && value !== null;\n}\n\nexport default isDefined;\n","import ts from 'typescript';\n\nexport function isNeverType(type: ts.TypeNode) {\n return type.kind === ts.SyntaxKind.NeverKeyword;\n}\n\nexport function isUnknownType(type: ts.TypeNode) {\n return type.kind === ts.SyntaxKind.UnknownKeyword;\n}\n\nexport function isNumericType(type: ts.TypeNode) {\n return type.kind === ts.SyntaxKind.NumberKeyword;\n}\n\nexport function isBooleanType(type: ts.TypeNode) {\n return type.kind === ts.SyntaxKind.BooleanKeyword;\n}\n\nexport function isNullType(type: ts.TypeNode | ts.LiteralTypeNode['literal']) {\n return type.kind === ts.SyntaxKind.NullKeyword;\n}\n\nexport function createBlobType() {\n return ts.factory.createTypeReferenceNode('Blob');\n}\n\nexport function createNullType() {\n return ts.factory.createLiteralTypeNode(ts.factory.createNull());\n}\n\nexport function createImportSpecifier(importName: string) {\n return ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(importName));\n}\n\nexport function createImportDeclaration(\n importSpecifiers: ts.ImportSpecifier[],\n moduleName: string,\n options: { typeOnly: boolean },\n) {\n return ts.factory.createImportDeclaration(\n undefined,\n ts.factory.createImportClause(\n options.typeOnly ? ts.SyntaxKind.TypeKeyword : undefined,\n undefined,\n ts.factory.createNamedImports(importSpecifiers),\n ),\n ts.factory.createStringLiteral(moduleName),\n );\n}\n","import {\n IfAny,\n UnionToIntersection,\n UnionHasMoreThanOneType,\n Prettify,\n NonEmptyArray,\n Branded,\n} from '@zimic/utils/types';\n\nimport { HttpFormDataSchema } from '../formData/types';\nimport { HttpHeadersSchema } from '../headers/types';\nimport { HttpPathParamsSchema } from '../pathParams/types';\nimport { HttpSearchParamsSchema } from '../searchParams/types';\nimport { HttpBody } from './requests';\n\nexport const HTTP_METHODS = Object.freeze(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'] as const);\n/**\n * A type representing the currently supported\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Methods `HTTP methods`}.\n */\nexport type HttpMethod = (typeof HTTP_METHODS)[number];\n\n/**\n * A schema representing the structure of an HTTP request.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport interface HttpRequestSchema {\n headers?: HttpHeadersSchema.Loose;\n searchParams?: HttpSearchParamsSchema.Loose;\n body?: HttpBody.Loose;\n}\n\n/**\n * A schema representing the structure of an HTTP response.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport interface HttpResponseSchema {\n headers?: HttpHeadersSchema.Loose;\n body?: HttpBody.Loose;\n}\n\n/**\n * The status codes used in HTTP responses, as defined by\n * {@link https://httpwg.org/specs/rfc9110.html#overview.of.status.codes RFC-9110}.\n *\n * - `HttpStatusCode.Information`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n * - `HttpStatusCode.Success`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n * - `HttpStatusCode.Redirection`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n * - `HttpStatusCode.ClientError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n * - `HttpStatusCode.ServerError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\nexport type HttpStatusCode =\n | HttpStatusCode.Information\n | HttpStatusCode.Success\n | HttpStatusCode.Redirection\n | HttpStatusCode.ClientError\n | HttpStatusCode.ServerError;\n\nexport namespace HttpStatusCode {\n /**\n * An HTTP status code in the `1XX` range, representing an informational response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n */\n export type Information =\n | 100 // Continue\n | 101 // Switching Protocols\n | 102 // Processing\n | 103; // Early Hints\n\n /**\n * An HTTP status code in the `2XX` range, representing a successful response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n */\n export type Success =\n | 200 // OK\n | 201 // Created\n | 202 // Accepted\n | 203 // Non-Authoritative Information\n | 204 // No Content\n | 205 // Reset Content\n | 206 // Partial Content\n | 207 // Multi-Status\n | 208 // Already Reported\n | 226; // IM Used\n\n /**\n * An HTTP status code in the `3XX` range, representing a redirection response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n */\n export type Redirection =\n | 300 // Multiple Choices\n | 301 // Moved Permanently\n | 302 // Found\n | 303 // See Other\n | 304 // Not Modified\n | 307 // Temporary Redirect\n | 308; // Permanent Redirect\n\n /**\n * An HTTP status code in the `4XX` range, representing a client error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n */\n export type ClientError =\n | 400 // Bad Request\n | 401 // Unauthorized\n | 402 // Payment Required\n | 403 // Forbidden\n | 404 // Not Found\n | 405 // Method Not Allowed\n | 406 // Not Acceptable\n | 407 // Proxy Authentication Required\n | 408 // Request Timeout\n | 409 // Conflict\n | 410 // Gone\n | 411 // Length Required\n | 412 // Precondition Failed\n | 413 // Content Too Large\n | 414 // URI Too Long\n | 415 // Unsupported Media Type\n | 416 // Range Not Satisfiable\n | 417 // Expectation Failed\n | 418 // I'm a teapot\n | 421 // Misdirected Request\n | 422 // Unprocessable Content\n | 423 // Locked\n | 424 // Failed Dependency\n | 425 // Too Early\n | 426 // Upgrade Required\n | 428 // Precondition Required\n | 429 // Too Many Requests\n | 431 // Request Header Fields Too Large\n | 451; // Unavailable For Legal Reasons\n\n /**\n * An HTTP status code in the `5XX` range, representing a server error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\n export type ServerError =\n | 500 // Internal Server Error\n | 501 // Not Implemented\n | 502 // Bad Gateway\n | 503 // Service Unavailable\n | 504 // Gateway Timeout\n | 505 // HTTP Version Not Supported\n | 506 // Variant Also Negotiates\n | 507 // Insufficient Storage\n | 508 // Loop Detected\n | 510 // Not Extended\n | 511; // Network Authentication Required\n}\n\n/**\n * A schema representing the structure of HTTP responses by status code.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport type HttpResponseSchemaByStatusCode = {\n [StatusCode in HttpStatusCode]?: HttpResponseSchema;\n};\n\n/**\n * Extracts the status codes used in a response schema by status code.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport type HttpResponseSchemaStatusCode<ResponseSchemaByStatusCode extends HttpResponseSchemaByStatusCode> =\n keyof ResponseSchemaByStatusCode & HttpStatusCode;\n\n/**\n * A schema representing the structure of an HTTP request and response for a given method.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport interface HttpMethodSchema {\n request?: HttpRequestSchema;\n response?: HttpResponseSchemaByStatusCode;\n}\n\n/**\n * A schema representing the structure of HTTP request and response by method.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport interface HttpMethodsSchema {\n GET?: HttpMethodSchema;\n POST?: HttpMethodSchema;\n PUT?: HttpMethodSchema;\n PATCH?: HttpMethodSchema;\n DELETE?: HttpMethodSchema;\n HEAD?: HttpMethodSchema;\n OPTIONS?: HttpMethodSchema;\n}\n\ninterface BaseHttpSchema {\n [path: string]: HttpMethodsSchema;\n}\n\n/** @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference} */\nexport type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = Branded<Schema, 'HttpSchema'>;\n\nexport namespace HttpSchema {\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemamethods `HttpSchema.Methods` API reference} */\n export type Methods<Schema extends HttpMethodsSchema> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemamethod `HttpSchema.Method` API reference} */\n export type Method<Schema extends HttpMethodSchema> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemarequest `HttpSchema.Request` API reference} */\n export type Request<Schema extends HttpRequestSchema> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemaresponsebystatuscode `HttpSchema.ResponseByStatusCode` API reference} */\n export type ResponseByStatusCode<Schema extends HttpResponseSchemaByStatusCode> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemaresponse `HttpSchema.Response` API reference} */\n export type Response<Schema extends HttpResponseSchema> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemabody `HttpSchema.Body` API reference} */\n export type Body<Schema extends HttpBody.Loose> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemaheaders `HttpSchema.Headers` API reference} */\n export type Headers<Schema extends HttpHeadersSchema.Loose> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemasearchparams `HttpSchema.SearchParams` API reference} */\n export type SearchParams<Schema extends HttpSearchParamsSchema.Loose> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemapathparams `HttpSchema.PathParams` API reference} */\n export type PathParams<Schema extends HttpPathParamsSchema.Loose> = Schema;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemaformdata `HttpSchema.FormData` API reference} */\n export type FormData<Schema extends HttpFormDataSchema.Loose> = Schema;\n}\n\n/**\n * Extracts the methods from an HTTP service schema.\n *\n * @see {@link https://zimic.dev/docs/http/api/http-schema `HttpSchema` API reference}\n */\nexport type HttpSchemaMethod<Schema extends HttpSchema> = IfAny<\n Schema,\n any, // eslint-disable-line @typescript-eslint/no-explicit-any\n keyof UnionToIntersection<Schema[keyof Schema]> & HttpMethod\n>;\n\ntype RepeatingPathParamModifier = '+';\ntype OptionalPathParamModifier = '?' | '*';\n\ntype ConvertPathParamToRecord<PathParam extends string> = PathParam extends `${infer PathParamWithoutSlash}/`\n ? ConvertPathParamToRecord<PathParamWithoutSlash>\n : PathParam extends `${infer PathParamWithoutSlash}\\\\:`\n ? ConvertPathParamToRecord<PathParamWithoutSlash>\n : PathParam extends `${infer PathParamWithoutModifier}${OptionalPathParamModifier}`\n ? { [Name in PathParamWithoutModifier]?: string }\n : PathParam extends `${infer PathParamWithoutModifier}${RepeatingPathParamModifier}`\n ? { [Name in PathParamWithoutModifier]: string }\n : { [Name in PathParam]: string };\n\ntype RecursiveInferPathParams<Path extends string> = Path extends `${infer Prefix}:${infer PathParamWithRemainingPath}`\n ? PathParamWithRemainingPath extends `${infer PathParam}/${infer RemainingPath}`\n ? Prefix extends `${string}\\\\`\n ? RecursiveInferPathParams<RemainingPath>\n : ConvertPathParamToRecord<PathParam> & RecursiveInferPathParams<RemainingPath>\n : PathParamWithRemainingPath extends `${infer PathParam}\\\\:${infer RemainingPath}`\n ? Prefix extends `${string}\\\\`\n ? RecursiveInferPathParams<`\\\\:${RemainingPath}`>\n : ConvertPathParamToRecord<PathParam> & RecursiveInferPathParams<`\\\\:${RemainingPath}`>\n : PathParamWithRemainingPath extends `${infer PathParam}:${infer RemainingPath}`\n ? Prefix extends `${string}\\\\`\n ? RecursiveInferPathParams<RemainingPath>\n : ConvertPathParamToRecord<PathParam> & RecursiveInferPathParams<`:${RemainingPath}`>\n : Prefix extends `${string}\\\\`\n ? {}\n : ConvertPathParamToRecord<PathParamWithRemainingPath>\n : {};\n\n/** @see {@link https://zimic.dev/docs/http/api/http-schema#inferpathparams `InferPathParams` API reference} */\nexport type InferPathParams<\n PathOrSchema extends string | HttpSchema,\n OptionalPath extends PathOrSchema extends HttpSchema ? HttpSchemaPath.Literal<PathOrSchema> : never = never,\n> = Prettify<\n RecursiveInferPathParams<\n PathOrSchema extends HttpSchema ? OptionalPath : PathOrSchema extends string ? PathOrSchema : never\n >\n>;\n\ntype WithoutEscapedColons<Path extends string> = Path extends `${infer Prefix}\\\\:${infer Suffix}`\n ? WithoutEscapedColons<`${Prefix}:${Suffix}`>\n : Path;\n\ntype ConvertPathParamToString<PathParam extends string> = PathParam extends `${infer PathParamWithoutSlash}/`\n ? `${ConvertPathParamToString<PathParamWithoutSlash>}/`\n : PathParam extends `${infer PathParamWithoutSlash}\\\\:`\n ? `${ConvertPathParamToString<PathParamWithoutSlash>}:`\n : string;\n\nexport type AllowAnyStringInPathParams<Path extends string> =\n Path extends `${infer Prefix}:${infer PathParamWithRemainingPath}`\n ? PathParamWithRemainingPath extends `${infer PathParam}/${infer RemainingPath}`\n ? Prefix extends `${infer PrefixPrefix}\\\\`\n ? `${PrefixPrefix}:${AllowAnyStringInPathParams<PathParamWithRemainingPath>}`\n : `${Prefix}${ConvertPathParamToString<PathParam>}/${AllowAnyStringInPathParams<RemainingPath>}`\n : PathParamWithRemainingPath extends `${infer PathParam}\\\\:${infer RemainingPath}`\n ? Prefix extends `${infer PrefixPrefix}\\\\`\n ? `${PrefixPrefix}:${AllowAnyStringInPathParams<PathParamWithRemainingPath>}`\n : `${Prefix}${ConvertPathParamToString<PathParam>}:${AllowAnyStringInPathParams<RemainingPath>}`\n : PathParamWithRemainingPath extends `${infer PathParam}:${infer RemainingPath}`\n ? Prefix extends `${infer PrefixPrefix}\\\\`\n ? `${PrefixPrefix}:${AllowAnyStringInPathParams<PathParamWithRemainingPath>}`\n : `${Prefix}${ConvertPathParamToString<PathParam>}${AllowAnyStringInPathParams<`:${RemainingPath}`>}`\n : Prefix extends `${infer PrefixPrefix}\\\\`\n ? `${PrefixPrefix}:${PathParamWithRemainingPath}`\n : `${Prefix}${ConvertPathParamToString<PathParamWithRemainingPath>}`\n : Path;\n\n/** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemapath `HttpSchemaPath` API reference} */\nexport namespace HttpSchemaPath {\n type LooseLiteral<Schema extends HttpSchema, Method extends HttpMethod = HttpMethod> = {\n [Path in keyof Schema & string]: Method extends keyof Schema[Path] ? Path : never;\n }[keyof Schema & string];\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemapathliteral `HttpSchemaPath.Literal` API reference} */\n export type Literal<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = LooseLiteral<Schema, Method>;\n\n /** @see {@link https://zimic.dev/docs/http/api/http-schema#httpschemapathnonliteral `HttpSchemaPath.NonLiteral` API reference} */\n export type NonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = WithoutEscapedColons<AllowAnyStringInPathParams<LooseLiteral<Schema, Method>>>;\n}\n\nexport type HttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n> = HttpSchemaPath.Literal<Schema, Method> | HttpSchemaPath.NonLiteral<Schema, Method>;\n\ntype LargestPathPrefix<Path extends string> = Path extends `${infer Prefix}/${infer Suffix}`\n ? `${Prefix}/${Suffix extends `${string}/${string}` ? LargestPathPrefix<Suffix> : ''}`\n : Path;\n\ntype ExcludeNonLiteralPathsSupersededByLiteralPath<Path extends string> =\n Path extends `${LargestPathPrefix<Path>}:${string}` ? never : Path;\n\nexport type PreferMostStaticLiteralPath<Path extends string> =\n UnionHasMoreThanOneType<Path> extends true ? ExcludeNonLiteralPathsSupersededByLiteralPath<Path> : Path;\n\ntype RecursiveInferHttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method>,\n> =\n NonLiteralPath extends AllowAnyStringInPathParams<LiteralPath>\n ? NonLiteralPath extends `${AllowAnyStringInPathParams<LiteralPath>}/${string}`\n ? never\n : LiteralPath\n : never;\n\nexport type LiteralHttpSchemaPathFromNonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method> = HttpSchemaPath.Literal<Schema, Method>,\n> = PreferMostStaticLiteralPath<\n LiteralPath extends LiteralPath ? RecursiveInferHttpSchemaPath<Schema, Method, NonLiteralPath, LiteralPath> : never\n>;\n\ntype OmitPastHttpStatusCodes<\n Schema extends HttpResponseSchemaByStatusCode,\n PastSchemas extends HttpResponseSchemaByStatusCode[],\n> =\n PastSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode>\n ? Omit<Schema, keyof UnionToIntersection<PastSchemas[number]>>\n : Schema;\n\n/** @see {@link https://zimic.dev/docs/http/api/http-schema#mergehttpresponsesbystatuscode `MergeHttpResponsesByStatusCode` API reference} */\nexport type MergeHttpResponsesByStatusCode<\n Schemas extends HttpResponseSchemaByStatusCode[],\n PastSchemas extends HttpResponseSchemaByStatusCode[] = [],\n> = Schemas extends [\n infer FirstSchema extends HttpResponseSchemaByStatusCode,\n ...infer RestSchemas extends HttpResponseSchemaByStatusCode[],\n]\n ? RestSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode>\n ? OmitPastHttpStatusCodes<FirstSchema, PastSchemas> &\n MergeHttpResponsesByStatusCode<RestSchemas, [...PastSchemas, FirstSchema]>\n : OmitPastHttpStatusCodes<FirstSchema, PastSchemas>\n : never;\n","export type TableLogRow = Record<string, string>;\n\nexport interface TableLogHeader<Row extends TableLogRow> {\n title: string;\n property: keyof Row;\n}\n\nexport interface LoggerOptions {\n prefix?: string;\n}\n\nclass Logger {\n prefix?: string;\n\n raw: Logger;\n\n constructor(options: LoggerOptions = {}) {\n const { prefix } = options;\n\n this.prefix = prefix;\n\n this.raw = prefix ? new Logger({ ...options, prefix: undefined }) : this;\n }\n\n private logWithLevel(level: 'log' | 'warn' | 'error', ...messages: unknown[]) {\n if (this.prefix) {\n console[level](this.prefix, ...messages);\n } else {\n console[level](...messages);\n }\n }\n\n info(...messages: unknown[]) {\n this.logWithLevel('log', ...messages);\n }\n\n warn(...messages: unknown[]) {\n this.logWithLevel('warn', ...messages);\n }\n\n error(...messages: unknown[]) {\n this.logWithLevel('error', ...messages);\n }\n\n table<Row extends TableLogRow>(headers: TableLogHeader<Row>[], rows: Row[]) {\n const columnLengths = headers.map((header) => {\n let maxValueLength = header.title.length;\n\n for (const row of rows) {\n const value = row[header.property];\n\n if (value.length > maxValueLength) {\n maxValueLength = value.length;\n }\n }\n\n return maxValueLength;\n });\n\n const formattedRows: string[][] = [];\n\n const horizontalLine = columnLengths.map((length) => '─'.repeat(length));\n formattedRows.push(horizontalLine, []);\n\n for (let headerIndex = 0; headerIndex < headers.length; headerIndex++) {\n const header = headers[headerIndex];\n const columnLength = columnLengths[headerIndex];\n\n const value = header.title;\n formattedRows.at(-1)?.push(value.padEnd(columnLength, ' '));\n }\n\n formattedRows.push(horizontalLine);\n\n for (const row of rows) {\n formattedRows.push([]);\n\n for (let headerIndex = 0; headerIndex < headers.length; headerIndex++) {\n const header = headers[headerIndex];\n const columnLength = columnLengths[headerIndex];\n\n const value = row[header.property];\n formattedRows.at(-1)?.push(value.padEnd(columnLength, ' '));\n }\n }\n\n formattedRows.push(horizontalLine);\n\n const formattedTable = formattedRows\n .map((row, index) => {\n const isFirstLine = index === 0;\n if (isFirstLine) {\n return `┌─${row.join('─┬─')}─┐`;\n }\n\n const isLineAfterHeaders = index === 2;\n if (isLineAfterHeaders) {\n return `├─${row.join('─┼─')}─┤`;\n }\n\n const isLastLine = index === formattedRows.length - 1;\n if (isLastLine) {\n return `└─${row.join('─┴─')}─┘`;\n }\n\n return `│ ${row.join(' │ ')} │`;\n })\n .join('\\n');\n\n this.logWithLevel('log', formattedTable);\n }\n}\n\nexport default Logger;\n","import Logger from '@zimic/utils/logging/Logger';\nimport color from 'picocolors';\n\nexport const logger = new Logger({\n prefix: color.cyan('[@zimic/http]'),\n});\n","import isDefined from '@zimic/utils/data/isDefined';\nimport { Override } from '@zimic/utils/types';\nimport ts from 'typescript';\n\nimport { TypeTransformContext } from './context';\nimport { normalizeTypeLiteralMethodType } from './methods';\n\nexport function createOperationsIdentifierText(serviceName: string) {\n return `${serviceName}Operations`;\n}\n\nexport function createOperationsIdentifier(serviceName: string) {\n return ts.factory.createIdentifier(createOperationsIdentifierText(serviceName));\n}\n\ntype OperationsDeclaration = ts.InterfaceDeclaration;\n\nexport function isOperationsDeclaration(node: ts.Node | undefined): node is OperationsDeclaration {\n return node !== undefined && ts.isInterfaceDeclaration(node) && node.name.text === 'operations';\n}\n\ntype Operation = Override<\n ts.PropertySignature,\n {\n type: ts.TypeLiteralNode;\n name: ts.Identifier | ts.StringLiteral;\n }\n>;\n\nfunction isOperation(node: ts.Node): node is Operation {\n return (\n ts.isPropertySignature(node) &&\n (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name)) &&\n node.type !== undefined &&\n ts.isTypeLiteralNode(node.type)\n );\n}\n\nfunction normalizeOperation(operation: ts.TypeElement, context: TypeTransformContext) {\n /* istanbul ignore if -- @preserve\n * Operation members are always expected to be an operation. */\n if (!isOperation(operation)) {\n return undefined;\n }\n\n const newType = normalizeTypeLiteralMethodType(operation.type, context);\n\n return ts.factory.updatePropertySignature(\n operation,\n operation.modifiers,\n operation.name,\n operation.questionToken,\n newType,\n );\n}\n\nexport function normalizeOperations(operations: OperationsDeclaration, context: TypeTransformContext) {\n const newIdentifier = createOperationsIdentifier(context.serviceName);\n\n const newMembers = operations.members.map((operation) => normalizeOperation(operation, context)).filter(isDefined);\n\n return ts.factory.updateInterfaceDeclaration(\n operations,\n operations.modifiers,\n newIdentifier,\n operations.typeParameters,\n operations.heritageClauses,\n newMembers,\n );\n}\n\nfunction removeOperationIfUnreferenced(operation: ts.TypeElement, context: TypeTransformContext) {\n /* istanbul ignore if -- @preserve\n * Operation members are always expected to be an operation. */\n if (!isOperation(operation)) {\n return undefined;\n }\n\n const operationName = operation.name.text;\n const isReferenced = context.referencedTypes.operations.has(operationName);\n\n if (isReferenced) {\n context.referencedTypes.operations.delete(operationName);\n return operation;\n }\n\n return undefined;\n}\n\nexport function removeUnreferencedOperations(operations: OperationsDeclaration, context: TypeTransformContext) {\n const newMembers = operations.members\n .map((operation) => removeOperationIfUnreferenced(operation, context))\n .filter(isDefined);\n\n context.referencedTypes.operations.clear();\n\n if (newMembers.length === 0) {\n return undefined;\n }\n\n return ts.factory.updateInterfaceDeclaration(\n operations,\n operations.modifiers,\n operations.name,\n operations.typeParameters,\n operations.heritageClauses,\n newMembers,\n );\n}\n","import isDefined from '@zimic/utils/data/isDefined';\nimport { Override } from '@zimic/utils/types';\nimport color from 'picocolors';\nimport ts from 'typescript';\n\nimport { HTTP_METHODS, HttpMethod } from '@/types/schema';\nimport { logger } from '@/utils/logging';\n\nimport { isUnknownType, isNeverType, isNullType } from '../utils/types';\nimport { renameComponentReferences } from './components';\nimport { TypeTransformContext } from './context';\nimport { createOperationsIdentifier } from './operations';\n\ntype Method = Override<\n ts.PropertySignature,\n {\n type: ts.TypeLiteralNode | ts.IndexedAccessTypeNode;\n name: ts.Identifier;\n }\n>;\n\nfunction isMethod(node: ts.Node): node is Method {\n return (\n ts.isPropertySignature(node) &&\n ts.isIdentifier(node.name) &&\n node.type !== undefined &&\n (ts.isTypeLiteralNode(node.type) || ts.isIndexedAccessTypeNode(node.type))\n );\n}\n\ntype MethodMember = Override<\n ts.PropertySignature,\n {\n name: ts.Identifier | ts.StringLiteral;\n type: ts.TypeLiteralNode | ts.IndexedAccessTypeNode;\n }\n>;\n\nfunction isMethodMember(node: ts.Node): node is MethodMember {\n return (\n ts.isPropertySignature(node) &&\n ts.isIdentifier(node.name) &&\n node.type !== undefined &&\n (ts.isTypeLiteralNode(node.type) || ts.isIndexedAccessTypeNode(node.type) || isNeverType(node.type))\n );\n}\n\ntype RequestMember = Override<\n ts.PropertySignature,\n {\n name: ts.Identifier;\n type: ts.TypeNode;\n }\n>;\n\nfunction isRequestMember(node: ts.Node): node is RequestMember {\n return (\n ts.isPropertySignature(node) && ts.isIdentifier(node.name) && node.type !== undefined && !isNeverType(node.type)\n );\n}\n\ntype RequestHeaders = Override<RequestMember, { type: ts.TypeLiteralNode }>;\n\nfunction isRequestHeaders(node: ts.Node): node is RequestHeaders {\n return isRequestMember(node) && node.name.text === 'headers' && ts.isTypeLiteralNode(node.type);\n}\n\ntype NormalizedRequestHeaders = Override<RequestHeaders, { type: ts.TypeLiteralNode }>;\n\nfunction isNormalizedRequestHeaders(node: ts.Node): node is NormalizedRequestHeaders {\n return isRequestMember(node) && node.name.text === 'headers' && ts.isTypeLiteralNode(node.type);\n}\n\ntype RequestParameters = Override<RequestMember, { type: ts.TypeLiteralNode }>;\n\nfunction isRequestParameters(node: ts.Node): node is RequestParameters {\n return isRequestMember(node) && node.name.text === 'parameters' && ts.isTypeLiteralNode(node.type);\n}\n\ntype Content = Override<RequestMember, { type: ts.TypeLiteralNode }>;\n\nfunction isContentPropertySignature(node: ts.Node): node is Content {\n return isRequestMember(node) && node.name.text === 'content' && ts.isTypeLiteralNode(node.type);\n}\n\ntype ContentMember = Override<\n ts.PropertySignature,\n {\n name: ts.Identifier | ts.StringLiteral;\n type: ts.TypeNode;\n }\n>;\n\nfunction isContentMember(node: ts.Node): node is ContentMember {\n return (\n ts.isPropertySignature(node) &&\n (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name)) &&\n node.type !== undefined &&\n !isNeverType(node.type)\n );\n}\n\ntype Response = Override<\n ts.PropertySignature,\n {\n name: ts.Identifier | ts.StringLiteral | ts.NumericLiteral;\n type: ts.TypeNode;\n }\n>;\n\nfunction isResponse(node: ts.Node): node is Response {\n return (\n ts.isPropertySignature(node) &&\n (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name) || ts.isNumericLiteral(node.name)) &&\n node.type !== undefined\n );\n}\n\nfunction removeRedundantNullUnionIfNecessary(type: ts.TypeNode) {\n const containsRedundantNullUnion =\n ts.isUnionTypeNode(type) &&\n type.types.some((type) => {\n const isNull = ts.isLiteralTypeNode(type) && isNullType(type.literal);\n return isNull;\n }) &&\n type.types.some((type) => {\n return (\n ts.isParenthesizedTypeNode(type) &&\n ts.isUnionTypeNode(type.type) &&\n type.type.types.some((subType) => {\n const isNull = ts.isLiteralTypeNode(subType) && isNullType(subType.literal);\n return isNull;\n })\n );\n });\n\n if (!containsRedundantNullUnion) {\n return type;\n }\n\n const typesWithoutRedundantNullUnion = type.types\n .filter((type) => {\n const isNull = ts.isLiteralTypeNode(type) && isNullType(type.literal);\n return !isNull;\n })\n .flatMap((type) => {\n /* istanbul ignore else -- @preserve */\n if (ts.isParenthesizedTypeNode(type) && ts.isUnionTypeNode(type.type)) {\n return type.type.types;\n }\n /* istanbul ignore next -- @preserve\n * Member types are always expected to be a union type or a parenthesized union type. */\n return [type];\n });\n\n return ts.factory.createUnionTypeNode(typesWithoutRedundantNullUnion);\n}\n\nfunction wrapFormDataContentType(type: ts.TypeNode, context: TypeTransformContext) {\n context.typeImports.http.add('HttpFormData');\n\n return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('HttpFormData'), [\n renameComponentReferences(type, context),\n ]);\n}\n\nfunction wrapURLEncodedContentType(type: ts.TypeNode, context: TypeTransformContext) {\n context.typeImports.http.add('HttpSearchParams');\n\n return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('HttpSearchParams'), [\n renameComponentReferences(type, context),\n ]);\n}\n\nfunction normalizeRequestBodyMember(\n requestBodyMember: ts.TypeElement,\n context: TypeTransformContext,\n options: { questionToken: ts.QuestionToken | undefined },\n) {\n /* istanbul ignore if -- @preserve\n * Request body members are always expected to be a request body. */\n if (!isContentMember(requestBodyMember)) {\n return undefined;\n }\n\n const newIdentifier = ts.factory.createIdentifier('body');\n\n const contentType = requestBodyMember.name.text;\n let newType = removeRedundantNullUnionIfNecessary(renameComponentReferences(requestBodyMember.type, context));\n\n if (contentType === 'multipart/form-data') {\n newType = wrapFormDataContentType(newType, context);\n } else if (contentType === 'x-www-form-urlencoded') {\n newType = wrapURLEncodedContentType(newType, context);\n }\n\n return {\n contentTypeName: contentType,\n propertySignature: ts.factory.updatePropertySignature(\n requestBodyMember,\n requestBodyMember.modifiers,\n newIdentifier,\n options.questionToken,\n newType,\n ),\n };\n}\n\nfunction normalizeHeaders(headers: ts.TypeLiteralNode) {\n const newHeaderMembers = headers.members.filter((header) => {\n if (ts.isIndexSignatureDeclaration(header)) {\n return false;\n }\n /* istanbul ignore else -- @preserve */\n if (ts.isPropertySignature(header)) {\n return header.type !== undefined && !isUnknownType(header.type);\n }\n /* istanbul ignore next -- @preserve\n * Headers are always expected to be property signatures or index signatures. */\n return true;\n });\n\n if (newHeaderMembers.length === 0) {\n return undefined;\n }\n\n return ts.factory.updateTypeLiteralNode(headers, ts.factory.createNodeArray(newHeaderMembers));\n}\n\nfunction normalizeRequestHeaders(requestHeader: ts.TypeElement): NormalizedRequestHeaders | undefined {\n if (!isRequestHeaders(requestHeader)) {\n return undefined;\n }\n\n const newType = normalizeHeaders(requestHeader.type);\n\n if (!newType) {\n return undefined;\n }\n\n return ts.factory.updatePropertySignature(\n requestHeader,\n requestHeader.modifiers,\n requestHeader.name,\n requestHeader.questionToken,\n newType satisfies NormalizedRequestHeaders['type'],\n ) satisfies ts.PropertySignature as NormalizedRequestHeaders;\n}\n\nfunction createHeaderForUnionByContentType(\n existingHeader: NormalizedRequestHeaders | undefined,\n contentTypeName: string,\n) {\n const existingHeaderMembers = existingHeader?.type.members ?? [];\n\n const contentTypeIdentifier = ts.factory.createIdentifier('\"content-type\"');\n const contentTypeValue = ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(contentTypeName));\n\n const newHeaderType = ts.factory.createTypeLiteralNode([\n ts.factory.createPropertySignature(undefined, contentTypeIdentifier, undefined, contentTypeValue),\n ...existingHeaderMembers,\n ]);\n\n return ts.factory.createPropertySignature(\n existingHeader?.modifiers,\n ts.factory.createIdentifier('headers'),\n undefined,\n newHeaderType,\n );\n}\n\nexport function normalizeContentType(\n contentType: ts.TypeNode,\n context: TypeTransformContext,\n options: { bodyQuestionToken: ts.QuestionToken | undefined },\n) {\n const { bodyQuestionToken } = options;\n\n if (ts.isIndexedAccessTypeNode(contentType)) {\n return renameComponentReferences(contentType, context);\n }\n\n if (!ts.isTypeLiteralNode(contentType)) {\n return contentType;\n }\n\n const newHeader = contentType.members.map(normalizeRequestHeaders).find(isDefined);\n\n const newBodyMembers = contentType.members.flatMap((body) => {\n if (isContentPropertySignature(body)) {\n return body.type.members\n .map((member) => normalizeRequestBodyMember(member, context, { questionToken: bodyQuestionToken }))\n .filter(isDefined);\n }\n return [];\n });\n\n if (newBodyMembers.length === 0) {\n const newMembers = [newHeader].filter(isDefined);\n\n return ts.factory.updateTypeLiteralNode(contentType, ts.factory.createNodeArray(newMembers));\n } else {\n const bodyMemberUnionTypes = newBodyMembers.map((bodyMember) => {\n const headerMember = createHeaderForUnionByContentType(newHeader, bodyMember.contentTypeName);\n return ts.factory.createTypeLiteralNode([headerMember, bodyMember.propertySignature]);\n });\n\n return ts.factory.createUnionTypeNode(bodyMemberUnionTypes);\n }\n}\n\nfunction normalizeRequest(request: MethodMember, context: TypeTransformContext) {\n const newIdentifier = ts.factory.createIdentifier('request');\n\n const newType = normalizeContentType(request.type, context, {\n bodyQuestionToken: request.questionToken,\n });\n\n if (\n request.questionToken &&\n ts.isIndexedAccessTypeNode(request.type) &&\n ts.isLiteralTypeNode(request.type.indexType) &&\n (ts.isIdentifier(request.type.indexType.literal) || ts.isStringLiteral(request.type.indexType.literal))\n ) {\n const referencedComponentName = request.type.indexType.literal.text;\n context.pendingActions.components.requests.toMarkBodyAsOptional.add(referencedComponentName);\n }\n\n return ts.factory.updatePropertySignature(request, request.modifiers, newIdentifier, undefined, newType);\n}\n\nfunction normalizeResponseType(\n responseType: ts.TypeNode,\n context: TypeTransformContext,\n options: { questionToken?: ts.QuestionToken },\n) {\n const { questionToken } = options;\n\n if (!ts.isTypeLiteralNode(responseType)) {\n return responseType;\n }\n\n return normalizeContentType(responseType, context, { bodyQuestionToken: questionToken });\n}\n\nconst NON_NUMERIC_RESPONSE_STATUS_TO_MAPPED_TYPE: Record<string, string | undefined> = {\n default: 'HttpStatusCode',\n '1xx': 'HttpStatusCode.Information',\n '2xx': 'HttpStatusCode.Success',\n '3xx': 'HttpStatusCode.Redirection',\n '4xx': 'HttpStatusCode.ClientError',\n '5xx': 'HttpStatusCode.ServerError',\n};\n\nexport function normalizeResponse(\n response: ts.TypeElement,\n context: TypeTransformContext,\n options: { isComponent?: boolean } = {},\n) {\n const { isComponent = false } = options;\n\n /* istanbul ignore if -- @preserve\n * Response members are always expected to be a response. */\n if (!isResponse(response)) {\n return undefined;\n }\n\n const newType = normalizeResponseType(response.type, context, {\n questionToken: response.questionToken,\n });\n\n const statusCodeOrComponentName = response.name.text;\n const isNumericStatusCode = /^\\d+$/.test(statusCodeOrComponentName);\n const shouldReuseIdentifier = isComponent || isNumericStatusCode;\n\n let newSignature: ts.PropertySignature;\n\n if (shouldReuseIdentifier) {\n newSignature = ts.factory.updatePropertySignature(\n response,\n response.modifiers,\n response.name,\n response.questionToken,\n newType,\n );\n } else {\n const statusCode = statusCodeOrComponentName.toLowerCase();\n const mappedType = NON_NUMERIC_RESPONSE_STATUS_TO_MAPPED_TYPE[statusCode];\n\n if (!mappedType) {\n logger.warn(\n `Warning: Response has a non-standard status code: ${color.yellow(response.name.text)}. ` +\n \"Consider replacing it with a number (e.g. '200'), a pattern ('1xx', '2xx', '3xx', '4xx', or '5xx'), \" +\n \"or 'default'.\",\n );\n\n return undefined;\n }\n\n context.typeImports.http.add('HttpStatusCode');\n const newIdentifier = ts.factory.createIdentifier(`[StatusCode in ${mappedType}]`);\n\n newSignature = ts.factory.updatePropertySignature(\n response,\n response.modifiers,\n newIdentifier,\n response.questionToken,\n newType,\n );\n }\n\n return {\n newSignature,\n statusCode: {\n value: statusCodeOrComponentName,\n isNumeric: isNumericStatusCode,\n },\n };\n}\n\nexport function normalizeResponses(responses: MethodMember, context: TypeTransformContext) {\n if (isNeverType(responses.type) || !ts.isTypeLiteralNode(responses.type)) {\n return undefined;\n }\n\n const newIdentifier = ts.factory.createIdentifier('response');\n const newQuestionToken = undefined;\n\n const newMembers = responses.type.members\n .map((response) => normalizeResponse(response, context), context)\n .filter(isDefined);\n\n const sortedNewMembers = Array.from(newMembers).sort((response, otherResponse) => {\n return response.statusCode.value.localeCompare(otherResponse.statusCode.value);\n });\n\n const isEveryStatusCodeNumeric = sortedNewMembers.every((response) => response.statusCode.isNumeric);\n let newType: ts.TypeLiteralNode | ts.TypeReferenceNode;\n\n if (isEveryStatusCodeNumeric) {\n newType = ts.factory.updateTypeLiteralNode(\n responses.type,\n ts.factory.createNodeArray(sortedNewMembers.map((response) => response.newSignature)),\n );\n } else {\n context.typeImports.http.add('MergeHttpResponsesByStatusCode');\n\n const typeMembersToMerge = sortedNewMembers.reduce<{\n numeric: ts.PropertySignature[];\n nonNumeric: ts.PropertySignature[];\n }>(\n (members, response) => {\n if (response.statusCode.isNumeric) {\n members.numeric.push(response.newSignature);\n } else {\n members.nonNumeric.push(response.newSignature);\n }\n return members;\n },\n { numeric: [], nonNumeric: [] },\n );\n\n const numericTypeLiteral = ts.factory.createTypeLiteralNode(typeMembersToMerge.numeric);\n const nonNumericTypeLiterals = typeMembersToMerge.nonNumeric.map((response) =>\n ts.factory.createTypeLiteralNode([response]),\n );\n\n const mergeWrapper = ts.factory.createIdentifier('MergeHttpResponsesByStatusCode');\n newType = ts.factory.createTypeReferenceNode(mergeWrapper, [\n ts.factory.createTupleTypeNode([numericTypeLiteral, ...nonNumericTypeLiterals]),\n ]);\n }\n\n return ts.factory.updatePropertySignature(\n responses,\n responses.modifiers,\n newIdentifier,\n newQuestionToken,\n renameComponentReferences(newType, context),\n );\n}\n\nfunction normalizeMethodMember(methodMember: ts.TypeElement, context: TypeTransformContext) {\n /* istanbul ignore else -- @preserve */\n if (isMethodMember(methodMember)) {\n if (methodMember.name.text === 'requestBody') {\n return normalizeRequest(methodMember, context);\n }\n if (methodMember.name.text === 'responses') {\n return normalizeResponses(methodMember, context);\n }\n return methodMember;\n }\n\n /* istanbul ignore next -- @preserve\n * Method members are always expected as property signatures in methods. */\n return undefined;\n}\n\nfunction normalizeRequestQueryWithParameters(requestMember: RequestMember, context: TypeTransformContext) {\n const newIdentifier = ts.factory.createIdentifier('searchParams');\n const newQuestionToken = undefined;\n\n const newType = renameComponentReferences(requestMember.type, context);\n\n return ts.factory.updatePropertySignature(\n requestMember,\n requestMember.modifiers,\n newIdentifier,\n newQuestionToken,\n newType,\n );\n}\n\nfunction normalizeRequestHeadersWithParameters(requestMember: RequestMember, context: TypeTransformContext) {\n const newIdentifier = ts.factory.createIdentifier('headers');\n const newQuestionToken = undefined;\n\n const newType = renameComponentReferences(requestMember.type, context);\n\n return ts.factory.updatePropertySignature(\n requestMember,\n requestMember.modifiers,\n newIdentifier,\n newQuestionToken,\n newType,\n );\n}\n\nfunction normalizeRequestMemberWithParameters(requestMember: ts.TypeElement, context: TypeTransformContext) {\n if (!isRequestMember(requestMember) || requestMember.name.text === 'path') {\n return undefined;\n }\n\n if (requestMember.name.text === 'query') {\n return normalizeRequestQueryWithParameters(requestMember, context);\n }\n if (requestMember.name.text === 'header') {\n return normalizeRequestHeadersWithParameters(requestMember, context);\n }\n\n return requestMember;\n}\n\nfunction mergeRequestHeadersMember(headers: NormalizedRequestHeaders, otherHeaders: NormalizedRequestHeaders) {\n const newType = ts.factory.updateTypeLiteralNode(\n headers.type,\n ts.factory.createNodeArray([...otherHeaders.type.members, ...headers.type.members]),\n );\n\n return ts.factory.updatePropertySignature(\n headers,\n headers.modifiers,\n headers.name,\n headers.questionToken,\n newType satisfies NormalizedRequestHeaders['type'],\n ) satisfies ts.PropertySignature as NormalizedRequestHeaders;\n}\n\nfunction mergeRequestHeadersMembers(members: (ts.PropertySignature | undefined)[]) {\n let mergedHeaders: NormalizedRequestHeaders | undefined;\n let firstHeadersIndex: number | undefined;\n\n const mergedHeadersMembers = members.map((member, index) => {\n if (!member || !isNormalizedRequestHeaders(member)) {\n return member;\n }\n\n if (firstHeadersIndex === undefined || !mergedHeaders) {\n firstHeadersIndex = index;\n mergedHeaders = member;\n return member;\n }\n\n mergedHeaders = mergeRequestHeadersMember(mergedHeaders, member);\n return undefined;\n });\n\n if (firstHeadersIndex !== undefined) {\n mergedHeadersMembers[firstHeadersIndex] = mergedHeaders;\n }\n\n return mergedHeadersMembers.filter(isDefined);\n}\n\nfunction mergeRequestAndParameterTypes(\n requestType: ts.TypeNode,\n methodMembers: ts.TypeElement[],\n context: TypeTransformContext,\n) {\n const parameters = methodMembers.find(isRequestParameters);\n /* istanbul ignore next -- @preserve\n * Parameters member is always expected to be found. */\n const parametersMembers = parameters ? parameters.type.members : [];\n\n const requestMembers = ts.isTypeLiteralNode(requestType) ? requestType.members : [];\n\n const newMembers = mergeRequestHeadersMembers(\n [...parametersMembers, ...requestMembers].map((member) => {\n return normalizeRequestMemberWithParameters(member, context);\n }),\n );\n\n if (newMembers.length === 0) {\n return undefined;\n }\n\n return ts.factory.createTypeLiteralNode(newMembers);\n}\n\nfunction normalizeRequestTypeWithParameters(\n requestType: ts.TypeNode,\n methodMembers: ts.TypeElement[],\n context: TypeTransformContext,\n): ts.TypeNode | undefined {\n if (ts.isUnionTypeNode(requestType)) {\n const newTypes = requestType.types\n .map((type) => normalizeRequestTypeWithParameters(type, methodMembers, context))\n .filter(isDefined);\n return ts.factory.updateUnionTypeNode(requestType, ts.factory.createNodeArray(newTypes));\n }\n\n if (ts.isIndexedAccessTypeNode(requestType)) {\n const newType = normalizeRequestTypeWithParameters(ts.factory.createTypeLiteralNode([]), methodMembers, context);\n return ts.factory.createIntersectionTypeNode([requestType, newType].filter(isDefined));\n }\n\n return mergeRequestAndParameterTypes(requestType, methodMembers, context);\n}\n\nfunction normalizeMethodMemberWithParameters(\n methodMember: ts.PropertySignature,\n methodMembers: ts.TypeElement[],\n context: TypeTransformContext,\n) {\n /* istanbul ignore if -- @preserve\n * Method members are always expected to have a name and type at this point. */\n if (!ts.isIdentifier(methodMember.name) || !methodMember.type) {\n return undefined;\n }\n\n if (methodMember.name.text === 'request') {\n const newType = normalizeRequestTypeWithParameters(methodMember.type, methodMembers, context);\n\n if (!newType) {\n return undefined;\n }\n\n return ts.factory.updatePropertySignature(\n methodMember,\n methodMember.modifiers,\n methodMember.name,\n undefined,\n newType,\n );\n }\n\n if (methodMember.name.text === 'response') {\n return methodMember;\n }\n\n return undefined;\n}\n\nexport function normalizeTypeLiteralMethodType(methodType: ts.TypeLiteralNode, context: TypeTransformContext) {\n const newMembers = methodType.members\n .map((member) => normalizeMethodMember(member, context))\n .filter(isDefined)\n .map((member, _index, partialMembers) => normalizeMethodMemberWithParameters(member, partialMembers, context))\n .filter(isDefined);\n\n return ts.factory.updateTypeLiteralNode(methodType, ts.factory.createNodeArray(newMembers));\n}\n\nfunction normalizeIndexedAccessMethodType(methodType: ts.IndexedAccessTypeNode, context: TypeTransformContext) {\n const isOperationsReference =\n ts.isTypeReferenceNode(methodType.objectType) &&\n ts.isIdentifier(methodType.objectType.typeName) &&\n methodType.objectType.typeName.text === 'operations';\n\n /* istanbul ignore if -- @preserve\n * In indexed access method types, the reference is always expected to be an operation. */\n if (!isOperationsReference) {\n return methodType;\n }\n\n const newIdentifier = createOperationsIdentifier(context.serviceName);\n const newObjectType = ts.factory.createTypeReferenceNode(newIdentifier, methodType.objectType.typeArguments);\n\n const hasIndexTypeName =\n ts.isLiteralTypeNode(methodType.indexType) &&\n (ts.isIdentifier(methodType.indexType.literal) || ts.isStringLiteral(methodType.indexType.literal));\n\n /* istanbul ignore else -- @preserve\n * In indexed access method types referencing operations, an index type name is always expected. */\n if (hasIndexTypeName) {\n const operationName = methodType.indexType.literal.text;\n context.referencedTypes.operations.add(operationName);\n }\n\n return ts.factory.updateIndexedAccessTypeNode(methodType, newObjectType, methodType.indexType);\n}\n\nexport function normalizeMethod(method: ts.TypeElement, context: TypeTransformContext, options: { pathName: string }) {\n if (!isMethod(method)) {\n return undefined;\n }\n\n const methodName = method.name.text.toUpperCase<HttpMethod>();\n\n if (!HTTP_METHODS.includes(methodName)) {\n return undefined;\n }\n\n const matchesPositiveFilters =\n context.filters.paths.positive.length === 0 ||\n context.filters.paths.positive.some(\n (filter) => filter.methodRegex.test(methodName) && filter.pathRegex.test(options.pathName),\n );\n\n if (!matchesPositiveFilters) {\n return undefined;\n }\n\n const matchesNegativeFilters =\n context.filters.paths.negative.length > 0 &&\n context.filters.paths.negative.some(\n (filter) => filter.methodRegex.test(methodName) && filter.pathRegex.test(options.pathName),\n );\n\n if (matchesNegativeFilters) {\n return undefined;\n }\n\n const newIdentifier = ts.factory.createIdentifier(methodName);\n\n const newType = ts.isTypeLiteralNode(method.type)\n ? normalizeTypeLiteralMethodType(method.type, context)\n : normalizeIndexedAccessMethodType(method.type, context);\n\n return ts.factory.updatePropertySignature(method, method.modifiers, newIdentifier, method.questionToken, newType);\n}\n","import isDefined from '@zimic/utils/data/isDefined';\nimport { Override } from '@zimic/utils/types';\nimport ts from 'typescript';\n\nimport { renameComponentReferences } from './components';\nimport { TypeTransformContext } from './context';\nimport { normalizeMethod } from './methods';\n\nexport function createPathsIdentifier(serviceName: string) {\n return ts.factory.createIdentifier(`${serviceName}Schema`);\n}\n\ntype PathsDeclaration = ts.InterfaceDeclaration | ts.TypeAliasDeclaration;\n\nexport function isPathsDeclaration(node: ts.Node | undefined): node is PathsDeclaration {\n return (\n node !== undefined &&\n (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) &&\n node.name.text === 'paths'\n );\n}\n\ntype Path = Override<\n ts.PropertySignature,\n {\n type: ts.TypeLiteralNode | ts.IndexedAccessTypeNode;\n name: ts.Identifier | ts.StringLiteral;\n }\n>;\n\nfunction isPath(node: ts.TypeElement): node is Path {\n return (\n ts.isPropertySignature(node) &&\n (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name)) &&\n node.type !== undefined &&\n (ts.isTypeLiteralNode(node.type) || ts.isIndexedAccessTypeNode(node.type))\n );\n}\n\nfunction normalizePathNameWithParameters(pathName: string) {\n return pathName.replace(/{([^}]+)}/g, ':$1');\n}\n\nexport function normalizePath(\n path: ts.TypeElement,\n context: TypeTransformContext,\n options: { isComponent?: boolean } = {},\n) {\n const { isComponent = false } = options;\n\n /* istanbul ignore if -- @preserve\n * Path members are always expected to be a path. */\n if (!isPath(path)) {\n return undefined;\n }\n\n const newPathName = isComponent ? path.name.text : normalizePathNameWithParameters(path.name.text);\n const newIdentifier = isComponent ? path.name : ts.factory.createStringLiteral(newPathName);\n\n let newType: ts.TypeNode;\n\n if (ts.isTypeLiteralNode(path.type)) {\n const newMethods = path.type.members\n .map((method) => normalizeMethod(method, context, { pathName: newPathName }))\n .filter(isDefined);\n\n if (newMethods.length === 0) {\n return undefined;\n }\n\n newType = ts.factory.updateTypeLiteralNode(path.type, ts.factory.createNodeArray(newMethods));\n } else {\n newType = renameComponentReferences(path.type, context);\n }\n\n return ts.factory.updatePropertySignature(path, path.modifiers, newIdentifier, path.questionToken, newType);\n}\n\nfunction wrapPathsType(type: ts.TypeLiteralNode, context: TypeTransformContext) {\n context.typeImports.http.add('HttpSchema');\n\n const httpSchemaPathsWrapper = ts.factory.createIdentifier('HttpSchema');\n return ts.factory.createTypeReferenceNode(httpSchemaPathsWrapper, [type]);\n}\n\nexport function normalizePaths(pathsOrTypeAlias: PathsDeclaration, context: TypeTransformContext) {\n const newIdentifier = createPathsIdentifier(context.serviceName);\n\n const paths = ts.isTypeAliasDeclaration(pathsOrTypeAlias)\n ? ts.factory.createInterfaceDeclaration(pathsOrTypeAlias.modifiers, pathsOrTypeAlias.name, undefined, undefined, [])\n : pathsOrTypeAlias;\n\n const newMembers = paths.members.map((path) => normalizePath(path, context)).filter(isDefined);\n const newType = ts.factory.createTypeLiteralNode(newMembers);\n\n return ts.factory.createTypeAliasDeclaration(\n paths.modifiers,\n newIdentifier,\n paths.typeParameters,\n wrapPathsType(newType, context),\n );\n}\n","import isDefined from '@zimic/utils/data/isDefined';\nimport { Override } from '@zimic/utils/types';\nimport ts from 'typescript';\n\nimport { isNeverType, isUnknownType } from '../utils/types';\nimport { ComponentPath, TypeTransformContext } from './context';\nimport { normalizeContentType, normalizeResponse } from './methods';\nimport { normalizePath } from './paths';\n\nexport function createComponentsIdentifierText(serviceName: string) {\n return `${serviceName}Components`;\n}\n\nfunction createComponentsIdentifier(serviceName: string) {\n return ts.factory.createIdentifier(createComponentsIdentifierText(serviceName));\n}\n\ntype ComponentsDeclaration = ts.InterfaceDeclaration;\n\nexport function isComponentsDeclaration(\n node: ts.Node | undefined,\n context: TypeTransformContext,\n): node is ComponentsDeclaration {\n const componentIdentifiers = ['components', createComponentsIdentifierText(context.serviceName)];\n return node !== undefined && ts.isInterfaceDeclaration(node) && componentIdentifiers.includes(node.name.text);\n}\n\ntype ComponentGroup = Override<\n ts.PropertySignature,\n {\n type: ts.TypeLiteralNode;\n name: ts.Identifier | ts.StringLiteral;\n }\n>;\n\nfunction isComponentGroup(node: ts.TypeElement): node is ComponentGroup {\n return (\n ts.isPropertySignature(node) &&\n node.type !== undefined &&\n ts.isTypeLiteralNode(node.type) &&\n ts.isIdentifier(node.name)\n );\n}\n\ntype Component = Override<\n ts.PropertySignature,\n {\n type: ts.TypeNode;\n name: ts.Identifier | ts.StringLiteral;\n }\n>;\n\nfunction isComponent(node: ts.TypeElement): node is Component {\n return (\n ts.isPropertySignature(node) &&\n node.type !== undefined &&\n !isNeverType(node.type) &&\n (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name))\n );\n}\n\ntype RequestComponent = Override<Component, { type: ts.TypeLiteralNode }>;\n\nfunction isRequestComponent(node: Component): node is RequestComponent {\n return ts.isTypeLiteralNode(node.type);\n}\n\nfunction unchangedIndexedAccessTypeNode(node: ts.IndexedAccessTypeNode) {\n return node;\n}\n\nfunction visitComponentReferences(\n node: ts.TypeNode,\n context: TypeTransformContext & {\n isComponentIndexedAccess?: boolean;\n partialComponentPath?: string[];\n },\n options: {\n onComponentReference: (node: ts.IndexedAccessTypeNode, componentPath: ComponentPath) => void;\n renameComponentReference?: (\n node: ts.IndexedAccessTypeNode,\n resources: {\n objectType: ts.TypeReferenceNode;\n indexType: ts.LiteralTypeNode;\n componentGroupName: string;\n },\n ) => ts.IndexedAccessTypeNode;\n },\n): ts.TypeNode {\n const { onComponentReference, renameComponentReference = unchangedIndexedAccessTypeNode } = options;\n\n if (isUnknownType(node)) {\n return ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword);\n }\n\n if (ts.isTypeReferenceNode(node)) {\n const newTypeArguments = node.typeArguments?.map((type) => visitComponentReferences(type, context, options));\n return ts.factory.updateTypeReferenceNode(node, node.typeName, ts.factory.createNodeArray(newTypeArguments));\n }\n\n if (ts.isArrayTypeNode(node)) {\n const newElementType = visitComponentReferences(node.elementType, context, options);\n return ts.factory.updateArrayTypeNode(node, newElementType);\n }\n\n if (ts.isTupleTypeNode(node)) {\n const newElements = node.elements.map((element) => visitComponentReferences(element, context, options));\n return ts.factory.updateTupleTypeNode(node, ts.factory.createNodeArray(newElements));\n }\n\n if (ts.isUnionTypeNode(node)) {\n const newTypes = node.types.map((type) => visitComponentReferences(type, context, options));\n return ts.factory.updateUnionTypeNode(node, ts.factory.createNodeArray(newTypes));\n }\n\n if (ts.isIntersectionTypeNode(node)) {\n const newTypes = node.types.map((type) => visitComponentReferences(type, context, options));\n return ts.factory.updateIntersectionTypeNode(node, ts.factory.createNodeArray(newTypes));\n }\n\n if (ts.isParenthesizedTypeNode(node)) {\n const newType = visitComponentReferences(node.type, context, options);\n return ts.factory.updateParenthesizedType(node, newType);\n }\n\n if (ts.isTypeLiteralNode(node)) {\n const newMembers = node.members.map((member) => {\n if (ts.isPropertySignature(member) && member.type) {\n const newType = visitComponentReferences(member.type, context, options);\n return ts.factory.updatePropertySignature(member, member.modifiers, member.name, member.questionToken, newType);\n }\n\n /* istanbul ignore else -- @preserve */\n if (ts.isIndexSignatureDeclaration(member)) {\n const newType = visitComponentReferences(member.type, context, options);\n return ts.factory.updateIndexSignature(member, member.modifiers, member.parameters, newType);\n }\n\n /* istanbul ignore next -- @preserve\n * All members are expected to be either a property signature or an index signature. */\n return member;\n });\n\n return ts.factory.updateTypeLiteralNode(node, ts.factory.createNodeArray(newMembers));\n }\n\n if (ts.isIndexedAccessTypeNode(node)) {\n const isRootIndexedAccess = context.isComponentIndexedAccess ?? true;\n\n if (ts.isIndexedAccessTypeNode(node.objectType)) {\n const childContext: typeof context = { ...context, isComponentIndexedAccess: false };\n const newObjectType = visitComponentReferences(node.objectType, childContext, options);\n\n const newNode = ts.factory.updateIndexedAccessTypeNode(node, newObjectType, node.indexType);\n\n /* istanbul ignore else -- @preserve\n * Component indexed accesses are always expected to have child indexed accesses. */\n if (childContext.partialComponentPath && childContext.partialComponentPath.length > 0) {\n const hasIndexTypeName =\n ts.isLiteralTypeNode(node.indexType) &&\n (ts.isIdentifier(node.indexType.literal) || ts.isStringLiteral(node.indexType.literal));\n\n /* istanbul ignore else -- @preserve\n * Component indexed accesses are always expected to have child indexed accesses. */\n if (hasIndexTypeName) {\n const componentName = node.indexType.literal.text;\n childContext.partialComponentPath.push(componentName);\n }\n\n /* istanbul ignore else -- @preserve\n * Component indexed accesses are always expected to have child indexed accesses. */\n if (isRootIndexedAccess) {\n const componentGroupName = childContext.partialComponentPath[0];\n const componentName = childContext.partialComponentPath.slice(1).join('.');\n const componentPath = `${componentGroupName}.${componentName}` as const;\n onComponentReference(newNode, componentPath);\n }\n }\n\n return newNode;\n }\n\n const componentIdentifiers = ['components', createComponentsIdentifierText(context.serviceName)];\n\n const isComponentIndexedAccess =\n ts.isTypeReferenceNode(node.objectType) &&\n ts.isIdentifier(node.objectType.typeName) &&\n componentIdentifiers.includes(node.objectType.typeName.text) &&\n ts.isLiteralTypeNode(node.indexType) &&\n (ts.isIdentifier(node.indexType.literal) || ts.isStringLiteral(node.indexType.literal));\n\n /* istanbul ignore else -- @preserve\n * All indexed accesses are expected to point to components. */\n if (isComponentIndexedAccess) {\n const isRawComponent = node.objectType.typeName.text === 'components';\n const componentGroupName = node.indexType.literal.text;\n\n const newNode = isRawComponent\n ? renameComponentReference(node, {\n objectType: node.objectType,\n indexType: node.indexType,\n componentGroupName,\n })\n : node;\n\n const newNodeHasComponentGroupName =\n ts.isLiteralTypeNode(newNode.indexType) &&\n (ts.isIdentifier(newNode.indexType.literal) || ts.isStringLiteral(newNode.indexType.literal));\n\n /* istanbul ignore else -- @preserve\n * All component indexed accesses are expected to have an index type name. */\n if (newNodeHasComponentGroupName) {\n const newComponentGroupName = newNode.indexType.literal.text;\n context.partialComponentPath = [newComponentGroupName];\n }\n\n return newNode;\n }\n }\n\n return node;\n}\n\nexport function normalizeComponentGroupName(rawComponentGroupName: string) {\n if (rawComponentGroupName === 'requestBodies') {\n return 'requests';\n }\n return rawComponentGroupName;\n}\n\nexport function renameComponentReferences(node: ts.TypeNode, context: TypeTransformContext): ts.TypeNode {\n return visitComponentReferences(node, context, {\n onComponentReference(_node, componentPath) {\n context.referencedTypes.components.add(componentPath);\n },\n\n renameComponentReference(node, { indexType, objectType, componentGroupName }) {\n const newIdentifier = createComponentsIdentifier(context.serviceName);\n const newObjectType = ts.factory.updateTypeReferenceNode(objectType, newIdentifier, objectType.typeArguments);\n\n const newComponentGroupName = normalizeComponentGroupName(componentGroupName);\n const newIndexType = ts.factory.updateLiteralTypeNode(\n indexType,\n ts.factory.createStringLiteral(newComponentGroupName),\n );\n\n return ts.factory.updateIndexedAccessTypeNode(node, newObjectType, newIndexType);\n },\n });\n}\n\nfunction processPendingRequestComponentActions(component: RequestComponent, context: TypeTransformContext) {\n const pendingRequestActions = context.pendingActions.components.requests;\n\n const componentName = component.name.text;\n const shouldBeMarkedAsOptional = pendingRequestActions.toMarkBodyAsOptional.has(componentName);\n\n const bodyQuestionToken = shouldBeMarkedAsOptional\n ? ts.factory.createToken(ts.SyntaxKind.QuestionToken)\n : component.questionToken;\n\n pendingRequestActions.toMarkBodyAsOptional.delete(componentName);\n\n return { bodyQuestionToken };\n}\n\nfunction normalizeRequestComponent(component: Component, context: TypeTransformContext) {\n /* istanbul ignore if -- @preserve\n * Component group members in `requests` are always expected the be request components. */\n if (!isRequestComponent(component)) {\n return undefined;\n }\n\n const { bodyQuestionToken } = processPendingRequestComponentActions(component, context);\n const newType = normalizeContentType(component.type, context, { bodyQuestionToken });\n\n return ts.factory.updatePropertySignature(\n component,\n component.modifiers,\n component.name,\n component.questionToken,\n newType,\n );\n}\n\nfunction normalizeComponent(\n component: ts.TypeElement,\n componentGroupName: string,\n context: TypeTransformContext,\n): ts.TypeElement | undefined {\n /* istanbul ignore if -- @preserve\n * Component group members are always expected the be components. */\n if (!isComponent(component)) {\n return undefined;\n }\n\n if (componentGroupName === 'requests') {\n return normalizeRequestComponent(component, context);\n }\n\n if (componentGroupName === 'responses') {\n const responseComponent = normalizeResponse(component, context, { isComponent: true });\n return responseComponent?.newSignature;\n }\n\n if (componentGroupName === 'pathItems') {\n return normalizePath(component, context, { isComponent: true });\n }\n\n return ts.factory.updatePropertySignature(\n component,\n component.modifiers,\n component.name,\n component.questionToken,\n renameComponentReferences(component.type, context),\n );\n}\n\nfunction normalizeComponentGroup(componentGroup: ts.TypeElement, context: TypeTransformContext) {\n if (!isComponentGroup(componentGroup)) {\n return undefined;\n }\n\n const componentGroupName = normalizeComponentGroupName(componentGroup.name.text);\n const newIdentifier = ts.factory.createIdentifier(componentGroupName);\n\n const newComponents = componentGroup.type.members\n .map((component) => normalizeComponent(component, componentGroupName, context))\n .filter(isDefined);\n\n const newType = ts.factory.updateTypeLiteralNode(componentGroup.type, ts.factory.createNodeArray(newComponents));\n\n return ts.factory.updatePropertySignature(\n componentGroup,\n componentGroup.modifiers,\n newIdentifier,\n componentGroup.questionToken,\n newType,\n );\n}\n\nexport function normalizeComponents(components: ts.InterfaceDeclaration, context: TypeTransformContext) {\n const newIdentifier = createComponentsIdentifier(context.serviceName);\n\n const newMembers = components.members\n .map((componentGroup) => normalizeComponentGroup(componentGroup, context))\n .filter(isDefined);\n\n return ts.factory.updateInterfaceDeclaration(\n components,\n components.modifiers,\n newIdentifier,\n components.typeParameters,\n components.heritageClauses,\n newMembers,\n );\n}\n\nexport function populateReferencedComponents(components: ts.InterfaceDeclaration, context: TypeTransformContext) {\n const pathsToVisit = new Set(context.referencedTypes.components);\n\n while (pathsToVisit.size > 0) {\n const previousPathsToVisit = new Set(pathsToVisit);\n pathsToVisit.clear();\n\n for (const componentGroup of components.members) {\n if (!isComponentGroup(componentGroup)) {\n continue;\n }\n\n const componentGroupName = normalizeComponentGroupName(componentGroup.name.text);\n\n for (const component of componentGroup.type.members) {\n /* istanbul ignore if -- @preserve\n * Component group members are always expected the be components. */\n if (!isComponent(component)) {\n continue;\n }\n\n const componentName = component.name.text;\n const componentPath = `${componentGroupName}.${componentName}` as const;\n const isComponentToVisit = previousPathsToVisit.has(componentPath);\n\n if (!isComponentToVisit) {\n continue;\n }\n\n context.referencedTypes.components.add(componentPath);\n\n visitComponentReferences(component.type, context, {\n onComponentReference(_node, componentPath) {\n const isKnownReferencedComponent = context.referencedTypes.components.has(componentPath);\n if (!isKnownReferencedComponent) {\n pathsToVisit.add(componentPath);\n }\n },\n });\n }\n }\n }\n}\n\nexport function removeComponentIfUnreferenced(\n component: ts.TypeElement,\n componentGroupName: string,\n context: TypeTransformContext,\n) {\n /* istanbul ignore if -- @preserve\n * Component group members are always expected the be components. */\n if (!isComponent(component)) {\n return undefined;\n }\n\n const componentName = component.name.text;\n const componentPath = `${componentGroupName}.${componentName}` as const;\n\n if (context.referencedTypes.components.has(componentPath)) {\n context.referencedTypes.components.delete(componentPath);\n return component;\n }\n\n return undefined;\n}\n\nfunction removeUnreferencedComponentsInGroup(componentGroup: ts.TypeElement, context: TypeTransformContext) {\n /* istanbul ignore if -- @preserve\n * Component members are always expected the be component groups. */\n if (!isComponentGroup(componentGroup)) {\n return undefined;\n }\n\n const componentGroupName = normalizeComponentGroupName(componentGroup.name.text);\n\n const newComponents = componentGroup.type.members\n .map((component) => removeComponentIfUnreferenced(component, componentGroupName, context))\n .filter(isDefined);\n\n if (newComponents.length === 0) {\n return undefined;\n }\n\n return ts.factory.updatePropertySignature(\n componentGroup,\n componentGroup.modifiers,\n componentGroup.name,\n componentGroup.questionToken,\n ts.factory.updateTypeLiteralNode(componentGroup.type, ts.factory.createNodeArray(newComponents)),\n );\n}\n\nexport function removeUnreferencedComponents(components: ts.InterfaceDeclaration, context: TypeTransformContext) {\n const newComponentGroups = components.members\n .map((componentGroup) => removeUnreferencedComponentsInGroup(componentGroup, context))\n .filter(isDefined);\n\n context.referencedTypes.components.clear();\n\n if (newComponentGroups.length === 0) {\n return undefined;\n }\n\n return ts.factory.updateInterfaceDeclaration(\n components,\n components.modifiers,\n components.name,\n components.typeParameters,\n components.heritageClauses,\n newComponentGroups,\n );\n}\n","export function convertToPascalCase(value: string) {\n return value.replace(/(?:^|[^A-Za-z\\d])([A-Za-z\\d])/g, (_match, letter: string) => letter.toUpperCase());\n}\n","import isDefined from './isDefined';\n\nfunction isNonEmpty<Value>(value: Value): value is Exclude<NonNullable<Value>, ''> {\n return isDefined(value) && value !== '';\n}\n\nexport default isNonEmpty;\n","export function createPathCharactersToEscapeRegex() {\n return /([.(){}+$])/g;\n}\n\nexport function preparePathForRegex(path: string) {\n // We encode the path using the URL API because, differently from encodeURI and encodeURIComponent, URL does not\n // re-encode already encoded characters. Since URL requires a full URL, we use a data scheme and strip it later.\n const pathURLPrefix = `data:${path.startsWith('/') ? '' : '/'}`;\n const pathAsURL = new URL(`${pathURLPrefix}${path}`);\n const encodedPath = pathAsURL.href.replace(pathURLPrefix, '');\n\n return encodedPath.replace(/^\\/+/g, '').replace(/\\/+$/g, '').replace(createPathCharactersToEscapeRegex(), '\\\\$1');\n}\n\n// Path params names must match the JavaScript identifier pattern.\n// See // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers.\nexport function createPathParamRegex() {\n return /(?<escape>\\\\)?:(?<identifier>[$_\\p{ID_Start}][$\\p{ID_Continue}]+)/gu;\n}\n\nexport function createRepeatingPathParamRegex() {\n return /(?<escape>\\\\)?:(?<identifier>[$_\\p{ID_Start}][$\\p{ID_Continue}]+)\\\\+/gu;\n}\n\nexport function createOptionalPathParamRegex() {\n return /(?<leadingSlash>\\/)?(?<escape>\\\\)?:(?<identifier>[$_\\p{ID_Start}][$\\p{ID_Continue}]+)\\?(?<trailingSlash>\\/)?/gu;\n}\n\nexport function createOptionalRepeatingPathParamRegex() {\n return /(?<leadingSlash>\\/)?(?<escape>\\\\)?:(?<identifier>[$_\\p{ID_Start}][$\\p{ID_Continue}]+)\\*(?<trailingSlash>\\/)?/gu;\n}\n\nfunction createRegexFromPath(path: string) {\n const pathRegexContent = preparePathForRegex(path)\n .replace(\n createOptionalRepeatingPathParamRegex(),\n (\n _match,\n leadingSlash: string | undefined,\n escape: string | undefined,\n identifier: string,\n trailingSlash: string | undefined,\n ) => {\n if (escape) {\n return `:${identifier}`;\n }\n\n const hasSegmentBeforePrefix = leadingSlash === '/';\n const prefixExpression = hasSegmentBeforePrefix ? '/?' : leadingSlash;\n\n const hasSegmentAfterSuffix = trailingSlash === '/';\n const suffixExpression = hasSegmentAfterSuffix ? '/?' : trailingSlash;\n\n if (prefixExpression && suffixExpression) {\n return `(?:${prefixExpression}(?<${identifier}>.+?)?${suffixExpression})?`;\n } else if (prefixExpression) {\n return `(?:${prefixExpression}(?<${identifier}>.+?))?`;\n } else if (suffixExpression) {\n return `(?:(?<${identifier}>.+?)${suffixExpression})?`;\n } else {\n return `(?<${identifier}>.+?)?`;\n }\n },\n )\n .replace(createRepeatingPathParamRegex(), (_match, escape: string | undefined, identifier: string) => {\n return escape ? `:${identifier}` : `(?<${identifier}>.+)`;\n })\n .replace(\n createOptionalPathParamRegex(),\n (\n _match,\n leadingSlash: string | undefined,\n escape: string | undefined,\n identifier: string,\n trailingSlash: string | undefined,\n ) => {\n if (escape) {\n return `:${identifier}`;\n }\n\n const hasSegmentBeforePrefix = leadingSlash === '/';\n const prefixExpression = hasSegmentBeforePrefix ? '/?' : leadingSlash;\n\n const hasSegmentAfterSuffix = trailingSlash === '/';\n const suffixExpression = hasSegmentAfterSuffix ? '/?' : trailingSlash;\n\n if (prefixExpression && suffixExpression) {\n return `(?:${prefixExpression}(?<${identifier}>[^\\\\/]+?)?${suffixExpression})`;\n } else if (prefixExpression) {\n return `(?:${prefixExpression}(?<${identifier}>[^\\\\/]+?))?`;\n } else if (suffixExpression) {\n return `(?:(?<${identifier}>[^\\\\/]+?)${suffixExpression})?`;\n } else {\n return `(?<${identifier}>[^\\\\/]+?)?`;\n }\n },\n )\n .replace(createPathParamRegex(), (_match, escape: string | undefined, identifier: string) => {\n return escape ? `:${identifier}` : `(?<${identifier}>[^\\\\/]+?)`;\n });\n\n return new RegExp(`^/?${pathRegexContent}/?$`);\n}\n\nexport default createRegexFromPath;\n","import { preparePathForRegex } from './createRegexFromPath';\n\nfunction getSingleWildcardPathRegex() {\n return /(?<wildcardPrefix>^|[^*])(?<escape>\\\\)?\\*(?<wildcardSuffix>[^*]|$)/g;\n}\n\nfunction getDoubleWildcardPathRegex() {\n return /(?<escape>\\\\)?\\*\\*/g;\n}\n\nfunction getTripleWildcardPathRegex() {\n return /(?<escape>\\\\)?\\*\\*\\/\\*(?<wildcardSuffix>[^*]|$)/g;\n}\n\nfunction createWildcardRegexFromPath(path: string) {\n const pathRegexContent = preparePathForRegex(path)\n .replace(getTripleWildcardPathRegex(), (_match, escape: string | undefined, wildcardSuffix: string) => {\n return escape === '\\\\' ? `\\\\*\\\\*/\\\\*${wildcardSuffix}` : `**${wildcardSuffix}`;\n })\n .replace(\n getSingleWildcardPathRegex(),\n (_match, wildcardPrefix: string, escape: string | undefined, wildcardSuffix: string) => {\n return escape === '\\\\' ? `${wildcardPrefix}\\\\*${wildcardSuffix}` : `${wildcardPrefix}[^/]*${wildcardSuffix}`;\n },\n )\n .replace(getDoubleWildcardPathRegex(), (_match, escape: string | undefined) => {\n return escape === '\\\\' ? '\\\\*\\\\*' : '.*';\n });\n\n return new RegExp(`^/?${pathRegexContent}/?$`);\n}\n\nexport default createWildcardRegexFromPath;\n","function createCachedDynamicImport<ImportType>(\n importModuleDynamically: () => Promise<ImportType>,\n): () => Promise<ImportType> {\n let cachedImportResult: ImportType | undefined;\n\n return async function importModuleDynamicallyWithCache() {\n cachedImportResult ??= await importModuleDynamically();\n return cachedImportResult;\n };\n}\n\nexport default createCachedDynamicImport;\n","import createCachedDynamicImport from '@zimic/utils/import/createCachedDynamicImport';\nimport fs from 'fs';\nimport path from 'path';\n\nexport const importFile = createCachedDynamicImport(\n /* istanbul ignore next -- @preserve\n * Ignoring as Node.js >=20 provides a global File and the import fallback won't run. */\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n async () => globalThis.File ?? (await import('buffer')).File,\n);\n\nexport function replaceFileExtension(filePath: string, newExtension: string) {\n const parsedFilePath = path.parse(filePath);\n return path.join(parsedFilePath.dir, `${parsedFilePath.name}.${newExtension}`);\n}\n\nexport async function pathExists(path: string) {\n try {\n await fs.promises.access(path, fs.constants.R_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensurePathExists(path: string, options: { errorMessage: string }) {\n try {\n await fs.promises.access(path, fs.constants.R_OK);\n } catch (accessError) {\n const error = new Error(options.errorMessage);\n error.cause = accessError;\n throw error;\n }\n}\n","import isNonEmpty from '@zimic/utils/data/isNonEmpty';\nimport createWildcardRegexFromPath from '@zimic/utils/url/createWildcardRegexFromPath';\nimport fs from 'fs';\nimport color from 'picocolors';\n\nimport { HTTP_METHODS } from '@/types/schema';\nimport { ensurePathExists } from '@/utils/files';\nimport { logger } from '@/utils/logging';\n\nimport { TypePathFilter, TypePathFilters } from './context';\n\nconst HTTP_METHOD_OPTIONS = HTTP_METHODS.join('|');\nconst MODIFIER_GROUP = '(?<modifier>!?)';\nconst METHOD_FILTER_GROUP = `(?<method>(?:\\\\*|(?:${HTTP_METHOD_OPTIONS})(?:,\\\\s*(?:${HTTP_METHOD_OPTIONS}))*))`;\nconst PATH_FILTER_GROUP = '(?<path>.+)';\nconst FILTER_REGEX = new RegExp(`^${MODIFIER_GROUP}\\\\s*${METHOD_FILTER_GROUP}\\\\s+${PATH_FILTER_GROUP}$`, 'i');\n\nexport function parseRawFilter(rawFilter: string): TypePathFilter | undefined {\n const filterMatch = rawFilter.match(FILTER_REGEX);\n const { modifier: filterModifier, method: filteredMethodsOrWildcard, path: filteredPath } = filterMatch?.groups ?? {};\n\n const isValidFilter = !filteredMethodsOrWildcard || !filteredPath;\n\n if (isValidFilter) {\n logger.warn(`Warning: Filter could not be parsed and was ignored: ${color.yellow(rawFilter)}`);\n return undefined;\n }\n\n return {\n methodRegex: new RegExp(`(?:${filteredMethodsOrWildcard.toUpperCase().replace(/,/g, '|').replace(/\\*/g, '.*')})`),\n pathRegex: createWildcardRegexFromPath(filteredPath),\n isNegativeMatch: filterModifier === '!',\n };\n}\n\nexport function groupParsedFiltersByMatch(parsedFilters: (TypePathFilter | undefined)[]) {\n return parsedFilters.reduce<TypePathFilters>(\n (groupedFilters, filter) => {\n if (filter) {\n if (filter.isNegativeMatch) {\n groupedFilters.negative.push(filter);\n } else {\n groupedFilters.positive.push(filter);\n }\n }\n\n return groupedFilters;\n },\n { positive: [], negative: [] },\n );\n}\n\nexport async function readPathFiltersFromFile(filePath: string) {\n await ensurePathExists(filePath, {\n errorMessage: `Could not read filter file: ${color.yellow(filePath)}`,\n });\n\n const fileContent = await fs.promises.readFile(filePath, 'utf-8');\n const fileContentWithoutComments = fileContent.replace(/#.*$/gm, '');\n\n const filters = fileContentWithoutComments.split('\\n');\n return filters;\n}\n\nexport function ignoreEmptyFilters(filters: string[]) {\n return filters.map((line) => line.trim()).filter(isNonEmpty);\n}\n","import { convertToPascalCase } from '@/utils/strings';\n\nimport { parseRawFilter, groupParsedFiltersByMatch } from './filters';\n\nexport interface TypePathFilter {\n methodRegex: RegExp;\n pathRegex: RegExp;\n isNegativeMatch: boolean;\n}\n\nexport interface TypePathFilters {\n positive: TypePathFilter[];\n negative: TypePathFilter[];\n}\n\ntype HttpTypeImportName =\n | 'HttpSchema'\n | 'HttpFormData'\n | 'HttpSearchParams'\n | 'HttpStatusCode'\n | 'MergeHttpResponsesByStatusCode';\n\ntype OperationName = string;\nexport type OperationPath = OperationName;\n\nexport type ComponentGroupName = string;\nexport type ComponentName = string;\nexport type ComponentPath = `${ComponentGroupName}.${ComponentName}`;\n\nexport interface TypeTransformContext {\n serviceName: string;\n filters: {\n paths: TypePathFilters;\n };\n typeImports: {\n http: Set<HttpTypeImportName>;\n };\n referencedTypes: {\n operations: Set<OperationPath>;\n components: Set<ComponentPath>;\n };\n pendingActions: {\n components: {\n requests: { toMarkBodyAsOptional: Set<ComponentName> };\n };\n };\n}\n\nexport function createTypeTransformationContext(serviceName: string, rawFilters: string[]): TypeTransformContext {\n const parsedFilters = rawFilters.map(parseRawFilter);\n\n return {\n serviceName: convertToPascalCase(serviceName),\n filters: {\n paths: groupParsedFiltersByMatch(parsedFilters),\n },\n typeImports: {\n http: new Set(),\n },\n referencedTypes: {\n operations: new Set(),\n components: new Set(),\n },\n pendingActions: {\n components: {\n requests: { toMarkBodyAsOptional: new Set() },\n },\n },\n };\n}\n","import { createImportDeclaration, createImportSpecifier } from '../utils/types';\nimport { TypeTransformContext } from './context';\n\n/* istanbul ignore next -- @preserve\n * The root import module is defined at build time. The fallback is not expected to be used. */\nexport const TYPEGEN_HTTP_IMPORT_MODULE = process.env.TYPEGEN_HTTP_IMPORT_MODULE ?? '@zimic/http';\n\nexport function createImportDeclarations(context: TypeTransformContext) {\n const httpTypeImports = Array.from(context.typeImports.http).sort().map(createImportSpecifier);\n const httpImportDeclaration = createImportDeclaration(httpTypeImports, TYPEGEN_HTTP_IMPORT_MODULE, {\n typeOnly: true,\n });\n\n return [httpImportDeclaration];\n}\n","import createCachedDynamicImport from '@zimic/utils/import/createCachedDynamicImport';\nimport fs from 'fs';\nimport type { SchemaObject } from 'openapi-typescript';\nimport path from 'path';\nimport ts from 'typescript';\n\nimport { createBlobType, createNullType } from '../utils/types';\n\nconst importOpenapiTypeScript = createCachedDynamicImport(() => import('openapi-typescript'));\n\nfunction transformSchemaObject(schemaObject: SchemaObject) {\n if (schemaObject.format === 'binary') {\n const blobType = createBlobType();\n\n if (schemaObject.nullable) {\n const nullType = createNullType();\n return ts.factory.createUnionTypeNode([blobType, nullType]);\n }\n\n return blobType;\n }\n}\n\nfunction convertFilePathOrURLToURL(filePathOrURL: string) {\n try {\n return new URL(filePathOrURL);\n } catch {\n return new URL(`file://${path.resolve(filePathOrURL)}`);\n }\n}\n\nexport async function importTypesFromOpenAPI(filePathOrURL: string) {\n const schemaURL = convertFilePathOrURLToURL(filePathOrURL);\n\n const { default: generateTypesFromOpenAPI } = await importOpenapiTypeScript();\n\n const rawNodes = await generateTypesFromOpenAPI(schemaURL, {\n alphabetize: false,\n additionalProperties: false,\n excludeDeprecated: false,\n propertiesRequiredByDefault: false,\n defaultNonNullable: true,\n pathParamsAsTypes: false,\n emptyObjectsUnknown: true,\n exportType: false,\n arrayLength: false,\n immutable: false,\n enumValues: false,\n enum: false,\n silent: true,\n transform: transformSchemaObject,\n });\n\n return rawNodes;\n}\n\nexport async function convertTypesToString(nodes: ts.Node[], options: { includeComments: boolean }) {\n const { astToString: convertTypeASTToString } = await importOpenapiTypeScript();\n\n const typegenResult = convertTypeASTToString(nodes, {\n formatOptions: { removeComments: !options.includeComments },\n });\n\n return typegenResult;\n}\n\nexport function formatTypegenResultToOutput(typegenResult: string) {\n const formattedResult = typegenResult\n .replace(/^export (\\w+)/gm, '\\nexport $1')\n .replace(/^( {4})+/gm, (match) => match.replace(/ {4}/g, ' '));\n\n return [\n '// Auto-generated by @zimic/http.',\n '// NOTE: Do not manually edit this file. Changes will be overridden.\\n',\n formattedResult,\n ].join('\\n');\n}\n\nexport async function writeTypegenResultToStandardOutput(typegenResult: string) {\n await new Promise((resolve) => {\n process.stdout.write(typegenResult, 'utf-8', resolve);\n });\n}\n\nexport async function writeTypegenResultToFile(outputFilePath: string, formattedResult: string) {\n const outputDirectory = path.dirname(outputFilePath);\n await fs.promises.mkdir(outputDirectory, { recursive: true });\n\n await fs.promises.writeFile(outputFilePath, formattedResult);\n}\n","import isDefined from '@zimic/utils/data/isDefined';\nimport path from 'path';\nimport ts from 'typescript';\n\nimport {\n isComponentsDeclaration,\n normalizeComponents,\n populateReferencedComponents,\n removeUnreferencedComponents,\n} from './transform/components';\nimport { createTypeTransformationContext, TypeTransformContext } from './transform/context';\nimport { readPathFiltersFromFile, ignoreEmptyFilters } from './transform/filters';\nimport { createImportDeclarations } from './transform/imports';\nimport {\n convertTypesToString,\n importTypesFromOpenAPI,\n formatTypegenResultToOutput,\n writeTypegenResultToStandardOutput,\n writeTypegenResultToFile,\n} from './transform/io';\nimport { isOperationsDeclaration, normalizeOperations, removeUnreferencedOperations } from './transform/operations';\nimport { isPathsDeclaration, normalizePaths } from './transform/paths';\n\nconst RESOURCES_TO_REMOVE_IF_NOT_NORMALIZED = ['paths', 'webhooks', 'operations', 'components', '$defs'];\n\nfunction removeUnknownResources(node: ts.Node | undefined) {\n const isUnknownResource =\n !node ||\n ((ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node)) &&\n RESOURCES_TO_REMOVE_IF_NOT_NORMALIZED.includes(node.name.text));\n\n if (isUnknownResource) {\n return undefined;\n }\n\n return node;\n}\n\nfunction normalizeRawNodes(rawNodes: ts.Node[], context: TypeTransformContext, options: { prune: boolean }) {\n let normalizedNodes = rawNodes.map((node) => (isPathsDeclaration(node) ? normalizePaths(node, context) : node));\n\n if (options.prune) {\n normalizedNodes = normalizedNodes\n .map((node) => (isOperationsDeclaration(node) ? removeUnreferencedOperations(node, context) : node))\n .filter(isDefined);\n }\n\n normalizedNodes = normalizedNodes\n .map((node) => (isOperationsDeclaration(node) ? normalizeOperations(node, context) : node))\n .filter(isDefined);\n\n if (options.prune) {\n for (const node of normalizedNodes) {\n if (isComponentsDeclaration(node, context)) {\n populateReferencedComponents(node, context);\n }\n }\n\n normalizedNodes = normalizedNodes\n .map((node) => (isComponentsDeclaration(node, context) ? removeUnreferencedComponents(node, context) : node))\n .filter(isDefined);\n }\n\n normalizedNodes = normalizedNodes\n .map((node) => (isComponentsDeclaration(node, context) ? normalizeComponents(node, context) : node))\n .map(removeUnknownResources)\n .filter(isDefined);\n\n return normalizedNodes;\n}\n\n/** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\nexport interface OpenAPITypegenOptions {\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n input: string;\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n output?: string;\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n serviceName: string;\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n includeComments: boolean;\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n prune: boolean;\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n filters?: string[];\n /** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\n filterFile?: string;\n}\n\n/** @see {@link https://zimic.dev/docs/http/api/typegen#generatetypesfromopenapi `generateTypesFromOpenAPI()` API reference} */\nasync function generateTypesFromOpenAPI({\n input: inputFilePathOrURL,\n output: outputFilePath,\n serviceName,\n includeComments,\n prune,\n filters: filtersFromArguments = [],\n filterFile,\n}: OpenAPITypegenOptions) {\n const filtersFromFile = filterFile ? await readPathFiltersFromFile(path.resolve(filterFile)) : [];\n const filters = ignoreEmptyFilters([...filtersFromFile, ...filtersFromArguments]);\n\n const rawNodes = await importTypesFromOpenAPI(inputFilePathOrURL);\n const context = createTypeTransformationContext(serviceName, filters);\n const nodes = normalizeRawNodes(rawNodes, context, { prune });\n\n const importDeclarations = createImportDeclarations(context);\n\n for (const declaration of importDeclarations) {\n nodes.unshift(declaration);\n }\n\n const typegenResult = await convertTypesToString(nodes, { includeComments });\n const formattedTypegenResult = formatTypegenResultToOutput(typegenResult);\n\n const shouldWriteToStandardOutput = outputFilePath === undefined;\n\n if (shouldWriteToStandardOutput) {\n await writeTypegenResultToStandardOutput(formattedTypegenResult);\n } else {\n await writeTypegenResultToFile(path.resolve(outputFilePath), formattedTypegenResult);\n }\n}\n\nexport default generateTypesFromOpenAPI;\n"]}
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkB2CEMX5F_js = require('./chunk-B2CEMX5F.js');
|
|
5
5
|
var color = require('picocolors');
|
|
6
6
|
var yargs = require('yargs');
|
|
7
7
|
var helpers = require('yargs/helpers');
|
|
@@ -12,7 +12,7 @@ var color__default = /*#__PURE__*/_interopDefault(color);
|
|
|
12
12
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
|
-
var version = "1.1.
|
|
15
|
+
var version = "1.1.3";
|
|
16
16
|
|
|
17
17
|
// src/utils/time.ts
|
|
18
18
|
async function usingElapsedTime(callback) {
|
|
@@ -83,7 +83,7 @@ async function runCLI() {
|
|
|
83
83
|
}),
|
|
84
84
|
async (cliArguments) => {
|
|
85
85
|
const executionSummary = await usingElapsedTime(async () => {
|
|
86
|
-
await
|
|
86
|
+
await chunkB2CEMX5F_js.generate_default({
|
|
87
87
|
input: cliArguments.input,
|
|
88
88
|
output: cliArguments.output,
|
|
89
89
|
serviceName: cliArguments.serviceName,
|
|
@@ -98,7 +98,7 @@ async function runCLI() {
|
|
|
98
98
|
`(${formatElapsedTime(executionSummary.elapsedTime)})`
|
|
99
99
|
)}`;
|
|
100
100
|
const hasWrittenToStdout = outputFilePath === void 0;
|
|
101
|
-
|
|
101
|
+
chunkB2CEMX5F_js.logger[hasWrittenToStdout ? "warn" : "info"](successMessage);
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
).parse();
|