bluejay 0.1.0.alpha.2-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +411 -0
  4. data/lib/bluejay/3.1/bluejay_rb.so +0 -0
  5. data/lib/bluejay/3.2/bluejay_rb.so +0 -0
  6. data/lib/bluejay/base/custom_scalar_type.rb +25 -0
  7. data/lib/bluejay/base/directive.rb +25 -0
  8. data/lib/bluejay/base/enum_type.rb +25 -0
  9. data/lib/bluejay/base/input_object_type.rb +25 -0
  10. data/lib/bluejay/base/interface_type.rb +25 -0
  11. data/lib/bluejay/base/object_type.rb +25 -0
  12. data/lib/bluejay/base/query_root.rb +25 -0
  13. data/lib/bluejay/base/schema.rb +25 -0
  14. data/lib/bluejay/base/union_type.rb +25 -0
  15. data/lib/bluejay/base.rb +11 -0
  16. data/lib/bluejay/base_input_type.rb +13 -0
  17. data/lib/bluejay/base_output_type.rb +15 -0
  18. data/lib/bluejay/builtin/directives/deprecated.rb +34 -0
  19. data/lib/bluejay/builtin/directives/include.rb +35 -0
  20. data/lib/bluejay/builtin/directives/skip.rb +35 -0
  21. data/lib/bluejay/builtin/directives/specified_by.rb +33 -0
  22. data/lib/bluejay/builtin/enum_types/directive_location.rb +44 -0
  23. data/lib/bluejay/builtin/enum_types/type_kind.rb +33 -0
  24. data/lib/bluejay/builtin/object_types/directive.rb +34 -0
  25. data/lib/bluejay/builtin/object_types/enum_value.rb +33 -0
  26. data/lib/bluejay/builtin/object_types/field.rb +35 -0
  27. data/lib/bluejay/builtin/object_types/input_value.rb +29 -0
  28. data/lib/bluejay/builtin/object_types/schema.rb +31 -0
  29. data/lib/bluejay/builtin/object_types/type.rb +57 -0
  30. data/lib/bluejay/builtin.rb +25 -0
  31. data/lib/bluejay/custom_scalar_type.rb +69 -0
  32. data/lib/bluejay/directive.rb +71 -0
  33. data/lib/bluejay/enum_type.rb +48 -0
  34. data/lib/bluejay/errors.rb +20 -0
  35. data/lib/bluejay/finalize.rb +27 -0
  36. data/lib/bluejay/input_object_type.rb +73 -0
  37. data/lib/bluejay/input_type_shorthands.rb +28 -0
  38. data/lib/bluejay/interface_type.rb +74 -0
  39. data/lib/bluejay/json_value.rb +16 -0
  40. data/lib/bluejay/name_from_class.rb +18 -0
  41. data/lib/bluejay/object_type.rb +81 -0
  42. data/lib/bluejay/output_type_shorthands.rb +28 -0
  43. data/lib/bluejay/query_root.rb +64 -0
  44. data/lib/bluejay/schema.rb +91 -0
  45. data/lib/bluejay/union_type.rb +50 -0
  46. data/lib/bluejay/version.rb +5 -0
  47. data/lib/bluejay.rb +45 -0
  48. data/lib/rbi_ext/model.rb +64 -0
  49. data/lib/tapioca/dsl/compilers/directive.rb +42 -0
  50. data/lib/tapioca/dsl/compilers/input_object_type.rb +41 -0
  51. data/lib/tapioca/dsl/compilers/interface_type.rb +33 -0
  52. data/lib/tapioca/dsl/compilers/object_type.rb +53 -0
  53. data/lib/tapioca/dsl/compilers/schema.rb +51 -0
  54. data/rust-toolchain.toml +2 -0
  55. metadata +118 -0
