Compare commits

..
36 Commits
Author SHA1 Message Date
Florent Vilmart 302a0dda73 Prepare 2.3.8 release (#3710) 2017-04-12 16:02:13 -07:00
Florent Vilmart e7a45cecb7 Adds graceful shutdown handler for mongodb (#3706) 2017-04-11 09:26:25 -07:00
Florent Vilmart 906fb27389 Delete { 2017-04-08 18:24:44 -04:00
ren dong f3f81b692b support pg-promise init options (#3613)
* pg-promise init options

* add database init options

* Create PostgresInitOptions.spec.js

* Update PostgresInitOptions.spec.js

* Update PostgresInitOptions.spec.js

* add PostgresInitOptions test

* Add files via upload

* linebreaks CRLF to LF

* modify postgresURI to test environment

* modify pg error code to 42P01

* fix reconfigureServer callback
2017-04-07 07:50:55 -04:00
zhoul-HS 52828683ba Add __type property to GeoPoint fields in PostgresStorageAdapter (#3695)
* Add __type property to GeoPoint fields in PostgresStorageAdapter

* Add test to check __type on GeoPoint queries
2017-04-07 07:44:12 -04:00
Florent Vilmart 0add7c0c50 Fixes broken links
Fixes #3692
2017-04-06 08:27:00 -04:00
Jean-Michel Fayard 1bc74f4aa3 doc: Host sample application on flynn (#3691) 2017-04-06 07:44:36 -04:00
Florent Vilmart c2e3092385 Updates links 2017-04-05 17:22:45 -04:00
Kevin Lacker 79806c5eba transfer code 2017-04-05 13:44:18 -07:00
George Perez 48115349d4 Add -d flag to link parse with mgo container (#3677)
Needed to run docker run --name my-parse-server --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY to link the containers
2017-04-03 12:39:05 -07:00
Greenkeeper 87085b35b6 chore(package): update cross-env to version 4.0.0 (#3680)
https://greenkeeper.io/
2017-04-03 12:36:42 -07:00
Greenkeeper 65a8a1fc56 chore(package): update ws to version 2.2.3 (#3686)
https://greenkeeper.io/
2017-04-03 12:35:34 -07:00
Greenkeeper f9ecebde3b chore(package): update babel-core to version 6.24.0 (#3628)
https://greenkeeper.io/
2017-03-28 15:28:41 -07:00
Benjamin Wilson Friedman e01b417d3f Added exception for Twitter and OAuth missing options (#3676)
* Added exception for Twitter and OAuth missing configuration information

* Updated error codes to INTERNAL_SERVER_ERROR, code 1
2017-03-28 18:16:47 -04:00
Zubeen Tolani a54f4d43fa Add install instructions for root user (#3419)
* Add install instructions for root user

* Reword the comment

* Update README.md

Commit adds a reference to solve the EACCES error while installation.

* remove trailing whitespace
2017-03-27 14:30:55 -07:00
Greenkeeper 7a43faa49c chore(package): update ws to version 2.2.2 (#3656)
https://greenkeeper.io/
2017-03-25 10:31:03 -07:00
Greenkeeper abf6828a7f chore(package): update babel-plugin-syntax-flow to version 6.18.0 (#3664)
https://greenkeeper.io/
2017-03-25 10:30:15 -07:00
Greenkeeper 2436a85de6 chore(package): update uws to version 0.14.0 (#3670)
https://greenkeeper.io/
2017-03-25 10:29:35 -07:00
Florent Vilmart 1f9a4edacd Ignore duplicate_object error on create _Schema if not exists (#3668) 2017-03-23 22:29:43 -04:00
Greenkeeper 6a2b972566 chore(package): update tv4 to version 1.3.0 (#3653)
https://greenkeeper.io/
2017-03-20 13:10:31 -04:00
Florent Vilmart f3765e0b8e use nyc for coverage (#3652)
* use nyc for coverage

* removes unnecessary logss

* Disable RedisCacheAdapter tests when not in specific environment
2017-03-20 09:58:36 -07:00
Greenkeeper eeb3a7028d chore(package): update mongodb to version 2.2.25 (#3649)
https://greenkeeper.io/
2017-03-17 18:57:36 -04:00
Wissam Abirached 2533a8cdb3 Do not create user if username or password is empty (#3650) 2017-03-17 18:57:21 -04:00
Greenkeeper ea94ae73f6 chore(package): update request-promise to version 4.2.0 (#3648)
https://greenkeeper.io/
2017-03-16 18:28:15 -04:00
Greenkeeper 1ec70b299b chore(package): update redis to version 2.7.1 (#3644)
https://greenkeeper.io/
2017-03-15 09:00:37 -04:00
Greenkeeper 45efe2f29c chore(package): update cross-env to version 3.2.4 (#3642)
https://greenkeeper.io/
2017-03-15 09:00:19 -04:00
Stefan Trauth 5e29336962 update push adapter to 1.3.0 (#3641) 2017-03-15 08:59:58 -04:00
jeacott1 82e0a59139 missing return in test. (#3645) 2017-03-15 08:59:19 -04:00
Greenkeeper 51b519355a chore(package): update ws to version 2.2.1 (#3631)
https://greenkeeper.io/
2017-03-13 15:48:20 -04:00
Greenkeeper 08e8a428b6 chore(package): update babel-cli to version 6.24.0 (#3627)
https://greenkeeper.io/
2017-03-13 15:48:09 -04:00
Greenkeeper 63bd333715 chore(package): update babel-preset-es2015 to version 6.24.0 (#3630)
https://greenkeeper.io/
2017-03-13 14:17:36 -04:00
Greenkeeper 11071dd015 chore(package): update babel-register to version 6.24.0 (#3629)
https://greenkeeper.io/
2017-03-13 14:17:22 -04:00
Greenkeeper 9b879dd371 chore(package): update winston-daily-rotate-file to version 1.4.6 (#3625)
https://greenkeeper.io/
2017-03-13 14:17:10 -04:00
Florent Vilmart eb1b84b556 CLI: Do not exit(0) so each module can close its connections (#3634) 2017-03-13 12:13:07 -04:00
Greenkeeper 80ec61f7ce chore(package): update redis to version 2.7.0 (#3620)
https://greenkeeper.io/
2017-03-12 21:28:01 -07:00
Greenkeeper 9f1077c9d3 chore(package): update pg-promise to version 5.6.4 (#3622)
https://greenkeeper.io/
2017-03-12 17:17:18 -07:00
27 changed files with 279 additions and 63 deletions
+3 -2
View File
@@ -1,2 +1,3 @@
lib/*
coverage/*
lib
coverage
+1
View File
@@ -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
-2
View File
@@ -1,2 +0,0 @@
instrumentation:
excludes: ["**/spec/**"]
+11
View File
@@ -0,0 +1,11 @@
{
"reporter": [
"lcov",
"text-summary"
],
"exclude": [
"**/spec/**",
"lib/"
]
}
+1 -1
View File
@@ -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
+29
View File
@@ -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)
+4
View File
@@ -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.
+4
View File
@@ -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.
+25 -22
View File
@@ -1,7 +1,7 @@
![Parse Server logo](.github/parse-server-logo.png?raw=true)
[![Build Status](https://img.shields.io/travis/ParsePlatform/parse-server/master.svg?style=flat)](https://travis-ci.org/ParsePlatform/parse-server)
[![Coverage Status](https://img.shields.io/codecov/c/github/ParsePlatform/parse-server/master.svg)](https://codecov.io/github/ParsePlatform/parse-server?branch=master)
[![Build Status](https://img.shields.io/travis/parse-community/parse-server/master.svg?style=flat)](https://travis-ci.org/parse-community/parse-server)
[![Coverage Status](https://img.shields.io/codecov/c/github/parse-community/parse-server/master.svg)](https://codecov.io/github/parse-community/parse-server?branch=master)
[![npm version](https://img.shields.io/npm/v/parse-server.svg?style=flat)](https://www.npmjs.com/package/parse-server)
[![Join Chat](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](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
View File
@@ -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"
}
}
+1
View File
@@ -16,6 +16,7 @@
"notEqual": true,
"it_exclude_dbs": true,
"describe_only_db": true,
"describe_only": true,
"on_db": true,
"defaultConfiguration": true,
"expectSuccess": true,
+10
View File
@@ -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();
}
});
});
+2 -4
View File
@@ -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();
});
});
+23
View File
@@ -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();
+24
View File
@@ -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();
+60
View File
@@ -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();
});
});
});
+1 -1
View File
@@ -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(() => {
+8 -2
View File
@@ -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';
+15 -1
View File
@@ -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();
}
});
});
+8
View File
@@ -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) {
+4
View File
@@ -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;
+3
View File
@@ -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
View File
@@ -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');
}
+1 -3
View File
@@ -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);