Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
// These tests check the "create" / "update" functionality of the REST API.
const auth = require('../lib/Auth');
const Config = require('../lib/Config');
const Parse = require('parse/node').Parse;
const rest = require('../lib/rest');
const RestWrite = require('../lib/RestWrite');
const request = require('../lib/request');
let config;
let database;
describe('rest create', () => {
beforeEach(() => {
config = Config.get('test');
database = config.database;
});
it('handles _id', done => {
rest
.create(config, auth.nobody(config), 'Foo', {})
// PARSE_APP.s3Bucket,
// {
// region: process.env.S3_REGION,
// directAccess: process.env.S3_DIRECT_ACCESS
// }
// )
});
// Serve the Parse API on the /parse URL prefix
var mountPath = PARSE_APP.mountPath || '/parse';
app.use(mountPath, api);
// cron jobs for production
if (process.env.NODE_ENV == "production") {
// Parse for node client
var Parse = require('parse/node').Parse;
Parse.initialize(PARSE_APP.appId || 'myAppId', null, PARSE_APP.masterKey || '');
Parse.serverURL = PARSE_APP.localServerURL || PARSE_APP.serverURL || 'http://localhost:1337/parse';
// [ CronJob ]
// Seconds: 0-59
// Minutes: 0-59
// Hours: 0-23
// Day of Month: 1-31
// Months: 0-11
// Day of Week: 0-6
// cronjob set
var CloudCode = require('./src/CloudCode');
var crond = new CloudCode(Parse, 'Asia/Seoul');
// backgroundJob
//
// Each individual Schema object should be immutable. The helpers to
// do things with the Schema just return a new schema when the schema
// is changed.
//
// The canonical place to store this Schema is in the database itself,
// in a _SCHEMA collection. This is not the right way to do it for an
// open source framework, but it's backward compatible, so we're
// keeping it this way for now.
//
// In API-handling code, you should only use the Schema class via the
// DatabaseController. This will let us replace the schema logic for
// different databases.
// TODO: hide all schema logic inside the database adapter.
// @flow-disable-next
const Parse = require('parse/node').Parse;
import { StorageAdapter } from '../Adapters/Storage/StorageAdapter';
import DatabaseController from './DatabaseController';
import Config from '../Config';
// @flow-disable-next
import deepcopy from 'deepcopy';
import type {
Schema,
SchemaFields,
ClassLevelPermissions,
SchemaField,
LoadSchemaOptions,
} from './types';
const defaultColumns: { [string]: SchemaFields } = Object.freeze({
// Contain the default columns for every parse object type (except _Join collection)
_Default: {
"use strict";
// ParsePushAdapter is the default implementation of
// PushAdapter, it uses GCM for android push and APNS
// for ios push.
import { classifyInstallations } from './PushAdapterUtils';
const Parse = require('parse/node').Parse;
var deepcopy = require('deepcopy');
import PushAdapter from './PushAdapter';
export class OneSignalPushAdapter extends PushAdapter {
constructor(pushConfig = {}) {
super(pushConfig);
this.https = require('https');
this.validPushTypes = ['ios', 'android'];
this.senderMap = {};
this.OneSignalConfig = {};
const { oneSignalAppId, oneSignalApiKey } = pushConfig;
if (!oneSignalAppId || !oneSignalApiKey) {
throw "Trying to initialize OneSignalPushAdapter without oneSignalAppId or oneSignalApiKey";
}
// Helper functions for accessing the WeChat Graph API.
const httpsRequest = require('./httpsRequest');
var Parse = require('parse/node').Parse;
// Returns a promise that fulfills iff this user id is valid.
function validateAuthData(authData) {
return graphRequest(
'auth?access_token=' + authData.access_token + '&openid=' + authData.id
).then(function(data) {
if (data.errcode == 0) {
return;
}
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
'wechat auth is invalid for this user.'
);
});
}
'use strict';
// Helper functions for accessing the vkontakte API.
const httpsRequest = require('./httpsRequest');
var Parse = require('parse/node').Parse;
// Returns a promise that fulfills iff this user id is valid.
function validateAuthData(authData, params) {
return vkOAuth2Request(params).then(function(response) {
if (response && response.access_token) {
return request(
'api.vk.com',
'method/users.get?access_token=' + authData.access_token + '&v=5.8'
).then(function(response) {
if (
response &&
response.response &&
response.response.length &&
response.response[0].id == authData.id
) {
return;
"use strict";
const Parse = require('parse/node').Parse;
const gcm = require('node-gcm');
const cryptoUtils = require('./cryptoUtils');
const GCMTimeToLiveMax = 4 * 7 * 24 * 60 * 60; // GCM allows a max of 4 weeks
const GCMRegistrationTokensMax = 1000;
function GCM(args) {
if (typeof args !== 'object' || !args.apiKey) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'GCM Configuration is invalid');
}
this.sender = new gcm.Sender(args.apiKey);
}
/**
* Send gcm request.
// analytics.js
var Parse = require('parse/node').Parse,
PromiseRouter = require('./PromiseRouter'),
rest = require('./rest');
var router = new PromiseRouter();
// Returns a promise that resolves to an empty object response
function ignoreAndSucceed(req) {
return Promise.resolve({
response: {}
});
}
router.route('POST','/events/AppOpened', ignoreAndSucceed);
router.route('POST','/events/:eventName', ignoreAndSucceed);
const Parse = require('parse/node').Parse;
import { CountResult, PojoResult } from './entity';
function initParse() {
Parse.initialize(process.env.PARSE_ID, process.env.PARSE_TOKEN, process.env.PARSE_MASTER_KEY);
(Parse as any).serverURL = process.env.PARSE_URL;
}
async function updateCount(users: number, registries: number, models: number) {
const Meta = Parse.Object.extend('Meta');
const meta = new Meta();
meta.set('user', users);
meta.set('registry', registries);
meta.set('model', models);
const results: any[] = await meta.save();
return results;
const Parse = require('parse/node').Parse;
const PostgresStorageAdapter = require('../lib/Adapters/Storage/Postgres/PostgresStorageAdapter')
.default;
const postgresURI =
'postgres://localhost:5432/parse_server_postgres_adapter_test_database';
const ParseServer = require('../lib/index');
const express = require('express');
//public schema
const databaseOptions1 = {
initOptions: {
schema: 'public',
},
};
//not exists schema
const databaseOptions2 = {
initOptions: {