@@ -20,6 +20,7 @@
|
|||||||
"eol-last": 2,
|
"eol-last": 2,
|
||||||
"space-in-parens": ["error", "never"],
|
"space-in-parens": ["error", "never"],
|
||||||
"no-multiple-empty-lines": 1,
|
"no-multiple-empty-lines": 1,
|
||||||
"prefer-const": "error"
|
"prefer-const": "error",
|
||||||
|
"space-infix-ops": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ var path = require('path');
|
|||||||
|
|
||||||
describe('AuthenticationProviers', function() {
|
describe('AuthenticationProviers', function() {
|
||||||
["facebook", "github", "instagram", "google", "linkedin", "meetup", "twitter", "janrainengage", "janraincapture", "vkontakte"].map(function(providerName){
|
["facebook", "github", "instagram", "google", "linkedin", "meetup", "twitter", "janrainengage", "janraincapture", "vkontakte"].map(function(providerName){
|
||||||
it("Should validate structure of "+providerName, (done) => {
|
it("Should validate structure of " + providerName, (done) => {
|
||||||
var provider = require("../src/Adapters/Auth/"+providerName);
|
var provider = require("../src/Adapters/Auth/" + providerName);
|
||||||
jequal(typeof provider.validateAuthData, "function");
|
jequal(typeof provider.validateAuthData, "function");
|
||||||
jequal(typeof provider.validateAppId, "function");
|
jequal(typeof provider.validateAppId, "function");
|
||||||
jequal(provider.validateAuthData({}, {}).constructor, Promise.prototype.constructor);
|
jequal(provider.validateAuthData({}, {}).constructor, Promise.prototype.constructor);
|
||||||
|
|||||||
@@ -1361,7 +1361,7 @@ describe('afterFind hooks', () => {
|
|||||||
Parse.Cloud.afterFind('MyObject', (req, res) => {
|
Parse.Cloud.afterFind('MyObject', (req, res) => {
|
||||||
const filteredResults = [];
|
const filteredResults = [];
|
||||||
for(let i = 0 ; i < req.objects.length ; i++){
|
for(let i = 0 ; i < req.objects.length ; i++){
|
||||||
if(req.objects[i].get("secretField")==="SSID1") {
|
if(req.objects[i].get("secretField") === "SSID1") {
|
||||||
filteredResults.push(req.objects[i]);
|
filteredResults.push(req.objects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ var httpRequest = require("../src/cloud-code/httpRequest"),
|
|||||||
express = require("express");
|
express = require("express");
|
||||||
|
|
||||||
var port = 13371;
|
var port = 13371;
|
||||||
var httpRequestServer = "http://localhost:"+port;
|
var httpRequestServer = "http://localhost:" + port;
|
||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
app.use(bodyParser.json({ 'type': '*/*' }));
|
app.use(bodyParser.json({ 'type': '*/*' }));
|
||||||
@@ -39,7 +39,7 @@ app.listen(13371);
|
|||||||
describe("httpRequest", () => {
|
describe("httpRequest", () => {
|
||||||
it("should do /hello", (done) => {
|
it("should do /hello", (done) => {
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/hello"
|
url: httpRequestServer + "/hello"
|
||||||
}).then(function(httpResponse){
|
}).then(function(httpResponse){
|
||||||
expect(httpResponse.status).toBe(200);
|
expect(httpResponse.status).toBe(200);
|
||||||
expect(httpResponse.buffer).toEqual(new Buffer('{"response":"OK"}'));
|
expect(httpResponse.buffer).toEqual(new Buffer('{"response":"OK"}'));
|
||||||
@@ -55,7 +55,7 @@ describe("httpRequest", () => {
|
|||||||
it("should do /hello with callback and promises", (done) => {
|
it("should do /hello with callback and promises", (done) => {
|
||||||
var calls = 0;
|
var calls = 0;
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/hello",
|
url: httpRequestServer + "/hello",
|
||||||
success: function() { calls++; },
|
success: function() { calls++; },
|
||||||
error: function() { calls++; }
|
error: function() { calls++; }
|
||||||
}).then(function(httpResponse){
|
}).then(function(httpResponse){
|
||||||
@@ -74,7 +74,7 @@ describe("httpRequest", () => {
|
|||||||
it("should do not follow redirects by default", (done) => {
|
it("should do not follow redirects by default", (done) => {
|
||||||
|
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/301"
|
url: httpRequestServer + "/301"
|
||||||
}).then(function(httpResponse){
|
}).then(function(httpResponse){
|
||||||
expect(httpResponse.status).toBe(301);
|
expect(httpResponse.status).toBe(301);
|
||||||
done();
|
done();
|
||||||
@@ -87,7 +87,7 @@ describe("httpRequest", () => {
|
|||||||
it("should follow redirects when set", (done) => {
|
it("should follow redirects when set", (done) => {
|
||||||
|
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/301",
|
url: httpRequestServer + "/301",
|
||||||
followRedirects: true
|
followRedirects: true
|
||||||
}).then(function(httpResponse){
|
}).then(function(httpResponse){
|
||||||
expect(httpResponse.status).toBe(200);
|
expect(httpResponse.status).toBe(200);
|
||||||
@@ -104,7 +104,7 @@ describe("httpRequest", () => {
|
|||||||
it("should fail on 404", (done) => {
|
it("should fail on 404", (done) => {
|
||||||
var calls = 0;
|
var calls = 0;
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/404",
|
url: httpRequestServer + "/404",
|
||||||
success: function() {
|
success: function() {
|
||||||
calls++;
|
calls++;
|
||||||
fail("should not succeed");
|
fail("should not succeed");
|
||||||
@@ -124,7 +124,7 @@ describe("httpRequest", () => {
|
|||||||
|
|
||||||
it("should fail on 404", (done) => {
|
it("should fail on 404", (done) => {
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/404",
|
url: httpRequestServer + "/404",
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
fail("should not succeed");
|
fail("should not succeed");
|
||||||
done();
|
done();
|
||||||
@@ -141,7 +141,7 @@ describe("httpRequest", () => {
|
|||||||
var calls = 0;
|
var calls = 0;
|
||||||
httpRequest({
|
httpRequest({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: httpRequestServer+"/echo",
|
url: httpRequestServer + "/echo",
|
||||||
body: {
|
body: {
|
||||||
foo: "bar"
|
foo: "bar"
|
||||||
},
|
},
|
||||||
@@ -218,7 +218,7 @@ describe("httpRequest", () => {
|
|||||||
|
|
||||||
it("should params object to query string", (done) => {
|
it("should params object to query string", (done) => {
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/qs",
|
url: httpRequestServer + "/qs",
|
||||||
params: {
|
params: {
|
||||||
foo: "bar"
|
foo: "bar"
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ describe("httpRequest", () => {
|
|||||||
|
|
||||||
it("should params string to query string", (done) => {
|
it("should params string to query string", (done) => {
|
||||||
httpRequest({
|
httpRequest({
|
||||||
url: httpRequestServer+"/qs",
|
url: httpRequestServer + "/qs",
|
||||||
params: "foo=bar&foo2=bar2"
|
params: "foo=bar&foo2=bar2"
|
||||||
}).then(function(httpResponse){
|
}).then(function(httpResponse){
|
||||||
expect(httpResponse.status).toBe(200);
|
expect(httpResponse.status).toBe(200);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ describe('Logger', () => {
|
|||||||
logging.logger.info('hi', {key: 'value'});
|
logging.logger.info('hi', {key: 'value'});
|
||||||
expect(process.stdout.write).toHaveBeenCalled();
|
expect(process.stdout.write).toHaveBeenCalled();
|
||||||
var firstLog = process.stdout.write.calls.first().args[0];
|
var firstLog = process.stdout.write.calls.first().args[0];
|
||||||
expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' })+'\n');
|
expect(firstLog).toEqual(JSON.stringify({key: 'value', level: 'info', message: 'hi' }) + '\n');
|
||||||
return reconfigureServer({
|
return reconfigureServer({
|
||||||
jsonLogs: false
|
jsonLogs: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ describe('OAuth', function() {
|
|||||||
var req = oauthClient.buildRequest(method, path, {"query": "param"});
|
var req = oauthClient.buildRequest(method, path, {"query": "param"});
|
||||||
|
|
||||||
jequal(req.host, options.host);
|
jequal(req.host, options.host);
|
||||||
jequal(req.path, "/"+path+"?query=param");
|
jequal(req.path, "/" + path + "?query=param");
|
||||||
jequal(req.method, "GET");
|
jequal(req.method, "GET");
|
||||||
jequal(req.headers['Content-Type'], 'application/x-www-form-urlencoded');
|
jequal(req.headers['Content-Type'], 'application/x-www-form-urlencoded');
|
||||||
jequal(req.headers['Authorization'], 'OAuth oauth_consumer_key="hello", oauth_nonce="AAAAAAAAAAAAAAAAA", oauth_signature="wNkyEkDE%2F0JZ2idmqyrgHdvC0rs%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="123450000", oauth_token="token", oauth_version="1.0"')
|
jequal(req.headers['Authorization'], 'OAuth oauth_consumer_key="hello", oauth_nonce="AAAAAAAAAAAAAAAAA", oauth_signature="wNkyEkDE%2F0JZ2idmqyrgHdvC0rs%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="123450000", oauth_token="token", oauth_version="1.0"')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ describe('Parse.Push', () => {
|
|||||||
const promises = installations.map((installation) => {
|
const promises = installations.map((installation) => {
|
||||||
if (installation.deviceType == "ios") {
|
if (installation.deviceType == "ios") {
|
||||||
expect(installation.badge).toEqual(badge);
|
expect(installation.badge).toEqual(badge);
|
||||||
expect(installation.originalBadge+1).toEqual(installation.badge);
|
expect(installation.originalBadge + 1).toEqual(installation.badge);
|
||||||
} else {
|
} else {
|
||||||
expect(installation.badge).toBeUndefined();
|
expect(installation.badge).toBeUndefined();
|
||||||
}
|
}
|
||||||
@@ -39,8 +39,8 @@ describe('Parse.Push', () => {
|
|||||||
var installations = [];
|
var installations = [];
|
||||||
while(installations.length != 10) {
|
while(installations.length != 10) {
|
||||||
var installation = new Parse.Object("_Installation");
|
var installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("badge", installations.length);
|
installation.set("badge", installations.length);
|
||||||
installation.set("originalBadge", installations.length);
|
installation.set("originalBadge", installations.length);
|
||||||
installation.set("deviceType", "ios");
|
installation.set("deviceType", "ios");
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ describe('miscellaneous', function() {
|
|||||||
};
|
};
|
||||||
request.put({
|
request.put({
|
||||||
headers: headers,
|
headers: headers,
|
||||||
url: 'http://localhost:8378/1/classes/GameScore/'+obj.id,
|
url: 'http://localhost:8378/1/classes/GameScore/' + obj.id,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
a: 'b',
|
a: 'b',
|
||||||
c: {"__op":"Increment","amount":2},
|
c: {"__op":"Increment","amount":2},
|
||||||
@@ -1241,7 +1241,7 @@ describe('miscellaneous', function() {
|
|||||||
amount: amount
|
amount: amount
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: 'http://localhost:8378/1/classes/AnObject/'+object.id
|
url: 'http://localhost:8378/1/classes/AnObject/' + object.id
|
||||||
})
|
})
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request.put(options, (err, res, body) => {
|
request.put(options, (err, res, body) => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ var express = require("express");
|
|||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
var port = 12345;
|
var port = 12345;
|
||||||
var hookServerURL = "http://localhost:"+port;
|
var hookServerURL = "http://localhost:" + port;
|
||||||
const AppCache = require('../src/cache').AppCache;
|
const AppCache = require('../src/cache').AppCache;
|
||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
@@ -129,7 +129,7 @@ describe('Hooks', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should fail to register hooks without Master Key", (done) => {
|
it("should fail to register hooks without Master Key", (done) => {
|
||||||
request.post(Parse.serverURL+"/hooks/functions", {
|
request.post(Parse.serverURL + "/hooks/functions", {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Parse-Application-Id": Parse.applicationId,
|
"X-Parse-Application-Id": Parse.applicationId,
|
||||||
"X-Parse-REST-API-Key": Parse.restKey,
|
"X-Parse-REST-API-Key": Parse.restKey,
|
||||||
@@ -254,7 +254,7 @@ describe('Hooks', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should fail trying to create a malformed function (REST)", (done) => {
|
it("should fail trying to create a malformed function (REST)", (done) => {
|
||||||
request.post(Parse.serverURL+"/hooks/functions", {
|
request.post(Parse.serverURL + "/hooks/functions", {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Parse-Application-Id": Parse.applicationId,
|
"X-Parse-Application-Id": Parse.applicationId,
|
||||||
"X-Parse-Master-Key": Parse.masterKey,
|
"X-Parse-Master-Key": Parse.masterKey,
|
||||||
@@ -272,18 +272,18 @@ describe('Hooks', () => {
|
|||||||
it("should create hooks and properly preload them", (done) => {
|
it("should create hooks and properly preload them", (done) => {
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
for (var i = 0; i<5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
promises.push(Parse.Hooks.createTrigger("MyClass"+i, "beforeSave", "http://url.com/beforeSave/"+i));
|
promises.push(Parse.Hooks.createTrigger("MyClass" + i, "beforeSave", "http://url.com/beforeSave/" + i));
|
||||||
promises.push(Parse.Hooks.createFunction("AFunction"+i, "http://url.com/function"+i));
|
promises.push(Parse.Hooks.createFunction("AFunction" + i, "http://url.com/function" + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
Parse.Promise.when(promises).then(function(){
|
Parse.Promise.when(promises).then(function(){
|
||||||
for (var i=0; i<5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
// Delete everything from memory, as the server just started
|
// Delete everything from memory, as the server just started
|
||||||
triggers.removeTrigger("beforeSave", "MyClass"+i, Parse.applicationId);
|
triggers.removeTrigger("beforeSave", "MyClass" + i, Parse.applicationId);
|
||||||
triggers.removeFunction("AFunction"+i, Parse.applicationId);
|
triggers.removeFunction("AFunction" + i, Parse.applicationId);
|
||||||
expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).toBeUndefined();
|
expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).toBeUndefined();
|
||||||
expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).toBeUndefined();
|
expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).toBeUndefined();
|
||||||
}
|
}
|
||||||
const hooksController = new HooksController(Parse.applicationId, AppCache.get('test').databaseController);
|
const hooksController = new HooksController(Parse.applicationId, AppCache.get('test').databaseController);
|
||||||
return hooksController.load()
|
return hooksController.load()
|
||||||
@@ -292,9 +292,9 @@ describe('Hooks', () => {
|
|||||||
fail('Should properly create all hooks');
|
fail('Should properly create all hooks');
|
||||||
done();
|
done();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
for (var i=0; i<5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
expect(triggers.getTrigger("MyClass"+i, "beforeSave", Parse.applicationId)).not.toBeUndefined();
|
expect(triggers.getTrigger("MyClass" + i, "beforeSave", Parse.applicationId)).not.toBeUndefined();
|
||||||
expect(triggers.getFunction("AFunction"+i, Parse.applicationId)).not.toBeUndefined();
|
expect(triggers.getFunction("AFunction" + i, Parse.applicationId)).not.toBeUndefined();
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
@@ -310,7 +310,7 @@ describe('Hooks', () => {
|
|||||||
res.json({success:"OK!"});
|
res.json({success:"OK!"});
|
||||||
});
|
});
|
||||||
|
|
||||||
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunction").then(function(){
|
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunction").then(function(){
|
||||||
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
jfail(err);
|
jfail(err);
|
||||||
@@ -332,7 +332,7 @@ describe('Hooks', () => {
|
|||||||
res.json({error: {code: 1337, error: "hacking that one!"}});
|
res.json({error: {code: 1337, error: "hacking that one!"}});
|
||||||
});
|
});
|
||||||
// The function is deleted as the DB is dropped between calls
|
// The function is deleted as the DB is dropped between calls
|
||||||
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/SomeFunctionError").then(function(){
|
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/SomeFunctionError").then(function(){
|
||||||
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
jfail(err);
|
jfail(err);
|
||||||
@@ -362,7 +362,7 @@ describe('Hooks', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKey").then(function(){
|
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKey").then(function(){
|
||||||
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
jfail(err);
|
jfail(err);
|
||||||
@@ -389,7 +389,7 @@ describe('Hooks', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL+"/ExpectingKeyAlso").then(function(){
|
Parse.Hooks.createFunction("SOME_TEST_FUNCTION", hookServerURL + "/ExpectingKeyAlso").then(function(){
|
||||||
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
return Parse.Cloud.run("SOME_TEST_FUNCTION")
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
jfail(err);
|
jfail(err);
|
||||||
@@ -422,7 +422,7 @@ describe('Hooks', () => {
|
|||||||
res.json({success: object});
|
res.json({success: object});
|
||||||
});
|
});
|
||||||
// The function is delete as the DB is dropped between calls
|
// The function is delete as the DB is dropped between calls
|
||||||
Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL+"/BeforeSaveSome").then(function(){
|
Parse.Hooks.createTrigger("SomeRandomObject", "beforeSave" ,hookServerURL + "/BeforeSaveSome").then(function(){
|
||||||
const obj = new Parse.Object("SomeRandomObject");
|
const obj = new Parse.Object("SomeRandomObject");
|
||||||
return obj.save();
|
return obj.save();
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
@@ -444,7 +444,7 @@ describe('Hooks', () => {
|
|||||||
object.set('hello', "world");
|
object.set('hello', "world");
|
||||||
res.json({success: object});
|
res.json({success: object});
|
||||||
});
|
});
|
||||||
Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL+"/BeforeSaveSome2").then(function(){
|
Parse.Hooks.createTrigger("SomeRandomObject2", "beforeSave" ,hookServerURL + "/BeforeSaveSome2").then(function(){
|
||||||
const obj = new Parse.Object("SomeRandomObject2");
|
const obj = new Parse.Object("SomeRandomObject2");
|
||||||
return obj.save();
|
return obj.save();
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
@@ -471,7 +471,7 @@ describe('Hooks', () => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
// The function is delete as the DB is dropped between calls
|
// The function is delete as the DB is dropped between calls
|
||||||
Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL+"/AfterSaveSome").then(function(){
|
Parse.Hooks.createTrigger("SomeRandomObject", "afterSave" ,hookServerURL + "/AfterSaveSome").then(function(){
|
||||||
const obj = new Parse.Object("SomeRandomObject");
|
const obj = new Parse.Object("SomeRandomObject");
|
||||||
return obj.save();
|
return obj.save();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
|||||||
@@ -1390,7 +1390,7 @@ describe('Parse.Object testing', () => {
|
|||||||
}
|
}
|
||||||
equal(itemsAgain.length, numItems, "Should get the array back");
|
equal(itemsAgain.length, numItems, "Should get the array back");
|
||||||
itemsAgain.forEach(function(item, i) {
|
itemsAgain.forEach(function(item, i) {
|
||||||
var newValue = i*2;
|
var newValue = i * 2;
|
||||||
item.set("x", newValue);
|
item.set("x", newValue);
|
||||||
});
|
});
|
||||||
return Parse.Object.saveAll(itemsAgain);
|
return Parse.Object.saveAll(itemsAgain);
|
||||||
@@ -1400,7 +1400,7 @@ describe('Parse.Object testing', () => {
|
|||||||
equal(fetchedItemsAgain.length, numItems,
|
equal(fetchedItemsAgain.length, numItems,
|
||||||
"Number of items fetched should not change");
|
"Number of items fetched should not change");
|
||||||
fetchedItemsAgain.forEach(function(item, i) {
|
fetchedItemsAgain.forEach(function(item, i) {
|
||||||
equal(item.get("x"), i*2);
|
equal(item.get("x"), i * 2);
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -1457,7 +1457,7 @@ describe('Parse.Object testing', () => {
|
|||||||
}
|
}
|
||||||
equal(itemsAgain.length, numItems, "Should get the array back");
|
equal(itemsAgain.length, numItems, "Should get the array back");
|
||||||
itemsAgain.forEach(function(item, i) {
|
itemsAgain.forEach(function(item, i) {
|
||||||
var newValue = i*2;
|
var newValue = i * 2;
|
||||||
item.set("x", newValue);
|
item.set("x", newValue);
|
||||||
});
|
});
|
||||||
return Parse.Object.saveAll(itemsAgain);
|
return Parse.Object.saveAll(itemsAgain);
|
||||||
@@ -1467,7 +1467,7 @@ describe('Parse.Object testing', () => {
|
|||||||
equal(fetchedItemsAgain.length, numItems,
|
equal(fetchedItemsAgain.length, numItems,
|
||||||
"Number of items fetched should not change");
|
"Number of items fetched should not change");
|
||||||
fetchedItemsAgain.forEach(function(item, i) {
|
fetchedItemsAgain.forEach(function(item, i) {
|
||||||
equal(item.get("x"), i*2);
|
equal(item.get("x"), i * 2);
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
@@ -1581,7 +1581,7 @@ describe('Parse.Object testing', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
itemsAgain.forEach(function(item, i) {
|
itemsAgain.forEach(function(item, i) {
|
||||||
item.set("x", i*2);
|
item.set("x", i * 2);
|
||||||
});
|
});
|
||||||
return Parse.Object.saveAll(itemsAgain);
|
return Parse.Object.saveAll(itemsAgain);
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
@@ -1619,7 +1619,7 @@ describe('Parse.Object testing', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
itemsAgain.forEach(function(item, i) {
|
itemsAgain.forEach(function(item, i) {
|
||||||
item.set("x", i*2);
|
item.set("x", i * 2);
|
||||||
});
|
});
|
||||||
return Parse.Object.saveAll(itemsAgain);
|
return Parse.Object.saveAll(itemsAgain);
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
|||||||
@@ -1652,8 +1652,8 @@ describe('Parse.Query testing', () => {
|
|||||||
}
|
}
|
||||||
Parse.Object.saveAll(objects).then(() => {
|
Parse.Object.saveAll(objects).then(() => {
|
||||||
const object = new Parse.Object("AContainer");
|
const object = new Parse.Object("AContainer");
|
||||||
for (var i=0; i<objects.length; i++) {
|
for (var i = 0; i < objects.length; i++) {
|
||||||
if (i%2 == 0) {
|
if (i % 2 == 0) {
|
||||||
objects[i].id = 'randomThing'
|
objects[i].id = 'randomThing'
|
||||||
} else {
|
} else {
|
||||||
total += objects[i].get('key');
|
total += objects[i].get('key');
|
||||||
@@ -2401,7 +2401,7 @@ describe('Parse.Query testing', () => {
|
|||||||
it('query match on array with multiple objects', (done) => {
|
it('query match on array with multiple objects', (done) => {
|
||||||
var target1 = {__type: 'Pointer', className: 'TestObject', objectId: 'abc'};
|
var target1 = {__type: 'Pointer', className: 'TestObject', objectId: 'abc'};
|
||||||
var target2 = {__type: 'Pointer', className: 'TestObject', objectId: '123'};
|
var target2 = {__type: 'Pointer', className: 'TestObject', objectId: '123'};
|
||||||
var obj= new Parse.Object('TestObject');
|
var obj = new Parse.Object('TestObject');
|
||||||
obj.set('someObjs', [target1, target2]);
|
obj.set('someObjs', [target1, target2]);
|
||||||
obj.save().then(() => {
|
obj.save().then(() => {
|
||||||
var query = new Parse.Query('TestObject');
|
var query = new Parse.Query('TestObject');
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ describe('Parse Role testing', () => {
|
|||||||
expect(roles.length).toEqual(4);
|
expect(roles.length).toEqual(4);
|
||||||
|
|
||||||
allRoles.forEach(function(name) {
|
allRoles.forEach(function(name) {
|
||||||
expect(roles.indexOf("role:"+name)).not.toBe(-1);
|
expect(roles.indexOf("role:" + name)).not.toBe(-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 1 Query for the initial setup
|
// 1 Query for the initial setup
|
||||||
@@ -165,7 +165,7 @@ describe('Parse Role testing', () => {
|
|||||||
}).then((roles) => {
|
}).then((roles) => {
|
||||||
expect(roles.length).toEqual(3);
|
expect(roles.length).toEqual(3);
|
||||||
rolesNames.forEach((name) => {
|
rolesNames.forEach((name) => {
|
||||||
expect(roles.indexOf('role:'+name)).not.toBe(-1);
|
expect(roles.indexOf('role:' + name)).not.toBe(-1);
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
}, function(){
|
}, function(){
|
||||||
|
|||||||
@@ -1678,7 +1678,7 @@ describe('Parse.User testing', () => {
|
|||||||
const userId = model.id;
|
const userId = model.id;
|
||||||
Parse.User.logOut().then(() => {
|
Parse.User.logOut().then(() => {
|
||||||
request.post({
|
request.post({
|
||||||
url:Parse.serverURL+'/classes/_User',
|
url:Parse.serverURL + '/classes/_User',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': Parse.applicationId,
|
'X-Parse-Application-Id': Parse.applicationId,
|
||||||
'X-Parse-REST-API-Key': 'rest'
|
'X-Parse-REST-API-Key': 'rest'
|
||||||
@@ -1688,7 +1688,7 @@ describe('Parse.User testing', () => {
|
|||||||
// make sure the location header is properly set
|
// make sure the location header is properly set
|
||||||
expect(userId).not.toBeUndefined();
|
expect(userId).not.toBeUndefined();
|
||||||
expect(body.objectId).toEqual(userId);
|
expect(body.objectId).toEqual(userId);
|
||||||
expect(res.headers.location).toEqual(Parse.serverURL+'/users/'+userId);
|
expect(res.headers.location).toEqual(Parse.serverURL + '/users/' + userId);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ describe('PushController', () => {
|
|||||||
var installations = [];
|
var installations = [];
|
||||||
while(installations.length != 10) {
|
while(installations.length != 10) {
|
||||||
const installation = new Parse.Object("_Installation");
|
const installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("badge", installations.length);
|
installation.set("badge", installations.length);
|
||||||
installation.set("originalBadge", installations.length);
|
installation.set("originalBadge", installations.length);
|
||||||
installation.set("deviceType", "ios");
|
installation.set("deviceType", "ios");
|
||||||
@@ -149,8 +149,8 @@ describe('PushController', () => {
|
|||||||
|
|
||||||
while(installations.length != 15) {
|
while(installations.length != 15) {
|
||||||
const installation = new Parse.Object("_Installation");
|
const installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("deviceType", "android");
|
installation.set("deviceType", "android");
|
||||||
installations.push(installation);
|
installations.push(installation);
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ describe('PushController', () => {
|
|||||||
installations.forEach((installation) => {
|
installations.forEach((installation) => {
|
||||||
if (installation.deviceType == "ios") {
|
if (installation.deviceType == "ios") {
|
||||||
expect(installation.badge).toEqual(badge);
|
expect(installation.badge).toEqual(badge);
|
||||||
expect(installation.originalBadge+1).toEqual(installation.badge);
|
expect(installation.originalBadge + 1).toEqual(installation.badge);
|
||||||
} else {
|
} else {
|
||||||
expect(installation.badge).toBeUndefined();
|
expect(installation.badge).toBeUndefined();
|
||||||
}
|
}
|
||||||
@@ -199,8 +199,8 @@ describe('PushController', () => {
|
|||||||
var installations = [];
|
var installations = [];
|
||||||
while(installations.length != 10) {
|
while(installations.length != 10) {
|
||||||
var installation = new Parse.Object("_Installation");
|
var installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("badge", installations.length);
|
installation.set("badge", installations.length);
|
||||||
installation.set("originalBadge", installations.length);
|
installation.set("originalBadge", installations.length);
|
||||||
installation.set("deviceType", "ios");
|
installation.set("deviceType", "ios");
|
||||||
@@ -249,8 +249,8 @@ describe('PushController', () => {
|
|||||||
var installations = [];
|
var installations = [];
|
||||||
while(installations.length != 10) {
|
while(installations.length != 10) {
|
||||||
var installation = new Parse.Object("_Installation");
|
var installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("badge", installations.length);
|
installation.set("badge", installations.length);
|
||||||
installation.set("originalBadge", installations.length);
|
installation.set("originalBadge", installations.length);
|
||||||
installation.set("deviceType", "ios");
|
installation.set("deviceType", "ios");
|
||||||
@@ -305,8 +305,8 @@ describe('PushController', () => {
|
|||||||
var installations = [];
|
var installations = [];
|
||||||
while(installations.length != 10) {
|
while(installations.length != 10) {
|
||||||
const installation = new Parse.Object("_Installation");
|
const installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("badge", installations.length);
|
installation.set("badge", installations.length);
|
||||||
installation.set("originalBadge", installations.length);
|
installation.set("originalBadge", installations.length);
|
||||||
installation.set("deviceType", "ios");
|
installation.set("deviceType", "ios");
|
||||||
@@ -315,8 +315,8 @@ describe('PushController', () => {
|
|||||||
|
|
||||||
while(installations.length != 15) {
|
while(installations.length != 15) {
|
||||||
const installation = new Parse.Object("_Installation");
|
const installation = new Parse.Object("_Installation");
|
||||||
installation.set("installationId", "installation_"+installations.length);
|
installation.set("installationId", "installation_" + installations.length);
|
||||||
installation.set("deviceToken","device_token_"+installations.length)
|
installation.set("deviceToken","device_token_" + installations.length)
|
||||||
installation.set("deviceType", "android");
|
installation.set("deviceType", "android");
|
||||||
installations.push(installation);
|
installations.push(installation);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ describe('PushRouter', () => {
|
|||||||
|
|
||||||
it('sends a push through REST', (done) => {
|
it('sends a push through REST', (done) => {
|
||||||
request.post({
|
request.post({
|
||||||
url: Parse.serverURL+"/push",
|
url: Parse.serverURL + "/push",
|
||||||
json: true,
|
json: true,
|
||||||
body: {
|
body: {
|
||||||
'channels': {
|
'channels': {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ describe_only_db('mongo')('revocable sessions', () => {
|
|||||||
|
|
||||||
it('should not upgrade bad legacy session token', done => {
|
it('should not upgrade bad legacy session token', done => {
|
||||||
rp.post({
|
rp.post({
|
||||||
url: Parse.serverURL+'/upgradeToRevocableSession',
|
url: Parse.serverURL + '/upgradeToRevocableSession',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': Parse.applicationId,
|
'X-Parse-Application-Id': Parse.applicationId,
|
||||||
'X-Parse-Rest-API-Key': 'rest',
|
'X-Parse-Rest-API-Key': 'rest',
|
||||||
@@ -92,7 +92,7 @@ describe_only_db('mongo')('revocable sessions', () => {
|
|||||||
|
|
||||||
it('should not crash without session token #2720', done => {
|
it('should not crash without session token #2720', done => {
|
||||||
rp.post({
|
rp.post({
|
||||||
url: Parse.serverURL+'/upgradeToRevocableSession',
|
url: Parse.serverURL + '/upgradeToRevocableSession',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': Parse.applicationId,
|
'X-Parse-Application-Id': Parse.applicationId,
|
||||||
'X-Parse-Rest-API-Key': 'rest'
|
'X-Parse-Rest-API-Key': 'rest'
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ Parse.serverURL = 'http://localhost:' + port + '/1';
|
|||||||
Parse.Promise.disableAPlusCompliant();
|
Parse.Promise.disableAPlusCompliant();
|
||||||
|
|
||||||
// 10 minutes timeout
|
// 10 minutes timeout
|
||||||
beforeAll(startDB, 10*60*1000);
|
beforeAll(startDB, 10 * 60 * 1000);
|
||||||
|
|
||||||
afterAll(stopDB);
|
afterAll(stopDB);
|
||||||
|
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ describe('rest create', () => {
|
|||||||
|
|
||||||
var session = r.results[0];
|
var session = r.results[0];
|
||||||
var actual = new Date(session.expiresAt.iso);
|
var actual = new Date(session.expiresAt.iso);
|
||||||
var expected = new Date(now.getTime() + (sessionLength*1000));
|
var expected = new Date(now.getTime() + (sessionLength * 1000));
|
||||||
|
|
||||||
expect(actual.getFullYear()).toEqual(expected.getFullYear());
|
expect(actual.getFullYear()).toEqual(expected.getFullYear());
|
||||||
expect(actual.getMonth()).toEqual(expected.getMonth());
|
expect(actual.getMonth()).toEqual(expected.getMonth());
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ describe('schemas', () => {
|
|||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
op({
|
op({
|
||||||
url: 'http://localhost:8378/1/schemas/'+className,
|
url: 'http://localhost:8378/1/schemas/' + className,
|
||||||
headers: masterKeyHeaders,
|
headers: masterKeyHeaders,
|
||||||
json: true,
|
json: true,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export class AccountLockout {
|
|||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
const updateFields = {
|
const updateFields = {
|
||||||
_account_lockout_expires_at: Parse._encode(new Date(now.getTime() + this._config.accountLockout.duration*60*1000))
|
_account_lockout_expires_at: Parse._encode(new Date(now.getTime() + this._config.accountLockout.duration * 60 * 1000))
|
||||||
};
|
};
|
||||||
|
|
||||||
this._config.database.update('_User', query, updateFields)
|
this._config.database.update('_User', query, updateFields)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ OAuth.prototype.send = function(method, path, params, body){
|
|||||||
|
|
||||||
OAuth.prototype.buildRequest = function(method, path, params, body) {
|
OAuth.prototype.buildRequest = function(method, path, params, body) {
|
||||||
if (path.indexOf("/") != 0) {
|
if (path.indexOf("/") != 0) {
|
||||||
path = "/"+path;
|
path = "/" + path;
|
||||||
}
|
}
|
||||||
if (params && Object.keys(params).length > 0) {
|
if (params && Object.keys(params).length > 0) {
|
||||||
path += "?" + OAuth.buildParameterString(params);
|
path += "?" + OAuth.buildParameterString(params);
|
||||||
@@ -118,7 +118,7 @@ OAuth.nonce = function(){
|
|||||||
var text = "";
|
var text = "";
|
||||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
for(var i=0; i < 30; i++)
|
for(var i = 0; i < 30; i++)
|
||||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@@ -162,7 +162,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to
|
|||||||
oauth_parameters.oauth_nonce = OAuth.nonce();
|
oauth_parameters.oauth_nonce = OAuth.nonce();
|
||||||
}
|
}
|
||||||
if (!oauth_parameters.oauth_timestamp) {
|
if (!oauth_parameters.oauth_timestamp) {
|
||||||
oauth_parameters.oauth_timestamp = Math.floor(new Date().getTime()/1000);
|
oauth_parameters.oauth_timestamp = Math.floor(new Date().getTime() / 1000);
|
||||||
}
|
}
|
||||||
if (!oauth_parameters.oauth_signature_method) {
|
if (!oauth_parameters.oauth_signature_method) {
|
||||||
oauth_parameters.oauth_signature_method = OAuth.signatureMethod;
|
oauth_parameters.oauth_signature_method = OAuth.signatureMethod;
|
||||||
@@ -172,7 +172,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!auth_token_secret){
|
if(!auth_token_secret){
|
||||||
auth_token_secret="";
|
auth_token_secret = "";
|
||||||
}
|
}
|
||||||
// Force GET method if unset
|
// Force GET method if unset
|
||||||
if (!request.method) {
|
if (!request.method) {
|
||||||
@@ -193,7 +193,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to
|
|||||||
var parameterString = OAuth.buildParameterString(signatureParams);
|
var parameterString = OAuth.buildParameterString(signatureParams);
|
||||||
|
|
||||||
// Build the signature string
|
// Build the signature string
|
||||||
var url = "https://"+request.host+""+request.path;
|
var url = "https://" + request.host + "" + request.path;
|
||||||
|
|
||||||
var signatureString = OAuth.buildSignatureString(request.method, url, parameterString);
|
var signatureString = OAuth.buildSignatureString(request.method, url, parameterString);
|
||||||
// Hash the signature string
|
// Hash the signature string
|
||||||
@@ -210,7 +210,7 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to
|
|||||||
// Set the authorization header
|
// Set the authorization header
|
||||||
var authHeader = Object.keys(oauth_parameters).sort().map(function(key){
|
var authHeader = Object.keys(oauth_parameters).sort().map(function(key){
|
||||||
var value = oauth_parameters[key];
|
var value = oauth_parameters[key];
|
||||||
return key+'="'+value+'"';
|
return key + '="' + value + '"';
|
||||||
}).join(", ")
|
}).join(", ")
|
||||||
|
|
||||||
request.headers.Authorization = 'OAuth ' + authHeader;
|
request.headers.Authorization = 'OAuth ' + authHeader;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function request(path, access_token) {
|
|||||||
host: 'api.github.com',
|
host: 'api.github.com',
|
||||||
path: '/' + path,
|
path: '/' + path,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'bearer '+access_token,
|
'Authorization': 'bearer ' + access_token,
|
||||||
'User-Agent': 'parse-server'
|
'User-Agent': 'parse-server'
|
||||||
}
|
}
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ var https = require('https');
|
|||||||
var Parse = require('parse/node').Parse;
|
var Parse = require('parse/node').Parse;
|
||||||
|
|
||||||
function validateIdToken(id, token) {
|
function validateIdToken(id, token) {
|
||||||
return request("tokeninfo?id_token="+token)
|
return request("tokeninfo?id_token=" + token)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && (response.sub == id || response.user_id == id)) {
|
if (response && (response.sub == id || response.user_id == id)) {
|
||||||
return;
|
return;
|
||||||
@@ -15,7 +15,7 @@ function validateIdToken(id, token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validateAuthToken(id, token) {
|
function validateAuthToken(id, token) {
|
||||||
return request("tokeninfo?access_token="+token)
|
return request("tokeninfo?access_token=" + token)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && (response.sub == id || response.user_id == id)) {
|
if (response && (response.sub == id || response.user_id == id)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ var Parse = require('parse/node').Parse;
|
|||||||
|
|
||||||
// Returns a promise that fulfills iff this user id is valid.
|
// Returns a promise that fulfills iff this user id is valid.
|
||||||
function validateAuthData(authData) {
|
function validateAuthData(authData) {
|
||||||
return request("users/self/?access_token="+authData.access_token)
|
return request("users/self/?access_token=" + authData.access_token)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && response.data && response.data.id == authData.id) {
|
if (response && response.data && response.data.id == authData.id) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function request(path, access_token) {
|
|||||||
host: 'api.meetup.com',
|
host: 'api.meetup.com',
|
||||||
path: '/2/' + path,
|
path: '/2/' + path,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'bearer '+access_token
|
'Authorization': 'bearer ' + access_token
|
||||||
}
|
}
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
var data = '';
|
var data = '';
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ function graphRequest(path) {
|
|||||||
data += chunk;
|
data += chunk;
|
||||||
});
|
});
|
||||||
res.on('end', function () {
|
res.on('end', function () {
|
||||||
var starPos=data.indexOf("(");
|
var starPos = data.indexOf("(");
|
||||||
var endPos=data.indexOf(")");
|
var endPos = data.indexOf(")");
|
||||||
if(starPos==-1||endPos==-1){
|
if(starPos == -1 || endPos == -1){
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.');
|
||||||
}
|
}
|
||||||
data=data.substring(starPos+1,endPos-1);
|
data = data.substring(starPos + 1,endPos - 1);
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function request(path, access_token) {
|
|||||||
host: 'api.spotify.com',
|
host: 'api.spotify.com',
|
||||||
path: '/v1/' + path,
|
path: '/v1/' + path,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer '+access_token
|
'Authorization': 'Bearer ' + access_token
|
||||||
}
|
}
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
var data = '';
|
var data = '';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function validateAuthData(authData, options) {
|
|||||||
client.auth_token_secret = authData.auth_token_secret;
|
client.auth_token_secret = authData.auth_token_secret;
|
||||||
|
|
||||||
return client.get("/1.1/account/verify_credentials.json").then((data) => {
|
return client.get("/1.1/account/verify_credentials.json").then((data) => {
|
||||||
if (data && data.id_str == ''+authData.id) {
|
if (data && data.id_str == '' + authData.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ var Parse = require('parse/node').Parse;
|
|||||||
|
|
||||||
// Returns a promise that fulfills iff this user id is valid.
|
// Returns a promise that fulfills iff this user id is valid.
|
||||||
function validateAuthData(authData) {
|
function validateAuthData(authData) {
|
||||||
return graphRequest('auth?access_token=' + authData.access_token +'&openid=' +authData.id).then(function (data) {
|
return graphRequest('auth?access_token=' + authData.access_token + '&openid=' + authData.id).then(function (data) {
|
||||||
if (data.errcode == 0) {
|
if (data.errcode == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSc
|
|||||||
}
|
}
|
||||||
|
|
||||||
const transformInteriorValue = restValue => {
|
const transformInteriorValue = restValue => {
|
||||||
if (restValue !== null && typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$')|| key.includes('.'))) {
|
if (restValue !== null && typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$') || key.includes('.'))) {
|
||||||
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
|
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
|
||||||
}
|
}
|
||||||
// Handle atomic values
|
// Handle atomic values
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const logger = require('../../../logger');
|
|||||||
|
|
||||||
const debug = function(){
|
const debug = function(){
|
||||||
let args = [...arguments];
|
let args = [...arguments];
|
||||||
args = ['PG: '+arguments[0]].concat(args.slice(1, args.length));
|
args = ['PG: ' + arguments[0]].concat(args.slice(1, args.length));
|
||||||
const log = logger.getLogger();
|
const log = logger.getLogger();
|
||||||
log.debug.apply(log, args);
|
log.debug.apply(log, args);
|
||||||
}
|
}
|
||||||
@@ -196,8 +196,8 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
}
|
}
|
||||||
return `'${cmpt}'`;
|
return `'${cmpt}'`;
|
||||||
});
|
});
|
||||||
let name = components.slice(0, components.length-1).join('->');
|
let name = components.slice(0, components.length - 1).join('->');
|
||||||
name+='->>'+components[components.length-1];
|
name += '->>' + components[components.length - 1];
|
||||||
patterns.push(`${name} = '${fieldValue}'`);
|
patterns.push(`${name} = '${fieldValue}'`);
|
||||||
} else if (typeof fieldValue === 'string') {
|
} else if (typeof fieldValue === 'string') {
|
||||||
patterns.push(`$${index}:name = $${index + 1}`);
|
patterns.push(`$${index}:name = $${index + 1}`);
|
||||||
@@ -277,7 +277,7 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
if (baseArray.length > 0) {
|
if (baseArray.length > 0) {
|
||||||
const not = notIn ? ' NOT ' : '';
|
const not = notIn ? ' NOT ' : '';
|
||||||
if (isArrayField) {
|
if (isArrayField) {
|
||||||
patterns.push(`${not} array_contains($${index}:name, $${index+1})`);
|
patterns.push(`${not} array_contains($${index}:name, $${index + 1})`);
|
||||||
values.push(fieldName, JSON.stringify(baseArray));
|
values.push(fieldName, JSON.stringify(baseArray));
|
||||||
index += 2;
|
index += 2;
|
||||||
} else {
|
} else {
|
||||||
@@ -305,9 +305,9 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(fieldValue.$all) && isArrayField) {
|
if (Array.isArray(fieldValue.$all) && isArrayField) {
|
||||||
patterns.push(`array_contains_all($${index}:name, $${index+1}::jsonb)`);
|
patterns.push(`array_contains_all($${index}:name, $${index + 1}::jsonb)`);
|
||||||
values.push(fieldName, JSON.stringify(fieldValue.$all));
|
values.push(fieldName, JSON.stringify(fieldValue.$all));
|
||||||
index+=2;
|
index += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof fieldValue.$exists !== 'undefined') {
|
if (typeof fieldValue.$exists !== 'undefined') {
|
||||||
@@ -323,9 +323,9 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
if (fieldValue.$nearSphere) {
|
if (fieldValue.$nearSphere) {
|
||||||
const point = fieldValue.$nearSphere;
|
const point = fieldValue.$nearSphere;
|
||||||
const distance = fieldValue.$maxDistance;
|
const distance = fieldValue.$maxDistance;
|
||||||
const distanceInKM = distance*6371*1000;
|
const distanceInKM = distance * 6371 * 1000;
|
||||||
patterns.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index+1}, $${index+2})::geometry) <= $${index+3}`);
|
patterns.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) <= $${index + 3}`);
|
||||||
sorts.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index+1}, $${index+2})::geometry) ASC`)
|
sorts.push(`ST_distance_sphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) ASC`)
|
||||||
values.push(fieldName, point.longitude, point.latitude, distanceInKM);
|
values.push(fieldName, point.longitude, point.latitude, distanceInKM);
|
||||||
index += 4;
|
index += 4;
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
const right = box[1].longitude;
|
const right = box[1].longitude;
|
||||||
const top = box[1].latitude;
|
const top = box[1].latitude;
|
||||||
|
|
||||||
patterns.push(`$${index}:name::point <@ $${index+1}::box`);
|
patterns.push(`$${index}:name::point <@ $${index + 1}::box`);
|
||||||
values.push(fieldName, `((${left}, ${bottom}), (${right}, ${top}))`);
|
values.push(fieldName, `((${left}, ${bottom}), (${right}, ${top}))`);
|
||||||
index += 2;
|
index += 2;
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
|
|
||||||
regex = processRegexPattern(regex);
|
regex = processRegexPattern(regex);
|
||||||
|
|
||||||
patterns.push(`$${index}:name ${operator} '$${index+1}:raw'`);
|
patterns.push(`$${index}:name ${operator} '$${index + 1}:raw'`);
|
||||||
values.push(fieldName, regex);
|
values.push(fieldName, regex);
|
||||||
index += 2;
|
index += 2;
|
||||||
}
|
}
|
||||||
@@ -490,11 +490,11 @@ export class PostgresStorageAdapter {
|
|||||||
}
|
}
|
||||||
valuesArray.push(fieldName);
|
valuesArray.push(fieldName);
|
||||||
valuesArray.push(parseTypeToPostgresType(parseType));
|
valuesArray.push(parseTypeToPostgresType(parseType));
|
||||||
patternsArray.push(`$${index}:name $${index+1}:raw`);
|
patternsArray.push(`$${index}:name $${index + 1}:raw`);
|
||||||
if (fieldName === 'objectId') {
|
if (fieldName === 'objectId') {
|
||||||
patternsArray.push(`PRIMARY KEY ($${index}:name)`)
|
patternsArray.push(`PRIMARY KEY ($${index}:name)`)
|
||||||
}
|
}
|
||||||
index = index+2;
|
index = index + 2;
|
||||||
});
|
});
|
||||||
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${patternsArray.join(',')})`;
|
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${patternsArray.join(',')})`;
|
||||||
const values = [className, ...valuesArray];
|
const values = [className, ...valuesArray];
|
||||||
@@ -618,7 +618,7 @@ export class PostgresStorageAdapter {
|
|||||||
|
|
||||||
const values = [className, ...fieldNames];
|
const values = [className, ...fieldNames];
|
||||||
const columns = fieldNames.map((name, idx) => {
|
const columns = fieldNames.map((name, idx) => {
|
||||||
return `$${idx+2}:name`;
|
return `$${idx + 2}:name`;
|
||||||
}).join(',');
|
}).join(',');
|
||||||
|
|
||||||
const doBatch = (t) => {
|
const doBatch = (t) => {
|
||||||
@@ -699,8 +699,8 @@ export class PostgresStorageAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldName === '_account_lockout_expires_at'||
|
if (fieldName === '_account_lockout_expires_at' ||
|
||||||
fieldName === '_perishable_token_expires_at'||
|
fieldName === '_perishable_token_expires_at' ||
|
||||||
fieldName === '_password_changed_at') {
|
fieldName === '_password_changed_at') {
|
||||||
if (object[fieldName]) {
|
if (object[fieldName]) {
|
||||||
valuesArray.push(object[fieldName].iso);
|
valuesArray.push(object[fieldName].iso);
|
||||||
@@ -762,7 +762,7 @@ export class PostgresStorageAdapter {
|
|||||||
const value = geoPoints[key];
|
const value = geoPoints[key];
|
||||||
valuesArray.push(value.longitude, value.latitude);
|
valuesArray.push(value.longitude, value.latitude);
|
||||||
const l = valuesArray.length + columnsArray.length;
|
const l = valuesArray.length + columnsArray.length;
|
||||||
return `POINT($${l}, $${l+1})`;
|
return `POINT($${l}, $${l + 1})`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const columnsPattern = columnsArray.map((col, index) => `$${index + 2}:name`).join(',');
|
const columnsPattern = columnsArray.map((col, index) => `$${index + 2}:name`).join(',');
|
||||||
@@ -848,11 +848,11 @@ export class PostgresStorageAdapter {
|
|||||||
}
|
}
|
||||||
const lastKey = `$${index}:name`;
|
const lastKey = `$${index}:name`;
|
||||||
const fieldNameIndex = index;
|
const fieldNameIndex = index;
|
||||||
index+=1;
|
index += 1;
|
||||||
values.push(fieldName);
|
values.push(fieldName);
|
||||||
const update = Object.keys(fieldValue).reduce((lastKey, key) => {
|
const update = Object.keys(fieldValue).reduce((lastKey, key) => {
|
||||||
const str = generate(lastKey, `$${index}::text`, `$${index+1}::jsonb`)
|
const str = generate(lastKey, `$${index}::text`, `$${index + 1}::jsonb`)
|
||||||
index+=2;
|
index += 2;
|
||||||
let value = fieldValue[key];
|
let value = fieldValue[key];
|
||||||
if (value) {
|
if (value) {
|
||||||
if (value.__op === 'Delete') {
|
if (value.__op === 'Delete') {
|
||||||
@@ -997,7 +997,7 @@ export class PostgresStorageAdapter {
|
|||||||
if (hasLimit) {
|
if (hasLimit) {
|
||||||
values.push(limit);
|
values.push(limit);
|
||||||
}
|
}
|
||||||
const skipPattern = hasSkip ? `OFFSET $${values.length+1}` : '';
|
const skipPattern = hasSkip ? `OFFSET $${values.length + 1}` : '';
|
||||||
if (hasSkip) {
|
if (hasSkip) {
|
||||||
values.push(skip);
|
values.push(skip);
|
||||||
}
|
}
|
||||||
@@ -1024,7 +1024,7 @@ export class PostgresStorageAdapter {
|
|||||||
return key.length > 0;
|
return key.length > 0;
|
||||||
});
|
});
|
||||||
columns = keys.map((key, index) => {
|
columns = keys.map((key, index) => {
|
||||||
return `$${index+values.length+1}:name`;
|
return `$${index + values.length + 1}:name`;
|
||||||
}).join(',');
|
}).join(',');
|
||||||
values = values.concat(keys);
|
values = values.concat(keys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function removeTrailingSlash(str) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
if (str.endsWith("/")) {
|
if (str.endsWith("/")) {
|
||||||
str = str.substr(0, str.length-1);
|
str = str.substr(0, str.length - 1);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ export class Config {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
return new Date(now.getTime() + (this.emailVerifyTokenValidityDuration*1000));
|
return new Date(now.getTime() + (this.emailVerifyTokenValidityDuration * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
generatePasswordResetTokenExpiresAt() {
|
generatePasswordResetTokenExpiresAt() {
|
||||||
@@ -223,7 +223,7 @@ export class Config {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
return new Date(now.getTime() + (this.sessionLength*1000));
|
return new Date(now.getTime() + (this.sessionLength * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
get invalidLinkURL() {
|
get invalidLinkURL() {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class AdaptableController {
|
|||||||
|
|
||||||
validateAdapter(adapter) {
|
validateAdapter(adapter) {
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
throw new Error(this.constructor.name+" requires an adapter");
|
throw new Error(this.constructor.name + " requires an adapter");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type = this.expectedAdapterType();
|
const Type = this.expectedAdapterType();
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ export class LoggerController extends AdaptableController {
|
|||||||
// until (optional) End time for the search. Defaults to current time.
|
// until (optional) End time for the search. Defaults to current time.
|
||||||
// order (optional) Direction of results returned, either “asc” or “desc”. Defaults to “desc”.
|
// order (optional) Direction of results returned, either “asc” or “desc”. Defaults to “desc”.
|
||||||
// size (optional) Number of rows returned by search. Defaults to 10
|
// size (optional) Number of rows returned by search. Defaults to 10
|
||||||
getLogs(options= {}) {
|
getLogs(options = {}) {
|
||||||
if (!this.adapter) {
|
if (!this.adapter) {
|
||||||
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
|
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
|
||||||
'Logger adapter is not available');
|
'Logger adapter is not available');
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ export class PushController extends AdaptableController {
|
|||||||
if (installation.deviceType != "ios") {
|
if (installation.deviceType != "ios") {
|
||||||
badge = UNSUPPORTED_BADGE_KEY;
|
badge = UNSUPPORTED_BADGE_KEY;
|
||||||
}
|
}
|
||||||
map[badge+''] = map[badge+''] || [];
|
map[badge + ''] = map[badge + ''] || [];
|
||||||
map[badge+''].push(installation);
|
map[badge + ''].push(installation);
|
||||||
return map;
|
return map;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ export default class SchemaCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
put(key, value) {
|
put(key, value) {
|
||||||
return this.cache.get(this.prefix+ALL_KEYS).then((allKeys) => {
|
return this.cache.get(this.prefix + ALL_KEYS).then((allKeys) => {
|
||||||
allKeys = allKeys || {};
|
allKeys = allKeys || {};
|
||||||
allKeys[key] = true;
|
allKeys[key] = true;
|
||||||
return Promise.all([this.cache.put(this.prefix+ALL_KEYS, allKeys, this.ttl), this.cache.put(key, value, this.ttl)]);
|
return Promise.all([this.cache.put(this.prefix + ALL_KEYS, allKeys, this.ttl), this.cache.put(key, value, this.ttl)]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,32 +32,32 @@ export default class SchemaCache {
|
|||||||
if (!this.ttl) {
|
if (!this.ttl) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
return this.cache.get(this.prefix+MAIN_SCHEMA);
|
return this.cache.get(this.prefix + MAIN_SCHEMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAllClasses(schema) {
|
setAllClasses(schema) {
|
||||||
if (!this.ttl) {
|
if (!this.ttl) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
return this.put(this.prefix+MAIN_SCHEMA, schema);
|
return this.put(this.prefix + MAIN_SCHEMA, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
setOneSchema(className, schema) {
|
setOneSchema(className, schema) {
|
||||||
if (!this.ttl) {
|
if (!this.ttl) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
return this.put(this.prefix+className, schema);
|
return this.put(this.prefix + className, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOneSchema(className) {
|
getOneSchema(className) {
|
||||||
if (!this.ttl) {
|
if (!this.ttl) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
return this.cache.get(this.prefix+className).then((schema) => {
|
return this.cache.get(this.prefix + className).then((schema) => {
|
||||||
if (schema) {
|
if (schema) {
|
||||||
return Promise.resolve(schema);
|
return Promise.resolve(schema);
|
||||||
}
|
}
|
||||||
return this.cache.get(this.prefix+MAIN_SCHEMA).then((cachedSchemas) => {
|
return this.cache.get(this.prefix + MAIN_SCHEMA).then((cachedSchemas) => {
|
||||||
cachedSchemas = cachedSchemas || [];
|
cachedSchemas = cachedSchemas || [];
|
||||||
schema = cachedSchemas.find((cachedSchema) => {
|
schema = cachedSchemas.find((cachedSchema) => {
|
||||||
return cachedSchema.className === className;
|
return cachedSchema.className === className;
|
||||||
@@ -72,7 +72,7 @@ export default class SchemaCache {
|
|||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
// That clears all caches...
|
// That clears all caches...
|
||||||
return this.cache.get(this.prefix+ALL_KEYS).then((allKeys) => {
|
return this.cache.get(this.prefix + ALL_KEYS).then((allKeys) => {
|
||||||
if (!allKeys) {
|
if (!allKeys) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ export default class SchemaController {
|
|||||||
if (missingColumns.length > 0) {
|
if (missingColumns.length > 0) {
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
Parse.Error.INCORRECT_TYPE,
|
Parse.Error.INCORRECT_TYPE,
|
||||||
missingColumns[0]+' is required.');
|
missingColumns[0] + ' is required.');
|
||||||
}
|
}
|
||||||
return Promise.resolve(this);
|
return Promise.resolve(this);
|
||||||
}
|
}
|
||||||
@@ -947,7 +947,7 @@ function getObjectType(obj) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid " + obj.__type);
|
||||||
}
|
}
|
||||||
if (obj['$ne']) {
|
if (obj['$ne']) {
|
||||||
return getObjectType(obj['$ne']);
|
return getObjectType(obj['$ne']);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import logger from '../logger';
|
|||||||
class SessionTokenCache {
|
class SessionTokenCache {
|
||||||
cache: Object;
|
cache: Object;
|
||||||
|
|
||||||
constructor(timeout: number = 30 * 24 * 60 *60 * 1000, maxSize: number = 10000) {
|
constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) {
|
||||||
this.cache = new LRU({
|
this.cache = new LRU({
|
||||||
max: maxSize,
|
max: maxSize,
|
||||||
maxAge: timeout
|
maxAge: timeout
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ function makeExpressHandler(appId, promiseHandler) {
|
|||||||
// Override the default expressjs response
|
// Override the default expressjs response
|
||||||
// as it double encodes %encoded chars in URL
|
// as it double encodes %encoded chars in URL
|
||||||
if (!result.response) {
|
if (!result.response) {
|
||||||
res.send('Found. Redirecting to '+result.location);
|
res.send('Found. Redirecting to ' + result.location);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function RestQuery(config, auth, className, restWhere = {}, restOptions = {}, cl
|
|||||||
// reduce to create all paths
|
// reduce to create all paths
|
||||||
// ([a,b,c] -> {a: true, 'a.b': true, 'a.b.c': true})
|
// ([a,b,c] -> {a: true, 'a.b': true, 'a.b.c': true})
|
||||||
return path.split('.').reduce((memo, path, index, parts) => {
|
return path.split('.').reduce((memo, path, index, parts) => {
|
||||||
memo[parts.slice(0, index+1).join('.')] = true;
|
memo[parts.slice(0, index + 1).join('.')] = true;
|
||||||
return memo;
|
return memo;
|
||||||
}, memo);
|
}, memo);
|
||||||
}, {});
|
}, {});
|
||||||
@@ -552,8 +552,8 @@ function includePath(config, auth, response, path, restOptions = {}) {
|
|||||||
const keys = new Set(restOptions.keys.split(','));
|
const keys = new Set(restOptions.keys.split(','));
|
||||||
const keySet = Array.from(keys).reduce((set, key) => {
|
const keySet = Array.from(keys).reduce((set, key) => {
|
||||||
const keyPath = key.split('.');
|
const keyPath = key.split('.');
|
||||||
let i=0;
|
let i = 0;
|
||||||
for (i; i<path.length; i++) {
|
for (i; i < path.length; i++) {
|
||||||
if (path[i] != keyPath[i]) {
|
if (path[i] != keyPath[i]) {
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function handleFileStream(stream, req, res, contentType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!partialend) {
|
if (!partialend) {
|
||||||
if (((stream.length-1) - start) < (buffer_size)) {
|
if (((stream.length - 1) - start) < (buffer_size)) {
|
||||||
end = stream.length - 1;
|
end = stream.length - 1;
|
||||||
}else{
|
}else{
|
||||||
end = start + (buffer_size);
|
end = start + (buffer_size);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function parseURL(URL) {
|
|||||||
|
|
||||||
function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
|
function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
|
||||||
serverURL = serverURL ? parseURL(serverURL) : undefined;
|
serverURL = serverURL ? parseURL(serverURL) : undefined;
|
||||||
publicServerURL = publicServerURL ? parseURL(publicServerURL): undefined;
|
publicServerURL = publicServerURL ? parseURL(publicServerURL) : undefined;
|
||||||
|
|
||||||
const apiPrefixLength = originalUrl.length - batchPath.length;
|
const apiPrefixLength = originalUrl.length - batchPath.length;
|
||||||
let apiPrefix = originalUrl.slice(0, apiPrefixLength);
|
let apiPrefix = originalUrl.slice(0, apiPrefixLength);
|
||||||
|
|||||||
@@ -122,14 +122,14 @@ runner({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
startServer(options, () => {
|
startServer(options, () => {
|
||||||
console.log('['+process.pid+'] parse-server running on '+options.serverURL);
|
console.log('[' + process.pid + '] parse-server running on ' + options.serverURL);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startServer(options, () => {
|
startServer(options, () => {
|
||||||
logOptions();
|
logOptions();
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('['+process.pid+'] parse-server running on '+options.serverURL);
|
console.log('[' + process.pid + '] parse-server running on ' + options.serverURL);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function randomHexString(size: number): string {
|
|||||||
if (size % 2 !== 0) {
|
if (size % 2 !== 0) {
|
||||||
throw new Error('randomHexString size must be divisible by 2.')
|
throw new Error('randomHexString size must be divisible by 2.')
|
||||||
}
|
}
|
||||||
return randomBytes(size/2).toString('hex');
|
return randomBytes(size / 2).toString('hex');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a new random alphanumeric string of the given size.
|
// Returns a new random alphanumeric string of the given size.
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ export function maybeRunAfterFindTrigger(triggerType, auth, className, objects,
|
|||||||
logTriggerSuccessBeforeHook(triggerType, className, 'AfterFind', JSON.stringify(objects), auth);
|
logTriggerSuccessBeforeHook(triggerType, className, 'AfterFind', JSON.stringify(objects), auth);
|
||||||
request.objects = objects.map(object => {
|
request.objects = objects.map(object => {
|
||||||
//setting the class name to transform into parse object
|
//setting the class name to transform into parse object
|
||||||
object.className=className;
|
object.className = className;
|
||||||
return Parse.Object.fromJSON(object);
|
return Parse.Object.fromJSON(object);
|
||||||
});
|
});
|
||||||
const triggerPromise = trigger(request, response);
|
const triggerPromise = trigger(request, response);
|
||||||
|
|||||||
Reference in New Issue
Block a user