Coverage for graphqler / core.py: 0%
17 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-18 23:20 -0400
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-18 23:20 -0400
1from graphqler.fuzzer import Fuzzer
2from graphqler.compiler import Compiler
3from graphqler.utils.config_handler import set_config
4from graphqler.utils.stats import Stats
5from graphqler.utils.objects_bucket import ObjectsBucket
6from graphqler.utils.api import API
9def compile_and_fuzz(path: str, url: str, input_config: dict | None = None) -> dict:
10 """
11 Runs the program in compile and fuzz mode.
13 Args:
14 path (str): Directory where all compilation outputs will be saved.
15 url (str): URL of the target.
16 input_config (dict, optional): A configuration dictionary with any overridden config values. Defaults to None.
18 Returns:
19 dict: A dictionary containing the following keys:
20 - 'objects_bucket' (ObjectsBucket): The bucket of created objects. See the `ObjectsBucket` class for more details.
21 - 'stats' (Stats): The stats object containing fuzzer statistics. See the `Stats` class for more details.
22 - 'total_queries' (int): The total number of queries.
23 - 'total_mutations' (int): The total number of mutations.
24 - 'total_objects' (int): The total number of objects.
25 - 'api' (API): The API object with API information. See the `API` class for more details.
26 - 'queries' (dict): A dictionary of queries { query_name: query_info }.
27 - 'mutations' (dict): A dictionary of mutations { mutation_name: mutation_info }.
28 - 'objects' (dict): A dictionary of objects { object_name: object_info }.
29 - 'input_objects' (dict): A dictionary of input objects { input_object_name: input_object_info }.
30 - 'enums' (dict): A dictionary of enums { enum_name: enum_info }.
31 - 'unions' (dict): A dictionary of unions { union_name: union_info }.
32 - 'interfaces' (dict): A dictionary of interfaces { interface_name: interface_info }.
33 - 'results' (dict): A dictionary of results { endpoint: Set(Result) }. See the `Result` class for more details.
34 """
35 if input_config:
36 set_config(input_config)
38 compiler = Compiler(path, url)
39 compiler.run()
41 fuzzer = Fuzzer(path, url)
42 fuzzer.run()
44 api: API = fuzzer.api
46 objects_bucket = ObjectsBucket(api=api).load()
47 stats = Stats().load()
49 return {
50 'objects_bucket': objects_bucket,
51 'stats': stats,
52 'api': fuzzer.api,
53 'results': stats.results
54 }