graphql_types 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/.gitignore +9 -0
- data/.rubocop.yml +139 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +13 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/graphql_types.gemspec +30 -0
- data/lib/graphql_types.rb +39 -0
- data/lib/graphql_types/version.rb +5 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7222e73c4b18881bcc13a8d23c3a9c04f8b33982
|
4
|
+
data.tar.gz: a71c0ab70dda2b8789428dbf95ea4416b9851d44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c800d0d9a2dbcdc4c3959a862a33d56732410f98d302ff5565063086df55516a1bd11f5303375a949002d27b4e53e5017da8281447bcfcdb4d71e04e8d3fef91
|
7
|
+
data.tar.gz: 1a866b259b60c3c1af755674ccd0dd03171a4ef6b97d6e1d150007e486c48a2cacc69b75245e07272d117abaa29ecade1e23bc91294cf35fded935340d385fe4
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
# See also https://github.com/onk/onkcop/blob/master/config/rubocop.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
DisplayCopNames: true
|
6
|
+
Exclude:
|
7
|
+
- bin/**/*
|
8
|
+
|
9
|
+
Lint/UnusedBlockArgument:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Lint/AmbiguousBlockAssociation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Lint/ScriptPermission:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Layout/MultilineMethodCallIndentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Layout/EmptyLinesAroundClassBody:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Max: 32
|
26
|
+
|
27
|
+
Metrics/PerceivedComplexity:
|
28
|
+
Max: 10
|
29
|
+
|
30
|
+
Metrics/CyclomaticComplexity:
|
31
|
+
Max: 10
|
32
|
+
|
33
|
+
Metrics/ClassLength:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/BlockLength:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/LineLength:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/MethodLength:
|
43
|
+
Max: 45
|
44
|
+
|
45
|
+
Metrics/ModuleLength:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics/ParameterLists:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/BlockDelimiters:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/CommentAnnotation:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/Documentation:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/FileName:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/GuardClause:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/IfInsideElse:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/IfUnlessModifier:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Style/Lambda:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/MutableConstant:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
Style/NumericPredicate:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Style/PercentLiteralDelimiters:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Style/SignalException:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Style/StringLiterals:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Style/TrailingCommaInLiteral:
|
91
|
+
EnforcedStyleForMultiline: comma
|
92
|
+
|
93
|
+
Style/TrailingCommaInArguments:
|
94
|
+
EnforcedStyleForMultiline: comma
|
95
|
+
|
96
|
+
Style/WordArray:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
Style/NumericLiterals:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Style/MultilineBlockChain:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
Style/ConditionalAssignment:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
Style/RescueModifier:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Style/AsciiComments:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Style/EmptyMethod:
|
115
|
+
EnforcedStyle: expanded
|
116
|
+
|
117
|
+
Style/VariableNumber:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Style/PredicateName:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Style/AccessorMethodName:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Style/YodaCondition:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/FormatStringToken:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/MultipleComparison:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Style/StructInheritance:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Performance/RedundantBlockCall:
|
139
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
|
7
|
+
# Specify your gem's dependencies in graphql_json_type.gemspec
|
8
|
+
gemspec
|
9
|
+
|
10
|
+
gem 'bundler'
|
11
|
+
gem 'minitest'
|
12
|
+
gem 'minitest-power_assert'
|
13
|
+
gem 'rake'
|
14
|
+
gem 'rubocop'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 FUJI Goro (gfx)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# GraphqlTypes
|
2
|
+
|
3
|
+
This gem provides scalar types that GraphQL core does not have:
|
4
|
+
|
5
|
+
* `GraphqlTypes::JsonType` as `JSON`
|
6
|
+
* `GraphqlTypes::DateType` as `Date`
|
7
|
+
* `GraphqlTypes::BigIntType` as `BigInt`
|
8
|
+
|
9
|
+
This is created on `graphql-ruby`.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'graphql_types'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install graphql_types
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/graphql_json_type.
|
36
|
+
|
37
|
+
## Copygirht
|
38
|
+
|
39
|
+
Copyright (c) 2017 Bit Journey, Inc.
|
40
|
+
|
41
|
+
## License
|
42
|
+
|
43
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.warning = false # too many warnings in graphql-ruby
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
task default: :test
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "graphql_types"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path("../lib", __FILE__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
require "graphql_types/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "graphql_types"
|
10
|
+
spec.version = GraphqlTypes::VERSION
|
11
|
+
spec.authors = ["FUJI Goro (gfx)"]
|
12
|
+
spec.email = ["goro-fuji@bitjourney.com"]
|
13
|
+
|
14
|
+
spec.summary = 'Extra types for graphql-ruby'
|
15
|
+
spec.description = 'Extra types for graphql-ruby: JSON, Date, and BigInt'
|
16
|
+
spec.homepage = "https://github.com/bitjourney/graphql_json_type"
|
17
|
+
spec.license = "MIT"
|
18
|
+
spec.required_ruby_version = '>= 2.3'
|
19
|
+
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_runtime_dependency "graphql"
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./graphql_types/version"
|
4
|
+
|
5
|
+
require "graphql"
|
6
|
+
require "json"
|
7
|
+
require "time"
|
8
|
+
|
9
|
+
module GraphqlTypes
|
10
|
+
|
11
|
+
# @type [GraphQL::ScalarType]
|
12
|
+
JsonType = GraphQL::ScalarType.define do
|
13
|
+
name "JSON"
|
14
|
+
description "A dynamic object"
|
15
|
+
|
16
|
+
coerce_input ->(x, _context) { JSON.parse(x) }
|
17
|
+
coerce_result ->(x, _context) { JSON.dump(x) }
|
18
|
+
end
|
19
|
+
|
20
|
+
# @type [GraphQL::ScalarType]
|
21
|
+
DateType = GraphQL::ScalarType.define do
|
22
|
+
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
|
23
|
+
name "Date"
|
24
|
+
description "A single moment of a time"
|
25
|
+
|
26
|
+
coerce_input ->(x, _context) { Time.parse(x) }
|
27
|
+
coerce_result ->(x, _context) { x.iso8601 }
|
28
|
+
end
|
29
|
+
|
30
|
+
# @type [GraphQL::ScalarType]
|
31
|
+
BigIntType = GraphQL::ScalarType.define do
|
32
|
+
# https://github.com/tc39/proposal-bigint
|
33
|
+
name "BigInt"
|
34
|
+
description "An arbitrary precision integer"
|
35
|
+
|
36
|
+
coerce_input ->(x, _context) { x.to_i }
|
37
|
+
coerce_result ->(x, _context) { x.to_s }
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: graphql_types
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- FUJI Goro (gfx)
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: graphql
|
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
|
+
description: 'Extra types for graphql-ruby: JSON, Date, and BigInt'
|
28
|
+
email:
|
29
|
+
- goro-fuji@bitjourney.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- ".travis.yml"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- Gemfile
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- bin/console
|
43
|
+
- bin/setup
|
44
|
+
- graphql_types.gemspec
|
45
|
+
- lib/graphql_types.rb
|
46
|
+
- lib/graphql_types/version.rb
|
47
|
+
homepage: https://github.com/bitjourney/graphql_json_type
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata:
|
51
|
+
allowed_push_host: https://rubygems.org
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.3'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.6.13
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Extra types for graphql-ruby
|
72
|
+
test_files: []
|