from __future__ import annotations import json import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from worklib.graphql_client import execute_graphql # noqa: E402 def run(query: str) -> None: resp = execute_graphql(query=query) print(json.dumps(resp, ensure_ascii=False, indent=2)[:4000]) if __name__ == "__main__": run('query { __type(name: "PlaceType") { kind name enumValues { name } } }') run('query { __type(name: "PassTargetInput") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }') run('query { __type(name: "CreatePlaceMultipleDTO") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }') run('query { __type(name: "CreatePlaceDTO") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }') # list mutation field names to find binding operations for pass/service resp = execute_graphql(query='query { __schema { mutationType { fields { name } } } }') names = [f.get("name") for f in resp.get("data", {}).get("__schema", {}).get("mutationType", {}).get("fields", []) if isinstance(f, dict)] interesting = [n for n in names if n and any(x in n.lower() for x in ("pass", "service", "place"))] print(json.dumps({"interesting_mutations": interesting[:200]}, ensure_ascii=False, indent=2)) # show args for service<->place binding and createPass args_resp = execute_graphql( query='query { __schema { mutationType { fields { name args { name type { kind name ofType { kind name ofType { kind name } } } } } } } }' ) fields = args_resp.get("data", {}).get("__schema", {}).get("mutationType", {}).get("fields", []) focus = [f for f in fields if isinstance(f, dict) and f.get("name") in ("addPlaceToService", "removePlaceFromService", "createAccessService", "createService", "createPass")] print(json.dumps({"focus_fields": focus}, ensure_ascii=False, indent=2)[:4000]) run('query { __type(name: "AddPlaceToServiceInput") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }') run('query { __type(name: "RequestPassInput") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }') run('query { __type(name: "CreateAcessServiceInput") { kind name inputFields { name type { kind name ofType { kind name ofType { kind name } } } } } }')