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

Function RestQuery

src/RestQuery.js:40–81  ·  view source on GitHub ↗

* Use to perform a query on a class. It will run security checks and triggers. * @param options * @param options.method {RestQuery.Method} The type of query to perform * @param options.config {ParseServerConfiguration} The server configuration * @param options.auth {Auth} The auth object for the

({
  method,
  config,
  auth,
  className,
  restWhere = {},
  restOptions = {},
  clientSDK,
  runAfterFind = true,
  runBeforeFind = true,
  context,
})

Source from the content-addressed store, hash-verified

38 * @returns {Promise<_UnsafeRestQuery>} A promise that is resolved with the _UnsafeRestQuery object
39 */
40async function RestQuery({
41 method,
42 config,
43 auth,
44 className,
45 restWhere = {},
46 restOptions = {},
47 clientSDK,
48 runAfterFind = true,
49 runBeforeFind = true,
50 context,
51}) {
52 if (![RestQuery.Method.find, RestQuery.Method.get].includes(method)) {
53 throw new Parse.Error(Parse.Error.INVALID_QUERY, 'bad query type');
54 }
55 const isGet = method === RestQuery.Method.get;
56 enforceRoleSecurity(method, className, auth, config);
57 const result = runBeforeFind
58 ? await triggers.maybeRunQueryTrigger(
59 triggers.Types.beforeFind,
60 className,
61 restWhere,
62 restOptions,
63 config,
64 auth,
65 context,
66 isGet
67 )
68 : Promise.resolve({ restWhere, restOptions });
69
70 return new _UnsafeRestQuery(
71 config,
72 auth,
73 className,
74 result.restWhere || restWhere,
75 result.restOptions || restOptions,
76 clientSDK,
77 runAfterFind,
78 context,
79 isGet
80 );
81}
82
83RestQuery.Method = Object.freeze({
84 get: 'get',

Callers 15

renewSessionIfNeededFunction · 0.85
getAuthForSessionTokenFunction · 0.85
Auth.jsFile · 0.85
runFindTriggersFunction · 0.85
delFunction · 0.85
updateFunction · 0.85
RestWrite.jsFile · 0.85
RestQuery.jsFile · 0.85
includePathFunction · 0.85
sendPushMethod · 0.85
verifyEmailMethod · 0.85

Calls 1

enforceRoleSecurityFunction · 0.85

Tested by

no test coverage detected