static getJobsData(req) { const config = req.config; const jobs = triggers.getJobs(config.applicationId) || {}; return _rest.default.find(req.config, req.auth, '_JobSchedule', {}, {}).then(scheduledJobs => { return { response: { in_use: scheduledJobs.results.map(job => job.jobName), jobs: Object.keys(jobs) } }; }); }
getFileLocation(config, filename) { return ( config.mount + '/files/' + config.applicationId + '/' + encodeURIComponent(filename) ); }
function runLiveQueryEventHandlers(data, applicationId = _node.default.applicationId) { if (!_triggerStore || !_triggerStore[applicationId] || !_triggerStore[applicationId].LiveQuery) { return; } _triggerStore[applicationId].LiveQuery.forEach(handler => handler(data)); }
beforeEach(async () => { Config.get(Parse.applicationId).database.schemaCache.clear(); user1 = await Parse.User.signUp('user1', 'password'); user2 = await Parse.User.signUp('user2', 'password'); await Parse.User.logOut(); });
// deletes all collections and drops the app from cache function dropApp(req, res) { if (!req.auth.isMaster) { return res.status(401).send({ error: 'unauthorized' }); } return req.config.database.deleteEverything().then(() => { AppCache.del(req.config.applicationId); res.status(200).send({}); }); }
function checkTriggers(className, config, types) { return types.some(triggerType => { return triggers.getTrigger(className, triggers.Types[triggerType], config.applicationId); }); }
it('should use default configuration when none is set', async () => { await setup({}); expect(Config.get(Parse.applicationId).idempotencyOptions.ttl).toBe(Definitions.IdempotencyOptions.ttl.default); expect(Config.get(Parse.applicationId).idempotencyOptions.paths).toBe(Definitions.IdempotencyOptions.paths.default); });
beforeEach(() => { RESTController = ParseServerRESTController( Parse.applicationId, ParseServer.promiseRouter({ appId: Parse.applicationId }) ); });
async function maybeRunConnectTrigger(triggerType, request) { const trigger = getTrigger(ConnectClassName, triggerType, _node.default.applicationId); if (!trigger) { return; } request.user = await userForSessionToken(request.sessionToken); return trigger(request); }
function validateJobSchedule(config, job_schedule) { const jobs = triggers.getJobs(config.applicationId) || {}; if (job_schedule.jobName && !jobs[job_schedule.jobName]) { throw new _node.default.Error(_node.default.Error.INTERNAL_SERVER_ERROR, 'Cannot Schedule a job that is not deployed'); } }
async function setup(options) { await reconfigureServer({ appId: Parse.applicationId, masterKey: Parse.masterKey, serverURL: Parse.serverURL, idempotencyOptions: options, }); }
function addLiveQueryEventHandler(handler, applicationId) { applicationId = applicationId || _node.default.applicationId; _triggerStore[applicationId] = _triggerStore[applicationId] || baseStore(); _triggerStore[applicationId].LiveQuery.push(handler); }
async function updateCLP(clp) { const config = Config.get(Parse.applicationId); const schemaController = await config.database.loadSchema(); await schemaController.updateClass(className, {}, clp); }
function createUser() { const config = Config.get(Parse.applicationId); const user = { objectId: '1234567890', username: 'hello', password: 'pass', _session_token: sessionToken, }; return config.database.create('_User', user); }
getFileLocation(config, filename) { return ( config.mount + '/files/' + config.applicationId + '/' + encodeURIComponent(filename) ); }