MCPcopy Create free account
hub / github.com/codemix/graph / convertWithClause

Function convertWithClause

packages/graph/src/astToSteps.ts:798–823  ·  view source on GitHub ↗

* Convert a WITH clause into a WithStep.

(withClause: WithClause)

Source from the content-addressed store, hash-verified

796 * Convert a WITH clause into a WithStep.
797 */
798function convertWithClause(withClause: WithClause): WithStep {
799 const items: WithItemConfig[] = withClause.items.map((item) => convertWithItem(item));
800
801 // Convert ORDER BY if present
802 // Build alias map from WITH items for alias resolution
803 const aliasMap = buildWithAliasMap(withClause.items);
804 const orderBy = withClause.orderBy
805 ? withClause.orderBy.orders.map(
806 (order) => resolveOrderItem(order, aliasMap, true), // true = use alias directly for WITH ORDER BY
807 )
808 : undefined;
809
810 // Convert WHERE condition if present
811 const whereCondition = withClause.where
812 ? convertCondition(withClause.where.condition)
813 : undefined;
814
815 return new WithStep({
816 distinct: withClause.distinct,
817 items,
818 orderBy,
819 skip: withClause.skip,
820 limit: withClause.limit,
821 whereCondition,
822 });
823}
824
825/**
826 * Convert a WITH item AST node to a WithItemConfig.

Callers 2

processQuerySegmentsFunction · 0.85
processLegacyQueryFunction · 0.85

Calls 5

convertWithItemFunction · 0.85
buildWithAliasMapFunction · 0.85
resolveOrderItemFunction · 0.85
convertConditionFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected