Mounts createLiveQueryServer, fix babel induced problem
This commit is contained in:
@@ -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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
22
src/index.js
22
src/index.js
@@ -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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user