MCPcopy Index your code
hub / github.com/parse-community/parse-server / maybeRunValidator

Function maybeRunValidator

src/triggers.js:721–747  ·  view source on GitHub ↗
(request, functionName, auth)

Source from the content-addressed store, hash-verified

719 return error;
720}
721export function maybeRunValidator(request, functionName, auth) {
722 const theValidator = getValidator(functionName, Parse.applicationId);
723 if (!theValidator) {
724 return;
725 }
726 if (typeof theValidator === 'object' && theValidator.skipWithMasterKey && request.master) {
727 request.skipWithMasterKey = true;
728 }
729 return new Promise((resolve, reject) => {
730 return Promise.resolve()
731 .then(() => {
732 return typeof theValidator === 'object'
733 ? builtInTriggerValidator(theValidator, request, auth)
734 : theValidator(request);
735 })
736 .then(() => {
737 resolve();
738 })
739 .catch(e => {
740 const error = resolveError(e, {
741 code: Parse.Error.VALIDATION_ERROR,
742 message: 'Validation failed.',
743 });
744 reject(error);
745 });
746 });
747}
748async function builtInTriggerValidator(options, request, auth) {
749 if (request.master && !options.validateMasterKey) {
750 return;

Callers 6

runTriggerFunction · 0.85
maybeRunAfterFindTriggerFunction · 0.85
maybeRunQueryTriggerFunction · 0.85
maybeRunTriggerFunction · 0.85
maybeRunFileTriggerFunction · 0.85

Calls 4

getValidatorFunction · 0.85
builtInTriggerValidatorFunction · 0.85
resolveErrorFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected