flattenAST() — supabase Function Reference
Architecture documentation for the flattenAST() function in fields.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 8c15a3b0_a8b6_062a_e852_7c801cccbc6c["flattenAST()"] 0798a399_f545_735f_286b_381d55d69ca6["graphQLFields()"] 0798a399_f545_735f_286b_381d55d69ca6 -->|calls| 8c15a3b0_a8b6_062a_e852_7c801cccbc6c 7ce9f429_32c1_86c0_5cac_a798059f90e5["getSelections()"] 8c15a3b0_a8b6_062a_e852_7c801cccbc6c -->|calls| 7ce9f429_32c1_86c0_5cac_a798059f90e5 4e856584_4ea7_c3b1_92dd_d5f2fe44bb57["getDirectiveResults()"] 8c15a3b0_a8b6_062a_e852_7c801cccbc6c -->|calls| 4e856584_4ea7_c3b1_92dd_d5f2fe44bb57 35da8936_b438_abcc_24ef_5bb318355379["isFragment()"] 8c15a3b0_a8b6_062a_e852_7c801cccbc6c -->|calls| 35da8936_b438_abcc_24ef_5bb318355379 75bc06d8_082a_0747_bf76_cdd36f396563["getAST()"] 8c15a3b0_a8b6_062a_e852_7c801cccbc6c -->|calls| 75bc06d8_082a_0747_bf76_cdd36f396563 25f878c6_cb46_7aea_c38c_0534df600019["getArguments()"] 8c15a3b0_a8b6_062a_e852_7c801cccbc6c -->|calls| 25f878c6_cb46_7aea_c38c_0534df600019 style 8c15a3b0_a8b6_062a_e852_7c801cccbc6c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/resources/utils/fields.ts lines 119–154
function flattenAST(
ast: FieldNode | FragmentDefinitionNode | InlineFragmentNode,
info: GraphQLResolveInfo,
obj?: Record<string, any>
) {
obj = obj || {}
return getSelections(ast).reduce((flattened, a) => {
if (a.directives && a.directives.length) {
const { shouldInclude, shouldSkip } = getDirectiveResults(a, info)
if (shouldSkip || !shouldInclude) {
return flattened
}
}
if (isFragment(a)) {
flattened = flattenAST(getAST(a, info), info, flattened)
} else {
const name = a.name.value
if (options.excludedFields && options.excludedFields.indexOf(name) !== -1) {
return flattened
}
if (flattened[name] && flattened[name] !== '__arguments') {
Object.assign(flattened[name], flattenAST(a, info, flattened[name]))
} else {
flattened[name] = flattenAST(a, info)
}
if (options.processArguments) {
// check if the current field has arguments
if (a.arguments && a.arguments.length) {
Object.assign(flattened[name], { __arguments: getArguments(a, info) })
}
}
}
return flattened
}, obj)
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does flattenAST() do?
flattenAST() is a function in the supabase codebase.
What does flattenAST() call?
flattenAST() calls 5 function(s): getAST, getArguments, getDirectiveResults, getSelections, isFragment.
What calls flattenAST()?
flattenAST() is called by 1 function(s): graphQLFields.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free