2018-09-01 13:58:06 -04:00
import { AnalyticsAdapter } from '../Adapters/Analytics/AnalyticsAdapter' ;
import { FilesAdapter } from '../Adapters/Files/FilesAdapter' ;
import { LoggerAdapter } from '../Adapters/Logger/LoggerAdapter' ;
import { StorageAdapter } from '../Adapters/Storage/StorageAdapter' ;
import { CacheAdapter } from '../Adapters/Cache/CacheAdapter' ;
import { MailAdapter } from '../Adapters/Email/MailAdapter' ;
import { PubSubAdapter } from '../Adapters/PubSub/PubSubAdapter' ;
2018-08-10 15:51:31 -04:00
2017-10-23 08:43:05 -04:00
// @flow
2018-09-01 13:58:06 -04:00
type Adapter < T > = string | any | T ;
type NumberOrBoolean = number | boolean ;
2019-05-11 15:25:31 -05:00
type ProtectedFields = any ;
2017-10-23 08:43:05 -04:00
export interface ParseServerOptions {
/ * Y o u r P a r s e A p p l i c a t i o n I D
: ENV : PARSE _SERVER _APPLICATION _ID * /
appId : string ;
/* Your Parse Master Key */
masterKey : string ;
/* URL to your parse server with http:/ / or https : //.
: ENV : PARSE _SERVER _URL * /
serverURL : string ;
2018-09-08 14:12:23 -04:00
/ * R e s t r i c t m a s t e r K e y t o b e u s e d b y o n l y t h e s e i p s , d e f a u l t s t o [ ] ( a l l o w a l l i p s )
: DEFAULT : [ ] * /
masterKeyIps : ? ( string [ ] ) ;
2017-10-23 08:43:05 -04:00
/* Sets the app name */
appName : ? string ;
/* Adapter module for the analytics */
2018-08-10 15:51:31 -04:00
analyticsAdapter : ? Adapter < AnalyticsAdapter > ;
2017-10-23 08:43:05 -04:00
/* Adapter module for the files sub-system */
2018-08-10 15:51:31 -04:00
filesAdapter : ? Adapter < FilesAdapter > ;
2017-10-23 08:43:05 -04:00
/* Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications */
push : ? any ;
2018-09-08 14:12:23 -04:00
/ * C o n f i g u r a t i o n f o r p u s h s c h e d u l i n g , d e f a u l t s t o f a l s e .
: DEFAULT : false * /
scheduledPush : ? boolean ;
2017-10-23 08:43:05 -04:00
/* Adapter module for the logging sub-system */
2018-08-10 15:51:31 -04:00
loggerAdapter : ? Adapter < LoggerAdapter > ;
2017-10-23 08:43:05 -04:00
/ * L o g a s s t r u c t u r e d J S O N o b j e c t s
: ENV : JSON _LOGS * /
jsonLogs : ? boolean ;
/ * F o l d e r f o r t h e l o g s ( d e f a u l t s t o ' . / l o g s ' ) ; s e t t o n u l l t o d i s a b l e f i l e b a s e d l o g g i n g
2018-09-08 14:12:23 -04:00
: ENV : PARSE _SERVER _LOGS _FOLDER
: DEFAULT : . / logs * /
logsFolder : ? string ;
2017-10-23 08:43:05 -04:00
/ * S e t t h e l o g g i n g t o v e r b o s e
: ENV : VERBOSE * /
verbose : ? boolean ;
/* Sets the level for logs */
logLevel : ? string ;
/ * D i s a b l e s c o n s o l e o u t p u t
: ENV : SILENT * /
silent : ? boolean ;
2018-09-08 14:12:23 -04:00
/ * T h e f u l l U R I t o y o u r d a t a b a s e . S u p p o r t e d d a t a b a s e s a r e m o n g o d b o r p o s t g r e s .
: DEFAULT : mongodb : //localhost:27017/parse */
databaseURI : string ;
2017-10-23 08:43:05 -04:00
/* Options to pass to the mongodb client */
databaseOptions : ? any ;
/* Adapter module for the database */
2018-08-10 15:51:31 -04:00
databaseAdapter : ? Adapter < StorageAdapter > ;
2017-10-23 08:43:05 -04:00
/* Full path to your cloud code main.js */
2017-10-23 09:11:08 -04:00
cloud : ? string ;
2018-09-08 14:12:23 -04:00
/ * A c o l l e c t i o n p r e f i x f o r t h e c l a s s e s
: DEFAULT : '' * /
collectionPrefix : ? string ;
2017-10-23 08:43:05 -04:00
/* Key for iOS, MacOS, tvOS clients */
clientKey : ? string ;
/* Key for the Javascript SDK */
javascriptKey : ? string ;
/* Key for Unity and .Net SDK */
dotNetKey : ? string ;
2017-10-25 11:46:40 -04:00
/ * K e y f o r R E S T c a l l s
: ENV : PARSE _SERVER _REST _API _KEY * /
2017-10-23 08:43:05 -04:00
restAPIKey : ? string ;
2017-10-26 15:35:07 -04:00
/* Read-only key, which has the same capabilities as MasterKey without writes */
readOnlyMasterKey : ? string ;
2017-10-23 08:43:05 -04:00
/* Key sent with outgoing webhook calls */
webhookKey : ? string ;
/* Key for your files */
fileKey : ? string ;
2018-07-27 10:04:06 -03:00
/ * E n a b l e ( o r d i s a b l e ) t h e a d d i t i o n o f a u n i q u e h a s h t o t h e f i l e n a m e s
2018-09-08 14:12:23 -04:00
: ENV : PARSE _SERVER _PRESERVE _FILE _NAME
: DEFAULT : false * /
preserveFileName : ? boolean ;
2019-01-28 07:46:36 +00:00
/ * P e r s o n a l l y i d e n t i f i a b l e i n f o r m a t i o n f i e l d s i n t h e u s e r t a b l e t h e s h o u l d b e r e m o v e d f o r n o n - a u t h o r i z e d u s e r s . D e p r e c a t e d @ s e e p r o t e c t e d F i e l d s
2018-09-08 14:12:23 -04:00
: DEFAULT : [ "email" ] * /
userSensitiveFields : ? ( string [ ] ) ;
2019-01-28 07:46:36 +00:00
/ * P r o t e c t e d f i e l d s t h a t s h o u l d b e t r e a t e d w i t h e x t r a s e c u r i t y w h e n f e t c h i n g d e t a i l s .
: DEFAULT : { "_User" : { "*" : [ "email" ] } } * /
2019-05-11 15:25:31 -05:00
protectedFields : ? ProtectedFields ;
2017-10-23 08:43:05 -04:00
/ * E n a b l e ( o r d i s a b l e ) a n o n u s e r s , d e f a u l t s t o t r u e
2018-09-08 14:12:23 -04:00
: ENV : PARSE _SERVER _ENABLE _ANON _USERS
: DEFAULT : true * /
enableAnonymousUsers : ? boolean ;
2017-10-23 08:43:05 -04:00
/ * E n a b l e ( o r d i s a b l e ) c l i e n t c l a s s c r e a t i o n , d e f a u l t s t o t r u e
2018-09-08 14:12:23 -04:00
: ENV : PARSE _SERVER _ALLOW _CLIENT _CLASS _CREATION
: DEFAULT : true * /
allowClientClassCreation : ? boolean ;
2017-10-23 08:43:05 -04:00
/* Configuration for your authentication providers, as stringified JSON. See http:/ / docs . parseplatform . org / parse - server / guide / # oauth - and - 3 rd - party - authentication
: ENV : PARSE _SERVER _AUTH _PROVIDERS * /
auth : ? any ;
2018-09-08 14:12:23 -04:00
/ * M a x f i l e s i z e f o r u p l o a d s , d e f a u l t s t o 2 0 m b
: DEFAULT : 20 mb * /
maxUploadSize : ? string ;
/ * E n a b l e ( o r d i s a b l e ) u s e r e m a i l v a l i d a t i o n , d e f a u l t s t o f a l s e
: DEFAULT : false * /
verifyUserEmails : ? boolean ;
/ * P r e v e n t u s e r f r o m l o g i n i f e m a i l i s n o t v e r i f i e d a n d P A R S E _ S E R V E R _ V E R I F Y _ U S E R _ E M A I L S i s t r u e , d e f a u l t s t o f a l s e
: DEFAULT : false * /
preventLoginWithUnverifiedEmail : ? boolean ;
2018-08-10 15:51:31 -04:00
/* Email verification token validity duration, in seconds */
2017-10-23 08:43:05 -04:00
emailVerifyTokenValidityDuration : ? number ;
/* account lockout policy for failed login attempts */
accountLockout : ? any ;
/* Password policy for enforcing password related rules */
passwordPolicy : ? any ;
/* Adapter module for the cache */
2018-08-10 15:51:31 -04:00
cacheAdapter : ? Adapter < CacheAdapter > ;
/* Adapter module for email sending */
emailAdapter : ? Adapter < MailAdapter > ;
2017-10-23 08:43:05 -04:00
/* Public URL to your parse server with http:/ / or https : //.
: ENV : PARSE _PUBLIC _SERVER _URL * /
publicServerURL : ? string ;
2018-09-08 14:12:23 -04:00
/ * c u s t o m p a g e s f o r p a s s w o r d v a l i d a t i o n a n d r e s e t
: DEFAULT : { } * /
customPages : ? CustomPagesOptions ;
2017-10-23 08:43:05 -04:00
/* parse-server's LiveQuery configuration object */
liveQuery : ? LiveQueryOptions ;
2018-09-08 14:12:23 -04:00
/ * S e s s i o n d u r a t i o n , i n s e c o n d s , d e f a u l t s t o 1 y e a r
: DEFAULT : 31536000 * /
sessionLength : ? number ;
2017-10-23 08:43:05 -04:00
/* Max value for limit option on queries, defaults to unlimited */
maxLimit : ? number ;
2018-09-08 14:12:23 -04:00
/ * S e t s w e t h e r w e s h o u l d e x p i r e t h e i n a c t i v e s e s s i o n s , d e f a u l t s t o t r u e
: DEFAULT : true * /
expireInactiveSessions : ? boolean ;
/ * W h e n a u s e r c h a n g e s t h e i r p a s s w o r d , e i t h e r t h r o u g h t h e r e s e t p a s s w o r d e m a i l o r w h i l e l o g g e d i n , a l l s e s s i o n s a r e r e v o k e d i f t h i s i s t r u e . S e t t o f a l s e i f y o u d o n ' t w a n t t o r e v o k e s e s s i o n s .
: DEFAULT : true * /
revokeSessionOnPasswordReset : ? boolean ;
/ * T h e T T L f o r c a c h i n g t h e s c h e m a f o r o p t i m i z i n g r e a d / w r i t e o p e r a t i o n s . Y o u s h o u l d p u t a l o n g T T L w h e n y o u r D B i s i n p r o d u c t i o n . d e f a u l t t o 5 0 0 0 ; s e t 0 t o d i s a b l e .
: DEFAULT : 5000 * /
schemaCacheTTL : ? number ;
/ * S e t s t h e T T L f o r t h e i n m e m o r y c a c h e ( i n m s ) , d e f a u l t s t o 5 0 0 0 ( 5 s e c o n d s )
: DEFAULT : 5000 * /
cacheTTL : ? number ;
/ * S e t s t h e m a x i m u m s i z e f o r t h e i n m e m o r y c a c h e , d e f a u l t s t o 1 0 0 0 0
: DEFAULT : 10000 * /
cacheMaxSize : ? number ;
2019-05-10 14:34:19 -05:00
/ * R e p l a c e H T T P I n t e r f a c e w h e n u s i n g J S S D K i n c u r r e n t n o d e r u n t i m e , d e f a u l t s t o f a l s e . C a u t i o n , t h i s i s a n e x p e r i m e n t a l f e a t u r e t h a t m a y n o t b e a p p r o p r i a t e f o r p r o d u c t i o n .
: ENV : PARSE _SERVER _ENABLE _EXPERIMENTAL _DIRECT _ACCESS
: DEFAULT : false * /
directAccess : ? boolean ;
2018-09-08 14:12:23 -04:00
/ * U s e a s i n g l e s c h e m a c a c h e s h a r e d a c r o s s r e q u e s t s . R e d u c e s n u m b e r o f q u e r i e s m a d e t o _ S C H E M A , d e f a u l t s t o f a l s e , i . e . u n i q u e s c h e m a c a c h e p e r r e q u e s t .
: DEFAULT : false * /
enableSingleSchemaCache : ? boolean ;
/ * E n a b l e s t h e d e f a u l t e x p r e s s e r r o r h a n d l e r f o r a l l e r r o r s
: DEFAULT : false * /
enableExpressErrorHandler : ? boolean ;
/ * S e t s t h e n u m b e r o f c h a r a c t e r s i n g e n e r a t e d o b j e c t i d ' s , d e f a u l t 1 0
: DEFAULT : 10 * /
objectIdSize : ? number ;
2018-08-10 15:51:31 -04:00
/ * T h e p o r t t o r u n t h e P a r s e S e r v e r , d e f a u l t s t o 1 3 3 7 .
2018-09-08 14:12:23 -04:00
: ENV : PORT
: DEFAULT : 1337 * /
port : ? number ;
/ * T h e h o s t t o s e r v e P a r s e S e r v e r o n , d e f a u l t s t o 0 . 0 . 0 . 0
: DEFAULT : 0.0 . 0.0 * /
host : ? string ;
/ * M o u n t p a t h f o r t h e s e r v e r , d e f a u l t s t o / p a r s e
: DEFAULT : /parse */
mountPath : ? string ;
2017-10-23 08:43:05 -04:00
/* Run with cluster, optionally set the number of processes default to os.cpus().length */
cluster : ? NumberOrBoolean ;
/* middleware for express server, can be string or function */
2018-09-01 13:58:06 -04:00
middleware : ? ( ( ( ) => void ) | string ) ;
2017-10-23 08:43:05 -04:00
/* Starts the liveQuery server */
startLiveQueryServer : ? boolean ;
/* Live query server configuration options (will start the liveQuery server) */
liveQueryServerOptions : ? LiveQueryServerOptions ;
2018-09-01 13:58:06 -04:00
_ _indexBuildCompletionCallbackForTests : ? ( ) => void ;
2017-10-23 08:43:05 -04:00
}
export interface CustomPagesOptions {
/* invalid link page path */
invalidLink : ? string ;
/* verify email success page path */
verifyEmailSuccess : ? string ;
/* choose password page path */
choosePassword : ? string ;
/* password reset success page path */
passwordResetSuccess : ? string ;
}
export interface LiveQueryOptions {
/ * p a r s e - s e r v e r ' s L i v e Q u e r y c l a s s N a m e s
: ENV : PARSE _SERVER _LIVEQUERY _CLASSNAMES * /
2018-09-01 13:58:06 -04:00
classNames : ? ( string [ ] ) ;
2017-10-23 08:43:05 -04:00
/* parse-server's LiveQuery redisURL */
2018-09-01 13:58:06 -04:00
redisURL : ? string ;
2017-10-23 08:43:05 -04:00
/* LiveQuery pubsub adapter */
2018-09-01 13:58:06 -04:00
pubSubAdapter : ? Adapter < PubSubAdapter > ;
2017-10-23 08:43:05 -04:00
}
export interface LiveQueryServerOptions {
/* This string should match the appId in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same appId.*/
2018-09-01 13:58:06 -04:00
appId : ? string ;
2017-10-23 08:43:05 -04:00
/* This string should match the masterKey in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same masterKey.*/
2018-09-01 13:58:06 -04:00
masterKey : ? string ;
2017-10-23 08:43:05 -04:00
/* This string should match the serverURL in use by your Parse Server. If you deploy the LiveQuery server alongside Parse Server, the LiveQuery server will try to use the same serverURL.*/
2018-09-01 13:58:06 -04:00
serverURL : ? string ;
2017-10-23 08:43:05 -04:00
/* A JSON object that serves as a whitelist of keys. It is used for validating clients when they try to connect to the LiveQuery server. Check the following Security section and our protocol specification for details.*/
2018-09-01 13:58:06 -04:00
keyPairs : ? any ;
2018-08-10 15:51:31 -04:00
/* Number of milliseconds between ping/pong frames. The WebSocket server sends ping/pong frames to the clients to keep the WebSocket alive. This value defines the interval of the ping/pong frame from the server to clients, defaults to 10 * 1000 ms (10 s).*/
2018-09-01 13:58:06 -04:00
websocketTimeout : ? number ;
2018-08-10 15:51:31 -04:00
/* Number in milliseconds. When clients provide the sessionToken to the LiveQuery server, the LiveQuery server will try to fetch its ParseUser's objectId from parse server and store it in the cache. The value defines the duration of the cache. Check the following Security section and our protocol specification for details, defaults to 30 * 24 * 60 * 60 * 1000 ms (~30 days).*/
2018-09-01 13:58:06 -04:00
cacheTimeout : ? number ;
2018-08-10 15:51:31 -04:00
/* This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE, defaults to INFO.*/
2018-09-01 13:58:06 -04:00
logLevel : ? string ;
2018-09-08 14:12:23 -04:00
/ * T h e p o r t t o r u n t h e L i v e Q u e r y s e r v e r , d e f a u l t s t o 1 3 3 7 .
: DEFAULT : 1337 * /
port : ? number ;
2017-10-23 08:43:05 -04:00
/* parse-server's LiveQuery redisURL */
2018-09-01 13:58:06 -04:00
redisURL : ? string ;
2017-10-23 08:43:05 -04:00
/* LiveQuery pubsub adapter */
2018-09-01 13:58:06 -04:00
pubSubAdapter : ? Adapter < PubSubAdapter > ;
2017-10-23 08:43:05 -04:00
}