├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── pom.xml
├── spring-boot-sample
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── leangen
│ │ └── spqr
│ │ └── samples
│ │ └── demo
│ │ ├── configuration
│ │ ├── ApplicationStartupListener.java
│ │ └── DemoApplication.java
│ │ ├── controller
│ │ └── GraphQLSampleController.java
│ │ ├── dto
│ │ ├── Address.java
│ │ ├── Customer.java
│ │ ├── Person.java
│ │ ├── PersonalTitle.java
│ │ ├── Product.java
│ │ ├── ProductInStock.java
│ │ ├── SocialNetworkAccount.java
│ │ └── Vendor.java
│ │ └── query
│ │ ├── annotated
│ │ ├── PersonQuery.java
│ │ ├── SocialNetworkQuery.java
│ │ └── VendorQuery.java
│ │ └── unannotated
│ │ ├── DomainQuery.java
│ │ └── ProductQuery.java
│ └── resources
│ ├── application.yml
│ ├── banner.txt
│ └── static
│ ├── core
│ ├── css
│ │ └── bootstrap.min.css
│ └── js
│ │ └── bootstrap.min.js
│ └── graphiql
│ ├── css
│ └── graphiql.css
│ ├── index.html
│ └── js
│ ├── graphiql.js
│ └── vendor
│ ├── es6-promise.auto.js
│ ├── fetch.min.js
│ ├── react-15.0.1.min.js
│ ├── react-15.4.2.js
│ ├── react-dom-15.0.1.min.js
│ └── react-dom-15.4.2.js
└── spring-boot-starter-sample
├── pom.xml
└── src
├── main
├── java
│ └── io
│ │ └── leangen
│ │ └── graphql
│ │ └── samples
│ │ ├── StarterDemoApplication.java
│ │ ├── config
│ │ └── DataLoaderFactory.java
│ │ ├── dto
│ │ ├── Project.java
│ │ ├── Status.java
│ │ ├── Task.java
│ │ └── Type.java
│ │ ├── repo
│ │ ├── ProjectRepo.java
│ │ └── TaskRepo.java
│ │ └── service
│ │ ├── ProjectService.java
│ │ └── TaskService.java
└── resources
│ └── application.properties
└── test
└── java
└── io
└── leangen
└── graphql
└── samples
└── StarterDemoApplicationTests.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # IDEA
2 |
3 | .idea
4 | .idea_modules/
5 | *.iml
6 | /lib
7 |
8 | # OSX
9 | .DS_Store
10 | .DS_Store?
11 | ._*
12 | .Spotlight-V100
13 | .Trashes
14 |
15 | # Windows
16 |
17 | ehthumbs.db
18 | Thumbs.db
19 |
20 | # Build directories
21 |
22 | **/target
23 | target
24 | out/
25 | overlays/
26 | /data/
27 | /statics/themes/themes/default/css/
28 |
29 | # Maven
30 | pom.xml.tag
31 | pom.xml.releaseBackup
32 | pom.xml.versionsBackup
33 | pom.xml.next
34 | release.properties
35 |
36 | # Gradle
37 | .gradle
38 | out
39 | build
40 | generated
41 |
42 | # ??
43 | *.log
44 | demo/.idea/
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GraphQL-SPQR Spring Boot Samples
2 |
3 | [](https://travis-ci.org/leangen/graphql-spqr-samples)
4 | [](https://gitter.im/leangen/graphql-spqr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5 |
6 | Simplistic Spring Boot application for demoing GraphQL SPQR lib's capabilities.
7 | This is mostly used by us for doing live demo's in our talks, not as documentation.
8 |
9 | Package with Maven, run the jar, play around.
10 |
11 | Out of the box, the application runs on port 8000
12 |
13 | GraphQL Playground (graphical environment) is mapped to `/gui` by default (e.g. http://localhost:8000/gui)
14 |
15 | API is exposed on `/graphql`
16 |
17 | Example queries can be found in javadoc for query methods
18 |
19 | For an elaborate introspection query you might want to use:
20 | ```graphql
21 | query IntrospectionQuery {
22 | __schema {
23 | queryType { name }
24 | mutationType { name }
25 | subscriptionType { name }
26 | types {
27 | ...FullType
28 | }
29 | directives {
30 | name
31 | description
32 | locations
33 | args {
34 | ...InputValue
35 | }
36 | }
37 | }
38 | }
39 | fragment FullType on __Type {
40 | kind
41 | name
42 | description
43 | fields(includeDeprecated: true) {
44 | name
45 | description
46 | args {
47 | ...InputValue
48 | }
49 | type {
50 | ...TypeRef
51 | }
52 | isDeprecated
53 | deprecationReason
54 | }
55 | inputFields {
56 | ...InputValue
57 | }
58 | interfaces {
59 | ...TypeRef
60 | }
61 | enumValues(includeDeprecated: true) {
62 | name
63 | description
64 | isDeprecated
65 | deprecationReason
66 | }
67 | possibleTypes {
68 | ...TypeRef
69 | }
70 | }
71 | fragment InputValue on __InputValue {
72 | name
73 | description
74 | type { ...TypeRef }
75 | defaultValue
76 | }
77 | fragment TypeRef on __Type {
78 | kind
79 | name
80 | ofType {
81 | kind
82 | name
83 | ofType {
84 | kind
85 | name
86 | ofType {
87 | kind
88 | name
89 | ofType {
90 | kind
91 | name
92 | ofType {
93 | kind
94 | name
95 | ofType {
96 | kind
97 | name
98 | ofType {
99 | kind
100 | name
101 | }
102 | }
103 | }
104 | }
105 | }
106 | }
107 | }
108 | }
109 | ```
110 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.leangen.spqr.samples
7 | demo-projects
8 | 0.0.1-SNAPSHOT
9 | pom
10 |
11 | Demo projects
12 | SPQR demo projects
13 |
14 |
15 | spring-boot-sample
16 | spring-boot-starter-sample
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/spring-boot-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | io.leangen.spqr.samples
8 | spring-boot-demo
9 | 1.0.0
10 |
11 | Spring Boot demo
12 | Demo project for GraphQL SPQR
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.4.2
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-web
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-actuator
30 |
31 |
32 | io.projectreactor
33 | reactor-core
34 | 3.4.4
35 |
36 |
37 |
38 |
39 | io.leangen.graphql
40 | spqr
41 | 0.11.2
42 |
43 |
44 |
45 |
46 | spqr-demo
47 |
48 |
49 |
50 | org.apache.maven.plugins
51 | maven-compiler-plugin
52 | 3.8.0
53 |
54 | 1.8
55 | 1.8
56 | -parameters
57 | -parameters
58 |
59 |
60 |
61 | org.springframework.boot
62 | spring-boot-maven-plugin
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/configuration/ApplicationStartupListener.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.configuration;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Value;
7 | import org.springframework.boot.context.event.ApplicationReadyEvent;
8 | import org.springframework.context.ApplicationListener;
9 | import org.springframework.stereotype.Component;
10 |
11 | @Component
12 | public class ApplicationStartupListener implements ApplicationListener {
13 | private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationStartupListener.class);
14 |
15 | private final String port;
16 |
17 | @Autowired
18 | public ApplicationStartupListener(@Value("${server.port}") String port) {
19 | this.port = port;
20 | }
21 |
22 | @Override
23 | public void onApplicationEvent(final ApplicationReadyEvent event) {
24 | LOGGER.info("Application is running on port: {}", this.port);
25 | }
26 | }
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/configuration/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.configuration;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.ComponentScan;
8 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10 |
11 | @SpringBootApplication
12 | @ComponentScan(basePackages = "io.leangen.spqr.samples.demo")
13 | public class DemoApplication extends SpringBootServletInitializer {
14 |
15 | public static void main(String[] args) throws Exception {
16 | SpringApplication.run(DemoApplication.class, args);
17 | }
18 |
19 | @Bean
20 | public WebMvcConfigurer forwardToIndex() {
21 | return new WebMvcConfigurer() {
22 | @Override
23 | public void addViewControllers(ViewControllerRegistry registry) {
24 | registry.addViewController("/").setViewName(
25 | "forward:/graphiql/index.html");
26 | }
27 | };
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/controller/GraphQLSampleController.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.controller;
2 |
3 | import graphql.ExecutionInput;
4 | import graphql.ExecutionResult;
5 | import graphql.GraphQL;
6 | import graphql.schema.GraphQLSchema;
7 | import io.leangen.graphql.GraphQLSchemaGenerator;
8 | import io.leangen.spqr.samples.demo.query.annotated.PersonQuery;
9 | import io.leangen.spqr.samples.demo.query.annotated.SocialNetworkQuery;
10 | import io.leangen.spqr.samples.demo.query.annotated.VendorQuery;
11 | import io.leangen.spqr.samples.demo.query.unannotated.DomainQuery;
12 | import io.leangen.spqr.samples.demo.query.unannotated.ProductQuery;
13 | import org.slf4j.Logger;
14 | import org.slf4j.LoggerFactory;
15 | import org.springframework.beans.factory.annotation.Autowired;
16 | import org.springframework.http.MediaType;
17 | import org.springframework.web.bind.annotation.PostMapping;
18 | import org.springframework.web.bind.annotation.RequestBody;
19 | import org.springframework.web.bind.annotation.ResponseBody;
20 | import org.springframework.web.bind.annotation.RestController;
21 |
22 | import javax.servlet.http.HttpServletRequest;
23 | import java.util.Map;
24 |
25 | @RestController
26 | public class GraphQLSampleController {
27 |
28 | private static final Logger LOGGER = LoggerFactory.getLogger(GraphQLSampleController.class);
29 |
30 | private final GraphQL graphQL;
31 |
32 | @Autowired
33 | public GraphQLSampleController(PersonQuery personQuery,
34 | SocialNetworkQuery socialNetworkQuery,
35 | DomainQuery domainQuery,
36 | ProductQuery productQuery,
37 | VendorQuery vendorQuery) {
38 |
39 | //Schema generated from query classes
40 | GraphQLSchema schema = new GraphQLSchemaGenerator()
41 | .withBasePackages("io.leangen.spqr.samples.demo")
42 | .withOperationsFromSingletons(personQuery, socialNetworkQuery, vendorQuery, domainQuery, productQuery)
43 | .generate();
44 | graphQL = GraphQL.newGraphQL(schema).build();
45 |
46 | LOGGER.info("Generated GraphQL schema using SPQR");
47 | }
48 |
49 | @PostMapping(value = "/graphql", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
50 | @ResponseBody
51 | public Map indexFromAnnotated(@RequestBody Map request, HttpServletRequest raw) {
52 | ExecutionResult executionResult = graphQL.execute(ExecutionInput.newExecutionInput()
53 | .query(request.get("query"))
54 | .operationName(request.get("operationName"))
55 | .context(raw)
56 | .build());
57 | return executionResult.toSpecification();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/Address.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class Address {
6 | private String country;
7 | private String city;
8 | private String streetAndNumber;
9 | private String postalCode;
10 |
11 | public Address(){
12 | }
13 |
14 | public Address(String country, String city, String streetAndNumber, String postalCode) {
15 | this.country = country;
16 | this.city = city;
17 | this.streetAndNumber = streetAndNumber;
18 | this.postalCode = postalCode;
19 | }
20 |
21 | @GraphQLQuery(name = "country")
22 | public String getCountry() {
23 | return country;
24 | }
25 |
26 | public void setCountry(String country) {
27 | this.country = country;
28 | }
29 |
30 | @GraphQLQuery(name = "city")
31 | public String getCity() {
32 | return city;
33 | }
34 |
35 | public void setCity(String city) {
36 | this.city = city;
37 | }
38 |
39 | @GraphQLQuery(name = "streetAndNumber")
40 | public String getStreetAndNumber() {
41 | return streetAndNumber;
42 | }
43 |
44 | public void setStreetAndNumber(String streetAndNumber) {
45 | this.streetAndNumber = streetAndNumber;
46 | }
47 |
48 | @GraphQLQuery(name = "postalCode")
49 | public String getPostalCode() {
50 | return postalCode;
51 | }
52 |
53 | public void setPostalCode(String postalCode) {
54 | this.postalCode = postalCode;
55 | }
56 |
57 | @Override
58 | public boolean equals(Object o) {
59 | if (this == o) return true;
60 | if (o == null || getClass() != o.getClass()) return false;
61 |
62 | Address address = (Address) o;
63 |
64 | if (country != null ? !country.equals(address.country) : address.country != null) return false;
65 | if (city != null ? !city.equals(address.city) : address.city != null) return false;
66 | if (streetAndNumber != null ? !streetAndNumber.equals(address.streetAndNumber) : address.streetAndNumber != null)
67 | return false;
68 | return postalCode != null ? postalCode.equals(address.postalCode) : address.postalCode == null;
69 |
70 | }
71 |
72 | @Override
73 | public int hashCode() {
74 | int result = country != null ? country.hashCode() : 0;
75 | result = 31 * result + (city != null ? city.hashCode() : 0);
76 | result = 31 * result + (streetAndNumber != null ? streetAndNumber.hashCode() : 0);
77 | result = 31 * result + (postalCode != null ? postalCode.hashCode() : 0);
78 | return result;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/Customer.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class Customer extends Person {
6 | private PersonalTitle personalTitle;
7 |
8 | @GraphQLQuery(name = "title")
9 | public PersonalTitle getPersonalTitle() {
10 | return personalTitle;
11 | }
12 |
13 | public void setPersonalTitle(PersonalTitle personalTitle) {
14 | this.personalTitle = personalTitle;
15 | }
16 |
17 | @Override
18 | public boolean equals(Object o) {
19 | if (this == o) return true;
20 | if (o == null || getClass() != o.getClass()) return false;
21 | if (!super.equals(o)) return false;
22 |
23 | Customer customer = (Customer) o;
24 |
25 | return personalTitle == customer.personalTitle;
26 |
27 | }
28 |
29 | @Override
30 | public int hashCode() {
31 | int result = super.hashCode();
32 | result = 31 * result + (personalTitle != null ? personalTitle.hashCode() : 0);
33 | return result;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/Person.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class Person {
6 | private String firstName;
7 | private String lastName;
8 |
9 | @GraphQLQuery(name = "firstName")
10 | public String getFirstName() {
11 | return firstName;
12 | }
13 |
14 | public void setFirstName(String firstName) {
15 | this.firstName = firstName;
16 | }
17 |
18 | @GraphQLQuery(name = "lastName")
19 | public String getLastName() {
20 | return lastName;
21 | }
22 |
23 | public void setLastName(String lastName) {
24 | this.lastName = lastName;
25 | }
26 |
27 | @Override
28 | public boolean equals(Object o) {
29 | if (this == o) return true;
30 | if (o == null || getClass() != o.getClass()) return false;
31 |
32 | Person person = (Person) o;
33 |
34 | if (firstName != null ? !firstName.equals(person.firstName) : person.firstName != null) return false;
35 | return lastName != null ? lastName.equals(person.lastName) : person.lastName == null;
36 |
37 | }
38 |
39 | @Override
40 | public int hashCode() {
41 | int result = firstName != null ? firstName.hashCode() : 0;
42 | result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
43 | return result;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/PersonalTitle.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | public enum PersonalTitle {
4 | MR("Mr."),
5 | MRS("Mrs."),
6 | MS("Ms.");
7 |
8 | private String titleLiteral;
9 |
10 | PersonalTitle(String titleLiteral) {
11 | this.titleLiteral=titleLiteral;
12 | }
13 |
14 | @Override
15 | public String toString() {
16 | return this.titleLiteral;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/Product.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class Product {
6 | private Long id;
7 | private String name;
8 | private String description;
9 |
10 | public Product() {
11 | }
12 |
13 | public Product(Long id, String name, String description) {
14 | this.id = id;
15 | this.name = name;
16 | this.description = description;
17 | }
18 |
19 | @GraphQLQuery(name = "id")
20 | public Long getId() {
21 | return id;
22 | }
23 |
24 | public void setId(Long id) {
25 | this.id = id;
26 | }
27 |
28 | @GraphQLQuery(name = "name")
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | @GraphQLQuery(name = "description")
38 | public String getDescription() {
39 | return description;
40 | }
41 |
42 | public void setDescription(String description) {
43 | this.description = description;
44 | }
45 |
46 | @Override
47 | public boolean equals(Object o) {
48 | if (this == o) return true;
49 | if (o == null || getClass() != o.getClass()) return false;
50 |
51 | Product product = (Product) o;
52 |
53 | return id != null ? id.equals(product.id) : product.id == null;
54 |
55 | }
56 |
57 | @Override
58 | public int hashCode() {
59 | return id != null ? id.hashCode() : 0;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/ProductInStock.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class ProductInStock {
6 | private Product product;
7 | private long stockSize;
8 |
9 | public ProductInStock(){
10 | }
11 |
12 | public ProductInStock(Product product, long stockSize) {
13 | this.product = product;
14 | this.stockSize = stockSize;
15 | }
16 |
17 | @GraphQLQuery(name = "product")
18 | public Product getProduct() {
19 | return product;
20 | }
21 |
22 | public void setProduct(Product product) {
23 | this.product = product;
24 | }
25 |
26 | @GraphQLQuery(name = "stockSize")
27 | public long getStockSize() {
28 | return stockSize;
29 | }
30 |
31 | public void setStockSize(long stockSize) {
32 | this.stockSize = stockSize;
33 | }
34 |
35 | @Override
36 | public boolean equals(Object o) {
37 | if (this == o) return true;
38 | if (o == null || getClass() != o.getClass()) return false;
39 |
40 | ProductInStock that = (ProductInStock) o;
41 |
42 | return product != null ? product.equals(that.product) : that.product == null;
43 |
44 | }
45 |
46 | @Override
47 | public int hashCode() {
48 | return product != null ? product.hashCode() : 0;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/SocialNetworkAccount.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | public class SocialNetworkAccount {
6 | private String networkName;
7 | private String username;
8 | private Long numberOfConnections;
9 |
10 | @GraphQLQuery(name = "networkName")
11 | public String getNetworkName() {
12 | return networkName;
13 | }
14 |
15 | public void setNetworkName(String networkName) {
16 | this.networkName = networkName;
17 | }
18 |
19 | @GraphQLQuery(name = "username")
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | @GraphQLQuery(name = "numberOfConnections")
29 | public Long getNumberOfConnections() {
30 | return numberOfConnections;
31 | }
32 |
33 | public void setNumberOfConnections(Long numberOfConnections) {
34 | this.numberOfConnections = numberOfConnections;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/dto/Vendor.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.dto;
2 |
3 | import io.leangen.graphql.annotations.GraphQLQuery;
4 |
5 | import java.util.HashSet;
6 | import java.util.Set;
7 |
8 | public class Vendor {
9 | private Long id;
10 | private String name;
11 | private Address address;
12 | private Set productsInStock;
13 |
14 | public Vendor(){
15 | productsInStock = new HashSet();
16 | }
17 |
18 | public Vendor(Long id, String name, Address address) {
19 | this.id = id;
20 | this.name = name;
21 | this.address = address;
22 | productsInStock = new HashSet();
23 | }
24 |
25 | public Vendor(String name, Address address) {
26 | this.id = null;
27 | this.name = name;
28 | this.address = address;
29 | productsInStock = new HashSet();
30 | }
31 |
32 | @GraphQLQuery(name = "id")
33 | public Long getId() {
34 | return id;
35 | }
36 |
37 | public void setId(Long id) {
38 | this.id = id;
39 | }
40 |
41 | @GraphQLQuery(name = "name")
42 | public String getName() {
43 | return name;
44 | }
45 |
46 | public void setName(String name) {
47 | this.name = name;
48 | }
49 |
50 | @GraphQLQuery(name = "address")
51 | public Address getAddress() {
52 | return address;
53 | }
54 |
55 | public void setAddress(Address address) {
56 | this.address = address;
57 | }
58 |
59 | public void setProductsInStock(Set productsInStock) {
60 | this.productsInStock = productsInStock;
61 | }
62 |
63 | @Override
64 | public boolean equals(Object o) {
65 | if (this == o) return true;
66 | if (o == null || getClass() != o.getClass()) return false;
67 |
68 | Vendor vendor = (Vendor) o;
69 |
70 | return id != null ? id.equals(vendor.id) : vendor.id == null;
71 |
72 | }
73 |
74 | @Override
75 | public int hashCode() {
76 | return id != null ? id.hashCode() : 0;
77 | }
78 |
79 | @GraphQLQuery(name = "productsInStock")
80 | public Set getProductsInStock() {
81 | return productsInStock;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/query/annotated/PersonQuery.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.query.annotated;
2 |
3 | import io.leangen.graphql.annotations.GraphQLArgument;
4 | import io.leangen.graphql.annotations.GraphQLQuery;
5 | import io.leangen.spqr.samples.demo.dto.Customer;
6 | import io.leangen.spqr.samples.demo.dto.Person;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 | import java.util.stream.Collectors;
12 |
13 | @Component
14 | public class PersonQuery {
15 | /**
16 | * Hello world greeting.
17 | *
18 | * Invoke with:
19 | * {greeting(Person: {firstName: "John", lastName: "Doe"})}
20 | *
21 | * @param person Person to greet
22 | * @return Hello string
23 | */
24 | @GraphQLQuery(name = "greeting")
25 | public String getGreeting(@GraphQLArgument(name = "Person", description = "Person to greet.")
26 | final Person person){
27 | return "Hello "+ person.getFirstName()+"!";
28 | }
29 |
30 |
31 | /**
32 | * Hello world polite greeting.
33 | *
34 | * Invoke with:
35 | * {greeting(Customer: {firstName: "John", lastName: "Doe", title: MR})}
36 | *
37 | * @param customer Customer to greet politely
38 | * @return Informal hello string
39 | */
40 | @GraphQLQuery(name = "greeting")
41 | public String getGreeting(@GraphQLArgument(name = "Customer", description = "Customer to greet.")
42 | final Customer customer){
43 | return "Hello "+ customer.getPersonalTitle()+" "+customer.getLastName()+"!";
44 | }
45 |
46 |
47 | /**
48 | * Getting first N elements of a mock list of users
49 | *
50 | * Invoke with:
51 | * {firstNPersons(count: 5) {firstName, lastName}}
52 | *
53 | * @param count max number of elements
54 | * @return first persons
55 | */
56 | @GraphQLQuery(name = "firstNPersons")
57 | public List getFirstNPersons(@GraphQLArgument(name = "count") int count){
58 | List result = new ArrayList<>();
59 |
60 | Person p1 = new Person();
61 | p1.setFirstName("John");
62 | p1.setLastName("Doe");
63 | result.add(p1);
64 |
65 | Person p2 = new Person();
66 | p2.setFirstName("Jane");
67 | p2.setLastName("Doe");
68 | result.add(p2);
69 |
70 | return result.stream().limit(count).collect(Collectors.toList());
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/query/annotated/SocialNetworkQuery.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.query.annotated;
2 |
3 | import io.leangen.graphql.annotations.GraphQLContext;
4 | import io.leangen.graphql.annotations.GraphQLQuery;
5 | import io.leangen.spqr.samples.demo.dto.Person;
6 | import io.leangen.spqr.samples.demo.dto.SocialNetworkAccount;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.LinkedHashSet;
10 | import java.util.Random;
11 | import java.util.Set;
12 |
13 | @Component
14 | public class SocialNetworkQuery {
15 | private Random random;
16 |
17 | public SocialNetworkQuery() {
18 | random = new Random();
19 | }
20 |
21 | /**
22 | * Attaching an external query to the domain object result
23 | * (e.g. adding a set of SocialNetworkAccounts to a Person)
24 | *
25 | * Invoke with:
26 | * {firstNPersons(count: 5) {firstName, lastName, socialNetworkAccounts{networkName, username, numberOfConnections}}}
27 | *
28 | * @param person
29 | * @return
30 | */
31 | @GraphQLQuery(name = "socialNetworkAccounts")
32 | public Set getSocialNetworkAccounts(
33 | @GraphQLContext Person person) throws InterruptedException {
34 | Set mockResult = new LinkedHashSet<>();
35 |
36 | SocialNetworkAccount twitterAccount = new SocialNetworkAccount();
37 | twitterAccount.setNetworkName("Twitter");
38 | twitterAccount.setUsername(generateMockUsername(person.getFirstName()));
39 | twitterAccount.setNumberOfConnections(250L);
40 | mockResult.add(twitterAccount);
41 |
42 | SocialNetworkAccount facebookAcount = new SocialNetworkAccount();
43 | facebookAcount.setNetworkName("Facebook");
44 | facebookAcount.setUsername(generateMockUsername(person.getLastName()));
45 | facebookAcount.setNumberOfConnections(2311L);
46 | mockResult.add(facebookAcount);
47 |
48 | //Mocking slow external API access
49 | Thread.sleep(1000L);
50 |
51 | return mockResult;
52 | }
53 |
54 | private String generateMockUsername(String base){
55 | final int randomSuffix = 100 + this.random.nextInt(899);
56 | return base+randomSuffix;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/query/annotated/VendorQuery.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.query.annotated;
2 |
3 | import io.leangen.graphql.annotations.GraphQLArgument;
4 | import io.leangen.graphql.annotations.GraphQLMutation;
5 | import io.leangen.graphql.annotations.GraphQLQuery;
6 | import io.leangen.spqr.samples.demo.dto.Vendor;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.LinkedHashSet;
10 | import java.util.Optional;
11 | import java.util.Set;
12 | import java.util.stream.Collectors;
13 |
14 | @Component
15 | public class VendorQuery {
16 | private Set mockVendorStorage;
17 |
18 | public VendorQuery() {
19 | mockVendorStorage = new LinkedHashSet<>();
20 | }
21 |
22 | /**
23 | * Save new Vendor.
24 | *
25 | * Invoke with:
26 | * mutation NewVendorMutation{createVendor(vendor:{name: "vendor0", address:{ country: "Netherlands", city: "Amsterdam", streetAndNumber: "Damrak 1", postalCode: "2000XX"}}){id, name, address{streetAndNumber}, productsInStock{product{name}}}}
27 | *
28 | * @param vendor
29 | * @return
30 | */
31 | @GraphQLMutation(name = "createVendor")
32 | public Vendor createVendor(@GraphQLArgument(name = "vendor") Vendor vendor){
33 | Vendor createdVendor = new Vendor((long) mockVendorStorage.size() + 1,
34 | vendor.getName(),
35 | vendor.getAddress());
36 | mockVendorStorage.add(createdVendor);
37 | return createdVendor;
38 | }
39 |
40 |
41 | /**
42 | * Retrieve saved Vendor by id.
43 | * Invoke after you get an id from the createVendor mutation.
44 | *
45 | * Invoke with
46 | * {vendorById(id:0){name,address{postalCode}}}
47 | *
48 | * @param id
49 | * @return
50 | */
51 | @GraphQLQuery(name = "vendorById")
52 | public Vendor getVendor(@GraphQLArgument(name = "id") Long id){
53 | final Optional searchResult = this.mockVendorStorage.stream()
54 | .filter(vendor -> vendor.getId().equals(id))
55 | .findFirst();
56 | return searchResult.orElseThrow(()->new RuntimeException("Vendor not found"));
57 | }
58 |
59 |
60 | /**
61 | * Retrieves a set of Vendors with a same name.
62 | *
63 | * Invoke with:
64 | * {vendorsByName(name:"vendor0"){id, name, address{postalCode}}}
65 | *
66 | * @param name
67 | * @return
68 | */
69 | @GraphQLQuery(name = "vendorsByName")
70 | public Set getVendors(@GraphQLArgument(name = "name") String name){
71 | return this.mockVendorStorage.stream()
72 | .filter(vendor -> vendor.getName().equals(name))
73 | .collect(Collectors.toSet());
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/query/unannotated/DomainQuery.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.query.unannotated;
2 |
3 | import io.leangen.spqr.samples.demo.dto.Customer;
4 | import io.leangen.spqr.samples.demo.dto.Person;
5 | import org.springframework.stereotype.Component;
6 |
7 | @Component
8 | public class DomainQuery {
9 | /**
10 | * Hello world greeting.
11 | *
12 | * Invoke with:
13 | * {getNormalGreeting(person: {firstName: "John", lastName: "Doe"})}
14 | *
15 | * @param person Person to greet
16 | * @return Informal hello string
17 | */
18 | public String getNormalGreeting(final Person person){
19 | return "Hello "+ person.getFirstName()+"!";
20 | }
21 |
22 |
23 | /**
24 | * Hello world polite greeting.
25 | *
26 | * Invoke with:
27 | * {getPoliteGreeting(customer: {firstName: "John", lastName: "Doe", title: MR})}
28 | *
29 | * @param customer Customer to greet politely
30 | * @return Formal hello string
31 | */
32 | public String getPoliteGreeting(final Customer customer){
33 | return "Hello "+ customer.getPersonalTitle()+" "+customer.getLastName()+"!";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/java/io/leangen/spqr/samples/demo/query/unannotated/ProductQuery.java:
--------------------------------------------------------------------------------
1 | package io.leangen.spqr.samples.demo.query.unannotated;
2 |
3 | import io.leangen.spqr.samples.demo.dto.Product;
4 | import io.leangen.spqr.samples.demo.dto.ProductInStock;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.HashSet;
8 | import java.util.Set;
9 |
10 | @Component
11 | public class ProductQuery {
12 |
13 | /**
14 | * Fetching a mock list of a vendor's products in stock
15 | *
16 | * Invoke with:
17 | * {getProductsInStock(vendorId: 2){product{name, description},stockSize}}
18 | *
19 | * @param vendorId
20 | * @return
21 | */
22 | public Set getProductsInStock(Long vendorId){
23 | Set mockResult = new HashSet<>();
24 | Product product1 = new Product(0L,"MockProduct1", "Product 1 description");
25 | mockResult.add(new ProductInStock(product1, 10L));
26 | Product product2 = new Product(1L,"MockProduct2", "Product 2 description");
27 | mockResult.add(new ProductInStock(product2, 20L));
28 |
29 | return mockResult;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 7777
3 |
4 | spring:
5 | resources:
6 | static-locations: classpath:/static/
7 | logging:
8 | level:
9 | ROOT: warn
10 | io.leangen: debug
11 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | ]╫Nw ,gN╦
2 | `╙Ñ░╫N╥ ,╥Ñ░╦╩^
3 | `╨Ñ░Ñ╦, ,«]░░Ñ^
4 | "╨╫░Ñ╦, ╓]╫░Ñ*`
5 | ╔╦╥ "╩╫░N≥. ╥╦╫░Ñ╨² ²g,
6 | `╙╩░╫Nw `"╩░░N╥ ²╦Ñ░Ñ╨` ,gÑ░╫╩`
7 | `╙Ñ░ÑN╥ `╙Ñ░╫Nw ,gÑ░╫╩^ ,╥]░░╩^
8 | "╨Ñ░Ñ╦, `╙Ñ░╫N╥ ,╥Ñ░░╩^ .«]╦░Ñ^
9 | ,≈, "╩╫░Ñ╦, `╨Ñ░Ñ╦, ,«]░░Ñ^ ,╥]╫░Ñ*` ,
10 | "╩░░N╥. "╩╫░N╥. "╨╫░N╦Ñ░░ÑN]╫░Ñ*` ╥╦╫░Ñ╨` ,╦╫░Ñ╨
11 | `╙╩░░Nw `╙╩░░Nw ]░░░░░░░` ²╦Ñ░Ñ╨^ ,╦Ñ░Ñ╨^
12 | `╙Ñ░╫Nw `╙Ñ░╫Nw ,g╫░░░░░░░Nw ,gÑ░╫╩^ ,gÑ░╫╩^
13 | , ²╨Ñ░ÑN, ²╨╫░ÑÑ░╫╩^ "╙╨*``╙Ñ░╫N░░Ñ^ ,«]░░╩^
14 | ╚╫░N≥, "╨╫░Ñ╦dÑ░░╫N«]░░Ñ^ `╨Ñ░Ñ╦╥]╫ÑNw«]╫░Ñ*` ╥]╫░R
15 | "╩╫░N╥. "░░░░░░░░*` "░░░░░░░░*` ╥╦╫░Ñ╨²
16 | `"╩░░Nw ╙░░░░░░M ]░░░░░░H ²╦Ñ░Ñ╨`
17 | `╙Ñ░╫Nw "░░░ `╨░░╨` ,gÑ░╫╩^
18 | ]░Ñ╦, `╙Ñ░ÑN╥ ░░H ░░ ,╥]░░╩^ .«]░N
19 | "╨╫░Ñ╦, "╨╫░Ñ░░H ░░N╫░Ñ^ ,«]╫░Ñ*`
20 | "╩╫░N╥. "░░H ░░H` ╥╦╫░Ñ╨²
21 | `"╩░░N╥ ░░U ░░H ²╦Ñ░Ñ╨`
22 | `╙Ñ░╫Nw ╥g░░U ░░N, ,gÑ░╫╩^
23 | `╙Ñ░░░░░░Ñ j░░░░░░╫╩^
24 | ]░░░░░░░w .░░░░░░░Ñ
25 | ,«]╦░Ñ╫░╫╩╩╫░Ñ╦, ,╥]╫░Ñ╩░░░Ñ╫░Ñ╦.
26 | ╙╩*` ²]░░░N╥. ╥╦╫░░░░ "╨^
27 | ,╦Ñ░Ñ╨``╙Ñ░░NÑ░░░ÑÑ░╦╩^`^╩░░Nw
28 | ,gÑ░╫╩^ ]░░░░░░░H `╙Ñ░╫Nw
29 | ,gÑ░╫╩^ ,«]╫░░░░░░░Ñ╦, `╙Ñ░╫N╥
30 | ╙╦╩^ ,╥]╫░Ñ*` `"^^ "╨╫░Ñ╦² `╨Ñ*
31 | ╥╦╫░Ñ╨² "╩╫░N≥.
32 | ,╦Ñ░Ñ╨` "╩░░N╥
33 | ,gÑ░Ñ╨^ `╙╩░╦Nw
34 | j░╫╩^ `╙Ñ░H
35 |
36 | .,,, .,,,,. ,²². .,.,,.
37 | ]╫^ `]╡ ]░```╙Ѳ ╓Ñ^ `╨N ]░```╙Ñ
38 | 1░w ]░ ░H ]░ ]╫ ]░ ,░H
39 | `"╨ÑÑ╦ ]░≈≈gÑ╨ ]░ ]░ ]░ºº╫░`
40 | , ]░ ]░ ²░, ÑH ]░ Ѽ
41 | ]Ñ≈╥╥╦Ñ` ,]░╥ `╩Nw╥╥gÑ` ,]░, ÑN²
42 | `╙1≥ ,
43 | `^^
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/core/js/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.4 (http://getbootstrap.com)
3 | * Copyright 2011-2015 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.4",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.4",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.4",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.4",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)&&!/input|textarea/i.test(b.target.tagName)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g&&27!=b.which||g&&27==b.which)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(b.target);38==b.which&&j>0&&j--,40==b.which&&j').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-mp.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.4",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.4",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.4",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a(document.body).height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/graphiql/css/graphiql.css:
--------------------------------------------------------------------------------
1 | #graphiql-container {
2 | color: #141823;
3 | display: flex;
4 | display: -webkit-flex;
5 | flex-direction: row;
6 | -webkit-flex-direction: row;
7 | font-family:
8 | system,
9 | -apple-system,
10 | 'San Francisco',
11 | '.SFNSDisplay-Regular',
12 | 'Segoe UI',
13 | Segoe,
14 | 'Segoe WP',
15 | 'Helvetica Neue',
16 | helvetica,
17 | 'Lucida Grande',
18 | arial,
19 | sans-serif;
20 | font-size: 14px;
21 | height: 100%;
22 | margin: 0;
23 | overflow: hidden;
24 | width: 100%;
25 | }
26 |
27 | #graphiql-container .editorWrap {
28 | display: -webkit-flex;
29 | display: flex;
30 | -webkit-flex-direction: column;
31 | flex-direction: column;
32 | -webkit-flex: 1;
33 | flex: 1;
34 | }
35 |
36 | #graphiql-container .title {
37 | font-size: 18px;
38 | }
39 |
40 | #graphiql-container .title em {
41 | font-family: georgia;
42 | font-size: 19px;
43 | }
44 |
45 | #graphiql-container .topBarWrap {
46 | display: -webkit-flex;
47 | display: flex;
48 | -webkit-flex-direction: row;
49 | flex-direction: row;
50 | }
51 |
52 | #graphiql-container .topBar {
53 | -webkit-align-items: center;
54 | align-items: center;
55 | background: -webkit-linear-gradient(#f7f7f7, #e2e2e2);
56 | background: linear-gradient(#f7f7f7, #e2e2e2);
57 | border-bottom: 1px solid #d0d0d0;
58 | cursor: default;
59 | display: -webkit-flex;
60 | display: flex;
61 | height: 34px;
62 | padding: 7px 14px 6px;
63 | -webkit-flex: 1;
64 | flex: 1;
65 | -webkit-flex-direction: row;
66 | flex-direction: row;
67 | -webkit-user-select: none;
68 | user-select: none;
69 | }
70 |
71 | #graphiql-container .toolbar {
72 | overflow-x: auto;
73 | }
74 |
75 | #graphiql-container .docExplorerShow {
76 | background: -webkit-linear-gradient(#f7f7f7, #e2e2e2);
77 | background: linear-gradient(#f7f7f7, #e2e2e2);
78 | border-bottom: 1px solid #d0d0d0;
79 | border-left: 1px solid rgba(0, 0, 0, 0.2);
80 | border-right: none;
81 | border-top: none;
82 | color: #3B5998;
83 | cursor: pointer;
84 | font-size: 14px;
85 | outline: 0;
86 | margin: 0;
87 | padding: 2px 20px 0 18px;
88 | }
89 |
90 | #graphiql-container .docExplorerShow:before {
91 | border-left: 2px solid #3B5998;
92 | border-top: 2px solid #3B5998;
93 | content: '';
94 | display: inline-block;
95 | height: 9px;
96 | margin: 0 3px -1px 0;
97 | position: relative;
98 | -webkit-transform: rotate(-45deg);
99 | transform: rotate(-45deg);
100 | width: 9px;
101 | }
102 |
103 | #graphiql-container .editorBar {
104 | display: -webkit-flex;
105 | display: flex;
106 | -webkit-flex: 1;
107 | flex: 1;
108 | -webkit-flex-direction: row;
109 | flex-direction: row;
110 | }
111 |
112 | #graphiql-container .queryWrap {
113 | display: -webkit-flex;
114 | display: flex;
115 | -webkit-flex: 1;
116 | flex: 1;
117 | -webkit-flex-direction: column;
118 | flex-direction: column;
119 | }
120 |
121 | #graphiql-container .resultWrap {
122 | border-left: solid 1px #e0e0e0;
123 | display: -webkit-flex;
124 | display: flex;
125 | position: relative;
126 | -webkit-flex: 1;
127 | flex: 1;
128 | -webkit-flex-direction: column;
129 | flex-direction: column;
130 | }
131 |
132 | #graphiql-container .docExplorerWrap {
133 | background: white;
134 | box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
135 | position: relative;
136 | z-index: 3;
137 | }
138 |
139 | #graphiql-container .docExplorerResizer {
140 | cursor: col-resize;
141 | height: 100%;
142 | left: -5px;
143 | position: absolute;
144 | top: 0;
145 | width: 10px;
146 | z-index: 10;
147 | }
148 |
149 | #graphiql-container .docExplorerHide {
150 | cursor: pointer;
151 | font-size: 18px;
152 | margin: -7px -8px -6px 0;
153 | padding: 18px 16px 15px 12px;
154 | }
155 |
156 | #graphiql-container .query-editor {
157 | -webkit-flex: 1;
158 | flex: 1;
159 | position: relative;
160 | }
161 |
162 | #graphiql-container .variable-editor {
163 | display: -webkit-flex;
164 | display: flex;
165 | height: 29px;
166 | -webkit-flex-direction: column;
167 | flex-direction: column;
168 | position: relative;
169 | }
170 |
171 | #graphiql-container .variable-editor-title {
172 | background: #eeeeee;
173 | border-bottom: 1px solid #d6d6d6;
174 | border-top: 1px solid #e0e0e0;
175 | color: #777;
176 | font-variant: small-caps;
177 | font-weight: bold;
178 | letter-spacing: 1px;
179 | line-height: 14px;
180 | padding: 6px 0 8px 43px;
181 | text-transform: lowercase;
182 | -webkit-user-select: none;
183 | user-select: none;
184 | }
185 |
186 | #graphiql-container .codemirrorWrap {
187 | -webkit-flex: 1;
188 | flex: 1;
189 | position: relative;
190 | }
191 |
192 | #graphiql-container .result-window {
193 | -webkit-flex: 1;
194 | flex: 1;
195 | position: relative;
196 | }
197 |
198 | #graphiql-container .footer {
199 | background: #f6f7f8;
200 | border-left: 1px solid #e0e0e0;
201 | border-top: 1px solid #e0e0e0;
202 | margin-left: 12px;
203 | position: relative;
204 | }
205 |
206 | #graphiql-container .footer:before {
207 | background: #eeeeee;
208 | bottom: 0;
209 | content: " ";
210 | left: -13px;
211 | position: absolute;
212 | top: -1px;
213 | width: 12px;
214 | }
215 |
216 | #graphiql-container .result-window .CodeMirror {
217 | background: #f6f7f8;
218 | }
219 |
220 | #graphiql-container .result-window .CodeMirror-gutters {
221 | background-color: #eeeeee;
222 | border-color: #e0e0e0;
223 | cursor: col-resize;
224 | }
225 |
226 | #graphiql-container .result-window .CodeMirror-foldgutter,
227 | #graphiql-container .result-window .CodeMirror-foldgutter-open:after,
228 | #graphiql-container .result-window .CodeMirror-foldgutter-folded:after {
229 | padding-left: 3px;
230 | }
231 |
232 | #graphiql-container .toolbar-button {
233 | background: #fdfdfd;
234 | background: -webkit-linear-gradient(#fbfbfb, #f8f8f8);
235 | background: linear-gradient(#fbfbfb, #f8f8f8);
236 | border-width: 0.5px;
237 | border-style: solid;
238 | border-color: #d3d3d3 #d0d0d0 #bababa;
239 | border-radius: 4px;
240 | box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.13), inset 0 1px #fff;
241 | color: #444;
242 | cursor: pointer;
243 | display: inline-block;
244 | margin: 0 5px 0;
245 | padding: 2px 8px 4px;
246 | text-decoration: none;
247 | }
248 |
249 | #graphiql-container .toolbar-button:active {
250 | background: -webkit-linear-gradient(#ececec, #d8d8d8);
251 | background: linear-gradient(#ececec, #d8d8d8);
252 | border-color: #cacaca #c9c9c9 #b0b0b0;
253 | box-shadow:
254 | 0 1px 0 #fff,
255 | inset 0 1px rgba(255, 255, 255, 0.2),
256 | inset 0 1px 1px rgba(0, 0, 0, 0.08);
257 | }
258 |
259 | #graphiql-container .toolbar-button.error {
260 | background: -webkit-linear-gradient(#fdf3f3, #e6d6d7);
261 | background: linear-gradient(#fdf3f3, #e6d6d7);
262 | color: #b00;
263 | }
264 |
265 | #graphiql-container .execute-button-wrap {
266 | position: relative;
267 | margin: 0 14px 0 28px;
268 | height: 34px;
269 | }
270 |
271 | #graphiql-container .execute-button {
272 | background: -webkit-linear-gradient(#fdfdfd, #d2d3d6);
273 | background: linear-gradient(#fdfdfd, #d2d3d6);
274 | border: 1px solid rgba(0,0,0,0.25);
275 | border-radius: 17px;
276 | box-shadow: 0 1px 0 #fff;
277 | cursor: pointer;
278 | fill: #444;
279 | height: 34px;
280 | margin: 0;
281 | padding: 0;
282 | width: 34px;
283 | }
284 |
285 | #graphiql-container .execute-button svg {
286 | pointer-events: none;
287 | }
288 |
289 | #graphiql-container .execute-button:active {
290 | background: -webkit-linear-gradient(#e6e6e6, #c0c0c0);
291 | background: linear-gradient(#e6e6e6, #c0c0c0);
292 | box-shadow:
293 | 0 1px 0 #fff,
294 | inset 0 0 2px rgba(0, 0, 0, 0.3),
295 | inset 0 0 6px rgba(0, 0, 0, 0.2);
296 | }
297 |
298 | #graphiql-container .execute-button:focus {
299 | outline: 0;
300 | }
301 |
302 | #graphiql-container .execute-options {
303 | background: #fff;
304 | box-shadow:
305 | 0 0 0 1px rgba(0,0,0,0.1),
306 | 0 2px 4px rgba(0,0,0,0.25);
307 | left: -1px;
308 | margin: 0;
309 | padding: 8px 0;
310 | position: absolute;
311 | top: 37px;
312 | z-index: 100;
313 | }
314 |
315 | #graphiql-container .execute-options li {
316 | padding: 2px 30px 4px 10px;
317 | list-style: none;
318 | min-width: 100px;
319 | cursor: pointer;
320 | }
321 |
322 | #graphiql-container .execute-options li.selected {
323 | background: #e10098;
324 | color: white;
325 | }
326 |
327 | #graphiql-container .CodeMirror-scroll {
328 | -webkit-overflow-scrolling: touch;
329 | }
330 |
331 | #graphiql-container .CodeMirror {
332 | color: #141823;
333 | font-family:
334 | 'Consolas',
335 | 'Inconsolata',
336 | 'Droid Sans Mono',
337 | 'Monaco',
338 | monospace;
339 | font-size: 13px;
340 | height: 100%;
341 | left: 0;
342 | position: absolute;
343 | top: 0;
344 | width: 100%;
345 | }
346 |
347 | #graphiql-container .CodeMirror-lines {
348 | padding: 20px 0;
349 | }
350 |
351 | .CodeMirror-hint-information .content {
352 | -webkit-box-orient: vertical;
353 | box-orient: vertical;
354 | color: #141823;
355 | display: -webkit-box;
356 | font-family: system, -apple-system, 'San Francisco', '.SFNSDisplay-Regular', 'Segoe UI', Segoe, 'Segoe WP', 'Helvetica Neue', helvetica, 'Lucida Grande', arial, sans-serif;
357 | font-size: 13px;
358 | -webkit-line-clamp: 3;
359 | line-clamp: 3;
360 | line-height: 16px;
361 | max-height: 48px;
362 | overflow: hidden;
363 | text-overflow: -o-ellipsis-lastline;
364 | }
365 |
366 | .CodeMirror-hint-information .content p:first-child {
367 | margin-top: 0;
368 | }
369 |
370 | .CodeMirror-hint-information .content p:last-child {
371 | margin-bottom: 0;
372 | }
373 |
374 | .CodeMirror-hint-information .infoType {
375 | color: #30a;
376 | cursor: pointer;
377 | display: inline;
378 | margin-right: 0.5em;
379 | }
380 |
381 | .autoInsertedLeaf.cm-property {
382 | -webkit-animation-duration: 6s;
383 | -moz-animation-duration: 6s;
384 | animation-duration: 6s;
385 | -webkit-animation-name: insertionFade;
386 | -moz-animation-name: insertionFade;
387 | animation-name: insertionFade;
388 | border-bottom: 2px solid rgba(255, 255, 255, 0);
389 | border-radius: 2px;
390 | margin: -2px -4px -1px;
391 | padding: 2px 4px 1px;
392 | }
393 |
394 | @-moz-keyframes insertionFade {
395 | from, to {
396 | background: rgba(255, 255, 255, 0);
397 | border-color: rgba(255, 255, 255, 0);
398 | }
399 |
400 | 15%, 85% {
401 | background: #fbffc9;
402 | border-color: #f0f3c0;
403 | }
404 | }
405 |
406 | @-webkit-keyframes insertionFade {
407 | from, to {
408 | background: rgba(255, 255, 255, 0);
409 | border-color: rgba(255, 255, 255, 0);
410 | }
411 |
412 | 15%, 85% {
413 | background: #fbffc9;
414 | border-color: #f0f3c0;
415 | }
416 | }
417 |
418 | @keyframes insertionFade {
419 | from, to {
420 | background: rgba(255, 255, 255, 0);
421 | border-color: rgba(255, 255, 255, 0);
422 | }
423 |
424 | 15%, 85% {
425 | background: #fbffc9;
426 | border-color: #f0f3c0;
427 | }
428 | }
429 |
430 | div.CodeMirror-lint-tooltip {
431 | background-color: white;
432 | border: 0;
433 | border-radius: 2px;
434 | color: #141823;
435 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
436 | font-family:
437 | system,
438 | -apple-system,
439 | 'San Francisco',
440 | '.SFNSDisplay-Regular',
441 | 'Segoe UI',
442 | Segoe,
443 | 'Segoe WP',
444 | 'Helvetica Neue',
445 | helvetica,
446 | 'Lucida Grande',
447 | arial,
448 | sans-serif;
449 | font-size: 13px;
450 | line-height: 16px;
451 | opacity: 0;
452 | padding: 6px 10px;
453 | -webkit-transition: opacity 0.15s;
454 | -moz-transition: opacity 0.15s;
455 | -ms-transition: opacity 0.15s;
456 | -o-transition: opacity 0.15s;
457 | transition: opacity 0.15s;
458 | }
459 |
460 | div.CodeMirror-lint-message-error, div.CodeMirror-lint-message-warning {
461 | padding-left: 23px;
462 | }
463 |
464 | /* COLORS */
465 |
466 | #graphiql-container .CodeMirror-foldmarker {
467 | border-radius: 4px;
468 | background: #08f;
469 | background: -webkit-linear-gradient(#43A8FF, #0F83E8);
470 | background: linear-gradient(#43A8FF, #0F83E8);
471 | box-shadow:
472 | 0 1px 1px rgba(0, 0, 0, 0.2),
473 | inset 0 0 0 1px rgba(0, 0, 0, 0.1);
474 | color: white;
475 | font-family: arial;
476 | font-size: 12px;
477 | line-height: 0;
478 | margin: 0 3px;
479 | padding: 0px 4px 1px;
480 | text-shadow: 0 -1px rgba(0, 0, 0, 0.1);
481 | }
482 |
483 | #graphiql-container div.CodeMirror span.CodeMirror-matchingbracket {
484 | color: #555;
485 | text-decoration: underline;
486 | }
487 |
488 | #graphiql-container div.CodeMirror span.CodeMirror-nonmatchingbracket {
489 | color: #f00;
490 | }
491 |
492 | /* Comment */
493 | .cm-comment {
494 | color: #999;
495 | }
496 |
497 | /* Punctuation */
498 | .cm-punctuation {
499 | color: #555;
500 | }
501 |
502 | /* Keyword */
503 | .cm-keyword {
504 | color: #B11A04;
505 | }
506 |
507 | /* OperationName, FragmentName */
508 | .cm-def {
509 | color: #D2054E;
510 | }
511 |
512 | /* FieldName */
513 | .cm-property {
514 | color: #1F61A0;
515 | }
516 |
517 | /* FieldAlias */
518 | .cm-qualifier {
519 | color: #1C92A9;
520 | }
521 |
522 | /* ArgumentName and ObjectFieldName */
523 | .cm-attribute {
524 | color: #8B2BB9;
525 | }
526 |
527 | /* Number */
528 | .cm-number {
529 | color: #2882F9;
530 | }
531 |
532 | /* String */
533 | .cm-string {
534 | color: #D64292;
535 | }
536 |
537 | /* Boolean */
538 | .cm-builtin {
539 | color: #D47509;
540 | }
541 |
542 | /* EnumValue */
543 | .cm-string-2 {
544 | color: #0B7FC7;
545 | }
546 |
547 | /* Variable */
548 | .cm-variable {
549 | color: #397D13;
550 | }
551 |
552 | /* Directive */
553 | .cm-meta {
554 | color: #B33086;
555 | }
556 |
557 | /* Type */
558 | .cm-atom {
559 | color: #CA9800;
560 | }
561 | /* BASICS */
562 |
563 | .CodeMirror {
564 | /* Set height, width, borders, and global font properties here */
565 | font-family: monospace;
566 | height: 300px;
567 | color: black;
568 | }
569 |
570 | /* PADDING */
571 |
572 | .CodeMirror-lines {
573 | padding: 4px 0; /* Vertical padding around content */
574 | }
575 | .CodeMirror pre {
576 | padding: 0 4px; /* Horizontal padding of content */
577 | }
578 |
579 | .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
580 | background-color: white; /* The little square between H and V scrollbars */
581 | }
582 |
583 | /* GUTTER */
584 |
585 | .CodeMirror-gutters {
586 | border-right: 1px solid #ddd;
587 | background-color: #f7f7f7;
588 | white-space: nowrap;
589 | }
590 | .CodeMirror-linenumbers {}
591 | .CodeMirror-linenumber {
592 | padding: 0 3px 0 5px;
593 | min-width: 20px;
594 | text-align: right;
595 | color: #999;
596 | white-space: nowrap;
597 | }
598 |
599 | .CodeMirror-guttermarker { color: black; }
600 | .CodeMirror-guttermarker-subtle { color: #999; }
601 |
602 | /* CURSOR */
603 |
604 | .CodeMirror div.CodeMirror-cursor {
605 | border-left: 1px solid black;
606 | }
607 | /* Shown when moving in bi-directional text */
608 | .CodeMirror div.CodeMirror-secondarycursor {
609 | border-left: 1px solid silver;
610 | }
611 | .CodeMirror.cm-fat-cursor div.CodeMirror-cursor {
612 | width: auto;
613 | border: 0;
614 | background: #7e7;
615 | }
616 | .CodeMirror.cm-fat-cursor div.CodeMirror-cursors {
617 | z-index: 1;
618 | }
619 |
620 | .cm-animate-fat-cursor {
621 | width: auto;
622 | border: 0;
623 | -webkit-animation: blink 1.06s steps(1) infinite;
624 | -moz-animation: blink 1.06s steps(1) infinite;
625 | animation: blink 1.06s steps(1) infinite;
626 | }
627 | @-moz-keyframes blink {
628 | 0% { background: #7e7; }
629 | 50% { background: none; }
630 | 100% { background: #7e7; }
631 | }
632 | @-webkit-keyframes blink {
633 | 0% { background: #7e7; }
634 | 50% { background: none; }
635 | 100% { background: #7e7; }
636 | }
637 | @keyframes blink {
638 | 0% { background: #7e7; }
639 | 50% { background: none; }
640 | 100% { background: #7e7; }
641 | }
642 |
643 | /* Can style cursor different in overwrite (non-insert) mode */
644 | div.CodeMirror-overwrite div.CodeMirror-cursor {}
645 |
646 | .cm-tab { display: inline-block; text-decoration: inherit; }
647 |
648 | .CodeMirror-ruler {
649 | border-left: 1px solid #ccc;
650 | position: absolute;
651 | }
652 |
653 | /* DEFAULT THEME */
654 |
655 | .cm-s-default .cm-keyword {color: #708;}
656 | .cm-s-default .cm-atom {color: #219;}
657 | .cm-s-default .cm-number {color: #164;}
658 | .cm-s-default .cm-def {color: #00f;}
659 | .cm-s-default .cm-variable,
660 | .cm-s-default .cm-punctuation,
661 | .cm-s-default .cm-property,
662 | .cm-s-default .cm-operator {}
663 | .cm-s-default .cm-variable-2 {color: #05a;}
664 | .cm-s-default .cm-variable-3 {color: #085;}
665 | .cm-s-default .cm-comment {color: #a50;}
666 | .cm-s-default .cm-string {color: #a11;}
667 | .cm-s-default .cm-string-2 {color: #f50;}
668 | .cm-s-default .cm-meta {color: #555;}
669 | .cm-s-default .cm-qualifier {color: #555;}
670 | .cm-s-default .cm-builtin {color: #30a;}
671 | .cm-s-default .cm-bracket {color: #997;}
672 | .cm-s-default .cm-tag {color: #170;}
673 | .cm-s-default .cm-attribute {color: #00c;}
674 | .cm-s-default .cm-header {color: blue;}
675 | .cm-s-default .cm-quote {color: #090;}
676 | .cm-s-default .cm-hr {color: #999;}
677 | .cm-s-default .cm-link {color: #00c;}
678 |
679 | .cm-negative {color: #d44;}
680 | .cm-positive {color: #292;}
681 | .cm-header, .cm-strong {font-weight: bold;}
682 | .cm-em {font-style: italic;}
683 | .cm-link {text-decoration: underline;}
684 | .cm-strikethrough {text-decoration: line-through;}
685 |
686 | .cm-s-default .cm-error {color: #f00;}
687 | .cm-invalidchar {color: #f00;}
688 |
689 | .CodeMirror-composing { border-bottom: 2px solid; }
690 |
691 | /* Default styles for common addons */
692 |
693 | div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
694 | div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
695 | .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
696 | .CodeMirror-activeline-background {background: #e8f2ff;}
697 |
698 | /* STOP */
699 |
700 | /* The rest of this file contains styles related to the mechanics of
701 | the editor. You probably shouldn't touch them. */
702 |
703 | .CodeMirror {
704 | position: relative;
705 | overflow: hidden;
706 | background: white;
707 | }
708 |
709 | .CodeMirror-scroll {
710 | overflow: scroll !important; /* Things will break if this is overridden */
711 | /* 30px is the magic margin used to hide the element's real scrollbars */
712 | /* See overflow: hidden in .CodeMirror */
713 | margin-bottom: -30px; margin-right: -30px;
714 | padding-bottom: 30px;
715 | height: 100%;
716 | outline: none; /* Prevent dragging from highlighting the element */
717 | position: relative;
718 | }
719 | .CodeMirror-sizer {
720 | position: relative;
721 | border-right: 30px solid transparent;
722 | }
723 |
724 | /* The fake, visible scrollbars. Used to force redraw during scrolling
725 | before actual scrolling happens, thus preventing shaking and
726 | flickering artifacts. */
727 | .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
728 | position: absolute;
729 | z-index: 6;
730 | display: none;
731 | }
732 | .CodeMirror-vscrollbar {
733 | right: 0; top: 0;
734 | overflow-x: hidden;
735 | overflow-y: scroll;
736 | }
737 | .CodeMirror-hscrollbar {
738 | bottom: 0; left: 0;
739 | overflow-y: hidden;
740 | overflow-x: scroll;
741 | }
742 | .CodeMirror-scrollbar-filler {
743 | right: 0; bottom: 0;
744 | }
745 | .CodeMirror-gutter-filler {
746 | left: 0; bottom: 0;
747 | }
748 |
749 | .CodeMirror-gutters {
750 | position: absolute; left: 0; top: 0;
751 | min-height: 100%;
752 | z-index: 3;
753 | }
754 | .CodeMirror-gutter {
755 | white-space: normal;
756 | height: 100%;
757 | display: inline-block;
758 | vertical-align: top;
759 | margin-bottom: -30px;
760 | /* Hack to make IE7 behave */
761 | *zoom:1;
762 | *display:inline;
763 | }
764 | .CodeMirror-gutter-wrapper {
765 | position: absolute;
766 | z-index: 4;
767 | background: none !important;
768 | border: none !important;
769 | }
770 | .CodeMirror-gutter-background {
771 | position: absolute;
772 | top: 0; bottom: 0;
773 | z-index: 4;
774 | }
775 | .CodeMirror-gutter-elt {
776 | position: absolute;
777 | cursor: default;
778 | z-index: 4;
779 | }
780 | .CodeMirror-gutter-wrapper {
781 | -webkit-user-select: none;
782 | -moz-user-select: none;
783 | user-select: none;
784 | }
785 |
786 | .CodeMirror-lines {
787 | cursor: text;
788 | min-height: 1px; /* prevents collapsing before first draw */
789 | }
790 | .CodeMirror pre {
791 | /* Reset some styles that the rest of the page might have set */
792 | -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
793 | border-width: 0;
794 | background: transparent;
795 | font-family: inherit;
796 | font-size: inherit;
797 | margin: 0;
798 | white-space: pre;
799 | word-wrap: normal;
800 | line-height: inherit;
801 | color: inherit;
802 | z-index: 2;
803 | position: relative;
804 | overflow: visible;
805 | -webkit-tap-highlight-color: transparent;
806 | -webkit-font-variant-ligatures: none;
807 | font-variant-ligatures: none;
808 | }
809 | .CodeMirror-wrap pre {
810 | word-wrap: break-word;
811 | white-space: pre-wrap;
812 | word-break: normal;
813 | }
814 |
815 | .CodeMirror-linebackground {
816 | position: absolute;
817 | left: 0; right: 0; top: 0; bottom: 0;
818 | z-index: 0;
819 | }
820 |
821 | .CodeMirror-linewidget {
822 | position: relative;
823 | z-index: 2;
824 | overflow: auto;
825 | }
826 |
827 | .CodeMirror-widget {}
828 |
829 | .CodeMirror-code {
830 | outline: none;
831 | }
832 |
833 | /* Force content-box sizing for the elements where we expect it */
834 | .CodeMirror-scroll,
835 | .CodeMirror-sizer,
836 | .CodeMirror-gutter,
837 | .CodeMirror-gutters,
838 | .CodeMirror-linenumber {
839 | -moz-box-sizing: content-box;
840 | box-sizing: content-box;
841 | }
842 |
843 | .CodeMirror-measure {
844 | position: absolute;
845 | width: 100%;
846 | height: 0;
847 | overflow: hidden;
848 | visibility: hidden;
849 | }
850 |
851 | .CodeMirror-cursor { position: absolute; }
852 | .CodeMirror-measure pre { position: static; }
853 |
854 | div.CodeMirror-cursors {
855 | visibility: hidden;
856 | position: relative;
857 | z-index: 3;
858 | }
859 | div.CodeMirror-dragcursors {
860 | visibility: visible;
861 | }
862 |
863 | .CodeMirror-focused div.CodeMirror-cursors {
864 | visibility: visible;
865 | }
866 |
867 | .CodeMirror-selected { background: #d9d9d9; }
868 | .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
869 | .CodeMirror-crosshair { cursor: crosshair; }
870 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
871 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
872 |
873 | .cm-searching {
874 | background: #ffa;
875 | background: rgba(255, 255, 0, .4);
876 | }
877 |
878 | /* IE7 hack to prevent it from returning funny offsetTops on the spans */
879 | .CodeMirror span { *vertical-align: text-bottom; }
880 |
881 | /* Used to force a border model for a node */
882 | .cm-force-border { padding-right: .1px; }
883 |
884 | @media print {
885 | /* Hide the cursor when printing */
886 | .CodeMirror div.CodeMirror-cursors {
887 | visibility: hidden;
888 | }
889 | }
890 |
891 | /* See issue #2901 */
892 | .cm-tab-wrap-hack:after { content: ''; }
893 |
894 | /* Help users use markselection to safely style text background */
895 | span.CodeMirror-selectedtext { background: none; }
896 | #graphiql-container .doc-explorer {
897 | background: white;
898 | }
899 |
900 | #graphiql-container .doc-explorer-title-bar {
901 | cursor: default;
902 | display: -webkit-flex;
903 | display: flex;
904 | height: 34px;
905 | line-height: 14px;
906 | padding: 8px 8px 5px;
907 | position: relative;
908 | -webkit-user-select: none;
909 | user-select: none;
910 | }
911 |
912 | #graphiql-container .doc-explorer-title {
913 | padding: 10px 0 10px 10px;
914 | font-weight: bold;
915 | text-align: center;
916 | text-overflow: ellipsis;
917 | white-space: nowrap;
918 | overflow-x: hidden;
919 | -webkit-flex: 1;
920 | flex: 1;
921 | }
922 |
923 | #graphiql-container .doc-explorer-back {
924 | color: #3B5998;
925 | cursor: pointer;
926 | margin: -7px 0 -6px -8px;
927 | overflow-x: hidden;
928 | padding: 17px 12px 16px 16px;
929 | text-overflow: ellipsis;
930 | white-space: nowrap;
931 | }
932 |
933 | #graphiql-container .doc-explorer-back:before {
934 | border-left: 2px solid #3B5998;
935 | border-top: 2px solid #3B5998;
936 | content: '';
937 | display: inline-block;
938 | height: 9px;
939 | margin: 0 3px -1px 0;
940 | position: relative;
941 | width: 9px;
942 | -webkit-transform: rotate(-45deg);
943 | transform: rotate(-45deg);
944 | }
945 |
946 | #graphiql-container .doc-explorer-rhs {
947 | position: relative;
948 | }
949 |
950 | #graphiql-container .doc-explorer-contents {
951 | background-color: #ffffff;
952 | border-top: 1px solid #d6d6d6;
953 | bottom: 0;
954 | left: 0;
955 | min-width: 300px;
956 | overflow-y: auto;
957 | padding: 20px 15px;
958 | position: absolute;
959 | right: 0;
960 | top: 47px;
961 | }
962 |
963 | #graphiql-container .doc-type-description p:first-child ,
964 | #graphiql-container .doc-type-description blockquote:first-child {
965 | margin-top: 0;
966 | }
967 |
968 | #graphiql-container .doc-explorer-contents a {
969 | cursor: pointer;
970 | text-decoration: none;
971 | }
972 |
973 | #graphiql-container .doc-explorer-contents a:hover {
974 | text-decoration: underline;
975 | }
976 |
977 | #graphiql-container .doc-value-description {
978 | padding: 4px 0 8px 12px;
979 | }
980 |
981 | #graphiql-container .doc-category {
982 | margin: 20px 0;
983 | }
984 |
985 | #graphiql-container .doc-category-title {
986 | border-bottom: 1px solid #e0e0e0;
987 | color: #777;
988 | cursor: default;
989 | font-size: 14px;
990 | font-variant: small-caps;
991 | font-weight: bold;
992 | letter-spacing: 1px;
993 | margin: 0 -15px 10px 0;
994 | padding: 10px 0;
995 | -webkit-user-select: none;
996 | user-select: none;
997 | }
998 |
999 | #graphiql-container .doc-category-item {
1000 | margin: 12px 0;
1001 | color: #555;
1002 | }
1003 |
1004 | #graphiql-container .keyword {
1005 | color: #B11A04;
1006 | }
1007 |
1008 | #graphiql-container .type-name {
1009 | color: #CA9800;
1010 | }
1011 |
1012 | #graphiql-container .field-name {
1013 | color: #1F61A0;
1014 | }
1015 |
1016 | #graphiql-container .value-name {
1017 | color: #0B7FC7;
1018 | }
1019 |
1020 | #graphiql-container .arg-name {
1021 | color: #8B2BB9;
1022 | }
1023 |
1024 | #graphiql-container .arg:after {
1025 | content: ', ';
1026 | }
1027 |
1028 | #graphiql-container .arg:last-child:after {
1029 | content: '';
1030 | }
1031 |
1032 | #graphiql-container .doc-alert-text {
1033 | color: #F00F00;
1034 | font-family: 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace;
1035 | font-size: 13px;
1036 | }
1037 |
1038 | #graphiql-container .search-box-outer {
1039 | border: 1px solid #d3d6db;
1040 | box-sizing: border-box;
1041 | display: inline-block;
1042 | font-size: 12px;
1043 | height: 24px;
1044 | margin-bottom: 12px;
1045 | padding: 3px 8px 5px;
1046 | vertical-align: middle;
1047 | width: 100%;
1048 | }
1049 |
1050 | #graphiql-container .search-box-input {
1051 | border: 0;
1052 | font-size: 12px;
1053 | margin: 0;
1054 | outline: 0;
1055 | padding: 0;
1056 | width: 100%;
1057 | }
1058 | .CodeMirror-foldmarker {
1059 | color: blue;
1060 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
1061 | font-family: arial;
1062 | line-height: .3;
1063 | cursor: pointer;
1064 | }
1065 | .CodeMirror-foldgutter {
1066 | width: .7em;
1067 | }
1068 | .CodeMirror-foldgutter-open,
1069 | .CodeMirror-foldgutter-folded {
1070 | cursor: pointer;
1071 | }
1072 | .CodeMirror-foldgutter-open:after {
1073 | content: "\25BE";
1074 | }
1075 | .CodeMirror-foldgutter-folded:after {
1076 | content: "\25B8";
1077 | }
1078 | /* The lint marker gutter */
1079 | .CodeMirror-lint-markers {
1080 | width: 16px;
1081 | }
1082 |
1083 | .CodeMirror-lint-tooltip {
1084 | background-color: infobackground;
1085 | border: 1px solid black;
1086 | border-radius: 4px 4px 4px 4px;
1087 | color: infotext;
1088 | font-family: monospace;
1089 | font-size: 10pt;
1090 | overflow: hidden;
1091 | padding: 2px 5px;
1092 | position: fixed;
1093 | white-space: pre;
1094 | white-space: pre-wrap;
1095 | z-index: 100;
1096 | max-width: 600px;
1097 | opacity: 0;
1098 | transition: opacity .4s;
1099 | -moz-transition: opacity .4s;
1100 | -webkit-transition: opacity .4s;
1101 | -o-transition: opacity .4s;
1102 | -ms-transition: opacity .4s;
1103 | }
1104 |
1105 | .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
1106 | background-position: left bottom;
1107 | background-repeat: repeat-x;
1108 | }
1109 |
1110 | .CodeMirror-lint-mark-error {
1111 | background-image:
1112 | url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
1113 | ;
1114 | }
1115 |
1116 | .CodeMirror-lint-mark-warning {
1117 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
1118 | }
1119 |
1120 | .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
1121 | background-position: center center;
1122 | background-repeat: no-repeat;
1123 | cursor: pointer;
1124 | display: inline-block;
1125 | height: 16px;
1126 | width: 16px;
1127 | vertical-align: middle;
1128 | position: relative;
1129 | }
1130 |
1131 | .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
1132 | padding-left: 18px;
1133 | background-position: top left;
1134 | background-repeat: no-repeat;
1135 | }
1136 |
1137 | .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
1138 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
1139 | }
1140 |
1141 | .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
1142 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
1143 | }
1144 |
1145 | .CodeMirror-lint-marker-multiple {
1146 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
1147 | background-repeat: no-repeat;
1148 | background-position: right bottom;
1149 | width: 100%; height: 100%;
1150 | }
1151 | #graphiql-container .spinner-container {
1152 | position: absolute;
1153 | top: 50%;
1154 | height: 36px;
1155 | width: 36px;
1156 | left: 50%;
1157 | transform: translate(-50%, -50%);
1158 | z-index: 10;
1159 | }
1160 |
1161 | #graphiql-container .spinner {
1162 | vertical-align: middle;
1163 | display: inline-block;
1164 | height: 24px;
1165 | width: 24px;
1166 | position: absolute;
1167 | -webkit-animation: rotation .6s infinite linear;
1168 | -moz-animation: rotation .6s infinite linear;
1169 | -o-animation: rotation .6s infinite linear;
1170 | animation: rotation .6s infinite linear;
1171 | border-left: 6px solid rgba(150, 150, 150, .15);
1172 | border-right: 6px solid rgba(150, 150, 150, .15);
1173 | border-bottom: 6px solid rgba(150, 150, 150, .15);
1174 | border-top: 6px solid rgba(150, 150, 150, .8);
1175 | border-radius: 100%;
1176 | }
1177 |
1178 | @-webkit-keyframes rotation {
1179 | from { -webkit-transform: rotate(0deg); }
1180 | to { -webkit-transform: rotate(359deg); }
1181 | }
1182 |
1183 | @-moz-keyframes rotation {
1184 | from { -moz-transform: rotate(0deg); }
1185 | to { -moz-transform: rotate(359deg); }
1186 | }
1187 |
1188 | @-o-keyframes rotation {
1189 | from { -o-transform: rotate(0deg); }
1190 | to { -o-transform: rotate(359deg); }
1191 | }
1192 |
1193 | @keyframes rotation {
1194 | from { transform: rotate(0deg); }
1195 | to { transform: rotate(359deg); }
1196 | }
1197 | .CodeMirror-hints {
1198 | background: white;
1199 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1200 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1201 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1202 | font-family: 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace;
1203 | font-size: 13px;
1204 | list-style: none;
1205 | margin: 0;
1206 | margin-left: -6px;
1207 | max-height: 14.5em;
1208 | overflow-y: auto;
1209 | overflow: hidden;
1210 | padding: 0;
1211 | position: absolute;
1212 | z-index: 10;
1213 | }
1214 |
1215 | .CodeMirror-hints-wrapper {
1216 | background: white;
1217 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1218 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1219 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
1220 | margin-left: -6px;
1221 | position: absolute;
1222 | z-index: 10;
1223 | }
1224 |
1225 | .CodeMirror-hints-wrapper .CodeMirror-hints {
1226 | -webkit-box-shadow: none;
1227 | -moz-box-shadow: none;
1228 | box-shadow: none;
1229 | position: relative;
1230 | margin-left: 0;
1231 | z-index: 0;
1232 | }
1233 |
1234 | .CodeMirror-hint {
1235 | border-top: solid 1px #f7f7f7;
1236 | color: #141823;
1237 | cursor: pointer;
1238 | margin: 0;
1239 | max-width: 300px;
1240 | overflow: hidden;
1241 | padding: 2px 6px;
1242 | white-space: pre;
1243 | }
1244 |
1245 | li.CodeMirror-hint-active {
1246 | background-color: #08f;
1247 | border-top-color: white;
1248 | color: white;
1249 | }
1250 |
1251 | .CodeMirror-hint-information {
1252 | border-top: solid 1px #c0c0c0;
1253 | max-width: 300px;
1254 | padding: 4px 6px;
1255 | position: relative;
1256 | z-index: 1;
1257 | }
1258 |
1259 | .CodeMirror-hint-information:first-child {
1260 | border-bottom: solid 1px #c0c0c0;
1261 | border-top: none;
1262 | margin-bottom: -1px;
1263 | }
1264 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/graphiql/index.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | Loading...
34 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/graphiql/js/vendor/es6-promise.auto.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * @overview es6-promise - a tiny implementation of Promises/A+.
3 | * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
4 | * @license Licensed under MIT license
5 | * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
6 | * @version 4.0.5
7 | */
8 |
9 | (function (global, factory) {
10 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
11 | typeof define === 'function' && define.amd ? define(factory) :
12 | (global.ES6Promise = factory());
13 | }(this, (function () { 'use strict';
14 |
15 | function objectOrFunction(x) {
16 | return typeof x === 'function' || typeof x === 'object' && x !== null;
17 | }
18 |
19 | function isFunction(x) {
20 | return typeof x === 'function';
21 | }
22 |
23 | var _isArray = undefined;
24 | if (!Array.isArray) {
25 | _isArray = function (x) {
26 | return Object.prototype.toString.call(x) === '[object Array]';
27 | };
28 | } else {
29 | _isArray = Array.isArray;
30 | }
31 |
32 | var isArray = _isArray;
33 |
34 | var len = 0;
35 | var vertxNext = undefined;
36 | var customSchedulerFn = undefined;
37 |
38 | var asap = function asap(callback, arg) {
39 | queue[len] = callback;
40 | queue[len + 1] = arg;
41 | len += 2;
42 | if (len === 2) {
43 | // If len is 2, that means that we need to schedule an async flush.
44 | // If additional callbacks are queued before the queue is flushed, they
45 | // will be processed by this flush that we are scheduling.
46 | if (customSchedulerFn) {
47 | customSchedulerFn(flush);
48 | } else {
49 | scheduleFlush();
50 | }
51 | }
52 | };
53 |
54 | function setScheduler(scheduleFn) {
55 | customSchedulerFn = scheduleFn;
56 | }
57 |
58 | function setAsap(asapFn) {
59 | asap = asapFn;
60 | }
61 |
62 | var browserWindow = typeof window !== 'undefined' ? window : undefined;
63 | var browserGlobal = browserWindow || {};
64 | var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
65 | var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
66 |
67 | // test for web worker but not in IE10
68 | var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
69 |
70 | // node
71 | function useNextTick() {
72 | // node version 0.10.x displays a deprecation warning when nextTick is used recursively
73 | // see https://github.com/cujojs/when/issues/410 for details
74 | return function () {
75 | return process.nextTick(flush);
76 | };
77 | }
78 |
79 | // vertx
80 | function useVertxTimer() {
81 | if (typeof vertxNext !== 'undefined') {
82 | return function () {
83 | vertxNext(flush);
84 | };
85 | }
86 |
87 | return useSetTimeout();
88 | }
89 |
90 | function useMutationObserver() {
91 | var iterations = 0;
92 | var observer = new BrowserMutationObserver(flush);
93 | var node = document.createTextNode('');
94 | observer.observe(node, { characterData: true });
95 |
96 | return function () {
97 | node.data = iterations = ++iterations % 2;
98 | };
99 | }
100 |
101 | // web worker
102 | function useMessageChannel() {
103 | var channel = new MessageChannel();
104 | channel.port1.onmessage = flush;
105 | return function () {
106 | return channel.port2.postMessage(0);
107 | };
108 | }
109 |
110 | function useSetTimeout() {
111 | // Store setTimeout reference so es6-promise will be unaffected by
112 | // other code modifying setTimeout (like sinon.useFakeTimers())
113 | var globalSetTimeout = setTimeout;
114 | return function () {
115 | return globalSetTimeout(flush, 1);
116 | };
117 | }
118 |
119 | var queue = new Array(1000);
120 | function flush() {
121 | for (var i = 0; i < len; i += 2) {
122 | var callback = queue[i];
123 | var arg = queue[i + 1];
124 |
125 | callback(arg);
126 |
127 | queue[i] = undefined;
128 | queue[i + 1] = undefined;
129 | }
130 |
131 | len = 0;
132 | }
133 |
134 | function attemptVertx() {
135 | try {
136 | var r = require;
137 | var vertx = r('vertx');
138 | vertxNext = vertx.runOnLoop || vertx.runOnContext;
139 | return useVertxTimer();
140 | } catch (e) {
141 | return useSetTimeout();
142 | }
143 | }
144 |
145 | var scheduleFlush = undefined;
146 | // Decide what async method to use to triggering processing of queued callbacks:
147 | if (isNode) {
148 | scheduleFlush = useNextTick();
149 | } else if (BrowserMutationObserver) {
150 | scheduleFlush = useMutationObserver();
151 | } else if (isWorker) {
152 | scheduleFlush = useMessageChannel();
153 | } else if (browserWindow === undefined && typeof require === 'function') {
154 | scheduleFlush = attemptVertx();
155 | } else {
156 | scheduleFlush = useSetTimeout();
157 | }
158 |
159 | function then(onFulfillment, onRejection) {
160 | var _arguments = arguments;
161 |
162 | var parent = this;
163 |
164 | var child = new this.constructor(noop);
165 |
166 | if (child[PROMISE_ID] === undefined) {
167 | makePromise(child);
168 | }
169 |
170 | var _state = parent._state;
171 |
172 | if (_state) {
173 | (function () {
174 | var callback = _arguments[_state - 1];
175 | asap(function () {
176 | return invokeCallback(_state, child, callback, parent._result);
177 | });
178 | })();
179 | } else {
180 | subscribe(parent, child, onFulfillment, onRejection);
181 | }
182 |
183 | return child;
184 | }
185 |
186 | /**
187 | `Promise.resolve` returns a promise that will become resolved with the
188 | passed `value`. It is shorthand for the following:
189 |
190 | ```javascript
191 | let promise = new Promise(function(resolve, reject){
192 | resolve(1);
193 | });
194 |
195 | promise.then(function(value){
196 | // value === 1
197 | });
198 | ```
199 |
200 | Instead of writing the above, your code now simply becomes the following:
201 |
202 | ```javascript
203 | let promise = Promise.resolve(1);
204 |
205 | promise.then(function(value){
206 | // value === 1
207 | });
208 | ```
209 |
210 | @method resolve
211 | @static
212 | @param {Any} value value that the returned promise will be resolved with
213 | Useful for tooling.
214 | @return {Promise} a promise that will become fulfilled with the given
215 | `value`
216 | */
217 | function resolve(object) {
218 | /*jshint validthis:true */
219 | var Constructor = this;
220 |
221 | if (object && typeof object === 'object' && object.constructor === Constructor) {
222 | return object;
223 | }
224 |
225 | var promise = new Constructor(noop);
226 | _resolve(promise, object);
227 | return promise;
228 | }
229 |
230 | var PROMISE_ID = Math.random().toString(36).substring(16);
231 |
232 | function noop() {}
233 |
234 | var PENDING = void 0;
235 | var FULFILLED = 1;
236 | var REJECTED = 2;
237 |
238 | var GET_THEN_ERROR = new ErrorObject();
239 |
240 | function selfFulfillment() {
241 | return new TypeError("You cannot resolve a promise with itself");
242 | }
243 |
244 | function cannotReturnOwn() {
245 | return new TypeError('A promises callback cannot return that same promise.');
246 | }
247 |
248 | function getThen(promise) {
249 | try {
250 | return promise.then;
251 | } catch (error) {
252 | GET_THEN_ERROR.error = error;
253 | return GET_THEN_ERROR;
254 | }
255 | }
256 |
257 | function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
258 | try {
259 | then.call(value, fulfillmentHandler, rejectionHandler);
260 | } catch (e) {
261 | return e;
262 | }
263 | }
264 |
265 | function handleForeignThenable(promise, thenable, then) {
266 | asap(function (promise) {
267 | var sealed = false;
268 | var error = tryThen(then, thenable, function (value) {
269 | if (sealed) {
270 | return;
271 | }
272 | sealed = true;
273 | if (thenable !== value) {
274 | _resolve(promise, value);
275 | } else {
276 | fulfill(promise, value);
277 | }
278 | }, function (reason) {
279 | if (sealed) {
280 | return;
281 | }
282 | sealed = true;
283 |
284 | _reject(promise, reason);
285 | }, 'Settle: ' + (promise._label || ' unknown promise'));
286 |
287 | if (!sealed && error) {
288 | sealed = true;
289 | _reject(promise, error);
290 | }
291 | }, promise);
292 | }
293 |
294 | function handleOwnThenable(promise, thenable) {
295 | if (thenable._state === FULFILLED) {
296 | fulfill(promise, thenable._result);
297 | } else if (thenable._state === REJECTED) {
298 | _reject(promise, thenable._result);
299 | } else {
300 | subscribe(thenable, undefined, function (value) {
301 | return _resolve(promise, value);
302 | }, function (reason) {
303 | return _reject(promise, reason);
304 | });
305 | }
306 | }
307 |
308 | function handleMaybeThenable(promise, maybeThenable, then$$) {
309 | if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
310 | handleOwnThenable(promise, maybeThenable);
311 | } else {
312 | if (then$$ === GET_THEN_ERROR) {
313 | _reject(promise, GET_THEN_ERROR.error);
314 | } else if (then$$ === undefined) {
315 | fulfill(promise, maybeThenable);
316 | } else if (isFunction(then$$)) {
317 | handleForeignThenable(promise, maybeThenable, then$$);
318 | } else {
319 | fulfill(promise, maybeThenable);
320 | }
321 | }
322 | }
323 |
324 | function _resolve(promise, value) {
325 | if (promise === value) {
326 | _reject(promise, selfFulfillment());
327 | } else if (objectOrFunction(value)) {
328 | handleMaybeThenable(promise, value, getThen(value));
329 | } else {
330 | fulfill(promise, value);
331 | }
332 | }
333 |
334 | function publishRejection(promise) {
335 | if (promise._onerror) {
336 | promise._onerror(promise._result);
337 | }
338 |
339 | publish(promise);
340 | }
341 |
342 | function fulfill(promise, value) {
343 | if (promise._state !== PENDING) {
344 | return;
345 | }
346 |
347 | promise._result = value;
348 | promise._state = FULFILLED;
349 |
350 | if (promise._subscribers.length !== 0) {
351 | asap(publish, promise);
352 | }
353 | }
354 |
355 | function _reject(promise, reason) {
356 | if (promise._state !== PENDING) {
357 | return;
358 | }
359 | promise._state = REJECTED;
360 | promise._result = reason;
361 |
362 | asap(publishRejection, promise);
363 | }
364 |
365 | function subscribe(parent, child, onFulfillment, onRejection) {
366 | var _subscribers = parent._subscribers;
367 | var length = _subscribers.length;
368 |
369 | parent._onerror = null;
370 |
371 | _subscribers[length] = child;
372 | _subscribers[length + FULFILLED] = onFulfillment;
373 | _subscribers[length + REJECTED] = onRejection;
374 |
375 | if (length === 0 && parent._state) {
376 | asap(publish, parent);
377 | }
378 | }
379 |
380 | function publish(promise) {
381 | var subscribers = promise._subscribers;
382 | var settled = promise._state;
383 |
384 | if (subscribers.length === 0) {
385 | return;
386 | }
387 |
388 | var child = undefined,
389 | callback = undefined,
390 | detail = promise._result;
391 |
392 | for (var i = 0; i < subscribers.length; i += 3) {
393 | child = subscribers[i];
394 | callback = subscribers[i + settled];
395 |
396 | if (child) {
397 | invokeCallback(settled, child, callback, detail);
398 | } else {
399 | callback(detail);
400 | }
401 | }
402 |
403 | promise._subscribers.length = 0;
404 | }
405 |
406 | function ErrorObject() {
407 | this.error = null;
408 | }
409 |
410 | var TRY_CATCH_ERROR = new ErrorObject();
411 |
412 | function tryCatch(callback, detail) {
413 | try {
414 | return callback(detail);
415 | } catch (e) {
416 | TRY_CATCH_ERROR.error = e;
417 | return TRY_CATCH_ERROR;
418 | }
419 | }
420 |
421 | function invokeCallback(settled, promise, callback, detail) {
422 | var hasCallback = isFunction(callback),
423 | value = undefined,
424 | error = undefined,
425 | succeeded = undefined,
426 | failed = undefined;
427 |
428 | if (hasCallback) {
429 | value = tryCatch(callback, detail);
430 |
431 | if (value === TRY_CATCH_ERROR) {
432 | failed = true;
433 | error = value.error;
434 | value = null;
435 | } else {
436 | succeeded = true;
437 | }
438 |
439 | if (promise === value) {
440 | _reject(promise, cannotReturnOwn());
441 | return;
442 | }
443 | } else {
444 | value = detail;
445 | succeeded = true;
446 | }
447 |
448 | if (promise._state !== PENDING) {
449 | // noop
450 | } else if (hasCallback && succeeded) {
451 | _resolve(promise, value);
452 | } else if (failed) {
453 | _reject(promise, error);
454 | } else if (settled === FULFILLED) {
455 | fulfill(promise, value);
456 | } else if (settled === REJECTED) {
457 | _reject(promise, value);
458 | }
459 | }
460 |
461 | function initializePromise(promise, resolver) {
462 | try {
463 | resolver(function resolvePromise(value) {
464 | _resolve(promise, value);
465 | }, function rejectPromise(reason) {
466 | _reject(promise, reason);
467 | });
468 | } catch (e) {
469 | _reject(promise, e);
470 | }
471 | }
472 |
473 | var id = 0;
474 | function nextId() {
475 | return id++;
476 | }
477 |
478 | function makePromise(promise) {
479 | promise[PROMISE_ID] = id++;
480 | promise._state = undefined;
481 | promise._result = undefined;
482 | promise._subscribers = [];
483 | }
484 |
485 | function Enumerator(Constructor, input) {
486 | this._instanceConstructor = Constructor;
487 | this.promise = new Constructor(noop);
488 |
489 | if (!this.promise[PROMISE_ID]) {
490 | makePromise(this.promise);
491 | }
492 |
493 | if (isArray(input)) {
494 | this._input = input;
495 | this.length = input.length;
496 | this._remaining = input.length;
497 |
498 | this._result = new Array(this.length);
499 |
500 | if (this.length === 0) {
501 | fulfill(this.promise, this._result);
502 | } else {
503 | this.length = this.length || 0;
504 | this._enumerate();
505 | if (this._remaining === 0) {
506 | fulfill(this.promise, this._result);
507 | }
508 | }
509 | } else {
510 | _reject(this.promise, validationError());
511 | }
512 | }
513 |
514 | function validationError() {
515 | return new Error('Array Methods must be provided an Array');
516 | };
517 |
518 | Enumerator.prototype._enumerate = function () {
519 | var length = this.length;
520 | var _input = this._input;
521 |
522 | for (var i = 0; this._state === PENDING && i < length; i++) {
523 | this._eachEntry(_input[i], i);
524 | }
525 | };
526 |
527 | Enumerator.prototype._eachEntry = function (entry, i) {
528 | var c = this._instanceConstructor;
529 | var resolve$$ = c.resolve;
530 |
531 | if (resolve$$ === resolve) {
532 | var _then = getThen(entry);
533 |
534 | if (_then === then && entry._state !== PENDING) {
535 | this._settledAt(entry._state, i, entry._result);
536 | } else if (typeof _then !== 'function') {
537 | this._remaining--;
538 | this._result[i] = entry;
539 | } else if (c === Promise) {
540 | var promise = new c(noop);
541 | handleMaybeThenable(promise, entry, _then);
542 | this._willSettleAt(promise, i);
543 | } else {
544 | this._willSettleAt(new c(function (resolve$$) {
545 | return resolve$$(entry);
546 | }), i);
547 | }
548 | } else {
549 | this._willSettleAt(resolve$$(entry), i);
550 | }
551 | };
552 |
553 | Enumerator.prototype._settledAt = function (state, i, value) {
554 | var promise = this.promise;
555 |
556 | if (promise._state === PENDING) {
557 | this._remaining--;
558 |
559 | if (state === REJECTED) {
560 | _reject(promise, value);
561 | } else {
562 | this._result[i] = value;
563 | }
564 | }
565 |
566 | if (this._remaining === 0) {
567 | fulfill(promise, this._result);
568 | }
569 | };
570 |
571 | Enumerator.prototype._willSettleAt = function (promise, i) {
572 | var enumerator = this;
573 |
574 | subscribe(promise, undefined, function (value) {
575 | return enumerator._settledAt(FULFILLED, i, value);
576 | }, function (reason) {
577 | return enumerator._settledAt(REJECTED, i, reason);
578 | });
579 | };
580 |
581 | /**
582 | `Promise.all` accepts an array of promises, and returns a new promise which
583 | is fulfilled with an array of fulfillment values for the passed promises, or
584 | rejected with the reason of the first passed promise to be rejected. It casts all
585 | elements of the passed iterable to promises as it runs this algorithm.
586 |
587 | Example:
588 |
589 | ```javascript
590 | let promise1 = resolve(1);
591 | let promise2 = resolve(2);
592 | let promise3 = resolve(3);
593 | let promises = [ promise1, promise2, promise3 ];
594 |
595 | Promise.all(promises).then(function(array){
596 | // The array here would be [ 1, 2, 3 ];
597 | });
598 | ```
599 |
600 | If any of the `promises` given to `all` are rejected, the first promise
601 | that is rejected will be given as an argument to the returned promises's
602 | rejection handler. For example:
603 |
604 | Example:
605 |
606 | ```javascript
607 | let promise1 = resolve(1);
608 | let promise2 = reject(new Error("2"));
609 | let promise3 = reject(new Error("3"));
610 | let promises = [ promise1, promise2, promise3 ];
611 |
612 | Promise.all(promises).then(function(array){
613 | // Code here never runs because there are rejected promises!
614 | }, function(error) {
615 | // error.message === "2"
616 | });
617 | ```
618 |
619 | @method all
620 | @static
621 | @param {Array} entries array of promises
622 | @param {String} label optional string for labeling the promise.
623 | Useful for tooling.
624 | @return {Promise} promise that is fulfilled when all `promises` have been
625 | fulfilled, or rejected if any of them become rejected.
626 | @static
627 | */
628 | function all(entries) {
629 | return new Enumerator(this, entries).promise;
630 | }
631 |
632 | /**
633 | `Promise.race` returns a new promise which is settled in the same way as the
634 | first passed promise to settle.
635 |
636 | Example:
637 |
638 | ```javascript
639 | let promise1 = new Promise(function(resolve, reject){
640 | setTimeout(function(){
641 | resolve('promise 1');
642 | }, 200);
643 | });
644 |
645 | let promise2 = new Promise(function(resolve, reject){
646 | setTimeout(function(){
647 | resolve('promise 2');
648 | }, 100);
649 | });
650 |
651 | Promise.race([promise1, promise2]).then(function(result){
652 | // result === 'promise 2' because it was resolved before promise1
653 | // was resolved.
654 | });
655 | ```
656 |
657 | `Promise.race` is deterministic in that only the state of the first
658 | settled promise matters. For example, even if other promises given to the
659 | `promises` array argument are resolved, but the first settled promise has
660 | become rejected before the other promises became fulfilled, the returned
661 | promise will become rejected:
662 |
663 | ```javascript
664 | let promise1 = new Promise(function(resolve, reject){
665 | setTimeout(function(){
666 | resolve('promise 1');
667 | }, 200);
668 | });
669 |
670 | let promise2 = new Promise(function(resolve, reject){
671 | setTimeout(function(){
672 | reject(new Error('promise 2'));
673 | }, 100);
674 | });
675 |
676 | Promise.race([promise1, promise2]).then(function(result){
677 | // Code here never runs
678 | }, function(reason){
679 | // reason.message === 'promise 2' because promise 2 became rejected before
680 | // promise 1 became fulfilled
681 | });
682 | ```
683 |
684 | An example real-world use case is implementing timeouts:
685 |
686 | ```javascript
687 | Promise.race([ajax('foo.json'), timeout(5000)])
688 | ```
689 |
690 | @method race
691 | @static
692 | @param {Array} promises array of promises to observe
693 | Useful for tooling.
694 | @return {Promise} a promise which settles in the same way as the first passed
695 | promise to settle.
696 | */
697 | function race(entries) {
698 | /*jshint validthis:true */
699 | var Constructor = this;
700 |
701 | if (!isArray(entries)) {
702 | return new Constructor(function (_, reject) {
703 | return reject(new TypeError('You must pass an array to race.'));
704 | });
705 | } else {
706 | return new Constructor(function (resolve, reject) {
707 | var length = entries.length;
708 | for (var i = 0; i < length; i++) {
709 | Constructor.resolve(entries[i]).then(resolve, reject);
710 | }
711 | });
712 | }
713 | }
714 |
715 | /**
716 | `Promise.reject` returns a promise rejected with the passed `reason`.
717 | It is shorthand for the following:
718 |
719 | ```javascript
720 | let promise = new Promise(function(resolve, reject){
721 | reject(new Error('WHOOPS'));
722 | });
723 |
724 | promise.then(function(value){
725 | // Code here doesn't run because the promise is rejected!
726 | }, function(reason){
727 | // reason.message === 'WHOOPS'
728 | });
729 | ```
730 |
731 | Instead of writing the above, your code now simply becomes the following:
732 |
733 | ```javascript
734 | let promise = Promise.reject(new Error('WHOOPS'));
735 |
736 | promise.then(function(value){
737 | // Code here doesn't run because the promise is rejected!
738 | }, function(reason){
739 | // reason.message === 'WHOOPS'
740 | });
741 | ```
742 |
743 | @method reject
744 | @static
745 | @param {Any} reason value that the returned promise will be rejected with.
746 | Useful for tooling.
747 | @return {Promise} a promise rejected with the given `reason`.
748 | */
749 | function reject(reason) {
750 | /*jshint validthis:true */
751 | var Constructor = this;
752 | var promise = new Constructor(noop);
753 | _reject(promise, reason);
754 | return promise;
755 | }
756 |
757 | function needsResolver() {
758 | throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
759 | }
760 |
761 | function needsNew() {
762 | throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
763 | }
764 |
765 | /**
766 | Promise objects represent the eventual result of an asynchronous operation. The
767 | primary way of interacting with a promise is through its `then` method, which
768 | registers callbacks to receive either a promise's eventual value or the reason
769 | why the promise cannot be fulfilled.
770 |
771 | Terminology
772 | -----------
773 |
774 | - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
775 | - `thenable` is an object or function that defines a `then` method.
776 | - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
777 | - `exception` is a value that is thrown using the throw statement.
778 | - `reason` is a value that indicates why a promise was rejected.
779 | - `settled` the final resting state of a promise, fulfilled or rejected.
780 |
781 | A promise can be in one of three states: pending, fulfilled, or rejected.
782 |
783 | Promises that are fulfilled have a fulfillment value and are in the fulfilled
784 | state. Promises that are rejected have a rejection reason and are in the
785 | rejected state. A fulfillment value is never a thenable.
786 |
787 | Promises can also be said to *resolve* a value. If this value is also a
788 | promise, then the original promise's settled state will match the value's
789 | settled state. So a promise that *resolves* a promise that rejects will
790 | itself reject, and a promise that *resolves* a promise that fulfills will
791 | itself fulfill.
792 |
793 |
794 | Basic Usage:
795 | ------------
796 |
797 | ```js
798 | let promise = new Promise(function(resolve, reject) {
799 | // on success
800 | resolve(value);
801 |
802 | // on failure
803 | reject(reason);
804 | });
805 |
806 | promise.then(function(value) {
807 | // on fulfillment
808 | }, function(reason) {
809 | // on rejection
810 | });
811 | ```
812 |
813 | Advanced Usage:
814 | ---------------
815 |
816 | Promises shine when abstracting away asynchronous interactions such as
817 | `XMLHttpRequest`s.
818 |
819 | ```js
820 | function getJSON(url) {
821 | return new Promise(function(resolve, reject){
822 | let xhr = new XMLHttpRequest();
823 |
824 | xhr.open('GET', url);
825 | xhr.onreadystatechange = handler;
826 | xhr.responseType = 'json';
827 | xhr.setRequestHeader('Accept', 'application/json');
828 | xhr.send();
829 |
830 | function handler() {
831 | if (this.readyState === this.DONE) {
832 | if (this.status === 200) {
833 | resolve(this.response);
834 | } else {
835 | reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
836 | }
837 | }
838 | };
839 | });
840 | }
841 |
842 | getJSON('/posts.json').then(function(json) {
843 | // on fulfillment
844 | }, function(reason) {
845 | // on rejection
846 | });
847 | ```
848 |
849 | Unlike callbacks, promises are great composable primitives.
850 |
851 | ```js
852 | Promise.all([
853 | getJSON('/posts'),
854 | getJSON('/comments')
855 | ]).then(function(values){
856 | values[0] // => postsJSON
857 | values[1] // => commentsJSON
858 |
859 | return values;
860 | });
861 | ```
862 |
863 | @class Promise
864 | @param {function} resolver
865 | Useful for tooling.
866 | @constructor
867 | */
868 | function Promise(resolver) {
869 | this[PROMISE_ID] = nextId();
870 | this._result = this._state = undefined;
871 | this._subscribers = [];
872 |
873 | if (noop !== resolver) {
874 | typeof resolver !== 'function' && needsResolver();
875 | this instanceof Promise ? initializePromise(this, resolver) : needsNew();
876 | }
877 | }
878 |
879 | Promise.all = all;
880 | Promise.race = race;
881 | Promise.resolve = resolve;
882 | Promise.reject = reject;
883 | Promise._setScheduler = setScheduler;
884 | Promise._setAsap = setAsap;
885 | Promise._asap = asap;
886 |
887 | Promise.prototype = {
888 | constructor: Promise,
889 |
890 | /**
891 | The primary way of interacting with a promise is through its `then` method,
892 | which registers callbacks to receive either a promise's eventual value or the
893 | reason why the promise cannot be fulfilled.
894 |
895 | ```js
896 | findUser().then(function(user){
897 | // user is available
898 | }, function(reason){
899 | // user is unavailable, and you are given the reason why
900 | });
901 | ```
902 |
903 | Chaining
904 | --------
905 |
906 | The return value of `then` is itself a promise. This second, 'downstream'
907 | promise is resolved with the return value of the first promise's fulfillment
908 | or rejection handler, or rejected if the handler throws an exception.
909 |
910 | ```js
911 | findUser().then(function (user) {
912 | return user.name;
913 | }, function (reason) {
914 | return 'default name';
915 | }).then(function (userName) {
916 | // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
917 | // will be `'default name'`
918 | });
919 |
920 | findUser().then(function (user) {
921 | throw new Error('Found user, but still unhappy');
922 | }, function (reason) {
923 | throw new Error('`findUser` rejected and we're unhappy');
924 | }).then(function (value) {
925 | // never reached
926 | }, function (reason) {
927 | // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
928 | // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
929 | });
930 | ```
931 | If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
932 |
933 | ```js
934 | findUser().then(function (user) {
935 | throw new PedagogicalException('Upstream error');
936 | }).then(function (value) {
937 | // never reached
938 | }).then(function (value) {
939 | // never reached
940 | }, function (reason) {
941 | // The `PedgagocialException` is propagated all the way down to here
942 | });
943 | ```
944 |
945 | Assimilation
946 | ------------
947 |
948 | Sometimes the value you want to propagate to a downstream promise can only be
949 | retrieved asynchronously. This can be achieved by returning a promise in the
950 | fulfillment or rejection handler. The downstream promise will then be pending
951 | until the returned promise is settled. This is called *assimilation*.
952 |
953 | ```js
954 | findUser().then(function (user) {
955 | return findCommentsByAuthor(user);
956 | }).then(function (comments) {
957 | // The user's comments are now available
958 | });
959 | ```
960 |
961 | If the assimliated promise rejects, then the downstream promise will also reject.
962 |
963 | ```js
964 | findUser().then(function (user) {
965 | return findCommentsByAuthor(user);
966 | }).then(function (comments) {
967 | // If `findCommentsByAuthor` fulfills, we'll have the value here
968 | }, function (reason) {
969 | // If `findCommentsByAuthor` rejects, we'll have the reason here
970 | });
971 | ```
972 |
973 | Simple Example
974 | --------------
975 |
976 | Synchronous Example
977 |
978 | ```javascript
979 | let result;
980 |
981 | try {
982 | result = findResult();
983 | // success
984 | } catch(reason) {
985 | // failure
986 | }
987 | ```
988 |
989 | Errback Example
990 |
991 | ```js
992 | findResult(function(result, err){
993 | if (err) {
994 | // failure
995 | } else {
996 | // success
997 | }
998 | });
999 | ```
1000 |
1001 | Promise Example;
1002 |
1003 | ```javascript
1004 | findResult().then(function(result){
1005 | // success
1006 | }, function(reason){
1007 | // failure
1008 | });
1009 | ```
1010 |
1011 | Advanced Example
1012 | --------------
1013 |
1014 | Synchronous Example
1015 |
1016 | ```javascript
1017 | let author, books;
1018 |
1019 | try {
1020 | author = findAuthor();
1021 | books = findBooksByAuthor(author);
1022 | // success
1023 | } catch(reason) {
1024 | // failure
1025 | }
1026 | ```
1027 |
1028 | Errback Example
1029 |
1030 | ```js
1031 |
1032 | function foundBooks(books) {
1033 |
1034 | }
1035 |
1036 | function failure(reason) {
1037 |
1038 | }
1039 |
1040 | findAuthor(function(author, err){
1041 | if (err) {
1042 | failure(err);
1043 | // failure
1044 | } else {
1045 | try {
1046 | findBoooksByAuthor(author, function(books, err) {
1047 | if (err) {
1048 | failure(err);
1049 | } else {
1050 | try {
1051 | foundBooks(books);
1052 | } catch(reason) {
1053 | failure(reason);
1054 | }
1055 | }
1056 | });
1057 | } catch(error) {
1058 | failure(err);
1059 | }
1060 | // success
1061 | }
1062 | });
1063 | ```
1064 |
1065 | Promise Example;
1066 |
1067 | ```javascript
1068 | findAuthor().
1069 | then(findBooksByAuthor).
1070 | then(function(books){
1071 | // found books
1072 | }).catch(function(reason){
1073 | // something went wrong
1074 | });
1075 | ```
1076 |
1077 | @method then
1078 | @param {Function} onFulfilled
1079 | @param {Function} onRejected
1080 | Useful for tooling.
1081 | @return {Promise}
1082 | */
1083 | then: then,
1084 |
1085 | /**
1086 | `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
1087 | as the catch block of a try/catch statement.
1088 |
1089 | ```js
1090 | function findAuthor(){
1091 | throw new Error('couldn't find that author');
1092 | }
1093 |
1094 | // synchronous
1095 | try {
1096 | findAuthor();
1097 | } catch(reason) {
1098 | // something went wrong
1099 | }
1100 |
1101 | // async with promises
1102 | findAuthor().catch(function(reason){
1103 | // something went wrong
1104 | });
1105 | ```
1106 |
1107 | @method catch
1108 | @param {Function} onRejection
1109 | Useful for tooling.
1110 | @return {Promise}
1111 | */
1112 | 'catch': function _catch(onRejection) {
1113 | return this.then(null, onRejection);
1114 | }
1115 | };
1116 |
1117 | function polyfill() {
1118 | var local = undefined;
1119 |
1120 | if (typeof global !== 'undefined') {
1121 | local = global;
1122 | } else if (typeof self !== 'undefined') {
1123 | local = self;
1124 | } else {
1125 | try {
1126 | local = Function('return this')();
1127 | } catch (e) {
1128 | throw new Error('polyfill failed because global object is unavailable in this environment');
1129 | }
1130 | }
1131 |
1132 | var P = local.Promise;
1133 |
1134 | if (P) {
1135 | var promiseToString = null;
1136 | try {
1137 | promiseToString = Object.prototype.toString.call(P.resolve());
1138 | } catch (e) {
1139 | // silently ignored
1140 | }
1141 |
1142 | if (promiseToString === '[object Promise]' && !P.cast) {
1143 | return;
1144 | }
1145 | }
1146 |
1147 | local.Promise = Promise;
1148 | }
1149 |
1150 | // Strange compat..
1151 | Promise.polyfill = polyfill;
1152 | Promise.Promise = Promise;
1153 |
1154 | return Promise;
1155 |
1156 | })));
1157 |
1158 | ES6Promise.polyfill();
1159 | //# sourceMappingURL=es6-promise.auto.map
1160 |
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/graphiql/js/vendor/fetch.min.js:
--------------------------------------------------------------------------------
1 | !function(){"use strict";function t(t){if("string"!=typeof t&&(t=t.toString()),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function e(t){return"string"!=typeof t&&(t=t.toString()),t}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function n(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function s(t){var e=new FileReader;return e.readAsArrayBuffer(t),n(e)}function i(t){var e=new FileReader;return e.readAsText(t),n(e)}function a(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(p.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(p.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else{if(t)throw new Error("unsupported BodyInit type");this._bodyText=""}},p.blob?(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(s)},this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return i(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var t=o(this);return t?t:Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(t){var e=t.toUpperCase();return c.indexOf(e)>-1?e:t}function f(t,e){if(e=e||{},this.url=t,this.credentials=e.credentials||"omit",this.headers=new r(e.headers),this.method=u(e.method||"GET"),this.mode=e.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&e.body)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(e.body)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(n))}}),e}function d(t){var e=new r,o=t.getAllResponseHeaders().trim().split("\n");return o.forEach(function(t){var r=t.trim().split(":"),o=r.shift().trim(),n=r.join(":").trim();e.append(o,n)}),e}function l(t,e){e||(e={}),this._initBody(t),this.type="default",this.url=null,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof r?e.headers:new r(e.headers),this.url=e.url||""}if(!self.fetch){r.prototype.append=function(r,o){r=t(r),o=e(o);var n=this.map[r];n||(n=[],this.map[r]=n),n.push(o)},r.prototype["delete"]=function(e){delete this.map[t(e)]},r.prototype.get=function(e){var r=this.map[t(e)];return r?r[0]:null},r.prototype.getAll=function(e){return this.map[t(e)]||[]},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.set=function(r,o){this.map[t(r)]=[e(o)]},r.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(o){t.call(e,o,r,this)},this)},this)};var p={blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self},c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];a.call(f.prototype),a.call(l.prototype),self.Headers=r,self.Request=f,self.Response=l,self.fetch=function(t,e){var r;return r=f.prototype.isPrototypeOf(t)&&!e?t:new f(t,e),new Promise(function(t,e){function o(){return"responseURL"in n?n.responseURL:/^X-Request-URL:/m.test(n.getAllResponseHeaders())?n.getResponseHeader("X-Request-URL"):void 0}var n=new XMLHttpRequest;n.onload=function(){var r=1223===n.status?204:n.status;if(100>r||r>599)return void e(new TypeError("Network request failed"));var s={status:r,statusText:n.statusText,headers:d(n),url:o()},i="response"in n?n.response:n.responseText;t(new l(i,s))},n.onerror=function(){e(new TypeError("Network request failed"))},n.open(r.method,r.url,!0),"include"===r.credentials&&(n.withCredentials=!0),"responseType"in n&&p.blob&&(n.responseType="blob"),r.headers.forEach(function(t,e){n.setRequestHeader(e,t)}),n.send("undefined"==typeof r._bodyInit?null:r._bodyInit)})},self.fetch.polyfill=!0}}();
--------------------------------------------------------------------------------
/spring-boot-sample/src/main/resources/static/graphiql/js/vendor/react-dom-15.0.1.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * ReactDOM v15.1.0
3 | *
4 | * Copyright 2013-present, Facebook, Inc.
5 | * All rights reserved.
6 | *
7 | * This source code is licensed under the BSD-style license found in the
8 | * LICENSE file in the root directory of this source tree. An additional grant
9 | * of patent rights can be found in the PATENTS file in the same directory.
10 | *
11 | */
12 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOM=e(f.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED});
--------------------------------------------------------------------------------
/spring-boot-starter-sample/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.leangen.spqr.samples.starter
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | Spring Boot Starter demo
12 | Demo project for GraphQL SPQR Spring Boot Starter
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.4.2
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-websocket
35 |
36 |
37 | org.springframework.data
38 | spring-data-commons
39 |
40 |
41 |
42 | io.leangen.graphql
43 | graphql-spqr-spring-boot-starter
44 | 0.0.6
45 |
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-starter-test
50 | test
51 |
52 |
53 |
54 |
55 |
56 |
57 | org.springframework.boot
58 | spring-boot-maven-plugin
59 |
60 |
61 |
62 | org.apache.maven.plugins
63 | maven-compiler-plugin
64 | 3.8.0
65 |
66 |
67 | -parameters
68 |
69 | 1.8
70 | 1.8
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/StarterDemoApplication.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class StarterDemoApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(StarterDemoApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/config/DataLoaderFactory.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.config;
2 |
3 | import io.leangen.graphql.samples.dto.Project;
4 | import io.leangen.graphql.spqr.spring.autoconfigure.DataLoaderRegistryFactory;
5 | import org.dataloader.BatchLoader;
6 | import org.dataloader.DataLoader;
7 | import org.dataloader.DataLoaderRegistry;
8 | import org.springframework.stereotype.Component;
9 |
10 | import java.util.List;
11 | import java.util.concurrent.CompletableFuture;
12 | import java.util.concurrent.ThreadLocalRandom;
13 | import java.util.stream.Collectors;
14 | import java.util.stream.IntStream;
15 |
16 | @Component
17 | public class DataLoaderFactory implements DataLoaderRegistryFactory {
18 |
19 | private static final BatchLoader fundingBatchLoader = DataLoaderFactory::fundings;
20 |
21 | @Override
22 | public DataLoaderRegistry createDataLoaderRegistry() {
23 | DataLoader fundingLoader = new DataLoader<>(fundingBatchLoader);
24 | DataLoaderRegistry loaders = new DataLoaderRegistry();
25 | loaders.register("funding", fundingLoader);
26 | return loaders;
27 | }
28 |
29 | //Simulates a call to an external API to fetch the current funding for multiple projects.
30 | private static CompletableFuture> fundings(List projects) {
31 | return CompletableFuture.completedFuture(
32 | IntStream.range(0, projects.size())
33 | .mapToObj(i -> ThreadLocalRandom.current().nextLong(1000) * 1000)
34 | .collect(Collectors.toList())
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/dto/Project.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonCreator;
4 |
5 | import java.util.List;
6 |
7 | public class Project {
8 |
9 | private final String code;
10 | private final String name;
11 | private final List tasks;
12 | private final List tags;
13 |
14 | @JsonCreator
15 | public Project(String code, String name, List tasks, List tags) {
16 | this.code = code;
17 | this.name = name;
18 | this.tasks = tasks;
19 | this.tags = tags;
20 | }
21 |
22 | public void addTask(Task task) {
23 | this.tasks.add(task);
24 | }
25 |
26 | public void addTag(String tag) {
27 | this.tags.add(tag);
28 | }
29 |
30 | public String getName() {
31 | return name;
32 | }
33 |
34 | public String getCode() {
35 | return code;
36 | }
37 |
38 | public List getTasks() {
39 | return tasks;
40 | }
41 |
42 | public List getTags() {
43 | return tags;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/dto/Status.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.dto;
2 |
3 | public enum Status {
4 |
5 | PLANNING, READY, WIP, VERIFICATION, DONE
6 | }
7 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/dto/Task.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonCreator;
4 |
5 | public class Task {
6 |
7 | private String code;
8 | private String description;
9 | private Type type;
10 | private Status status;
11 |
12 | @JsonCreator
13 | public Task(String code, String description, Status status, Type type) {
14 | this.code = code;
15 | this.description = description;
16 | this.status = status;
17 | this.type = type;
18 | }
19 |
20 | public String getCode() {
21 | return code;
22 | }
23 |
24 | public String getDescription() {
25 | return description;
26 | }
27 |
28 | public Type getType() {
29 | return type;
30 | }
31 |
32 | public Status getStatus() {
33 | return status;
34 | }
35 |
36 | public void setDescription(String description) {
37 | this.description = description;
38 | }
39 |
40 | public void setStatus(Status status) {
41 | this.status = status;
42 | }
43 | }
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/dto/Type.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.dto;
2 |
3 | public enum Type {
4 |
5 | PURCHASE, MAINTENANCE, CREATIVE, PRODUCTION
6 | }
7 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/repo/ProjectRepo.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.repo;
2 |
3 | import io.leangen.graphql.execution.relay.Page;
4 | import io.leangen.graphql.execution.relay.generic.PageFactory;
5 | import io.leangen.graphql.samples.dto.Project;
6 | import io.leangen.graphql.samples.dto.Task;
7 | import org.springframework.data.domain.PageImpl;
8 | import org.springframework.data.domain.Pageable;
9 | import org.springframework.stereotype.Repository;
10 |
11 | import java.util.ArrayList;
12 | import java.util.Arrays;
13 | import java.util.HashMap;
14 | import java.util.List;
15 | import java.util.Map;
16 | import java.util.stream.Collectors;
17 |
18 | @Repository
19 | public class ProjectRepo {
20 |
21 | private final Map projects = new HashMap<>();
22 |
23 | public Project save(String name, List tags) {
24 | String code = generateCode(name);
25 | Project project = new Project(code, name, new ArrayList<>(), tags);
26 | projects.put(code, project);
27 | return project;
28 | }
29 |
30 | public void addTask(String code, Task task) {
31 | projects.get(code).addTask(task);
32 | }
33 |
34 | public Project byCode(String code) {
35 | return projects.get(code);
36 | }
37 |
38 | //Relay page! Not Spring Data page!
39 | public Page findProjects(int limit, int offset, String... tags) {
40 | List filteredByTag = findByTags(limit,offset, tags);
41 | List page = filteredByTag.subList(offset, Math.min(offset + limit, filteredByTag.size()));
42 | return PageFactory.createOffsetBasedPage(page, filteredByTag.size(), offset);
43 | }
44 |
45 | //SpringData page
46 | public org.springframework.data.domain.Page findProjects(Pageable paging, String... tags) {
47 | int offset = paging.getPageNumber() * paging.getPageSize();
48 | int limit = offset + paging.getPageSize();
49 | List filteredByTag = findByTags(limit, offset, tags);
50 | List page = filteredByTag.subList(offset, Math.min(offset + limit, filteredByTag.size()));
51 | return new PageImpl<>(page, paging, filteredByTag.size());
52 | }
53 |
54 | private List findByTags(int limit, int offset, String... tags) {
55 | return projects.values().stream()
56 | .filter(project -> tags == null || tags.length == 0 || Arrays.stream(tags).anyMatch(tag ->
57 | project.getTags().contains(tag)))
58 | .collect(Collectors.toList());
59 | }
60 |
61 | private String generateCode(String name) {
62 | if (name.length() < 3) {
63 | return name.toUpperCase() + "XX";
64 | }
65 | List chars = new ArrayList<>();
66 | boolean take = false;
67 | for(char c : name.toCharArray()) {
68 | if (Character.isUpperCase(c) || take) {
69 | chars.add(Character.toUpperCase(c) + "");
70 | take = false;
71 | }
72 | if (c == ' ') {
73 | take = true;
74 | }
75 | }
76 | if (chars.size() < 3) {
77 | chars.add(1, name.substring(1, 3).toUpperCase());
78 | }
79 | return String.join("", chars);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/repo/TaskRepo.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.repo;
2 |
3 | import io.leangen.graphql.samples.dto.Task;
4 | import io.leangen.graphql.samples.dto.Project;
5 | import io.leangen.graphql.samples.dto.Status;
6 | import io.leangen.graphql.samples.dto.Type;
7 | import org.springframework.stereotype.Repository;
8 |
9 | import java.util.Arrays;
10 | import java.util.Collection;
11 | import java.util.stream.Collectors;
12 |
13 | @Repository
14 | public class TaskRepo {
15 |
16 | private final ProjectRepo projectRepo;
17 |
18 | public TaskRepo(ProjectRepo projectRepo) {
19 | this.projectRepo = projectRepo;
20 | }
21 |
22 | public Task saveTask(String projectCode, String description, Status status, Type type) {
23 | Project project = projectRepo.byCode(projectCode);
24 | String code = projectCode + "-" + (project.getTasks().size() + 1);
25 | Task saved = new Task(code, description, status, type);
26 | projectRepo.addTask(projectCode, saved);
27 | return saved;
28 | }
29 |
30 | public Task byCode(String code) {
31 | String projectCode = getProjectCode(code);
32 | return projectRepo.byCode(projectCode).getTasks().stream()
33 | .filter(task -> task.getCode().equals(code))
34 | .findFirst().orElse(null);
35 | }
36 |
37 | public Collection byProjectCodeAndStatus(String projectCode, Status... statuses) {
38 | return projectRepo.byCode(projectCode).getTasks().stream()
39 | .filter(task -> statuses == null || Arrays.stream(statuses).anyMatch(status -> task.getStatus() == status))
40 | .collect(Collectors.toList());
41 | }
42 |
43 | public static String getProjectCode(String taskCode) {
44 | return taskCode.substring(0, taskCode.indexOf("-"));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/service/ProjectService.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.service;
2 |
3 | import io.leangen.graphql.annotations.GraphQLArgument;
4 | import io.leangen.graphql.annotations.GraphQLContext;
5 | import io.leangen.graphql.annotations.GraphQLEnvironment;
6 | import io.leangen.graphql.annotations.GraphQLMutation;
7 | import io.leangen.graphql.annotations.GraphQLQuery;
8 | import io.leangen.graphql.execution.ResolutionEnvironment;
9 | import io.leangen.graphql.execution.relay.Page;
10 | import io.leangen.graphql.samples.dto.Project;
11 | import io.leangen.graphql.samples.dto.Task;
12 | import io.leangen.graphql.samples.repo.ProjectRepo;
13 | import io.leangen.graphql.samples.repo.TaskRepo;
14 | import io.leangen.graphql.spqr.spring.annotations.GraphQLApi;
15 | import org.dataloader.DataLoader;
16 | import org.springframework.data.domain.Pageable;
17 | import org.springframework.stereotype.Service;
18 |
19 | import java.util.List;
20 | import java.util.concurrent.CompletableFuture;
21 |
22 | @GraphQLApi
23 | @Service
24 | public class ProjectService {
25 |
26 | private final ProjectRepo repo;
27 |
28 | public ProjectService(ProjectRepo repo) {
29 | this.repo = repo;
30 | }
31 |
32 | @GraphQLQuery
33 | public Project project(String code) {
34 | return repo.byCode(code);
35 | }
36 |
37 | @GraphQLMutation
38 | public Project createProject(String name, @GraphQLArgument(name = "tags", defaultValue = "[]") List tags) {
39 | return repo.save(name, tags);
40 | }
41 |
42 | @GraphQLQuery
43 | //Relay page! Not Spring Data page!
44 | public Page projects(
45 | @GraphQLArgument(name = "limit", defaultValue = "10") int limit,
46 | @GraphQLArgument(name = "offset", defaultValue = "0") int offset,
47 | String... tags) {
48 | return repo.findProjects(limit, offset, tags);
49 | }
50 |
51 | @GraphQLQuery
52 | //Spring Data page. Toggle graphql.spqr.relay.spring-data-compatible for Relay compliant mapping
53 | public org.springframework.data.domain.Page projectsData(Pageable paging, String... tags) {
54 | return repo.findProjects(paging, tags);
55 | }
56 |
57 | @GraphQLQuery
58 | public Project project(@GraphQLContext Task task) {
59 | return project(TaskRepo.getProjectCode(task.getCode()));
60 | }
61 |
62 | @GraphQLQuery
63 | public CompletableFuture currentFunding(@GraphQLContext Project project, @GraphQLEnvironment ResolutionEnvironment env) {
64 | DataLoader fundingLoader = env.dataFetchingEnvironment.getDataLoader("funding");
65 | return fundingLoader.load(project);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/java/io/leangen/graphql/samples/service/TaskService.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples.service;
2 |
3 | import io.leangen.graphql.annotations.GraphQLArgument;
4 | import io.leangen.graphql.annotations.GraphQLMutation;
5 | import io.leangen.graphql.annotations.GraphQLNonNull;
6 | import io.leangen.graphql.annotations.GraphQLQuery;
7 | import io.leangen.graphql.annotations.GraphQLSubscription;
8 | import io.leangen.graphql.samples.dto.Status;
9 | import io.leangen.graphql.samples.dto.Task;
10 | import io.leangen.graphql.samples.dto.Type;
11 | import io.leangen.graphql.samples.repo.TaskRepo;
12 | import io.leangen.graphql.spqr.spring.annotations.GraphQLApi;
13 | import io.leangen.graphql.spqr.spring.util.ConcurrentMultiMap;
14 | import org.reactivestreams.Publisher;
15 | import org.springframework.stereotype.Service;
16 | import reactor.core.publisher.Flux;
17 | import reactor.core.publisher.FluxSink;
18 |
19 | import java.util.Collection;
20 |
21 | @GraphQLApi
22 | @Service
23 | public class TaskService {
24 |
25 | private final TaskRepo repo;
26 | private final ConcurrentMultiMap> subscribers = new ConcurrentMultiMap<>();
27 |
28 | public TaskService(TaskRepo repo) {
29 | this.repo = repo;
30 | }
31 |
32 | @GraphQLMutation
33 | public Task createTask(String projectCode, String description, @GraphQLArgument(name = "status", defaultValue = "\"PLANNING\"") Status status, Type type) {
34 | return repo.saveTask(projectCode, description, status, type);
35 | }
36 |
37 | @GraphQLMutation
38 | public Task updateTask(@GraphQLNonNull String code, String description, @GraphQLNonNull Status status) {
39 | Task task = repo.byCode(code);
40 | if (description != null) {
41 | task.setDescription(description);
42 | }
43 | task.setStatus(status);
44 | //Notify all the subscribers following this task
45 | subscribers.get(code).forEach(subscriber -> subscriber.next(task));
46 | return task;
47 | }
48 |
49 | @GraphQLQuery
50 | public Collection tasks(String projectCode, Status... statuses) {
51 | return repo.byProjectCodeAndStatus(projectCode, statuses);
52 | }
53 |
54 | @GraphQLQuery
55 | public Task task(String code) {
56 | return repo.byCode(code);
57 | }
58 |
59 | @GraphQLSubscription
60 | public Publisher taskStatusChanged(String code) {
61 | return Flux.create(subscriber -> subscribers.add(code, subscriber.onDispose(() -> subscribers.remove(code, subscriber))), FluxSink.OverflowStrategy.LATEST);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 | graphql.spqr.gui.enabled=true
3 | graphql.spqr.relay.connection-check-relaxed=true
4 | graphql.spqr.relay.spring-data-compatible=false
5 | spring.data.rest.default-page-size=20
6 | spring.mvc.converters.preferred-json-mapper=jackson
7 |
--------------------------------------------------------------------------------
/spring-boot-starter-sample/src/test/java/io/leangen/graphql/samples/StarterDemoApplicationTests.java:
--------------------------------------------------------------------------------
1 | package io.leangen.graphql.samples;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | public class StarterDemoApplicationTests {
8 |
9 | @Test
10 | public void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------