/** * Binding Table (pass 1 of the DI graph analyzer) * * Scans every source file in the project's TypeScript program (skipping .d.ts and * node_modules) and collects all Inversify bindings into a Map: * * - ContainerModule bodies: bind(TOKEN).to(Impl) / .toSelf() / .toConstantValue(x) * / .toDynamicValue(fn), with .inSingletonScope() etc. * - Decorators: @provideSingleton() / @provideTransient() (self-binding) * and @provideSingletonDefaultForApi(TOKEN) * * Arrays because multiInject tokens (e.g. HEADER_TYPES.PlatformHeadersExtension) are * bound once per ContainerModule across several packages. */ import * as ts from 'typescript'; import { Binding } from './model'; export declare class BindingTable { private readonly byToken; /** providerTokenKey -> the class its get() resolves. See bindFrameworkProvider. */ private readonly providerTargets; add(binding: Binding): void; lookup(tokenKey: string): Binding[]; /** Record `bindFrameworkProvider(ProviderClass, TargetClass)`. */ addProviderTarget(providerTokenKey: string, target: ts.ClassDeclaration): void; /** * The class a Provider hands out, if this token is a registered Provider subclass. * The walker follows this so `Factory -> XProvider -> X` is visible in the design, * instead of the provider dead-ending as an opaque toDynamicValue leaf. */ providerTarget(providerTokenKey: string): ts.ClassDeclaration | undefined; } /** * A class the walker treats as an EXTERNAL boundary: its declaration lives in a * `.d.ts` file or under `node_modules` — i.e. a published package outside this * nx workspace. The exact inverse of {@link isAnalyzableFile}'s file test. In an * nx monorepo internal libs resolve through tsconfig path mappings to real `.ts` * source, so they are NOT external and keep expanding; only third-party packages * (resolved to `.d.ts` in `node_modules`) trip this. Pass-2 renders such a class * as a leaf `external` node and stops — it does not descend into its ctor deps. */ export declare function isExternalClass(cls: ts.ClassDeclaration): boolean; /** * If `expr` is (or resolves through the checker to) a class declaration, return it. */ export declare function resolveClassDeclaration(expr: ts.Expression, checker: ts.TypeChecker): ts.ClassDeclaration | null; /** * True when `expr` (the argument to `.toDynamicValue(...)` / an Angular * `useFactory`) builds an API-client proxy: it contains a `createApiClient(Api, ...)` * call whose first argument resolves to an @ApiPath-decorated contract class. * * This is the DI-graph boundary marker for generated (and external) API clients: * the walk renders such a binding as an `api` leaf and stops, rather than * descending into the client's own transport config (ClientConfig → ...). */ export declare function isApiClientBoundary(expr: ts.Expression, checker: ts.TypeChecker): boolean; /** Return the decorator call expression when `decorator` is `@name(...)`, else null. */ export declare function decoratorCall(decorator: ts.Decorator): ts.CallExpression | null; /** The identifier name of a decorator like `@provideSingleton()` or `@inject(X)`. */ export declare function decoratorName(decorator: ts.Decorator): string | null; export declare function classDecorators(cls: ts.ClassDeclaration): ts.Decorator[]; /** * Pass 1: collect every binding in the program into a token-keyed table. */ export declare function collectBindings(program: ts.Program, checker: ts.TypeChecker, workspaceRoot: string): BindingTable;