Remove viewer from logout (#7029)

This commit is contained in:
Antoine Cormouls
2020-12-08 00:45:51 +01:00
committed by GitHub
parent 88e958a75f
commit b398894341
4 changed files with 93 additions and 178 deletions

116
package-lock.json generated
View File

@@ -4408,9 +4408,9 @@
} }
}, },
"bl": { "bl": {
"version": "1.2.2", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
"integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
"dev": true, "dev": true,
"requires": { "requires": {
"readable-stream": "^2.3.5", "readable-stream": "^2.3.5",
@@ -4548,9 +4548,9 @@
} }
}, },
"bson": { "bson": {
"version": "1.1.3", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.3.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.5.tgz",
"integrity": "sha512-TdiJxMVnodVS7r0BdL42y/pqC9cL2iKynVwA0Ho3qbsQYr428veL3l7BQyuqiw+Q5SqqoT0m4srSY/BlZ9AxXg==", "integrity": "sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg==",
"dev": true "dev": true
}, },
"buffer": { "buffer": {
@@ -5702,6 +5702,15 @@
"are-we-there-yet": "~1.1.2", "are-we-there-yet": "~1.1.2",
"gauge": "~1.2.5" "gauge": "~1.2.5"
} }
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
} }
} }
}, },
@@ -6452,9 +6461,9 @@
}, },
"dependencies": { "dependencies": {
"type": { "type": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/type/-/type-2.0.0.tgz", "resolved": "https://registry.npmjs.org/type/-/type-2.1.0.tgz",
"integrity": "sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==", "integrity": "sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==",
"dev": true "dev": true
} }
} }
@@ -7196,12 +7205,6 @@
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
"dev": true "dev": true
}, },
"graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
"dev": true
},
"graphql": { "graphql": {
"version": "15.4.0", "version": "15.4.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-15.4.0.tgz", "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.4.0.tgz",
@@ -7428,9 +7431,9 @@
}, },
"dependencies": { "dependencies": {
"readable-stream": { "readable-stream": {
"version": "3.4.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dev": true, "dev": true,
"requires": { "requires": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
@@ -7878,9 +7881,9 @@
} }
}, },
"is-mongodb-running": { "is-mongodb-running": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-mongodb-running/-/is-mongodb-running-1.0.1.tgz", "resolved": "https://registry.npmjs.org/is-mongodb-running/-/is-mongodb-running-1.0.2.tgz",
"integrity": "sha512-gyUmdhGKLHuDv+JGma70b1P1WLBMy8bvt9QLSEojSSi3/5FbUKuOKCNzHmto9ftMjyLtzlUtfCoSGdkPvx6H5w==", "integrity": "sha512-EslN8MErcBPExb+iK4RnG1n28JGjByA2Rm3YPmdHDGCRd7Hc2uvqshyVMAJXxbDSxRMy8vhxims2oRqQUeGJeA==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.1", "chalk": "^2.4.1",
@@ -9572,9 +9575,8 @@
} }
}, },
"mongodb-runner": { "mongodb-runner": {
"version": "4.8.0", "version": "github:mongodb-js/runner#dfb9a520147de6e2537f7c1c21a5e7005d1905f8",
"resolved": "https://registry.npmjs.org/mongodb-runner/-/mongodb-runner-4.8.0.tgz", "from": "github:mongodb-js/runner",
"integrity": "sha512-wFTjkqVCkH9MK05t8kSDVP3oSmFq43AYwDBqVWndpggsO+Jr7sBqgf2VlNKlP5xzWF9rX2gqjESyc1Q3QxsXOw==",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "^3.1.0", "async": "^3.1.0",
@@ -9594,18 +9596,18 @@
}, },
"dependencies": { "dependencies": {
"async": { "async": {
"version": "3.1.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==", "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==",
"dev": true "dev": true
}, },
"debug": { "debug": {
"version": "4.1.1", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ms": "^2.1.1" "ms": "2.1.2"
} }
} }
} }
@@ -9651,12 +9653,6 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true "dev": true
},
"rimraf": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.6.tgz",
"integrity": "sha1-xZWXVpsU2VatKcrMQr3d9fDqT0w=",
"dev": true
} }
} }
}, },
@@ -11137,13 +11133,10 @@
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs="
}, },
"rimraf": { "rimraf": {
"version": "2.7.1", "version": "2.2.6",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.6.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "integrity": "sha1-xZWXVpsU2VatKcrMQr3d9fDqT0w=",
"dev": true, "dev": true
"requires": {
"glob": "^7.1.3"
}
}, },
"run-async": { "run-async": {
"version": "2.3.0", "version": "2.3.0",
@@ -11198,22 +11191,19 @@
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o="
}, },
"seek-bzip": { "seek-bzip": {
"version": "1.0.5", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz",
"integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "~2.8.1" "commander": "^2.8.1"
}, },
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.8.1", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true, "dev": true
"requires": {
"graceful-readlink": ">= 1.0.0"
}
} }
} }
}, },
@@ -12319,9 +12309,9 @@
"dev": true "dev": true
}, },
"unbzip2-stream": { "unbzip2-stream": {
"version": "1.4.0", "version": "1.4.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.0.tgz", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
"integrity": "sha512-kVx7CDAsdBSWVf404Mw7oI9i09w5/mTT/Ruk+RWa64PLYKvsAucLLFHvQtnvjeADM4ZizxrvG5SHnF4Te4T2Cg==", "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
"dev": true, "dev": true,
"requires": { "requires": {
"buffer": "^5.2.1", "buffer": "^5.2.1",
@@ -12329,13 +12319,13 @@
}, },
"dependencies": { "dependencies": {
"buffer": { "buffer": {
"version": "5.5.0", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
"integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"base64-js": "^1.0.2", "base64-js": "^1.3.1",
"ieee754": "^1.1.4" "ieee754": "^1.1.13"
} }
} }
} }

