Mounts createLiveQueryServer, fix babel induced problem

This commit is contained in:
Florent Vilmart
2016-03-23 09:19:09 -04:00
parent f5fdedfbc7
commit ddb76a8650
2 changed files with 19 additions and 11 deletions

View File

@@ -228,4 +228,12 @@ describe('server', () => {
done(); done();
}) })
}); });
it('has createLiveQueryServer', done => {
// original implementation through the factory
expect(typeof ParseServer.ParseServer.createLiveQueryServer).toEqual('function');
// For import calls
expect(typeof ParseServer.default.createLiveQueryServer).toEqual('function');
done();
});
}); });

View File

@@ -79,7 +79,7 @@ addParseCloud();
// "javascriptKey": optional key from Parse dashboard // "javascriptKey": optional key from Parse dashboard
// "push": optional key from configure push // "push": optional key from configure push
export default class ParseServer { class ParseServer {
constructor({ constructor({
appId = requiredParameter('You must provide an appId!'), appId = requiredParameter('You must provide an appId!'),
@@ -270,25 +270,25 @@ export default class ParseServer {
return api; return api;
} }
static ParseServer(options) {
let server = new ParseServer(options);
return server.app;
}
static createLiveQueryServer(httpServer, config) { static createLiveQueryServer(httpServer, config) {
return new ParseLiveQueryServer(httpServer, config); return new ParseLiveQueryServer(httpServer, config);
} }
} }
// Factory function
let _ParseServer = function(options) {
let server = new ParseServer(options);
return server.app;
}
// Mount the create liveQueryServer
_ParseServer.createLiveQueryServer = ParseServer.createLiveQueryServer;
function addParseCloud() { function addParseCloud() {
const ParseCloud = require("./cloud-code/Parse.Cloud"); const ParseCloud = require("./cloud-code/Parse.Cloud");
Object.assign(Parse.Cloud, ParseCloud); Object.assign(Parse.Cloud, ParseCloud);
global.Parse = Parse; global.Parse = Parse;
} }
let runServer = function(options) { export default ParseServer;
return ParseServer.ParseServer(options);
}
export { S3Adapter, GCSAdapter, FileSystemAdapter }; export { S3Adapter, GCSAdapter, FileSystemAdapter };
export { runServer as ParseServer }; export { _ParseServer as ParseServer };