Skip to content

Commit d46c8fc

Browse files
authored
Merge branch 'alpha' into snyk-upgrade-88be3eb02ce6725e515b875a3de97add
2 parents 230544a + e7c7f44 commit d46c8fc

File tree

7 files changed

+126
-65
lines changed

7 files changed

+126
-65
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [5.0.0-alpha.11](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.10...5.0.0-alpha.11) (2021-11-29)
2+
3+
4+
### Bug Fixes
5+
6+
* upgrade mime from 2.5.2 to 3.0.0 ([#7725](https://github.com/parse-community/parse-server/issues/7725)) ([f5ef98b](https://github.com/parse-community/parse-server/commit/f5ef98bde32083403c0e30a12162fcc1e52cac37))
7+
8+
# [5.0.0-alpha.10](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.9...5.0.0-alpha.10) (2021-11-29)
9+
10+
11+
### Bug Fixes
12+
13+
* upgrade parse from 3.3.1 to 3.4.0 ([#7723](https://github.com/parse-community/parse-server/issues/7723)) ([d4c1f47](https://github.com/parse-community/parse-server/commit/d4c1f473073764cb0570c633fc4a30669c2ce889))
14+
15+
# [5.0.0-alpha.9](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.8...5.0.0-alpha.9) (2021-11-27)
16+
17+
18+
### Bug Fixes
19+
20+
* unable to use objectId size higher than 19 on GraphQL API ([#7627](https://github.com/parse-community/parse-server/issues/7627)) ([ed86c80](https://github.com/parse-community/parse-server/commit/ed86c807721cc52a1a5a9dea0b768717eec269ed))
21+
122
# [5.0.0-alpha.8](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.7...5.0.0-alpha.8) (2021-11-18)
223

324

package-lock.json

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

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "5.0.0-alpha.8",
3+
"version": "5.0.0-alpha.11",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {
@@ -32,28 +32,28 @@
3232
"cors": "2.8.5",
3333
"deepcopy": "2.1.0",
3434
"express": "4.17.1",
35-
"follow-redirects": "1.14.4",
35+
"follow-redirects": "1.14.5",
3636
"graphql": "15.7.1",
3737
"graphql-list-fields": "2.0.2",
38-
"graphql-relay": "0.9.0",
39-
"graphql-tag": "2.12.5",
38+
"graphql-relay": "0.7.0",
39+
"graphql-tag": "2.12.6",
4040
"graphql-upload": "11.0.0",
4141
"intersect": "1.0.1",
4242
"jsonwebtoken": "8.5.1",
4343
"jwks-rsa": "1.12.3",
4444
"ldapjs": "2.3.1",
4545
"lodash": "4.17.21",
4646
"lru-cache": "5.1.1",
47-
"mime": "2.5.2",
47+
"mime": "3.0.0",
4848
"mongodb": "3.6.11",
4949
"mustache": "4.2.0",
50-
"parse": "3.3.1",
50+
"parse": "3.4.0",
5151
"pg-monitor": "1.4.1",
5252
"pg-promise": "10.11.1",
5353
"pluralize": "8.0.0",
5454
"redis": "3.1.2",
5555
"semver": "7.3.5",
56-
"subscriptions-transport-ws": "0.10.0",
56+
"subscriptions-transport-ws": "0.11.0",
5757
"tv4": "1.3.0",
5858
"uuid": "8.3.2",
5959
"winston": "3.3.3",

spec/CloudCode.spec.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,25 @@ describe('beforeFind hooks', () => {
19991999
});
20002000
});
20012001

2002+
it('should have object found with nested relational data query', async () => {
2003+
const obj1 = Parse.Object.extend('TestObject');
2004+
const obj2 = Parse.Object.extend('TestObject2');
2005+
let item2 = new obj2();
2006+
item2 = await item2.save();
2007+
let item1 = new obj1();
2008+
const relation = item1.relation('rel');
2009+
relation.add(item2);
2010+
item1 = await item1.save();
2011+
Parse.Cloud.beforeFind('TestObject', req => {
2012+
const additionalQ = new Parse.Query('TestObject');
2013+
additionalQ.equalTo('rel', item2);
2014+
return Parse.Query.and(req.query, additionalQ);
2015+
});
2016+
const q = new Parse.Query('TestObject');
2017+
const res = await q.first();
2018+
expect(res.id).toEqual(item1.id);
2019+
});
2020+
20022021
it('should use the modified exclude query', async () => {
20032022
Parse.Cloud.beforeFind('MyObject', req => {
20042023
const q = req.query;
@@ -3516,23 +3535,4 @@ describe('sendEmail', () => {
35163535
'Failed to send email because no mail adapter is configured for Parse Server.'
35173536
);
35183537
});
3519-
3520-
it('should have object found with nested relational data query', async () => {
3521-
const obj1 = Parse.Object.extend('TestObject');
3522-
const obj2 = Parse.Object.extend('TestObject2');
3523-
let item2 = new obj2();
3524-
item2 = await item2.save();
3525-
let item1 = new obj1();
3526-
const relation = item1.relation('rel');
3527-
relation.add(item2);
3528-
item1 = await item1.save();
3529-
Parse.Cloud.beforeFind('TestObject', req => {
3530-
const additionalQ = new Parse.Query('TestObject');
3531-
additionalQ.equalTo('rel', item2);
3532-
return Parse.Query.and(req.query, additionalQ);
3533-
});
3534-
const q = new Parse.Query('TestObject');
3535-
const res = await q.first();
3536-
expect(res.id).toEqual(item1.id);
3537-
});
35383538
});

spec/ParseGraphQLServer.spec.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,8 +2287,7 @@ describe('ParseGraphQLServer', () => {
22872287
expect(nodeResult.data.node2.objectId).toBe(obj2.id);
22882288
expect(nodeResult.data.node2.someField).toBe('some value 2');
22892289
});
2290-
// TODO: (moumouls, davimacedo) Fix flaky test
2291-
xit('Id inputs should work either with global id or object id', async () => {
2290+
it('Id inputs should work either with global id or object id', async () => {
22922291
try {
22932292
await apolloClient.mutate({
22942293
mutation: gql`
@@ -2595,9 +2594,12 @@ describe('ParseGraphQLServer', () => {
25952594
.map(value => value.node.someField)
25962595
.sort()
25972596
).toEqual(['some value 22', 'some value 44']);
2598-
expect(
2599-
findSecondaryObjectsResult.data.secondaryObjects.edges[0].node.id
2600-
).toBeLessThan(findSecondaryObjectsResult.data.secondaryObjects.edges[1].node.id);
2597+
// NOTE: Here @davimacedo tried to test RelayID order, but the test is wrong since
2598+
// "objectId1" < "objectId2" do not always keep the order when objectId is transformed
2599+
// to base64 by Relay
2600+
// "SecondaryObject:bBRgmzIRRM" < "SecondaryObject:nTMcuVbATY" true
2601+
// base64("SecondaryObject:bBRgmzIRRM"") < base64(""SecondaryObject:nTMcuVbATY"") false
2602+
// "U2Vjb25kYXJ5T2JqZWN0OmJCUmdteklSUk0=" < "U2Vjb25kYXJ5T2JqZWN0Om5UTWN1VmJBVFk=" false
26012603
expect(
26022604
findSecondaryObjectsResult.data.secondaryObjects.edges[0].node.objectId
26032605
).toBeLessThan(
@@ -2763,6 +2765,23 @@ describe('ParseGraphQLServer', () => {
27632765
handleError(e);
27642766
}
27652767
});
2768+
it('Id inputs should work either with global id or object id with objectId higher than 19', async () => {
2769+
await reconfigureServer({ objectIdSize: 20 });
2770+
const obj = new Parse.Object('SomeClass');
2771+
await obj.save({ name: 'aname', type: 'robot' });
2772+
const result = await apolloClient.query({
2773+
query: gql`
2774+
query getSomeClass($id: ID!) {
2775+
someClass(id: $id) {
2776+
objectId
2777+
id
2778+
}
2779+
}
2780+
`,
2781+
variables: { id: obj.id },
2782+
});
2783+
expect(result.data.someClass.objectId).toEqual(obj.id);
2784+
});
27662785
});
27672786
});
27682787

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,13 @@ export class PostgresStorageAdapter implements StorageAdapter {
18071807
if (key === 'ACL') {
18081808
memo.push('_rperm');
18091809
memo.push('_wperm');
1810-
} else if (key.length > 0) {
1810+
} else if (
1811+
key.length > 0 &&
1812+
// Remove selected field not referenced in the schema
1813+
// Relation is not a column in postgres
1814+
// $score is a Parse special field and is also not a column
1815+
((schema.fields[key] && schema.fields[key].type !== 'Relation') || key === '$score')
1816+
) {
18111817
memo.push(key);
18121818
}
18131819
return memo;

src/Controllers/DatabaseController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,9 @@ class DatabaseController {
972972
});
973973
}
974974
if (query['$and']) {
975-
const ors = query['$and'];
975+
const ands = query['$and'];
976976
return Promise.all(
977-
ors.map((aQuery, index) => {
977+
ands.map((aQuery, index) => {
978978
return this.reduceInRelation(className, aQuery, schema).then(aQuery => {
979979
query['$and'][index] = aQuery;
980980
});

0 commit comments

Comments
 (0)