├── angel_graphql
├── mono_pkg.yaml
├── analysis_options.yaml
├── CHANGELOG.md
├── pubspec.yaml
├── angel_graphql.iml
├── LICENSE
├── lib
│ ├── angel_graphql.dart
│ └── src
│ │ ├── graphql_ws.dart
│ │ └── graphiql.dart
├── .gitignore
└── example
│ ├── subscription.dart
│ └── main.dart
├── data_loader
├── mono_pkg.yaml
├── CHANGELOG.md
├── .gitignore
├── analysis_options.yaml
├── pubspec.yaml
├── README.md
├── LICENSE
├── example
│ └── main.dart
├── test
│ └── all_test.dart
└── lib
│ └── data_loader.dart
├── graphql_parser
├── mono_pkg.yaml
├── lib
│ ├── graphql_parser.dart
│ └── src
│ │ └── language
│ │ ├── ast
│ │ ├── node.dart
│ │ ├── input_value.dart
│ │ ├── type_condition.dart
│ │ ├── deprecated_value.dart
│ │ ├── document.dart
│ │ ├── definition.dart
│ │ ├── type_name.dart
│ │ ├── selection.dart
│ │ ├── default_value.dart
│ │ ├── field_name.dart
│ │ ├── variable.dart
│ │ ├── boolean_value.dart
│ │ ├── list_type.dart
│ │ ├── variable_definition.dart
│ │ ├── ast.dart
│ │ ├── alias.dart
│ │ ├── variable_definitions.dart
│ │ ├── argument.dart
│ │ ├── array_value.dart
│ │ ├── fragment_spread.dart
│ │ ├── type.dart
│ │ ├── number_value.dart
│ │ ├── field.dart
│ │ ├── inline_fragment.dart
│ │ ├── selection_set.dart
│ │ ├── fragment_definition.dart
│ │ ├── directive.dart
│ │ ├── operation_definition.dart
│ │ ├── string_value.dart
│ │ └── misc_value.dart
│ │ ├── language.dart
│ │ ├── syntax_error.dart
│ │ ├── token.dart
│ │ ├── token_type.dart
│ │ └── lexer.dart
├── analysis_options.yaml
├── test
│ ├── common.dart
│ ├── comment_test.dart
│ ├── next_name_test.dart
│ ├── variable_test.dart
│ ├── fragment_spread_test.dart
│ ├── inline_fragment_test.dart
│ ├── argument_test.dart
│ ├── variable_definition_test.dart
│ ├── value_test.dart
│ ├── selection_set_test.dart
│ ├── type_test.dart
│ ├── issue23_test.dart
│ ├── directive_test.dart
│ ├── document_test.dart
│ └── field_test.dart
├── pubspec.yaml
├── graphql_parser.iml
├── example
│ └── example.dart
├── CHANGELOG.md
├── LICENSE
├── README.md
└── .gitignore
├── graphql_schema
├── mono_pkg.yaml
├── lib
│ ├── graphql_schema.dart
│ └── src
│ │ ├── validation_result.dart
│ │ ├── gen.dart
│ │ ├── argument.dart
│ │ ├── field.dart
│ │ ├── union.dart
│ │ └── enum.dart
├── analysis_options.yaml
├── CHANGELOG.md
├── pubspec.yaml
├── test
│ ├── common.dart
│ ├── inheritance_test.dart
│ ├── validation_test.dart
│ ├── equality_test.dart
│ └── serialize_test.dart
├── graphql_schema.iml
├── example
│ └── example.dart
├── LICENSE
├── .gitignore
└── README.md
├── graphql_server
├── mono_pkg.yaml
├── analysis_options.yaml
├── test
│ ├── common.dart
│ ├── query_test.dart
│ ├── subscription_test.dart
│ └── mirrors_test.dart
├── lib
│ ├── subscriptions_transport_ws.dart
│ └── src
│ │ └── apollo
│ │ ├── remote_client.dart
│ │ └── transport.dart
├── graphql_server.iml
├── pubspec.yaml
├── LICENSE
├── CHANGELOG.md
├── example
│ └── main.dart
└── .gitignore
├── example_star_wars
├── mono_pkg.yaml
├── analysis_options.yaml
├── lib
│ └── src
│ │ ├── models
│ │ ├── models.dart
│ │ ├── character.dart
│ │ ├── episode.dart
│ │ ├── starship.dart
│ │ ├── episode.g.dart
│ │ ├── character.g.dart
│ │ ├── droid.dart
│ │ ├── human.dart
│ │ └── starship.g.dart
│ │ └── pretty_logging.dart
├── pubspec.yaml
├── example_star_wars.iml
├── bin
│ └── server.dart
├── LICENSE
└── .gitignore
├── graphql_generator
├── mono_pkg.yaml
├── analysis_options.yaml
├── CHANGELOG.md
├── example
│ ├── main.dart
│ └── main.g.dart
├── build.yaml
├── pubspec.yaml
├── LICENSE
├── README.md
└── .gitignore
├── video.png
├── img
├── angel_logo.png
├── angel_logo.xcf
└── angel_graphql.png
├── .travis.yml
├── .idea
├── vcs.xml
├── runConfigurations
│ ├── tests_in_comment_test_dart.xml
│ ├── tests_in_query_test_dart.xml
│ ├── tests_in_value_test_dart.xml
│ ├── tests_in_mirrors_test_dart.xml
│ ├── main_dart.xml
│ ├── tests_in_validation_test_dart.xml
│ ├── tests_in_graphql_schema.xml
│ ├── tests_in_graphql_parser.xml
│ ├── server_dart.xml
│ └── objects_in_equality_test_dart.xml
├── graphql_parser.iml
└── modules.xml
├── travis.sh
├── graphql.iml
├── LICENSE
├── .gitignore
└── README.md
/angel_graphql/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data_loader/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphql_parser/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphql_schema/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphql_server/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example_star_wars/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/graphql_generator/mono_pkg.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data_loader/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.0.0
2 | * Initial version.
--------------------------------------------------------------------------------
/graphql_schema/lib/graphql_schema.dart:
--------------------------------------------------------------------------------
1 | export 'src/schema.dart';
2 |
--------------------------------------------------------------------------------
/data_loader/.gitignore:
--------------------------------------------------------------------------------
1 | .packages
2 | pubspec.lock
3 | .dart_tool
4 | doc/api
--------------------------------------------------------------------------------
/video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angel-dart-archive/graphql/HEAD/video.png
--------------------------------------------------------------------------------
/example_star_wars/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | analyzer:
2 | strong-mode:
3 | implicit-casts: false
--------------------------------------------------------------------------------
/graphql_schema/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | analyzer:
2 | strong-mode:
3 | implicit-casts: false
--------------------------------------------------------------------------------
/img/angel_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angel-dart-archive/graphql/HEAD/img/angel_logo.png
--------------------------------------------------------------------------------
/img/angel_logo.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angel-dart-archive/graphql/HEAD/img/angel_logo.xcf
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: dart
2 | dart:
3 | - dev
4 | - stable
5 | script:
6 | - bash -ex travis.sh
--------------------------------------------------------------------------------
/img/angel_graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/angel-dart-archive/graphql/HEAD/img/angel_graphql.png
--------------------------------------------------------------------------------
/graphql_parser/lib/graphql_parser.dart:
--------------------------------------------------------------------------------
1 | export 'src/language/ast/ast.dart';
2 | export 'src/language/language.dart';
3 |
--------------------------------------------------------------------------------
/data_loader/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:pedantic/analysis_options.yaml
2 | analyzer:
3 | strong-mode:
4 | implicit-casts: false
--------------------------------------------------------------------------------
/angel_graphql/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:pedantic/analysis_options.yaml
2 | analyzer:
3 | strong-mode:
4 | implicit-casts: false
--------------------------------------------------------------------------------
/graphql_parser/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:pedantic/analysis_options.yaml
2 | analyzer:
3 | strong-mode:
4 | implicit-casts: false
--------------------------------------------------------------------------------
/graphql_parser/test/common.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_parser/graphql_parser.dart';
2 |
3 | Parser parse(String text) => Parser(scan(text));
4 |
--------------------------------------------------------------------------------
/graphql_server/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:pedantic/analysis_options.yaml
2 | analyzer:
3 | strong-mode:
4 | implicit-casts: false
--------------------------------------------------------------------------------
/graphql_generator/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:pedantic/analysis_options.yaml
2 | analyzer:
3 | strong-mode:
4 | implicit-casts: false
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/node.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 |
3 | abstract class Node {
4 | FileSpan get span;
5 | }
6 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/models.dart:
--------------------------------------------------------------------------------
1 | export 'character.dart';
2 | export 'droid.dart';
3 | export 'episode.dart';
4 | export 'human.dart';
5 | export 'starship.dart';
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/language.dart:
--------------------------------------------------------------------------------
1 | library graphql_parser.language;
2 |
3 | export 'lexer.dart';
4 | export 'parser.dart';
5 | export 'syntax_error.dart';
6 | export 'token.dart';
7 | export 'token_type.dart';
8 |
--------------------------------------------------------------------------------
/graphql_generator/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.0.0+1
2 | * Replace `snakeCase` with `camelCase`.
3 |
4 | # 1.0.0
5 | * Apply `package:pedantic`.
6 |
7 | # 1.0.0-rc.1
8 | * Add `CHANGELOG.md`, `example/main.dart`.
9 | * Add documentation to `README.md`.
--------------------------------------------------------------------------------
/graphql_server/test/common.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_schema/graphql_schema.dart';
2 | import 'package:test/test.dart';
3 |
4 | final Matcher throwsAGraphQLException =
5 | throwsA(predicate((x) => x is GraphQLException, 'is a GraphQL exception'));
6 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/input_value.dart:
--------------------------------------------------------------------------------
1 | import 'node.dart';
2 |
3 | /// Represents a value in GraphQL.
4 | abstract class InputValueContext extends Node {
5 | /// Computes the value, relative to some set of [variables].
6 | T computeValue(Map variables);
7 | }
8 |
--------------------------------------------------------------------------------
/graphql_schema/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.0.4
2 | * Add `convert` method to types, to avoid some annoying generics bugs.
3 |
4 | # 1.0.3
5 | * `enumTypeFromStrings` now returns `GraphQLEnumType`.
6 |
7 | # 1.0.2
8 | * Added `GraphQLClass()`.
9 | * Added `typeName`.
10 |
11 | # 1.0.1
12 | * Dart 2 updates.
--------------------------------------------------------------------------------
/travis.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | PWD=$(pwd)
3 | cd "$PWD/graphql_parser" && pub get && pub run test -j2 && cd ..
4 | cd "$PWD/graphql_schema" && pub get && pub run test -j2 && cd ..
5 | cd "$PWD/graphql_server" && pub get && pub run test -j2 && cd ..
6 | cd "$PWD/data_loader" && pub get && pub run test -j2 && cd ..
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/character.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_schema/graphql_schema.dart';
2 | import 'episode.dart';
3 | part 'character.g.dart';
4 |
5 | @graphQLClass
6 | abstract class Character {
7 | String get id;
8 |
9 | String get name;
10 |
11 | // List get appearsIn;
12 | }
13 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/episode.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_schema/graphql_schema.dart';
2 | part 'episode.g.dart';
3 |
4 | @GraphQLDocumentation(
5 | description: 'The episodes of the Star Wars original trilogy.')
6 | @graphQLClass
7 | enum Episode {
8 | NEWHOPE,
9 | EMPIRE,
10 | JEDI,
11 | }
12 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/type_condition.dart:
--------------------------------------------------------------------------------
1 | import 'node.dart';
2 | import 'package:source_span/source_span.dart';
3 | import 'type_name.dart';
4 |
5 | class TypeConditionContext extends Node {
6 | final TypeNameContext typeName;
7 |
8 | TypeConditionContext(this.typeName);
9 |
10 | @override
11 | FileSpan get span => typeName.span;
12 | }
13 |
--------------------------------------------------------------------------------
/graphql_parser/test/comment_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_parser/graphql_parser.dart';
2 | import 'package:test/test.dart';
3 |
4 | void main() {
5 | test('heeds comments', () {
6 | var tokens = scan('''
7 | # Hello
8 | {
9 | # Goodbye
10 | }
11 | # Bonjour
12 | ''');
13 |
14 | expect(tokens, hasLength(2));
15 | });
16 | }
17 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/starship.dart:
--------------------------------------------------------------------------------
1 | import 'package:angel_model/angel_model.dart';
2 | import 'package:angel_serialize/angel_serialize.dart';
3 | import 'package:graphql_schema/graphql_schema.dart';
4 | part 'starship.g.dart';
5 |
6 | @serializable
7 | @graphQLClass
8 | abstract class _Starship extends Model {
9 | String get name;
10 | int get length;
11 | }
12 |
--------------------------------------------------------------------------------
/graphql_generator/example/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_schema/graphql_schema.dart';
2 | part 'main.g.dart';
3 |
4 | @graphQLClass
5 | class TodoItem {
6 | String text;
7 |
8 | @GraphQLDocumentation(description: 'Whether this item is complete.')
9 | bool isComplete;
10 | }
11 |
12 | void main() {
13 | print(todoItemGraphQLType.fields.map((f) => f.name));
14 | }
15 |
--------------------------------------------------------------------------------
/data_loader/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: data_loader
2 | version: 1.0.0
3 | author: Tobe O
4 | description: Batch and cache database lookups. Works well with GraphQL. Ported from JS.
5 | homepage: https://github.com/angel-dart/graphql
6 | environment:
7 | sdk: ">=2.0.0-dev <3.0.0"
8 | dev_dependencies:
9 | graphql_schema: ^1.0.0
10 | pedantic: ^1.0.0
11 | test: ">=0.12.0 <2.0.0"
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/syntax_error.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 |
3 | class SyntaxError implements Exception {
4 | final String message;
5 | final FileSpan span;
6 |
7 | SyntaxError(this.message, this.span);
8 |
9 | @override
10 | String toString() =>
11 | 'Syntax error at ${span.start.toolString}: $message\n${span.highlight()}';
12 | }
13 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/deprecated_value.dart:
--------------------------------------------------------------------------------
1 | import 'input_value.dart';
2 |
3 | /// Use [ConstantContext] instead. This class remains solely for backwards compatibility.
4 | @deprecated
5 | abstract class ValueContext extends InputValueContext {
6 | /// Return a constant value.
7 | T get value;
8 |
9 | @override
10 | T computeValue(Map variables) => value;
11 | }
12 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_comment_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/angel_graphql/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.1.0
2 | * Support the GraphQL multipart spec: https://github.com/jaydenseric/graphql-multipart-request-spec
3 |
4 | # 1.0.0
5 | * Apply `package:pedantic`.
6 |
7 | # 1.0.0-rc.0
8 | * Finish `graphQLWS`.
9 |
10 | # 1.0.0-beta.1
11 | * Add `graphQLWS` handler, and support subscriptions.
12 |
13 | # 1.0.0-beta
14 | * Angel RC updates.
15 |
16 | # 1.0.0-alpha
17 | * First official release.
--------------------------------------------------------------------------------
/graphql_server/lib/subscriptions_transport_ws.dart:
--------------------------------------------------------------------------------
1 | /// An implementation of Apollo's `subscriptions-transport-ws` in Dart.
2 | ///
3 | /// See:
4 | /// https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
5 | library graphql_server.subscriptions_transport_ws;
6 |
7 | export 'src/apollo/remote_client.dart';
8 | export 'src/apollo/server.dart';
9 | export 'src/apollo/transport.dart';
10 |
--------------------------------------------------------------------------------
/graphql_generator/build.yaml:
--------------------------------------------------------------------------------
1 | builders:
2 | graphql:
3 | import: "package:graphql_generator/graphql_generator.dart"
4 | builder_factories:
5 | - graphQLBuilder
6 | auto_apply: root_package
7 | build_to: cache
8 | build_extensions:
9 | .dart:
10 | - graphql_generator.g.part
11 | required_inputs:
12 | - angel_serialize.g.part
13 | applies_builders:
14 | - source_gen|combining_builder
--------------------------------------------------------------------------------
/graphql_schema/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: graphql_schema
2 | version: 1.0.4
3 | description: An implementation of GraphQL's type system in Dart. Basis of graphql_server.
4 | author: Tobe O
5 | homepage: https://github.com/angel-dart/graphql
6 | environment:
7 | sdk: ">=1.8.0 <3.0.0"
8 | dependencies:
9 | collection: ^1.0.0
10 | meta: ^1.0.0
11 | source_span: ^1.0.0
12 | dev_dependencies:
13 | test: ">=0.12.0 <2.0.0"
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_query_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_value_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_mirrors_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_validation_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_graphql_schema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/tests_in_graphql_parser.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/graphql_parser/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: graphql_parser
2 | version: 1.1.4
3 | description: Parses GraphQL queries and schemas. Also includes classes for the GraphQL AST.
4 | author: Tobe O
5 | homepage: https://github.com/angel-dart/graphql
6 | environment:
7 | sdk: ">=1.8.0 <3.0.0"
8 | dependencies:
9 | charcode: ^1.0.0
10 | source_span: ^1.0.0
11 | string_scanner: ^1.0.0
12 | dev_dependencies:
13 | matcher: any
14 | pedantic: ^1.0.0
15 | test: ">=0.12.0 <2.0.0"
16 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/token.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 | import 'token_type.dart';
3 |
4 | class Token {
5 | final TokenType type;
6 | final String text;
7 | FileSpan span;
8 |
9 | Token(this.type, this.text, [this.span]);
10 |
11 | @override
12 | String toString() {
13 | if (span == null) {
14 | return "'$text' -> $type";
15 | } else {
16 | return "(${span.start.line}:${span.start.column}) '$text' -> $type";
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/graphql.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/token_type.dart:
--------------------------------------------------------------------------------
1 | enum TokenType {
2 | ARROBA,
3 | COLON,
4 | COMMA,
5 | DOLLAR,
6 | ELLIPSIS,
7 | EQUALS,
8 | EXCLAMATION,
9 | LBRACE,
10 | RBRACE,
11 | LBRACKET,
12 | RBRACKET,
13 | LPAREN,
14 | RPAREN,
15 |
16 | // Note: these are *not* reserved names.
17 | // FRAGMENT,
18 | // MUTATION,
19 | // SUBSCRIPTION,
20 | // ON,
21 | // QUERY,
22 | // NULL
23 | // BOOLEAN,
24 |
25 | NUMBER,
26 | STRING,
27 | BLOCK_STRING,
28 |
29 | NAME,
30 | }
31 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/server_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/document.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 | import 'definition.dart';
3 | import 'node.dart';
4 |
5 | /// A GraphQL document.
6 | class DocumentContext extends Node {
7 | /// The top-level definitions in the document.
8 | final List definitions = [];
9 |
10 | @override
11 | FileSpan get span {
12 | if (definitions.isEmpty) return null;
13 | return definitions
14 | .map((d) => d.span)
15 | .reduce((a, b) => a.expand(b));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/episode.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'episode.dart';
4 |
5 | // **************************************************************************
6 | // _GraphQLGenerator
7 | // **************************************************************************
8 |
9 | /// Auto-generated from [Episode].
10 | final GraphQLEnumType episodeGraphQLType = enumTypeFromStrings(
11 | 'Episode', const ['NEWHOPE', 'EMPIRE', 'JEDI'],
12 | description: 'The episodes of the Star Wars original trilogy.');
13 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/character.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'character.dart';
4 |
5 | // **************************************************************************
6 | // _GraphQLGenerator
7 | // **************************************************************************
8 |
9 | /// Auto-generated from [Character].
10 | final GraphQLObjectType characterGraphQLType = objectType('Character',
11 | isInterface: true,
12 | interfaces: [],
13 | fields: [field('id', graphQLString), field('name', graphQLString)]);
14 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/definition.dart:
--------------------------------------------------------------------------------
1 | import 'node.dart';
2 |
3 | /// The base class for top-level GraphQL definitions.
4 | abstract class DefinitionContext extends Node {}
5 |
6 | /// An executable definition.
7 | abstract class ExecutableDefinitionContext extends DefinitionContext {}
8 |
9 | /// An ad-hoc type system declared in GraphQL.
10 | abstract class TypeSystemDefinitionContext extends DefinitionContext {}
11 |
12 | /// An extension to an existing ad-hoc type system.
13 | abstract class TypeSystemExtensionContext extends DefinitionContext {}
14 |
--------------------------------------------------------------------------------
/graphql_schema/test/common.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_schema/graphql_schema.dart';
2 |
3 | final GraphQLObjectType pokemonType = objectType('Pokemon', fields: [
4 | field('species', graphQLString),
5 | field('catch_date', graphQLDate)
6 | ]);
7 |
8 | final GraphQLObjectType trainerType =
9 | objectType('Trainer', fields: [field('name', graphQLString)]);
10 |
11 | final GraphQLObjectType pokemonRegionType = objectType('PokemonRegion',
12 | fields: [
13 | field('trainer', trainerType),
14 | field('pokemon_species', listOf(pokemonType))
15 | ]);
16 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/objects_in_equality_test_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example_star_wars/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: star_wars
2 | publish_to: none
3 | dependencies:
4 | #angel_file_service: ^1.0.0
5 | angel_graphql:
6 | path: ../angel_graphql
7 | angel_hot: ^2.0.0-alpha
8 | angel_serialize: ^2.0.0
9 | io: ^0.3.2
10 | dev_dependencies:
11 | angel_serialize_generator: ^2.0.0
12 | build_runner: ^1.0.0
13 | graphql_generator:
14 | path: ../graphql_generator
15 | dependency_overrides:
16 | graphql_parser:
17 | path: ../graphql_parser
18 | graphql_schema:
19 | path: ../graphql_schema
20 | graphql_server:
21 | path: ../graphql_server
--------------------------------------------------------------------------------
/graphql_generator/example/main.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'main.dart';
4 |
5 | // **************************************************************************
6 | // _GraphQLGenerator
7 | // **************************************************************************
8 |
9 | /// Auto-generated from [TodoItem].
10 | final GraphQLObjectType todoItemGraphQLType = objectType('TodoItem',
11 | isInterface: false,
12 | interfaces: [],
13 | fields: [
14 | field('text', graphQLString),
15 | field('isComplete', graphQLBoolean)
16 | ]);
17 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/type_name.dart:
--------------------------------------------------------------------------------
1 | import 'node.dart';
2 | import 'package:source_span/source_span.dart';
3 | import '../token.dart';
4 |
5 | /// The name of a GraphQL type.
6 | class TypeNameContext extends Node {
7 | /// The source token.
8 | final Token nameToken;
9 |
10 | TypeNameContext(this.nameToken);
11 |
12 | /// Use [nameToken] instead.
13 | @deprecated
14 | Token get NAME => nameToken;
15 |
16 | /// The [String] value of the [nameToken].
17 | String get name => nameToken.text;
18 |
19 | @override
20 | FileSpan get span => nameToken.span;
21 | }
22 |
--------------------------------------------------------------------------------
/.idea/graphql_parser.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/graphql_generator/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: graphql_generator
2 | version: 1.0.0+1
3 | description: Generates GraphQL schemas from Dart classes, for use with pkg:graphql_server.
4 | author: Tobe O
5 | homepage: https://github.com/angel-dart/graphql
6 | environment:
7 | sdk: ">=2.0.0 <3.0.0"
8 | dependencies:
9 | analyzer: ">=0.27.1 <2.0.0"
10 | angel_model: ^1.0.0
11 | angel_serialize_generator: ^2.0.0
12 | build: ^1.0.0
13 | build_config: ^0.3.0
14 | code_builder: ^3.0.0
15 | graphql_schema: ^1.0.2
16 | recase: ^2.0.0
17 | source_gen: ^0.9.4
18 | dev_dependencies:
19 | build_runner: ^1.0.0
20 | pedantic: ^1.0.0
--------------------------------------------------------------------------------
/angel_graphql/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: angel_graphql
2 | version: 1.1.0
3 | description: The fastest + easiest way to get a GraphQL backend in Dart, using Angel.
4 | homepage: https://github.com/angel-dart/graphql
5 | author: Tobe O
6 | environment:
7 | sdk: ">=2.0.0-dev <3.0.0"
8 | dependencies:
9 | angel_file_service: ^2.0.0
10 | angel_framework: ^2.0.0
11 | angel_websocket: ^2.0.0
12 | angel_validate: ^2.0.0
13 | graphql_parser: ^1.0.0
14 | graphql_schema: ^1.0.0
15 | graphql_server: ^1.0.0
16 | http_parser: ^3.0.0
17 | web_socket_channel: ^1.0.0
18 | dev_dependencies:
19 | angel_serialize: ^2.0.0
20 | file: ^5.0.0
21 | logging: ^0.11.0
22 | pedantic: ^1.0.0
--------------------------------------------------------------------------------
/example_star_wars/example_star_wars.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/selection.dart:
--------------------------------------------------------------------------------
1 | import 'field.dart';
2 | import 'fragment_spread.dart';
3 | import 'inline_fragment.dart';
4 | import 'node.dart';
5 | import 'package:source_span/source_span.dart';
6 |
7 | class SelectionContext extends Node {
8 | final FieldContext field;
9 | final FragmentSpreadContext fragmentSpread;
10 | final InlineFragmentContext inlineFragment;
11 |
12 | SelectionContext(this.field, [this.fragmentSpread, this.inlineFragment]) {
13 | assert(field != null || fragmentSpread != null || inlineFragment != null);
14 | }
15 |
16 | @override
17 | FileSpan get span =>
18 | field?.span ?? fragmentSpread?.span ?? inlineFragment?.span;
19 | }
20 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/default_value.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 | import '../token.dart';
3 | import 'input_value.dart';
4 | import 'node.dart';
5 |
6 | /// The default value to be passed to an [ArgumentContext].
7 | class DefaultValueContext extends Node {
8 | /// The source token.
9 | final Token equalsToken;
10 |
11 | /// The default value for the argument.
12 | final InputValueContext value;
13 |
14 | DefaultValueContext(this.equalsToken, this.value);
15 |
16 | /// Use [equalsToken] instead.
17 | @deprecated
18 | Token get EQUALS => equalsToken;
19 |
20 | @override
21 | FileSpan get span => equalsToken.span.expand(value.span);
22 | }
23 |
--------------------------------------------------------------------------------
/angel_graphql/angel_graphql.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/graphql_parser/graphql_parser.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/graphql_schema/graphql_schema.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/graphql_server/graphql_server.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/graphql_server/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: graphql_server
2 | version: 1.1.0
3 | author: Tobe O
4 | description: Base package for implementing GraphQL servers. You might prefer `package:angel_graphql`, the fastest way to implement GraphQL backends in Dart.
5 | homepage: https://github.com/angel-dart/graphql
6 | environment:
7 | sdk: ">=2.0.0 <3.0.0"
8 | dependencies:
9 | angel_serialize: ^2.0.0
10 | collection: ^1.0.0
11 | graphql_schema: ^1.0.0
12 | graphql_parser: ^1.0.0
13 | meta: ^1.0.0
14 | recase: ^2.0.0
15 | stream_channel: ^2.0.0
16 | tuple: ^1.0.0
17 | dev_dependencies:
18 | pedantic: ^1.0.0
19 | test: ">=0.12.0 <2.0.0"
20 | dependency_overrides:
21 | graphql_parser:
22 | path: ../graphql_parser
23 |
--------------------------------------------------------------------------------
/example_star_wars/lib/src/models/droid.dart:
--------------------------------------------------------------------------------
1 | import 'package:angel_model/angel_model.dart';
2 | import 'package:angel_serialize/angel_serialize.dart';
3 | import 'package:collection/collection.dart';
4 | import 'package:graphql_schema/graphql_schema.dart';
5 | import 'character.dart';
6 | import 'episode.dart';
7 | part 'droid.g.dart';
8 |
9 | @serializable
10 | @graphQLClass
11 | @GraphQLDocumentation(description: 'Beep! Boop!')
12 | abstract class _Droid extends Model implements Character {
13 | String get id;
14 |
15 | String get name;
16 |
17 | @GraphQLDocumentation(
18 | description: 'The list of episodes this droid appears in.')
19 | List get appearsIn;
20 |
21 | /// Doc comments automatically become GraphQL descriptions.
22 | List get friends;
23 | }
24 |
--------------------------------------------------------------------------------
/graphql_parser/example/example.dart:
--------------------------------------------------------------------------------
1 | import 'package:graphql_parser/graphql_parser.dart';
2 |
3 | final String text = '''
4 | {
5 | project(name: "GraphQL") {
6 | tagline
7 | }
8 | }
9 | '''
10 | .trim();
11 |
12 | main() {
13 | var tokens = scan(text);
14 | var parser = Parser(tokens);
15 | var doc = parser.parseDocument();
16 |
17 | var operation = doc.definitions.first as OperationDefinitionContext;
18 |
19 | var projectField = operation.selectionSet.selections.first.field;
20 | print(projectField.fieldName.name); // project
21 | print(projectField.arguments.first.name); // name
22 | print(projectField.arguments.first.value); // GraphQL
23 |
24 | var taglineField = projectField.selectionSet.selections.first.field;
25 | print(taglineField.fieldName.name); // tagline
26 | }
27 |
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/field_name.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 | import '../token.dart';
3 | import 'alias.dart';
4 | import 'node.dart';
5 |
6 | /// The name of a GraphQL [FieldContext], which may or may not be [alias]ed.
7 | class FieldNameContext extends Node {
8 | /// The source token.
9 | final Token nameToken;
10 |
11 | /// An (optional) alias for the field.
12 | final AliasContext alias;
13 |
14 | FieldNameContext(this.nameToken, [this.alias]) {
15 | assert(nameToken != null || alias != null);
16 | }
17 |
18 | /// Use [nameToken] instead.
19 | @deprecated
20 | Token get NAME => nameToken;
21 |
22 | /// The [String] value of the [nameToken], if any.
23 | String get name => nameToken?.text;
24 |
25 | @override
26 | FileSpan get span => alias?.span ?? nameToken.span;
27 | }
28 |
--------------------------------------------------------------------------------
/graphql_parser/test/next_name_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:test/test.dart';
2 | import 'common.dart';
3 |
4 | var githubSrc = r'''
5 | query searchRepos($queryString: String!, $repositoryOrder: RepositoryOrder, $first: Int!) {
6 | search(type: REPOSITORY, query: $queryString, first: $first) {
7 | ...SearchResultItemConnection
8 | }
9 | }
10 | ''';
11 |
12 | void main() {
13 | test('can parse formerly-reserved words', () {
14 | var def = parse(githubSrc).parseOperationDefinition();
15 | expect(def.isQuery, isTrue);
16 | expect(def.variableDefinitions.variableDefinitions, hasLength(3));
17 |
18 | var searchField = def.selectionSet.selections[0].field;
19 | expect(searchField.fieldName.name, 'search');
20 |
21 | var argNames = searchField.arguments.map((a) => a.name).toList();
22 | expect(argNames, ['type', 'query', 'first']);
23 | });
24 | }
25 |
--------------------------------------------------------------------------------
/data_loader/README.md:
--------------------------------------------------------------------------------
1 | # data_loader
2 | [](https://pub.dartlang.org/packages/data_loader)
3 | [](https://travis-ci.org/angel-dart/graphql)
4 |
5 |
6 | Batch and cache database lookups. Works well with GraphQL.
7 | Ported from the original JS version:
8 | https://github.com/graphql/dataloader
9 |
10 | ## Installation
11 | In your pubspec.yaml:
12 |
13 | ```yaml
14 | dependencies:
15 | data_loader: ^1.0.0
16 | ```
17 |
18 | ## Usage
19 | Complete example:
20 | https://github.com/angel-dart/graphql/blob/master/data_loader/example/main.dart
21 |
22 | ```dart
23 | var userLoader = new DataLoader((key) => myBatchGetUsers(keys));
24 | var invitedBy = await userLoader.load(1)then(user => userLoader.load(user.invitedByID))
25 | print('User 1 was invited by $invitedBy'));
26 | ```
--------------------------------------------------------------------------------
/graphql_parser/lib/src/language/ast/variable.dart:
--------------------------------------------------------------------------------
1 | import 'package:source_span/source_span.dart';
2 | import '../token.dart';
3 | import 'input_value.dart';
4 |
5 | /// A variable reference in GraphQL.
6 | class VariableContext extends InputValueContext