Checks whether SQL contains any {{query:"..."}} composition tokens. Use this as a fast guard before calling ResolveComposition(). Only tokens that are SQL count: not those inside a comment, a string literal or a bracket-quoted identifier.
Parses all {{query:"..."}} tokens from SQL without resolving them. Useful for dependency extraction during the save pipeline. Only tokens that are SQL count: not those inside a comment, a string literal or a bracket-quoted identifier.
Uses MJLexer for structured tokenization instead of regex, providing full parsing of category paths, query names, and parameter lists.
The SQL text to parse
Array of parsed token metadata
Resolves the composition tokens of sql into CTEs without rendering sql itself: each
composed query is rendered with the static arguments its token passes (its own compositions
render as usual) and the result is assembled into one statement. The outer SQL's own template
tags, if any, stay as written. References resolve by full category path and name only.
The SQL containing composition tokens
Target database platform for SQL resolution
User context for permission checks on referenced queries
Optional_outerParams: Record<string, string>Not used: the outer SQL is not rendered, so its compositions take static arguments only. Kept for the signature.
OptionalinlineDependencies: QueryDependencySpec[]Optional inline dependency specs for transient query testing, searched before the saved queries. Inline dependencies skip governance validation (Reusable, IsApproved, UserCanRun).
CompositionResult with the composed SQL and provenance metadata
QueryCompositionEngine reads and resolves
{{query:"CategoryPath/QueryName(params)"}}composition tokens.Composition itself is render-then-compose (see
RenderPipeline.Run): each composed query is rendered with its own arguments and the plain SQL is assembled from the rendered parts. This class keeps the token-reading methods and ResolveComposition, which composes SQL whose compositions take static arguments only, without rendering the outer SQL.