@quilted/create 0.1.81 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/templates/app-graphql/features/start/Start/Start.test.tsx +3 -1
- package/templates/app-graphql/features/start/Start/Start.tsx +1 -1
- package/templates/app-graphql/features/start/Start/StartQuery.graphql +3 -1
- package/templates/app-graphql/server/graphql.ts +15 -20
- package/templates/app-graphql/server.tsx +7 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c40bc1de`](https://github.com/lemonmade/quilt/commit/c40bc1deb3e3b48c30c881a4dd7bd98e2807a596) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix more GraphQL template issues
|
|
8
|
+
|
|
3
9
|
## 0.1.81
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -9,7 +9,9 @@ import startQuery from './StartQuery.graphql';
|
|
|
9
9
|
describe('<Start />', () => {
|
|
10
10
|
it('welcomes the user with their name', async () => {
|
|
11
11
|
const name = 'Winston';
|
|
12
|
-
const graphql = new GraphQLController([
|
|
12
|
+
const graphql = new GraphQLController([
|
|
13
|
+
fillGraphQL(startQuery, {me: {name}}),
|
|
14
|
+
]);
|
|
13
15
|
|
|
14
16
|
const start = await renderApp(<Start />, {graphql});
|
|
15
17
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {graphql} from 'graphql';
|
|
2
|
+
import {
|
|
3
|
+
toGraphQLSource,
|
|
4
|
+
type GraphQLFetch,
|
|
5
|
+
type GraphQLResult,
|
|
6
|
+
} from '@quilted/quilt/graphql';
|
|
2
7
|
import {
|
|
3
8
|
createGraphQLSchema,
|
|
4
9
|
createGraphQLResolverBuilder,
|
|
5
10
|
} from '@quilted/quilt/graphql/server';
|
|
6
|
-
import type {GraphQLResult, GraphQLSource} from '@quilted/quilt/graphql';
|
|
7
11
|
|
|
8
12
|
import schemaSource, {type Schema} from '../graphql/schema.ts';
|
|
9
13
|
|
|
@@ -26,22 +30,13 @@ const Query = createQueryResolver({
|
|
|
26
30
|
|
|
27
31
|
const schema = createGraphQLSchema(schemaSource, {Query, Person});
|
|
28
32
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const result = await graphql({
|
|
40
|
-
schema,
|
|
41
|
-
source: operation,
|
|
42
|
-
operationName,
|
|
43
|
-
variableValues: variables,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return result as GraphQLResult<Data>;
|
|
47
|
-
}
|
|
33
|
+
export const performGraphQLOperation: GraphQLFetch =
|
|
34
|
+
async function performGraphQLOperation(operation, options) {
|
|
35
|
+
const result = await graphql({
|
|
36
|
+
schema,
|
|
37
|
+
source: toGraphQLSource(operation),
|
|
38
|
+
variableValues: options?.variables as Readonly<{}>,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return result as GraphQLResult<any>;
|
|
42
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
2
|
|
|
3
3
|
import {RequestRouter, JSONResponse} from '@quilted/quilt/request-router';
|
|
4
|
-
import {type GraphQLFetch} from '@quilted/quilt/graphql';
|
|
5
4
|
import {BrowserAssets} from '@quilted/quilt/magic/assets';
|
|
6
5
|
|
|
7
6
|
const router = new RequestRouter();
|
|
@@ -29,23 +28,13 @@ router.get(async (request) => {
|
|
|
29
28
|
import('@quilted/quilt/server'),
|
|
30
29
|
]);
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const response = await renderToResponse(<App fetchGraphQL={fetchGraphQL} />, {
|
|
46
|
-
request,
|
|
47
|
-
assets,
|
|
48
|
-
});
|
|
31
|
+
const response = await renderToResponse(
|
|
32
|
+
<App fetchGraphQL={performGraphQLOperation} />,
|
|
33
|
+
{
|
|
34
|
+
request,
|
|
35
|
+
assets,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
49
38
|
|
|
50
39
|
return response;
|
|
51
40
|
});
|