Skip to content

Commit bc984b3

Browse files
authored
Merge branch 'alpha' into increase-coverage
2 parents 2afb4af + b3199d7 commit bc984b3

14 files changed

+369
-79
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
- [Merging](#merging)
2525
- [Breaking Change](#breaking-change-1)
2626
- [Reverting](#reverting)
27+
- [Releasing](#releasing)
28+
- [General Considerations](#general-considerations)
2729
- [Major Release / Long-Term-Support](#major-release--long-term-support)
2830
- [Versioning](#versioning)
2931
- [Code of Conduct](#code-of-conduct)
@@ -379,6 +381,12 @@ If the commit reverts a previous commit, use the prefix `revert:`, followed by t
379381
This reverts commit 1234567890abcdef.
380382
```
381383
384+
## Releasing
385+
386+
### General Considerations
387+
388+
- The `package-lock.json` file has to be deleted and recreated by npm from scratch in regular intervals using the `npm i` command. It is not enough to only update the file via automated security pull requests (e.g. dependabot, snyk), that can create inconsistencies between sub-devependencies of a dependency and increase the chances of vulnerabilities. The file should be recreated once every release cycle which is usually monthly.
389+
382390
### Major Release / Long-Term-Support
383391
384392
Long-Term-Support (LTS) is provided for the previous Parse Server major version. For example, Parse Server 4.x will receive security updates until Parse Server 5.x is superseded by Parse Server 6.x and becomes the new LTS version. While the current major version is published on branch `release`, a LTS version is published on branch `release-#.x.x`, for example `release-4.x.x` for the Parse Server 4.x LTS branch.

changelogs/CHANGELOG_alpha.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
## [5.2.1-alpha.1](https://github.com/parse-community/parse-server/compare/5.2.0...5.2.1-alpha.1) (2022-03-26)
2+
3+
4+
### Bug Fixes
5+
6+
* return correct response when revert is used in beforeSave ([#7839](https://github.com/parse-community/parse-server/issues/7839)) ([f63fb2b](https://github.com/parse-community/parse-server/commit/f63fb2b338c908f0e7a648d338c26b9daa50c8f2))
7+
8+
# [5.2.0-alpha.3](https://github.com/parse-community/parse-server/compare/5.2.0-alpha.2...5.2.0-alpha.3) (2022-03-24)
9+
10+
11+
### Bug Fixes
12+
13+
* security bump minimist from 1.2.5 to 1.2.6 ([#7884](https://github.com/parse-community/parse-server/issues/7884)) ([c5cf282](https://github.com/parse-community/parse-server/commit/c5cf282d11ffdc023764f8e7539a2bd6bc246fe1))
14+
15+
# [5.2.0-alpha.2](https://github.com/parse-community/parse-server/compare/5.2.0-alpha.1...5.2.0-alpha.2) (2022-03-24)
16+
17+
18+
### Bug Fixes
19+
20+
* sensitive keyword detection may produce false positives ([#7881](https://github.com/parse-community/parse-server/issues/7881)) ([0d6f9e9](https://github.com/parse-community/parse-server/commit/0d6f9e951d9e186e95e96d8869066ce7022bad02))
21+
22+
# [5.2.0-alpha.1](https://github.com/parse-community/parse-server/compare/5.1.1...5.2.0-alpha.1) (2022-03-23)
23+
24+
25+
### Features
26+
27+
* improved LiveQuery error logging with additional information ([#7837](https://github.com/parse-community/parse-server/issues/7837)) ([443a509](https://github.com/parse-community/parse-server/commit/443a5099059538d379fe491793a5871fcbb4f377))
28+
129
# [5.0.0-alpha.29](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.28...5.0.0-alpha.29) (2022-03-12)
230

331

changelogs/CHANGELOG_beta.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# [5.2.0-beta.2](https://github.com/parse-community/parse-server/compare/5.2.0-beta.1...5.2.0-beta.2) (2022-03-24)
2+
3+
4+
### Bug Fixes
5+
6+
* security bump minimist from 1.2.5 to 1.2.6 ([#7884](https://github.com/parse-community/parse-server/issues/7884)) ([c5cf282](https://github.com/parse-community/parse-server/commit/c5cf282d11ffdc023764f8e7539a2bd6bc246fe1))
7+
* sensitive keyword detection may produce false positives ([#7881](https://github.com/parse-community/parse-server/issues/7881)) ([0d6f9e9](https://github.com/parse-community/parse-server/commit/0d6f9e951d9e186e95e96d8869066ce7022bad02))
8+
9+
# [5.2.0-beta.1](https://github.com/parse-community/parse-server/compare/5.1.1...5.2.0-beta.1) (2022-03-23)
10+
11+
12+
### Features
13+
14+
* improved LiveQuery error logging with additional information ([#7837](https://github.com/parse-community/parse-server/issues/7837)) ([443a509](https://github.com/parse-community/parse-server/commit/443a5099059538d379fe491793a5871fcbb4f377))
15+
116
# [5.0.0-beta.10](https://github.com/parse-community/parse-server/compare/5.0.0-beta.9...5.0.0-beta.10) (2022-03-15)
217

318

changelogs/CHANGELOG_release.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [5.2.0](https://github.com/parse-community/parse-server/compare/5.1.1...5.2.0) (2022-03-24)
2+
3+
4+
### Bug Fixes
5+
6+
* security bump minimist from 1.2.5 to 1.2.6 ([#7884](https://github.com/parse-community/parse-server/issues/7884)) ([c5cf282](https://github.com/parse-community/parse-server/commit/c5cf282d11ffdc023764f8e7539a2bd6bc246fe1))
7+
* sensitive keyword detection may produce false positives ([#7881](https://github.com/parse-community/parse-server/issues/7881)) ([0d6f9e9](https://github.com/parse-community/parse-server/commit/0d6f9e951d9e186e95e96d8869066ce7022bad02))
8+
9+
### Features
10+
11+
* improved LiveQuery error logging with additional information ([#7837](https://github.com/parse-community/parse-server/issues/7837)) ([443a509](https://github.com/parse-community/parse-server/commit/443a5099059538d379fe491793a5871fcbb4f377))
12+
113
## [5.1.1](https://github.com/parse-community/parse-server/compare/5.1.0...5.1.1) (2022-03-18)
214

315

ci/nodeEngineCheck.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,21 @@ class NodeEngineCheck {
7575

7676
// For each file
7777
for (const file of files) {
78-
7978
// Get node version
8079
const contentString = await fs.readFile(file, 'utf-8');
81-
const contentJson = JSON.parse(contentString);
82-
const version = ((contentJson || {}).engines || {}).node;
83-
84-
// Add response
85-
response.push({
86-
file: file,
87-
nodeVersion: version
88-
});
80+
try {
81+
const contentJson = JSON.parse(contentString);
82+
const version = ((contentJson || {}).engines || {}).node;
83+
84+
// Add response
85+
response.push({
86+
file: file,
87+
nodeVersion: version
88+
});
89+
} catch(e) {
90+
console.log(`Ignoring file because it is not valid JSON: ${file}`);
91+
core.warning(`Ignoring file because it is not valid JSON: ${file}`);
92+
}
8993
}
9094

9195
// If results should be cleaned by removing undefined node versions

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "5.1.1",
3+
"version": "5.2.1-alpha.1",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/CloudCode.spec.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,110 @@ describe('Cloud Code', () => {
15021502
});
15031503
});
15041504

1505+
it('before save can revert fields', async () => {
1506+
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
1507+
object.revert('foo');
1508+
return object;
1509+
});
1510+
1511+
Parse.Cloud.afterSave('TestObject', ({ object }) => {
1512+
expect(object.get('foo')).toBeUndefined();
1513+
return object;
1514+
});
1515+
1516+
const obj = new TestObject();
1517+
obj.set('foo', 'bar');
1518+
await obj.save();
1519+
1520+
expect(obj.get('foo')).toBeUndefined();
1521+
await obj.fetch();
1522+
1523+
expect(obj.get('foo')).toBeUndefined();
1524+
});
1525+
1526+
it('before save can revert fields with existing object', async () => {
1527+
Parse.Cloud.beforeSave(
1528+
'TestObject',
1529+
({ object }) => {
1530+
object.revert('foo');
1531+
return object;
1532+
},
1533+
{
1534+
skipWithMasterKey: true,
1535+
}
1536+
);
1537+
1538+
Parse.Cloud.afterSave(
1539+
'TestObject',
1540+
({ object }) => {
1541+
expect(object.get('foo')).toBe('bar');
1542+
return object;
1543+
},
1544+
{
1545+
skipWithMasterKey: true,
1546+
}
1547+
);
1548+
1549+
const obj = new TestObject();
1550+
obj.set('foo', 'bar');
1551+
await obj.save(null, { useMasterKey: true });
1552+
1553+
expect(obj.get('foo')).toBe('bar');
1554+
obj.set('foo', 'yolo');
1555+
await obj.save();
1556+
expect(obj.get('foo')).toBe('bar');
1557+
});
1558+
1559+
it('can unset in afterSave', async () => {
1560+
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
1561+
if (!object.existed()) {
1562+
object.set('secret', true);
1563+
return object;
1564+
}
1565+
object.revert('secret');
1566+
});
1567+
1568+
Parse.Cloud.afterSave('TestObject', ({ object }) => {
1569+
object.unset('secret');
1570+
});
1571+
1572+
Parse.Cloud.beforeFind(
1573+
'TestObject',
1574+
({ query }) => {
1575+
query.exclude('secret');
1576+
},
1577+
{
1578+
skipWithMasterKey: true,
1579+
}
1580+
);
1581+
1582+
const obj = new TestObject();
1583+
await obj.save();
1584+
expect(obj.get('secret')).toBeUndefined();
1585+
await obj.fetch();
1586+
expect(obj.get('secret')).toBeUndefined();
1587+
await obj.fetch({ useMasterKey: true });
1588+
expect(obj.get('secret')).toBe(true);
1589+
});
1590+
1591+
it('should revert in beforeSave', async () => {
1592+
Parse.Cloud.beforeSave('MyObject', ({ object }) => {
1593+
if (!object.existed()) {
1594+
object.set('count', 0);
1595+
return object;
1596+
}
1597+
object.revert('count');
1598+
return object;
1599+
});
1600+
const obj = await new Parse.Object('MyObject').save();
1601+
expect(obj.get('count')).toBe(0);
1602+
obj.set('count', 10);
1603+
await obj.save();
1604+
expect(obj.get('count')).toBe(0);
1605+
await obj.fetch();
1606+
expect(obj.get('count')).toBe(0);
1607+
});
1608+
15051609
it('beforeSave should not sanitize database', async done => {
15061610
const { adapter } = Config.get(Parse.applicationId).database;
15071611
const spy = spyOn(adapter, 'findOneAndUpdate').and.callThrough();
@@ -1868,6 +1972,36 @@ describe('afterSave hooks', () => {
18681972
const myObject = new MyObject();
18691973
myObject.save().then(() => done());
18701974
});
1975+
1976+
it('should unset in afterSave', async () => {
1977+
Parse.Cloud.afterSave(
1978+
'MyObject',
1979+
({ object }) => {
1980+
object.unset('secret');
1981+
},
1982+
{
1983+
skipWithMasterKey: true,
1984+
}
1985+
);
1986+
const obj = new Parse.Object('MyObject');
1987+
obj.set('secret', 'bar');
1988+
await obj.save();
1989+
expect(obj.get('secret')).toBeUndefined();
1990+
await obj.fetch();
1991+
expect(obj.get('secret')).toBe('bar');
1992+
});
1993+
1994+
it('should unset', async () => {
1995+
Parse.Cloud.beforeSave('MyObject', ({ object }) => {
1996+
object.set('secret', 'hidden');
1997+
});
1998+
1999+
Parse.Cloud.afterSave('MyObject', ({ object }) => {
2000+
object.unset('secret');
2001+
});
2002+
const obj = await new Parse.Object('MyObject').save();
2003+
expect(obj.get('secret')).toBeUndefined();
2004+
});
18712005
});
18722006

18732007
describe('beforeDelete hooks', () => {

0 commit comments

Comments
 (0)