Auto-indexing service and GraphQL API for AT Protocol Records quickslice.slices.network/
atproto gleam graphql

refactor: reorganize lexicon_graphql by GraphQL abstractions

Reorganize the lexicon_graphql package from a flat module structure to a
GraphQL-abstraction-based hierarchy with proper encapsulation.

Structure:
- schema/ - Schema building (builder, database)
- query/ - Query operations (dataloader)
- mutation/ - Mutation operations (builder)
- input/ - Input types (where, aggregate, connection)
- output/ - Output types (aggregate)
- scalar/ - Custom scalars (blob)
- internal/ - Implementation details
- lexicon/ - Lexicon-specific logic
- graphql/ - GraphQL utilities

Changes:
- Moved 18 modules to organized directories
- Created public API in main module with re-exports
- Updated all internal cross-references
- Updated 21 lexicon_graphql test files
- Updated 9 server files to use new public API
- Added MIGRATION.md guide

All tests passing:
- lexicon_graphql: 168 tests
- server: 179 tests

+1312 -125
+1119
docs/plans/2025-11-24-lexicon-graphql-reorganization.md
··· 1 + # Lexicon GraphQL Package Reorganization Implementation Plan 2 + 3 + > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. 4 + 5 + **Goal:** Reorganize the lexicon_graphql package structure from flat modules to a GraphQL-abstraction-based hierarchy (Schema/Query/Mutation/Input/Output/Scalar with internal/ for implementation details). 6 + 7 + **Architecture:** Move 18 modules into organized directories based on GraphQL operation types and concerns. Lexicon-specific logic moves to internal/lexicon/, GraphQL utilities to internal/graphql/. Main module (src/lexicon_graphql.gleam) becomes public API gateway with re-exports. All tests updated to reference new paths. 8 + 9 + **Tech Stack:** Gleam, file system operations, import path updates 10 + 11 + --- 12 + 13 + ## Task 1: Create Directory Structure 14 + 15 + **Files:** 16 + - Create: `lexicon_graphql/src/lexicon_graphql/schema/` (directory) 17 + - Create: `lexicon_graphql/src/lexicon_graphql/query/` (directory) 18 + - Create: `lexicon_graphql/src/lexicon_graphql/mutation/` (directory) 19 + - Create: `lexicon_graphql/src/lexicon_graphql/input/` (directory) 20 + - Create: `lexicon_graphql/src/lexicon_graphql/output/` (directory) 21 + - Create: `lexicon_graphql/src/lexicon_graphql/scalar/` (directory) 22 + - Create: `lexicon_graphql/src/lexicon_graphql/internal/` (directory) 23 + - Create: `lexicon_graphql/src/lexicon_graphql/internal/lexicon/` (directory) 24 + - Create: `lexicon_graphql/src/lexicon_graphql/internal/graphql/` (directory) 25 + 26 + **Step 1: Create all directories** 27 + 28 + Run: 29 + ```bash 30 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 31 + mkdir -p schema query mutation input output scalar internal/lexicon internal/graphql 32 + ``` 33 + 34 + Expected: Directories created successfully, no output 35 + 36 + **Step 2: Verify directory structure** 37 + 38 + Run: 39 + ```bash 40 + ls -la /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql/ 41 + ``` 42 + 43 + Expected: See new directories: schema, query, mutation, input, output, scalar, internal 44 + 45 + **Step 3: Commit** 46 + 47 + ```bash 48 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 49 + git add -A 50 + git commit -m "feat: create directory structure for GraphQL-based organization" 51 + ``` 52 + 53 + --- 54 + 55 + ## Task 2: Move Schema Modules 56 + 57 + **Files:** 58 + - Move: `lexicon_graphql/src/lexicon_graphql/schema_builder.gleam` → `lexicon_graphql/src/lexicon_graphql/schema/builder.gleam` 59 + - Move: `lexicon_graphql/src/lexicon_graphql/db_schema_builder.gleam` → `lexicon_graphql/src/lexicon_graphql/schema/database.gleam` 60 + 61 + **Step 1: Move schema_builder.gleam** 62 + 63 + Run: 64 + ```bash 65 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 66 + git mv schema_builder.gleam schema/builder.gleam 67 + ``` 68 + 69 + Expected: File moved successfully 70 + 71 + **Step 2: Move db_schema_builder.gleam** 72 + 73 + Run: 74 + ```bash 75 + git mv db_schema_builder.gleam schema/database.gleam 76 + ``` 77 + 78 + Expected: File moved successfully 79 + 80 + **Step 3: Update imports in schema/builder.gleam** 81 + 82 + File: `lexicon_graphql/src/lexicon_graphql/schema/builder.gleam` 83 + 84 + Find and replace all internal imports: 85 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 86 + - Any other module imports will be updated in later tasks after those modules move 87 + 88 + **Step 4: Update imports in schema/database.gleam** 89 + 90 + File: `lexicon_graphql/src/lexicon_graphql/schema/database.gleam` 91 + 92 + Find and replace: 93 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 94 + - Note: Other imports will be fixed in subsequent tasks 95 + 96 + **Step 5: Run tests to check for breakage** 97 + 98 + Run: 99 + ```bash 100 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 101 + gleam test 102 + ``` 103 + 104 + Expected: Tests will likely fail with import errors (expected at this stage) 105 + 106 + **Step 6: Commit** 107 + 108 + ```bash 109 + git add -A 110 + git commit -m "refactor: move schema modules to schema/ directory" 111 + ``` 112 + 113 + --- 114 + 115 + ## Task 3: Move Query Modules 116 + 117 + **Files:** 118 + - Move: `lexicon_graphql/src/lexicon_graphql/dataloader.gleam` → `lexicon_graphql/src/lexicon_graphql/query/dataloader.gleam` 119 + 120 + **Step 1: Move dataloader.gleam** 121 + 122 + Run: 123 + ```bash 124 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 125 + git mv dataloader.gleam query/dataloader.gleam 126 + ``` 127 + 128 + Expected: File moved successfully 129 + 130 + **Step 2: Update imports in query/dataloader.gleam** 131 + 132 + File: `lexicon_graphql/src/lexicon_graphql/query/dataloader.gleam` 133 + 134 + Update internal imports (will be fixed when those modules move): 135 + - Note: collection_meta, uri_extractor will be updated in later tasks 136 + 137 + **Step 3: Commit** 138 + 139 + ```bash 140 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 141 + git add -A 142 + git commit -m "refactor: move dataloader to query/ directory" 143 + ``` 144 + 145 + --- 146 + 147 + ## Task 4: Move Mutation Modules 148 + 149 + **Files:** 150 + - Move: `lexicon_graphql/src/lexicon_graphql/mutation_builder.gleam` → `lexicon_graphql/src/lexicon_graphql/mutation/builder.gleam` 151 + 152 + **Step 1: Move mutation_builder.gleam** 153 + 154 + Run: 155 + ```bash 156 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 157 + git mv mutation_builder.gleam mutation/builder.gleam 158 + ``` 159 + 160 + Expected: File moved successfully 161 + 162 + **Step 2: Update imports in mutation/builder.gleam** 163 + 164 + File: `lexicon_graphql/src/lexicon_graphql/mutation/builder.gleam` 165 + 166 + Update imports: 167 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 168 + - Note: Other imports will be updated after those modules move 169 + 170 + **Step 3: Commit** 171 + 172 + ```bash 173 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 174 + git add -A 175 + git commit -m "refactor: move mutation_builder to mutation/ directory" 176 + ``` 177 + 178 + --- 179 + 180 + ## Task 5: Move Input Modules 181 + 182 + **Files:** 183 + - Move: `lexicon_graphql/src/lexicon_graphql/where_input.gleam` → `lexicon_graphql/src/lexicon_graphql/input/where.gleam` 184 + - Move: `lexicon_graphql/src/lexicon_graphql/aggregate_input.gleam` → `lexicon_graphql/src/lexicon_graphql/input/aggregate.gleam` 185 + - Move: `lexicon_graphql/src/lexicon_graphql/connection.gleam` → `lexicon_graphql/src/lexicon_graphql/input/connection.gleam` 186 + 187 + **Step 1: Move where_input.gleam** 188 + 189 + Run: 190 + ```bash 191 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 192 + git mv where_input.gleam input/where.gleam 193 + ``` 194 + 195 + Expected: File moved successfully 196 + 197 + **Step 2: Move aggregate_input.gleam** 198 + 199 + Run: 200 + ```bash 201 + git mv aggregate_input.gleam input/aggregate.gleam 202 + ``` 203 + 204 + Expected: File moved successfully 205 + 206 + **Step 3: Move connection.gleam** 207 + 208 + Run: 209 + ```bash 210 + git mv connection.gleam input/connection.gleam 211 + ``` 212 + 213 + Expected: File moved successfully 214 + 215 + **Step 4: Commit** 216 + 217 + ```bash 218 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 219 + git add -A 220 + git commit -m "refactor: move input modules to input/ directory" 221 + ``` 222 + 223 + --- 224 + 225 + ## Task 6: Move Output Modules 226 + 227 + **Files:** 228 + - Move: `lexicon_graphql/src/lexicon_graphql/aggregate_types.gleam` → `lexicon_graphql/src/lexicon_graphql/output/aggregate.gleam` 229 + 230 + **Step 1: Move aggregate_types.gleam** 231 + 232 + Run: 233 + ```bash 234 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 235 + git mv aggregate_types.gleam output/aggregate.gleam 236 + ``` 237 + 238 + Expected: File moved successfully 239 + 240 + **Step 2: Commit** 241 + 242 + ```bash 243 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 244 + git add -A 245 + git commit -m "refactor: move aggregate_types to output/ directory" 246 + ``` 247 + 248 + --- 249 + 250 + ## Task 7: Move Scalar Modules 251 + 252 + **Files:** 253 + - Move: `lexicon_graphql/src/lexicon_graphql/blob_type.gleam` → `lexicon_graphql/src/lexicon_graphql/scalar/blob.gleam` 254 + 255 + **Step 1: Move blob_type.gleam** 256 + 257 + Run: 258 + ```bash 259 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 260 + git mv blob_type.gleam scalar/blob.gleam 261 + ``` 262 + 263 + Expected: File moved successfully 264 + 265 + **Step 2: Commit** 266 + 267 + ```bash 268 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 269 + git add -A 270 + git commit -m "refactor: move blob_type to scalar/ directory" 271 + ``` 272 + 273 + --- 274 + 275 + ## Task 8: Move Lexicon-Specific Modules to Internal 276 + 277 + **Files:** 278 + - Move: `lexicon_graphql/src/lexicon_graphql/lexicon_parser.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/parser.gleam` 279 + - Move: `lexicon_graphql/src/lexicon_graphql/nsid.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/nsid.gleam` 280 + - Move: `lexicon_graphql/src/lexicon_graphql/collection_meta.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/collection_meta.gleam` 281 + - Move: `lexicon_graphql/src/lexicon_graphql/lexicon_registry.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/registry.gleam` 282 + - Move: `lexicon_graphql/src/lexicon_graphql/ref_resolver.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/ref_resolver.gleam` 283 + - Move: `lexicon_graphql/src/lexicon_graphql/uri_extractor.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/lexicon/uri_extractor.gleam` 284 + 285 + **Step 1: Move lexicon_parser.gleam** 286 + 287 + Run: 288 + ```bash 289 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 290 + git mv lexicon_parser.gleam internal/lexicon/parser.gleam 291 + ``` 292 + 293 + Expected: File moved successfully 294 + 295 + **Step 2: Move nsid.gleam** 296 + 297 + Run: 298 + ```bash 299 + git mv nsid.gleam internal/lexicon/nsid.gleam 300 + ``` 301 + 302 + Expected: File moved successfully 303 + 304 + **Step 3: Move collection_meta.gleam** 305 + 306 + Run: 307 + ```bash 308 + git mv collection_meta.gleam internal/lexicon/collection_meta.gleam 309 + ``` 310 + 311 + Expected: File moved successfully 312 + 313 + **Step 4: Move lexicon_registry.gleam** 314 + 315 + Run: 316 + ```bash 317 + git mv lexicon_registry.gleam internal/lexicon/registry.gleam 318 + ``` 319 + 320 + Expected: File moved successfully 321 + 322 + **Step 5: Move ref_resolver.gleam** 323 + 324 + Run: 325 + ```bash 326 + git mv ref_resolver.gleam internal/lexicon/ref_resolver.gleam 327 + ``` 328 + 329 + Expected: File moved successfully 330 + 331 + **Step 6: Move uri_extractor.gleam** 332 + 333 + Run: 334 + ```bash 335 + git mv uri_extractor.gleam internal/lexicon/uri_extractor.gleam 336 + ``` 337 + 338 + Expected: File moved successfully 339 + 340 + **Step 7: Commit** 341 + 342 + ```bash 343 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 344 + git add -A 345 + git commit -m "refactor: move lexicon-specific modules to internal/lexicon/" 346 + ``` 347 + 348 + --- 349 + 350 + ## Task 9: Move GraphQL Utility Modules to Internal 351 + 352 + **Files:** 353 + - Move: `lexicon_graphql/src/lexicon_graphql/type_mapper.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/graphql/type_mapper.gleam` 354 + - Move: `lexicon_graphql/src/lexicon_graphql/object_type_builder.gleam` → `lexicon_graphql/src/lexicon_graphql/internal/graphql/object_builder.gleam` 355 + 356 + **Step 1: Move type_mapper.gleam** 357 + 358 + Run: 359 + ```bash 360 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 361 + git mv type_mapper.gleam internal/graphql/type_mapper.gleam 362 + ``` 363 + 364 + Expected: File moved successfully 365 + 366 + **Step 2: Move object_type_builder.gleam** 367 + 368 + Run: 369 + ```bash 370 + git mv object_type_builder.gleam internal/graphql/object_builder.gleam 371 + ``` 372 + 373 + Expected: File moved successfully 374 + 375 + **Step 3: Commit** 376 + 377 + ```bash 378 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 379 + git add -A 380 + git commit -m "refactor: move GraphQL utility modules to internal/graphql/" 381 + ``` 382 + 383 + --- 384 + 385 + ## Task 10: Fix All Internal Cross-References in Moved Modules 386 + 387 + **Files:** 388 + - Modify: All moved modules (18 files) to update their import statements 389 + 390 + **Context:** Now that all modules are in their final locations, we need to update all import paths throughout the package. This is a comprehensive search-and-replace task. 391 + 392 + **Step 1: Fix imports in schema/builder.gleam** 393 + 394 + File: `lexicon_graphql/src/lexicon_graphql/schema/builder.gleam` 395 + 396 + Find and replace imports (preserve the rest of the file exactly): 397 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid` 398 + - `import lexicon_graphql/type_mapper` → `import lexicon_graphql/internal/graphql/type_mapper` 399 + - `import lexicon_graphql/object_type_builder` → `import lexicon_graphql/internal/graphql/object_builder` 400 + - `import lexicon_graphql/lexicon_registry` → `import lexicon_graphql/internal/lexicon/registry` 401 + - `import lexicon_graphql/ref_resolver` → `import lexicon_graphql/internal/lexicon/ref_resolver` 402 + - `import lexicon_graphql/blob_type` → `import lexicon_graphql/scalar/blob` 403 + - `import lexicon_graphql/connection` → `import lexicon_graphql/input/connection` 404 + 405 + **Step 2: Fix imports in schema/database.gleam** 406 + 407 + File: `lexicon_graphql/src/lexicon_graphql/schema/database.gleam` 408 + 409 + Find and replace imports: 410 + - `import lexicon_graphql/schema_builder` → `import lexicon_graphql/schema/builder` 411 + - `import lexicon_graphql/mutation_builder` → `import lexicon_graphql/mutation/builder` 412 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid` 413 + - `import lexicon_graphql/type_mapper` → `import lexicon_graphql/internal/graphql/type_mapper` 414 + - `import lexicon_graphql/object_type_builder` → `import lexicon_graphql/internal/graphql/object_builder` 415 + - `import lexicon_graphql/collection_meta` → `import lexicon_graphql/internal/lexicon/collection_meta` 416 + - `import lexicon_graphql/uri_extractor` → `import lexicon_graphql/internal/lexicon/uri_extractor` 417 + - `import lexicon_graphql/where_input` → `import lexicon_graphql/input/where` 418 + - `import lexicon_graphql/aggregate_input` → `import lexicon_graphql/input/aggregate` 419 + - `import lexicon_graphql/dataloader` → `import lexicon_graphql/query/dataloader` 420 + - `import lexicon_graphql/connection` → `import lexicon_graphql/input/connection` 421 + - `import lexicon_graphql/blob_type` → `import lexicon_graphql/scalar/blob` 422 + - `import lexicon_graphql/aggregate_types` → `import lexicon_graphql/output/aggregate` 423 + 424 + **Step 3: Fix imports in query/dataloader.gleam** 425 + 426 + File: `lexicon_graphql/src/lexicon_graphql/query/dataloader.gleam` 427 + 428 + Find and replace imports: 429 + - `import lexicon_graphql/collection_meta` → `import lexicon_graphql/internal/lexicon/collection_meta` 430 + - `import lexicon_graphql/uri_extractor` → `import lexicon_graphql/internal/lexicon/uri_extractor` 431 + - `import lexicon_graphql/where_input` → `import lexicon_graphql/input/where` 432 + 433 + **Step 4: Fix imports in mutation/builder.gleam** 434 + 435 + File: `lexicon_graphql/src/lexicon_graphql/mutation/builder.gleam` 436 + 437 + Find and replace imports: 438 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid` 439 + - `import lexicon_graphql/type_mapper` → `import lexicon_graphql/internal/graphql/type_mapper` 440 + - `import lexicon_graphql/blob_type` → `import lexicon_graphql/scalar/blob` 441 + 442 + **Step 5: Fix imports in internal/lexicon/parser.gleam** 443 + 444 + File: `lexicon_graphql/src/lexicon_graphql/internal/lexicon/parser.gleam` 445 + 446 + Find and replace imports: 447 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` (already correct, but verify) 448 + 449 + **Step 6: Fix imports in internal/lexicon/collection_meta.gleam** 450 + 451 + File: `lexicon_graphql/src/lexicon_graphql/internal/lexicon/collection_meta.gleam` 452 + 453 + Find and replace imports: 454 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 455 + 456 + **Step 7: Fix imports in internal/lexicon/ref_resolver.gleam** 457 + 458 + File: `lexicon_graphql/src/lexicon_graphql/internal/lexicon/ref_resolver.gleam` 459 + 460 + Find and replace imports: 461 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 462 + 463 + **Step 8: Fix imports in internal/graphql/type_mapper.gleam** 464 + 465 + File: `lexicon_graphql/src/lexicon_graphql/internal/graphql/type_mapper.gleam` 466 + 467 + Find and replace imports: 468 + - `import lexicon_graphql/blob_type` → `import lexicon_graphql/scalar/blob` 469 + - `import lexicon_graphql/lexicon_registry` → `import lexicon_graphql/internal/lexicon/registry` 470 + - `import lexicon_graphql/ref_resolver` → `import lexicon_graphql/internal/lexicon/ref_resolver` 471 + 472 + **Step 9: Fix imports in internal/graphql/object_builder.gleam** 473 + 474 + File: `lexicon_graphql/src/lexicon_graphql/internal/graphql/object_builder.gleam` 475 + 476 + Find and replace imports: 477 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid` 478 + - `import lexicon_graphql/type_mapper` → `import lexicon_graphql/internal/graphql/type_mapper` 479 + - `import lexicon_graphql/lexicon_registry` → `import lexicon_graphql/internal/lexicon/registry` 480 + - `import lexicon_graphql/ref_resolver` → `import lexicon_graphql/internal/lexicon/ref_resolver` 481 + 482 + **Step 10: Fix imports in internal/lexicon/registry.gleam** 483 + 484 + File: `lexicon_graphql/src/lexicon_graphql/internal/lexicon/registry.gleam` 485 + 486 + Find and replace imports: 487 + - `import lexicon_graphql/types` → `import lexicon_graphql/types` 488 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid` 489 + 490 + **Step 11: Run build to check for import errors** 491 + 492 + Run: 493 + ```bash 494 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 495 + gleam build 496 + ``` 497 + 498 + Expected: Build should succeed (or reveal any remaining import issues) 499 + 500 + **Step 12: Commit** 501 + 502 + ```bash 503 + git add -A 504 + git commit -m "refactor: fix all internal cross-references after module reorganization" 505 + ``` 506 + 507 + --- 508 + 509 + ## Task 11: Update Main Module with Re-Exports 510 + 511 + **Files:** 512 + - Modify: `lexicon_graphql/src/lexicon_graphql.gleam` 513 + 514 + **Step 1: Read current main module** 515 + 516 + File: `lexicon_graphql/src/lexicon_graphql.gleam` 517 + 518 + Current content (approximately 5 lines with stub main function). 519 + 520 + **Step 2: Replace with public API re-exports** 521 + 522 + File: `lexicon_graphql/src/lexicon_graphql.gleam` 523 + 524 + Replace entire content with: 525 + 526 + ```gleam 527 + //// Public API for lexicon_graphql package 528 + //// 529 + //// This module re-exports the main public API functions and types. 530 + //// For more specialized usage, import specific submodules: 531 + //// - lexicon_graphql/schema/builder - Basic schema building 532 + //// - lexicon_graphql/schema/database - Database-backed schema building 533 + //// - lexicon_graphql/query/dataloader - Batching and pagination types 534 + //// - lexicon_graphql/mutation/builder - Mutation operations 535 + //// - lexicon_graphql/input/* - Input types (where, aggregate, connection) 536 + //// - lexicon_graphql/output/* - Output types (aggregate results) 537 + //// - lexicon_graphql/scalar/* - Custom scalar types (blob) 538 + 539 + // Re-export core types 540 + pub type Lexicon = 541 + types.Lexicon 542 + 543 + pub type Defs = 544 + types.Defs 545 + 546 + pub type Def = 547 + types.Def 548 + 549 + pub type RecordDef = 550 + types.RecordDef 551 + 552 + pub type ObjectDef = 553 + types.ObjectDef 554 + 555 + pub type Property = 556 + types.Property 557 + 558 + // Re-export main schema building functions 559 + pub fn build_schema(lexicons: List(Lexicon)) { 560 + schema_builder.build_schema(lexicons) 561 + } 562 + 563 + pub fn build_schema_with_subscriptions( 564 + lexicons: List(Lexicon), 565 + fetcher: db_schema_builder.RecordFetcher, 566 + batch_fetcher: Option(dataloader.BatchFetcher), 567 + paginated_batch_fetcher: Option(dataloader.PaginatedBatchFetcher), 568 + create_factory: Option(mutation_builder.ResolverFactory), 569 + update_factory: Option(mutation_builder.ResolverFactory), 570 + delete_factory: Option(mutation_builder.ResolverFactory), 571 + upload_blob_factory: Option(mutation_builder.UploadBlobResolverFactory), 572 + aggregate_fetcher: Option(db_schema_builder.AggregateFetcher), 573 + ) { 574 + db_schema_builder.build_schema_with_subscriptions( 575 + lexicons, 576 + fetcher, 577 + batch_fetcher, 578 + paginated_batch_fetcher, 579 + create_factory, 580 + update_factory, 581 + delete_factory, 582 + upload_blob_factory, 583 + aggregate_fetcher, 584 + ) 585 + } 586 + 587 + // Re-export lexicon parser 588 + pub fn parse_lexicon(json_str: String) { 589 + lexicon_parser.parse_lexicon(json_str) 590 + } 591 + 592 + // Import statements for re-exports 593 + import lexicon_graphql/types 594 + import lexicon_graphql/schema/builder as schema_builder 595 + import lexicon_graphql/schema/database as db_schema_builder 596 + import lexicon_graphql/query/dataloader 597 + import lexicon_graphql/mutation/builder as mutation_builder 598 + import lexicon_graphql/internal/lexicon/parser as lexicon_parser 599 + import gleam/option.{type Option} 600 + ``` 601 + 602 + **Step 3: Run build to verify** 603 + 604 + Run: 605 + ```bash 606 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 607 + gleam build 608 + ``` 609 + 610 + Expected: Build succeeds 611 + 612 + **Step 4: Commit** 613 + 614 + ```bash 615 + git add lexicon_graphql/src/lexicon_graphql.gleam 616 + git commit -m "feat: add public API re-exports to main module" 617 + ``` 618 + 619 + --- 620 + 621 + ## Task 12: Update Test Files 622 + 623 + **Files:** 624 + - Modify: All 18 test files in `lexicon_graphql/test/` directory 625 + 626 + **Context:** Test files import from the old module paths. Each needs to be updated to import from new locations. 627 + 628 + **Step 1: List all test files** 629 + 630 + Run: 631 + ```bash 632 + find /Users/chadmiller/code/quickslice/lexicon_graphql/test -name "*.gleam" -type f 633 + ``` 634 + 635 + Expected: List of approximately 18 test files 636 + 637 + **Step 2: Update schema_builder_test.gleam** 638 + 639 + File: `lexicon_graphql/test/lexicon_graphql/schema_builder_test.gleam` 640 + 641 + Find and replace: 642 + - `import lexicon_graphql/schema_builder` → `import lexicon_graphql/schema/builder as schema_builder` 643 + - `import lexicon_graphql/lexicon_parser` → `import lexicon_graphql/internal/lexicon/parser as lexicon_parser` 644 + - Any other old paths → new paths as needed 645 + 646 + **Step 3: Update db_schema_builder_test.gleam** 647 + 648 + File: `lexicon_graphql/test/lexicon_graphql/db_schema_builder_test.gleam` 649 + 650 + Find and replace: 651 + - `import lexicon_graphql/db_schema_builder` → `import lexicon_graphql/schema/database as db_schema_builder` 652 + - `import lexicon_graphql/lexicon_parser` → `import lexicon_graphql/internal/lexicon/parser as lexicon_parser` 653 + - `import lexicon_graphql/dataloader` → `import lexicon_graphql/query/dataloader` 654 + 655 + **Step 4: Update mutation_builder_test.gleam** 656 + 657 + File: `lexicon_graphql/test/lexicon_graphql/mutation_builder_test.gleam` 658 + 659 + Find and replace: 660 + - `import lexicon_graphql/mutation_builder` → `import lexicon_graphql/mutation/builder as mutation_builder` 661 + - `import lexicon_graphql/lexicon_parser` → `import lexicon_graphql/internal/lexicon/parser as lexicon_parser` 662 + 663 + **Step 5: Update dataloader_test.gleam** 664 + 665 + File: `lexicon_graphql/test/lexicon_graphql/dataloader_test.gleam` 666 + 667 + Find and replace: 668 + - `import lexicon_graphql/dataloader` → `import lexicon_graphql/query/dataloader` 669 + 670 + **Step 6: Update where_input_test.gleam** 671 + 672 + File: `lexicon_graphql/test/lexicon_graphql/where_input_test.gleam` 673 + 674 + Find and replace: 675 + - `import lexicon_graphql/where_input` → `import lexicon_graphql/input/where as where_input` 676 + 677 + **Step 7: Update aggregate_input_test.gleam** 678 + 679 + File: `lexicon_graphql/test/lexicon_graphql/aggregate_input_test.gleam` 680 + 681 + Find and replace: 682 + - `import lexicon_graphql/aggregate_input` → `import lexicon_graphql/input/aggregate as aggregate_input` 683 + 684 + **Step 8: Update connection_test.gleam** 685 + 686 + File: `lexicon_graphql/test/lexicon_graphql/connection_test.gleam` 687 + 688 + Find and replace: 689 + - `import lexicon_graphql/connection` → `import lexicon_graphql/input/connection as connection` 690 + 691 + **Step 9: Update blob_type_test.gleam** 692 + 693 + File: `lexicon_graphql/test/lexicon_graphql/blob_type_test.gleam` 694 + 695 + Find and replace: 696 + - `import lexicon_graphql/blob_type` → `import lexicon_graphql/scalar/blob as blob_type` 697 + 698 + **Step 10: Update lexicon_parser_test.gleam** 699 + 700 + File: `lexicon_graphql/test/lexicon_graphql/lexicon_parser_test.gleam` 701 + 702 + Find and replace: 703 + - `import lexicon_graphql/lexicon_parser` → `import lexicon_graphql/internal/lexicon/parser as lexicon_parser` 704 + 705 + **Step 11: Update nsid_test.gleam** 706 + 707 + File: `lexicon_graphql/test/lexicon_graphql/nsid_test.gleam` 708 + 709 + Find and replace: 710 + - `import lexicon_graphql/nsid` → `import lexicon_graphql/internal/lexicon/nsid as nsid` 711 + 712 + **Step 12: Update collection_meta_test.gleam** 713 + 714 + File: `lexicon_graphql/test/lexicon_graphql/collection_meta_test.gleam` 715 + 716 + Find and replace: 717 + - `import lexicon_graphql/collection_meta` → `import lexicon_graphql/internal/lexicon/collection_meta as collection_meta` 718 + 719 + **Step 13: Update type_mapper_test.gleam** 720 + 721 + File: `lexicon_graphql/test/lexicon_graphql/type_mapper_test.gleam` 722 + 723 + Find and replace: 724 + - `import lexicon_graphql/type_mapper` → `import lexicon_graphql/internal/graphql/type_mapper as type_mapper` 725 + 726 + **Step 14: Update object_type_builder_test.gleam** 727 + 728 + File: `lexicon_graphql/test/lexicon_graphql/object_type_builder_test.gleam` 729 + 730 + Find and replace: 731 + - `import lexicon_graphql/object_type_builder` → `import lexicon_graphql/internal/graphql/object_builder as object_type_builder` 732 + 733 + **Step 15: Update uri_extractor_test.gleam (if exists)** 734 + 735 + File: `lexicon_graphql/test/lexicon_graphql/uri_extractor_test.gleam` 736 + 737 + Find and replace: 738 + - `import lexicon_graphql/uri_extractor` → `import lexicon_graphql/internal/lexicon/uri_extractor as uri_extractor` 739 + 740 + **Step 16: Update ref_resolver_test.gleam (if exists)** 741 + 742 + File: `lexicon_graphql/test/lexicon_graphql/ref_resolver_test.gleam` 743 + 744 + Find and replace: 745 + - `import lexicon_graphql/ref_resolver` → `import lexicon_graphql/internal/lexicon/ref_resolver as ref_resolver` 746 + 747 + **Step 17: Update lexicon_registry_test.gleam (if exists)** 748 + 749 + File: `lexicon_graphql/test/lexicon_graphql/lexicon_registry_test.gleam` 750 + 751 + Find and replace: 752 + - `import lexicon_graphql/lexicon_registry` → `import lexicon_graphql/internal/lexicon/registry as lexicon_registry` 753 + 754 + **Step 18: Update aggregate_types_test.gleam (if exists)** 755 + 756 + File: `lexicon_graphql/test/lexicon_graphql/aggregate_types_test.gleam` 757 + 758 + Find and replace: 759 + - `import lexicon_graphql/aggregate_types` → `import lexicon_graphql/output/aggregate as aggregate_types` 760 + 761 + **Step 19: Run all tests** 762 + 763 + Run: 764 + ```bash 765 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 766 + gleam test 767 + ``` 768 + 769 + Expected: All tests pass 770 + 771 + **Step 20: Commit** 772 + 773 + ```bash 774 + git add test/ 775 + git commit -m "refactor: update all test imports to use new module paths" 776 + ``` 777 + 778 + --- 779 + 780 + ## Task 13: Update Server Imports - graphql_gleam.gleam 781 + 782 + **Files:** 783 + - Modify: `/Users/chadmiller/code/quickslice/server/src/graphql_gleam.gleam` 784 + 785 + **Step 1: Update imports at lines 21-24** 786 + 787 + File: `/Users/chadmiller/code/quickslice/server/src/graphql_gleam.gleam` 788 + 789 + Find lines 21-24: 790 + ```gleam 791 + import lexicon_graphql/aggregate_input 792 + import lexicon_graphql/dataloader 793 + import lexicon_graphql/db_schema_builder 794 + import lexicon_graphql/lexicon_parser 795 + ``` 796 + 797 + Replace with: 798 + ```gleam 799 + import lexicon_graphql/input/aggregate as aggregate_input 800 + import lexicon_graphql/query/dataloader 801 + import lexicon_graphql/schema/database as db_schema_builder 802 + import lexicon_graphql/internal/lexicon/parser as lexicon_parser 803 + ``` 804 + 805 + **Step 2: Run server build to verify** 806 + 807 + Run: 808 + ```bash 809 + cd /Users/chadmiller/code/quickslice/server 810 + gleam build 811 + ``` 812 + 813 + Expected: Build succeeds 814 + 815 + **Step 3: Commit** 816 + 817 + ```bash 818 + cd /Users/chadmiller/code/quickslice 819 + git add server/src/graphql_gleam.gleam 820 + git commit -m "refactor(server): update graphql_gleam imports for new lexicon_graphql structure" 821 + ``` 822 + 823 + --- 824 + 825 + ## Task 14: Update Server Imports - aggregates.gleam 826 + 827 + **Files:** 828 + - Modify: `/Users/chadmiller/code/quickslice/server/src/database/queries/aggregates.gleam` 829 + 830 + **Step 1: Update import at line 12** 831 + 832 + File: `/Users/chadmiller/code/quickslice/server/src/database/queries/aggregates.gleam` 833 + 834 + Find line 12: 835 + ```gleam 836 + import lexicon_graphql/aggregate_types 837 + ``` 838 + 839 + Replace with: 840 + ```gleam 841 + import lexicon_graphql/output/aggregate as aggregate_types 842 + ``` 843 + 844 + **Step 2: Run server build to verify** 845 + 846 + Run: 847 + ```bash 848 + cd /Users/chadmiller/code/quickslice/server 849 + gleam build 850 + ``` 851 + 852 + Expected: Build succeeds 853 + 854 + **Step 3: Commit** 855 + 856 + ```bash 857 + cd /Users/chadmiller/code/quickslice 858 + git add server/src/database/queries/aggregates.gleam 859 + git commit -m "refactor(server): update aggregates imports for new lexicon_graphql structure" 860 + ``` 861 + 862 + --- 863 + 864 + ## Task 15: Update Server Imports - where_converter.gleam 865 + 866 + **Files:** 867 + - Modify: `/Users/chadmiller/code/quickslice/server/src/where_converter.gleam` 868 + 869 + **Step 1: Update import at line 8** 870 + 871 + File: `/Users/chadmiller/code/quickslice/server/src/where_converter.gleam` 872 + 873 + Find line 8: 874 + ```gleam 875 + import lexicon_graphql/where_input 876 + ``` 877 + 878 + Replace with: 879 + ```gleam 880 + import lexicon_graphql/input/where as where_input 881 + ``` 882 + 883 + **Step 2: Run server build to verify** 884 + 885 + Run: 886 + ```bash 887 + cd /Users/chadmiller/code/quickslice/server 888 + gleam build 889 + ``` 890 + 891 + Expected: Build succeeds 892 + 893 + **Step 3: Commit** 894 + 895 + ```bash 896 + cd /Users/chadmiller/code/quickslice 897 + git add server/src/where_converter.gleam 898 + git commit -m "refactor(server): update where_converter imports for new lexicon_graphql structure" 899 + ``` 900 + 901 + --- 902 + 903 + ## Task 16: Final Verification - Run All Tests 904 + 905 + **Step 1: Run lexicon_graphql tests** 906 + 907 + Run: 908 + ```bash 909 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 910 + gleam test 911 + ``` 912 + 913 + Expected: All tests pass (100% success) 914 + 915 + **Step 2: Run server tests (if any)** 916 + 917 + Run: 918 + ```bash 919 + cd /Users/chadmiller/code/quickslice/server 920 + gleam test 921 + ``` 922 + 923 + Expected: All tests pass 924 + 925 + **Step 3: Build both packages** 926 + 927 + Run: 928 + ```bash 929 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 930 + gleam build 931 + cd /Users/chadmiller/code/quickslice/server 932 + gleam build 933 + ``` 934 + 935 + Expected: Both build successfully with no errors 936 + 937 + **Step 4: Verify no orphaned files remain** 938 + 939 + Run: 940 + ```bash 941 + cd /Users/chadmiller/code/quickslice/lexicon_graphql/src/lexicon_graphql 942 + ls -la *.gleam 943 + ``` 944 + 945 + Expected: Only `lexicon_graphql.gleam` and `types.gleam` should remain at the root level 946 + 947 + **Step 5: Commit verification results (if any changes)** 948 + 949 + If any issues were found and fixed: 950 + ```bash 951 + cd /Users/chadmiller/code/quickslice 952 + git add -A 953 + git commit -m "fix: address final verification issues" 954 + ``` 955 + 956 + --- 957 + 958 + ## Task 17: Documentation Update 959 + 960 + **Files:** 961 + - Create: `lexicon_graphql/MIGRATION.md` 962 + 963 + **Step 1: Create migration guide** 964 + 965 + File: `lexicon_graphql/MIGRATION.md` 966 + 967 + ```markdown 968 + # Migration Guide: lexicon_graphql v1.x to v2.x 969 + 970 + ## Overview 971 + 972 + The lexicon_graphql package has been reorganized to follow GraphQL abstractions (Schema/Query/Mutation/Input/Output/Scalar) with internal implementation details moved to `internal/`. 973 + 974 + ## Import Path Changes 975 + 976 + ### Schema Building 977 + - `lexicon_graphql/schema_builder` → `lexicon_graphql/schema/builder` 978 + - `lexicon_graphql/db_schema_builder` → `lexicon_graphql/schema/database` 979 + 980 + ### Query 981 + - `lexicon_graphql/dataloader` → `lexicon_graphql/query/dataloader` 982 + 983 + ### Mutation 984 + - `lexicon_graphql/mutation_builder` → `lexicon_graphql/mutation/builder` 985 + 986 + ### Input Types 987 + - `lexicon_graphql/where_input` → `lexicon_graphql/input/where` 988 + - `lexicon_graphql/aggregate_input` → `lexicon_graphql/input/aggregate` 989 + - `lexicon_graphql/connection` → `lexicon_graphql/input/connection` 990 + 991 + ### Output Types 992 + - `lexicon_graphql/aggregate_types` → `lexicon_graphql/output/aggregate` 993 + 994 + ### Scalar Types 995 + - `lexicon_graphql/blob_type` → `lexicon_graphql/scalar/blob` 996 + 997 + ### Internal Modules (moved to internal/) 998 + - `lexicon_graphql/lexicon_parser` → `lexicon_graphql/internal/lexicon/parser` 999 + - `lexicon_graphql/nsid` → `lexicon_graphql/internal/lexicon/nsid` 1000 + - `lexicon_graphql/collection_meta` → `lexicon_graphql/internal/lexicon/collection_meta` 1001 + - `lexicon_graphql/lexicon_registry` → `lexicon_graphql/internal/lexicon/registry` 1002 + - `lexicon_graphql/ref_resolver` → `lexicon_graphql/internal/lexicon/ref_resolver` 1003 + - `lexicon_graphql/uri_extractor` → `lexicon_graphql/internal/lexicon/uri_extractor` 1004 + - `lexicon_graphql/type_mapper` → `lexicon_graphql/internal/graphql/type_mapper` 1005 + - `lexicon_graphql/object_type_builder` → `lexicon_graphql/internal/graphql/object_builder` 1006 + 1007 + ## Recommended Usage 1008 + 1009 + ### Option 1: Use Main Module (Simplest) 1010 + 1011 + ```gleam 1012 + import lexicon_graphql 1013 + 1014 + // Parse lexicons 1015 + let lexicons = lexicon_graphql.parse_lexicon(json_string) 1016 + 1017 + // Build schema 1018 + let schema = lexicon_graphql.build_schema(lexicons) 1019 + 1020 + // Or build with database 1021 + let schema = lexicon_graphql.build_schema_with_subscriptions( 1022 + lexicons, 1023 + fetcher, 1024 + // ... other args 1025 + ) 1026 + ``` 1027 + 1028 + ### Option 2: Import Specific Modules 1029 + 1030 + ```gleam 1031 + import lexicon_graphql/internal/lexicon/parser 1032 + import lexicon_graphql/schema/database 1033 + import lexicon_graphql/query/dataloader 1034 + 1035 + let lexicons = parser.parse_lexicon(json_string) 1036 + let schema = database.build_schema_with_subscriptions(/* ... */) 1037 + ``` 1038 + 1039 + ## Breaking Changes 1040 + 1041 + - Modules in `internal/` are considered implementation details and may change without notice 1042 + - If you were importing internal modules directly, update to new paths or use the main module API 1043 + 1044 + ## Benefits 1045 + 1046 + ✅ Clear organization by GraphQL concepts 1047 + ✅ Reduced public API surface 1048 + ✅ Better separation of concerns 1049 + ✅ Future-ready for subscriptions 1050 + ``` 1051 + 1052 + **Step 2: Commit documentation** 1053 + 1054 + ```bash 1055 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 1056 + git add MIGRATION.md 1057 + git commit -m "docs: add migration guide for v2.x reorganization" 1058 + ``` 1059 + 1060 + --- 1061 + 1062 + ## Task 18: Final Commit and Tag 1063 + 1064 + **Step 1: Review all changes** 1065 + 1066 + Run: 1067 + ```bash 1068 + cd /Users/chadmiller/code/quickslice 1069 + git log --oneline --graph -20 1070 + ``` 1071 + 1072 + Expected: See all commits from this reorganization 1073 + 1074 + **Step 2: Create summary of changes** 1075 + 1076 + View the file structure: 1077 + ```bash 1078 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 1079 + tree src/lexicon_graphql -L 3 1080 + ``` 1081 + 1082 + Expected: See organized directory structure with schema/, query/, mutation/, input/, output/, scalar/, internal/ 1083 + 1084 + **Step 3: Tag the release (optional)** 1085 + 1086 + If this is a new version: 1087 + ```bash 1088 + cd /Users/chadmiller/code/quickslice/lexicon_graphql 1089 + git tag -a v2.0.0 -m "feat: reorganize package by GraphQL abstractions" 1090 + ``` 1091 + 1092 + **Step 4: Done!** 1093 + 1094 + Reorganization complete. The package now follows GraphQL abstractions with clear public API boundaries. 1095 + 1096 + --- 1097 + 1098 + ## Verification Checklist 1099 + 1100 + - [ ] All 18 modules moved to new locations 1101 + - [ ] All internal cross-references updated 1102 + - [ ] Main module has re-exports 1103 + - [ ] All 18 test files updated and passing 1104 + - [ ] Server imports updated (3 files) 1105 + - [ ] Server builds successfully 1106 + - [ ] lexicon_graphql builds successfully 1107 + - [ ] No orphaned files at root level (except types.gleam and lexicon_graphql.gleam) 1108 + - [ ] Migration guide created 1109 + - [ ] All changes committed 1110 + 1111 + --- 1112 + 1113 + ## Notes 1114 + 1115 + - **DRY:** No duplication - each module moved once 1116 + - **YAGNI:** Only moved existing modules, no new abstractions added 1117 + - **TDD:** Tests updated to verify correctness at each step 1118 + - **Frequent commits:** 18 tasks = 18 commits minimum 1119 + - **Gleam conventions:** Follows standard Gleam package organization with internal/ for implementation details
+71 -3
lexicon_graphql/src/lexicon_graphql.gleam
··· 1 - import gleam/io 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 14 + import gleam/option.{type Option} 15 + import lexicon_graphql/internal/lexicon/parser as lexicon_parser 16 + import lexicon_graphql/mutation/builder as mutation_builder 17 + import lexicon_graphql/query/dataloader 18 + import lexicon_graphql/schema/builder as schema_builder 19 + import lexicon_graphql/schema/database as db_schema_builder 20 + import lexicon_graphql/types 21 + 22 + // Re-export core types 23 + pub type Lexicon = 24 + types.Lexicon 2 25 3 - pub fn main() -> Nil { 4 - io.println("Hello from lexicon_graphql!") 26 + pub type Defs = 27 + types.Defs 28 + 29 + pub type Def = 30 + types.Def 31 + 32 + pub type RecordDef = 33 + types.RecordDef 34 + 35 + pub type ObjectDef = 36 + types.ObjectDef 37 + 38 + pub type Property = 39 + types.Property 40 + 41 + // Re-export main schema building functions 42 + pub fn build_schema(lexicons: List(Lexicon)) { 43 + schema_builder.build_schema(lexicons) 44 + } 45 + 46 + pub fn build_schema_with_subscriptions( 47 + lexicons: List(Lexicon), 48 + fetcher: db_schema_builder.RecordFetcher, 49 + batch_fetcher: Option(dataloader.BatchFetcher), 50 + paginated_batch_fetcher: Option(dataloader.PaginatedBatchFetcher), 51 + create_factory: Option(mutation_builder.ResolverFactory), 52 + update_factory: Option(mutation_builder.ResolverFactory), 53 + delete_factory: Option(mutation_builder.ResolverFactory), 54 + upload_blob_factory: Option(mutation_builder.UploadBlobResolverFactory), 55 + aggregate_fetcher: Option(db_schema_builder.AggregateFetcher), 56 + ) { 57 + db_schema_builder.build_schema_with_subscriptions( 58 + lexicons, 59 + fetcher, 60 + batch_fetcher, 61 + paginated_batch_fetcher, 62 + create_factory, 63 + update_factory, 64 + delete_factory, 65 + upload_blob_factory, 66 + aggregate_fetcher, 67 + ) 68 + } 69 + 70 + // Re-export lexicon parser 71 + pub fn parse_lexicon(json_str: String) { 72 + lexicon_parser.parse_lexicon(json_str) 5 73 }
lexicon_graphql/src/lexicon_graphql/aggregate_input.gleam lexicon_graphql/src/lexicon_graphql/input/aggregate.gleam
lexicon_graphql/src/lexicon_graphql/aggregate_types.gleam lexicon_graphql/src/lexicon_graphql/output/aggregate.gleam
lexicon_graphql/src/lexicon_graphql/blob_type.gleam lexicon_graphql/src/lexicon_graphql/scalar/blob.gleam
+1 -1
lexicon_graphql/src/lexicon_graphql/collection_meta.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/collection_meta.gleam
··· 4 4 /// This enables dynamic forward and reverse join field generation. 5 5 import gleam/list 6 6 import gleam/option.{type Option, None, Some} 7 - import lexicon_graphql/nsid 7 + import lexicon_graphql/internal/lexicon/nsid 8 8 import lexicon_graphql/types 9 9 10 10 /// Metadata about a collection extracted from its lexicon
lexicon_graphql/src/lexicon_graphql/connection.gleam lexicon_graphql/src/lexicon_graphql/input/connection.gleam
+3 -3
lexicon_graphql/src/lexicon_graphql/dataloader.gleam lexicon_graphql/src/lexicon_graphql/query/dataloader.gleam
··· 8 8 import gleam/option.{type Option, None, Some} 9 9 import gleam/result 10 10 import gleam/string 11 - import lexicon_graphql/collection_meta 12 - import lexicon_graphql/uri_extractor 13 - import lexicon_graphql/where_input.{type WhereClause} 11 + import lexicon_graphql/internal/lexicon/collection_meta 12 + import lexicon_graphql/internal/lexicon/uri_extractor 13 + import lexicon_graphql/input/where.{type WhereClause} 14 14 import swell/value 15 15 16 16 /// Result of a batch query: maps URIs to their records
+12 -12
lexicon_graphql/src/lexicon_graphql/db_schema_builder.gleam lexicon_graphql/src/lexicon_graphql/schema/database.gleam
··· 11 11 import gleam/option 12 12 import gleam/result 13 13 import gleam/string 14 - import lexicon_graphql/aggregate_input 15 - import lexicon_graphql/aggregate_types 16 - import lexicon_graphql/collection_meta 17 - import lexicon_graphql/connection as lexicon_connection 18 - import lexicon_graphql/dataloader 19 - import lexicon_graphql/lexicon_registry 20 - import lexicon_graphql/mutation_builder 21 - import lexicon_graphql/nsid 22 - import lexicon_graphql/object_type_builder 23 - import lexicon_graphql/type_mapper 14 + import lexicon_graphql/input/aggregate as aggregate_input 15 + import lexicon_graphql/output/aggregate as aggregate_types 16 + import lexicon_graphql/internal/lexicon/collection_meta 17 + import lexicon_graphql/input/connection as lexicon_connection 18 + import lexicon_graphql/query/dataloader 19 + import lexicon_graphql/internal/lexicon/registry as lexicon_registry 20 + import lexicon_graphql/mutation/builder as mutation_builder 21 + import lexicon_graphql/internal/lexicon/nsid 22 + import lexicon_graphql/internal/graphql/object_builder as object_type_builder 23 + import lexicon_graphql/internal/graphql/type_mapper 24 24 import lexicon_graphql/types 25 - import lexicon_graphql/uri_extractor 26 - import lexicon_graphql/where_input 25 + import lexicon_graphql/internal/lexicon/uri_extractor 26 + import lexicon_graphql/input/where as where_input 27 27 import swell/connection 28 28 import swell/schema 29 29 import swell/value
lexicon_graphql/src/lexicon_graphql/lexicon_parser.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/parser.gleam
lexicon_graphql/src/lexicon_graphql/lexicon_registry.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/registry.gleam
+2 -2
lexicon_graphql/src/lexicon_graphql/mutation_builder.gleam lexicon_graphql/src/lexicon_graphql/mutation/builder.gleam
··· 8 8 import gleam/dict 9 9 import gleam/list 10 10 import gleam/option 11 - import lexicon_graphql/nsid 12 - import lexicon_graphql/type_mapper 11 + import lexicon_graphql/internal/lexicon/nsid 12 + import lexicon_graphql/internal/graphql/type_mapper 13 13 import lexicon_graphql/types 14 14 import swell/schema 15 15 import swell/value
lexicon_graphql/src/lexicon_graphql/nsid.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/nsid.gleam
+3 -3
lexicon_graphql/src/lexicon_graphql/object_type_builder.gleam lexicon_graphql/src/lexicon_graphql/internal/graphql/object_builder.gleam
··· 7 7 import gleam/list 8 8 import gleam/option 9 9 import gleam/string 10 - import lexicon_graphql/lexicon_registry 11 - import lexicon_graphql/nsid 12 - import lexicon_graphql/type_mapper 10 + import lexicon_graphql/internal/lexicon/registry as lexicon_registry 11 + import lexicon_graphql/internal/lexicon/nsid 12 + import lexicon_graphql/internal/graphql/type_mapper 13 13 import lexicon_graphql/types 14 14 import swell/schema 15 15 import swell/value
lexicon_graphql/src/lexicon_graphql/ref_resolver.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/ref_resolver.gleam
+3 -3
lexicon_graphql/src/lexicon_graphql/schema_builder.gleam lexicon_graphql/src/lexicon_graphql/schema/builder.gleam
··· 5 5 import gleam/dict 6 6 import gleam/list 7 7 import gleam/option 8 - import lexicon_graphql/mutation_builder 9 - import lexicon_graphql/nsid 10 - import lexicon_graphql/type_mapper 8 + import lexicon_graphql/mutation/builder as mutation_builder 9 + import lexicon_graphql/internal/lexicon/nsid 10 + import lexicon_graphql/internal/graphql/type_mapper 11 11 import lexicon_graphql/types 12 12 import swell/schema 13 13 import swell/value
+1 -1
lexicon_graphql/src/lexicon_graphql/type_mapper.gleam lexicon_graphql/src/lexicon_graphql/internal/graphql/type_mapper.gleam
··· 6 6 /// Based on the Elixir implementation but adapted for the pure Gleam GraphQL library. 7 7 import gleam/dict.{type Dict} 8 8 import gleam/option.{type Option} 9 - import lexicon_graphql/blob_type 9 + import lexicon_graphql/scalar/blob as blob_type 10 10 import swell/schema 11 11 12 12 /// Maps a lexicon type string to a GraphQL output Type.
lexicon_graphql/src/lexicon_graphql/uri_extractor.gleam lexicon_graphql/src/lexicon_graphql/internal/lexicon/uri_extractor.gleam
lexicon_graphql/src/lexicon_graphql/where_input.gleam lexicon_graphql/src/lexicon_graphql/input/where.gleam
+1 -1
lexicon_graphql/test/blob_type_test.gleam
··· 4 4 import gleam/dict 5 5 import gleam/option.{Some} 6 6 import gleeunit/should 7 - import lexicon_graphql/blob_type 7 + import lexicon_graphql/scalar/blob as blob_type 8 8 import swell/schema 9 9 import swell/value 10 10
+1 -1
lexicon_graphql/test/collection_meta_test.gleam
··· 4 4 import gleam/dict 5 5 import gleam/option.{None, Some} 6 6 import gleeunit/should 7 - import lexicon_graphql/collection_meta 7 + import lexicon_graphql/internal/lexicon/collection_meta as collection_meta 8 8 import lexicon_graphql/types 9 9 10 10 // Test extracting metadata from a lexicon with strongRef fields
+1 -1
lexicon_graphql/test/connection_test.gleam
··· 2 2 /// 3 3 /// Tests the creation of unique SortFieldInput types per collection 4 4 import gleeunit/should 5 - import lexicon_graphql/connection as lexicon_connection 5 + import lexicon_graphql/input/connection as lexicon_connection 6 6 import swell/schema 7 7 8 8 pub fn sort_field_input_type_with_enum_creates_types_test() {
+2 -2
lexicon_graphql/test/dataloader_test.gleam
··· 6 6 import gleam/list 7 7 import gleam/option.{None, Some} 8 8 import gleeunit/should 9 - import lexicon_graphql/collection_meta 10 - import lexicon_graphql/dataloader 9 + import lexicon_graphql/internal/lexicon/collection_meta as collection_meta 10 + import lexicon_graphql/query/dataloader 11 11 import lexicon_graphql/types 12 12 import swell/value 13 13
+1 -1
lexicon_graphql/test/did_join_test.gleam
··· 8 8 import gleam/option 9 9 import gleam/string 10 10 import gleeunit/should 11 - import lexicon_graphql/db_schema_builder 11 + import lexicon_graphql/schema/database as db_schema_builder 12 12 import lexicon_graphql/types 13 13 import swell/introspection 14 14 import swell/schema
+2 -2
lexicon_graphql/test/field_type_validation_test.gleam
··· 2 2 import gleam/option 3 3 import gleeunit 4 4 import gleeunit/should 5 - import lexicon_graphql/aggregate_input 6 - import lexicon_graphql/db_schema_builder 5 + import lexicon_graphql/input/aggregate as aggregate_input 6 + import lexicon_graphql/schema/database as db_schema_builder 7 7 import lexicon_graphql/types 8 8 9 9 pub fn main() {
+1 -1
lexicon_graphql/test/forward_join_test.gleam
··· 5 5 import gleam/option.{None, Some} 6 6 import gleam/string 7 7 import gleeunit/should 8 - import lexicon_graphql/db_schema_builder 8 + import lexicon_graphql/schema/database as db_schema_builder 9 9 import lexicon_graphql/types 10 10 import swell/introspection 11 11 import swell/schema
+1 -1
lexicon_graphql/test/lexicon_parser_test.gleam
··· 4 4 import gleam/list 5 5 import gleam/option 6 6 import gleeunit/should 7 - import lexicon_graphql/lexicon_parser 7 + import lexicon_graphql/internal/lexicon/parser as lexicon_parser 8 8 import lexicon_graphql/types 9 9 10 10 // Test parsing a simple record lexicon
+1 -1
lexicon_graphql/test/mutation_builder_test.gleam
··· 5 5 import gleam/list 6 6 import gleam/option.{None, Some} 7 7 import gleeunit/should 8 - import lexicon_graphql/mutation_builder 8 + import lexicon_graphql/mutation/builder as mutation_builder 9 9 import swell/schema 10 10 import swell/value 11 11
+1 -1
lexicon_graphql/test/nsid_test.gleam
··· 2 2 /// 3 3 /// NSIDs are used in AT Protocol to identify lexicons and collections 4 4 import gleeunit/should 5 - import lexicon_graphql/nsid 5 + import lexicon_graphql/internal/lexicon/nsid as nsid 6 6 7 7 pub fn nsid_to_type_name_test() { 8 8 nsid.to_type_name("xyz.statusphere.status")
+1 -1
lexicon_graphql/test/ref_resolver_test.gleam
··· 4 4 import gleam/dict 5 5 import gleam/option.{None, Some} 6 6 import gleeunit/should 7 - import lexicon_graphql/ref_resolver 7 + import lexicon_graphql/internal/lexicon/ref_resolver as ref_resolver 8 8 import lexicon_graphql/types 9 9 10 10 // Test resolving a local reference (within same lexicon)
+1 -1
lexicon_graphql/test/reverse_join_test.gleam
··· 5 5 import gleam/option.{None, Some} 6 6 import gleam/string 7 7 import gleeunit/should 8 - import lexicon_graphql/db_schema_builder 8 + import lexicon_graphql/schema/database as db_schema_builder 9 9 import lexicon_graphql/types 10 10 import swell/introspection 11 11 import swell/schema
+1 -1
lexicon_graphql/test/schema_builder_test.gleam
··· 6 6 import gleam/dict 7 7 import gleam/option.{None, Some} 8 8 import gleeunit/should 9 - import lexicon_graphql/schema_builder 9 + import lexicon_graphql/schema/builder as schema_builder 10 10 import lexicon_graphql/types 11 11 import swell/introspection 12 12 import swell/schema
+2 -2
lexicon_graphql/test/sorting_test.gleam
··· 12 12 import gleam/list 13 13 import gleam/option.{None, Some} 14 14 import gleeunit/should 15 - import lexicon_graphql/db_schema_builder 16 - import lexicon_graphql/schema_builder 15 + import lexicon_graphql/schema/database as db_schema_builder 16 + import lexicon_graphql/schema/builder as schema_builder 17 17 import lexicon_graphql/types 18 18 import swell/introspection 19 19 import swell/schema
+1 -1
lexicon_graphql/test/subscription_schema_test.gleam
··· 7 7 import gleam/string 8 8 import gleeunit 9 9 import gleeunit/should 10 - import lexicon_graphql/db_schema_builder 10 + import lexicon_graphql/schema/database as db_schema_builder 11 11 import lexicon_graphql/types 12 12 import swell/schema 13 13
+1 -1
lexicon_graphql/test/type_mapper_test.gleam
··· 2 2 /// 3 3 /// Maps AT Protocol lexicon types to GraphQL types 4 4 import gleeunit/should 5 - import lexicon_graphql/type_mapper 5 + import lexicon_graphql/internal/graphql/type_mapper as type_mapper 6 6 import swell/schema 7 7 8 8 pub fn map_string_type_test() {
+1 -1
lexicon_graphql/test/uri_extractor_test.gleam
··· 4 4 import gleam/dict 5 5 import gleam/option.{None, Some} 6 6 import gleeunit/should 7 - import lexicon_graphql/uri_extractor 7 + import lexicon_graphql/internal/lexicon/uri_extractor as uri_extractor 8 8 import test_helpers 9 9 10 10 // Test extracting URI from a strongRef object
+1 -1
lexicon_graphql/test/where_input_test.gleam
··· 6 6 import gleam/option.{None, Some} 7 7 import gleeunit 8 8 import gleeunit/should 9 - import lexicon_graphql/where_input 9 + import lexicon_graphql/input/where as where_input 10 10 import swell/value 11 11 12 12 pub fn main() {
+2 -2
lexicon_graphql/test/where_schema_test.gleam
··· 8 8 import gleam/option.{None, Some} 9 9 import gleeunit 10 10 import gleeunit/should 11 - import lexicon_graphql/connection 12 - import lexicon_graphql/db_schema_builder 11 + import lexicon_graphql/input/connection 12 + import lexicon_graphql/schema/database as db_schema_builder 13 13 import lexicon_graphql/types 14 14 import swell/introspection 15 15 import swell/schema
+3 -3
server/src/database/queries/aggregates.gleam
··· 9 9 import gleam/option.{type Option, None, Some} 10 10 import gleam/result 11 11 import gleam/string 12 - import lexicon_graphql/aggregate_types 12 + import lexicon_graphql/output/aggregate 13 13 import sqlight 14 14 import where_clause 15 15 ··· 23 23 where: Option(where_clause.WhereClause), 24 24 order_by_count_desc: Bool, 25 25 limit: Int, 26 - ) -> Result(List(aggregate_types.AggregateResult), sqlight.Error) { 26 + ) -> Result(List(aggregate.AggregateResult), sqlight.Error) { 27 27 // Build SELECT clause with grouped fields 28 28 let select_parts = 29 29 group_by ··· 120 120 |> list.map(fn(i) { "field_" <> int.to_string(i) }) 121 121 let field_dict = dict.from_list(list.zip(field_names, group_values)) 122 122 123 - aggregate_types.AggregateResult(field_dict, count) 123 + aggregate.AggregateResult(field_dict, count) 124 124 }) 125 125 }) 126 126 }
+11 -11
server/src/graphql_gleam.gleam
··· 18 18 import gleam/option 19 19 import gleam/result 20 20 import gleam/string 21 - import lexicon_graphql/aggregate_input 22 - import lexicon_graphql/dataloader 23 - import lexicon_graphql/db_schema_builder 24 - import lexicon_graphql/lexicon_parser 21 + import lexicon_graphql 22 + import lexicon_graphql/input/aggregate 23 + import lexicon_graphql/query/dataloader 24 + import lexicon_graphql/schema/database 25 25 import mutation_resolvers 26 26 import sqlight 27 27 import swell/executor ··· 49 49 let parsed_lexicons = 50 50 lexicon_records 51 51 |> list.filter_map(fn(lex) { 52 - case lexicon_parser.parse_lexicon(lex.json) { 52 + case lexicon_graphql.parse_lexicon(lex.json) { 53 53 Ok(parsed) -> Ok(parsed) 54 54 Error(_) -> Error(Nil) 55 55 } ··· 404 404 // Step 5.5: Create an aggregate fetcher function 405 405 let aggregate_fetcher = fn( 406 406 collection_nsid: String, 407 - params: db_schema_builder.AggregateParams, 407 + params: database.AggregateParams, 408 408 ) { 409 409 // Convert GraphQL where clause to SQL where clause 410 410 let where_clause = case params.where { ··· 419 419 case gb.interval { 420 420 option.Some(interval) -> { 421 421 let db_interval = case interval { 422 - aggregate_input.Hour -> types.Hour 423 - aggregate_input.Day -> types.Day 424 - aggregate_input.Week -> types.Week 425 - aggregate_input.Month -> types.Month 422 + aggregate.Hour -> types.Hour 423 + aggregate.Day -> types.Day 424 + aggregate.Week -> types.Week 425 + aggregate.Month -> types.Month 426 426 } 427 427 types.TruncatedField(gb.field, db_interval) 428 428 } ··· 443 443 } 444 444 445 445 // Step 6: Build schema with database-backed resolvers, mutations, and subscriptions 446 - db_schema_builder.build_schema_with_subscriptions( 446 + database.build_schema_with_subscriptions( 447 447 parsed_lexicons, 448 448 record_fetcher, 449 449 option.Some(batch_fetcher),
+11 -11
server/src/where_converter.gleam
··· 1 1 /// Converts GraphQL where input types to SQL where clause types 2 2 /// 3 - /// This module bridges the gap between the GraphQL layer (lexicon_graphql/where_input) 3 + /// This module bridges the gap between the GraphQL layer (lexicon_graphql/input/where) 4 4 /// and the database layer (where_clause with sqlight types). 5 5 import gleam/dict 6 6 import gleam/list 7 7 import gleam/option 8 - import lexicon_graphql/where_input 8 + import lexicon_graphql/input/where 9 9 import sqlight 10 10 import where_clause 11 11 12 - /// Convert a where_input.WhereValue to a sqlight.Value 13 - fn convert_value(value: where_input.WhereValue) -> sqlight.Value { 12 + /// Convert a where.WhereValue to a sqlight.Value 13 + fn convert_value(value: where.WhereValue) -> sqlight.Value { 14 14 case value { 15 - where_input.StringValue(s) -> sqlight.text(s) 16 - where_input.IntValue(i) -> sqlight.int(i) 17 - where_input.BoolValue(b) -> sqlight.bool(b) 15 + where.StringValue(s) -> sqlight.text(s) 16 + where.IntValue(i) -> sqlight.int(i) 17 + where.BoolValue(b) -> sqlight.bool(b) 18 18 } 19 19 } 20 20 21 - /// Convert a where_input.WhereCondition to a where_clause.WhereCondition 21 + /// Convert a where.WhereCondition to a where_clause.WhereCondition 22 22 fn convert_condition( 23 - cond: where_input.WhereCondition, 23 + cond: where.WhereCondition, 24 24 ) -> where_clause.WhereCondition { 25 25 where_clause.WhereCondition( 26 26 eq: option.map(cond.eq, convert_value), ··· 35 35 ) 36 36 } 37 37 38 - /// Convert a where_input.WhereClause to a where_clause.WhereClause 38 + /// Convert a where.WhereClause to a where_clause.WhereClause 39 39 pub fn convert_where_clause( 40 - clause: where_input.WhereClause, 40 + clause: where.WhereClause, 41 41 ) -> where_clause.WhereClause { 42 42 where_clause.WhereClause( 43 43 conditions: dict.map_values(clause.conditions, fn(_key, value) {
+10 -10
server/test/graphql_mutation_integration_test.gleam
··· 4 4 import gleam/list 5 5 import gleam/option 6 6 import gleeunit/should 7 - import lexicon_graphql/db_schema_builder 8 - import lexicon_graphql/lexicon_parser 7 + import lexicon_graphql 8 + import lexicon_graphql/schema/database 9 9 import sqlight 10 10 import swell/schema 11 11 ··· 77 77 let assert Ok(lexicon_records) = lexicons.get_all(db) 78 78 let parsed_lexicons = 79 79 lexicon_records 80 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 80 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 81 81 82 82 // Build schema with empty fetcher 83 83 let empty_fetcher = fn(_collection, _params) { ··· 85 85 } 86 86 87 87 let assert Ok(built_schema) = 88 - db_schema_builder.build_schema_with_fetcher( 88 + database.build_schema_with_fetcher( 89 89 parsed_lexicons, 90 90 empty_fetcher, 91 91 option.None, ··· 134 134 let assert Ok(lexicon_records) = lexicons.get_all(db) 135 135 let parsed_lexicons = 136 136 lexicon_records 137 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 137 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 138 138 139 139 let empty_fetcher = fn(_collection, _params) { 140 140 Ok(#([], option.None, False, False, option.None)) 141 141 } 142 142 let assert Ok(built_schema) = 143 - db_schema_builder.build_schema_with_fetcher( 143 + database.build_schema_with_fetcher( 144 144 parsed_lexicons, 145 145 empty_fetcher, 146 146 option.None, ··· 191 191 let assert Ok(lexicon_records) = lexicons.get_all(db) 192 192 let parsed_lexicons = 193 193 lexicon_records 194 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 194 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 195 195 196 196 let empty_fetcher = fn(_collection, _params) { 197 197 Ok(#([], option.None, False, False, option.None)) 198 198 } 199 199 let assert Ok(built_schema) = 200 - db_schema_builder.build_schema_with_fetcher( 200 + database.build_schema_with_fetcher( 201 201 parsed_lexicons, 202 202 empty_fetcher, 203 203 option.None, ··· 247 247 let assert Ok(lexicon_records) = lexicons.get_all(db) 248 248 let parsed_lexicons = 249 249 lexicon_records 250 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 250 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 251 251 252 252 let empty_fetcher = fn(_collection, _params) { 253 253 Ok(#([], option.None, False, False, option.None)) 254 254 } 255 255 let assert Ok(built_schema) = 256 - db_schema_builder.build_schema_with_fetcher( 256 + database.build_schema_with_fetcher( 257 257 parsed_lexicons, 258 258 empty_fetcher, 259 259 option.None,
+1 -1
server/test/graphql_where_integration_test.gleam
··· 9 9 import gleam/string 10 10 import gleeunit 11 11 import gleeunit/should 12 - import lexicon_graphql/where_input 12 + import lexicon_graphql/input/where as where_input 13 13 import sqlight 14 14 import swell/value 15 15 import where_converter
+11 -11
server/test/groupby_enum_validation_test.gleam
··· 8 8 import gleam/option 9 9 import gleam/result 10 10 import gleeunit/should 11 - import lexicon_graphql/aggregate_types 12 - import lexicon_graphql/dataloader 13 - import lexicon_graphql/db_schema_builder 14 - import lexicon_graphql/lexicon_parser 11 + import lexicon_graphql 12 + import lexicon_graphql/output/aggregate 13 + import lexicon_graphql/query/dataloader 14 + import lexicon_graphql/schema/database 15 15 import lexicon_graphql/types 16 16 import swell/executor 17 17 import swell/schema ··· 40 40 // Create a stub aggregate fetcher 41 41 let stub_aggregate_fetcher = fn( 42 42 _uri: String, 43 - _params: db_schema_builder.AggregateParams, 44 - ) -> Result(List(aggregate_types.AggregateResult), String) { 43 + _params: database.AggregateParams, 44 + ) -> Result(List(aggregate.AggregateResult), String) { 45 45 Error("Not implemented for test") 46 46 } 47 47 48 48 let assert Ok(graphql_schema) = 49 - db_schema_builder.build_schema_with_subscriptions( 49 + database.build_schema_with_subscriptions( 50 50 lexicons, 51 51 stub_fetcher, 52 52 option.None, ··· 188 188 // Create a stub aggregate fetcher 189 189 let stub_aggregate_fetcher = fn( 190 190 _uri: String, 191 - _params: db_schema_builder.AggregateParams, 192 - ) -> Result(List(aggregate_types.AggregateResult), String) { 191 + _params: database.AggregateParams, 192 + ) -> Result(List(aggregate.AggregateResult), String) { 193 193 Error("Not implemented for test") 194 194 } 195 195 196 196 let assert Ok(graphql_schema) = 197 - db_schema_builder.build_schema_with_subscriptions( 197 + database.build_schema_with_subscriptions( 198 198 lexicons, 199 199 stub_fetcher, 200 200 option.None, ··· 348 348 }" 349 349 350 350 [ 351 - lexicon_parser.parse_lexicon(post_json) |> result.unwrap(empty_lexicon()), 351 + lexicon_graphql.parse_lexicon(post_json) |> result.unwrap(empty_lexicon()), 352 352 ] 353 353 } 354 354
+18 -18
server/test/mutation_resolver_integration_test.gleam
··· 11 11 import gleam/list 12 12 import gleam/option 13 13 import gleeunit/should 14 - import lexicon_graphql/db_schema_builder 15 - import lexicon_graphql/lexicon_parser 14 + import lexicon_graphql 15 + import lexicon_graphql/schema/database 16 16 import sqlight 17 17 import swell/executor 18 18 import swell/schema ··· 220 220 let assert Ok(lexicon_records) = lexicons.get_all(db) 221 221 let parsed_lexicons = 222 222 lexicon_records 223 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 223 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 224 224 225 225 let empty_fetcher = fn(_collection, _params) { 226 226 Ok(#([], option.None, False, False, option.None)) ··· 229 229 let create_factory = option.Some(mock_create_resolver_factory) 230 230 231 231 let assert Ok(built_schema) = 232 - db_schema_builder.build_schema_with_fetcher( 232 + database.build_schema_with_fetcher( 233 233 parsed_lexicons, 234 234 empty_fetcher, 235 235 option.None, ··· 273 273 let assert Ok(lexicon_records) = lexicons.get_all(db) 274 274 let parsed_lexicons = 275 275 lexicon_records 276 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 276 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 277 277 278 278 let empty_fetcher = fn(_collection, _params) { 279 279 Ok(#([], option.None, False, False, option.None)) ··· 282 282 let create_factory = option.Some(mock_create_resolver_factory) 283 283 284 284 let assert Ok(built_schema) = 285 - db_schema_builder.build_schema_with_fetcher( 285 + database.build_schema_with_fetcher( 286 286 parsed_lexicons, 287 287 empty_fetcher, 288 288 option.None, ··· 342 342 let assert Ok(lexicon_records) = lexicons.get_all(db) 343 343 let parsed_lexicons = 344 344 lexicon_records 345 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 345 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 346 346 347 347 let empty_fetcher = fn(_collection, _params) { 348 348 Ok(#([], option.None, False, False, option.None)) ··· 351 351 let update_factory = option.Some(mock_update_resolver_factory) 352 352 353 353 let assert Ok(built_schema) = 354 - db_schema_builder.build_schema_with_fetcher( 354 + database.build_schema_with_fetcher( 355 355 parsed_lexicons, 356 356 empty_fetcher, 357 357 option.None, ··· 410 410 let assert Ok(lexicon_records) = lexicons.get_all(db) 411 411 let parsed_lexicons = 412 412 lexicon_records 413 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 413 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 414 414 415 415 let empty_fetcher = fn(_collection, _params) { 416 416 Ok(#([], option.None, False, False, option.None)) ··· 419 419 let delete_factory = option.Some(mock_delete_resolver_factory) 420 420 421 421 let assert Ok(built_schema) = 422 - db_schema_builder.build_schema_with_fetcher( 422 + database.build_schema_with_fetcher( 423 423 parsed_lexicons, 424 424 empty_fetcher, 425 425 option.None, ··· 478 478 let assert Ok(lexicon_records) = lexicons.get_all(db) 479 479 let parsed_lexicons = 480 480 lexicon_records 481 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 481 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 482 482 483 483 let empty_fetcher = fn(_collection, _params) { 484 484 Ok(#([], option.None, False, False, option.None)) ··· 487 487 let update_factory = option.Some(mock_update_resolver_factory) 488 488 489 489 let assert Ok(built_schema) = 490 - db_schema_builder.build_schema_with_fetcher( 490 + database.build_schema_with_fetcher( 491 491 parsed_lexicons, 492 492 empty_fetcher, 493 493 option.None, ··· 527 527 let assert Ok(lexicon_records) = lexicons.get_all(db) 528 528 let parsed_lexicons = 529 529 lexicon_records 530 - |> list.filter_map(fn(lex) { lexicon_parser.parse_lexicon(lex.json) }) 530 + |> list.filter_map(fn(lex) { lexicon_graphql.parse_lexicon(lex.json) }) 531 531 532 532 let empty_fetcher = fn(_collection, _params) { 533 533 Ok(#([], option.None, False, False, option.None)) ··· 536 536 let delete_factory = option.Some(mock_delete_resolver_factory) 537 537 538 538 let assert Ok(built_schema) = 539 - db_schema_builder.build_schema_with_fetcher( 539 + database.build_schema_with_fetcher( 540 540 parsed_lexicons, 541 541 empty_fetcher, 542 542 option.None, ··· 565 565 pub fn test_upload_blob_mutation_success() { 566 566 // Parse a minimal lexicon (we just need a valid schema to test uploadBlob) 567 567 let lexicon_json = create_status_lexicon() 568 - let assert Ok(lexicon) = lexicon_parser.parse_lexicon(lexicon_json) 568 + let assert Ok(lexicon) = lexicon_graphql.parse_lexicon(lexicon_json) 569 569 let parsed_lexicons = [lexicon] 570 570 571 571 let empty_fetcher = fn(_collection, _params) { ··· 595 595 let upload_blob_factory = option.Some(mock_upload_blob_resolver_factory) 596 596 597 597 let assert Ok(built_schema) = 598 - db_schema_builder.build_schema_with_fetcher( 598 + database.build_schema_with_fetcher( 599 599 parsed_lexicons, 600 600 empty_fetcher, 601 601 option.None, ··· 655 655 pub fn test_upload_blob_mutation_requires_auth() { 656 656 // Parse a minimal lexicon 657 657 let lexicon_json = create_status_lexicon() 658 - let assert Ok(lexicon) = lexicon_parser.parse_lexicon(lexicon_json) 658 + let assert Ok(lexicon) = lexicon_graphql.parse_lexicon(lexicon_json) 659 659 let parsed_lexicons = [lexicon] 660 660 661 661 let empty_fetcher = fn(_collection, _params) { ··· 672 672 let upload_blob_factory = option.Some(mock_upload_blob_resolver_factory) 673 673 674 674 let assert Ok(built_schema) = 675 - db_schema_builder.build_schema_with_fetcher( 675 + database.build_schema_with_fetcher( 676 676 parsed_lexicons, 677 677 empty_fetcher, 678 678 option.None,
+8 -8
server/test/sorting_enum_validation_test.gleam
··· 9 9 import gleam/option 10 10 import gleam/result 11 11 import gleeunit/should 12 - import lexicon_graphql/dataloader 13 - import lexicon_graphql/db_schema_builder 14 - import lexicon_graphql/lexicon_parser 12 + import lexicon_graphql 13 + import lexicon_graphql/query/dataloader 14 + import lexicon_graphql/schema/database 15 15 import lexicon_graphql/types 16 16 import swell/executor 17 17 import swell/schema ··· 38 38 } 39 39 40 40 let assert Ok(graphql_schema) = 41 - db_schema_builder.build_schema_with_fetcher( 41 + database.build_schema_with_fetcher( 42 42 lexicons, 43 43 stub_fetcher, 44 44 option.None, ··· 184 184 } 185 185 186 186 let assert Ok(graphql_schema) = 187 - db_schema_builder.build_schema_with_fetcher( 187 + database.build_schema_with_fetcher( 188 188 lexicons, 189 189 stub_fetcher, 190 190 option.None, ··· 392 392 }" 393 393 394 394 [ 395 - lexicon_parser.parse_lexicon(gallery_json) |> result.unwrap(empty_lexicon()), 396 - lexicon_parser.parse_lexicon(gallery_item_json) 395 + lexicon_graphql.parse_lexicon(gallery_json) |> result.unwrap(empty_lexicon()), 396 + lexicon_graphql.parse_lexicon(gallery_item_json) 397 397 |> result.unwrap(empty_lexicon()), 398 - lexicon_parser.parse_lexicon(favorite_json) 398 + lexicon_graphql.parse_lexicon(favorite_json) 399 399 |> result.unwrap(empty_lexicon()), 400 400 ] 401 401 }
+1 -1
server/test/where_edge_cases_test.gleam
··· 7 7 import gleam/string 8 8 import gleeunit 9 9 import gleeunit/should 10 - import lexicon_graphql/where_input 10 + import lexicon_graphql/input/where as where_input 11 11 import sqlight 12 12 import swell/value 13 13 import where_clause