Auto-indexing service and GraphQL API for AT Protocol Records quickslice.slices.network/
atproto gleam graphql
at main 93 lines 3.0 kB view raw
1//// Public API for lexicon_graphql package 2//// 3//// This module re-exports the main public API functions and types. 4//// For more specialized usage, import specific submodules: 5//// - lexicon_graphql/schema/builder - Basic schema building 6//// - lexicon_graphql/schema/database - Database-backed schema building 7//// - lexicon_graphql/query/dataloader - Batching and pagination types 8//// - lexicon_graphql/mutation/builder - Mutation operations 9//// - lexicon_graphql/input/* - Input types (where, aggregate, connection) 10//// - lexicon_graphql/output/* - Output types (aggregate results) 11//// - lexicon_graphql/scalar/* - Custom scalar types (blob) 12 13// Import statements for re-exports 14import gleam/option.{type Option} 15import lexicon_graphql/internal/lexicon/parser as lexicon_parser 16import lexicon_graphql/mutation/builder as mutation_builder 17import lexicon_graphql/query/dataloader 18import lexicon_graphql/schema/builder as schema_builder 19import lexicon_graphql/schema/database as db_schema_builder 20import lexicon_graphql/types 21import swell/schema 22 23// Re-export core types 24pub type Lexicon = 25 types.Lexicon 26 27pub type Defs = 28 types.Defs 29 30pub type Def = 31 types.Def 32 33pub type RecordDef = 34 types.RecordDef 35 36pub type ObjectDef = 37 types.ObjectDef 38 39pub type Property = 40 types.Property 41 42// Re-export fetcher types 43pub type ViewerFetcher = 44 db_schema_builder.ViewerFetcher 45 46pub type NotificationFetcher = 47 db_schema_builder.NotificationFetcher 48 49// Re-export main schema building functions 50pub fn build_schema(lexicons: List(Lexicon)) { 51 schema_builder.build_schema(lexicons) 52} 53 54pub fn build_schema_with_subscriptions( 55 lexicons: List(Lexicon), 56 fetcher: db_schema_builder.RecordFetcher, 57 batch_fetcher: Option(dataloader.BatchFetcher), 58 paginated_batch_fetcher: Option(dataloader.PaginatedBatchFetcher), 59 create_factory: Option(mutation_builder.ResolverFactory), 60 update_factory: Option(mutation_builder.ResolverFactory), 61 delete_factory: Option(mutation_builder.ResolverFactory), 62 upload_blob_factory: Option(mutation_builder.UploadBlobResolverFactory), 63 aggregate_fetcher: Option(db_schema_builder.AggregateFetcher), 64 viewer_fetcher: Option(ViewerFetcher), 65 notification_fetcher: Option(NotificationFetcher), 66 viewer_state_fetcher: Option(dataloader.ViewerStateFetcher), 67 labels_fetcher: Option(db_schema_builder.LabelsFetcher), 68 custom_mutation_fields: Option(List(schema.Field)), 69 custom_query_fields: Option(List(schema.Field)), 70) { 71 db_schema_builder.build_schema_with_subscriptions( 72 lexicons, 73 fetcher, 74 batch_fetcher, 75 paginated_batch_fetcher, 76 create_factory, 77 update_factory, 78 delete_factory, 79 upload_blob_factory, 80 aggregate_fetcher, 81 viewer_fetcher, 82 notification_fetcher, 83 viewer_state_fetcher, 84 labels_fetcher, 85 custom_mutation_fields, 86 custom_query_fields, 87 ) 88} 89 90// Re-export lexicon parser 91pub fn parse_lexicon(json_str: String) { 92 lexicon_parser.parse_lexicon(json_str) 93}