rails-graphql 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +31 -0
- data/ext/depend +3 -0
- data/ext/extconf.rb +57 -0
- data/ext/graphqlparser/Ast.cpp +346 -0
- data/ext/graphqlparser/Ast.h +1214 -0
- data/ext/graphqlparser/AstNode.h +36 -0
- data/ext/graphqlparser/AstVisitor.h +137 -0
- data/ext/graphqlparser/GraphQLParser.cpp +76 -0
- data/ext/graphqlparser/GraphQLParser.h +55 -0
- data/ext/graphqlparser/JsonVisitor.cpp +161 -0
- data/ext/graphqlparser/JsonVisitor.cpp.inc +456 -0
- data/ext/graphqlparser/JsonVisitor.h +121 -0
- data/ext/graphqlparser/JsonVisitor.h.inc +110 -0
- data/ext/graphqlparser/VERSION +1 -0
- data/ext/graphqlparser/c/GraphQLAst.cpp +324 -0
- data/ext/graphqlparser/c/GraphQLAst.h +180 -0
- data/ext/graphqlparser/c/GraphQLAstForEachConcreteType.h +44 -0
- data/ext/graphqlparser/c/GraphQLAstNode.cpp +25 -0
- data/ext/graphqlparser/c/GraphQLAstNode.h +33 -0
- data/ext/graphqlparser/c/GraphQLAstToJSON.cpp +21 -0
- data/ext/graphqlparser/c/GraphQLAstToJSON.h +24 -0
- data/ext/graphqlparser/c/GraphQLAstVisitor.cpp +55 -0
- data/ext/graphqlparser/c/GraphQLAstVisitor.h +53 -0
- data/ext/graphqlparser/c/GraphQLParser.cpp +35 -0
- data/ext/graphqlparser/c/GraphQLParser.h +54 -0
- data/ext/graphqlparser/dump_json_ast.cpp +48 -0
- data/ext/graphqlparser/lexer.lpp +324 -0
- data/ext/graphqlparser/parser.ypp +693 -0
- data/ext/graphqlparser/parsergen/lexer.cpp +2633 -0
- data/ext/graphqlparser/parsergen/lexer.h +528 -0
- data/ext/graphqlparser/parsergen/location.hh +189 -0
- data/ext/graphqlparser/parsergen/parser.tab.cpp +3300 -0
- data/ext/graphqlparser/parsergen/parser.tab.hpp +646 -0
- data/ext/graphqlparser/parsergen/position.hh +179 -0
- data/ext/graphqlparser/parsergen/stack.hh +156 -0
- data/ext/graphqlparser/syntaxdefs.h +19 -0
- data/ext/libgraphqlparser/AstNode.h +36 -0
- data/ext/libgraphqlparser/CMakeLists.txt +148 -0
- data/ext/libgraphqlparser/CONTRIBUTING.md +23 -0
- data/ext/libgraphqlparser/GraphQLParser.cpp +76 -0
- data/ext/libgraphqlparser/GraphQLParser.h +55 -0
- data/ext/libgraphqlparser/JsonVisitor.cpp +161 -0
- data/ext/libgraphqlparser/JsonVisitor.h +121 -0
- data/ext/libgraphqlparser/LICENSE +22 -0
- data/ext/libgraphqlparser/README.clang-tidy +7 -0
- data/ext/libgraphqlparser/README.md +84 -0
- data/ext/libgraphqlparser/ast/ast.ast +203 -0
- data/ext/libgraphqlparser/ast/ast.py +61 -0
- data/ext/libgraphqlparser/ast/c.py +100 -0
- data/ext/libgraphqlparser/ast/c.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_impl.py +61 -0
- data/ext/libgraphqlparser/ast/c_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.py +39 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/casing.py +26 -0
- data/ext/libgraphqlparser/ast/casing.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx.py +197 -0
- data/ext/libgraphqlparser/ast/cxx.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_impl.py +61 -0
- data/ext/libgraphqlparser/ast/cxx_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.py +42 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.py +80 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.py +64 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.pyc +0 -0
- data/ext/libgraphqlparser/ast/js.py +65 -0
- data/ext/libgraphqlparser/ast/license.py +10 -0
- data/ext/libgraphqlparser/ast/license.pyc +0 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.cpp +25 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.h +33 -0
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.cpp +21 -0
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.h +24 -0
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.cpp +55 -0
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.h +53 -0
- data/ext/libgraphqlparser/c/GraphQLParser.cpp +35 -0
- data/ext/libgraphqlparser/c/GraphQLParser.h +54 -0
- data/ext/libgraphqlparser/clang-tidy-all.sh +3 -0
- data/ext/libgraphqlparser/cmake/version.cmake +16 -0
- data/ext/libgraphqlparser/dump_json_ast.cpp +48 -0
- data/ext/libgraphqlparser/go/README.md +20 -0
- data/ext/libgraphqlparser/go/callbacks.go +18 -0
- data/ext/libgraphqlparser/go/gotest.go +64 -0
- data/ext/libgraphqlparser/lexer.lpp +324 -0
- data/ext/libgraphqlparser/libgraphqlparser.pc.in +11 -0
- data/ext/libgraphqlparser/parser.ypp +693 -0
- data/ext/libgraphqlparser/parsergen/lexer.cpp +2633 -0
- data/ext/libgraphqlparser/parsergen/lexer.h +528 -0
- data/ext/libgraphqlparser/parsergen/location.hh +189 -0
- data/ext/libgraphqlparser/parsergen/parser.tab.cpp +3300 -0
- data/ext/libgraphqlparser/parsergen/parser.tab.hpp +646 -0
- data/ext/libgraphqlparser/parsergen/position.hh +179 -0
- data/ext/libgraphqlparser/parsergen/stack.hh +156 -0
- data/ext/libgraphqlparser/python/CMakeLists.txt +14 -0
- data/ext/libgraphqlparser/python/README.md +5 -0
- data/ext/libgraphqlparser/python/example.py +31 -0
- data/ext/libgraphqlparser/syntaxdefs.h +19 -0
- data/ext/libgraphqlparser/test/BuildCAPI.c +5 -0
- data/ext/libgraphqlparser/test/CMakeLists.txt +25 -0
- data/ext/libgraphqlparser/test/JsonVisitorTests.cpp +28 -0
- data/ext/libgraphqlparser/test/ParserTests.cpp +352 -0
- data/ext/libgraphqlparser/test/kitchen-sink.graphql +59 -0
- data/ext/libgraphqlparser/test/kitchen-sink.json +1 -0
- data/ext/libgraphqlparser/test/schema-kitchen-sink.graphql +78 -0
- data/ext/libgraphqlparser/test/schema-kitchen-sink.json +1 -0
- data/ext/libgraphqlparser/test/valgrind.supp +33 -0
- data/ext/version.cpp +21 -0
- data/lib/generators/graphql/controller_generator.rb +22 -0
- data/lib/generators/graphql/schema_generator.rb +22 -0
- data/lib/generators/graphql/templates/controller.erb +5 -0
- data/lib/generators/graphql/templates/schema.erb +6 -0
- data/lib/graphqlparser.so +0 -0
- data/lib/rails-graphql.rb +2 -0
- data/lib/rails/graphql.rake +1 -0
- data/lib/rails/graphql.rb +185 -0
- data/lib/rails/graphql/adapters/mysql_adapter.rb +0 -0
- data/lib/rails/graphql/adapters/pg_adapter.rb +50 -0
- data/lib/rails/graphql/adapters/sqlite_adapter.rb +39 -0
- data/lib/rails/graphql/argument.rb +220 -0
- data/lib/rails/graphql/callback.rb +124 -0
- data/lib/rails/graphql/collectors.rb +14 -0
- data/lib/rails/graphql/collectors/hash_collector.rb +83 -0
- data/lib/rails/graphql/collectors/idented_collector.rb +73 -0
- data/lib/rails/graphql/collectors/json_collector.rb +114 -0
- data/lib/rails/graphql/config.rb +61 -0
- data/lib/rails/graphql/directive.rb +203 -0
- data/lib/rails/graphql/directive/deprecated_directive.rb +59 -0
- data/lib/rails/graphql/directive/include_directive.rb +24 -0
- data/lib/rails/graphql/directive/skip_directive.rb +24 -0
- data/lib/rails/graphql/errors.rb +42 -0
- data/lib/rails/graphql/event.rb +141 -0
- data/lib/rails/graphql/field.rb +318 -0
- data/lib/rails/graphql/field/input_field.rb +92 -0
- data/lib/rails/graphql/field/mutation_field.rb +52 -0
- data/lib/rails/graphql/field/output_field.rb +96 -0
- data/lib/rails/graphql/field/proxied_field.rb +131 -0
- data/lib/rails/graphql/field/resolved_field.rb +96 -0
- data/lib/rails/graphql/field/scoped_config.rb +22 -0
- data/lib/rails/graphql/field/typed_field.rb +104 -0
- data/lib/rails/graphql/helpers.rb +40 -0
- data/lib/rails/graphql/helpers/attribute_delegator.rb +39 -0
- data/lib/rails/graphql/helpers/inherited_collection.rb +152 -0
- data/lib/rails/graphql/helpers/leaf_from_ar.rb +141 -0
- data/lib/rails/graphql/helpers/registerable.rb +103 -0
- data/lib/rails/graphql/helpers/with_arguments.rb +125 -0
- data/lib/rails/graphql/helpers/with_assignment.rb +113 -0
- data/lib/rails/graphql/helpers/with_callbacks.rb +55 -0
- data/lib/rails/graphql/helpers/with_directives.rb +126 -0
- data/lib/rails/graphql/helpers/with_events.rb +81 -0
- data/lib/rails/graphql/helpers/with_fields.rb +141 -0
- data/lib/rails/graphql/helpers/with_namespace.rb +40 -0
- data/lib/rails/graphql/helpers/with_owner.rb +35 -0
- data/lib/rails/graphql/helpers/with_schema_fields.rb +230 -0
- data/lib/rails/graphql/helpers/with_validator.rb +52 -0
- data/lib/rails/graphql/introspection.rb +53 -0
- data/lib/rails/graphql/native.rb +56 -0
- data/lib/rails/graphql/native/functions.rb +38 -0
- data/lib/rails/graphql/native/location.rb +41 -0
- data/lib/rails/graphql/native/pointers.rb +23 -0
- data/lib/rails/graphql/native/visitor.rb +349 -0
- data/lib/rails/graphql/railtie.rb +85 -0
- data/lib/rails/graphql/railties/base_generator.rb +35 -0
- data/lib/rails/graphql/railties/controller.rb +101 -0
- data/lib/rails/graphql/railties/controller_runtime.rb +40 -0
- data/lib/rails/graphql/railties/log_subscriber.rb +62 -0
- data/lib/rails/graphql/request.rb +343 -0
- data/lib/rails/graphql/request/arguments.rb +93 -0
- data/lib/rails/graphql/request/component.rb +100 -0
- data/lib/rails/graphql/request/component/field.rb +225 -0
- data/lib/rails/graphql/request/component/fragment.rb +118 -0
- data/lib/rails/graphql/request/component/operation.rb +178 -0
- data/lib/rails/graphql/request/component/operation/subscription.rb +16 -0
- data/lib/rails/graphql/request/component/spread.rb +119 -0
- data/lib/rails/graphql/request/component/typename.rb +82 -0
- data/lib/rails/graphql/request/context.rb +51 -0
- data/lib/rails/graphql/request/errors.rb +54 -0
- data/lib/rails/graphql/request/event.rb +112 -0
- data/lib/rails/graphql/request/helpers/directives.rb +64 -0
- data/lib/rails/graphql/request/helpers/selection_set.rb +87 -0
- data/lib/rails/graphql/request/helpers/value_writers.rb +115 -0
- data/lib/rails/graphql/request/steps/organizable.rb +146 -0
- data/lib/rails/graphql/request/steps/prepareable.rb +33 -0
- data/lib/rails/graphql/request/steps/resolveable.rb +32 -0
- data/lib/rails/graphql/request/strategy.rb +249 -0
- data/lib/rails/graphql/request/strategy/dynamic_instance.rb +41 -0
- data/lib/rails/graphql/request/strategy/multi_query_strategy.rb +36 -0
- data/lib/rails/graphql/request/strategy/sequenced_strategy.rb +28 -0
- data/lib/rails/graphql/schema.rb +272 -0
- data/lib/rails/graphql/shortcuts.rb +77 -0
- data/lib/rails/graphql/source.rb +371 -0
- data/lib/rails/graphql/source/active_record/builders.rb +154 -0
- data/lib/rails/graphql/source/active_record_source.rb +231 -0
- data/lib/rails/graphql/source/scoped_arguments.rb +87 -0
- data/lib/rails/graphql/to_gql.rb +368 -0
- data/lib/rails/graphql/type.rb +138 -0
- data/lib/rails/graphql/type/enum.rb +206 -0
- data/lib/rails/graphql/type/enum/directive_location_enum.rb +30 -0
- data/lib/rails/graphql/type/enum/type_kind_enum.rb +57 -0
- data/lib/rails/graphql/type/input.rb +134 -0
- data/lib/rails/graphql/type/interface.rb +82 -0
- data/lib/rails/graphql/type/object.rb +111 -0
- data/lib/rails/graphql/type/object/directive_object.rb +34 -0
- data/lib/rails/graphql/type/object/enum_value_object.rb +25 -0
- data/lib/rails/graphql/type/object/field_object.rb +54 -0
- data/lib/rails/graphql/type/object/input_value_object.rb +49 -0
- data/lib/rails/graphql/type/object/schema_object.rb +40 -0
- data/lib/rails/graphql/type/object/type_object.rb +136 -0
- data/lib/rails/graphql/type/scalar.rb +71 -0
- data/lib/rails/graphql/type/scalar/bigint_scalar.rb +34 -0
- data/lib/rails/graphql/type/scalar/binary_scalar.rb +30 -0
- data/lib/rails/graphql/type/scalar/boolean_scalar.rb +37 -0
- data/lib/rails/graphql/type/scalar/date_scalar.rb +34 -0
- data/lib/rails/graphql/type/scalar/date_time_scalar.rb +32 -0
- data/lib/rails/graphql/type/scalar/decimal_scalar.rb +35 -0
- data/lib/rails/graphql/type/scalar/float_scalar.rb +32 -0
- data/lib/rails/graphql/type/scalar/id_scalar.rb +39 -0
- data/lib/rails/graphql/type/scalar/int_scalar.rb +36 -0
- data/lib/rails/graphql/type/scalar/string_scalar.rb +28 -0
- data/lib/rails/graphql/type/scalar/time_scalar.rb +40 -0
- data/lib/rails/graphql/type/union.rb +87 -0
- data/lib/rails/graphql/type_map.rb +347 -0
- data/lib/rails/graphql/version.rb +7 -0
- data/test/assets/introspection-db.json +0 -0
- data/test/assets/introspection-mem.txt +1 -0
- data/test/assets/introspection.gql +91 -0
- data/test/assets/luke.jpg +0 -0
- data/test/assets/mem.gql +428 -0
- data/test/assets/sqlite.gql +423 -0
- data/test/config.rb +80 -0
- data/test/graphql/request/context_test.rb +70 -0
- data/test/graphql/schema_test.rb +190 -0
- data/test/graphql/source_test.rb +237 -0
- data/test/graphql/type/enum_test.rb +203 -0
- data/test/graphql/type/input_test.rb +138 -0
- data/test/graphql/type/interface_test.rb +72 -0
- data/test/graphql/type/object_test.rb +104 -0
- data/test/graphql/type/scalar/bigint_scalar_test.rb +42 -0
- data/test/graphql/type/scalar/binary_scalar_test.rb +17 -0
- data/test/graphql/type/scalar/boolean_scalar_test.rb +40 -0
- data/test/graphql/type/scalar/date_scalar_test.rb +29 -0
- data/test/graphql/type/scalar/date_time_scalar_test.rb +29 -0
- data/test/graphql/type/scalar/decimal_scalar_test.rb +28 -0
- data/test/graphql/type/scalar/float_scalar_test.rb +22 -0
- data/test/graphql/type/scalar/id_scalar_test.rb +26 -0
- data/test/graphql/type/scalar/int_scalar_test.rb +26 -0
- data/test/graphql/type/scalar/string_scalar_test.rb +17 -0
- data/test/graphql/type/scalar/time_scalar_test.rb +36 -0
- data/test/graphql/type/scalar_test.rb +45 -0
- data/test/graphql/type/union_test.rb +82 -0
- data/test/graphql/type_map_test.rb +362 -0
- data/test/graphql/type_test.rb +68 -0
- data/test/graphql_test.rb +55 -0
- data/test/integration/config.rb +56 -0
- data/test/integration/memory/star_wars_introspection_test.rb +144 -0
- data/test/integration/memory/star_wars_query_test.rb +184 -0
- data/test/integration/memory/star_wars_validation_test.rb +99 -0
- data/test/integration/schemas/memory.rb +232 -0
- data/test/integration/schemas/sqlite.rb +82 -0
- data/test/integration/sqlite/star_wars_introspection_test.rb +15 -0
- data/test/integration/sqlite/star_wars_mutation_test.rb +82 -0
- data/test/integration/sqlite/star_wars_query_test.rb +71 -0
- data/test/test_ext.rb +48 -0
- metadata +509 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 49e43687d5292b789a8bd31a328c7788e65ea18fa9e7210804a6d2b5fa626a55
|
4
|
+
data.tar.gz: e18c7462267165fbc6c891cb6abcd8e1d58a7c4e4cef52209d8b7cd779775768
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a389ad749b2de6f1109b81e675ab78adad048b2d621e268c2d22a7ed7ace9f76aa2ab7b82510a2089cdced461f3df721a89f3a86a9c4fca5215458266b274c3
|
7
|
+
data.tar.gz: ac5b71676b2bded14527eed7d2b2b7242c3258f9ee0aaddc562d9ea7a58931aa1372d54634176058e0e1f4b959c712db95831dbcd2b1f15473652b13aa8126aa
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2020 "VirtualShield LLC"
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= Torque PostgreSQL
|
2
|
+
|
3
|
+
|
4
|
+
== Download and installation
|
5
|
+
|
6
|
+
The latest version of Rails GraphQL can be installed with RubyGems:
|
7
|
+
|
8
|
+
$ gem install rails-graphql
|
9
|
+
|
10
|
+
Source code can be downloaded direct from the GitHub repository:
|
11
|
+
|
12
|
+
* https://github.com/virtualshield/rails-graphql
|
13
|
+
|
14
|
+
|
15
|
+
== License
|
16
|
+
|
17
|
+
Rails GraphQL is released under the MIT license:
|
18
|
+
|
19
|
+
* http://www.opensource.org/licenses/MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Rake tasks for development purposes
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'bundler/setup'
|
6
|
+
rescue LoadError
|
7
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rdoc/task'
|
11
|
+
require 'rake/testtask'
|
12
|
+
|
13
|
+
require_relative 'tasks/libgraphqlparser'
|
14
|
+
|
15
|
+
task default: :test
|
16
|
+
|
17
|
+
Rake::TestTask.new(:test) do |t|
|
18
|
+
t.libs << 'test'
|
19
|
+
t.warning = true
|
20
|
+
t.verbose = true
|
21
|
+
t.test_files = Dir.glob("test/**/*_test.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
25
|
+
rdoc.rdoc_dir = 'rdoc'
|
26
|
+
rdoc.title = 'Rails::GraphQL'
|
27
|
+
rdoc.options << '--line-numbers'
|
28
|
+
rdoc.rdoc_files.include('README.rdoc')
|
29
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
30
|
+
end
|
31
|
+
|
data/ext/depend
ADDED
data/ext/extconf.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
gem_root = File.expand_path('..', __dir__)
|
4
|
+
precomp_dir = File.join(gem_root, 'ext', 'graphqlparser')
|
5
|
+
|
6
|
+
abort 'The libgraphqlparser must be pre-compile first!' \
|
7
|
+
unless File.directory?(precomp_dir)
|
8
|
+
|
9
|
+
require 'mkmf'
|
10
|
+
|
11
|
+
# Define a version variable
|
12
|
+
version = File.read(File.join(precomp_dir, 'VERSION'))
|
13
|
+
$defs << "-DGRAPHQLPARSER_VERSION=\\\"#{version}\\\""
|
14
|
+
|
15
|
+
# Set necessary flags and includes
|
16
|
+
$CXXFLAGS << ' -std=gnu++11' << ' -g' << ' -Wall'
|
17
|
+
|
18
|
+
# Set to true when building binary gems
|
19
|
+
if enable_config('static-stdlib', false)
|
20
|
+
$LDFLAGS << ' -static-libgcc -static-libstdc++'
|
21
|
+
end
|
22
|
+
|
23
|
+
# Enable maintainer mode for better log
|
24
|
+
if ENV['MAINTAINER_MODE']
|
25
|
+
require 'pry'
|
26
|
+
|
27
|
+
$stderr.puts 'Maintainer mode enabled'
|
28
|
+
$CFLAGS << ' -ggdb' << ' -DDEBUG' << ' -pedantic'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Disable noisy compilation warnings.
|
32
|
+
$warnflags = ''
|
33
|
+
$CFLAGS.gsub!(/[\s+](-ansi|-std=[^\s]+)/, '')
|
34
|
+
|
35
|
+
$VPATH << "$(srcdir)/graphqlparser/"
|
36
|
+
$VPATH << "$(srcdir)/graphqlparser/c/"
|
37
|
+
$VPATH << "$(srcdir)/graphqlparser/parsergen/"
|
38
|
+
|
39
|
+
$INCFLAGS << " -I$(srcdir)/graphqlparser/"
|
40
|
+
$INCFLAGS << " -I$(srcdir)/graphqlparser/c/"
|
41
|
+
$INCFLAGS << " -I$(srcdir)/graphqlparser/parsergen/"
|
42
|
+
|
43
|
+
$srcs = [
|
44
|
+
File.join(precomp_dir, 'Ast.cpp'),
|
45
|
+
File.join(precomp_dir, 'JsonVisitor.cpp'),
|
46
|
+
File.join(precomp_dir, 'parsergen', 'parser.tab.cpp'),
|
47
|
+
File.join(precomp_dir, 'parsergen', 'lexer.cpp'),
|
48
|
+
File.join(precomp_dir, 'c', 'GraphQLAst.cpp'),
|
49
|
+
File.join(precomp_dir, 'c', 'GraphQLAstNode.cpp'),
|
50
|
+
File.join(precomp_dir, 'c', 'GraphQLAstToJSON.cpp'),
|
51
|
+
File.join(precomp_dir, 'c', 'GraphQLAstVisitor.cpp'),
|
52
|
+
File.join(precomp_dir, 'GraphQLParser.cpp'),
|
53
|
+
File.join(gem_root, 'ext', 'version.cpp'),
|
54
|
+
]
|
55
|
+
|
56
|
+
create_header
|
57
|
+
create_makefile 'graphqlparser'
|
@@ -0,0 +1,346 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2019-present GraphQL Foundation
|
3
|
+
* This source code is licensed under the MIT license found in the
|
4
|
+
* LICENSE file in the root directory of this source tree.
|
5
|
+
*/
|
6
|
+
/** @generated */
|
7
|
+
|
8
|
+
#include "Ast.h"
|
9
|
+
#include "AstVisitor.h"
|
10
|
+
|
11
|
+
namespace facebook {
|
12
|
+
namespace graphql {
|
13
|
+
namespace ast {
|
14
|
+
|
15
|
+
void Document::accept(visitor::AstVisitor *visitor) const {
|
16
|
+
if (visitor->visitDocument(*this)) {
|
17
|
+
|
18
|
+
{ for (const auto &x : *definitions_) { x->accept(visitor); } }
|
19
|
+
}
|
20
|
+
visitor->endVisitDocument(*this);
|
21
|
+
}
|
22
|
+
|
23
|
+
void OperationDefinition::accept(visitor::AstVisitor *visitor) const {
|
24
|
+
if (visitor->visitOperationDefinition(*this)) {
|
25
|
+
|
26
|
+
if (name_) { name_->accept(visitor); }
|
27
|
+
if (variableDefinitions_) { for (const auto &x : *variableDefinitions_) { x->accept(visitor); } }
|
28
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
29
|
+
selectionSet_->accept(visitor);
|
30
|
+
}
|
31
|
+
visitor->endVisitOperationDefinition(*this);
|
32
|
+
}
|
33
|
+
|
34
|
+
void VariableDefinition::accept(visitor::AstVisitor *visitor) const {
|
35
|
+
if (visitor->visitVariableDefinition(*this)) {
|
36
|
+
|
37
|
+
variable_->accept(visitor);
|
38
|
+
type_->accept(visitor);
|
39
|
+
if (defaultValue_) { defaultValue_->accept(visitor); }
|
40
|
+
}
|
41
|
+
visitor->endVisitVariableDefinition(*this);
|
42
|
+
}
|
43
|
+
|
44
|
+
void SelectionSet::accept(visitor::AstVisitor *visitor) const {
|
45
|
+
if (visitor->visitSelectionSet(*this)) {
|
46
|
+
|
47
|
+
{ for (const auto &x : *selections_) { x->accept(visitor); } }
|
48
|
+
}
|
49
|
+
visitor->endVisitSelectionSet(*this);
|
50
|
+
}
|
51
|
+
|
52
|
+
void Field::accept(visitor::AstVisitor *visitor) const {
|
53
|
+
if (visitor->visitField(*this)) {
|
54
|
+
|
55
|
+
if (alias_) { alias_->accept(visitor); }
|
56
|
+
name_->accept(visitor);
|
57
|
+
if (arguments_) { for (const auto &x : *arguments_) { x->accept(visitor); } }
|
58
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
59
|
+
if (selectionSet_) { selectionSet_->accept(visitor); }
|
60
|
+
}
|
61
|
+
visitor->endVisitField(*this);
|
62
|
+
}
|
63
|
+
|
64
|
+
void Argument::accept(visitor::AstVisitor *visitor) const {
|
65
|
+
if (visitor->visitArgument(*this)) {
|
66
|
+
|
67
|
+
name_->accept(visitor);
|
68
|
+
value_->accept(visitor);
|
69
|
+
}
|
70
|
+
visitor->endVisitArgument(*this);
|
71
|
+
}
|
72
|
+
|
73
|
+
void FragmentSpread::accept(visitor::AstVisitor *visitor) const {
|
74
|
+
if (visitor->visitFragmentSpread(*this)) {
|
75
|
+
|
76
|
+
name_->accept(visitor);
|
77
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
78
|
+
}
|
79
|
+
visitor->endVisitFragmentSpread(*this);
|
80
|
+
}
|
81
|
+
|
82
|
+
void InlineFragment::accept(visitor::AstVisitor *visitor) const {
|
83
|
+
if (visitor->visitInlineFragment(*this)) {
|
84
|
+
|
85
|
+
if (typeCondition_) { typeCondition_->accept(visitor); }
|
86
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
87
|
+
selectionSet_->accept(visitor);
|
88
|
+
}
|
89
|
+
visitor->endVisitInlineFragment(*this);
|
90
|
+
}
|
91
|
+
|
92
|
+
void FragmentDefinition::accept(visitor::AstVisitor *visitor) const {
|
93
|
+
if (visitor->visitFragmentDefinition(*this)) {
|
94
|
+
|
95
|
+
name_->accept(visitor);
|
96
|
+
typeCondition_->accept(visitor);
|
97
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
98
|
+
selectionSet_->accept(visitor);
|
99
|
+
}
|
100
|
+
visitor->endVisitFragmentDefinition(*this);
|
101
|
+
}
|
102
|
+
|
103
|
+
void Variable::accept(visitor::AstVisitor *visitor) const {
|
104
|
+
if (visitor->visitVariable(*this)) {
|
105
|
+
|
106
|
+
name_->accept(visitor);
|
107
|
+
}
|
108
|
+
visitor->endVisitVariable(*this);
|
109
|
+
}
|
110
|
+
|
111
|
+
void IntValue::accept(visitor::AstVisitor *visitor) const {
|
112
|
+
if (visitor->visitIntValue(*this)) {
|
113
|
+
|
114
|
+
}
|
115
|
+
visitor->endVisitIntValue(*this);
|
116
|
+
}
|
117
|
+
|
118
|
+
void FloatValue::accept(visitor::AstVisitor *visitor) const {
|
119
|
+
if (visitor->visitFloatValue(*this)) {
|
120
|
+
|
121
|
+
}
|
122
|
+
visitor->endVisitFloatValue(*this);
|
123
|
+
}
|
124
|
+
|
125
|
+
void StringValue::accept(visitor::AstVisitor *visitor) const {
|
126
|
+
if (visitor->visitStringValue(*this)) {
|
127
|
+
|
128
|
+
}
|
129
|
+
visitor->endVisitStringValue(*this);
|
130
|
+
}
|
131
|
+
|
132
|
+
void BooleanValue::accept(visitor::AstVisitor *visitor) const {
|
133
|
+
if (visitor->visitBooleanValue(*this)) {
|
134
|
+
|
135
|
+
}
|
136
|
+
visitor->endVisitBooleanValue(*this);
|
137
|
+
}
|
138
|
+
|
139
|
+
void NullValue::accept(visitor::AstVisitor *visitor) const {
|
140
|
+
if (visitor->visitNullValue(*this)) {
|
141
|
+
|
142
|
+
}
|
143
|
+
visitor->endVisitNullValue(*this);
|
144
|
+
}
|
145
|
+
|
146
|
+
void EnumValue::accept(visitor::AstVisitor *visitor) const {
|
147
|
+
if (visitor->visitEnumValue(*this)) {
|
148
|
+
|
149
|
+
}
|
150
|
+
visitor->endVisitEnumValue(*this);
|
151
|
+
}
|
152
|
+
|
153
|
+
void ListValue::accept(visitor::AstVisitor *visitor) const {
|
154
|
+
if (visitor->visitListValue(*this)) {
|
155
|
+
|
156
|
+
{ for (const auto &x : *values_) { x->accept(visitor); } }
|
157
|
+
}
|
158
|
+
visitor->endVisitListValue(*this);
|
159
|
+
}
|
160
|
+
|
161
|
+
void ObjectValue::accept(visitor::AstVisitor *visitor) const {
|
162
|
+
if (visitor->visitObjectValue(*this)) {
|
163
|
+
|
164
|
+
{ for (const auto &x : *fields_) { x->accept(visitor); } }
|
165
|
+
}
|
166
|
+
visitor->endVisitObjectValue(*this);
|
167
|
+
}
|
168
|
+
|
169
|
+
void ObjectField::accept(visitor::AstVisitor *visitor) const {
|
170
|
+
if (visitor->visitObjectField(*this)) {
|
171
|
+
|
172
|
+
name_->accept(visitor);
|
173
|
+
value_->accept(visitor);
|
174
|
+
}
|
175
|
+
visitor->endVisitObjectField(*this);
|
176
|
+
}
|
177
|
+
|
178
|
+
void Directive::accept(visitor::AstVisitor *visitor) const {
|
179
|
+
if (visitor->visitDirective(*this)) {
|
180
|
+
|
181
|
+
name_->accept(visitor);
|
182
|
+
if (arguments_) { for (const auto &x : *arguments_) { x->accept(visitor); } }
|
183
|
+
}
|
184
|
+
visitor->endVisitDirective(*this);
|
185
|
+
}
|
186
|
+
|
187
|
+
void NamedType::accept(visitor::AstVisitor *visitor) const {
|
188
|
+
if (visitor->visitNamedType(*this)) {
|
189
|
+
|
190
|
+
name_->accept(visitor);
|
191
|
+
}
|
192
|
+
visitor->endVisitNamedType(*this);
|
193
|
+
}
|
194
|
+
|
195
|
+
void ListType::accept(visitor::AstVisitor *visitor) const {
|
196
|
+
if (visitor->visitListType(*this)) {
|
197
|
+
|
198
|
+
type_->accept(visitor);
|
199
|
+
}
|
200
|
+
visitor->endVisitListType(*this);
|
201
|
+
}
|
202
|
+
|
203
|
+
void NonNullType::accept(visitor::AstVisitor *visitor) const {
|
204
|
+
if (visitor->visitNonNullType(*this)) {
|
205
|
+
|
206
|
+
type_->accept(visitor);
|
207
|
+
}
|
208
|
+
visitor->endVisitNonNullType(*this);
|
209
|
+
}
|
210
|
+
|
211
|
+
void Name::accept(visitor::AstVisitor *visitor) const {
|
212
|
+
if (visitor->visitName(*this)) {
|
213
|
+
|
214
|
+
}
|
215
|
+
visitor->endVisitName(*this);
|
216
|
+
}
|
217
|
+
|
218
|
+
void SchemaDefinition::accept(visitor::AstVisitor *visitor) const {
|
219
|
+
if (visitor->visitSchemaDefinition(*this)) {
|
220
|
+
|
221
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
222
|
+
{ for (const auto &x : *operationTypes_) { x->accept(visitor); } }
|
223
|
+
}
|
224
|
+
visitor->endVisitSchemaDefinition(*this);
|
225
|
+
}
|
226
|
+
|
227
|
+
void OperationTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
228
|
+
if (visitor->visitOperationTypeDefinition(*this)) {
|
229
|
+
|
230
|
+
type_->accept(visitor);
|
231
|
+
}
|
232
|
+
visitor->endVisitOperationTypeDefinition(*this);
|
233
|
+
}
|
234
|
+
|
235
|
+
void ScalarTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
236
|
+
if (visitor->visitScalarTypeDefinition(*this)) {
|
237
|
+
|
238
|
+
name_->accept(visitor);
|
239
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
240
|
+
}
|
241
|
+
visitor->endVisitScalarTypeDefinition(*this);
|
242
|
+
}
|
243
|
+
|
244
|
+
void ObjectTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
245
|
+
if (visitor->visitObjectTypeDefinition(*this)) {
|
246
|
+
|
247
|
+
name_->accept(visitor);
|
248
|
+
if (interfaces_) { for (const auto &x : *interfaces_) { x->accept(visitor); } }
|
249
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
250
|
+
{ for (const auto &x : *fields_) { x->accept(visitor); } }
|
251
|
+
}
|
252
|
+
visitor->endVisitObjectTypeDefinition(*this);
|
253
|
+
}
|
254
|
+
|
255
|
+
void FieldDefinition::accept(visitor::AstVisitor *visitor) const {
|
256
|
+
if (visitor->visitFieldDefinition(*this)) {
|
257
|
+
|
258
|
+
name_->accept(visitor);
|
259
|
+
if (arguments_) { for (const auto &x : *arguments_) { x->accept(visitor); } }
|
260
|
+
type_->accept(visitor);
|
261
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
262
|
+
}
|
263
|
+
visitor->endVisitFieldDefinition(*this);
|
264
|
+
}
|
265
|
+
|
266
|
+
void InputValueDefinition::accept(visitor::AstVisitor *visitor) const {
|
267
|
+
if (visitor->visitInputValueDefinition(*this)) {
|
268
|
+
|
269
|
+
name_->accept(visitor);
|
270
|
+
type_->accept(visitor);
|
271
|
+
if (defaultValue_) { defaultValue_->accept(visitor); }
|
272
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
273
|
+
}
|
274
|
+
visitor->endVisitInputValueDefinition(*this);
|
275
|
+
}
|
276
|
+
|
277
|
+
void InterfaceTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
278
|
+
if (visitor->visitInterfaceTypeDefinition(*this)) {
|
279
|
+
|
280
|
+
name_->accept(visitor);
|
281
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
282
|
+
{ for (const auto &x : *fields_) { x->accept(visitor); } }
|
283
|
+
}
|
284
|
+
visitor->endVisitInterfaceTypeDefinition(*this);
|
285
|
+
}
|
286
|
+
|
287
|
+
void UnionTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
288
|
+
if (visitor->visitUnionTypeDefinition(*this)) {
|
289
|
+
|
290
|
+
name_->accept(visitor);
|
291
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
292
|
+
{ for (const auto &x : *types_) { x->accept(visitor); } }
|
293
|
+
}
|
294
|
+
visitor->endVisitUnionTypeDefinition(*this);
|
295
|
+
}
|
296
|
+
|
297
|
+
void EnumTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
298
|
+
if (visitor->visitEnumTypeDefinition(*this)) {
|
299
|
+
|
300
|
+
name_->accept(visitor);
|
301
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
302
|
+
{ for (const auto &x : *values_) { x->accept(visitor); } }
|
303
|
+
}
|
304
|
+
visitor->endVisitEnumTypeDefinition(*this);
|
305
|
+
}
|
306
|
+
|
307
|
+
void EnumValueDefinition::accept(visitor::AstVisitor *visitor) const {
|
308
|
+
if (visitor->visitEnumValueDefinition(*this)) {
|
309
|
+
|
310
|
+
name_->accept(visitor);
|
311
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
312
|
+
}
|
313
|
+
visitor->endVisitEnumValueDefinition(*this);
|
314
|
+
}
|
315
|
+
|
316
|
+
void InputObjectTypeDefinition::accept(visitor::AstVisitor *visitor) const {
|
317
|
+
if (visitor->visitInputObjectTypeDefinition(*this)) {
|
318
|
+
|
319
|
+
name_->accept(visitor);
|
320
|
+
if (directives_) { for (const auto &x : *directives_) { x->accept(visitor); } }
|
321
|
+
{ for (const auto &x : *fields_) { x->accept(visitor); } }
|
322
|
+
}
|
323
|
+
visitor->endVisitInputObjectTypeDefinition(*this);
|
324
|
+
}
|
325
|
+
|
326
|
+
void TypeExtensionDefinition::accept(visitor::AstVisitor *visitor) const {
|
327
|
+
if (visitor->visitTypeExtensionDefinition(*this)) {
|
328
|
+
|
329
|
+
definition_->accept(visitor);
|
330
|
+
}
|
331
|
+
visitor->endVisitTypeExtensionDefinition(*this);
|
332
|
+
}
|
333
|
+
|
334
|
+
void DirectiveDefinition::accept(visitor::AstVisitor *visitor) const {
|
335
|
+
if (visitor->visitDirectiveDefinition(*this)) {
|
336
|
+
|
337
|
+
name_->accept(visitor);
|
338
|
+
if (arguments_) { for (const auto &x : *arguments_) { x->accept(visitor); } }
|
339
|
+
{ for (const auto &x : *locations_) { x->accept(visitor); } }
|
340
|
+
}
|
341
|
+
visitor->endVisitDirectiveDefinition(*this);
|
342
|
+
}
|
343
|
+
|
344
|
+
} // namespace ast
|
345
|
+
} // namespace graphql
|
346
|
+
} // namespace facebook
|