rails-graphql 0.2.1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/console.rb +18 -0
- data/ext/extconf.h +3 -0
- data/ext/extconf.rb +1 -54
- data/ext/gql_parser.c +631 -0
- data/ext/gql_parser.h +21 -0
- data/ext/shared.c +477 -0
- data/ext/shared.h +177 -0
- data/lib/generators/graphql/channel_generator.rb +27 -0
- data/lib/generators/graphql/controller_generator.rb +9 -4
- data/lib/generators/graphql/install_generator.rb +49 -0
- data/lib/generators/graphql/schema_generator.rb +9 -4
- data/lib/generators/graphql/templates/channel.erb +7 -0
- data/lib/generators/graphql/templates/config.rb +97 -0
- data/lib/generators/graphql/templates/controller.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +5 -3
- data/lib/gql_parser.so +0 -0
- data/lib/rails/graphql/adapters/mysql_adapter.rb +59 -0
- data/lib/rails/graphql/adapters/pg_adapter.rb +25 -22
- data/lib/rails/graphql/adapters/sqlite_adapter.rb +17 -14
- data/lib/rails/graphql/alternative/field_set.rb +48 -0
- data/lib/rails/graphql/alternative/mutation.rb +17 -0
- data/lib/rails/graphql/alternative/query.rb +98 -0
- data/lib/rails/graphql/alternative/subscription.rb +18 -0
- data/lib/rails/graphql/alternative.rb +20 -0
- data/lib/rails/graphql/argument.rb +25 -26
- data/lib/rails/graphql/callback.rb +30 -14
- data/lib/rails/graphql/collectors/hash_collector.rb +26 -7
- data/lib/rails/graphql/collectors/idented_collector.rb +10 -7
- data/lib/rails/graphql/collectors/json_collector.rb +43 -17
- data/lib/rails/graphql/collectors.rb +4 -4
- data/lib/rails/graphql/config.rb +154 -23
- data/lib/rails/graphql/directive/cached_directive.rb +33 -0
- data/lib/rails/graphql/directive/deprecated_directive.rb +10 -10
- data/lib/rails/graphql/directive/include_directive.rb +4 -4
- data/lib/rails/graphql/directive/skip_directive.rb +4 -4
- data/lib/rails/graphql/directive/specified_by_directive.rb +24 -0
- data/lib/rails/graphql/directive.rb +134 -73
- data/lib/rails/graphql/errors.rb +33 -4
- data/lib/rails/graphql/event.rb +21 -9
- data/lib/rails/graphql/field/authorized_field.rb +17 -6
- data/lib/rails/graphql/field/input_field.rb +8 -12
- data/lib/rails/graphql/field/mutation_field.rb +43 -9
- data/lib/rails/graphql/field/output_field.rb +112 -12
- data/lib/rails/graphql/field/proxied_field.rb +35 -26
- data/lib/rails/graphql/field/resolved_field.rb +27 -25
- data/lib/rails/graphql/field/scoped_config.rb +10 -4
- data/lib/rails/graphql/field/subscription_field.rb +123 -0
- data/lib/rails/graphql/field/typed_field.rb +69 -24
- data/lib/rails/graphql/field.rb +89 -74
- data/lib/rails/graphql/global_id.rb +89 -0
- data/lib/rails/graphql/helpers/attribute_delegator.rb +5 -5
- data/lib/rails/graphql/helpers/inherited_collection/array.rb +51 -0
- data/lib/rails/graphql/helpers/inherited_collection/base.rb +45 -0
- data/lib/rails/graphql/helpers/inherited_collection/hash.rb +88 -0
- data/lib/rails/graphql/helpers/inherited_collection.rb +25 -76
- data/lib/rails/graphql/helpers/instantiable.rb +15 -0
- data/lib/rails/graphql/helpers/leaf_from_ar.rb +7 -7
- data/lib/rails/graphql/helpers/registerable.rb +44 -62
- data/lib/rails/graphql/helpers/unregisterable.rb +16 -0
- data/lib/rails/graphql/helpers/with_arguments.rb +33 -28
- data/lib/rails/graphql/helpers/with_assignment.rb +6 -6
- data/lib/rails/graphql/helpers/with_callbacks.rb +28 -11
- data/lib/rails/graphql/helpers/with_description.rb +73 -0
- data/lib/rails/graphql/helpers/with_directives.rb +58 -30
- data/lib/rails/graphql/helpers/with_events.rb +22 -23
- data/lib/rails/graphql/helpers/with_fields.rb +86 -26
- data/lib/rails/graphql/helpers/with_global_id.rb +22 -0
- data/lib/rails/graphql/helpers/with_name.rb +44 -0
- data/lib/rails/graphql/helpers/with_namespace.rb +7 -4
- data/lib/rails/graphql/helpers/with_owner.rb +8 -7
- data/lib/rails/graphql/helpers/with_schema_fields.rb +162 -56
- data/lib/rails/graphql/helpers/with_validator.rb +9 -9
- data/lib/rails/graphql/helpers.rb +10 -3
- data/lib/rails/graphql/introspection.rb +43 -36
- data/lib/rails/graphql/railtie.rb +89 -33
- data/lib/rails/graphql/railties/app/base_channel.rb +10 -0
- data/lib/rails/graphql/railties/app/base_controller.rb +12 -0
- data/lib/rails/graphql/railties/app/views/_cable.js.erb +56 -0
- data/lib/rails/graphql/railties/app/views/_fetch.js.erb +20 -0
- data/lib/rails/graphql/railties/app/views/graphiql.html.erb +101 -0
- data/lib/rails/graphql/railties/base_generator.rb +5 -17
- data/lib/rails/graphql/railties/channel.rb +157 -0
- data/lib/rails/graphql/railties/controller.rb +91 -25
- data/lib/rails/graphql/railties/controller_runtime.rb +5 -5
- data/lib/rails/graphql/railties/log_subscriber.rb +81 -14
- data/lib/rails/graphql/request/arguments.rb +26 -50
- data/lib/rails/graphql/request/backtrace.rb +212 -0
- data/lib/rails/graphql/request/component/field.rb +98 -70
- data/lib/rails/graphql/request/component/fragment.rb +80 -26
- data/lib/rails/graphql/request/component/operation/subscription.rb +162 -4
- data/lib/rails/graphql/request/component/operation.rb +73 -34
- data/lib/rails/graphql/request/component/spread.rb +79 -27
- data/lib/rails/graphql/request/component/typename.rb +28 -13
- data/lib/rails/graphql/request/component.rb +77 -36
- data/lib/rails/graphql/request/context.rb +19 -9
- data/lib/rails/graphql/request/errors.rb +16 -6
- data/lib/rails/graphql/request/event.rb +23 -8
- data/lib/rails/graphql/request/helpers/directives.rb +69 -27
- data/lib/rails/graphql/request/helpers/selection_set.rb +57 -25
- data/lib/rails/graphql/request/helpers/value_writers.rb +24 -19
- data/lib/rails/graphql/request/prepared_data.rb +100 -0
- data/lib/rails/graphql/request/steps/authorizable.rb +24 -14
- data/lib/rails/graphql/request/steps/organizable.rb +111 -49
- data/lib/rails/graphql/request/steps/{prepareable.rb → preparable.rb} +21 -8
- data/lib/rails/graphql/request/steps/{resolveable.rb → resolvable.rb} +16 -7
- data/lib/rails/graphql/request/strategy/cached_strategy.rb +64 -0
- data/lib/rails/graphql/request/strategy/dynamic_instance.rb +6 -6
- data/lib/rails/graphql/request/strategy/multi_query_strategy.rb +6 -13
- data/lib/rails/graphql/request/strategy/sequenced_strategy.rb +9 -9
- data/lib/rails/graphql/request/strategy.rb +147 -77
- data/lib/rails/graphql/request/subscription.rb +82 -0
- data/lib/rails/graphql/request.rb +353 -104
- data/lib/rails/graphql/schema.rb +251 -106
- data/lib/rails/graphql/shortcuts.rb +33 -8
- data/lib/rails/graphql/source/active_record/builders.rb +64 -51
- data/lib/rails/graphql/source/active_record_source.rb +158 -82
- data/lib/rails/graphql/source/base.rb +83 -0
- data/lib/rails/graphql/source/builder.rb +115 -0
- data/lib/rails/graphql/source/scoped_arguments.rb +39 -21
- data/lib/rails/graphql/source.rb +90 -228
- data/lib/rails/graphql/subscription/provider/action_cable.rb +113 -0
- data/lib/rails/graphql/subscription/provider/base.rb +192 -0
- data/lib/rails/graphql/subscription/provider.rb +18 -0
- data/lib/rails/graphql/subscription/store/base.rb +141 -0
- data/lib/rails/graphql/subscription/store/memory.rb +136 -0
- data/lib/rails/graphql/subscription/store.rb +19 -0
- data/lib/rails/graphql/subscription.rb +17 -0
- data/lib/rails/graphql/to_gql.rb +29 -32
- data/lib/rails/graphql/type/creator.rb +196 -0
- data/lib/rails/graphql/type/enum/directive_location_enum.rb +11 -11
- data/lib/rails/graphql/type/enum/type_kind_enum.rb +3 -3
- data/lib/rails/graphql/type/enum.rb +44 -50
- data/lib/rails/graphql/type/input.rb +92 -25
- data/lib/rails/graphql/type/interface.rb +29 -28
- data/lib/rails/graphql/type/object/directive_object.rb +10 -9
- data/lib/rails/graphql/type/object/enum_value_object.rb +3 -3
- data/lib/rails/graphql/type/object/field_object.rb +24 -6
- data/lib/rails/graphql/type/object/input_value_object.rb +6 -7
- data/lib/rails/graphql/type/object/schema_object.rb +5 -8
- data/lib/rails/graphql/type/object/type_object.rb +62 -25
- data/lib/rails/graphql/type/object.rb +34 -26
- data/lib/rails/graphql/type/scalar/any_scalar.rb +30 -0
- data/lib/rails/graphql/type/scalar/bigint_scalar.rb +5 -5
- data/lib/rails/graphql/type/scalar/binary_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/boolean_scalar.rb +8 -8
- data/lib/rails/graphql/type/scalar/date_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/date_time_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/decimal_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/float_scalar.rb +5 -5
- data/lib/rails/graphql/type/scalar/id_scalar.rb +6 -5
- data/lib/rails/graphql/type/scalar/int_scalar.rb +6 -5
- data/lib/rails/graphql/type/scalar/json_scalar.rb +41 -0
- data/lib/rails/graphql/type/scalar/string_scalar.rb +18 -4
- data/lib/rails/graphql/type/scalar/time_scalar.rb +8 -6
- data/lib/rails/graphql/type/scalar.rb +26 -23
- data/lib/rails/graphql/type/union.rb +21 -18
- data/lib/rails/graphql/type.rb +43 -26
- data/lib/rails/graphql/type_map.rb +268 -165
- data/lib/rails/graphql/uri.rb +167 -0
- data/lib/rails/graphql/version.rb +19 -3
- data/lib/rails/graphql.rake +3 -0
- data/lib/rails/graphql.rb +91 -56
- data/lib/rails-graphql.rb +1 -1
- data/test/assets/en.yml +29 -0
- data/test/assets/introspection-mem.txt +1 -1
- data/test/assets/introspection.gql +2 -0
- data/test/assets/mem.gql +86 -99
- data/test/assets/mysql.gql +406 -0
- data/test/assets/sqlite.gql +96 -73
- data/test/assets/translate.gql +346 -0
- data/test/config.rb +19 -8
- data/test/graphql/schema_test.rb +14 -50
- data/test/graphql/source_test.rb +8 -85
- data/test/graphql/type/enum_test.rb +207 -203
- data/test/graphql/type/input_test.rb +14 -9
- data/test/graphql/type/interface_test.rb +12 -9
- data/test/graphql/type/object_test.rb +8 -2
- data/test/graphql/type/scalar/any_scalar_test.rb +38 -0
- data/test/graphql/type/scalar/boolean_scalar_test.rb +6 -3
- data/test/graphql/type/scalar/json_scalar_test.rb +23 -0
- data/test/graphql/type_map_test.rb +63 -81
- data/test/graphql/type_test.rb +0 -19
- data/test/graphql_test.rb +1 -1
- data/test/integration/{authorization/authorization_test.rb → authorization_test.rb} +40 -14
- data/test/integration/config.rb +36 -3
- data/test/integration/customization_test.rb +39 -0
- data/test/integration/global_id_test.rb +99 -0
- data/test/integration/memory/star_wars_introspection_test.rb +24 -16
- data/test/integration/memory/star_wars_query_test.rb +54 -3
- data/test/integration/memory/star_wars_validation_test.rb +3 -3
- data/test/integration/mysql/star_wars_introspection_test.rb +25 -0
- data/test/integration/persisted_query_test.rb +87 -0
- data/test/integration/resolver_precedence_test.rb +154 -0
- data/test/integration/schemas/memory.rb +24 -10
- data/test/integration/schemas/mysql.rb +62 -0
- data/test/integration/schemas/sqlite.rb +21 -12
- data/test/integration/sqlite/star_wars_global_id_test.rb +89 -0
- data/test/integration/sqlite/star_wars_introspection_test.rb +10 -0
- data/test/integration/sqlite/star_wars_query_test.rb +14 -1
- data/test/integration/translate_test.rb +73 -0
- data/test/test_ext.rb +16 -13
- metadata +125 -161
- data/ext/depend +0 -3
- data/ext/graphqlparser/Ast.cpp +0 -346
- data/ext/graphqlparser/Ast.h +0 -1214
- data/ext/graphqlparser/AstNode.h +0 -36
- data/ext/graphqlparser/AstVisitor.h +0 -137
- data/ext/graphqlparser/GraphQLParser.cpp +0 -76
- data/ext/graphqlparser/GraphQLParser.h +0 -55
- data/ext/graphqlparser/JsonVisitor.cpp +0 -161
- data/ext/graphqlparser/JsonVisitor.cpp.inc +0 -456
- data/ext/graphqlparser/JsonVisitor.h +0 -121
- data/ext/graphqlparser/JsonVisitor.h.inc +0 -110
- data/ext/graphqlparser/VERSION +0 -1
- data/ext/graphqlparser/c/GraphQLAst.cpp +0 -324
- data/ext/graphqlparser/c/GraphQLAst.h +0 -180
- data/ext/graphqlparser/c/GraphQLAstForEachConcreteType.h +0 -44
- data/ext/graphqlparser/c/GraphQLAstNode.cpp +0 -25
- data/ext/graphqlparser/c/GraphQLAstNode.h +0 -33
- data/ext/graphqlparser/c/GraphQLAstToJSON.cpp +0 -21
- data/ext/graphqlparser/c/GraphQLAstToJSON.h +0 -24
- data/ext/graphqlparser/c/GraphQLAstVisitor.cpp +0 -55
- data/ext/graphqlparser/c/GraphQLAstVisitor.h +0 -53
- data/ext/graphqlparser/c/GraphQLParser.cpp +0 -35
- data/ext/graphqlparser/c/GraphQLParser.h +0 -54
- data/ext/graphqlparser/dump_json_ast.cpp +0 -48
- data/ext/graphqlparser/lexer.lpp +0 -324
- data/ext/graphqlparser/parser.ypp +0 -693
- data/ext/graphqlparser/parsergen/lexer.cpp +0 -2633
- data/ext/graphqlparser/parsergen/lexer.h +0 -528
- data/ext/graphqlparser/parsergen/location.hh +0 -189
- data/ext/graphqlparser/parsergen/parser.tab.cpp +0 -3300
- data/ext/graphqlparser/parsergen/parser.tab.hpp +0 -646
- data/ext/graphqlparser/parsergen/position.hh +0 -179
- data/ext/graphqlparser/parsergen/stack.hh +0 -156
- data/ext/graphqlparser/syntaxdefs.h +0 -19
- data/ext/libgraphqlparser/AstNode.h +0 -36
- data/ext/libgraphqlparser/CMakeLists.txt +0 -148
- data/ext/libgraphqlparser/CONTRIBUTING.md +0 -23
- data/ext/libgraphqlparser/GraphQLParser.cpp +0 -76
- data/ext/libgraphqlparser/GraphQLParser.h +0 -55
- data/ext/libgraphqlparser/JsonVisitor.cpp +0 -161
- data/ext/libgraphqlparser/JsonVisitor.h +0 -121
- data/ext/libgraphqlparser/LICENSE +0 -22
- data/ext/libgraphqlparser/README.clang-tidy +0 -7
- data/ext/libgraphqlparser/README.md +0 -84
- data/ext/libgraphqlparser/ast/ast.ast +0 -203
- data/ext/libgraphqlparser/ast/ast.py +0 -61
- data/ext/libgraphqlparser/ast/c.py +0 -100
- data/ext/libgraphqlparser/ast/c.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_impl.py +0 -61
- data/ext/libgraphqlparser/ast/c_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.py +0 -39
- data/ext/libgraphqlparser/ast/c_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/casing.py +0 -26
- data/ext/libgraphqlparser/ast/casing.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx.py +0 -197
- data/ext/libgraphqlparser/ast/cxx.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_impl.py +0 -61
- data/ext/libgraphqlparser/ast/cxx_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.py +0 -42
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.py +0 -80
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.py +0 -64
- data/ext/libgraphqlparser/ast/cxx_visitor.pyc +0 -0
- data/ext/libgraphqlparser/ast/js.py +0 -65
- data/ext/libgraphqlparser/ast/license.py +0 -10
- data/ext/libgraphqlparser/ast/license.pyc +0 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.cpp +0 -25
- data/ext/libgraphqlparser/c/GraphQLAstNode.h +0 -33
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.cpp +0 -21
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.h +0 -24
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.cpp +0 -55
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.h +0 -53
- data/ext/libgraphqlparser/c/GraphQLParser.cpp +0 -35
- data/ext/libgraphqlparser/c/GraphQLParser.h +0 -54
- data/ext/libgraphqlparser/clang-tidy-all.sh +0 -3
- data/ext/libgraphqlparser/cmake/version.cmake +0 -16
- data/ext/libgraphqlparser/dump_json_ast.cpp +0 -48
- data/ext/libgraphqlparser/go/README.md +0 -20
- data/ext/libgraphqlparser/go/callbacks.go +0 -18
- data/ext/libgraphqlparser/go/gotest.go +0 -64
- data/ext/libgraphqlparser/lexer.lpp +0 -324
- data/ext/libgraphqlparser/libgraphqlparser.pc.in +0 -11
- data/ext/libgraphqlparser/parser.ypp +0 -693
- data/ext/libgraphqlparser/parsergen/lexer.cpp +0 -2633
- data/ext/libgraphqlparser/parsergen/lexer.h +0 -528
- data/ext/libgraphqlparser/parsergen/location.hh +0 -189
- data/ext/libgraphqlparser/parsergen/parser.tab.cpp +0 -3300
- data/ext/libgraphqlparser/parsergen/parser.tab.hpp +0 -646
- data/ext/libgraphqlparser/parsergen/position.hh +0 -179
- data/ext/libgraphqlparser/parsergen/stack.hh +0 -156
- data/ext/libgraphqlparser/python/CMakeLists.txt +0 -14
- data/ext/libgraphqlparser/python/README.md +0 -5
- data/ext/libgraphqlparser/python/example.py +0 -31
- data/ext/libgraphqlparser/syntaxdefs.h +0 -19
- data/ext/libgraphqlparser/test/BuildCAPI.c +0 -5
- data/ext/libgraphqlparser/test/CMakeLists.txt +0 -25
- data/ext/libgraphqlparser/test/JsonVisitorTests.cpp +0 -28
- data/ext/libgraphqlparser/test/ParserTests.cpp +0 -352
- data/ext/libgraphqlparser/test/kitchen-sink.graphql +0 -59
- data/ext/libgraphqlparser/test/kitchen-sink.json +0 -1
- data/ext/libgraphqlparser/test/schema-kitchen-sink.graphql +0 -78
- data/ext/libgraphqlparser/test/schema-kitchen-sink.json +0 -1
- data/ext/libgraphqlparser/test/valgrind.supp +0 -33
- data/ext/version.cpp +0 -21
- data/lib/graphqlparser.so +0 -0
- data/lib/rails/graphql/native/functions.rb +0 -38
- data/lib/rails/graphql/native/location.rb +0 -41
- data/lib/rails/graphql/native/pointers.rb +0 -23
- data/lib/rails/graphql/native/visitor.rb +0 -349
- data/lib/rails/graphql/native.rb +0 -56
- data/test/integration/schemas/authorization.rb +0 -12
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Rails
|
4
|
-
module GraphQL
|
5
|
-
class Request
|
3
|
+
module Rails
|
4
|
+
module GraphQL
|
5
|
+
class Request
|
6
6
|
# = GraphQL Request Component Operation
|
7
7
|
#
|
8
8
|
# This class holds information about a given operation. This will guide
|
@@ -16,9 +16,9 @@ module Rails # :nodoc:
|
|
16
16
|
class << self
|
17
17
|
alias type kind
|
18
18
|
|
19
|
-
# Helper method to initialize an operation given the
|
20
|
-
def build(request, node
|
21
|
-
request.build(const_get(
|
19
|
+
# Helper method to initialize an operation given the node
|
20
|
+
def build(request, node)
|
21
|
+
request.build(const_get(node.type.to_s.classify), request, node)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Rewrite the kind to always return +:operation+
|
@@ -49,6 +49,7 @@ module Rails # :nodoc:
|
|
49
49
|
autoload :Subscription
|
50
50
|
|
51
51
|
delegate :type, :query?, :mutation?, :subscription?, to: :class
|
52
|
+
delegate :schema, to: :strategy
|
52
53
|
|
53
54
|
attr_reader :name, :variables, :arguments, :request
|
54
55
|
|
@@ -57,11 +58,11 @@ module Rails # :nodoc:
|
|
57
58
|
alias vars variables
|
58
59
|
alias all_arguments arguments
|
59
60
|
|
60
|
-
def initialize(request, node
|
61
|
-
@name =
|
61
|
+
def initialize(request, node)
|
62
|
+
@name = node[1]
|
62
63
|
@request = request
|
63
64
|
|
64
|
-
super(node
|
65
|
+
super(node)
|
65
66
|
|
66
67
|
check_invalid_operation!
|
67
68
|
end
|
@@ -72,6 +73,13 @@ module Rails # :nodoc:
|
|
72
73
|
schema.fields_for(type)
|
73
74
|
end
|
74
75
|
|
76
|
+
# Allow accessing the fake type form the schema. It's used for
|
77
|
+
# inline spreads without a specified type
|
78
|
+
def type_klass
|
79
|
+
return @type_klass if defined?(@type_klass)
|
80
|
+
@type_klass = schema.public_send("#{type}_type")
|
81
|
+
end
|
82
|
+
|
75
83
|
# The typename is always based on the fake name used for the set of
|
76
84
|
# schema fields
|
77
85
|
def typename
|
@@ -88,22 +96,48 @@ module Rails # :nodoc:
|
|
88
96
|
response.safe_add(name, nil) if stacked_selection?
|
89
97
|
end
|
90
98
|
|
91
|
-
# Stores all the used
|
99
|
+
# Stores all the used variables to report not used ones
|
92
100
|
def used_variables
|
93
101
|
@used_variables ||= Set.new
|
94
102
|
end
|
95
103
|
|
104
|
+
# Stores all the used fragments
|
105
|
+
def used_fragments
|
106
|
+
@used_fragments ||= Set.new
|
107
|
+
end
|
108
|
+
|
96
109
|
# A fast way to access the correct display name for log or errors
|
97
110
|
def log_source
|
98
|
-
@log_source ||= name.blank? ? type : "#{name} #{type}"
|
111
|
+
@log_source ||= name.blank? ? type : +"#{name} #{type}"
|
112
|
+
end
|
113
|
+
|
114
|
+
# The hash of operations must take into consideration the used fragments
|
115
|
+
def hash
|
116
|
+
return super unless defined?(@used_fragments)
|
117
|
+
|
118
|
+
super ^ used_fragments.reduce(0) do |value, fragment|
|
119
|
+
value ^ request.fragments[fragment].hash
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Build the cache object
|
124
|
+
def cache_dump
|
125
|
+
super.merge(type: self.class)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Organize from cache data
|
129
|
+
def cache_load(data)
|
130
|
+
@name = data[:node][1]
|
131
|
+
|
132
|
+
super
|
99
133
|
end
|
100
134
|
|
101
135
|
protected
|
102
136
|
|
103
137
|
# Trigger an specific event with the +type+ of the operation
|
104
138
|
def organize
|
139
|
+
trigger_event(type)
|
105
140
|
organize_then do
|
106
|
-
trigger_event(type)
|
107
141
|
yield if block_given?
|
108
142
|
organize_fields
|
109
143
|
report_unused_variables
|
@@ -113,15 +147,15 @@ module Rails # :nodoc:
|
|
113
147
|
# Perform the organization step
|
114
148
|
def organize_then(&block)
|
115
149
|
super(block) do
|
116
|
-
parse_variables
|
117
|
-
parse_directives(type)
|
118
|
-
parse_selection
|
150
|
+
parse_variables(@node[2])
|
151
|
+
parse_directives(@node[3], type)
|
152
|
+
parse_selection(@node[4])
|
119
153
|
end
|
120
154
|
end
|
121
155
|
|
122
156
|
# Resolve all the fields
|
123
|
-
def
|
124
|
-
|
157
|
+
def resolve_then(&block)
|
158
|
+
super(block) { resolve_fields }
|
125
159
|
end
|
126
160
|
|
127
161
|
# Don't stack over response when the operation doesn't have a name
|
@@ -133,42 +167,47 @@ module Rails # :nodoc:
|
|
133
167
|
|
134
168
|
# Name used for debug purposes
|
135
169
|
def display_name
|
136
|
-
@display_name ||= "#{type.to_s.titlecase} #{name.presence || '__default__'}"
|
170
|
+
@display_name ||= +"#{type.to_s.titlecase} #{name.presence || '__default__'}"
|
137
171
|
end
|
138
172
|
|
139
|
-
# Add an error for each not used variable
|
173
|
+
# Add an error for each not used variable
|
140
174
|
def report_unused_variables
|
175
|
+
return if arguments.nil?
|
176
|
+
|
141
177
|
(arguments.keys - used_variables.to_a).each do |key|
|
142
178
|
argument = arguments[key]
|
143
|
-
request.report_node_error(
|
144
|
-
|
179
|
+
request.report_node_error((+<<~MSG).squish, argument.node)
|
180
|
+
Variable $#{argument.gql_name} was provided to #{log_source} but not used.
|
145
181
|
MSG
|
146
182
|
end
|
147
183
|
|
148
|
-
|
184
|
+
# Report all used variables to the request for greater scope
|
185
|
+
request.instance_variable_get(:@used_variables).merge(arguments.keys)
|
186
|
+
|
187
|
+
# Clear anything that is not necessary anymore
|
149
188
|
@used_variables = nil
|
150
189
|
end
|
151
190
|
|
152
191
|
# If there is another operation with the same name already defined,
|
153
192
|
# raise an error. If an anonymous was started, then any other
|
154
|
-
#
|
193
|
+
# operations is invalid.
|
155
194
|
def check_invalid_operation!
|
156
|
-
|
157
|
-
|
195
|
+
other = request.document[0].find do |other|
|
196
|
+
other != @node && name == other[1]
|
197
|
+
end
|
198
|
+
|
199
|
+
return if other.nil?
|
200
|
+
invalidate!
|
158
201
|
|
159
|
-
|
202
|
+
if name.nil?
|
203
|
+
request.report_node_error((+<<~MSG).squish, self)
|
160
204
|
Unable to process the operation #{display_name} when the document
|
161
205
|
contain multiple anonymous operations.
|
162
206
|
MSG
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
other_node = request.operations[name].instance_variable_get(:@node)
|
167
|
-
location = GraphQL::Native.get_location(other_node)
|
168
|
-
|
169
|
-
request.report_node_error(<<~MSG.squish, @node)
|
207
|
+
else
|
208
|
+
request.report_node_error((+<<~MSG).squish, self)
|
170
209
|
Duplicated operation named "#{name}" defined on
|
171
|
-
line #{
|
210
|
+
line #{other.begin_line}:#{other.begin_column}.
|
172
211
|
MSG
|
173
212
|
end
|
174
213
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Rails
|
4
|
-
module GraphQL
|
5
|
-
class Request
|
3
|
+
module Rails
|
4
|
+
module GraphQL
|
5
|
+
class Request
|
6
6
|
# = GraphQL Request Component Spread
|
7
7
|
#
|
8
8
|
# This class holds information about a given spread that should be
|
@@ -11,20 +11,18 @@ module Rails # :nodoc:
|
|
11
11
|
include SelectionSet
|
12
12
|
include Directives
|
13
13
|
|
14
|
-
delegate :operation, :typename, to: :parent
|
14
|
+
delegate :operation, :typename, :request, to: :parent
|
15
15
|
delegate :variables, to: :operation
|
16
16
|
|
17
|
-
|
17
|
+
attr_reader :name, :parent, :fragment, :current_object, :type_klass
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
def initialize(parent, node, data)
|
19
|
+
def initialize(parent, node)
|
22
20
|
@parent = parent
|
23
21
|
|
24
|
-
@name =
|
25
|
-
@inline =
|
22
|
+
@name = node[0]
|
23
|
+
@inline = name.nil?
|
26
24
|
|
27
|
-
super(node
|
25
|
+
super(node)
|
28
26
|
end
|
29
27
|
|
30
28
|
# Check if the object is an inline spread
|
@@ -32,9 +30,14 @@ module Rails # :nodoc:
|
|
32
30
|
@inline.present?
|
33
31
|
end
|
34
32
|
|
33
|
+
# Check if all the sub fields or the fragment is broadcastable
|
34
|
+
def broadcastable?
|
35
|
+
inline? ? selection.each_value.all?(&:broadcastable?) : fragment.broadcastable?
|
36
|
+
end
|
37
|
+
|
35
38
|
# Redirect to the fragment or check the inline type before resolving
|
36
39
|
def resolve_with!(object)
|
37
|
-
return if
|
40
|
+
return if unresolvable?
|
38
41
|
|
39
42
|
@current_object = object
|
40
43
|
resolve!
|
@@ -42,6 +45,25 @@ module Rails # :nodoc:
|
|
42
45
|
@current_object = nil
|
43
46
|
end
|
44
47
|
|
48
|
+
# Build the cache object
|
49
|
+
def cache_dump
|
50
|
+
inline? ? super.merge(type_klass: all_to_gid(type_klass)) : super
|
51
|
+
end
|
52
|
+
|
53
|
+
# Organize from cache data
|
54
|
+
def cache_load(data)
|
55
|
+
@name = data[:node][0]
|
56
|
+
@inline = name.nil?
|
57
|
+
|
58
|
+
if inline?
|
59
|
+
@type_klass = all_from_gid(data[:type_klass])
|
60
|
+
else
|
61
|
+
collect_fragment
|
62
|
+
end
|
63
|
+
|
64
|
+
super
|
65
|
+
end
|
66
|
+
|
45
67
|
protected
|
46
68
|
|
47
69
|
# Spread always resolve inline selection unstacked on response,
|
@@ -51,13 +73,13 @@ module Rails # :nodoc:
|
|
51
73
|
end
|
52
74
|
|
53
75
|
# Just provide the correct location for directives
|
54
|
-
def parse_directives
|
55
|
-
super(inline? ? :inline_fragment : :fragment_spread)
|
76
|
+
def parse_directives(nodes)
|
77
|
+
super(nodes, (inline? ? :inline_fragment : :fragment_spread))
|
56
78
|
end
|
57
79
|
|
58
80
|
# Scope the arguments whenever stacked within a spread
|
59
81
|
def stacked(*)
|
60
|
-
|
82
|
+
Arguments.scoped(operation) { super }
|
61
83
|
end
|
62
84
|
|
63
85
|
# Normal mode of the organize step
|
@@ -66,7 +88,6 @@ module Rails # :nodoc:
|
|
66
88
|
def organize
|
67
89
|
inline? ? organize_then { organize_fields } : organize_then do
|
68
90
|
run_on_fragment(:organize!)
|
69
|
-
# Ensure necessary variables
|
70
91
|
end
|
71
92
|
end
|
72
93
|
|
@@ -74,33 +95,42 @@ module Rails # :nodoc:
|
|
74
95
|
def organize_then(&block)
|
75
96
|
super(block) do
|
76
97
|
if inline?
|
77
|
-
@type_klass = find_type!(
|
78
|
-
|
98
|
+
@type_klass = @node[1].nil? ? parent.type_klass : find_type!(@node[1])
|
99
|
+
parse_directives(@node[2])
|
100
|
+
parse_selection(@node[3])
|
79
101
|
else
|
80
|
-
@
|
81
|
-
|
102
|
+
parse_directives(@node[2])
|
103
|
+
@fragment = collect_fragment
|
104
|
+
raise ArgumentError, (+<<~MSG).squish if @fragment.nil?
|
82
105
|
The "#{name}" fragment is not defined in this request.
|
83
106
|
MSG
|
84
107
|
end
|
85
|
-
|
86
|
-
parse_directives
|
87
108
|
end
|
88
109
|
end
|
89
110
|
|
90
111
|
# Spread has a special behavior when using a fragment
|
91
112
|
def prepare
|
92
113
|
return super if inline?
|
93
|
-
|
114
|
+
catch(:fragment_prepared) do
|
115
|
+
return fragment.prepare!
|
116
|
+
end
|
117
|
+
|
118
|
+
invalidate!
|
119
|
+
raise ExecutionError, (+<<~MSG).squish
|
120
|
+
Fields inside the "#{name}" fragment tried to be prepared more than once.
|
121
|
+
This feature is not supported yet.
|
122
|
+
MSG
|
94
123
|
end
|
95
124
|
|
96
125
|
# Resolve the spread operation
|
97
126
|
def resolve
|
98
|
-
return if
|
127
|
+
return if unresolvable?
|
99
128
|
|
100
|
-
object = (defined?(@current_object) && @current_object)
|
129
|
+
object = (defined?(@current_object) && @current_object)
|
130
|
+
object ||= parent.type_klass unless parent.kind == :operation
|
101
131
|
return run_on_fragment(:resolve_with!, object) unless inline?
|
102
132
|
|
103
|
-
super if type_klass =~ object
|
133
|
+
super if (object.nil? && type_klass&.operational?) || type_klass =~ object
|
104
134
|
end
|
105
135
|
|
106
136
|
# This will just trigger the selection resolver
|
@@ -111,7 +141,29 @@ module Rails # :nodoc:
|
|
111
141
|
# Most of the things that are redirected to the fragment needs to run
|
112
142
|
# inside a arguments scoped
|
113
143
|
def run_on_fragment(method_name, *args)
|
114
|
-
|
144
|
+
Arguments.scoped(operation) { fragment.public_send(method_name, *args) }
|
145
|
+
end
|
146
|
+
|
147
|
+
# Only initialize the fragment once and only when requested for the
|
148
|
+
# first time. It also reports to the operation the used variables
|
149
|
+
# within the fragment
|
150
|
+
def collect_fragment
|
151
|
+
node = request.fragments[name]
|
152
|
+
|
153
|
+
if node.is_a?(Component::Fragment)
|
154
|
+
unless (used_variables = node.used_variables).nil?
|
155
|
+
operation.used_variables.merge(used_variables)
|
156
|
+
end
|
157
|
+
|
158
|
+
unless (used_fragments = node.used_fragments).nil?
|
159
|
+
operation.used_fragments.merge(used_fragments)
|
160
|
+
end
|
161
|
+
|
162
|
+
node
|
163
|
+
else
|
164
|
+
operation.used_fragments << name
|
165
|
+
request.fragments[name] = request.build(Component::Fragment, request, node)
|
166
|
+
end
|
115
167
|
end
|
116
168
|
end
|
117
169
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Rails
|
4
|
-
module GraphQL
|
5
|
-
class Request
|
3
|
+
module Rails
|
4
|
+
module GraphQL
|
5
|
+
class Request
|
6
6
|
# = GraphQL Request Component Typename
|
7
7
|
#
|
8
8
|
# Extra component which simulates a field that its only purpose is to
|
@@ -11,11 +11,9 @@ module Rails # :nodoc:
|
|
11
11
|
include ValueWriters
|
12
12
|
include Directives
|
13
13
|
|
14
|
-
delegate :operation, to: :parent
|
14
|
+
delegate :operation, :request, to: :parent
|
15
15
|
delegate :variables, to: :operation
|
16
16
|
|
17
|
-
parent_memoize :request
|
18
|
-
|
19
17
|
attr_reader :name, :alias_name, :parent
|
20
18
|
|
21
19
|
# Rewrite the kind to always return +:field+
|
@@ -23,13 +21,13 @@ module Rails # :nodoc:
|
|
23
21
|
:field
|
24
22
|
end
|
25
23
|
|
26
|
-
def initialize(parent, node
|
24
|
+
def initialize(parent, node)
|
27
25
|
@parent = parent
|
28
26
|
|
29
|
-
@name =
|
30
|
-
@alias_name =
|
27
|
+
@name = node[0]
|
28
|
+
@alias_name = node[1]
|
31
29
|
|
32
|
-
super(node
|
30
|
+
super(node)
|
33
31
|
end
|
34
32
|
|
35
33
|
# Set the value that the field will be resolved as
|
@@ -47,7 +45,24 @@ module Rails # :nodoc:
|
|
47
45
|
|
48
46
|
# Write the typename information
|
49
47
|
def write_value(value)
|
50
|
-
response.serialize(Type::Scalar::StringScalar, gql_name, value)
|
48
|
+
response.serialize(Type::Scalar::StringScalar, gql_name, value.itself)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Typename is always broadcastable
|
52
|
+
def broadcastable?
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
# Prepare is not necessary for this field
|
57
|
+
def prepare!
|
58
|
+
end
|
59
|
+
|
60
|
+
# Organize from cache data
|
61
|
+
def cache_load(data)
|
62
|
+
@name = data[:node][0]
|
63
|
+
@alias_name = data[:node][1]
|
64
|
+
|
65
|
+
super
|
51
66
|
end
|
52
67
|
|
53
68
|
protected
|
@@ -59,14 +74,14 @@ module Rails # :nodoc:
|
|
59
74
|
|
60
75
|
# Perform the organization step
|
61
76
|
def organize_then(&block)
|
62
|
-
super(block) { parse_directives(:field) }
|
77
|
+
super(block) { parse_directives(@node[3], :field) }
|
63
78
|
end
|
64
79
|
|
65
80
|
# Go through the right flow to write the value
|
66
81
|
def resolve_then
|
67
82
|
super do
|
68
83
|
typename = @typename || parent.typename
|
69
|
-
raise InvalidValueError,
|
84
|
+
raise InvalidValueError, (+<<~MSG).squish if typename.blank?
|
70
85
|
The #{gql_name} field value cannot be null.
|
71
86
|
MSG
|
72
87
|
|
@@ -1,80 +1,104 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Rails
|
4
|
-
module GraphQL
|
5
|
-
class Request
|
3
|
+
module Rails
|
4
|
+
module GraphQL
|
5
|
+
class Request
|
6
6
|
# = GraphQL Request Component
|
7
7
|
#
|
8
8
|
# Component is an abstraction of any possible type of object represented
|
9
9
|
# by a not of the document of a request. This class helps building
|
10
10
|
# cross-component features, like holding event listeners, setting up
|
11
|
-
#
|
11
|
+
# common initializer and providing helpers
|
12
12
|
class Component
|
13
13
|
extend ActiveSupport::Autoload
|
14
14
|
|
15
15
|
include Request::Organizable
|
16
|
-
include Request::
|
17
|
-
include Request::
|
16
|
+
include Request::Preparable
|
17
|
+
include Request::Resolvable
|
18
18
|
|
19
19
|
class << self
|
20
20
|
# Return the kind of the component
|
21
21
|
def kind
|
22
22
|
@kind ||= name.demodulize.underscore.to_sym
|
23
23
|
end
|
24
|
-
|
25
|
-
# Helper to memoize results from parent delegation
|
26
|
-
def parent_memoize(*methods)
|
27
|
-
methods.each do |method_name|
|
28
|
-
define_method(method_name) do
|
29
|
-
result = parent.public_send(method_name)
|
30
|
-
define_singleton_method(method_name) { result }
|
31
|
-
result
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
24
|
end
|
36
25
|
|
37
|
-
|
38
|
-
|
39
|
-
delegate :schema, :visitor, :response, :strategy, to: :request
|
26
|
+
delegate :visitor, :response, :strategy, to: :request
|
40
27
|
delegate :find_type!, :find_directive!, :trigger_event, to: :strategy
|
41
|
-
delegate :memo, to: :operation
|
28
|
+
delegate :memo, :schema, to: :operation
|
42
29
|
delegate :kind, to: :class
|
43
30
|
|
44
31
|
alias of_type? is_a?
|
45
32
|
|
46
33
|
eager_autoload do
|
47
34
|
autoload :Field
|
48
|
-
autoload :Fragment
|
49
35
|
autoload :Operation
|
50
|
-
autoload :Spread
|
51
|
-
autoload :Typename
|
52
36
|
end
|
53
37
|
|
54
|
-
|
38
|
+
autoload :Fragment
|
39
|
+
autoload :Spread
|
40
|
+
autoload :Typename
|
41
|
+
|
42
|
+
def initialize(node)
|
55
43
|
@node = node
|
56
|
-
@data = data
|
57
44
|
end
|
58
45
|
|
59
46
|
# Check if the component is in a invalid state
|
60
47
|
def invalid?
|
61
|
-
defined?(@invalid) && @invalid
|
48
|
+
defined?(@invalid) && @invalid.present?
|
49
|
+
end
|
50
|
+
|
51
|
+
# Check if the component is marked as skipped
|
52
|
+
def skipped?
|
53
|
+
defined?(@skipped) && @skipped
|
54
|
+
end
|
55
|
+
|
56
|
+
# Just a fancy name for invalid or skipped
|
57
|
+
def unresolvable?
|
58
|
+
invalid? || skipped?
|
62
59
|
end
|
63
60
|
|
64
61
|
# Mark the component as invalid
|
65
|
-
def invalidate!
|
66
|
-
@invalid =
|
62
|
+
def invalidate!(type = true)
|
63
|
+
@invalid = type
|
64
|
+
end
|
65
|
+
|
66
|
+
# Skip the component
|
67
|
+
def skip!
|
68
|
+
@skipped = true
|
67
69
|
end
|
68
70
|
|
69
|
-
#
|
71
|
+
# Normally, components are not assignable, only fields are
|
70
72
|
def assignable?
|
71
73
|
false
|
72
74
|
end
|
73
75
|
|
76
|
+
# Get an identifier of the component
|
77
|
+
def hash
|
78
|
+
@node.hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# Build the cache object
|
82
|
+
def cache_dump
|
83
|
+
hash = { node: @node }
|
84
|
+
hash[:invalid] = @invalid if defined?(@invalid) && @invalid != :authorization
|
85
|
+
hash[:skipped] = @skipped if defined?(@skipped) && @skipped
|
86
|
+
hash.merge!(super)
|
87
|
+
hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Organize from cache data
|
91
|
+
def cache_load(data)
|
92
|
+
@node = data[:node]
|
93
|
+
@invalid = data[:invalid] if data.key?(:invalid)
|
94
|
+
@skipped = data[:skipped] if data.key?(:skipped)
|
95
|
+
super
|
96
|
+
end
|
97
|
+
|
74
98
|
protected
|
75
99
|
|
76
100
|
# It's extremely important to have a way to access the current request
|
77
|
-
# since not all objects stores
|
101
|
+
# since not all objects stores a direct pointer to it
|
78
102
|
def request
|
79
103
|
raise NotImplementedError
|
80
104
|
end
|
@@ -86,13 +110,30 @@ module Rails # :nodoc:
|
|
86
110
|
|
87
111
|
# Run a given block and ensure to capture exceptions to set them as
|
88
112
|
# errors
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
|
113
|
+
def report_exception(error)
|
114
|
+
return if request.rescue_with_handler(error, source: self) == false
|
115
|
+
|
116
|
+
Backtrace.print(error, self, request)
|
117
|
+
|
93
118
|
stack_path = request.stack_to_path
|
94
119
|
stack_path << gql_name if respond_to?(:gql_name) && gql_name.present?
|
95
|
-
request.exception_to_error(error,
|
120
|
+
request.exception_to_error(error, self, path: stack_path, stage: strategy.stage.to_s)
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
# Properly transform values to string gid
|
126
|
+
def all_to_gid(enum)
|
127
|
+
(enum.is_a?(Enumerable) ? enum : enum.then).each do |item|
|
128
|
+
item.to_gid.to_s
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Properly recover values from gid string
|
133
|
+
def all_from_gid(enum)
|
134
|
+
(enum.is_a?(Enumerable) ? enum : enum.then).each do |item|
|
135
|
+
GraphQL::GlobalID.find(item)
|
136
|
+
end
|
96
137
|
end
|
97
138
|
end
|
98
139
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Rails
|
4
|
-
module GraphQL
|
5
|
-
class Request
|
3
|
+
module Rails
|
4
|
+
module GraphQL
|
5
|
+
class Request
|
6
6
|
# = GraphQL Request Context
|
7
7
|
#
|
8
8
|
# This class is used as context for the response while processing fields,
|
@@ -23,9 +23,14 @@ module Rails # :nodoc:
|
|
23
23
|
@stack.shift
|
24
24
|
end
|
25
25
|
|
26
|
-
#
|
27
|
-
def
|
28
|
-
@stack
|
26
|
+
# Return a duplicated version of the stack, for safety
|
27
|
+
def stack
|
28
|
+
@stack.dup
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get a value at the given +index+
|
32
|
+
def at(index)
|
33
|
+
@stack[index]
|
29
34
|
end
|
30
35
|
|
31
36
|
# Get all ancestors objects
|
@@ -33,10 +38,15 @@ module Rails # :nodoc:
|
|
33
38
|
@stack[1..-1]
|
34
39
|
end
|
35
40
|
|
36
|
-
#
|
37
|
-
|
41
|
+
# Find the parent object
|
42
|
+
def parent
|
43
|
+
at(1)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get the current value, which basically means the first item
|
47
|
+
# on the current stack
|
38
48
|
def current_value
|
39
|
-
|
49
|
+
at(0)
|
40
50
|
end
|
41
51
|
|
42
52
|
# Change the current value, either form hits or the actual value
|