Browse Source

Generate src graphql query

Andrew Swistak 6 năm trước cách đây
mục cha
commit
0345c60fe2

+ 173 - 0
app/javascript/src/__generated__/src_PokemonIndex_Query.graphql.ts

@@ -0,0 +1,173 @@
+/* tslint:disable */
+
+import { ConcreteRequest } from "relay-runtime";
+type Show_pokemon$ref = any;
+export type src_PokemonIndex_QueryVariables = {};
+export type src_PokemonIndex_QueryResponse = {
+    readonly pokemonConnection: {
+        readonly edges: ReadonlyArray<{
+            readonly node: {
+                readonly id: string;
+                readonly " $fragmentRefs": Show_pokemon$ref;
+            } | null;
+        } | null> | null;
+    };
+};
+export type src_PokemonIndex_Query = {
+    readonly response: src_PokemonIndex_QueryResponse;
+    readonly variables: src_PokemonIndex_QueryVariables;
+};
+
+
+
+/*
+query src_PokemonIndex_Query {
+  pokemonConnection {
+    edges {
+      node {
+        id
+        ...Show_pokemon
+      }
+    }
+  }
+}
+
+fragment Show_pokemon on Pokemon {
+  id
+  iid
+  nickname
+  pokedexNumber
+}
+*/
+
+const node: ConcreteRequest = (function(){
+var v0 = {
+  "kind": "ScalarField",
+  "alias": null,
+  "name": "id",
+  "args": null,
+  "storageKey": null
+};
+return {
+  "kind": "Request",
+  "fragment": {
+    "kind": "Fragment",
+    "name": "src_PokemonIndex_Query",
+    "type": "Query",
+    "metadata": null,
+    "argumentDefinitions": [],
+    "selections": [
+      {
+        "kind": "LinkedField",
+        "alias": null,
+        "name": "pokemonConnection",
+        "storageKey": null,
+        "args": null,
+        "concreteType": "PokemonConnection",
+        "plural": false,
+        "selections": [
+          {
+            "kind": "LinkedField",
+            "alias": null,
+            "name": "edges",
+            "storageKey": null,
+            "args": null,
+            "concreteType": "PokemonEdge",
+            "plural": true,
+            "selections": [
+              {
+                "kind": "LinkedField",
+                "alias": null,
+                "name": "node",
+                "storageKey": null,
+                "args": null,
+                "concreteType": "Pokemon",
+                "plural": false,
+                "selections": [
+                  (v0/*: any*/),
+                  {
+                    "kind": "FragmentSpread",
+                    "name": "Show_pokemon",
+                    "args": null
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  },
+  "operation": {
+    "kind": "Operation",
+    "name": "src_PokemonIndex_Query",
+    "argumentDefinitions": [],
+    "selections": [
+      {
+        "kind": "LinkedField",
+        "alias": null,
+        "name": "pokemonConnection",
+        "storageKey": null,
+        "args": null,
+        "concreteType": "PokemonConnection",
+        "plural": false,
+        "selections": [
+          {
+            "kind": "LinkedField",
+            "alias": null,
+            "name": "edges",
+            "storageKey": null,
+            "args": null,
+            "concreteType": "PokemonEdge",
+            "plural": true,
+            "selections": [
+              {
+                "kind": "LinkedField",
+                "alias": null,
+                "name": "node",
+                "storageKey": null,
+                "args": null,
+                "concreteType": "Pokemon",
+                "plural": false,
+                "selections": [
+                  (v0/*: any*/),
+                  {
+                    "kind": "ScalarField",
+                    "alias": null,
+                    "name": "iid",
+                    "args": null,
+                    "storageKey": null
+                  },
+                  {
+                    "kind": "ScalarField",
+                    "alias": null,
+                    "name": "nickname",
+                    "args": null,
+                    "storageKey": null
+                  },
+                  {
+                    "kind": "ScalarField",
+                    "alias": null,
+                    "name": "pokedexNumber",
+                    "args": null,
+                    "storageKey": null
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    ]
+  },
+  "params": {
+    "operationKind": "query",
+    "name": "src_PokemonIndex_Query",
+    "id": null,
+    "text": "query src_PokemonIndex_Query {\n  pokemonConnection {\n    edges {\n      node {\n        id\n        ...Show_pokemon\n      }\n    }\n  }\n}\n\nfragment Show_pokemon on Pokemon {\n  id\n  iid\n  nickname\n  pokedexNumber\n}\n",
+    "metadata": {}
+  }
+};
+})();
+(node as any).hash = '66fc985663ff11f482c564da6ef3de1a';
+export default node;

+ 2 - 2
app/javascript/src/components/pages/pokemon/Index.tsx

@@ -1,10 +1,10 @@
 import React from 'react';
 
-import {AppPokemonIndexQueryResponse} from '../../../__generated__/AppPokemonIndexQuery.graphql';
+import {src_PokemonIndex_QueryResponse as PokemonIndexQueryResponse} from '../../../__generated__/src_PokemonIndex_Query.graphql';
 import PokemonShow from './Show';
 
 function PokemonIndex(
-  props: AppPokemonIndexQueryResponse
+  props: PokemonIndexQueryResponse
 ): React.ReactElement<void> {
   return (
     <ul>

+ 11 - 11
app/javascript/src/__generated__/AppPokemonIndexQuery.graphql.ts → app/javascript/src/components/pages/pokemon/__generated__/IndexRouteQuery.graphql.ts

@@ -2,8 +2,8 @@
 
 import { ConcreteRequest } from "relay-runtime";
 type Show_pokemon$ref = any;
-export type AppPokemonIndexQueryVariables = {};
-export type AppPokemonIndexQueryResponse = {
+export type IndexRouteQueryVariables = {};
+export type IndexRouteQueryResponse = {
     readonly pokemonConnection: {
         readonly edges: ReadonlyArray<{
             readonly node: {
@@ -13,15 +13,15 @@ export type AppPokemonIndexQueryResponse = {
         } | null> | null;
     };
 };
-export type AppPokemonIndexQuery = {
-    readonly response: AppPokemonIndexQueryResponse;
-    readonly variables: AppPokemonIndexQueryVariables;
+export type IndexRouteQuery = {
+    readonly response: IndexRouteQueryResponse;
+    readonly variables: IndexRouteQueryVariables;
 };
 
 
 
 /*
-query AppPokemonIndexQuery {
+query IndexRouteQuery {
   pokemonConnection {
     edges {
       node {
@@ -52,7 +52,7 @@ return {
   "kind": "Request",
   "fragment": {
     "kind": "Fragment",
-    "name": "AppPokemonIndexQuery",
+    "name": "IndexRouteQuery",
     "type": "Query",
     "metadata": null,
     "argumentDefinitions": [],
@@ -100,7 +100,7 @@ return {
   },
   "operation": {
     "kind": "Operation",
-    "name": "AppPokemonIndexQuery",
+    "name": "IndexRouteQuery",
     "argumentDefinitions": [],
     "selections": [
       {
@@ -162,12 +162,12 @@ return {
   },
   "params": {
     "operationKind": "query",
-    "name": "AppPokemonIndexQuery",
+    "name": "IndexRouteQuery",
     "id": null,
-    "text": "query AppPokemonIndexQuery {\n  pokemonConnection {\n    edges {\n      node {\n        id\n        ...Show_pokemon\n      }\n    }\n  }\n}\n\nfragment Show_pokemon on Pokemon {\n  id\n  iid\n  nickname\n  pokedexNumber\n}\n",
+    "text": "query IndexRouteQuery {\n  pokemonConnection {\n    edges {\n      node {\n        id\n        ...Show_pokemon\n      }\n    }\n  }\n}\n\nfragment Show_pokemon on Pokemon {\n  id\n  iid\n  nickname\n  pokedexNumber\n}\n",
     "metadata": {}
   }
 };
 })();
-(node as any).hash = 'bd8d28f417b6cf2d9c83547f6107b4a8';
+(node as any).hash = '8ff4a208769e98e624855d7f1aeead27';
 export default node;

+ 1 - 3
app/javascript/src/index.tsx

@@ -15,8 +15,6 @@ import TestComponent from './components/TestComponent';
 import PokemonIndex from './components/pages/pokemon/Index';
 import PokemonCreate from './components/pages/pokemon/Create';
 
-import './frontend';
-
 function App(): React.ReactElement {
   const routeConfig = makeRouteConfig(
     <Route Component={ApplicationLayout} path='/'>
@@ -25,7 +23,7 @@ function App(): React.ReactElement {
         Component={PokemonIndex}
         path='pokemon'
         query={graphql`
-          query AppPokemonIndexQuery {
+          query src_PokemonIndex_Query {
             pokemonConnection {
               edges {
                 node {