The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | /** |
| 2 | * GraphQL AST for the September 2025 executable and type-system grammar. |
| 3 | * Node names follow graphql-js, with `_tag` discriminants. |
| 4 | * |
| 5 | * - Locations are UTF-16 offsets with exclusive ends. |
| 6 | * - Absent lists are empty; absent children are `undefined`. |
| 7 | * - Numbers retain source text; strings contain decoded values. Block-string |
| 8 | * syntax is not retained. |
| 9 | * |
| 10 | * @internal |
| 11 | */ |
| 12 | |
| 13 | export interface Loc { |
| 14 | readonly start: number |
| 15 | readonly end: number |
| 16 | } |
| 17 | |
| 18 | export interface Name { |
| 19 | readonly _tag: "Name" |
| 20 | readonly value: string |
| 21 | readonly loc: Loc |
| 22 | } |
| 23 | |
| 24 | export interface Document { |
| 25 | readonly _tag: "Document" |
| 26 | readonly definitions: ReadonlyArray<Definition> |
| 27 | readonly loc: Loc |
| 28 | } |
| 29 | |
| 30 | export type Definition = ExecutableDefinition | TypeSystemDefinition | TypeSystemExtension |
| 31 | |
| 32 | // ----------------------------------------------------------------------------- |
| 33 | // Executable definitions |
| 34 | // ----------------------------------------------------------------------------- |
| 35 | |
| 36 | export type ExecutableDefinition = OperationDefinition | FragmentDefinition |
| 37 | |
| 38 | export type OperationType = "query" | "mutation" | "subscription" |
| 39 | |
| 40 | export interface OperationDefinition { |
| 41 | readonly _tag: "OperationDefinition" |
| 42 | readonly description: StringValue | undefined |
| 43 | readonly operation: OperationType |
| 44 | readonly name: Name | undefined |
| 45 | readonly variableDefinitions: ReadonlyArray<VariableDefinition> |
| 46 | readonly directives: ReadonlyArray<Directive> |
| 47 | readonly selectionSet: SelectionSet |
| 48 | readonly loc: Loc |
| 49 | } |
| 50 | |
| 51 | export interface VariableDefinition { |
| 52 | readonly _tag: "VariableDefinition" |
| 53 | readonly description: StringValue | undefined |
| 54 | readonly variable: Variable |
| 55 | readonly type: Type |
| 56 | readonly defaultValue: ConstValue | undefined |
| 57 | readonly directives: ReadonlyArray<ConstDirective> |
| 58 | readonly loc: Loc |
| 59 | } |
| 60 | |
| 61 | export interface SelectionSet { |
| 62 | readonly _tag: "SelectionSet" |
| 63 | readonly selections: ReadonlyArray<Selection> |
| 64 | readonly loc: Loc |
| 65 | } |
| 66 | |
| 67 | export type Selection = Field | FragmentSpread | InlineFragment |
| 68 | |
| 69 | export interface Field { |
| 70 | readonly _tag: "Field" |
| 71 | readonly alias: Name | undefined |
| 72 | readonly name: Name |
| 73 | readonly arguments: ReadonlyArray<Argument> |
| 74 | readonly directives: ReadonlyArray<Directive> |
| 75 | readonly selectionSet: SelectionSet | undefined |
| 76 | readonly loc: Loc |
| 77 | } |
| 78 | |
| 79 | export interface Argument { |
| 80 | readonly _tag: "Argument" |
| 81 | readonly name: Name |
| 82 | readonly value: Value |
| 83 | readonly loc: Loc |
| 84 | } |
| 85 | |
| 86 | export interface ConstArgument { |
| 87 | readonly _tag: "Argument" |
| 88 | readonly name: Name |
| 89 | readonly value: ConstValue |
| 90 | readonly loc: Loc |
| 91 | } |
| 92 | |
| 93 | export interface FragmentSpread { |
| 94 | readonly _tag: "FragmentSpread" |
| 95 | readonly name: Name |
| 96 | readonly directives: ReadonlyArray<Directive> |
| 97 | readonly loc: Loc |
| 98 | } |
| 99 | |
| 100 | export interface InlineFragment { |
| 101 | readonly _tag: "InlineFragment" |
| 102 | readonly typeCondition: NamedType | undefined |
| 103 | readonly directives: ReadonlyArray<Directive> |
| 104 | readonly selectionSet: SelectionSet |
| 105 | readonly loc: Loc |
| 106 | } |
| 107 | |
| 108 | export interface FragmentDefinition { |
| 109 | readonly _tag: "FragmentDefinition" |
| 110 | readonly description: StringValue | undefined |
| 111 | readonly name: Name |
| 112 | readonly typeCondition: NamedType |
| 113 | readonly directives: ReadonlyArray<Directive> |
| 114 | readonly selectionSet: SelectionSet |
| 115 | readonly loc: Loc |
| 116 | } |
| 117 | |
| 118 | // ----------------------------------------------------------------------------- |
| 119 | // Values |
| 120 | // ----------------------------------------------------------------------------- |
| 121 | |
| 122 | export type Value = |
| 123 | | Variable |
| 124 | | IntValue |
| 125 | | FloatValue |
| 126 | | StringValue |
| 127 | | BooleanValue |
| 128 | | NullValue |
| 129 | | EnumValue |
| 130 | | ListValue |
| 131 | | ObjectValue |
| 132 | |
| 133 | /** A `Value[Const]`: no variables at any depth. */ |
| 134 | export type ConstValue = |
| 135 | | IntValue |
| 136 | | FloatValue |
| 137 | | StringValue |
| 138 | | BooleanValue |
| 139 | | NullValue |
| 140 | | EnumValue |
| 141 | | ConstListValue |
| 142 | | ConstObjectValue |
| 143 | |
| 144 | export interface Variable { |
| 145 | readonly _tag: "Variable" |
| 146 | readonly name: Name |
| 147 | readonly loc: Loc |
| 148 | } |
| 149 | |
| 150 | export interface IntValue { |
| 151 | readonly _tag: "IntValue" |
| 152 | readonly value: string |
| 153 | readonly loc: Loc |
| 154 | } |
| 155 | |
| 156 | export interface FloatValue { |
| 157 | readonly _tag: "FloatValue" |
| 158 | readonly value: string |
| 159 | readonly loc: Loc |
| 160 | } |
| 161 | |
| 162 | export interface StringValue { |
| 163 | readonly _tag: "StringValue" |
| 164 | readonly value: string |
| 165 | readonly loc: Loc |
| 166 | } |
| 167 | |
| 168 | export interface BooleanValue { |
| 169 | readonly _tag: "BooleanValue" |
| 170 | readonly value: boolean |
| 171 | readonly loc: Loc |
| 172 | } |
| 173 | |
| 174 | export interface NullValue { |
| 175 | readonly _tag: "NullValue" |
| 176 | readonly loc: Loc |
| 177 | } |
| 178 | |
| 179 | export interface EnumValue { |
| 180 | readonly _tag: "EnumValue" |
| 181 | readonly value: string |
| 182 | readonly loc: Loc |
| 183 | } |
| 184 | |
| 185 | export interface ListValue { |
| 186 | readonly _tag: "ListValue" |
| 187 | readonly values: ReadonlyArray<Value> |
| 188 | readonly loc: Loc |
| 189 | } |
| 190 | |
| 191 | export interface ConstListValue { |
| 192 | readonly _tag: "ListValue" |
| 193 | readonly values: ReadonlyArray<ConstValue> |
| 194 | readonly loc: Loc |
| 195 | } |
| 196 | |
| 197 | export interface ObjectValue { |
| 198 | readonly _tag: "ObjectValue" |
| 199 | readonly fields: ReadonlyArray<ObjectField> |
| 200 | readonly loc: Loc |
| 201 | } |
| 202 | |
| 203 | export interface ConstObjectValue { |
| 204 | readonly _tag: "ObjectValue" |
| 205 | readonly fields: ReadonlyArray<ConstObjectField> |
| 206 | readonly loc: Loc |
| 207 | } |
| 208 | |
| 209 | export interface ObjectField { |
| 210 | readonly _tag: "ObjectField" |
| 211 | readonly name: Name |
| 212 | readonly value: Value |
| 213 | readonly loc: Loc |
| 214 | } |
| 215 | |
| 216 | export interface ConstObjectField { |
| 217 | readonly _tag: "ObjectField" |
| 218 | readonly name: Name |
| 219 | readonly value: ConstValue |
| 220 | readonly loc: Loc |
| 221 | } |
| 222 | |
| 223 | // ----------------------------------------------------------------------------- |
| 224 | // Directives and types |
| 225 | // ----------------------------------------------------------------------------- |
| 226 | |
| 227 | export interface Directive { |
| 228 | readonly _tag: "Directive" |
| 229 | readonly name: Name |
| 230 | readonly arguments: ReadonlyArray<Argument> |
| 231 | readonly loc: Loc |
| 232 | } |
| 233 | |
| 234 | export interface ConstDirective { |
| 235 | readonly _tag: "Directive" |
| 236 | readonly name: Name |
| 237 | readonly arguments: ReadonlyArray<ConstArgument> |
| 238 | readonly loc: Loc |
| 239 | } |
| 240 | |
| 241 | export type Type = NamedType | ListType | NonNullType |
| 242 | |
| 243 | export interface NamedType { |
| 244 | readonly _tag: "NamedType" |
| 245 | readonly name: Name |
| 246 | readonly loc: Loc |
| 247 | } |
| 248 | |
| 249 | export interface ListType { |
| 250 | readonly _tag: "ListType" |
| 251 | readonly type: Type |
| 252 | readonly loc: Loc |
| 253 | } |
| 254 | |
| 255 | export interface NonNullType { |
| 256 | readonly _tag: "NonNullType" |
| 257 | readonly type: NamedType | ListType |
| 258 | readonly loc: Loc |
| 259 | } |
| 260 | |
| 261 | // ----------------------------------------------------------------------------- |
| 262 | // Type-system definitions |
| 263 | // ----------------------------------------------------------------------------- |
| 264 | |
| 265 | export type TypeSystemDefinition = SchemaDefinition | TypeDefinition | DirectiveDefinition |
| 266 | |
| 267 | export type TypeDefinition = |
| 268 | | ScalarTypeDefinition |
| 269 | | ObjectTypeDefinition |
| 270 | | InterfaceTypeDefinition |
| 271 | | UnionTypeDefinition |
| 272 | | EnumTypeDefinition |
| 273 | | InputObjectTypeDefinition |
| 274 | |
| 275 | export interface SchemaDefinition { |
| 276 | readonly _tag: "SchemaDefinition" |
| 277 | readonly description: StringValue | undefined |
| 278 | readonly directives: ReadonlyArray<ConstDirective> |
| 279 | readonly operationTypes: ReadonlyArray<OperationTypeDefinition> |
| 280 | readonly loc: Loc |
| 281 | } |
| 282 | |
| 283 | export interface OperationTypeDefinition { |
| 284 | readonly _tag: "OperationTypeDefinition" |
| 285 | readonly operation: OperationType |
| 286 | readonly type: NamedType |
| 287 | readonly loc: Loc |
| 288 | } |
| 289 | |
| 290 | export interface ScalarTypeDefinition { |
| 291 | readonly _tag: "ScalarTypeDefinition" |
| 292 | readonly description: StringValue | undefined |
| 293 | readonly name: Name |
| 294 | readonly directives: ReadonlyArray<ConstDirective> |
| 295 | readonly loc: Loc |
| 296 | } |
| 297 | |
| 298 | export interface ObjectTypeDefinition { |
| 299 | readonly _tag: "ObjectTypeDefinition" |
| 300 | readonly description: StringValue | undefined |
| 301 | readonly name: Name |
| 302 | readonly interfaces: ReadonlyArray<NamedType> |
| 303 | readonly directives: ReadonlyArray<ConstDirective> |
| 304 | readonly fields: ReadonlyArray<FieldDefinition> |
| 305 | readonly loc: Loc |
| 306 | } |
| 307 | |
| 308 | export interface FieldDefinition { |
| 309 | readonly _tag: "FieldDefinition" |
| 310 | readonly description: StringValue | undefined |
| 311 | readonly name: Name |
| 312 | readonly arguments: ReadonlyArray<InputValueDefinition> |
| 313 | readonly type: Type |
| 314 | readonly directives: ReadonlyArray<ConstDirective> |
| 315 | readonly loc: Loc |
| 316 | } |
| 317 | |
| 318 | export interface InputValueDefinition { |
| 319 | readonly _tag: "InputValueDefinition" |
| 320 | readonly description: StringValue | undefined |
| 321 | readonly name: Name |
| 322 | readonly type: Type |
| 323 | readonly defaultValue: ConstValue | undefined |
| 324 | readonly directives: ReadonlyArray<ConstDirective> |
| 325 | readonly loc: Loc |
| 326 | } |
| 327 | |
| 328 | export interface InterfaceTypeDefinition { |
| 329 | readonly _tag: "InterfaceTypeDefinition" |
| 330 | readonly description: StringValue | undefined |
| 331 | readonly name: Name |
| 332 | readonly interfaces: ReadonlyArray<NamedType> |
| 333 | readonly directives: ReadonlyArray<ConstDirective> |
| 334 | readonly fields: ReadonlyArray<FieldDefinition> |
| 335 | readonly loc: Loc |
| 336 | } |
| 337 | |
| 338 | export interface UnionTypeDefinition { |
| 339 | readonly _tag: "UnionTypeDefinition" |
| 340 | readonly description: StringValue | undefined |
| 341 | readonly name: Name |
| 342 | readonly directives: ReadonlyArray<ConstDirective> |
| 343 | readonly types: ReadonlyArray<NamedType> |
| 344 | readonly loc: Loc |
| 345 | } |
| 346 | |
| 347 | export interface EnumTypeDefinition { |
| 348 | readonly _tag: "EnumTypeDefinition" |
| 349 | readonly description: StringValue | undefined |
| 350 | readonly name: Name |
| 351 | readonly directives: ReadonlyArray<ConstDirective> |
| 352 | readonly values: ReadonlyArray<EnumValueDefinition> |
| 353 | readonly loc: Loc |
| 354 | } |
| 355 | |
| 356 | export interface EnumValueDefinition { |
| 357 | readonly _tag: "EnumValueDefinition" |
| 358 | readonly description: StringValue | undefined |
| 359 | readonly name: Name |
| 360 | readonly directives: ReadonlyArray<ConstDirective> |
| 361 | readonly loc: Loc |
| 362 | } |
| 363 | |
| 364 | export interface InputObjectTypeDefinition { |
| 365 | readonly _tag: "InputObjectTypeDefinition" |
| 366 | readonly description: StringValue | undefined |
| 367 | readonly name: Name |
| 368 | readonly directives: ReadonlyArray<ConstDirective> |
| 369 | readonly fields: ReadonlyArray<InputValueDefinition> |
| 370 | readonly loc: Loc |
| 371 | } |
| 372 | |
| 373 | export interface DirectiveDefinition { |
| 374 | readonly _tag: "DirectiveDefinition" |
| 375 | readonly description: StringValue | undefined |
| 376 | readonly name: Name |
| 377 | readonly arguments: ReadonlyArray<InputValueDefinition> |
| 378 | readonly repeatable: boolean |
| 379 | /** Spec `DirectiveLocation` names, e.g. `FIELD_DEFINITION`. */ |
| 380 | readonly locations: ReadonlyArray<Name> |
| 381 | readonly loc: Loc |
| 382 | } |
| 383 | |
| 384 | // ----------------------------------------------------------------------------- |
| 385 | // Type-system extensions |
| 386 | // ----------------------------------------------------------------------------- |
| 387 | |
| 388 | export type TypeSystemExtension = SchemaExtension | TypeExtension |
| 389 | |
| 390 | export type TypeExtension = |
| 391 | | ScalarTypeExtension |
| 392 | | ObjectTypeExtension |
| 393 | | InterfaceTypeExtension |
| 394 | | UnionTypeExtension |
| 395 | | EnumTypeExtension |
| 396 | | InputObjectTypeExtension |
| 397 | |
| 398 | export interface SchemaExtension { |
| 399 | readonly _tag: "SchemaExtension" |
| 400 | readonly directives: ReadonlyArray<ConstDirective> |
| 401 | readonly operationTypes: ReadonlyArray<OperationTypeDefinition> |
| 402 | readonly loc: Loc |
| 403 | } |
| 404 | |
| 405 | export interface ScalarTypeExtension { |
| 406 | readonly _tag: "ScalarTypeExtension" |
| 407 | readonly name: Name |
| 408 | readonly directives: ReadonlyArray<ConstDirective> |
| 409 | readonly loc: Loc |
| 410 | } |
| 411 | |
| 412 | export interface ObjectTypeExtension { |
| 413 | readonly _tag: "ObjectTypeExtension" |
| 414 | readonly name: Name |
| 415 | readonly interfaces: ReadonlyArray<NamedType> |
| 416 | readonly directives: ReadonlyArray<ConstDirective> |
| 417 | readonly fields: ReadonlyArray<FieldDefinition> |
| 418 | readonly loc: Loc |
| 419 | } |
| 420 | |
| 421 | export interface InterfaceTypeExtension { |
| 422 | readonly _tag: "InterfaceTypeExtension" |
| 423 | readonly name: Name |
| 424 | readonly interfaces: ReadonlyArray<NamedType> |
| 425 | readonly directives: ReadonlyArray<ConstDirective> |
| 426 | readonly fields: ReadonlyArray<FieldDefinition> |
| 427 | readonly loc: Loc |
| 428 | } |
| 429 | |
| 430 | export interface UnionTypeExtension { |
| 431 | readonly _tag: "UnionTypeExtension" |
| 432 | readonly name: Name |
| 433 | readonly directives: ReadonlyArray<ConstDirective> |
| 434 | readonly types: ReadonlyArray<NamedType> |
| 435 | readonly loc: Loc |
| 436 | } |
| 437 | |
| 438 | export interface EnumTypeExtension { |
| 439 | readonly _tag: "EnumTypeExtension" |
| 440 | readonly name: Name |
| 441 | readonly directives: ReadonlyArray<ConstDirective> |
| 442 | readonly values: ReadonlyArray<EnumValueDefinition> |
| 443 | readonly loc: Loc |
| 444 | } |
| 445 | |
| 446 | export interface InputObjectTypeExtension { |
| 447 | readonly _tag: "InputObjectTypeExtension" |
| 448 | readonly name: Name |
| 449 | readonly directives: ReadonlyArray<ConstDirective> |
| 450 | readonly fields: ReadonlyArray<InputValueDefinition> |
| 451 | readonly loc: Loc |
| 452 | } |