UNPKG

@mesh-tech/mesh-cli

Version:

CLI for Mesh platform development utilities

93 lines (92 loc) 3.73 kB
export interface LocalMockDecl { mode?: ExternalMode; src?: string; compose?: string; openapi?: string; sandbox?: boolean; remote?: { env?: string; credentials?: Record<string, string>; profile?: string; }; displayName?: string; docs?: string | { url: string; provider?: string; }; port?: number; command?: string[]; env?: Record<string, string>; external?: string; credentials?: Record<string, string>; type?: string; healthPath?: string; probe?: "http" | "tcp"; } export type ExternalMode = "mock" | "local" | "remote"; export declare function externalMode(name: string, decl: LocalMockDecl): ExternalMode; export interface ExternalsSelection { names: string[]; overrides: Map<string, ExternalMode>; } export declare function parseExternalsSelection(input: string): ExternalsSelection; export declare function remoteInlineCredentials(decl: LocalMockDecl): Record<string, string> | undefined; export declare function isServiceMode(name: string, decl: LocalMockDecl): boolean; export interface MockEndpoint { url: string; host: string; port: number; } export declare function interpolateCredentialValue(raw: string, endpoint: MockEndpoint | undefined, env?: NodeJS.ProcessEnv): string; export declare function openapiMockCommand(decl: LocalMockDecl): string[]; export declare function composeProjectName(sessionName: string, mockName: string): string; export interface ComposeExternalRef { name: string; composeFile: string; project: string; } export type ComposeExternalPlan = { action: "up"; } | { action: "adopt-served"; container: string; } | { action: "adopt-stopped"; container: string; } | { action: "conflict"; container?: string; }; export interface ComposeExternalProbes { ownsRunning(composeFile: string, project: string): boolean; portServed(port: number): Promise<boolean>; foreignPinned(composeFile: string, project: string): string | undefined; portPublisher(composeFile: string, port: number): { container: string; definedByFile: boolean; } | undefined; } export declare function planComposeExternal(composeFile: string, project: string, port: number, probes: ComposeExternalProbes): Promise<ComposeExternalPlan>; export declare function composeExternalUp(appRoot: string, sessionName: string, name: string, decl: LocalMockDecl, probes?: ComposeExternalProbes): Promise<ComposeExternalRef | undefined>; export declare function composeExternalsDown(refs: ComposeExternalRef[] | undefined): void; export declare function readLocalMocks(appRoot: string): Record<string, LocalMockDecl>; export declare function externalSecretPath(tenant: string, external: string): string; export declare function fetchRemoteExternalCredentials(tenant: string, env: string, external: string, profile?: string): Promise<Record<string, string>>; export declare function resolveProbeTarget(mode: ExternalMode, decl: LocalMockDecl, endpoint: MockEndpoint | undefined, creds: Record<string, string>): { target: string; module?: "tcp_connect"; } | undefined; export declare function externalDisplayName(name: string, decl: LocalMockDecl): string; export declare function externalDocs(decl: LocalMockDecl): { url: string; provider?: string; } | undefined; export declare function localProbeFile(tenant: string, app: string, external: string): string; export declare function localProbesRemove(files: string[] | undefined): void; export declare function seedLocalMock(args: { tenant: string; app: string; name: string; decl: LocalMockDecl; endpoint?: MockEndpoint; }): Promise<string | undefined>;