Skip to content

Commit 60b35d2

Browse files
authored
Merge branch 'alpha' into moumouls/fix-peer-dep-apollo
2 parents 0551646 + 1299f06 commit 60b35d2

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [5.0.0-alpha.21](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.20...5.0.0-alpha.21) (2022-01-25)
2+
3+
4+
### Features
5+
6+
* add Cloud Code context to `ParseObject.fetch` ([#7779](https://github.com/parse-community/parse-server/issues/7779)) ([315290d](https://github.com/parse-community/parse-server/commit/315290d16110110938f80a6b779cc2d1db58c552))
7+
18
# [5.0.0-alpha.20](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.19...5.0.0-alpha.20) (2022-01-22)
29

310

package-lock.json

Lines changed: 18 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "5.0.0-alpha.20",
3+
"version": "5.0.0-alpha.21",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {
@@ -48,7 +48,7 @@
4848
"mime": "3.0.0",
4949
"mongodb": "3.6.11",
5050
"mustache": "4.2.0",
51-
"parse": "3.4.0",
51+
"parse": "3.4.1",
5252
"pg-monitor": "1.4.1",
5353
"pg-promise": "10.11.1",
5454
"pluralize": "8.0.0",

spec/CloudCode.spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,6 +3224,21 @@ describe('afterLogin hook', () => {
32243224
const query = new Parse.Query(TestObject);
32253225
await query.find({ context: { a: 'a' } });
32263226
});
3227+
3228+
it('beforeFind and afterFind should have access to context while making fetch call', async () => {
3229+
Parse.Cloud.beforeFind('TestObject', req => {
3230+
expect(req.context.a).toEqual('a');
3231+
expect(req.context.b).toBeUndefined();
3232+
req.context.b = 'b';
3233+
});
3234+
Parse.Cloud.afterFind('TestObject', req => {
3235+
expect(req.context.a).toEqual('a');
3236+
expect(req.context.b).toEqual('b');
3237+
});
3238+
const obj = new TestObject();
3239+
await obj.save();
3240+
await obj.fetch({ context: { a: 'a' } });
3241+
});
32273242
});
32283243

32293244
describe('saveFile hooks', () => {

src/Routers/ClassesRouter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export class ClassesRouter extends PromiseRouter {
8383
this.className(req),
8484
req.params.objectId,
8585
options,
86-
req.info.clientSDK
86+
req.info.clientSDK,
87+
req.info.context
8788
)
8889
.then(response => {
8990
if (!response.results || response.results.length == 0) {

0 commit comments

Comments
 (0)