/** * `appCompose(...apps)` — multi-app composition. * * Takes one-or-more `App` values and returns ONE composite App whose * `interface` merges every child's wires (tagged by the source app), and * whose `containerOf(wire)` resolver routes each wire back to its source * app's container. * * const orders = createApp({ appName: "orders", ... }).wire(post("/orders"), placeOrder); * const billing = createApp({ appName: "billing", ... }).wire(post("/invoices"), createInvoice); * * const composite = appCompose(orders, billing); * * // composite is itself an App: endpoint.use(adopter).mount(composite).run() * * Composing also seals the composite's cross-BC contract: every leaf's * `.public()` primitives are collected into one lookup (name → owning * runtime) installed on each leaf runtime, so `ctx.query` / `ctx.send` of a * sibling's public primitive runs on the sibling — and a sibling's internals * stay unreachable. See `installPublicContract`. * * Optional third-arg overload — pass `{ onCollision }` as the last arg * to override the default collision policy (throw on duplicate * `(adapter, key)` pairs across child apps). */ import { type Wire } from "@nwire/wires"; import type { App } from "./create-app.js"; export type CollisionPolicy = "throw" | "first" | "last"; export interface AppComposeOptions { readonly onCollision?: CollisionPolicy; } export declare function appCompose(...args: [...App[], AppComposeOptions]): App; export declare function appCompose(...apps: App[]): App; /** * `containerOf(wire)` — resolves a wire to its source app's container. * Endpoint adopters call this when building per-request scopes so the * resolve path lands in the right app. For wires that came in via * `app.wire()` (not through `appCompose`) the wire carries no source * reference, and adopters fall back to the endpoint's default container. */ export declare function containerOf(wire: Wire): any | undefined;