MCPcopy
hub / github.com/parse-community/parse-server / load

Function load

src/GraphQL/loaders/usersMutations.js:14–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12const usersRouter = new UsersRouter();
13
14const load = parseGraphQLSchema => {
15 if (parseGraphQLSchema.isUsersClassDisabled) {
16 return;
17 }
18
19 const signUpMutation = mutationWithClientMutationId({
20 name: 'SignUp',
21 description: 'The signUp mutation can be used to create and sign up a new user.',
22 inputFields: {
23 fields: {
24 descriptions: 'These are the fields of the new user to be created and signed up.',
25 type: parseGraphQLSchema.parseClassTypes['_User'].classGraphQLCreateType,
26 },
27 },
28 outputFields: {
29 viewer: {
30 description: 'This is the new user that was created, signed up and returned as a viewer.',
31 type: new GraphQLNonNull(parseGraphQLSchema.viewerType),
32 },
33 },
34 mutateAndGetPayload: async (args, context, mutationInfo) => {
35 try {
36 const { fields } = cloneArgs(args);
37 const { config, auth, info } = context;
38
39 const parseFields = await transformTypes('create', fields, {
40 className: '_User',
41 parseGraphQLSchema,
42 originalFields: args.fields,
43 req: { config, auth, info },
44 });
45
46 const { sessionToken, objectId, authDataResponse } = await objectsMutations.createObject(
47 '_User',
48 parseFields,
49 config,
50 auth,
51 info
52 );
53
54 context.info.sessionToken = sessionToken;
55 const viewer = await getUserFromSessionToken(
56 context,
57 mutationInfo,
58 'viewer.user.',
59 objectId
60 );
61 if (authDataResponse && viewer.user) { viewer.user.authDataResponse = authDataResponse; }
62 return {
63 viewer,
64 };
65 } catch (e) {
66 parseGraphQLSchema.handleError(e);
67 }
68 },
69 });
70
71 parseGraphQLSchema.addGraphQLType(signUpMutation.args.input.type.ofType, true, true);

Callers

nothing calls this directly

Calls 13

cloneArgsFunction · 0.90
transformTypesFunction · 0.90
getUserFromSessionTokenFunction · 0.90
addGraphQLTypeMethod · 0.80
addGraphQLMutationMethod · 0.80
handleLogInMethod · 0.80
handleLogOutMethod · 0.80
handleResetRequestMethod · 0.80
updatePasswordMethod · 0.80
handleChallengeMethod · 0.80
createObjectMethod · 0.65

Tested by

no test coverage detected