View File

@@ -87,7 +87,7 @@
"jsdoc": "3.6.3", "jsdoc": "3.6.3",
"jsdoc-babel": "0.5.0", "jsdoc-babel": "0.5.0",
"lint-staged": "10.2.3", "lint-staged": "10.2.3",
"mongodb-runner": "4.8.0", "mongodb-runner": "mongodb-js/runner",
"node-fetch": "2.6.1", "node-fetch": "2.6.1",
"nyc": "15.1.0", "nyc": "15.1.0",
"prettier": "2.0.5" "prettier": "2.0.5"
@@ -113,7 +113,7 @@
"node": ">= 8" "node": ">= 8"
}, },
"bin": { "bin": {
"parse-server": "./bin/parse-server" "parse-server": "bin/parse-server"
}, },
"optionalDependencies": { "optionalDependencies": {
"@node-rs/bcrypt": "0.4.1" "@node-rs/bcrypt": "0.4.1"

View File

@@ -964,7 +964,7 @@ describe('ParseGraphQLServer', () => {
.map(field => field.name) .map(field => field.name)
.sort(); .sort();
expect(payloadFields).toEqual(['clientMutationId', 'viewer']); expect(payloadFields).toEqual(['clientMutationId', 'ok']);
}); });
it('should have clientMutationId in createClass mutation input', async () => { it('should have clientMutationId in createClass mutation input', async () => {
@@ -6943,9 +6943,7 @@ describe('ParseGraphQLServer', () => {
mutation LogOutUser($input: LogOutInput!) { mutation LogOutUser($input: LogOutInput!) {
logOut(input: $input) { logOut(input: $input) {
clientMutationId clientMutationId
viewer { ok
sessionToken
}
} }
} }
`, `,
@@ -6961,7 +6959,7 @@ describe('ParseGraphQLServer', () => {
}, },
}); });
expect(logOut.data.logOut.clientMutationId).toEqual(clientMutationId); expect(logOut.data.logOut.clientMutationId).toEqual(clientMutationId);
expect(logOut.data.logOut.viewer.sessionToken).toEqual(sessionToken); expect(logOut.data.logOut.ok).toEqual(true);
try { try {
await apolloClient.query({ await apolloClient.query({

View File

@@ -1,9 +1,4 @@
import { import { GraphQLNonNull, GraphQLString, GraphQLBoolean, GraphQLInputObjectType } from 'graphql';
GraphQLNonNull,
GraphQLString,
GraphQLBoolean,
GraphQLInputObjectType,
} from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay'; import { mutationWithClientMutationId } from 'graphql-relay';
import UsersRouter from '../../Routers/UsersRouter'; import UsersRouter from '../../Routers/UsersRouter';
import * as objectsMutations from '../helpers/objectsMutations'; import * as objectsMutations from '../helpers/objectsMutations';
@@ -20,20 +15,16 @@ const load = parseGraphQLSchema => {
const signUpMutation = mutationWithClientMutationId({ const signUpMutation = mutationWithClientMutationId({
name: 'SignUp', name: 'SignUp',
description: description: 'The signUp mutation can be used to create and sign up a new user.',
'The signUp mutation can be used to create and sign up a new user.',
inputFields: { inputFields: {
fields: { fields: {
descriptions: descriptions: 'These are the fields of the new user to be created and signed up.',
'These are the fields of the new user to be created and signed up.', type: parseGraphQLSchema.parseClassTypes['_User'].classGraphQLCreateType,
type:
parseGraphQLSchema.parseClassTypes['_User'].classGraphQLCreateType,
}, },
}, },
outputFields: { outputFields: {
viewer: { viewer: {
description: description: 'This is the new user that was created, signed up and returned as a viewer.',
'This is the new user that was created, signed up and returned as a viewer.',
type: new GraphQLNonNull(parseGraphQLSchema.viewerType), type: new GraphQLNonNull(parseGraphQLSchema.viewerType),
}, },
}, },
@@ -59,12 +50,7 @@ const load = parseGraphQLSchema => {
context.info.sessionToken = sessionToken; context.info.sessionToken = sessionToken;
return { return {
viewer: await getUserFromSessionToken( viewer: await getUserFromSessionToken(context, mutationInfo, 'viewer.user.', objectId),
context,
mutationInfo,
'viewer.user.',
objectId
),
}; };
} catch (e) { } catch (e) {
parseGraphQLSchema.handleError(e); parseGraphQLSchema.handleError(e);
@@ -72,11 +58,7 @@ const load = parseGraphQLSchema => {
}, },
}); });
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(signUpMutation.args.input.type.ofType, true, true);
signUpMutation.args.input.type.ofType,
true,
true
);
parseGraphQLSchema.addGraphQLType(signUpMutation.type, true, true); parseGraphQLSchema.addGraphQLType(signUpMutation.type, true, true);
parseGraphQLSchema.addGraphQLMutation('signUp', signUpMutation, true, true); parseGraphQLSchema.addGraphQLMutation('signUp', signUpMutation, true, true);
const logInWithMutation = mutationWithClientMutationId({ const logInWithMutation = mutationWithClientMutationId({
@@ -89,35 +71,30 @@ const load = parseGraphQLSchema => {
type: new GraphQLNonNull(OBJECT), type: new GraphQLNonNull(OBJECT),
}, },
fields: { fields: {
descriptions: descriptions: 'These are the fields of the user to be created/updated and logged in.',
'These are the fields of the user to be created/updated and logged in.',
type: new GraphQLInputObjectType({ type: new GraphQLInputObjectType({
name: 'UserLoginWithInput', name: 'UserLoginWithInput',
fields: () => { fields: () => {
const classGraphQLCreateFields = parseGraphQLSchema.parseClassTypes[ const classGraphQLCreateFields = parseGraphQLSchema.parseClassTypes[
'_User' '_User'
].classGraphQLCreateType.getFields(); ].classGraphQLCreateType.getFields();
return Object.keys(classGraphQLCreateFields).reduce( return Object.keys(classGraphQLCreateFields).reduce((fields, fieldName) => {
(fields, fieldName) => { if (
if ( fieldName !== 'password' &&
fieldName !== 'password' && fieldName !== 'username' &&
fieldName !== 'username' && fieldName !== 'authData'
fieldName !== 'authData' ) {
) { fields[fieldName] = classGraphQLCreateFields[fieldName];
fields[fieldName] = classGraphQLCreateFields[fieldName]; }
} return fields;
return fields; }, {});
},
{}
);
}, },
}), }),
}, },
}, },
outputFields: { outputFields: {
viewer: { viewer: {
description: description: 'This is the new user that was created, signed up and returned as a viewer.',
'This is the new user that was created, signed up and returned as a viewer.',
type: new GraphQLNonNull(parseGraphQLSchema.viewerType), type: new GraphQLNonNull(parseGraphQLSchema.viewerType),
}, },
}, },
@@ -143,12 +120,7 @@ const load = parseGraphQLSchema => {
context.info.sessionToken = sessionToken; context.info.sessionToken = sessionToken;
return { return {
viewer: await getUserFromSessionToken( viewer: await getUserFromSessionToken(context, mutationInfo, 'viewer.user.', objectId),
context,
mutationInfo,
'viewer.user.',
objectId
),
}; };
} catch (e) { } catch (e) {
parseGraphQLSchema.handleError(e); parseGraphQLSchema.handleError(e);
@@ -156,18 +128,9 @@ const load = parseGraphQLSchema => {
}, },
}); });
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(logInWithMutation.args.input.type.ofType, true, true);
logInWithMutation.args.input.type.ofType,
true,
true
);
parseGraphQLSchema.addGraphQLType(logInWithMutation.type, true, true); parseGraphQLSchema.addGraphQLType(logInWithMutation.type, true, true);
parseGraphQLSchema.addGraphQLMutation( parseGraphQLSchema.addGraphQLMutation('logInWith', logInWithMutation, true, true);
'logInWith',
logInWithMutation,
true,
true
);
const logInMutation = mutationWithClientMutationId({ const logInMutation = mutationWithClientMutationId({
name: 'LogIn', name: 'LogIn',
@@ -184,8 +147,7 @@ const load = parseGraphQLSchema => {
}, },
outputFields: { outputFields: {
viewer: { viewer: {
description: description: 'This is the existing user that was logged in and returned as a viewer.',
'This is the existing user that was logged in and returned as a viewer.',
type: new GraphQLNonNull(parseGraphQLSchema.viewerType), type: new GraphQLNonNull(parseGraphQLSchema.viewerType),
}, },
}, },
@@ -210,12 +172,7 @@ const load = parseGraphQLSchema => {
context.info.sessionToken = sessionToken; context.info.sessionToken = sessionToken;
return { return {
viewer: await getUserFromSessionToken( viewer: await getUserFromSessionToken(context, mutationInfo, 'viewer.user.', objectId),
context,
mutationInfo,
'viewer.user.',
objectId
),
}; };
} catch (e) { } catch (e) {
parseGraphQLSchema.handleError(e); parseGraphQLSchema.handleError(e);
@@ -223,11 +180,7 @@ const load = parseGraphQLSchema => {
}, },
}); });
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(logInMutation.args.input.type.ofType, true, true);
logInMutation.args.input.type.ofType,
true,
true
);
parseGraphQLSchema.addGraphQLType(logInMutation.type, true, true); parseGraphQLSchema.addGraphQLType(logInMutation.type, true, true);
parseGraphQLSchema.addGraphQLMutation('logIn', logInMutation, true, true); parseGraphQLSchema.addGraphQLMutation('logIn', logInMutation, true, true);
@@ -235,41 +188,29 @@ const load = parseGraphQLSchema => {
name: 'LogOut', name: 'LogOut',
description: 'The logOut mutation can be used to log out an existing user.', description: 'The logOut mutation can be used to log out an existing user.',
outputFields: { outputFields: {
viewer: { ok: {
description: description: "It's always true.",
'This is the existing user that was logged out and returned as a viewer.', type: new GraphQLNonNull(GraphQLBoolean),
type: new GraphQLNonNull(parseGraphQLSchema.viewerType),
}, },
}, },
mutateAndGetPayload: async (_args, context, mutationInfo) => { mutateAndGetPayload: async (_args, context) => {
try { try {
const { config, auth, info } = context; const { config, auth, info } = context;
const viewer = await getUserFromSessionToken(
context,
mutationInfo,
'viewer.user.',
auth.user.id
);
await usersRouter.handleLogOut({ await usersRouter.handleLogOut({
config, config,
auth, auth,
info, info,
}); });
return { viewer }; return { ok: true };
} catch (e) { } catch (e) {
parseGraphQLSchema.handleError(e); parseGraphQLSchema.handleError(e);
} }
}, },
}); });
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(logOutMutation.args.input.type.ofType, true, true);
logOutMutation.args.input.type.ofType,
true,
true
);
parseGraphQLSchema.addGraphQLType(logOutMutation.type, true, true); parseGraphQLSchema.addGraphQLType(logOutMutation.type, true, true);
parseGraphQLSchema.addGraphQLMutation('logOut', logOutMutation, true, true); parseGraphQLSchema.addGraphQLMutation('logOut', logOutMutation, true, true);
@@ -305,18 +246,9 @@ const load = parseGraphQLSchema => {
}, },
}); });
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(resetPasswordMutation.args.input.type.ofType, true, true);
resetPasswordMutation.args.input.type.ofType,
true,
true
);
parseGraphQLSchema.addGraphQLType(resetPasswordMutation.type, true, true); parseGraphQLSchema.addGraphQLType(resetPasswordMutation.type, true, true);
parseGraphQLSchema.addGraphQLMutation( parseGraphQLSchema.addGraphQLMutation('resetPassword', resetPasswordMutation, true, true);
'resetPassword',
resetPasswordMutation,
true,
true
);
const sendVerificationEmailMutation = mutationWithClientMutationId({ const sendVerificationEmailMutation = mutationWithClientMutationId({
name: 'SendVerificationEmail', name: 'SendVerificationEmail',
@@ -324,8 +256,7 @@ const load = parseGraphQLSchema => {
'The sendVerificationEmail mutation can be used to send the verification email again.', 'The sendVerificationEmail mutation can be used to send the verification email again.',
inputFields: { inputFields: {
email: { email: {
descriptions: descriptions: 'Email of the user that should receive the verification email',
'Email of the user that should receive the verification email',
type: new GraphQLNonNull(GraphQLString), type: new GraphQLNonNull(GraphQLString),
}, },
}, },
@@ -360,11 +291,7 @@ const load = parseGraphQLSchema => {
true, true,
true true
); );
parseGraphQLSchema.addGraphQLType( parseGraphQLSchema.addGraphQLType(sendVerificationEmailMutation.type, true, true);
sendVerificationEmailMutation.type,
true,
true
);
parseGraphQLSchema.addGraphQLMutation( parseGraphQLSchema.addGraphQLMutation(
'sendVerificationEmail', 'sendVerificationEmail',
sendVerificationEmailMutation, sendVerificationEmailMutation,