mirror of
https://github.com/parse-community/parse-server
synced 2026-08-09 13:03:18 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
302a0dda73 | ||
|
|
e7a45cecb7 | ||
|
|
906fb27389 | ||
|
|
f3f81b692b | ||
|
|
52828683ba | ||
|
|
0add7c0c50 | ||
|
|
1bc74f4aa3 | ||
|
|
c2e3092385 | ||
|
|
79806c5eba | ||
|
|
48115349d4 | ||
|
|
87085b35b6 | ||
|
|
65a8a1fc56 | ||
|
|
f9ecebde3b | ||
|
|
e01b417d3f | ||
|
|
a54f4d43fa | ||
|
|
7a43faa49c | ||
|
|
abf6828a7f | ||
|
|
2436a85de6 | ||
|
|
1f9a4edacd | ||
|
|
6a2b972566 | ||
|
|
f3765e0b8e | ||
|
|
eeb3a7028d | ||
|
|
2533a8cdb3 | ||
|
|
ea94ae73f6 | ||
|
|
1ec70b299b | ||
|
|
45efe2f29c | ||
|
|
5e29336962 | ||
|
|
82e0a59139 | ||
|
|
51b519355a | ||
|
|
08e8a428b6 | ||
|
|
63bd333715 | ||
|
|
11071dd015 | ||
|
|
9b879dd371 | ||
|
|
eb1b84b556 | ||
|
|
80ec61f7ce | ||
|
|
9f1077c9d3 |
+3
-2
@@ -1,2 +1,3 @@
|
||||
lib/*
|
||||
coverage/*
|
||||
lib
|
||||
coverage
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
instrumentation:
|
||||
excludes: ["**/spec/**"]
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
],
|
||||
"exclude": [
|
||||
"**/spec/**",
|
||||
"lib/"
|
||||
]
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ before_script:
|
||||
- psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d parse_server_postgres_adapter_test_database
|
||||
env:
|
||||
global:
|
||||
- COVERAGE_OPTION='./node_modules/.bin/istanbul cover'
|
||||
- COVERAGE_OPTION='./node_modules/.bin/nyc'
|
||||
matrix:
|
||||
- MONGODB_VERSION=3.0.8
|
||||
- MONGODB_VERSION=3.2.6
|
||||
|
||||
@@ -1,5 +1,34 @@
|
||||
## Parse Server Changelog
|
||||
|
||||
### 2.3.8
|
||||
[Full Changelog](https://github.com/ParsePlatform/parse-server/compare/2.3.7...2.3.8)
|
||||
|
||||
#### New Features
|
||||
* Support for PG-Promise options, thanks to [ren dong](https://github.com/rendongsc)
|
||||
|
||||
#### Improvements
|
||||
* Improves support for graceful shutdown, thanks to [Florent Vilmart](https://github.com/flovilmart)
|
||||
* Improves configuration validation for Twitter Authentication, thanks to [Benjamin Wilson Friedman](https://github.com/montymxb)
|
||||
|
||||
#### Bug Fixes
|
||||
* Fixes issue affecting GeoPoint __type with Postgres, thanks to [zhoul-HS](https://github.com/zhoul-HS)
|
||||
* Prevent user creation if username or password is empty, thanks to [Wissam Abirached](https://github.com/wabirached)
|
||||
|
||||
#### Dependency Updates:
|
||||
* [cross-env@4.0.0 ](https://www.npmjs.com/package/cross-env)
|
||||
* [ws@2.2.3](https://www.npmjs.com/package/ws)
|
||||
* [babel-core@6.24.0](https://www.npmjs.com/package/babel-core)
|
||||
* [uws@0.14.0](https://www.npmjs.com/package/uws)
|
||||
* [babel-preset-es2015@6.24.0](https://www.npmjs.com/package/babel-preset-es2015)
|
||||
* [babel-plugin-syntax-flow@6.18.0](https://www.npmjs.com/package/babel-plugin-syntax-flow)
|
||||
* [babel-cli@6.24.0](https://www.npmjs.com/package/babel-cli)
|
||||
* [babel-register@6.24.0](https://www.npmjs.com/package/babel-register)
|
||||
* [winston-daily-rotate-file@1.4.6](https://www.npmjs.com/package/winston-daily-rotate-file)
|
||||
* [mongodb@2.2.25](https://www.npmjs.com/package/mongodb)
|
||||
* [redis@2.7.0](https://www.npmjs.com/package/redis)
|
||||
* [pg-promise@5.6.4](https://www.npmjs.com/package/pg-promise)
|
||||
* [parse-server-push-adapter@1.3.0](https://www.npmjs.com/package/parse-server-push-adapter)
|
||||
|
||||
### 2.3.7
|
||||
[Full Changelog](https://github.com/ParsePlatform/parse-server/compare/2.3.6...2.3.7)
|
||||
|
||||
|
||||
@@ -28,3 +28,7 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-----
|
||||
|
||||
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
|
||||
|
||||
@@ -31,3 +31,7 @@ necessarily infringed by the Software standing alone.
|
||||
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
|
||||
or contributory infringement or inducement to infringe any patent, including a
|
||||
cross-claim or counterclaim.
|
||||
|
||||
-----
|
||||
|
||||
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||

|
||||
|
||||
[](https://travis-ci.org/ParsePlatform/parse-server)
|
||||
[](https://codecov.io/github/ParsePlatform/parse-server?branch=master)
|
||||
[](https://travis-ci.org/parse-community/parse-server)
|
||||
[](https://codecov.io/github/parse-community/parse-server?branch=master)
|
||||
[](https://www.npmjs.com/package/parse-server)
|
||||
|
||||
[](https://gitter.im/ParsePlatform/Chat)
|
||||
@@ -24,12 +24,14 @@ $ npm install -g parse-server mongodb-runner
|
||||
$ mongodb-runner start
|
||||
$ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://localhost/test
|
||||
```
|
||||
***Note:*** *If installation with* `-g` *fails due to permission problems* (`npm ERR! code 'EACCES'`), *please refer to [this link](https://docs.npmjs.com/getting-started/fixing-npm-permissions).*
|
||||
|
||||
|
||||
### Inside a Docker container
|
||||
```
|
||||
$ docker build --tag parse-server .
|
||||
$ docker run --name my-mongo -d mongo
|
||||
$ docker run --name my-parse-server --link my-mongo:mongo parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test
|
||||
$ docker run --name my-parse-server --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test
|
||||
```
|
||||
|
||||
You can use any arbitrary string as your application id and master key. These will be used by your clients to authenticate with the Parse Server.
|
||||
@@ -40,7 +42,7 @@ That's it! You are now running a standalone version of Parse Server on your mach
|
||||
|
||||
### Saving your first object
|
||||
|
||||
Now that you're running Parse Server, it is time to save your first object. We'll use the [REST API](https://parse.com/docs/rest/guide), but you can easily do the same using any of the [Parse SDKs](https://parseplatform.github.io/#sdks). Run the following:
|
||||
Now that you're running Parse Server, it is time to save your first object. We'll use the [REST API](https://docs.parseplatform.org/rest/guide), but you can easily do the same using any of the [Parse SDKs](https://parseplatform.github.io/#sdks). Run the following:
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
@@ -102,19 +104,19 @@ $ curl -X GET \
|
||||
|
||||
```
|
||||
|
||||
To learn more about using saving and querying objects on Parse Server, check out the [Parse documentation](https://parse.com/docs).
|
||||
To learn more about using saving and querying objects on Parse Server, check out the [Parse documentation](https://docs.parseplatform.org).
|
||||
|
||||
### Connect your app to Parse Server
|
||||
|
||||
Parse provides SDKs for all the major platforms. Refer to the Parse Server guide to [learn how to connect your app to Parse Server](https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#using-parse-sdks-with-parse-server).
|
||||
Parse provides SDKs for all the major platforms. Refer to the Parse Server guide to [learn how to connect your app to Parse Server](https://github.com/parse-community/parse-server/wiki/Parse-Server-Guide#using-parse-sdks-with-parse-server).
|
||||
|
||||
## Running Parse Server elsewhere
|
||||
|
||||
Once you have a better understanding of how the project works, please refer to the [Parse Server wiki](https://github.com/ParsePlatform/parse-server/wiki) for in-depth guides to deploy Parse Server to major infrastructure providers. Read on to learn more about additional ways of running Parse Server.
|
||||
Once you have a better understanding of how the project works, please refer to the [Parse Server wiki](https://github.com/parse-community/parse-server/wiki) for in-depth guides to deploy Parse Server to major infrastructure providers. Read on to learn more about additional ways of running Parse Server.
|
||||
|
||||
### Parse Server Sample Application
|
||||
|
||||
We have provided a basic [Node.js application](https://github.com/ParsePlatform/parse-server-example) that uses the Parse Server module on Express and can be easily deployed to various infrastructure providers:
|
||||
We have provided a basic [Node.js application](https://github.com/parse-community/parse-server-example) that uses the Parse Server module on Express and can be easily deployed to various infrastructure providers:
|
||||
|
||||
* [Heroku and mLab](https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku)
|
||||
* [AWS and Elastic Beanstalk](http://mobile.awsblog.com/post/TxCD57GZLM2JR/How-to-set-up-Parse-Server-on-AWS-using-AWS-Elastic-Beanstalk)
|
||||
@@ -125,6 +127,7 @@ We have provided a basic [Node.js application](https://github.com/ParsePlatform/
|
||||
* [Pivotal Web Services](https://github.com/cf-platform-eng/pws-parse-server)
|
||||
* [Back4app](http://blog.back4app.com/2016/03/01/quick-wizard-migration/)
|
||||
* [Gomix](https://gomix.com/#!/project/parse-server)
|
||||
* [Flynn](https://flynn.io/blog/parse-apps-on-flynn)
|
||||
|
||||
### Parse Server + Express
|
||||
|
||||
@@ -170,11 +173,7 @@ Logs are also be viewable in Parse Dashboard.
|
||||
|
||||
# Documentation
|
||||
|
||||
The full documentation for Parse Server is available in the [wiki](https://github.com/ParsePlatform/parse-server/wiki). The [Parse Server guide](https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide) is a good place to get started. If you're interested in developing for Parse Server, the [Development guide](https://github.com/ParsePlatform/parse-server/wiki/Development-Guide) will help you get set up.
|
||||
|
||||
## Migrating an Existing Parse App
|
||||
|
||||
The hosted version of Parse will be fully retired on January 28th, 2017. If you are planning to migrate an app, you need to begin work as soon as possible. There are a few areas where Parse Server does not provide compatibility with the hosted version of Parse. Learn more in the [Migration guide](https://parse.com/migration).
|
||||
The full documentation for Parse Server is available in the [wiki](https://github.com/parse-community/parse-server/wiki). The [Parse Server guide](http://docs.parseplatform.org/parse-server/guide/) is a good place to get started. If you're interested in developing for Parse Server, the [Development guide](http://docs.parseplatform.org/parse-server/guide/#development-guide) will help you get set up.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -190,7 +189,7 @@ For the full list of available options, run `parse-server --help`.
|
||||
* `port` - The default port is 1337, specify this parameter to use a different port.
|
||||
* `serverURL` - URL to your Parse Server (don't forget to specify http:// or https://). This URL will be used when making requests to Parse Server from Cloud Code.
|
||||
* `cloud` - The absolute path to your cloud code `main.js` file.
|
||||
* `push` - Configuration options for APNS and GCM push. See the [Push Notifications wiki entry](https://github.com/ParsePlatform/parse-server/wiki/Push).
|
||||
* `push` - Configuration options for APNS and GCM push. See the [Push Notifications quick start](http://docs.parseplatform.org/parse-server/guide/#push-notifications_push-notifications-quick-start).
|
||||
|
||||
#### Client key options
|
||||
|
||||
@@ -206,12 +205,12 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
|
||||
* `fileKey` - For migrated apps, this is necessary to provide access to files already hosted on Parse.
|
||||
* `allowClientClassCreation` - Set to false to disable client class creation. Defaults to true.
|
||||
* `enableAnonymousUsers` - Set to false to disable anonymous users. Defaults to true.
|
||||
* `auth` - Used to configure support for [3rd party authentication](https://github.com/ParsePlatform/parse-server/wiki/OAuth--and-Custom-Authentication).
|
||||
* `auth` - Used to configure support for [3rd party authentication](http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication).
|
||||
* `facebookAppIds` - An array of valid Facebook application IDs that users may authenticate with.
|
||||
* `mountPath` - Mount path for the server. Defaults to `/parse`.
|
||||
* `filesAdapter` - The default behavior (GridStore) can be changed by creating an adapter class (see [`FilesAdapter.js`](https://github.com/ParsePlatform/parse-server/blob/master/src/Adapters/Files/FilesAdapter.js)).
|
||||
* `filesAdapter` - The default behavior (GridStore) can be changed by creating an adapter class (see [`FilesAdapter.js`](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Files/FilesAdapter.js)).
|
||||
* `maxUploadSize` - Max file size for uploads. Defaults to 20 MB.
|
||||
* `loggerAdapter` - The default behavior/transport (File) can be changed by creating an adapter class (see [`LoggerAdapter.js`](https://github.com/ParsePlatform/parse-server/blob/master/src/Adapters/Logger/LoggerAdapter.js)).
|
||||
* `loggerAdapter` - The default behavior/transport (File) can be changed by creating an adapter class (see [`LoggerAdapter.js`](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Logger/LoggerAdapter.js)).
|
||||
* `sessionLength` - The length of time in seconds that a session should be valid for. Defaults to 31536000 seconds (1 year).
|
||||
* `revokeSessionOnPasswordReset` - When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.
|
||||
* `accountLockout` - Lock account when a malicious user is attempting to determine an account password by trial and error.
|
||||
@@ -337,19 +336,19 @@ Parse Server allows developers to choose from several options when hosting files
|
||||
* `S3Adapter`, which is backed by [Amazon S3](https://aws.amazon.com/s3/); or
|
||||
* `GCSAdapter`, which is backed by [Google Cloud Storage](https://cloud.google.com/storage/)
|
||||
|
||||
`GridStoreAdapter` is used by default and requires no setup, but if you're interested in using S3 or Google Cloud Storage, additional configuration information is available in the [Parse Server wiki](https://github.com/ParsePlatform/parse-server/wiki/Configuring-File-Adapters).
|
||||
`GridStoreAdapter` is used by default and requires no setup, but if you're interested in using S3 or Google Cloud Storage, additional configuration information is available in the [Parse Server guide](http://docs.parseplatform.org/parse-server/guide/#configuring-file-adapters).
|
||||
|
||||
# Support
|
||||
|
||||
For implementation related questions or technical support, please refer to the [Stack Overflow](http://stackoverflow.com/questions/tagged/parse.com) and [Server Fault](https://serverfault.com/tags/parse) communities.
|
||||
|
||||
If you believe you've found an issue with Parse Server, make sure these boxes are checked before [reporting an issue](https://github.com/ParsePlatform/parse-server/issues):
|
||||
If you believe you've found an issue with Parse Server, make sure these boxes are checked before [reporting an issue](https://github.com/parse-community/parse-server/issues):
|
||||
|
||||
- [ ] You've met the [prerequisites](https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#prerequisites).
|
||||
- [ ] You've met the [prerequisites](http://docs.parseplatform.org/parse-server/guide/#prerequisites).
|
||||
|
||||
- [ ] You're running the [latest version](https://github.com/ParsePlatform/parse-server/releases) of Parse Server.
|
||||
- [ ] You're running the [latest version](https://github.com/parse-community/parse-server/releases) of Parse Server.
|
||||
|
||||
- [ ] You've searched through [existing issues](https://github.com/ParsePlatform/parse-server/issues?utf8=%E2%9C%93&q=). Chances are that your issue has been reported or resolved before.
|
||||
- [ ] You've searched through [existing issues](https://github.com/parse-community/parse-server/issues?utf8=%E2%9C%93&q=). Chances are that your issue has been reported or resolved before.
|
||||
|
||||
# Want to ride the bleeding edge?
|
||||
|
||||
@@ -366,3 +365,7 @@ npm install parseplatform/parse-server.git#latest
|
||||
# Contributing
|
||||
|
||||
We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the [Contributing to Parse Server guide](CONTRIBUTING.md).
|
||||
|
||||
-----
|
||||
|
||||
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
|
||||
|
||||
+19
-20
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "parse-server",
|
||||
"version": "2.3.7",
|
||||
"version": "2.3.8",
|
||||
"description": "An express module providing a Parse-compatible API server",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
@@ -27,44 +27,43 @@
|
||||
"lodash": "4.17.4",
|
||||
"lru-cache": "4.0.2",
|
||||
"mime": "1.3.4",
|
||||
"mongodb": "2.2.24",
|
||||
"mongodb": "2.2.25",
|
||||
"multer": "1.3.0",
|
||||
"parse": "1.9.2",
|
||||
"parse-server-fs-adapter": "1.0.1",
|
||||
"parse-server-push-adapter": "1.2.0",
|
||||
"parse-server-push-adapter": "1.3.0",
|
||||
"parse-server-s3-adapter": "1.0.6",
|
||||
"parse-server-simple-mailgun-adapter": "1.0.0",
|
||||
"pg-promise": "5.6.2",
|
||||
"redis": "2.6.5",
|
||||
"pg-promise": "5.6.4",
|
||||
"redis": "2.7.1",
|
||||
"request": "2.81.0",
|
||||
"semver": "5.2.0",
|
||||
"tv4": "1.2.7",
|
||||
"tv4": "1.3.0",
|
||||
"winston": "2.3.1",
|
||||
"winston-daily-rotate-file": "1.4.5",
|
||||
"ws": "2.2.0"
|
||||
"winston-daily-rotate-file": "1.4.6",
|
||||
"ws": "2.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
"babel-cli": "6.23.0",
|
||||
"babel-core": "6.23.1",
|
||||
"babel-cli": "6.24.0",
|
||||
"babel-core": "6.24.0",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-plugin-syntax-flow": "6.13.0",
|
||||
"babel-plugin-syntax-flow": "6.18.0",
|
||||
"babel-plugin-transform-flow-strip-types": "6.22.0",
|
||||
"babel-preset-es2015": "6.22.0",
|
||||
"babel-preset-es2015": "6.24.0",
|
||||
"babel-preset-stage-0": "6.22.0",
|
||||
"babel-register": "6.23.0",
|
||||
"babel-register": "6.24.0",
|
||||
"bcrypt-nodejs": "0.0.3",
|
||||
"cross-env": "3.1.4",
|
||||
"cross-env": "4.0.0",
|
||||
"deep-diff": "0.3.4",
|
||||
"eslint": "^3.16.1",
|
||||
"eslint-plugin-flowtype": "^2.25.0",
|
||||
"gaze": "1.1.1",
|
||||
"istanbul": "1.0.0-alpha.1",
|
||||
"jasmine": "2.5.3",
|
||||
"jasmine-spec-reporter": "^3.1.0",
|
||||
"mongodb-runner": "3.4.0",
|
||||
"nodemon": "1.11.0",
|
||||
"request-promise": "4.1.1"
|
||||
"nyc": "^10.1.2",
|
||||
"request-promise": "4.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "npm run build && node bin/dev",
|
||||
@@ -73,8 +72,8 @@
|
||||
"pretest": "npm run lint",
|
||||
"test": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 $COVERAGE_OPTION jasmine",
|
||||
"test:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 jasmine",
|
||||
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/istanbul cover' npm test",
|
||||
"coverage:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/jasmine/bin/jasmine.js",
|
||||
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/nyc' npm test",
|
||||
"coverage:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 node ./node_modules/.bin/nyc ./node_modules/jasmine/bin/jasmine.js",
|
||||
"start": "node ./bin/parse-server",
|
||||
"prepublish": "npm run build"
|
||||
},
|
||||
@@ -86,6 +85,6 @@
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bcrypt": "1.0.2",
|
||||
"uws": "^0.13.0"
|
||||
"uws": "^0.14.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"notEqual": true,
|
||||
"it_exclude_dbs": true,
|
||||
"describe_only_db": true,
|
||||
"describe_only": true,
|
||||
"on_db": true,
|
||||
"defaultConfiguration": true,
|
||||
"expectSuccess": true,
|
||||
|
||||
@@ -133,4 +133,14 @@ describe('OAuth', function() {
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it("Should fail with missing options", (done) => {
|
||||
var options = undefined;
|
||||
try {
|
||||
new OAuth(options);
|
||||
} catch (error) {
|
||||
jequal(error.message, 'No options passed to OAuth');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -755,14 +755,12 @@ describe('Parse.ACL', () => {
|
||||
user2.set("password", "burger");
|
||||
return user2.signUp();
|
||||
}).then(() => {
|
||||
console.log(user2.getSessionToken());
|
||||
return object.destroy({sessionToken: user2.getSessionToken() });
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
}).then(() => {
|
||||
fail('should not be able to destroy the object');
|
||||
done();
|
||||
}, (err) => {
|
||||
console.error(err);
|
||||
expect(err).not.toBeUndefined();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,6 +26,29 @@ describe('Parse.GeoPoint testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('has the correct __type field in the json response', done => {
|
||||
var point = new Parse.GeoPoint(44.0, -11.0);
|
||||
var obj = new TestObject();
|
||||
obj.set('location', point);
|
||||
obj.set('name', 'Zhoul')
|
||||
obj.save(null, {
|
||||
success: (obj) => {
|
||||
console.log(obj);
|
||||
Parse.Cloud.httpRequest({
|
||||
url: 'http://localhost:8378/1/classes/TestObject/' + obj.id,
|
||||
headers: {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-Master-Key': 'test'
|
||||
}
|
||||
}).then(response => {
|
||||
equal(response.data.location.__type, 'GeoPoint');
|
||||
done();
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
it('geo point exception two fields', (done) => {
|
||||
var point = new Parse.GeoPoint(20, 20);
|
||||
var obj = new TestObject();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const ParseServerRESTController = require('../src/ParseServerRESTController').ParseServerRESTController;
|
||||
const ParseServer = require('../src/ParseServer').default;
|
||||
const Parse = require('parse/node').Parse;
|
||||
|
||||
let RESTController;
|
||||
|
||||
describe('ParseServerRESTController', () => {
|
||||
@@ -103,6 +105,28 @@ describe('ParseServerRESTController', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('ensures no user is created when passing an empty username', (done) => {
|
||||
RESTController.request("POST", "/classes/_User", {username: "", password: "world"}).then(() => {
|
||||
jfail(new Error('Success callback should not be called when passing an empty username.'));
|
||||
done();
|
||||
}, (err) => {
|
||||
expect(err.code).toBe(Parse.Error.USERNAME_MISSING);
|
||||
expect(err.message).toBe('bad or missing username');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('ensures no user is created when passing an empty password', (done) => {
|
||||
RESTController.request("POST", "/classes/_User", {username: "hello", password: ""}).then(() => {
|
||||
jfail(new Error('Success callback should not be called when passing an empty password.'));
|
||||
done();
|
||||
}, (err) => {
|
||||
expect(err.code).toBe(Parse.Error.PASSWORD_MISSING);
|
||||
expect(err.message).toBe('password is required');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('ensures no session token is created on creating users', (done) => {
|
||||
RESTController.request("POST", "/classes/_User", {username: "hello", password: "world"}).then((user) => {
|
||||
expect(user.sessionToken).toBeUndefined();
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
const Parse = require('parse/node').Parse;
|
||||
const PostgresStorageAdapter = require('../src/Adapters/Storage/Postgres/PostgresStorageAdapter');
|
||||
const postgresURI = 'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
|
||||
|
||||
//public schema
|
||||
const databaseOptions1 = {
|
||||
initOptions: {
|
||||
connect: function (client, dc, isFresh) {
|
||||
if (isFresh) {
|
||||
client.query('SET search_path = public');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//not exists schema
|
||||
const databaseOptions2 = {
|
||||
initOptions: {
|
||||
connect: function (client, dc, isFresh) {
|
||||
if (isFresh) {
|
||||
client.query('SET search_path = not_exists_schema');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const GameScore = Parse.Object.extend({
|
||||
className: "GameScore"
|
||||
});
|
||||
|
||||
describe('Postgres database init options', () => {
|
||||
it('create server with public schema databaseOptions,shoud be ok', (done) => {
|
||||
reconfigureServer({
|
||||
databaseAdapter: new PostgresStorageAdapter({
|
||||
uri: postgresURI, collectionPrefix: 'test_',
|
||||
databaseOptions: databaseOptions1
|
||||
})
|
||||
}).then(done, fail);
|
||||
});
|
||||
|
||||
it("save new GameScore in public schema", function (done) {
|
||||
var score = new GameScore({ "score": 1337, "playerName": "Sean Plott", "cheatMode": false });
|
||||
score.save().then(done, fail);
|
||||
});
|
||||
|
||||
it('create server with not exists schema databaseOptions,shoud be fail', (done) => {
|
||||
reconfigureServer({
|
||||
databaseAdapter: new PostgresStorageAdapter({
|
||||
uri: postgresURI, collectionPrefix: 'test_',
|
||||
databaseOptions: databaseOptions2
|
||||
})
|
||||
}).then(() => {
|
||||
done();
|
||||
})
|
||||
.catch(error => {
|
||||
expect(error.code).toEqual('42P01');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -519,7 +519,7 @@ describe('PushController', () => {
|
||||
reconfigureServer({
|
||||
push: { adapter: pushAdapter }
|
||||
}).then(() => {
|
||||
pushController.sendPush(payload, where, config, auth)
|
||||
return pushController.sendPush(payload, where, config, auth)
|
||||
}).then(() => {
|
||||
done();
|
||||
}).catch(() => {
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
var RedisCacheAdapter = require('../src/Adapters/Cache/RedisCacheAdapter').default;
|
||||
|
||||
describe('RedisCacheAdapter', function() {
|
||||
/*
|
||||
To run this test part of the complete suite
|
||||
set PARSE_SERVER_TEST_CACHE='redis'
|
||||
and make sure a redis server is available on the default port
|
||||
*/
|
||||
describe_only(() => {
|
||||
return process.env.PARSE_SERVER_TEST_CACHE === 'redis';
|
||||
})('RedisCacheAdapter', function() {
|
||||
var KEY = 'hello';
|
||||
var VALUE = 'world';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('Twitter Auth', () => {
|
||||
consumer_key: 'hello'
|
||||
}, {
|
||||
consumer_key: 'world'
|
||||
}]).consumer_key).toEqual('hello')
|
||||
}]).consumer_key).toEqual('hello');
|
||||
|
||||
// Multiple options, consumer_key not found
|
||||
expect(function(){
|
||||
@@ -47,4 +47,18 @@ describe('Twitter Auth', () => {
|
||||
consumer_key: 'hello'
|
||||
}).consumer_key).toEqual('hello');
|
||||
});
|
||||
|
||||
it("Should fail with missing options", (done) => {
|
||||
try {
|
||||
twitter.validateAuthData({
|
||||
consumer_key: 'key',
|
||||
consumer_secret: 'secret',
|
||||
auth_token: 'token',
|
||||
auth_token_secret: 'secret'
|
||||
}, undefined);
|
||||
} catch (error) {
|
||||
jequal(error.message, 'Twitter auth configuration missing');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -419,6 +419,14 @@ global.describe_only_db = db => {
|
||||
}
|
||||
}
|
||||
|
||||
global.describe_only = (validator) =>{
|
||||
if (validator()) {
|
||||
return describe;
|
||||
} else {
|
||||
return xdescribe;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var libraryCache = {};
|
||||
jasmine.mockLibrary = function(library, name, mock) {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
var https = require('https'),
|
||||
crypto = require('crypto');
|
||||
var Parse = require('parse/node').Parse;
|
||||
|
||||
var OAuth = function(options) {
|
||||
if(!options) {
|
||||
throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'No options passed to OAuth');
|
||||
}
|
||||
this.consumer_key = options.consumer_key;
|
||||
this.consumer_secret = options.consumer_secret;
|
||||
this.auth_token = options.auth_token;
|
||||
|
||||
@@ -5,6 +5,9 @@ var logger = require('../../logger').default;
|
||||
|
||||
// Returns a promise that fulfills iff this user id is valid.
|
||||
function validateAuthData(authData, options) {
|
||||
if(!options) {
|
||||
throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'Twitter auth configuration missing');
|
||||
}
|
||||
options = handleMultipleConfigurations(authData, options);
|
||||
var client = new OAuth(options);
|
||||
client.host = "api.twitter.com";
|
||||
|
||||
@@ -97,6 +97,17 @@ export class MongoStorageAdapter {
|
||||
|
||||
// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
|
||||
this._maxTimeMS = mongoOptions.maxTimeMS;
|
||||
process.on('SIGTERM', this.handleShutdown(this));
|
||||
process.on('SIGINT', this.handleShutdown(this));
|
||||
}
|
||||
|
||||
handleShutdown(storageAdapter) {
|
||||
return () => {
|
||||
if (!storageAdapter.database) {
|
||||
return;
|
||||
}
|
||||
storageAdapter.database.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
connect() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const pgp = require('pg-promise')();
|
||||
|
||||
const parser = require('./PostgresConfigParser');
|
||||
|
||||
export function createClient(uri, databaseOptions) {
|
||||
@@ -13,11 +13,13 @@ export function createClient(uri, databaseOptions) {
|
||||
dbOptions[key] = databaseOptions[key];
|
||||
}
|
||||
|
||||
const initOptions = dbOptions.initOptions || {};
|
||||
const pgp = require('pg-promise')(initOptions);
|
||||
const client = pgp(dbOptions);
|
||||
|
||||
if (dbOptions.pgOptions) {
|
||||
for (const key in dbOptions.pgOptions) {
|
||||
client.pg.defaults[key] = dbOptions.pgOptions[key];
|
||||
pgp.pg.defaults[key] = dbOptions.pgOptions[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import sql from './sql';
|
||||
const PostgresRelationDoesNotExistError = '42P01';
|
||||
const PostgresDuplicateRelationError = '42P07';
|
||||
const PostgresDuplicateColumnError = '42701';
|
||||
const PostgresDuplicateObjectError = '42710';
|
||||
const PostgresUniqueIndexViolationError = '23505';
|
||||
const PostgresTransactionAbortedError = '25P02';
|
||||
const logger = require('../../../logger');
|
||||
@@ -416,7 +417,9 @@ export class PostgresStorageAdapter {
|
||||
conn = conn || this._client;
|
||||
return conn.none('CREATE TABLE IF NOT EXISTS "_SCHEMA" ( "className" varChar(120), "schema" jsonb, "isParseClass" bool, PRIMARY KEY ("className") )')
|
||||
.catch(error => {
|
||||
if (error.code === PostgresDuplicateRelationError || error.code === PostgresUniqueIndexViolationError) {
|
||||
if (error.code === PostgresDuplicateRelationError
|
||||
|| error.code === PostgresUniqueIndexViolationError
|
||||
|| error.code === PostgresDuplicateObjectError) {
|
||||
// Table already exists, must have been created by a different request. Ignore error.
|
||||
} else {
|
||||
throw error;
|
||||
@@ -1071,6 +1074,7 @@ export class PostgresStorageAdapter {
|
||||
}
|
||||
if (object[fieldName] && schema.fields[fieldName].type === 'GeoPoint') {
|
||||
object[fieldName] = {
|
||||
__type: "GeoPoint",
|
||||
latitude: object[fieldName].y,
|
||||
longitude: object[fieldName].x
|
||||
}
|
||||
|
||||
+2
-2
@@ -204,11 +204,11 @@ RestWrite.prototype.validateAuthData = function() {
|
||||
}
|
||||
|
||||
if (!this.query && !this.data.authData) {
|
||||
if (typeof this.data.username !== 'string') {
|
||||
if (typeof this.data.username !== 'string' || _.isEmpty(this.data.username)) {
|
||||
throw new Parse.Error(Parse.Error.USERNAME_MISSING,
|
||||
'bad or missing username');
|
||||
}
|
||||
if (typeof this.data.password !== 'string') {
|
||||
if (typeof this.data.password !== 'string' || _.isEmpty(this.data.password)) {
|
||||
throw new Parse.Error(Parse.Error.PASSWORD_MISSING,
|
||||
'password is required');
|
||||
}
|
||||
|
||||
@@ -84,9 +84,7 @@ function startServer(options, callback) {
|
||||
const handleShutdown = function() {
|
||||
console.log('Termination signal received. Shutting down.');
|
||||
destroyAliveConnections();
|
||||
server.close(function () {
|
||||
process.exit(0);
|
||||
});
|
||||
server.close();
|
||||
};
|
||||
process.on('SIGTERM', handleShutdown);
|
||||
process.on('SIGINT', handleShutdown);
|
||||
|
||||
Reference in New Issue
Block a user