Skip to content

Commit d8d0d79

Browse files
committed
fix: feedbacks
1 parent c9e60cc commit d8d0d79

File tree

4 files changed

+59
-59
lines changed

4 files changed

+59
-59
lines changed

spec/ParseGraphQLServer.spec.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7092,8 +7092,8 @@ describe('ParseGraphQLServer', () => {
70927092

70937093
it("should return the config value for a specific parameter", async () => {
70947094
const query = gql`
7095-
query configValue($paramName: String!) {
7096-
configValue(paramName: $paramName) {
7095+
query cloudConfig($paramName: String!) {
7096+
cloudConfig(paramName: $paramName) {
70977097
value
70987098
isMasterKeyOnly
70997099
}
@@ -7111,14 +7111,14 @@ describe('ParseGraphQLServer', () => {
71117111
});
71127112

71137113
expect(result.errors).toBeUndefined();
7114-
expect(result.data.configValue.value).toEqual('publicValue');
7115-
expect(result.data.configValue.isMasterKeyOnly).toEqual(false);
7114+
expect(result.data.cloudConfig.value).toEqual('publicValue');
7115+
expect(result.data.cloudConfig.isMasterKeyOnly).toEqual(false);
71167116
});
71177117

71187118
it("should return null for non-existent parameter", async () => {
71197119
const query = gql`
7120-
query configValue($paramName: String!) {
7121-
configValue(paramName: $paramName) {
7120+
query cloudConfig($paramName: String!) {
7121+
cloudConfig(paramName: $paramName) {
71227122
value
71237123
isMasterKeyOnly
71247124
}
@@ -7136,18 +7136,18 @@ describe('ParseGraphQLServer', () => {
71367136
});
71377137

71387138
expect(result.errors).toBeUndefined();
7139-
expect(result.data.configValue.value).toBeNull();
7140-
expect(result.data.configValue.isMasterKeyOnly).toBeNull();
7139+
expect(result.data.cloudConfig.value).toBeNull();
7140+
expect(result.data.cloudConfig.isMasterKeyOnly).toBeNull();
71417141
});
71427142
});
71437143

71447144
describe("Config Mutations", () => {
71457145
it("should update a config value using mutation and retrieve it with query", async () => {
71467146
const mutation = gql`
7147-
mutation updateConfigValue($input: UpdateConfigValueInput!) {
7148-
updateConfigValue(input: $input) {
7147+
mutation updateCloudConfig($input: UpdateCloudConfigInput!) {
7148+
updateCloudConfig(input: $input) {
71497149
clientMutationId
7150-
configValue {
7150+
cloudConfig {
71517151
value
71527152
isMasterKeyOnly
71537153
}
@@ -7156,8 +7156,8 @@ describe('ParseGraphQLServer', () => {
71567156
`;
71577157

71587158
const query = gql`
7159-
query configValue($paramName: String!) {
7160-
configValue(paramName: $paramName) {
7159+
query cloudConfig($paramName: String!) {
7160+
cloudConfig(paramName: $paramName) {
71617161
value
71627162
isMasterKeyOnly
71637163
}
@@ -7182,8 +7182,8 @@ describe('ParseGraphQLServer', () => {
71827182
});
71837183

71847184
expect(mutationResult.errors).toBeUndefined();
7185-
expect(mutationResult.data.updateConfigValue.configValue.value).toEqual('testValue');
7186-
expect(mutationResult.data.updateConfigValue.configValue.isMasterKeyOnly).toEqual(false);
7185+
expect(mutationResult.data.updateCloudConfig.cloudConfig.value).toEqual('testValue');
7186+
expect(mutationResult.data.updateCloudConfig.cloudConfig.isMasterKeyOnly).toEqual(false);
71877187

71887188
const queryResult = await apolloClient.query({
71897189
query,
@@ -7196,16 +7196,16 @@ describe('ParseGraphQLServer', () => {
71967196
});
71977197

71987198
expect(queryResult.errors).toBeUndefined();
7199-
expect(queryResult.data.configValue.value).toEqual('testValue');
7200-
expect(queryResult.data.configValue.isMasterKeyOnly).toEqual(false);
7199+
expect(queryResult.data.cloudConfig.value).toEqual('testValue');
7200+
expect(queryResult.data.cloudConfig.isMasterKeyOnly).toEqual(false);
72017201
});
72027202

72037203
it("should update a config value with isMasterKeyOnly set to true", async () => {
72047204
const mutation = gql`
7205-
mutation updateConfigValue($input: UpdateConfigValueInput!) {
7206-
updateConfigValue(input: $input) {
7205+
mutation updateCloudConfig($input: UpdateCloudConfigInput!) {
7206+
updateCloudConfig(input: $input) {
72077207
clientMutationId
7208-
configValue {
7208+
cloudConfig {
72097209
value
72107210
isMasterKeyOnly
72117211
}
@@ -7214,8 +7214,8 @@ describe('ParseGraphQLServer', () => {
72147214
`;
72157215

72167216
const query = gql`
7217-
query configValue($paramName: String!) {
7218-
configValue(paramName: $paramName) {
7217+
query cloudConfig($paramName: String!) {
7218+
cloudConfig(paramName: $paramName) {
72197219
value
72207220
isMasterKeyOnly
72217221
}
@@ -7240,8 +7240,8 @@ describe('ParseGraphQLServer', () => {
72407240
});
72417241

72427242
expect(mutationResult.errors).toBeUndefined();
7243-
expect(mutationResult.data.updateConfigValue.configValue.value).toEqual('privateValue');
7244-
expect(mutationResult.data.updateConfigValue.configValue.isMasterKeyOnly).toEqual(true);
7243+
expect(mutationResult.data.updateCloudConfig.cloudConfig.value).toEqual('privateValue');
7244+
expect(mutationResult.data.updateCloudConfig.cloudConfig.isMasterKeyOnly).toEqual(true);
72457245

72467246
const queryResult = await apolloClient.query({
72477247
query,
@@ -7254,8 +7254,8 @@ describe('ParseGraphQLServer', () => {
72547254
});
72557255

72567256
expect(queryResult.errors).toBeUndefined();
7257-
expect(queryResult.data.configValue.value).toEqual('privateValue');
7258-
expect(queryResult.data.configValue.isMasterKeyOnly).toEqual(true);
7257+
expect(queryResult.data.cloudConfig.value).toEqual('privateValue');
7258+
expect(queryResult.data.cloudConfig.isMasterKeyOnly).toEqual(true);
72597259
});
72607260

72617261
it("should update an existing config value", async () => {
@@ -7266,10 +7266,10 @@ describe('ParseGraphQLServer', () => {
72667266
);
72677267

72687268
const mutation = gql`
7269-
mutation updateConfigValue($input: UpdateConfigValueInput!) {
7270-
updateConfigValue(input: $input) {
7269+
mutation updateCloudConfig($input: UpdateCloudConfigInput!) {
7270+
updateCloudConfig(input: $input) {
72717271
clientMutationId
7272-
configValue {
7272+
cloudConfig {
72737273
value
72747274
isMasterKeyOnly
72757275
}
@@ -7278,8 +7278,8 @@ describe('ParseGraphQLServer', () => {
72787278
`;
72797279

72807280
const query = gql`
7281-
query configValue($paramName: String!) {
7282-
configValue(paramName: $paramName) {
7281+
query cloudConfig($paramName: String!) {
7282+
cloudConfig(paramName: $paramName) {
72837283
value
72847284
isMasterKeyOnly
72857285
}
@@ -7304,7 +7304,7 @@ describe('ParseGraphQLServer', () => {
73047304
});
73057305

73067306
expect(mutationResult.errors).toBeUndefined();
7307-
expect(mutationResult.data.updateConfigValue.configValue.value).toEqual('updatedValue');
7307+
expect(mutationResult.data.updateCloudConfig.cloudConfig.value).toEqual('updatedValue');
73087308

73097309
const queryResult = await apolloClient.query({
73107310
query,
@@ -7317,15 +7317,15 @@ describe('ParseGraphQLServer', () => {
73177317
});
73187318

73197319
expect(queryResult.errors).toBeUndefined();
7320-
expect(queryResult.data.configValue.value).toEqual('updatedValue');
7320+
expect(queryResult.data.cloudConfig.value).toEqual('updatedValue');
73217321
});
73227322

73237323
it("should require master key to update config", async () => {
73247324
const mutation = gql`
7325-
mutation updateConfigValue($input: UpdateConfigValueInput!) {
7326-
updateConfigValue(input: $input) {
7325+
mutation updateCloudConfig($input: UpdateCloudConfigInput!) {
7326+
updateCloudConfig(input: $input) {
73277327
clientMutationId
7328-
configValue {
7328+
cloudConfig {
73297329
value
73307330
isMasterKeyOnly
73317331
}

src/GraphQL/ParseGraphQLSchema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const RESERVED_GRAPHQL_TYPE_NAMES = [
4949
'DeleteClassPayload',
5050
'PageInfo',
5151
];
52-
const RESERVED_GRAPHQL_QUERY_NAMES = ['health', 'viewer', 'class', 'classes', 'configValue'];
52+
const RESERVED_GRAPHQL_QUERY_NAMES = ['health', 'viewer', 'class', 'classes', 'cloudConfig'];
5353
const RESERVED_GRAPHQL_MUTATION_NAMES = [
5454
'signUp',
5555
'logIn',
@@ -59,7 +59,7 @@ const RESERVED_GRAPHQL_MUTATION_NAMES = [
5959
'createClass',
6060
'updateClass',
6161
'deleteClass',
62-
'updateConfigValue',
62+
'updateCloudConfig',
6363
];
6464

6565
class ParseGraphQLSchema {
@@ -119,7 +119,7 @@ class ParseGraphQLSchema {
119119
this.functionNamesString = functionNamesString;
120120
this.parseClassTypes = {};
121121
this.viewerType = null;
122-
this.configValueType = null;
122+
this.cloudConfigType = null;
123123
this.graphQLAutoSchema = null;
124124
this.graphQLSchema = null;
125125
this.graphQLTypes = [];

src/GraphQL/loaders/configMutations.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import GlobalConfigRouter from '../../Routers/GlobalConfigRouter';
66

77
const globalConfigRouter = new GlobalConfigRouter();
88

9-
const updateConfigValue = async (context, paramName, value, isMasterKeyOnly = false) => {
9+
const updateCloudConfig = async (context, paramName, value, isMasterKeyOnly = false) => {
1010
const { config, auth } = context;
1111

1212
if (!auth.isMaster) {
@@ -30,8 +30,8 @@ const updateConfigValue = async (context, paramName, value, isMasterKeyOnly = fa
3030
};
3131

3232
const load = parseGraphQLSchema => {
33-
const updateConfigValueMutation = mutationWithClientMutationId({
34-
name: 'UpdateConfigValue',
33+
const updateCloudConfigMutation = mutationWithClientMutationId({
34+
name: 'UpdateCloudConfig',
3535
description: 'Updates the value of a specific parameter in GlobalConfig.',
3636
inputFields: {
3737
paramName: {
@@ -49,28 +49,28 @@ const load = parseGraphQLSchema => {
4949
},
5050
},
5151
outputFields: {
52-
configValue: {
52+
cloudConfig: {
5353
description: 'The updated config value.',
54-
type: new GraphQLNonNull(parseGraphQLSchema.configValueType),
54+
type: new GraphQLNonNull(parseGraphQLSchema.cloudConfigType),
5555
},
5656
},
5757
mutateAndGetPayload: async (args, context) => {
5858
try {
5959
const { paramName, value, isMasterKeyOnly } = args;
60-
const result = await updateConfigValue(context, paramName, value, isMasterKeyOnly);
60+
const result = await updateCloudConfig(context, paramName, value, isMasterKeyOnly);
6161
return {
62-
configValue: result,
62+
cloudConfig: result,
6363
};
6464
} catch (e) {
6565
parseGraphQLSchema.handleError(e);
6666
}
6767
},
6868
});
6969

70-
parseGraphQLSchema.addGraphQLType(updateConfigValueMutation.args.input.type.ofType, true, true);
71-
parseGraphQLSchema.addGraphQLType(updateConfigValueMutation.type, true, true);
72-
parseGraphQLSchema.addGraphQLMutation('updateConfigValue', updateConfigValueMutation, true, true);
70+
parseGraphQLSchema.addGraphQLType(updateCloudConfigMutation.args.input.type.ofType, true, true);
71+
parseGraphQLSchema.addGraphQLType(updateCloudConfigMutation.type, true, true);
72+
parseGraphQLSchema.addGraphQLMutation('updateCloudConfig', updateCloudConfigMutation, true, true);
7373
};
7474

75-
export { load, updateConfigValue };
75+
export { load, updateCloudConfig };
7676

src/GraphQL/loaders/configQueries.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GraphQLNonNull, GraphQLString, GraphQLBoolean, GraphQLObjectType } from
22
import Parse from 'parse/node';
33
import { createSanitizedError } from '../../Error';
44

5-
const configValue = async (context, paramName) => {
5+
const cloudConfig = async (context, paramName) => {
66
const { config, auth } = context;
77

88
if (!auth.isMaster) {
@@ -30,32 +30,32 @@ const configValue = async (context, paramName) => {
3030
};
3131

3232
const load = (parseGraphQLSchema) => {
33-
if (!parseGraphQLSchema.configValueType) {
34-
const configValueType = new GraphQLObjectType({
33+
if (!parseGraphQLSchema.cloudConfigType) {
34+
const cloudConfigType = new GraphQLObjectType({
3535
name: 'ConfigValue',
3636
fields: {
3737
value: { type: GraphQLString },
3838
isMasterKeyOnly: { type: GraphQLBoolean },
3939
},
4040
});
41-
parseGraphQLSchema.addGraphQLType(configValueType, true, true);
42-
parseGraphQLSchema.configValueType = configValueType;
41+
parseGraphQLSchema.addGraphQLType(cloudConfigType, true, true);
42+
parseGraphQLSchema.cloudConfigType = cloudConfigType;
4343
}
4444

45-
parseGraphQLSchema.addGraphQLQuery('configValue', {
45+
parseGraphQLSchema.addGraphQLQuery('cloudConfig', {
4646
description: 'Returns the value of a specific parameter from GlobalConfig.',
4747
args: {
4848
paramName: { type: new GraphQLNonNull(GraphQLString) },
4949
},
50-
type: new GraphQLNonNull(parseGraphQLSchema.configValueType),
50+
type: new GraphQLNonNull(parseGraphQLSchema.cloudConfigType),
5151
async resolve(_source, args, context) {
5252
try {
53-
return await configValue(context, args.paramName);
53+
return await cloudConfig(context, args.paramName);
5454
} catch (e) {
5555
parseGraphQLSchema.handleError(e);
5656
}
5757
},
5858
}, false, true);
5959
};
6060

61-
export { load, configValue };
61+
export { load, cloudConfig };

0 commit comments

Comments
 (0)