-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat: Add GraphQL query cloudConfig to retrieve and mutation updateCloudConfig to update Cloud Config
#9947
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
Merged
mtrezza
merged 7 commits into
parse-community:alpha
from
coratgerl:feat-add-graphql-to-parse-config
Dec 3, 2025
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
473942a
feat: more
coratgerl 46f8ea9
Merge branch 'alpha' into feat-add-graphql-to-parse-config
coratgerl e92b88f
feat: add query and mutation to use Parse.Config
coratgerl a6c2bf2
fix: feedbacks
coratgerl c9e60cc
Merge branch 'alpha' into feat-add-graphql-to-parse-config
coratgerl d8d0d79
fix: feedbacks
coratgerl 5f2f6ba
Merge branch 'alpha' into feat-add-graphql-to-parse-config
mtrezza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { GraphQLNonNull, GraphQLString, GraphQLBoolean } from 'graphql'; | ||
| import { mutationWithClientMutationId } from 'graphql-relay'; | ||
| import Parse from 'parse/node'; | ||
| import { createSanitizedError } from '../../Error'; | ||
| import GlobalConfigRouter from '../../Routers/GlobalConfigRouter'; | ||
|
|
||
| const globalConfigRouter = new GlobalConfigRouter(); | ||
|
|
||
| const updateConfigValue = async (context, paramName, value, isMasterKeyOnly = false) => { | ||
| const { config, auth } = context; | ||
|
|
||
| if (!auth.isMaster) { | ||
| throw createSanitizedError( | ||
| Parse.Error.OPERATION_FORBIDDEN, | ||
| 'Master Key is required to update GlobalConfig.' | ||
| ); | ||
| } | ||
|
|
||
| await globalConfigRouter.updateGlobalConfig({ | ||
| body: { | ||
| params: { [paramName]: value }, | ||
| masterKeyOnly: { [paramName]: isMasterKeyOnly }, | ||
| }, | ||
| config, | ||
| auth, | ||
| context, | ||
| }); | ||
|
|
||
| return { value, isMasterKeyOnly }; | ||
| }; | ||
|
|
||
| const load = parseGraphQLSchema => { | ||
| const updateConfigValueMutation = mutationWithClientMutationId({ | ||
| name: 'UpdateConfigValue', | ||
| description: 'Updates the value of a specific parameter in GlobalConfig.', | ||
| inputFields: { | ||
| paramName: { | ||
| description: 'The name of the parameter to set.', | ||
| type: new GraphQLNonNull(GraphQLString), | ||
| }, | ||
| value: { | ||
| description: 'The value to set for the parameter.', | ||
| type: new GraphQLNonNull(GraphQLString), | ||
| }, | ||
| isMasterKeyOnly: { | ||
| description: 'Whether this parameter should only be accessible with master key.', | ||
| type: GraphQLBoolean, | ||
| defaultValue: false, | ||
| }, | ||
| }, | ||
| outputFields: { | ||
| configValue: { | ||
| description: 'The updated config value.', | ||
| type: new GraphQLNonNull(parseGraphQLSchema.configValueType), | ||
| }, | ||
| }, | ||
| mutateAndGetPayload: async (args, context) => { | ||
| try { | ||
| const { paramName, value, isMasterKeyOnly } = args; | ||
| const result = await updateConfigValue(context, paramName, value, isMasterKeyOnly); | ||
| return { | ||
| configValue: result, | ||
| }; | ||
| } catch (e) { | ||
| parseGraphQLSchema.handleError(e); | ||
| } | ||
| }, | ||
| }); | ||
|
|
||
| parseGraphQLSchema.addGraphQLType(updateConfigValueMutation.args.input.type.ofType, true, true); | ||
| parseGraphQLSchema.addGraphQLType(updateConfigValueMutation.type, true, true); | ||
| parseGraphQLSchema.addGraphQLMutation('updateConfigValue', updateConfigValueMutation, true, true); | ||
| }; | ||
|
|
||
| export { load, updateConfigValue }; | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.