import { Interface, Method, PropDefinitions } from "./types.mjs"; import prettier from "prettier"; import { JSONSchema4, JSONSchema4TypeName } from "json-schema"; import { OneOrMore } from "vtils/types"; /** * 抛出错误。 * * @param msg 错误信息 */ export declare function throwError(...msg: string[]): never; /** * 将路径统一为 unix 风格的路径。 * * @param path 路径 * @returns unix 风格的路径 */ export declare function toUnixPath(path: string): string; /** * 获得规范化的相对路径。 * * @param from 来源路径 * @param to 去向路径 * @returns 相对路径 */ export declare function getNormalizedRelativePath(from: string, to: string, options?: { keepExtension?: boolean; }): string; /** * 原地遍历 JSONSchema。 */ export declare function traverseJsonSchema(jsonSchema: JSONSchema4, cb: (jsonSchema: JSONSchema4, currentPath: Array) => JSONSchema4, currentPath?: Array): JSONSchema4; /** * 原地处理 JSONSchema。 * * @param jsonSchema 待处理的 JSONSchema * @returns 处理后的 JSONSchema */ export declare function processJsonSchema(jsonSchema: JSONSchema4, customTypeMapping: Record): JSONSchema4; /** * 获取适用于 JSTT 的 JSONSchema。 * * @param jsonSchema 待处理的 JSONSchema * @returns 适用于 JSTT 的 JSONSchema */ export declare function jsonSchemaToJSTTJsonSchema(jsonSchema: JSONSchema4, typeName: string): JSONSchema4; /** * 将 JSONSchema 字符串转为 JSONSchema 对象。 * * @param str 要转换的 JSONSchema 字符串 * @returns 转换后的 JSONSchema 对象 */ export declare function jsonSchemaStringToJsonSchema(str: string, customTypeMapping: Record): JSONSchema4; /** * 获得 JSON 数据的 JSONSchema 对象。 * * @param json JSON 数据 * @returns JSONSchema 对象 */ export declare function jsonToJsonSchema(json: object, customTypeMapping: Record): JSONSchema4; /** * 获得 mockjs 模板的 JSONSchema 对象。 * * @param template mockjs 模板 * @returns JSONSchema 对象 */ export declare function mockjsTemplateToJsonSchema(template: object, customTypeMapping: Record): JSONSchema4; /** * 获得属性定义列表的 JSONSchema 对象。 * * @param propDefinitions 属性定义列表 * @returns JSONSchema 对象 */ export declare function propDefinitionsToJsonSchema(propDefinitions: PropDefinitions, customTypeMapping: Record): JSONSchema4; /** * 根据 JSONSchema 对象生产 TypeScript 类型定义。 * * @param jsonSchema JSONSchema 对象 * @param typeName 类型名称 * @returns TypeScript 类型定义 */ export declare function jsonSchemaToType(jsonSchema: JSONSchema4, typeName: string): Promise; export declare function getRequestDataJsonSchema(interfaceInfo: Interface, customTypeMapping: Record): JSONSchema4; export declare function getResponseDataJsonSchema(interfaceInfo: Interface, customTypeMapping: Record, dataKey?: OneOrMore): JSONSchema4; export declare function reachJsonSchema(jsonSchema: JSONSchema4, path: OneOrMore): JSONSchema4; export declare function sortByWeights(list: T[]): T[]; export declare function isGetLikeMethod(method: Method): boolean; export declare function isPostLikeMethod(method: Method): boolean; export declare function getPrettier(cwd: string): Promise; export declare function getPrettierOptions(): Promise; export declare const getCachedPrettierOptions: typeof getPrettierOptions & { cache: import("vtils").AsyncMemoizeCacheMap; }; export declare function httpGet(url: string, query?: Record): Promise;