Add no trailing whitespace and force eol at end of file. (#3154)
This commit is contained in:
committed by
Florent Vilmart
parent
7292fa7f11
commit
11f7712651
@@ -84,8 +84,8 @@ export class AccountLockout {
|
||||
}
|
||||
|
||||
/**
|
||||
* if the failed login count is greater than the threshold
|
||||
* then sets lockout expiration to 'currenttime + accountPolicy.duration', i.e., account is locked out for the next 'accountPolicy.duration' minutes
|
||||
* if the failed login count is greater than the threshold
|
||||
* then sets lockout expiration to 'currenttime + accountPolicy.duration', i.e., account is locked out for the next 'accountPolicy.duration' minutes
|
||||
* else do nothing
|
||||
*/
|
||||
_setLockoutExpiration() {
|
||||
@@ -147,8 +147,8 @@ export class AccountLockout {
|
||||
* set and/or increment _failed_login_count
|
||||
* if _failed_login_count > threshold
|
||||
* set the _account_lockout_expires_at to current_time + accountPolicy.duration
|
||||
* else
|
||||
* do nothing
|
||||
* else
|
||||
* do nothing
|
||||
*/
|
||||
_handleFailedLoginAttempt() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -175,7 +175,7 @@ export class AccountLockout {
|
||||
if (!this._config.accountLockout) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
this._notLocked()
|
||||
.then(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
export class AnalyticsAdapter {
|
||||
|
||||
|
||||
/*
|
||||
@param parameters: the analytics request body, analytics info will be in the dimensions property
|
||||
@param req: the original http request
|
||||
@@ -8,7 +8,7 @@ export class AnalyticsAdapter {
|
||||
appOpened(parameters, req) {
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@param eventName: the name of the custom eventName
|
||||
@param parameters: the analytics request body, analytics info will be in the dimensions property
|
||||
|
||||
@@ -12,7 +12,7 @@ export class MailAdapter {
|
||||
* - subject: the subject of the email
|
||||
*/
|
||||
sendMail(options) {}
|
||||
|
||||
|
||||
/* You can implement those methods if you want
|
||||
* to provide HTML templates etc...
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ const transformKey = (className, fieldName, schema) => {
|
||||
case 'updatedAt': return '_updated_at';
|
||||
case 'sessionToken': return '_session_token';
|
||||
}
|
||||
|
||||
|
||||
if (schema.fields[fieldName] && schema.fields[fieldName].__type == 'Pointer') {
|
||||
fieldName = '_p_' + fieldName;
|
||||
} else if (schema.fields[fieldName] && schema.fields[fieldName].type == 'Pointer') {
|
||||
@@ -911,7 +911,7 @@ var BytesCoder = {
|
||||
};
|
||||
},
|
||||
|
||||
isValidDatabaseObject(object) {
|
||||
isValidDatabaseObject(object) {
|
||||
return (object instanceof mongodb.Binary) || this.isBase64Value(object);
|
||||
},
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ const handleDotFields = (object) => {
|
||||
value = undefined;
|
||||
}
|
||||
/* eslint-disable no-cond-assign */
|
||||
while(next = components.shift()) {
|
||||
while(next = components.shift()) {
|
||||
/* eslint-enable no-cond-assign */
|
||||
currentObj[next] = currentObj[next] || {};
|
||||
if (components.length === 0) {
|
||||
@@ -149,7 +149,7 @@ const validateKeys = (object) => {
|
||||
|
||||
if(key.includes('$') || key.includes('.')){
|
||||
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ const joinTablesForSchema = (schema) => {
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
const buildWhereClause = ({ schema, query, index }) => {
|
||||
let patterns = [];
|
||||
@@ -174,8 +174,8 @@ const buildWhereClause = ({ schema, query, index }) => {
|
||||
|
||||
schema = toPostgresSchema(schema);
|
||||
for (let fieldName in query) {
|
||||
let isArrayField = schema.fields
|
||||
&& schema.fields[fieldName]
|
||||
let isArrayField = schema.fields
|
||||
&& schema.fields[fieldName]
|
||||
&& schema.fields[fieldName].type === 'Array';
|
||||
let initialPatternsLength = patterns.length;
|
||||
let fieldValue = query[fieldName];
|
||||
@@ -186,14 +186,14 @@ const buildWhereClause = ({ schema, query, index }) => {
|
||||
if (fieldValue.$exists === false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldName.indexOf('.') >= 0) {
|
||||
let components = fieldName.split('.').map((cmpt, index) => {
|
||||
if (index === 0) {
|
||||
return `"${cmpt}"`;
|
||||
}
|
||||
return `'${cmpt}'`;
|
||||
return `'${cmpt}'`;
|
||||
});
|
||||
let name = components.slice(0, components.length-1).join('->');
|
||||
name+='->>'+components[components.length-1];
|
||||
@@ -252,7 +252,7 @@ const buildWhereClause = ({ schema, query, index }) => {
|
||||
const isInOrNin = Array.isArray(fieldValue.$in) || Array.isArray(fieldValue.$nin);
|
||||
if (Array.isArray(fieldValue.$in) &&
|
||||
isArrayField &&
|
||||
schema.fields[fieldName].contents &&
|
||||
schema.fields[fieldName].contents &&
|
||||
schema.fields[fieldName].contents.type === 'String') {
|
||||
let inPatterns = [];
|
||||
let allowNull = false;
|
||||
@@ -439,7 +439,7 @@ export class PostgresStorageAdapter {
|
||||
return this._client.tx(t => {
|
||||
const q1 = this.createTable(className, schema, t);
|
||||
const q2 = t.none('INSERT INTO "_SCHEMA" ("className", "schema", "isParseClass") VALUES ($<className>, $<schema>, true)', { className, schema });
|
||||
|
||||
|
||||
return t.batch([q1, q2]);
|
||||
})
|
||||
.then(() => {
|
||||
@@ -680,7 +680,7 @@ export class PostgresStorageAdapter {
|
||||
delete object[fieldName];
|
||||
fieldName = 'authData';
|
||||
}
|
||||
|
||||
|
||||
columnsArray.push(fieldName);
|
||||
if (!schema.fields[fieldName] && className === '_User') {
|
||||
if (fieldName === '_email_verify_token' ||
|
||||
@@ -726,7 +726,7 @@ export class PostgresStorageAdapter {
|
||||
} else {
|
||||
valuesArray.push(JSON.stringify(object[fieldName]));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'Object':
|
||||
case 'String':
|
||||
case 'Number':
|
||||
@@ -843,7 +843,7 @@ export class PostgresStorageAdapter {
|
||||
// This recursively sets the json_object
|
||||
// Only 1 level deep
|
||||
let generate = (jsonb, key, value) => {
|
||||
return `json_object_set_key(COALESCE(${jsonb}, '{}'::jsonb), ${key}, ${value})::jsonb`;
|
||||
return `json_object_set_key(COALESCE(${jsonb}, '{}'::jsonb), ${key}, ${value})::jsonb`;
|
||||
}
|
||||
let lastKey = `$${index}:name`;
|
||||
let fieldNameIndex = index;
|
||||
@@ -926,7 +926,7 @@ export class PostgresStorageAdapter {
|
||||
&& schema.fields[fieldName]
|
||||
&& schema.fields[fieldName].type === 'Object') {
|
||||
const keysToDelete = Object.keys(originalUpdate).filter(k => {
|
||||
// choose top level fields that have a delete operation set
|
||||
// choose top level fields that have a delete operation set
|
||||
return originalUpdate[k].__op === 'Delete' && k.split('.').length === 2
|
||||
}).map(k => k.split('.')[1]);
|
||||
|
||||
@@ -990,7 +990,7 @@ export class PostgresStorageAdapter {
|
||||
let values = [className];
|
||||
let where = buildWhereClause({ schema, query, index: 2 })
|
||||
values.push(...where.values);
|
||||
|
||||
|
||||
const wherePattern = where.pattern.length > 0 ? `WHERE ${where.pattern}` : '';
|
||||
const limitPattern = hasLimit ? `LIMIT $${values.length + 1}` : '';
|
||||
if (hasLimit) {
|
||||
|
||||
@@ -903,7 +903,7 @@ DatabaseController.prototype.performInitizalization = function() {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
// Create tables for volatile classes
|
||||
// Create tables for volatile classes
|
||||
let adapterInit = this.adapter.performInitialization({ VolatileClassesSchemas: SchemaController.VolatileClassesSchemas });
|
||||
return Promise.all([usernameUniqueness, emailUniqueness, adapterInit]);
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ class ParseLiveQueryServer {
|
||||
if (classSubscriptions.size === 0) {
|
||||
this.subscriptions.delete(className);
|
||||
}
|
||||
|
||||
|
||||
if (!notifyClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function ParseServerRESTController(applicationId, router) {
|
||||
function handleRequest(method, path, data = {}, options = {}) {
|
||||
// Store the arguments, for later use if internal fails
|
||||
let args = arguments;
|
||||
|
||||
|
||||
let config = new Config(applicationId);
|
||||
let serverURL = URL.parse(config.serverURL);
|
||||
if (path.indexOf(serverURL.path) === 0) {
|
||||
|
||||
@@ -674,7 +674,7 @@ RestWrite.prototype.handleInstallation = function() {
|
||||
}
|
||||
|
||||
// Updating _Installation but not updating anything critical
|
||||
if (this.query && !this.data.deviceToken
|
||||
if (this.query && !this.data.deviceToken
|
||||
&& !installationId && !this.data.deviceType) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,4 +17,4 @@ export class CloudCodeRouter extends PromiseRouter {
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const APP_STORE_ERRORS = {
|
||||
21005: "The receipt server is not currently available.",
|
||||
21006: "This receipt is valid but the subscription has expired.",
|
||||
21007: "This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.",
|
||||
21008: "This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead."
|
||||
21008: "This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead."
|
||||
}
|
||||
|
||||
function appStoreError(status) {
|
||||
@@ -49,7 +49,7 @@ function getFileForProductIdentifier(productIdentifier, req) {
|
||||
// Error not found or too many
|
||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.')
|
||||
}
|
||||
|
||||
|
||||
var download = products[0].download;
|
||||
return Promise.resolve({response: download});
|
||||
});
|
||||
@@ -58,16 +58,16 @@ function getFileForProductIdentifier(productIdentifier, req) {
|
||||
|
||||
|
||||
export class IAPValidationRouter extends PromiseRouter {
|
||||
|
||||
|
||||
handleRequest(req) {
|
||||
let receipt = req.body.receipt;
|
||||
const productIdentifier = req.body.productIdentifier;
|
||||
|
||||
|
||||
if (!receipt || ! productIdentifier) {
|
||||
// TODO: Error, malformed request
|
||||
throw new Parse.Error(Parse.Error.INVALID_JSON, "missing receipt or productIdentifier");
|
||||
}
|
||||
|
||||
|
||||
// Transform the object if there
|
||||
// otherwise assume it's in Base64 already
|
||||
if (typeof receipt == "object") {
|
||||
@@ -75,7 +75,7 @@ export class IAPValidationRouter extends PromiseRouter {
|
||||
receipt = receipt.base64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (process.env.NODE_ENV == "test" && req.body.bypassAppStoreValidation) {
|
||||
return getFileForProductIdentifier(productIdentifier, req);
|
||||
}
|
||||
@@ -87,9 +87,9 @@ export class IAPValidationRouter extends PromiseRouter {
|
||||
function errorCallback(error) {
|
||||
return Promise.resolve({response: appStoreError(error.status) });
|
||||
}
|
||||
|
||||
|
||||
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then( () => {
|
||||
|
||||
|
||||
return successCallback();
|
||||
|
||||
}, (error) => {
|
||||
@@ -100,12 +100,12 @@ export class IAPValidationRouter extends PromiseRouter {
|
||||
return errorCallback(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return errorCallback(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
mountRoutes() {
|
||||
this.route("POST","/validate_purchase", this.handleRequest);
|
||||
}
|
||||
|
||||
@@ -221,4 +221,4 @@ OAuth.signRequest = function(request, oauth_parameters, consumer_secret, auth_to
|
||||
|
||||
}
|
||||
|
||||
module.exports = OAuth;
|
||||
module.exports = OAuth;
|
||||
|
||||
@@ -29,7 +29,7 @@ function validateAuthToken(id, token) {
|
||||
// Returns a promise that fulfills if this user id is valid.
|
||||
function validateAuthData(authData) {
|
||||
if (authData.id_token) {
|
||||
return validateIdToken(authData.id, authData.id_token);
|
||||
return validateIdToken(authData.id, authData.id_token);
|
||||
} else {
|
||||
return validateAuthToken(authData.id, authData.access_token).then(() => {
|
||||
// Validation with auth token worked
|
||||
|
||||
@@ -10,7 +10,7 @@ function validateAuthData(authData, options) {
|
||||
client.host = "api.twitter.com";
|
||||
client.auth_token = authData.auth_token;
|
||||
client.auth_token_secret = authData.auth_token_secret;
|
||||
|
||||
|
||||
return client.get("/1.1/account/verify_credentials.json").then((data) => {
|
||||
if (data && data.id_str == ''+authData.id) {
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ var Parse = require('parse/node').Parse;
|
||||
var logger = require('../logger').default;
|
||||
|
||||
// Returns a promise that fulfills iff this user id is valid.
|
||||
function validateAuthData(authData, params) {
|
||||
function validateAuthData(authData, params) {
|
||||
return vkOAuth2Request(params).then(function (response) {
|
||||
if (response && response && response.access_token) {
|
||||
return request("api.vk.com", "method/secure.checkToken?token=" + authData.access_token + "&client_secret=" + params.appSecret + "&access_token=" + response.access_token).then(function (response) {
|
||||
@@ -59,4 +59,4 @@ function request(host, path) {
|
||||
module.exports = {
|
||||
validateAppId: validateAppId,
|
||||
validateAuthData: validateAuthData
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
|
||||
return path.posix.join('/', requestPath.slice(apiPrefix.length));
|
||||
}
|
||||
|
||||
if (serverURL && publicServerURL
|
||||
if (serverURL && publicServerURL
|
||||
&& (serverURL.path != publicServerURL.path)) {
|
||||
let localPath = serverURL.path;
|
||||
let publicPath = publicServerURL.path;
|
||||
|
||||
@@ -35,4 +35,4 @@ export default function({
|
||||
start(program, options, function() {
|
||||
logStartupOptions(options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class HTTPResponse {
|
||||
} else if (!_text && _data) {
|
||||
_text = JSON.stringify(_data);
|
||||
}
|
||||
return _text;
|
||||
return _text;
|
||||
}
|
||||
|
||||
let getData = () => {
|
||||
|
||||
@@ -144,8 +144,8 @@ export function handleParseHeaders(req, res, next) {
|
||||
|
||||
return Promise.resolve().then(() => {
|
||||
// handle the upgradeToRevocableSession path on it's own
|
||||
if (info.sessionToken &&
|
||||
req.url === '/upgradeToRevocableSession' &&
|
||||
if (info.sessionToken &&
|
||||
req.url === '/upgradeToRevocableSession' &&
|
||||
info.sessionToken.indexOf('r:') != 0) {
|
||||
return auth.getAuthForLegacySessionToken({ config: req.config, installationId: info.installationId, sessionToken: info.sessionToken })
|
||||
} else {
|
||||
|
||||
@@ -90,7 +90,7 @@ function del(config, auth, className, objectId) {
|
||||
objectId: objectId
|
||||
}, options);
|
||||
}).then(() => {
|
||||
return triggers.maybeRunTrigger(triggers.Types.afterDelete, auth, inflatedObject, null, config);
|
||||
return triggers.maybeRunTrigger(triggers.Types.afterDelete, auth, inflatedObject, null, config);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ export function getResponseObject(request, resolve, reject) {
|
||||
success: function(response) {
|
||||
if (request.triggerName === Types.afterFind) {
|
||||
if(!response){
|
||||
response = request.objects;
|
||||
response = request.objects;
|
||||
}
|
||||
response = response.map(object => {
|
||||
return object.toJSON();
|
||||
@@ -255,11 +255,11 @@ export function maybeRunAfterFindTrigger(triggerType, auth, className, objects,
|
||||
if (!trigger) {
|
||||
return resolve();
|
||||
}
|
||||
const request = getRequestObject(triggerType, auth, null, null, config);
|
||||
const request = getRequestObject(triggerType, auth, null, null, config);
|
||||
const response = getResponseObject(request,
|
||||
object => {
|
||||
resolve(object);
|
||||
},
|
||||
},
|
||||
error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user