parseproxy
Advanced tools
Comparing version 1.0.4 to 1.1.0
42
index.js
@@ -21,7 +21,7 @@ /** | ||
// ParseProxy | ||
var ParseProxy = function() { | ||
var ParseProxy = function () { | ||
this.ready = false; | ||
} | ||
ParseProxy.prototype.init = function(serverURL, appId, javascriptKey, masterKey) { | ||
ParseProxy.prototype.init = function (serverURL, appId, javascriptKey, masterKey) { | ||
// https://parseplatform.github.io/Parse-SDK-JS/api/classes/Parse.html | ||
@@ -39,4 +39,18 @@ Parse.initialize(appId, javascriptKey); | ||
*/ | ||
ParseProxy.prototype.subscribeMessageInbound = function(handler) { | ||
ParseProxy.prototype.subscribeMessageInbound = function (handler, filters) { | ||
let query = new Parse.Query('MessageInbound'); | ||
// build query with filters | ||
if (filters) { | ||
_.each(filters, function (val, index) { | ||
switch (val.ref) { | ||
case 'equalTo': | ||
query.equalTo(val.key, val.val); | ||
break; | ||
default: | ||
debug('not Implemented.'); | ||
break; | ||
} | ||
}); | ||
} | ||
let subscription = query.subscribe(); | ||
@@ -97,3 +111,3 @@ subscription.on('open', () => { | ||
*/ | ||
ParseProxy.prototype.createMessageInbound = function(obj) { | ||
ParseProxy.prototype.createMessageInbound = function (obj) { | ||
if (ObjectHasKeys(obj, ['fromUserId', 'type'])) { | ||
@@ -115,6 +129,6 @@ let MessageInbound = Parse.Object.extend("MessageInbound"); | ||
*/ | ||
ParseProxy.prototype.subscribeMessageOutbound = function(handler, filters) { | ||
ParseProxy.prototype.subscribeMessageOutbound = function (handler, filters) { | ||
let query = new Parse.Query('MessageOutbound'); | ||
if (filters) { | ||
_.each(filters, function(val, index) { | ||
_.each(filters, function (val, index) { | ||
switch (val.ref) { | ||
@@ -184,3 +198,3 @@ case 'equalTo': | ||
*/ | ||
ParseProxy.prototype.createMessageOutbound = function(obj) { | ||
ParseProxy.prototype.createMessageOutbound = function (obj) { | ||
if (ObjectHasKeys(obj, ['toUserId', 'type'])) { | ||
@@ -200,3 +214,3 @@ let MessageOutbound = Parse.Object.extend("MessageOutbound"); | ||
*/ | ||
ParseProxy.prototype.getParseObject = function(className) { | ||
ParseProxy.prototype.getParseObject = function (className) { | ||
return Parse.Object.extend(className); | ||
@@ -209,3 +223,3 @@ } | ||
*/ | ||
ParseProxy.prototype.getParseUser = function() { | ||
ParseProxy.prototype.getParseUser = function () { | ||
return Parse.User; | ||
@@ -219,6 +233,6 @@ } | ||
*/ | ||
ParseProxy.prototype.getParseQuery = function(classInst, filters) { | ||
ParseProxy.prototype.getParseQuery = function (classInst, filters) { | ||
let query = new Parse.Query(classInst); | ||
if (filters) { | ||
_.each(filters, function(val, index) { | ||
_.each(filters, function (val, index) { | ||
switch (val.ref) { | ||
@@ -237,2 +251,8 @@ case 'equalTo': | ||
//https://parseplatform.github.io/docs/js/guide/#config | ||
ParseProxy.prototype.getConfig = function(){ | ||
// return Promise | ||
return Parse.Config.get(); | ||
} | ||
exports = module.exports = new ParseProxy(); |
{ | ||
"name": "parseproxy", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Parse Proxy for parse server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8399
237