From ddb76a86504446d484b8ebb33a2ef7dffe07da53 Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Wed, 23 Mar 2016 09:19:09 -0400 Subject: [PATCH] Mounts createLiveQueryServer, fix babel induced problem --- spec/index.spec.js | 8 ++++++++ src/index.js | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/spec/index.spec.js b/spec/index.spec.js index f3a32b5d..bb902e05 100644 --- a/spec/index.spec.js +++ b/spec/index.spec.js @@ -228,4 +228,12 @@ describe('server', () => { 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(); + }); }); diff --git a/src/index.js b/src/index.js index 5abd4b14..47563d4b 100644 --- a/src/index.js +++ b/src/index.js @@ -79,7 +79,7 @@ addParseCloud(); // "javascriptKey": optional key from Parse dashboard // "push": optional key from configure push -export default class ParseServer { +class ParseServer { constructor({ appId = requiredParameter('You must provide an appId!'), @@ -270,25 +270,25 @@ export default class ParseServer { return api; } - static ParseServer(options) { - let server = new ParseServer(options); - return server.app; - } - static createLiveQueryServer(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() { const ParseCloud = require("./cloud-code/Parse.Cloud"); Object.assign(Parse.Cloud, ParseCloud); global.Parse = Parse; } -let runServer = function(options) { - return ParseServer.ParseServer(options); -} - +export default ParseServer; export { S3Adapter, GCSAdapter, FileSystemAdapter }; -export { runServer as ParseServer }; +export { _ParseServer as ParseServer };