Fix invalid JavaScript.
This commit is contained in:
@@ -60,7 +60,7 @@ APNS.prototype.send = function(data, deviceTokens) {
|
|||||||
var generateNotification = function(coreData, expirationTime) {
|
var generateNotification = function(coreData, expirationTime) {
|
||||||
var notification = new apn.notification();
|
var notification = new apn.notification();
|
||||||
var payload = {};
|
var payload = {};
|
||||||
for (key in coreData) {
|
for (var key in coreData) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'alert':
|
case 'alert':
|
||||||
notification.setAlertText(coreData.alert);
|
notification.setAlertText(coreData.alert);
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ var defaultColumns = {
|
|||||||
"GCMSenderId": {type:'String'},
|
"GCMSenderId": {type:'String'},
|
||||||
"timeZone": {type:'String'},
|
"timeZone": {type:'String'},
|
||||||
"localeIdentifier": {type:'String'},
|
"localeIdentifier": {type:'String'},
|
||||||
"badge": {type:'Number'},
|
"badge": {type:'Number'}
|
||||||
},
|
},
|
||||||
// The additional default columns for the _User collection (in addition to DefaultCols)
|
// The additional default columns for the _User collection (in addition to DefaultCols)
|
||||||
_Role: {
|
_Role: {
|
||||||
"name": {type:'String'},
|
"name": {type:'String'},
|
||||||
"users": {type:'Relation',className:'_User'},
|
"users": {type:'Relation',className:'_User'},
|
||||||
"roles": {type:'Relation',className:'_Role'},
|
"roles": {type:'Relation',className:'_Role'}
|
||||||
},
|
},
|
||||||
// The additional default columns for the _User collection (in addition to DefaultCols)
|
// The additional default columns for the _User collection (in addition to DefaultCols)
|
||||||
_Session: {
|
_Session: {
|
||||||
@@ -58,9 +58,9 @@ var defaultColumns = {
|
|||||||
"installationId": {type:'String'},
|
"installationId": {type:'String'},
|
||||||
"sessionToken": {type:'String'},
|
"sessionToken": {type:'String'},
|
||||||
"expiresAt": {type:'Date'},
|
"expiresAt": {type:'Date'},
|
||||||
"createdWith": {type:'Object'},
|
"createdWith": {type:'Object'}
|
||||||
},
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// Valid classes must:
|
// Valid classes must:
|
||||||
// Be one of _User, _Installation, _Role, _Session OR
|
// Be one of _User, _Installation, _Role, _Session OR
|
||||||
@@ -221,7 +221,7 @@ Schema.prototype.addClassIfNotExists = function(className, fields) {
|
|||||||
error: invalidClassNameMessage(className),
|
error: invalidClassNameMessage(className),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (fieldName in fields) {
|
for (var fieldName in fields) {
|
||||||
if (!fieldNameIsValid(fieldName)) {
|
if (!fieldNameIsValid(fieldName)) {
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
code: Parse.Error.INVALID_KEY_NAME,
|
code: Parse.Error.INVALID_KEY_NAME,
|
||||||
@@ -240,18 +240,18 @@ Schema.prototype.addClassIfNotExists = function(className, fields) {
|
|||||||
_id: className,
|
_id: className,
|
||||||
objectId: 'string',
|
objectId: 'string',
|
||||||
updatedAt: 'string',
|
updatedAt: 'string',
|
||||||
createdAt: 'string',
|
createdAt: 'string'
|
||||||
};
|
};
|
||||||
for (fieldName in defaultColumns[className]) {
|
for (var fieldName in defaultColumns[className]) {
|
||||||
validatedField = schemaAPITypeToMongoFieldType(defaultColumns[className][fieldName]);
|
var validatedField = schemaAPITypeToMongoFieldType(defaultColumns[className][fieldName]);
|
||||||
if (validatedField.code) {
|
if (validatedField.code) {
|
||||||
return Promise.reject(validatedField);
|
return Promise.reject(validatedField);
|
||||||
}
|
}
|
||||||
mongoObject[fieldName] = validatedField.result;
|
mongoObject[fieldName] = validatedField.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (fieldName in fields) {
|
for (var fieldName in fields) {
|
||||||
validatedField = schemaAPITypeToMongoFieldType(fields[fieldName]);
|
var validatedField = schemaAPITypeToMongoFieldType(fields[fieldName]);
|
||||||
if (validatedField.code) {
|
if (validatedField.code) {
|
||||||
return Promise.reject(validatedField);
|
return Promise.reject(validatedField);
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,6 @@ Schema.prototype.addClassIfNotExists = function(className, fields) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var geoPoints = Object.keys(mongoObject).filter(key => mongoObject[key] === 'geopoint');
|
var geoPoints = Object.keys(mongoObject).filter(key => mongoObject[key] === 'geopoint');
|
||||||
|
|
||||||
if (geoPoints.length > 1) {
|
if (geoPoints.length > 1) {
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
code: Parse.Error.INCORRECT_TYPE,
|
code: Parse.Error.INCORRECT_TYPE,
|
||||||
@@ -278,7 +277,7 @@ Schema.prototype.addClassIfNotExists = function(className, fields) {
|
|||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Returns a promise that resolves successfully to the new schema
|
// Returns a promise that resolves successfully to the new schema
|
||||||
// object or fails with a reason.
|
// object or fails with a reason.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function handleFind(req) {
|
|||||||
req.params.className, body.where, options)
|
req.params.className, body.where, options)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && response.results) {
|
if (response && response.results) {
|
||||||
for (result of response.results) {
|
for (var result of response.results) {
|
||||||
if (result.sessionToken) {
|
if (result.sessionToken) {
|
||||||
result.sessionToken = req.info.sessionToken || result.sessionToken;
|
result.sessionToken = req.info.sessionToken || result.sessionToken;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ function mongoFieldTypeToSchemaAPIType(type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mongoSchemaAPIResponseFields(schema) {
|
function mongoSchemaAPIResponseFields(schema) {
|
||||||
fieldNames = Object.keys(schema).filter(key => key !== '_id' && key !== '_metadata');
|
var fieldNames = Object.keys(schema).filter(key => key !== '_id' && key !== '_metadata');
|
||||||
response = fieldNames.reduce((obj, fieldName) => {
|
var response = fieldNames.reduce((obj, fieldName) => {
|
||||||
obj[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName])
|
obj[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName])
|
||||||
return obj;
|
return obj;
|
||||||
}, {});
|
}, {});
|
||||||
|
|||||||
Reference in New Issue
Block a user