import type { Expr } from "./ast.ts"; type Scope = "collection" | "database" | "cluster"; export type SystemStageCall = { stageName: string; scope: Scope; /** The options-object argument, or null when called with no arguments. */ optionsExpr: Expr | null; /** Position of the `.(...)` call site (for first-stage / arg errors). */ callPos: number; }; /** * Cheap shape check: is `expr` a *direct* method call on a bare context-ref * node that should be handled as a diagnostic source stage? Used by the * `index.ts` dispatch auto-wrap to route such a top-level call into Pipeline * mode, and by `pipeline.ts` to gate `resolveSystemStageCall`. * * `$$` shares its method namespace with the union (`.push`) and facet * (`.filter`) sugars, so on `CollectionRef` this only claims a method that is * an actual diagnostic — at any scope, so `$$.currentOp()` still routes here to * get the wrong-scope hint — or a near-typo of one (`$$.indexStat()` → "did you * mean indexStats"). Anything else (`$$.pop()`) returns `false` and falls * through to the union validator's own `.push` / `.filter` guidance. * * On `$$$` / `$$$$` a direct call is a diagnostic-only namespace (lookups use a * `.coll.find(...)` chain, whose receiver is a `MemberAccess`, not a bare ref), * so every direct call routes here — wrong-scope and misspelled methods * included — to get a precise error downstream. */ export declare function isSystemStageCall(expr: Expr): boolean; /** * Resolve a direct ref method call (one that `isSystemStageCall` accepts) into * a validated `SystemStageCall`, or throw an actionable `CodegenError`: * * - wrong scope (`$$.currentOp()` — a database stage) → points at the right prefix * - unknown method (`$$.indexStat()`) → `Did you mean 'indexStats'?` * - a no-option stage given an argument (`$$.indexStats({})`) * - an option-bearing stage given >1 arg or a non-object arg * * Caller must have already checked `isSystemStageCall(expr)`. */ export declare function resolveSystemStageCall(expr: Expr): SystemStageCall; /** Message for a diagnostic source stage used anywhere but the first stage. */ export declare function notFirstStageMessage(call: SystemStageCall): string; export {}; //# sourceMappingURL=system-stage-translation.d.ts.map