Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating all the things #71

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
17,313 changes: 7,625 additions & 9,688 deletions client/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.3.2",
"@material-ui/lab": "^4.0.0-alpha.23",
"apollo-boost": "^0.4.4",
"@material-ui/core": "^4.12.4",
"@material-ui/lab": "^4.0.0-alpha.61",
"apollo-boost": "^0.4.9",
"apollo-link-batch-http": "^1.2.14",
"graphql": "^14.4.2",
"react": "^16.9.0",
"react-apollo": "^3.0.1",
"react-dom": "^16.9.0",
"react-scripts": "^3.1.1"
"graphql": "^16.3.0",
"react": "^18.1.0",
"react-apollo": "^3.1.5",
"react-dom": "^18.1.0",
"react-scripts": "^5.0.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
6 changes: 4 additions & 2 deletions client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';
import { App } from './App';
Expand All @@ -12,4 +12,6 @@ const ApolloApp = (AppComponent) => (
</ApolloProvider>
);

render(ApolloApp(App), document.getElementById('root'));
const root = createRoot(document.getElementById('root'));

root.render(ApolloApp(App))
8 changes: 4 additions & 4 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IMocks } from 'graphql-tools';
import { IntrospectionQuery } from 'graphql';
import { IntrospectionQuery } from "graphql";
import { IMocks } from "@graphql-tools/mock";
interface MockGraphQLOptions {
schema: string | string[] | IntrospectionQuery;
mock: IMocks;
schema: string | string[] | IntrospectionQuery;
delay?: number;
}
/**
Expand All @@ -18,4 +18,4 @@ export declare const mockGraphQL: (options: MockGraphQLOptions, req: any, res: a
*/
export declare const graphQLSchemaFromFile: (filePath: string) => string;
export {};
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.graphQLSchemaFromFile = exports.mockGraphQL = void 0;
var tslib_1 = require("tslib");
var graphql_tools_1 = require("graphql-tools");
var schema_1 = require("@graphql-tools/schema");
var graphql_1 = require("graphql");
var mock_1 = require("@graphql-tools/mock");
var fs = tslib_1.__importStar(require("fs"));
var path = tslib_1.__importStar(require("path"));
/**
Expand All @@ -19,22 +20,23 @@ var wait = function (timeout) { return function (response) {
* @param req
* @param res
*/
exports.mockGraphQL = function (options, req, res) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var schema, payload, query, variables, data;
var mockGraphQL = function (options, req, res) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var schema, schemaWithMocks, payload, query, variables, data;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
schema = graphql_tools_1.makeExecutableSchema({
schema = (0, schema_1.makeExecutableSchema)({
typeDefs: schemaAsSDL(options.schema),
});
graphql_tools_1.addMockFunctionsToSchema({
schemaWithMocks = (0, mock_1.addMocksToSchema)({
schema: schema,
mocks: options.mock,
});
payload = JSON.parse(req.body);
query = payload.query, variables = payload.variables;
return [4 /*yield*/, graphql_1.graphql({
schema: schema,
console.log("QUERY", query);
return [4 /*yield*/, (0, graphql_1.graphql)({
schema: schemaWithMocks,
source: query,
variableValues: variables,
})
Expand All @@ -47,13 +49,15 @@ exports.mockGraphQL = function (options, req, res) { return tslib_1.__awaiter(vo
}
});
}); };
exports.mockGraphQL = mockGraphQL;
/**
* Read graphql schema from .graphql file
* @param filePath
*/
exports.graphQLSchemaFromFile = function (filePath) {
var graphQLSchemaFromFile = function (filePath) {
return fs.readFileSync(path.resolve(filePath), 'utf8');
};
exports.graphQLSchemaFromFile = graphQLSchemaFromFile;
/**
* Takes the schema either as the full .graphql file (string) or the introspection object.
* @param schema
Expand All @@ -62,5 +66,5 @@ var schemaAsSDL = function (schema) {
if (typeof schema === 'string' || Array.isArray(schema)) {
return schema;
}
return graphql_1.printSchema(graphql_1.buildClientSchema(schema));
return (0, graphql_1.printSchema)((0, graphql_1.buildClientSchema)(schema));
};
Loading