/** * Service Name Resolver * * Resolves the `serviceName` field written per project into * architecture/dependencies.json — the name a CLIENT uses to address this app at * runtime (`new ClientConfig('helper-fsdb')`), i.e. its deployed Cloud Run * service name, NOT its nx project name. * * It is DECLARED, never derived. The three naming spaces have no mechanical * relationship, and any strip-the-suffix rule gets it wrong somewhere: * * nx project | serviceName | Cloud Run * helper-svr | helper-portal | helper-portal * helper-fsdb-svr | helper-fsdb | helper-fsdb * lang-server | lang | lang * * Declared in the project's own project.json, next to the code it names: * * { "metadata": { "webpieces": { "serviceName": "helper-fsdb" } } } * * Absent is legal and common — a library or a browser app is never addressed by * name. A node WITHOUT one simply cannot be the resolved target of a targeted * client call, and the runtime graph says so out loud rather than guessing. */ import { ProjectInfo } from './project-info'; /** The project.json key path holding the declared name: metadata.webpieces.serviceName. */ export declare const SERVICE_NAME_METADATA_PATH = "metadata.webpieces.serviceName"; /** The project.json key path holding a client's declared target: metadata.webpieces.callsService. */ export declare const CALLS_SERVICE_METADATA_PATH = "metadata.webpieces.callsService"; export declare class ServiceNameResolution { /** Declared service name, or null when none is declared (or resolution failed). */ readonly serviceName: string | null; /** Problem description when the declaration is present but unusable, otherwise null. */ readonly problem: string | null; constructor( /** Declared service name, or null when none is declared (or resolution failed). */ serviceName: string | null, /** Problem description when the declaration is present but unusable, otherwise null. */ problem: string | null); } /** * Read `metadata.webpieces.serviceName` from the project's project.json. A missing file, a missing * key, or an unparseable file all resolve to "not declared" — only a PRESENT-but-wrong value (empty * or not a string) is a problem, because that is a typo the author wants told about. */ export declare function resolveServiceName(info: ProjectInfo, workspaceRoot: string): ServiceNameResolution; /** * A client's declared target — the service it addresses when the call site cannot carry a literal * `ClientConfig` (the client is built in a SHARED library from a config field, so the literal lives * in the app, not the lib, one indirection away). Symmetric to `serviceName`: the IMPLEMENTING side * declares the name it answers to, the CALLING side declares the name it calls. * * Two shapes: * - a single string — every untargeted `uses` in this project aims at that one service (the common * case: most clients talk to exactly one server); * - an `{ apiClassName: serviceName }` map — the mixed case, a client that genuinely calls several. */ export declare class CallsServiceResolution { /** Declared target(s), or null when none is declared (or resolution failed). */ readonly callsService: string | Record | null; /** Problem description when the declaration is present but unusable, otherwise null. */ readonly problem: string | null; constructor( /** Declared target(s), or null when none is declared (or resolution failed). */ callsService: string | Record | null, /** Problem description when the declaration is present but unusable, otherwise null. */ problem: string | null); } /** * Read `metadata.webpieces.callsService` from the project's project.json. A missing file, a missing * key, or an unparseable file all resolve to "not declared". A PRESENT value must be either a * non-empty string or a non-empty object of non-empty string values — anything else is a typo the * author wants told about. */ export declare function resolveCallsService(info: ProjectInfo, workspaceRoot: string): CallsServiceResolution; /** * Two projects claiming the same service name make every targeted client edge ambiguous, so the * graph would have to guess. Reported as a metadata problem instead. Appends to `problems`. */ export declare function validateUniqueServiceNames(names: Map, problems: string[]): void;