// Returns a promise that fulfills iff this user id is valid. function validateAuthData(authData, options) { return graphRequest('me?fields=id&access_token=' + authData.access_token + getAppSecretPath(authData, options)).then(data => { if (data && data.id == authData.id || process.env.TESTING && authData.id === 'test') { return; } throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is invalid for this user.'); }); }
(() => { let folder = './logs/'; if (typeof process !== 'undefined' && process.env.TESTING === '1') { folder = './test_logs/'; } if (process.env.PARSE_SERVER_LOGS_FOLDER) { folder = (0, _parsers.nullParser)(process.env.PARSE_SERVER_LOGS_FOLDER); } return folder; })()
// Returns a promise that fulfills iff this app id is valid. function validateAppId(appIds, authData, options) { var access_token = authData.access_token; if (process.env.TESTING && access_token === 'test') { return Promise.resolve(); } if (!appIds.length) { throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is not configured.'); } return graphRequest('app?access_token=' + access_token + getAppSecretPath(authData, options)).then(data => { if (data && appIds.indexOf(data.id) != -1) { return; } throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is invalid for this user.'); }); }
/** * Destroys all data in the database * @param {boolean} fast set to true if it's ok to just drop objects and not indexes. */ function destroyAllDataPermanently(fast) { if (!process.env.TESTING) { throw 'Only supported in test environment'; } return Promise.all(Object.keys(_cache.default.cache).map(appId => { const app = _cache.default.get(appId); if (app.databaseController) { return app.databaseController.deleteEverything(fast); } else { return Promise.resolve(); } })); }
export function createClient(uri, databaseOptions) { let dbOptions = {}; databaseOptions = databaseOptions || {}; if (uri) { dbOptions = parser.getDatabaseOptionsFromURI(uri); } for (const key in databaseOptions) { dbOptions[key] = databaseOptions[key]; } const initOptions = dbOptions.initOptions || {}; initOptions.noWarnings = process && process.env.TESTING; const pgp = require('pg-promise')(initOptions); const client = pgp(dbOptions); if (dbOptions.pgOptions) { for (const key in dbOptions.pgOptions) { pgp.pg.defaults[key] = dbOptions.pgOptions[key]; } } return { client, pgp }; }
if (process.env.TESTING == '1' && req.body.bypassAppStoreValidation) { return getFileForProductIdentifier(productIdentifier, req);
!process.env.TESTING && console.warn(`\nDEPRECATED: userSensitiveFields has been replaced by protectedFields allowing the ability to protect fields in all classes with CLP. \n`);
if (!process.env.TESTING) { configureListeners(this);
api.use(middlewares.handleParseErrors); // run the following when not testing if (!process.env.TESTING) { //This causes tests to spew some useless warnings, so disable in test
// Returns a promise that fulfills iff this user id is valid. function validateAuthData(authData, options) { return graphRequest( 'me?fields=id&access_token=' + authData.access_token + getAppSecretPath(authData, options) ).then(data => { if ( (data && data.id == authData.id) || (process.env.TESTING && authData.id === 'test') ) { return; } throw new Parse.Error( Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is invalid for this user.' ); }); }
// Returns a promise that fulfills iff this app id is valid. function validateAppId(appIds, authData, options) { var access_token = authData.access_token; if (process.env.TESTING && access_token === 'test') { return Promise.resolve(); } if (!appIds.length) { throw new Parse.Error( Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is not configured.' ); } return graphRequest( 'app?access_token=' + access_token + getAppSecretPath(authData, options) ).then(data => { if (data && appIds.indexOf(data.id) != -1) { return; } throw new Parse.Error( Parse.Error.OBJECT_NOT_FOUND, 'Facebook auth is invalid for this user.' ); }); }
function createClient(uri, databaseOptions) { let dbOptions = {}; databaseOptions = databaseOptions || {}; if (uri) { dbOptions = parser.getDatabaseOptionsFromURI(uri); } for (const key in databaseOptions) { dbOptions[key] = databaseOptions[key]; } const initOptions = dbOptions.initOptions || {}; initOptions.noWarnings = process && process.env.TESTING; const pgp = require('pg-promise')(initOptions); const client = pgp(dbOptions); if (dbOptions.pgOptions) { for (const key in dbOptions.pgOptions) { pgp.pg.defaults[key] = dbOptions.pgOptions[key]; } } return { client, pgp }; }