@@ -0,0 +1,42 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../../../rbi_ext/model"
5
+ require "bluejay"
6
+
7
+ module Tapioca
8
+ module Compilers
9
+ class Directive < Tapioca::Dsl::Compiler
10
+ extend T::Sig
11
+
12
+ ConstantType = type_member { { fixed: T.class_of(Bluejay::Directive) } }
13
+
14
+ class << self
15
+ extend(T::Sig)
16
+
17
+ sig { override.returns(T::Enumerable[Module]) }
18
+ def gather_constants
19
+ all_classes.select { |c| c < Bluejay::Directive }
20
+ end
21
+ end
22
+
23
+ sig { override.void }
24
+ def decorate
25
+ root.create_path(constant) do |klass|
26
+ parameters = constant.argument_definitions.map do |argument_definition|
27
+ create_kw_param(argument_definition.ruby_name, type: argument_definition.type.sorbet_type)
28
+ end
29
+
30
+ klass.custom_create_method("initialize", parameters:, return_type: nil)
31
+
32
+ constant.argument_definitions.each do |argument_definition|
33
+ klass.custom_create_method(
34
+ argument_definition.ruby_name,
35
+ return_type: argument_definition.type.sorbet_type,
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,41 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../../../rbi_ext/model"
5
+
6
+ module Tapioca
7
+ module Compilers
8
+ class InputObjectType < Tapioca::Dsl::Compiler
9
+ extend T::Sig
10
+
11
+ ConstantType = type_member { { fixed: T.class_of(Bluejay::InputObjectType) } }
12
+
13
+ class << self
14
+ extend(T::Sig)
15
+
16
+ sig { override.returns(T::Enumerable[Module]) }
17
+ def gather_constants
18
+ all_classes.select { |c| c < Bluejay::InputObjectType }
19
+ end
20
+ end
21
+
22
+ sig { override.void }
23
+ def decorate
24
+ root.create_path(constant) do |klass|
25
+ parameters = constant.input_field_definitions.map do |input_field_definition|
26
+ create_kw_param(input_field_definition.ruby_name, type: input_field_definition.type.sorbet_type)
27
+ end
28
+
29
+ klass.custom_create_method("initialize", parameters:, return_type: nil)
30
+
31
+ constant.input_field_definitions.each do |input_field_definition|
32
+ klass.custom_create_method(
33
+ input_field_definition.ruby_name,
34
+ return_type: input_field_definition.type.sorbet_type,
35
+ )
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,33 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../../../rbi_ext/model"
5
+
6
+ module Tapioca
7
+ module Compilers
8
+ class InterfaceType < Tapioca::Dsl::Compiler
9
+ extend T::Sig
10
+
11
+ ConstantType = type_member { { fixed: T.class_of(Bluejay::InterfaceType) } }
12
+
13
+ class << self
14
+ extend(T::Sig)
15
+
16
+ sig { override.returns(T::Enumerable[Module]) }
17
+ def gather_constants
18
+ all_classes.select { |c| c < Bluejay::InterfaceType }
19
+ end
20
+ end
21
+
22
+ sig { override.void }
23
+ def decorate
24
+ root.create_path(constant.const_get(:Interface)) do |klass|
25
+ constant.interface_implementations.each do |interface_implementation|
26
+ interface = T.cast(interface_implementation.interface, T.class_of(InterfaceType)).const_get(:Interface)
27
+ klass.create_include(interface.name)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,53 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../../../rbi_ext/model"
5
+
6
+ module Tapioca
7
+ module Compilers
8
+ class ObjectType < Tapioca::Dsl::Compiler
9
+ extend T::Sig
10
+
11
+ ConstantType = type_member { { fixed: T.class_of(Bluejay::ObjectType) } }
12
+
13
+ class << self
14
+ extend(T::Sig)
15
+
16
+ sig { override.returns(T::Enumerable[Module]) }
17
+ def gather_constants
18
+ all_classes.select { |c| c < Bluejay::ObjectType && c != Bluejay::QueryRoot }
19
+ end
20
+ end
21
+
22
+ sig { override.void }
23
+ def decorate
24
+ root.create_path(constant.const_get(:Interface)) do |klass|
25
+ klass.custom_create_method("resolve_typename", return_type: "String", is_final: true)
26
+
27
+ klass.mark_abstract
28
+
29
+ constant.interface_implementations.each do |interface_implementation|
30
+ interface = T.cast(interface_implementation.interface, T.class_of(InterfaceType)).const_get(:Interface)
31
+ klass.create_include(interface.name)
32
+ end
33
+
34
+ constant.field_definitions.each do |field_definition|
35
+ # TODO: add extra args
36
+ parameters = field_definition.argument_definitions.map do |argument_definition|
37
+ create_kw_param(argument_definition.ruby_name, type: argument_definition.type.sorbet_type)
38
+ end
39
+
40
+ return_type = field_definition.type.sorbet_type
41
+
42
+ klass.custom_create_method(
43
+ field_definition.resolver_method_name,
44
+ parameters:,
45
+ return_type:,
46
+ is_abstract: true,
47
+ )
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,51 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../../../rbi_ext/model"
5
+
6
+ module Tapioca
7
+ module Compilers
8
+ class Schema < Tapioca::Dsl::Compiler
9
+ extend T::Sig
10
+
11
+ ConstantType = type_member { { fixed: T.class_of(Bluejay::Schema) } }
12
+
13
+ class << self
14
+ extend(T::Sig)
15
+
16
+ sig { override.returns(T::Enumerable[Module]) }
17
+ def gather_constants
18
+ all_classes.select { |c| c < Bluejay::Schema }
19
+ end
20
+ end
21
+
22
+ sig { override.void }
23
+ def decorate
24
+ root.create_path(constant) do |klass|
25
+ parameters = [
26
+ create_kw_param("query", type: "String"),
27
+ create_kw_param("initial_value", type: "#{constant.name}::Root"),
28
+ create_kw_opt_param("operation_name", type: "T.nilable(String)", default: "nil"),
29
+ create_kw_opt_param("variables", type: "T::Hash[String, T.untyped]", default: "{}"),
30
+ ]
31
+ klass.custom_create_method(
32
+ "execute",
33
+ return_type: "Bluejay::ExecutionResult",
34
+ parameters:,
35
+ class_method: true,
36
+ )
37
+ end
38
+
39
+ root.create_path(constant.const_get(:Root)) do |klass|
40
+ klass.mark_interface
41
+
42
+ klass.custom_create_method("query", return_type: constant.query.const_get(:Interface).name, is_abstract: true)
43
+
44
+ if (mutation = constant.mutation)
45
+ klass.custom_create_method("mutation", return_type: mutation.const_get(:Interface).name, is_abstract: true)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,2 @@
1
+ [toolchain]
2
+ channel = "stable"
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bluejay
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.alpha.2
5
+ platform: x86_64-linux
6
+ authors:
7
+ - Adam Petro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-07-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sorbet-runtime
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ force_ruby_platform: false
28
+ description: A fast GraphQL engine.
29
+ email:
30
+ - adamapetro@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - LICENSE
36
+ - README.md
37
+ - lib/bluejay.rb
38
+ - lib/bluejay/3.1/bluejay_rb.so
39
+ - lib/bluejay/3.2/bluejay_rb.so
40
+ - lib/bluejay/base.rb
41
+ - lib/bluejay/base/custom_scalar_type.rb
42
+ - lib/bluejay/base/directive.rb
43
+ - lib/bluejay/base/enum_type.rb
44
+ - lib/bluejay/base/input_object_type.rb
45
+ - lib/bluejay/base/interface_type.rb
46
+ - lib/bluejay/base/object_type.rb
47
+ - lib/bluejay/base/query_root.rb
48
+ - lib/bluejay/base/schema.rb
49
+ - lib/bluejay/base/union_type.rb
50
+ - lib/bluejay/base_input_type.rb
51
+ - lib/bluejay/base_output_type.rb
52
+ - lib/bluejay/builtin.rb
53
+ - lib/bluejay/builtin/directives/deprecated.rb
54
+ - lib/bluejay/builtin/directives/include.rb
55
+ - lib/bluejay/builtin/directives/skip.rb
56
+ - lib/bluejay/builtin/directives/specified_by.rb
57
+ - lib/bluejay/builtin/enum_types/directive_location.rb
58
+ - lib/bluejay/builtin/enum_types/type_kind.rb
59
+ - lib/bluejay/builtin/object_types/directive.rb
60
+ - lib/bluejay/builtin/object_types/enum_value.rb
61
+ - lib/bluejay/builtin/object_types/field.rb
62
+ - lib/bluejay/builtin/object_types/input_value.rb
63
+ - lib/bluejay/builtin/object_types/schema.rb
64
+ - lib/bluejay/builtin/object_types/type.rb
65
+ - lib/bluejay/custom_scalar_type.rb
66
+ - lib/bluejay/directive.rb
67
+ - lib/bluejay/enum_type.rb
68
+ - lib/bluejay/errors.rb
69
+ - lib/bluejay/finalize.rb
70
+ - lib/bluejay/input_object_type.rb
71
+ - lib/bluejay/input_type_shorthands.rb
72
+ - lib/bluejay/interface_type.rb
73
+ - lib/bluejay/json_value.rb
74
+ - lib/bluejay/name_from_class.rb
75
+ - lib/bluejay/object_type.rb
76
+ - lib/bluejay/output_type_shorthands.rb
77
+ - lib/bluejay/query_root.rb
78
+ - lib/bluejay/schema.rb
79
+ - lib/bluejay/union_type.rb
80
+ - lib/bluejay/version.rb
81
+ - lib/rbi_ext/model.rb
82
+ - lib/tapioca/dsl/compilers/directive.rb
83
+ - lib/tapioca/dsl/compilers/input_object_type.rb
84
+ - lib/tapioca/dsl/compilers/interface_type.rb
85
+ - lib/tapioca/dsl/compilers/object_type.rb
86
+ - lib/tapioca/dsl/compilers/schema.rb
87
+ - rust-toolchain.toml
88
+ homepage: https://github.com/adampetro/bluejay-rb
89
+ licenses:
90
+ - MIT
91
+ metadata:
92
+ homepage_uri: https://github.com/adampetro/bluejay-rb
93
+ source_code_uri: https://github.com/adampetro/bluejay-rb
94
+ changelog_uri: https://github.com/adampetro/bluejay-rb/blob/main/CHANGELOG
95
+ cargo_crate_name: bluejay-rb
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '3.1'
105
+ - - "<"
106
+ - !ruby/object:Gem::Version
107
+ version: 3.3.dev
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">"
111
+ - !ruby/object:Gem::Version
112
+ version: 1.3.1
113
+ requirements: []
114
+ rubygems_version: 3.4.4
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: A fast GraphQL engine.
118
+ test_files: []