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

Function checkDepth

src/RestQuery.js:369–386  ·  view source on GitHub ↗
(where, depth)

Source from the content-addressed store, hash-verified

367 }
368 const maxDepth = rc.queryDepth;
369 const checkDepth = (where, depth) => {
370 if (depth > maxDepth) {
371 throw new Parse.Error(
372 Parse.Error.INVALID_QUERY,
373 `Query condition nesting depth exceeds maximum allowed depth of ${maxDepth}`
374 );
375 }
376 if (typeof where !== 'object' || where === null) {
377 return;
378 }
379 for (const op of ['$or', '$and', '$nor']) {
380 if (Array.isArray(where[op])) {
381 for (const subQuery of where[op]) {
382 checkDepth(subQuery, depth + 1);
383 }
384 }
385 }
386 };
387 checkDepth(this.restWhere, 0);
388};
389

Callers 3

RestQuery.jsFile · 0.85
checkDepthMethod · 0.85
_handleSubscribeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected