elasticgraph-rack 1.0.0.rc2 → 1.0.0.rc3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99d3c8f9043cc6b186adcd98c13043f535c7bc3799b8c27766b4682b17c85483
4
- data.tar.gz: 3dbd09242d3b24b476f8e2f320c069a563ccd3689b9456253dbd3cd3f1de47a4
3
+ metadata.gz: 86c85a72e61b8a2865506bf66e41b8bd1f371212aa94e0f4b5d3680da3ea1ec3
4
+ data.tar.gz: 4cbd5d3b3973367820e8cc32998dc3682b5ca6876789f844e48305e08234daa2
5
5
  SHA512:
6
- metadata.gz: 6f65be0baaf5cfd267a5a061887e44fb7427cc09d233a9b9a174cdb20f77e4300628df152683fdb9435fd9a02ef197eb47899a3a861b79100d05a96e85e36211
7
- data.tar.gz: a3ad8369393f155675efa43ceb49fb1f56598dc5c21da13a84721d2c6a5421c8450f33be7544dec0446891fbb1f4a25c1365712908f0a316846a7cab16ed5ac5
6
+ metadata.gz: b3948dc1d94660ce630e1fba86746b88151064ffc4d8a0bf50d6c7c7a36ea8a9d96246a16270cfe92c7c82a8bc803be64cbb4cd60b9be9add20e7c26b93b3139
7
+ data.tar.gz: 3333167137930e14e1380cd315068df3ef7c4900b3255613a610ef3f59cfa4f3aa403d4685b79f25336690efa7c2044f58bac84630127be1a22a2f831db48919
data/README.md CHANGED
@@ -20,9 +20,9 @@ graph LR;
20
20
  rack["rack"];
21
21
  elasticgraph-rack --> rack;
22
22
  class rack externalGemStyle;
23
- elasticgraph-local["elasticgraph-local"];
24
- elasticgraph-local --> elasticgraph-rack;
25
- class elasticgraph-local otherEgGemStyle;
23
+ elasticgraph-graphiql["elasticgraph-graphiql"];
24
+ elasticgraph-graphiql --> elasticgraph-rack;
25
+ class elasticgraph-graphiql otherEgGemStyle;
26
26
  click rack href "https://rubygems.org/gems/rack" "Open on RubyGems.org" _blank;
27
27
  ```
28
28
 
@@ -40,26 +40,3 @@ run ElasticGraph::Rack::GraphQLEndpoint.new(graphql)
40
40
  ```
41
41
 
42
42
  Run this with `rackup` (after installing the `rackup` gem) or any other rack-compatible server.
43
-
44
- ## Serving a GraphiQL UI
45
-
46
- This gem also provides a simple GraphiQL UI using the CDN-hosted GraphiQL assets.
47
- Here's an example `config.ru` to boot that:
48
-
49
- ``` ruby
50
- require 'elastic_graph/graphql'
51
- require 'elastic_graph/rack/graphiql'
52
-
53
- graphql = ElasticGraph::GraphQL.from_yaml_file("path/to/config.yaml")
54
- run ElasticGraph::Rack::GraphiQL.new(graphql)
55
- ```
56
-
57
- Run this with `rackup` (after installing the `rackup` gem) or any other rack-compatible server.
58
-
59
- ## License
60
-
61
- elasticgraph-rack is released under the [MIT License](https://opensource.org/licenses/MIT).
62
-
63
- [Part of the distributed code](lib/elastic_graph/rack/graphiql/index.html)
64
- comes from the [GraphiQL project](https://github.com/graphql/graphiql), also licensed under the
65
- MIT License, Copyright (c) GraphQL Contributors.
@@ -10,10 +10,7 @@ module ElasticGraph
10
10
  # Adapts an ElasticGraph GraphQL endpoint to run as a [Rack](https://github.com/rack/rack) application.
11
11
  # This allows an ElasticGraph GraphQL endpoint to run inside any [Rack-compatible web
12
12
  # framework](https://github.com/rack/rack#supported-web-frameworks), including [Ruby on Rails](https://rubyonrails.org/),
13
- # or as a stand-alone application. Two configurations are supported:
14
- #
15
- # * Use {Rack::GraphQLEndpoint} to serve a GraphQL endpoint.
16
- # * Use {Rack::GraphiQL} to serve a GraphQL endpoint and the [GraphiQL IDE](https://github.com/graphql/graphiql).
13
+ # or as a stand-alone application.
17
14
  module Rack
18
15
  end
19
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticgraph-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.0.rc2
20
+ version: 1.0.0.rc3
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.0.0.rc2
27
+ version: 1.0.0.rc3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rack
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -51,56 +51,56 @@ dependencies:
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0.rc2
54
+ version: 1.0.0.rc3
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0.rc2
61
+ version: 1.0.0.rc3
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: elasticgraph-elasticsearch
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0.rc2
68
+ version: 1.0.0.rc3
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.0.rc2
75
+ version: 1.0.0.rc3
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: elasticgraph-opensearch
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0.rc2
82
+ version: 1.0.0.rc3
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 1.0.0.rc2
89
+ version: 1.0.0.rc3
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: elasticgraph-indexer
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.0.0.rc2
96
+ version: 1.0.0.rc3
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0.rc2
103
+ version: 1.0.0.rc3
104
104
  email:
105
105
  - myron@squareup.com
106
106
  executables: []
@@ -110,19 +110,16 @@ files:
110
110
  - LICENSE.txt
111
111
  - README.md
112
112
  - lib/elastic_graph/rack.rb
113
- - lib/elastic_graph/rack/graphiql.rb
114
- - lib/elastic_graph/rack/graphiql/README.md
115
- - lib/elastic_graph/rack/graphiql/index.html
116
113
  - lib/elastic_graph/rack/graphql_endpoint.rb
117
114
  homepage: https://block.github.io/elasticgraph/
118
115
  licenses:
119
116
  - MIT
120
117
  metadata:
121
118
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
122
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc2
123
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc2/
119
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc3
120
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc3/
124
121
  homepage_uri: https://block.github.io/elasticgraph/
125
- source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc2/elasticgraph-rack
122
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc3/elasticgraph-rack
126
123
  gem_category: local
127
124
  rdoc_options: []
128
125
  require_paths:
@@ -1,40 +0,0 @@
1
- ## GraphiQL for ElasticGraph
2
-
3
- This directory provides the GraphiQL in browser UI for working with ElasticGraph
4
- applications.
5
-
6
- The `index.html` file is copied from:
7
-
8
- https://github.com/graphql/graphiql/blob/graphiql%402.4.0/examples/graphiql-cdn/index.html
9
-
10
- However, we've applied some slight changes to make it work for ElasticGraph.
11
-
12
- ```diff
13
- diff --git a/elasticgraph-rack/lib/elastic_graph/rack/graphiql/index.html b/elasticgraph-rack/lib/elastic_graph/rack/graphiql/index.html
14
- index 55cf5d05..a672ead9 100644
15
- --- a/elasticgraph-rack/lib/elastic_graph/rack/graphiql/index.html
16
- +++ b/elasticgraph-rack/lib/elastic_graph/rack/graphiql/index.html
17
- @@ -8,7 +8,7 @@
18
- <!DOCTYPE html>
19
- <html lang="en">
20
- <head>
21
- - <title>GraphiQL</title>
22
- + <title>ElasticGraph GraphiQL</title>
23
- <style>
24
- body {
25
- height: 100%;
26
- @@ -58,7 +58,7 @@
27
- ReactDOM.render(
28
- React.createElement(GraphiQL, {
29
- fetcher: GraphiQL.createFetcher({
30
- - url: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
31
- + url: '/graphql',
32
- }),
33
- defaultEditorToolsVisibility: true,
34
- }),
35
- ```
36
-
37
- ## License
38
-
39
- [index.html](index.html) comes from the [GraphiQL project](https://github.com/graphql/graphiql),
40
- licensed under the MIT License, Copyright (c) GraphQL Contributors.
@@ -1,90 +0,0 @@
1
- <!--
2
- * Copyright (c) 2021 GraphQL Contributors
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the GraphiQL license found at:
6
- * https://github.com/graphql/graphiql/blob/graphiql%404.0.0/LICENSE
7
- -->
8
- <!doctype html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8" />
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
13
- <title>ElasticGraph GraphiQL</title>
14
- <style>
15
- body {
16
- margin: 0;
17
- overflow: hidden; /* in Firefox */
18
- }
19
-
20
- #graphiql {
21
- height: 100dvh;
22
- }
23
-
24
- .loading {
25
- height: 100%;
26
- display: flex;
27
- align-items: center;
28
- justify-content: center;
29
- font-size: 4rem;
30
- }
31
- </style>
32
- <link
33
- rel="stylesheet"
34
- href="https://esm.sh/graphiql@4.0.0/dist/style.css"
35
- />
36
- <link
37
- rel="stylesheet"
38
- href="https://esm.sh/@graphiql/plugin-explorer@4.0.0/dist/style.css"
39
- />
40
- <!-- Note: the ?standalone flag bundles the module along with all of its `dependencies`, excluding `peerDependencies`, into a single JavaScript file. -->
41
- <script type="importmap">
42
- {
43
- "imports": {
44
- "react": "https://esm.sh/react@19.1.0",
45
- "react/jsx-runtime": "https://esm.sh/react@19.1.0/jsx-runtime",
46
-
47
- "react-dom": "https://esm.sh/react-dom@19.1.0",
48
- "react-dom/client": "https://esm.sh/react-dom@19.1.0/client",
49
-
50
- "graphiql": "https://esm.sh/graphiql@4.0.0?standalone&external=react,react/jsx-runtime,react-dom,@graphiql/react",
51
- "@graphiql/plugin-explorer": "https://esm.sh/@graphiql/plugin-explorer@4.0.0?standalone&external=react,react/jsx-runtime,react-dom,@graphiql/react,graphql",
52
- "@graphiql/react": "https://esm.sh/@graphiql/react@0.30.0?standalone&external=react,react/jsx-runtime,react-dom,graphql,@graphiql/toolkit",
53
-
54
- "@graphiql/toolkit": "https://esm.sh/@graphiql/toolkit@0.11.2?standalone&external=graphql",
55
- "graphql": "https://esm.sh/graphql@16.11.0"
56
- }
57
- }
58
- </script>
59
- <script type="module">
60
- // Import React and ReactDOM
61
- import React from 'react';
62
- import ReactDOM from 'react-dom/client';
63
- // Import GraphiQL and the Explorer plugin
64
- import { GraphiQL } from 'graphiql';
65
- import { createGraphiQLFetcher } from '@graphiql/toolkit';
66
- import { explorerPlugin } from '@graphiql/plugin-explorer';
67
-
68
- const fetcher = createGraphiQLFetcher({
69
- url: '/graphql',
70
- });
71
- const explorer = explorerPlugin();
72
-
73
- function App() {
74
- return React.createElement(GraphiQL, {
75
- fetcher,
76
- plugins: [explorer],
77
- });
78
- }
79
-
80
- const container = document.getElementById('graphiql');
81
- const root = ReactDOM.createRoot(container);
82
- root.render(React.createElement(App));
83
- </script>
84
- </head>
85
- <body>
86
- <div id="graphiql">
87
- <div class="loading">Loading…</div>
88
- </div>
89
- </body>
90
- </html>
@@ -1,44 +0,0 @@
1
- # Copyright 2024 - 2025 Block, Inc.
2
- #
3
- # Use of this source code is governed by an MIT-style
4
- # license that can be found in the LICENSE file or at
5
- # https://opensource.org/licenses/MIT.
6
- #
7
- # frozen_string_literal: true
8
-
9
- require "elastic_graph/rack/graphql_endpoint"
10
- require "rack/builder"
11
- require "rack/static"
12
-
13
- module ElasticGraph
14
- module Rack
15
- # A [Rack](https://github.com/rack/rack) application that serves both an ElasticGraph GraphQL endpoint
16
- # and a [GraphiQL IDE](https://github.com/graphql/graphiql). This can be used for local development,
17
- # mounted in a [Rails](https://rubyonrails.org/) application, or run in any other Rack-compatible context.
18
- #
19
- # @example Simple config.ru to run GraphiQL as a Rack application, targeting an ElasticGraph endpoint
20
- # require "elastic_graph/graphql"
21
- # require "elastic_graph/rack/graphiql"
22
- #
23
- # graphql = ElasticGraph::GraphQL.from_yaml_file("config/settings/development.yaml")
24
- # run ElasticGraph::Rack::GraphiQL.new(graphql)
25
- module GraphiQL
26
- # Builds a [Rack](https://github.com/rack/rack) application that serves both an ElasticGraph GraphQL endpoint
27
- # and a [GraphiQL IDE](https://github.com/graphql/graphiql).
28
- #
29
- # @param graphql [ElasticGraph::GraphQL] ElasticGraph GraphQL instance
30
- # @return [Rack::Builder] built Rack application
31
- def self.new(graphql)
32
- graphql_endpoint = ElasticGraph::Rack::GraphQLEndpoint.new(graphql)
33
-
34
- ::Rack::Builder.new do
35
- use ::Rack::Static, urls: {"/" => "index.html"}, root: ::File.join(__dir__, "graphiql")
36
-
37
- map "/graphql" do
38
- run graphql_endpoint
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end