Skip to content

Commit a467398

Browse files
authored
Merge branch 'alpha' into fix-fields
2 parents 8eac7f2 + d19acf1 commit a467398

33 files changed

+25170
-4837
lines changed

.babelrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"presets": [
77
["@babel/preset-env", {
88
"targets": {
9-
"node": "14"
10-
}
9+
"node": "14",
10+
},
11+
"exclude": ["proposal-dynamic-import"]
1112
}]
1213
],
1314
"sourceMaps": "inline"

.eslintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
"node": true,
66
"es6": true
77
},
8-
"parser": "babel-eslint",
8+
"parser": "@babel/eslint-parser",
99
"plugins": [
1010
"flowtype"
1111
],
1212
"parserOptions": {
1313
"ecmaVersion": 6,
14-
"sourceType": "module"
14+
"sourceType": "module",
15+
"requireConfigFile": false
1516
},
1617
"rules": {
1718
"indent": ["error", 2, { "SwitchCase": 1 }],

.github/workflows/ci.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ jobs:
7070
- name: Install dependencies
7171
run: npm ci
7272
- run: npm run lint
73+
check-definitions:
74+
name: Check Definitions
75+
timeout-minutes: 5
76+
runs-on: ubuntu-18.04
77+
steps:
78+
- uses: actions/checkout@v2
79+
- name: Use Node.js ${{ matrix.NODE_VERSION }}
80+
uses: actions/setup-node@v2
81+
with:
82+
node-version: ${{ matrix.node-version }}
83+
- name: Cache Node.js modules
84+
uses: actions/cache@v2
85+
with:
86+
path: ~/.npm
87+
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
88+
restore-keys: |
89+
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
90+
- name: Install dependencies
91+
run: npm ci
92+
- name: CI Definitions Check
93+
run: npm run ci:definitionsCheck
7394
check-circular:
7495
name: Circular Dependencies
7596
timeout-minutes: 5
@@ -116,7 +137,7 @@ jobs:
116137
- name: Check NPM lock file version
117138
uses: mansona/npm-lockfile-version@v1
118139
with:
119-
version: 1
140+
version: 2
120141
check-mongo:
121142
strategy:
122143
matrix:

6.0.0.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Parse Server 6 Migration Guide <!-- omit in toc -->
2+
3+
This document only highlights specific changes that require a longer explanation. For a full list of changes in Parse Server 6 please refer to the [changelog](https://github.com/parse-community/parse-server/blob/alpha/CHANGELOG.md).
4+
5+
---
6+
7+
- [Import Statement](#import-statement)
8+
- [Asynchronous Initialization](#asynchronous-initialization)
9+
10+
---
11+
12+
## Import Statement
13+
14+
The import and initialization syntax has been simplified with more intuitive naming and structure.
15+
16+
*Parse Server 5:*
17+
```js
18+
// Returns a Parse Server instance
19+
const ParseServer = require('parse-server');
20+
21+
// Returns a Parse Server express middleware
22+
const { ParseServer } = require('parse-server');
23+
```
24+
25+
*Parse Server 6:*
26+
```js
27+
// Both return a Parse Server instance
28+
const ParseServer = require('parse-server');
29+
const { ParseServer } = require('parse-server');
30+
```
31+
32+
To get the express middleware in Parse Server 6, configure the Parse Server instance, start Parse Server and use its `app` property. See [Asynchronous Initialization](#asynchronous-initialization) for more details.
33+
34+
## Asynchronous Initialization
35+
36+
Previously, it was possible to mount Parse Server before it was fully started up and ready to receive requests. This could result in undefined behavior, such as Parse Objects could be saved before Cloud Code was registered. To prevent this, Parse Server 6 requires to be started asynchronously before being mounted.
37+
38+
*Parse Server 5:*
39+
```js
40+
// 1. Import Parse Server
41+
const { ParseServer } = require('parse-server');
42+
43+
// 2. Create a Parse Server instance as express middleware
44+
const server = new ParseServer(config);
45+
46+
// 3. Mount express middleware
47+
app.use("/parse", server);
48+
```
49+
50+
*Parse Server 6:*
51+
```js
52+
// 1. Import Parse Server
53+
const ParseServer = require('parse-server');
54+
55+
// 2. Create a Parse Server instance
56+
const server = new ParseServer(config);
57+
58+
// 3. Start up Parse Server asynchronously
59+
await server.start();
60+
61+
// 4. Mount express middleware
62+
app.use("/parse", server.app);
63+
```

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [Merging](#merging)
3333
- [Breaking Change](#breaking-change-1)
3434
- [Reverting](#reverting)
35+
- [Security Vulnerability](#security-vulnerability)
3536
- [Releasing](#releasing)
3637
- [General Considerations](#general-considerations)
3738
- [Major Release / Long-Term-Support](#major-release--long-term-support)
@@ -451,6 +452,24 @@ If the commit reverts a previous commit, use the prefix `revert:`, followed by t
451452
This reverts commit 1234567890abcdef.
452453
```
453454
455+
### Security Vulnerability
456+
457+
#### Local Testing
458+
459+
Fixes for securify vulnerabilities are developed in private forks with a closed audience, inaccessible to the public. A current GitHub limitation does not allow to run CI tests on pull requests in private forks. Whether a pull requests fully passes all CI tests can only be determined by publishing the fix as a public pull request and running the CI. This means the fix and implicitly information about the vulnerabilty are made accessible to the public. This increases the risk that a vulnerability fix is published, but then cannot be merged immediately due to a CI issue. To mitigate that risk, before publishing a vulnerability fix, the following tests needs to be run locally and pass:
460+
461+
- `npm run test` (MongoDB)
462+
- `npm run test` (Postgres)
463+
- `npm run madge:circular` (circular dependencies)
464+
- `npm run lint` (Lint)
465+
- `npm run definitions` (Parse Server options definitions)
466+
467+
#### Merging
468+
469+
A current GitHub limitation does not allow to customize the commit message when merging pull requests of a private fork that was created to fix a security vulnerabilty. Our release automation framework demands a specific commit message syntax which therefore cannot be met. This prohibits to follow the process that GitHub suggest, which is to merge a pull request from a private fork directly to a public branch. Instead, after [local testing](#local-testing), a public pull request needs to be created with the code fix copied over from the private pull request.
470+
471+
This creates a risk that a vulnerability is indirectly disclosed by publishing a pull request with the fix, but the fix cannot be merged due to a CI issue. To mitigate that risk, the pull request title and description should be kept marginal or generic, not hiting to a vulnerabilty or giving any details about the vulnerabilty, until the pull request has been successfully merged.
472+
454473
## Releasing
455474
456475
### General Considerations

README.md

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
4040

4141
---
4242

43-
- [Flavors & Branches](#flavors--branches)
43+
- [Flavors \& Branches](#flavors--branches)
4444
- [Long Term Support](#long-term-support)
4545
- [Getting Started](#getting-started)
4646
- [Running Parse Server](#running-parse-server)
@@ -55,6 +55,8 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
5555
- [Running Parse Server elsewhere](#running-parse-server-elsewhere)
5656
- [Sample Application](#sample-application)
5757
- [Parse Server + Express](#parse-server--express)
58+
- [Parse Server Health](#parse-server-health)
59+
- [Status Values](#status-values)
5860
- [Configuration](#configuration)
5961
- [Basic Options](#basic-options)
6062
- [Client Key Options](#client-key-options)
@@ -136,13 +138,13 @@ Parse Server is continuously tested with the most recent releases of Node.js to
136138

137139
Parse Server is continuously tested with the most recent releases of MongoDB to ensure compatibility. We follow the [MongoDB support schedule](https://www.mongodb.com/support-policy) and [MongoDB lifecycle schedule](https://www.mongodb.com/support-policy/lifecycles) and only test against versions that are officially supported and have not reached their end-of-life date. We consider the end-of-life date of a MongoDB "rapid release" to be the same as its major version release.
138140

139-
| Version | Latest Version | End-of-Life | Compatible |
140-
|-------------|----------------|---------------|--------------|
141-
| MongoDB 4.0 | 4.0.28 | April 2022 | ✅ Yes |
142-
| MongoDB 4.2 | 4.2.19 | April 2023 | ✅ Yes |
143-
| MongoDB 4.4 | 4.4.13 | February 2024 | ✅ Yes |
144-
| MongoDB 5 | 5.3.2 | October 2024 | ✅ Yes |
145-
| MongoDB 6 | 6.0.2 | July 2025 | ✅ Yes |
141+
| Version | Latest Version | End-of-Life | Compatible |
142+
|-------------|----------------|---------------|------------|
143+
| MongoDB 4.0 | 4.0.28 | April 2022 | ✅ Yes |
144+
| MongoDB 4.2 | 4.2.19 | April 2023 | ✅ Yes |
145+
| MongoDB 4.4 | 4.4.13 | February 2024 | ✅ Yes |
146+
| MongoDB 5 | 5.3.2 | October 2024 | ✅ Yes |
147+
| MongoDB 6 | 6.0.2 | July 2025 | ✅ Yes |
146148

147149
#### PostgreSQL
148150

@@ -282,11 +284,11 @@ We have provided a basic [Node.js application](https://github.com/parse-communit
282284
You can also create an instance of Parse Server, and mount it on a new or existing Express website:
283285

284286
```js
285-
var express = require('express');
286-
var ParseServer = require('parse-server').ParseServer;
287-
var app = express();
287+
const express = require('express');
288+
const ParseServer = require('parse-server').ParseServer;
289+
const app = express();
288290

289-
var api = new ParseServer({
291+
const server = new ParseServer({
290292
databaseURI: 'mongodb://localhost:27017/dev', // Connection string for your MongoDB database
291293
cloud: './cloud/main.js', // Path to your Cloud Code
292294
appId: 'myAppId',
@@ -295,8 +297,11 @@ var api = new ParseServer({
295297
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
296298
});
297299

300+
// Start server
301+
await server.start();
302+
298303
// Serve the Parse API on the /parse URL prefix
299-
app.use('/parse', api);
304+
app.use('/parse', server.app);
300305

301306
app.listen(1337, function() {
302307
console.log('parse-server-example running on port 1337.');
@@ -305,6 +310,27 @@ app.listen(1337, function() {
305310

306311
For a full list of available options, run `parse-server --help` or take a look at [Parse Server Configurations](http://parseplatform.org/parse-server/api/master/ParseServerOptions.html).
307312

313+
## Parse Server Health
314+
315+
Check the Parse Server health by sending a request to the `/parse/health` endpoint.
316+
317+
The response looks like this:
318+
319+
```json
320+
{
321+
"status": "ok"
322+
}
323+
```
324+
325+
### Status Values
326+
327+
| Value | Description |
328+
|---------------|-----------------------------------------------------------------------------|
329+
| `initialized` | The server has been created but the `start` method has not been called yet. |
330+
| `starting` | The server is starting up. |
331+
| `ok` | The server started and is running. |
332+
| `error` | There was a startup error, see the logs for details. |
333+
308334
# Configuration
309335

310336
Parse Server can be configured using the following options. You may pass these as parameters when running a standalone `parse-server`, or by loading a configuration file in JSON format using `parse-server path/to/configuration.json`. If you're using Parse Server on Express, you may also pass these to the `ParseServer` object as options.
@@ -461,7 +487,7 @@ The following paths are already used by Parse Server's built-in features and are
461487
It’s possible to change the default pages of the app and redirect the user to another path or domain.
462488

463489
```js
464-
var server = ParseServer({
490+
const server = ParseServer({
465491
...otherOptions,
466492
467493
customPages: {
@@ -851,7 +877,7 @@ Then, create an `index.js` file with the following content:
851877
852878
```js
853879
const express = require('express');
854-
const { default: ParseServer, ParseGraphQLServer } = require('parse-server');
880+
const { ParseServer, ParseGraphQLServer } = require('parse-server');
855881

856882
const app = express();
857883

@@ -875,6 +901,7 @@ app.use('/parse', parseServer.app); // (Optional) Mounts the REST API
875901
parseGraphQLServer.applyGraphQL(app); // Mounts the GraphQL API
876902
parseGraphQLServer.applyPlayground(app); // (Optional) Mounts the GraphQL Playground - do NOT use in Production
877903

904+
await parseServer.start();
878905
app.listen(1337, function() {
879906
console.log('REST API running on http://localhost:1337/parse');
880907
console.log('GraphQL API running on http://localhost:1337/graphql');

changelogs/CHANGELOG_alpha.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
# [6.0.0-alpha.17](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.16...6.0.0-alpha.17) (2022-12-22)
2+
3+
4+
### Features
5+
6+
* Upgrade Node Package Manager lock file `package-lock.json` to version 2 ([#8285](https://github.com/parse-community/parse-server/issues/8285)) ([ee72467](https://github.com/parse-community/parse-server/commit/ee7246733d63e4bda20401f7b00262ff03299f20))
7+
8+
9+
### BREAKING CHANGES
10+
11+
* The Node Package Manager lock file `package-lock.json` is upgraded to version 2; while it is backwards with version 1 for the npm installer, consider this if you run any non-npm analysis tools that use the lock file (#8285) ([ee72467](ee72467))
12+
13+
# [6.0.0-alpha.16](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.15...6.0.0-alpha.16) (2022-12-21)
14+
15+
16+
### Features
17+
18+
* Asynchronous initialization of Parse Server ([#8232](https://github.com/parse-community/parse-server/issues/8232)) ([99fcf45](https://github.com/parse-community/parse-server/commit/99fcf45e55c368de2345b0c4d780e70e0adf0e15))
19+
20+
21+
### BREAKING CHANGES
22+
23+
* This release introduces the asynchronous initialization of Parse Server to prevent mounting Parse Server before being ready to receive request; it changes how Parse Server is imported, initialized and started; it also removes the callback `serverStartComplete`; see the [Parse Server 6 migration guide](https://github.com/parse-community/parse-server/blob/alpha/6.0.0.md) for more details (#8232) ([99fcf45](99fcf45))
24+
25+
# [6.0.0-alpha.15](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.14...6.0.0-alpha.15) (2022-12-20)
26+
27+
28+
### Bug Fixes
29+
30+
* Nested objects are encoded incorrectly for MongoDB ([#8209](https://github.com/parse-community/parse-server/issues/8209)) ([1412666](https://github.com/parse-community/parse-server/commit/1412666f75829612de6fb9d7ccae35761c9b75cb))
31+
32+
33+
### BREAKING CHANGES
34+
35+
* Nested objects are now properly stored in the database using JSON serialization; previously, due to a bug only top-level objects were serialized, but nested objects were saved as raw JSON; for example, a nested `Date` object was saved as a JSON object like `{ "__type": "Date", "iso": "2020-01-01T00:00:00.000Z" }` instead of its serialized representation `2020-01-01T00:00:00.000Z` (#8209) ([1412666](1412666))
36+
37+
# [6.0.0-alpha.14](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.13...6.0.0-alpha.14) (2022-12-16)
38+
39+
40+
### Features
41+
42+
* Write log entry when request with master key is rejected as outside of `masterKeyIps` ([#8350](https://github.com/parse-community/parse-server/issues/8350)) ([e22b73d](https://github.com/parse-community/parse-server/commit/e22b73d4b700c8ff745aa81726c6680082294b45))
43+
144
# [6.0.0-alpha.13](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.12...6.0.0-alpha.13) (2022-12-07)
245

346

ci/definitionsCheck.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const fs = require('fs').promises;
2+
const { exec } = require('child_process');
3+
const core = require('@actions/core');
4+
const { nextTick } = require('process');
5+
const { AbortController } = require("node-abort-controller");
6+
(async () => {
7+
const [currentDefinitions, currentDocs] = await Promise.all([
8+
fs.readFile('./src/Options/Definitions.js', 'utf8'),
9+
fs.readFile('./src/Options/docs.js', 'utf8'),
10+
]);
11+
exec('npm run definitions');
12+
const ac = new AbortController();
13+
const { signal } = ac;
14+
const watcher = fs.watch('./src/Options/docs.js', {signal});
15+
let i = 0;
16+
// eslint-disable-next-line
17+
for await (const _ of watcher) {
18+
i++;
19+
if (i === 3) {
20+
ac.abort();
21+
break;
22+
}
23+
}
24+
await new Promise(resolve => nextTick(resolve));
25+
const [newDefinitions, newDocs] = await Promise.all([
26+
fs.readFile('./src/Options/Definitions.js', 'utf8'),
27+
fs.readFile('./src/Options/docs.js', 'utf8'),
28+
]);
29+
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
30+
console.error(
31+
'\x1b[31m%s\x1b[0m',
32+
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'
33+
);
34+
core.error('Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.');
35+
process.exit(1);
36+
} else {
37+
process.exit(0);
38+
}
39+
})();

0 commit comments

Comments
 (0)