Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (63 commits)
  Fixes parse-community#1649 (parse-community#1650)
  Update issue template (parse-community#1899)
  Break schemaController dependency. (parse-community#1901)
  Remove unnecessary null check
  Update schema mismatch error to include type string (parse-community#1898)
  Move more mongo specific stuff into mongo adapter
  Kill mongoOptions
  Consistent parameter order
  move transformWhere into mongo adapter
  Remove options from count
  Can't sort a count
  Remove limit from count
  Destructure mongo options
  remove adaptive collection call
  create + use adapter count instead of collection count
  transformWhere in MongoAdapter
  remove schemaController paramater
  Remove schemaController parameter
  Remove getRelationFields
  Remove all dependencies on schemaController
  ...
  • Loading branch information
maninga committed May 26, 2016
2 parents 209317f + 0850c18 commit 0cb352e
Show file tree
Hide file tree
Showing 54 changed files with 2,241 additions and 1,191 deletions.
57 changes: 47 additions & 10 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Check out https://github.com/ParsePlatform/parse-server/issues/1271 for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!
Please read the following instructions carefully.

Many members of the community use Stack Overflow and Server Fault to ask questions. Read through the existing questions or ask your own!
Check out https://github.com/ParsePlatform/parse-server/issues/1271 for an ideal bug report.
The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!

Many members of the community use Stack Overflow and Server Fault to ask questions.
Read through the existing questions or ask your own!
- Stack Overflow: http://stackoverflow.com/questions/tagged/parse.com
- Server Fault: https://serverfault.com/tags/parse

Expand All @@ -15,16 +18,50 @@ Make sure these boxes are checked before submitting your issue -- thanks for rep

- [ ] You've searched through existing issues: https://github.com/ParsePlatform/Parse-Server/issues?utf8=%E2%9C%93&q=is%3Aissue Chances are that your issue has been reported or resolved before.

#### Environment Setup
- [ ] You have filled out every section below. Issues without sufficient information are more likely to be closed.

- Server: parse-server version, operating system, hardware, local or remote?
- Database: version, storage engine, hardware, local or remote?
--

#### Steps to reproduce
### Issue Description

- Can this issue be reproduced using the Parse Server REST API? Include curl commands when applicable.
- What was the expected result? What is the actual outcome?
[DELETE EVERYTHING ABOVE THIS LINE BEFORE SUBMITTING YOUR ISSUE]

#### Logs/Trace
Describe your issue in as much detail as possible.

- You can turn on additional logging by configuring VERBOSE=1 in your environment.
[FILL THIS OUT]

### Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

1. [FILL THIS OUT]
2. [FILL THIS OUT]
3. [FILL THIS OUT]

#### Expected Results

[FILL THIS OUT]

#### Actual Outcome

[FILL THIS OUT]

### Environment Setup

- **Server**
- parse-server version: [FILL THIS OUT]
- Operating System: [FILL THIS OUT]
- Hardware: [FILL THIS OUT]
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): [FILL THIS OUT]

- **Database**
- MongoDB version: [FILL THIS OUT]
- Storage engine: [FILL THIS OUT]
- Hardware: [FILL THIS OUT]
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): [FILL THIS OUT]

### Logs/Trace

You can turn on additional logging by configuring VERBOSE=1 in your environment.

[FILL THIS OUT]
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
matrix:
- MONGODB_VERSION=2.6.11
- MONGODB_VERSION=3.0.8
- MONGODB_VERSION=3.2.6
branches:
only:
- master
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Parse Server Changelog

### 2.2.10 (5/15/2016)

* Fix: Write legacy ACLs to Mongo so that clients that still go through Parse.com can read them, thanks to [Tyler Brock](https://github.com/TylerBrock) and [carmenlau](https://github.com/carmenlau)
* Fix: Querying installations with limit = 0 and count = 1 now works, thanks to [ssk7833](https://github.com/ssk7833)
* Fix: Return correct error when violating unique index, thanks to [Marco Cheung](https://github.com/Marco129)
* Fix: Allow unsetting user's email, thanks to [Marco Cheung](https://github.com/Marco129)
* New: Support for Node 6.1

### 2.2.9 (5/9/2016)

* Fix: Fix a regression that caused Parse Server to crash when a null parameter is passed to a Cloud function
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ That's it! You are now running a standalone version of Parse Server on your mach

**Using a remote MongoDB?** Pass the `--databaseURI DATABASE_URI` parameter when starting `parse-server`. Learn more about configuring Parse Server [here](#configuration). For a full list of available options, run `parse-server --help`.

**Want logs to be in placed in other folder?** Pass the `PARSE_SERVER_LOGS_FOLDER` environment variable when starting `parse-server`. Usage :- `PARSE_SERVER_LOGS_FOLDER='<path-to-logs-folder>' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY`

### 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:
Expand Down Expand Up @@ -243,6 +245,9 @@ $ PORT=8080 parse-server --appId APPLICATION_ID --masterKey MASTER_KEY

For the full list of configurable environment variables, run `parse-server --help`.

### Available Adapters
[Parse Server Modules (Adapters)](https://github.com/parse-server-modules)

### Configuring File Adapters

Parse Server allows developers to choose from several options when hosting files:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-server",
"version": "2.2.9",
"version": "2.2.10",
"description": "An express module providing a Parse-compatible API server",
"main": "lib/index.js",
"repository": {
Expand Down Expand Up @@ -31,7 +31,7 @@
"lru-cache": "^4.0.0",
"mailgun-js": "^0.7.7",
"mime": "^1.3.4",
"mongodb": "~2.1.0",
"mongodb": "2.1.18",
"multer": "^1.1.0",
"parse": "^1.8.0",
"parse-server-fs-adapter": "^1.0.0",
Expand Down Expand Up @@ -59,13 +59,13 @@
"deep-diff": "^0.3.3",
"gaze": "^1.0.0",
"jasmine": "^2.3.2",
"mongodb-runner": "3.2.2",
"mongodb-runner": "^3.3.2",
"nodemon": "^1.8.1"
},
"scripts": {
"dev": "npm run build && node bin/dev",
"build": "./node_modules/.bin/babel src/ -d lib/",
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} ./node_modules/.bin/mongodb-runner start",
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 ./node_modules/.bin/mongodb-runner start",
"test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
"test:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/** ./node_modules/jasmine/bin/jasmine.js && npm run posttest",
"posttest": "./node_modules/.bin/mongodb-runner stop",
Expand Down
74 changes: 74 additions & 0 deletions spec/CacheController.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var CacheController = require('../src/Controllers/CacheController.js').default;

describe('CacheController', function() {
var FakeCacheAdapter;
var FakeAppID = 'foo';
var KEY = 'hello';

beforeEach(() => {
FakeCacheAdapter = {
get: () => Promise.resolve(null),
put: jasmine.createSpy('put'),
del: jasmine.createSpy('del'),
clear: jasmine.createSpy('clear')
}

spyOn(FakeCacheAdapter, 'get').and.callThrough();
});


it('should expose role and user caches', (done) => {
var cache = new CacheController(FakeCacheAdapter, FakeAppID);

expect(cache.role).not.toEqual(null);
expect(cache.role.get).not.toEqual(null);
expect(cache.user).not.toEqual(null);
expect(cache.user.get).not.toEqual(null);

done();
});


['role', 'user'].forEach((cacheName) => {
it('should prefix ' + cacheName + ' cache', () => {
var cache = new CacheController(FakeCacheAdapter, FakeAppID)[cacheName];

cache.put(KEY, 'world');
var firstPut = FakeCacheAdapter.put.calls.first();
expect(firstPut.args[0]).toEqual([FakeAppID, cacheName, KEY].join(':'));

cache.get(KEY);
var firstGet = FakeCacheAdapter.get.calls.first();
expect(firstGet.args[0]).toEqual([FakeAppID, cacheName, KEY].join(':'));

cache.del(KEY);
var firstDel = FakeCacheAdapter.del.calls.first();
expect(firstDel.args[0]).toEqual([FakeAppID, cacheName, KEY].join(':'));
});
});

it('should clear the entire cache', () => {
var cache = new CacheController(FakeCacheAdapter, FakeAppID);

cache.clear();
expect(FakeCacheAdapter.clear.calls.count()).toEqual(1);

cache.user.clear();
expect(FakeCacheAdapter.clear.calls.count()).toEqual(2);

cache.role.clear();
expect(FakeCacheAdapter.clear.calls.count()).toEqual(3);
});

it('should handle cache rejections', (done) => {

FakeCacheAdapter.get = () => Promise.reject();

var cache = new CacheController(FakeCacheAdapter, FakeAppID);

cache.get('foo').then(done, () => {
fail('Promise should not be rejected.');
});
});

});
Loading

0 comments on commit 0cb352e

Please sign in to comment.