import { ChannelInterface, OperationInterface, OperationReplyInterface } from '@asyncapi/parser'; import { z } from 'zod'; /** * Deep partial type that does NOT partial function arguments. */ export type DeepPartial = T extends Function ? T : T extends object ? { [P in keyof T]?: DeepPartial; } : T; /** * Merge a non optional value with custom optional values to form a full value that has all properties sat. */ export declare function mergePartialAndDefault>(defaultNonOptional: T, customOptional?: DeepPartial): T; /** * Find duplicates in array of objects based on property */ export declare function findDuplicatesInArray(array: any[], property: string): any[]; /** * Get OS type, abstracted away from special cases */ export declare function getOSType(): 'windows' | 'unix' | 'macos'; /** * Windows renders relative paths weird i.e. '\' instead of '/' */ export declare function ensureRelativePath(pathToCheck: string): string; /** * Ensure array has unique values only. */ export declare function ensureUniqueValuesInArray(array: any[]): any[]; export declare function findExtensionObject(parsedObj: any): any; export declare function findNameFromChannel(channel: ChannelInterface): string; export declare function findOperationId(operation: OperationInterface, channel: ChannelInterface): any; export declare function findNameFromOperation(operation: OperationInterface, channel: ChannelInterface): string; export declare function firstLowercase(name: string): string; export declare function findReplyId(operation: OperationInterface, reply: OperationReplyInterface, channel: ChannelInterface): string; /** * Extract JSDoc metadata from an AsyncAPI operation. * Returns description and deprecated flag for use in generated JSDoc comments. */ export declare function getOperationMetadata(operation: OperationInterface): { description?: string; deprecated?: boolean; }; export declare function onlyUnique(array: any[]): any[]; /** * Shared Zod schema for import extension configuration. * Used both globally (typescript.importExtension) and per-generator. * * - 'none': No extension (default, for bundlers and classic moduleResolution) * - '.ts': Add .ts extension (for moduleResolution: "node16"/"nodenext" with allowImportingTsExtensions) * - '.js': Add .js extension (for compiled ESM output) */ export declare const zodImportExtension: z.ZodOptional>; /** * Import extension type for TypeScript imports. * - 'none': No extension added (default, for bundlers and classic moduleResolution) * - '.ts': Add .ts extension (for moduleResolution: "node16" / "nodenext" with allowImportingTsExtensions) * - '.js': Add .js extension (for compiled ESM output) */ export type ImportExtension = 'none' | '.ts' | '.js'; /** * Appends file extension to import path based on configuration. * Used to support modern TypeScript moduleResolution settings like "node16" or "nodenext" * which require explicit file extensions in import statements. * * @param importPath - The relative import path (e.g., './payloads/User') * @param extension - The extension to append ('none', '.ts', or '.js') * @returns The import path with extension appended (or unchanged if 'none') * * @example * appendImportExtension('./payloads/User', '.ts') // => './payloads/User.ts' * appendImportExtension('./payloads/User', 'none') // => './payloads/User' */ export declare function appendImportExtension(importPath: string, extension: ImportExtension): string; /** * Resolves the effective import extension from generator config or global config. * Priority: generator.importExtension > config.importExtension > 'none' * * @param generator - Generator configuration that may have importExtension override * @param config - Global configuration that may have importExtension (optional) * @returns The resolved import extension ('none', '.ts', or '.js') * * @example * // Generator override takes precedence * resolveImportExtension({importExtension: '.js'}, {importExtension: '.ts'}) * // => '.js' * * // Falls back to global config * resolveImportExtension({}, {importExtension: '.ts'}) * // => '.ts' * * // Defaults to 'none' for backward compatibility * resolveImportExtension({}, {}) * // => 'none' */ export declare function resolveImportExtension(generator: { importExtension?: ImportExtension; }, config?: { importExtension?: ImportExtension; }): ImportExtension; /** * Portable path join function that works in both Node.js and browser environments. * Joins path segments with forward slashes and normalizes the result. * * @param segments - Path segments to join * @returns Joined path with normalized slashes * * @example * joinPath('src/models', 'User.ts') // => 'src/models/User.ts' * joinPath('src/models/', '/User.ts') // => 'src/models/User.ts' * joinPath('./src', './models', 'User.ts') // => './src/models/User.ts' */ export declare function joinPath(...segments: string[]): string; /** * Portable relative path function that works in both Node.js and browser environments. * Computes the relative path from one location to another. * * @param from - The starting directory path * @param to - The target path * @returns Relative path from 'from' to 'to' * * @example * relativePath('src/channels', 'src/models/User') // => '../models/User' * relativePath('src/a/b', 'src/a/c') // => '../c' * relativePath('src/models', 'src/models/User') // => 'User' */ export declare function relativePath(from: string, to: string): string;