// Only for typings exports export type AutowireIdStrategy = 'legacy' | 'readable'; export type AutowireAliasResolution = 'first' | 'first-or-unique' | 'unique' | 'unique-or-fail' | 'none'; export type PassConfigHook = 'beforeOptimization' | 'optimize' | 'beforeRemoving' | 'remove' | 'afterRemoving'; export type Parameter = string | boolean | object | any[]; export type Argument = TagReference | TaggedReference | Reference | KeyedReference | KeyedGroupReference | PackageReference | ParameterReference | any; export type ValidationSeverity = 'ERROR' | 'WARN' | 'INFO'; export type ValidationIssueType = | 'missing_dependency' | 'circular_dependency' | 'unresolved_parameter' | 'unused_nullable_fallback' | 'deprecated_service_in_use' | 'orphan_tagged_service' | 'keyed_group_multiple_defaults' | 'invalid_alias'; export interface ValidationIssue { severity: ValidationSeverity; type: ValidationIssueType; service: string; detail: string; message: string; } export interface CompileOptions { validate?: boolean; throwOnError?: boolean; } export type GraphFormat = 'mermaid' | 'dot' | 'json'; export interface ExportGraphOptions { filter?: RegExp | string | ((serviceId: string) => boolean); tag?: string; root?: string; depth?: number; excludePrivate?: boolean; } export interface GraphNode { id: string; class: string | null; scope: 'singleton' | 'prototype'; lazy: boolean; keyed?: { group: string; key: string; default: boolean; }; } export interface GraphEdge { from: string; to: string; type: 'constructor' | 'lazy' | 'method'; } export interface GraphGroup { name: string; type: 'keyed'; services: string[]; default: string | null; } export interface ExportedGraphJson { nodes: GraphNode[]; edges: GraphEdge[]; groups: GraphGroup[]; } export interface Extension { load: Function; } export interface Logger { warn(message?: any, ...optionalParams: any[]): void; info?(message?: any, ...optionalParams: any[]): void; debug?(message?: any, ...optionalParams: any[]): void; } export type Verbosity = 'silent' | 'warn' | 'info' | 'debug'; export interface CompilerPass { process(container: ContainerBuilder): Promise; } export interface Factory { Object: Object | Reference; method: string; } export interface Call { method: string; args: Argument[]; } export interface Tag { name: string; attributes: Map; } export class InstanceManager { constructor(containerBuilder: ContainerBuilder, definitions: Map, alias: Map); getInstance(id: any, bypassPublic?: boolean): any; getInstanceFromDefinition(definition: Definition): any; searchDefinitionsToOverrideArgs(): Map; searchNotOverrideDefinitionsByObject(Object: any): Map; } // Package exports export class ContainerBuilder { defaultDir: string; readonly containerReferenceAsService: boolean; readonly definitions: Map; readonly instanceManager: InstanceManager; readonly extensions: Extension[]; readonly services: Map; frozen: boolean; logger: Logger; verbosity: Verbosity; autowire: Autowire | null; constructor(containerReferenceAsService?: boolean, defaultDir?: string | null); addCompilerPass(compilerPass: any, type?: PassConfigHook, priority?: number): void; compile(): Promise; compile(options: CompileOptions & { validate: true }): Promise; compile(options?: CompileOptions): Promise; exportGraph(format: 'json', options?: ExportGraphOptions): ExportedGraphJson; exportGraph(format?: Exclude, options?: ExportGraphOptions): string; exportGraph(format: GraphFormat, options?: ExportGraphOptions): string | ExportedGraphJson; findDefinition(key: string): Promise; findTaggedServiceIds(name: string): Iterable<{id: string, definition: Definition}>; get(id: string): T; get(id: any): any; getDefinition(key: string): Definition; getParameter(key: string): T; getKeyed(group: string, key?: string | null): T; getKeyedGroup(group: string): Map; has(key: string): boolean; hasAlias(alias: string): boolean; hasDefinition(key: string): boolean; hasParameter(key: string): boolean; isSet(id: string): boolean; register(id: string, object?: any, args?: Argument[]): Definition; registerKeyed(group: string, key: string, object?: any, args?: Argument[]): Definition; registerExtension(extension: Extension): void; remove(id: string): void; removeDefinition(key: string): boolean; set(id: string, instance: any): void; setAlias(alias: string, id: string): void; setDefinition(id: string, definition: Definition): Definition; setParameter(key: string, value: Parameter): void; } export class Definition { Object: any args: Argument[]; appendArgs: Argument[]; overrideArgs: Argument[]; public: boolean; deprecated: string; lazy: boolean; decoratedService: string; decorationPriority: number; synthetic: boolean; shared: boolean; abstract: boolean; parent: string; keyedGroup: string | null; keyedKey: string | null; keyedDefault: boolean; readonly factory: Factory | null; readonly calls: Call[]; readonly tags: Tag[]; readonly properties: Map; readonly condition: Condition | null; readonly whenMissingId: string | null; readonly whenServiceExistsId: string | null; constructor(object?: any, args?: Argument[], overrideArgs?: Argument[]); addArgument(argument: Argument, append?: boolean): Definition; addMethodCall(method: string, args: any[]): Definition; addProperty(key: string, value: any): Definition; addTag(name: string, attributes?: Map): Definition; isPublic(bypassPublic?: boolean): boolean; setDefault(value: boolean): Definition; setFactory(Object: Reference | Object, method: string): void; setCondition(condition: Condition): Definition; whenMissing(id: string): Definition; whenServiceExists(id: string): Definition; } export class PackageReference { readonly id: string; constructor(id: string); } export class Reference { readonly id: string; readonly nullable: boolean; constructor(id: string, nullable?: boolean); } /** Legacy !tagged reference preserving definition order. */ export class TagReference { readonly name: string; constructor(name: string); } /** Symfony-style tagged collection reference with priority and optional indexing. */ export class TaggedReference { readonly tag: string; readonly indexAttribute: string | null; constructor(tag: string, indexAttribute?: string | null); } export class KeyedReference { readonly group: string; readonly key: string; constructor(group: string, key: string); } export class KeyedGroupReference { readonly group: string; constructor(group: string); } export class PassConfig { static readonly TYPE_BEFORE_OPTIMIZATION: PassConfigHook; static readonly TYPE_OPTIMIZE: PassConfigHook; static readonly TYPE_BEFORE_REMOVING: PassConfigHook; static readonly TYPE_REMOVE: PassConfigHook; static readonly TYPE_AFTER_REMOVING: PassConfigHook; static isValidType(type: string): boolean; } export class FileLoader { constructor(container: ContainerBuilder); load(file: string | null): Promise; } export class YamlFileLoader extends FileLoader { } export class JsFileLoader extends FileLoader { } export class JsonFileLoader extends JsFileLoader { } export class XmlFileLoader extends FileLoader { } export class Autowire { constructor (container: ContainerBuilder, tsConfigFullPath?: string); get container (): ContainerBuilder; autowireAliasResolution: AutowireAliasResolution; process (): Promise; addExclude(excludedPath: string): void; set serviceFile(serviceFile: ServiceFile); get serviceFile(): ServiceFile; get idStrategy(): AutowireIdStrategy; makeIdReadable(): void; makeIdLegacy(): void; } export class ServiceFile { constructor (servicesDumpPath: string, absolutePath?: boolean); generateFromContainer(container: ContainerBuilder): Promise; } export class ParameterReference { readonly key: string; constructor(key: string); } export class ValidationResult { readonly errors: ValidationIssue[]; readonly warnings: ValidationIssue[]; readonly info: ValidationIssue[]; readonly isValid: boolean; serviceCount: number; addError(type: ValidationIssueType, service: string, detail: string, message: string): void; addWarning(type: ValidationIssueType, service: string, detail: string, message: string): void; addInfo(type: ValidationIssueType, service: string, detail: string, message: string): void; } export class ContainerValidationError extends Error { readonly result: ValidationResult; constructor(result: ValidationResult); } export class AmbiguousAutowireException extends Error { constructor( interfaceName: string, interfaceId: string, serviceIds: string[], consumers?: Array<{service: string, argument: string}> ); } export class KeyedGroupMultipleDefaultsException extends Error { constructor(group: string, serviceIds: string[]); } export class ContainerValidator { constructor(container: ContainerBuilder); validate(): ValidationResult; } export class Condition { readonly type: string; readonly options: object; constructor(type: string, options?: object); isPhaseOne(): boolean; isPhaseTwo(): boolean; evaluate(): boolean; evaluatePhaseTwo(remainingIds: Set): boolean; static envExists(varName: string): Condition; static envEquals(varName: string, value: string): Condition; static custom(fn: () => boolean): Condition; static all(...conditions: Condition[]): Condition; static any(...conditions: Condition[]): Condition; static missing(id: string): Condition; static serviceExists(id: string): Condition; }