MCPcopy
hub / github.com/parse-community/parse-server / getRequestObject

Function getRequestObject

src/triggers.js:275–332  ·  view source on GitHub ↗
(
  triggerType,
  auth,
  parseObject,
  originalParseObject,
  config,
  context,
  isGet
)

Source from the content-addressed store, hash-verified

273}
274
275export function getRequestObject(
276 triggerType,
277 auth,
278 parseObject,
279 originalParseObject,
280 config,
281 context,
282 isGet
283) {
284 const request = {
285 triggerName: triggerType,
286 object: parseObject,
287 master: false,
288 isReadOnly: false,
289 log: config.loggerController,
290 headers: config.headers,
291 ip: config.ip,
292 config,
293 };
294
295 if (isGet !== undefined) {
296 request.isGet = !!isGet;
297 }
298
299 if (originalParseObject) {
300 request.original = originalParseObject;
301 }
302 if (
303 triggerType === Types.beforeSave ||
304 triggerType === Types.afterSave ||
305 triggerType === Types.beforeDelete ||
306 triggerType === Types.afterDelete ||
307 triggerType === Types.beforeLogin ||
308 triggerType === Types.afterLogin ||
309 triggerType === Types.beforePasswordResetRequest ||
310 triggerType === Types.afterFind
311 ) {
312 // Set a copy of the context on the request object.
313 request.context = Object.assign(Object.create(null), context);
314 }
315
316 if (!auth) {
317 return request;
318 }
319 if (auth.isMaster) {
320 request['master'] = true;
321 }
322 if (auth.isReadOnly) {
323 request['isReadOnly'] = true;
324 }
325 if (auth.user) {
326 request['user'] = auth.user;
327 }
328 if (auth.installationId) {
329 request['installationId'] = auth.installationId;
330 }
331 return request;
332}

Callers 5

handleAuthDataValidationFunction · 0.90
handleChallengeMethod · 0.90
maybeRunAfterFindTriggerFunction · 0.85
maybeRunTriggerFunction · 0.85

Calls 1

createMethod · 0.80

Tested by

no test coverage detected