Pass context in beforeDelete, afterDelete, beforeFind and Parse.Cloud.run. (#6666)

* add context for following hooks.
1. beforeDelete
2. afterDelete
3. beforeFind
4. Cloud Function

* revert un-necessary code change.

* fix: failing test cases.

* fix: failing test cases.

* fix: failing test cases.

* fix: failing test cases.

* fix: failing test cases.

* fix: failing test cases.

* fix: failing test cases.

* review changes

* revert changes

* revert changes

* review changes

* lint changes

* review changes
This commit is contained in:
yog27ray
2020-07-11 02:17:27 +05:30
committed by GitHub
parent 4437ea73ba
commit 34614e0f78
19 changed files with 130 additions and 43 deletions

View File

@@ -69,7 +69,8 @@ export class AggregateRouter extends ClassesRouter {
this.className(req),
body.where,
options,
req.info.clientSDK
req.info.clientSDK,
req.info.context,
)
.then(response => {
for (const result of response.results) {

View File

@@ -21,7 +21,8 @@ export class AudiencesRouter extends ClassesRouter {
'_Audience',
body.where,
options,
req.info.clientSDK
req.info.clientSDK,
req.info.context,
)
.then(response => {
response.results.forEach(item => {

View File

@@ -40,7 +40,8 @@ export class ClassesRouter extends PromiseRouter {
this.className(req),
body.where,
options,
req.info.clientSDK
req.info.clientSDK,
req.info.context,
)
.then(response => {
return { response: response };
@@ -120,7 +121,8 @@ export class ClassesRouter extends PromiseRouter {
req.auth,
this.className(req),
req.body,
req.info.clientSDK
req.info.clientSDK,
req.info.context
);
}
@@ -132,7 +134,8 @@ export class ClassesRouter extends PromiseRouter {
this.className(req),
where,
req.body,
req.info.clientSDK
req.info.clientSDK,
req.info.context
);
}
@@ -143,7 +146,7 @@ export class ClassesRouter extends PromiseRouter {
req.auth,
this.className(req),
req.params.objectId,
req.info.clientSDK
req.info.context
)
.then(() => {
return { response: {} };

View File

@@ -88,7 +88,8 @@ export class CloudCodeRouter extends PromiseRouter {
req.auth,
'_JobSchedule',
formatJobSchedule(job_schedule),
req.client
req.client,
req.info.context
);
}
@@ -102,7 +103,9 @@ export class CloudCodeRouter extends PromiseRouter {
req.auth,
'_JobSchedule',
{ objectId },
formatJobSchedule(job_schedule)
formatJobSchedule(job_schedule),
undefined,
req.info.context
)
.then(response => {
return {
@@ -114,7 +117,7 @@ export class CloudCodeRouter extends PromiseRouter {
static deleteJob(req) {
const { objectId } = req.params;
return rest
.del(req.config, req.auth, '_JobSchedule', objectId)
.del(req.config, req.auth, '_JobSchedule', objectId, req.info.context)
.then(response => {
return {
response,

View File

@@ -148,6 +148,7 @@ export class FunctionsRouter extends PromiseRouter {
headers: req.config.headers,
ip: req.config.ip,
functionName,
context: req.info.context,
};
if (theValidator && typeof theValidator === 'function') {

View File

@@ -51,7 +51,8 @@ function getFileForProductIdentifier(productIdentifier, req) {
'_Product',
{ productIdentifier: productIdentifier },
undefined,
req.info.clientSDK
req.info.clientSDK,
req.info.context
)
.then(function(result) {
const products = result.results;

View File

@@ -21,7 +21,8 @@ export class InstallationsRouter extends ClassesRouter {
'_Installation',
body.where,
options,
req.info.clientSDK
req.info.clientSDK,
req.info.context
)
.then(response => {
return { response: response };

View File

@@ -23,7 +23,8 @@ export class SessionsRouter extends ClassesRouter {
'_Session',
{ sessionToken: req.info.sessionToken },
undefined,
req.info.clientSDK
req.info.clientSDK,
req.info.context
)
.then(response => {
if (!response.results || response.results.length == 0) {

View File

@@ -178,7 +178,8 @@ export class UsersRouter extends ClassesRouter {
'_Session',
{ sessionToken },
{ include: 'user' },
req.info.clientSDK
req.info.clientSDK,
req.info.context
)
.then(response => {
if (
@@ -302,7 +303,8 @@ export class UsersRouter extends ClassesRouter {
'_Session',
{ sessionToken: req.info.sessionToken },
undefined,
req.info.clientSDK
req.info.clientSDK,
req.info.context
)
.then(records => {
if (records.results && records.results.length) {
@@ -311,7 +313,8 @@ export class UsersRouter extends ClassesRouter {
req.config,
Auth.master(req.config),
'_Session',
records.results[0].objectId
records.results[0].objectId,
req.info.context
)
.then(() => {
this._runAfterLogoutTrigger(req, records.results[0]);