Adds documentations for adapters and main constructors (#4951)
* wip * Adds documentations for adapters, and constructors * nits * nit
This commit is contained in:
@@ -4,20 +4,20 @@
|
|||||||
"plugins": ["transform-flow-strip-types"]
|
"plugins": ["transform-flow-strip-types"]
|
||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"include": ["./README.md", "./src/cloud-code"],
|
"include": ["./README.md", "./src/cloud-code", "./src/Options/docs.js", "./src/ParseServer.js", "./src/Adapters"],
|
||||||
"excludePattern": "(^|\\/|\\\\)_"
|
"excludePattern": "(^|\\/|\\\\)_"
|
||||||
},
|
},
|
||||||
"templates": {
|
"templates": {
|
||||||
"default": {
|
"default": {
|
||||||
"outputSourceFiles": false
|
"outputSourceFiles": false,
|
||||||
|
"showInheritedInNav": false,
|
||||||
|
"useLongnameInNav": true
|
||||||
},
|
},
|
||||||
"cleverLinks": false,
|
"cleverLinks": true,
|
||||||
"monospaceLinks": false
|
"monospaceLinks": false
|
||||||
},
|
},
|
||||||
"opts": {
|
"opts": {
|
||||||
"recurse": true,
|
"template": "node_modules/@parse/minami",
|
||||||
"template": "node_modules/minami",
|
"recurse": true
|
||||||
"showInheritedInNav": false,
|
|
||||||
"useLongnameInNav": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5603
package-lock.json
generated
5603
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@
|
|||||||
"ws": "6.0.0"
|
"ws": "6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@parse/minami": "^1.0.0",
|
||||||
"babel-cli": "6.26.0",
|
"babel-cli": "6.26.0",
|
||||||
"babel-core": "6.26.0",
|
"babel-core": "6.26.0",
|
||||||
"babel-eslint": "^8.2.2",
|
"babel-eslint": "^8.2.2",
|
||||||
@@ -62,7 +63,6 @@
|
|||||||
"jasmine-spec-reporter": "^4.1.0",
|
"jasmine-spec-reporter": "^4.1.0",
|
||||||
"jsdoc": "^3.5.5",
|
"jsdoc": "^3.5.5",
|
||||||
"jsdoc-babel": "^0.4.0",
|
"jsdoc-babel": "^0.4.0",
|
||||||
"minami": "^1.2.3",
|
|
||||||
"mongodb-runner": "4.0.0",
|
"mongodb-runner": "4.0.0",
|
||||||
"nodemon": "1.18.3",
|
"nodemon": "1.18.3",
|
||||||
"nyc": "^12.0.2",
|
"nyc": "^12.0.2",
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ function parseDefaultValue(elt, value, t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function inject(t, list) {
|
function inject(t, list) {
|
||||||
return list.map((elt) => {
|
let comments = '';
|
||||||
|
const results = list.map((elt) => {
|
||||||
if (!elt.name) {
|
if (!elt.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -186,23 +187,42 @@ function inject(t, list) {
|
|||||||
throw new Error(`Unable to parse value for ${elt.name} `);
|
throw new Error(`Unable to parse value for ${elt.name} `);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let type = elt.type.replace('TypeAnnotation', '');
|
||||||
|
if (type === 'Generic') {
|
||||||
|
type = elt.typeAnnotation.id.name;
|
||||||
|
}
|
||||||
|
if (type === 'Array') {
|
||||||
|
type = `${elt.typeAnnotation.elementType.type.replace('TypeAnnotation', '')}[]`;
|
||||||
|
}
|
||||||
|
if (type === 'NumberOrBoolean') {
|
||||||
|
type = 'Number|Boolean';
|
||||||
|
}
|
||||||
|
if (type === 'Adapter') {
|
||||||
|
const adapterType = elt.typeAnnotation.typeParameters.params[0].id.name;
|
||||||
|
type = `Adapter<${adapterType}>`;
|
||||||
|
}
|
||||||
|
comments += ` * @property {${type}} ${elt.name} ${elt.help}\n`;
|
||||||
const obj = t.objectExpression(props);
|
const obj = t.objectExpression(props);
|
||||||
return t.objectProperty(t.stringLiteral(elt.name), obj);
|
return t.objectProperty(t.stringLiteral(elt.name), obj);
|
||||||
}).filter((elt) => {
|
}).filter((elt) => {
|
||||||
return elt != undefined;
|
return elt != undefined;
|
||||||
});
|
});
|
||||||
|
return { results, comments };
|
||||||
}
|
}
|
||||||
|
|
||||||
const makeRequire = function(variableName, module, t) {
|
const makeRequire = function(variableName, module, t) {
|
||||||
const decl = t.variableDeclarator(t.identifier(variableName), t.callExpression(t.identifier('require'), [t.stringLiteral(module)]));
|
const decl = t.variableDeclarator(t.identifier(variableName), t.callExpression(t.identifier('require'), [t.stringLiteral(module)]));
|
||||||
return t.variableDeclaration('var', [decl])
|
return t.variableDeclaration('var', [decl])
|
||||||
}
|
}
|
||||||
|
let docs = ``;
|
||||||
const plugin = function (babel) {
|
const plugin = function (babel) {
|
||||||
const t = babel.types;
|
const t = babel.types;
|
||||||
const moduleExports = t.memberExpression(t.identifier('module'), t.identifier('exports'));
|
const moduleExports = t.memberExpression(t.identifier('module'), t.identifier('exports'));
|
||||||
return {
|
return {
|
||||||
visitor: {
|
visitor: {
|
||||||
|
ImportDeclaration: function(path) {
|
||||||
|
path.remove();
|
||||||
|
},
|
||||||
Program: function(path) {
|
Program: function(path) {
|
||||||
// Inject the parser's loader
|
// Inject the parser's loader
|
||||||
path.unshiftContainer('body', makeRequire('parsers', './parsers', t));
|
path.unshiftContainer('body', makeRequire('parsers', './parsers', t));
|
||||||
@@ -210,11 +230,12 @@ const plugin = function (babel) {
|
|||||||
ExportDeclaration: function(path) {
|
ExportDeclaration: function(path) {
|
||||||
// Export declaration on an interface
|
// Export declaration on an interface
|
||||||
if (path.node && path.node.declaration && path.node.declaration.type == 'InterfaceDeclaration') {
|
if (path.node && path.node.declaration && path.node.declaration.type == 'InterfaceDeclaration') {
|
||||||
const l = inject(t, doInterface(path.node.declaration));
|
const { results, comments } = inject(t, doInterface(path.node.declaration));
|
||||||
const id = path.node.declaration.id.name;
|
const id = path.node.declaration.id.name;
|
||||||
const exports = t.memberExpression(moduleExports, t.identifier(id));
|
const exports = t.memberExpression(moduleExports, t.identifier(id));
|
||||||
|
docs += `/**\n * @interface ${id}\n${comments} */\n\n`;
|
||||||
path.replaceWith(
|
path.replaceWith(
|
||||||
t.assignmentExpression('=', exports, t.objectExpression(l))
|
t.assignmentExpression('=', exports, t.objectExpression(results))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,5 +250,7 @@ Do not edit manually, but update Options/index.js
|
|||||||
`
|
`
|
||||||
|
|
||||||
const babel = require("babel-core");
|
const babel = require("babel-core");
|
||||||
const res = babel.transformFileSync('./src/Options/index.js', { plugins: [ plugin ], auxiliaryCommentBefore });
|
const res = babel.transformFileSync('./src/Options/index.js', { plugins: [ plugin ], auxiliaryCommentBefore, sourceMaps: false });
|
||||||
require('fs').writeFileSync('./src/Options/Definitions.js', res.code + '\n');
|
require('fs').writeFileSync('./src/Options/Definitions.js', res.code + '\n');
|
||||||
|
require('fs').writeFileSync('./src/Options/docs.js', docs);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export function loadAdapter(adapter, defaultAdapter, options) {
|
/**
|
||||||
|
* @module AdapterLoader
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @static
|
||||||
|
* Attempt to load an adapter or fallback to the default.
|
||||||
|
* @param {Adapter} adapter an adapter
|
||||||
|
* @param {Adapter} defaultAdapter the default adapter to load
|
||||||
|
* @param {any} options options to pass to the contstructor
|
||||||
|
* @returns {Object} the loaded adapter
|
||||||
|
*/
|
||||||
|
export function loadAdapter<T>(adapter, defaultAdapter, options): T {
|
||||||
if (!adapter) {
|
if (!adapter) {
|
||||||
if (!defaultAdapter) {
|
if (!defaultAdapter) {
|
||||||
return options;
|
return options;
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
/*eslint no-unused-vars: "off"*/
|
/*eslint no-unused-vars: "off"*/
|
||||||
|
/**
|
||||||
|
* @module Adapters
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @interface AnalyticsAdapter
|
||||||
|
*/
|
||||||
export class AnalyticsAdapter {
|
export class AnalyticsAdapter {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
@param parameters: the analytics request body, analytics info will be in the dimensions property
|
@param {any} parameters: the analytics request body, analytics info will be in the dimensions property
|
||||||
@param req: the original http request
|
@param {Request} req: the original http request
|
||||||
*/
|
*/
|
||||||
appOpened(parameters, req) {
|
appOpened(parameters, req) {
|
||||||
return Promise.resolve({});
|
return Promise.resolve({});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
@param eventName: the name of the custom eventName
|
@param {String} eventName: the name of the custom eventName
|
||||||
@param parameters: the analytics request body, analytics info will be in the dimensions property
|
@param {any} parameters: the analytics request body, analytics info will be in the dimensions property
|
||||||
@param req: the original http request
|
@param {Request} req: the original http request
|
||||||
*/
|
*/
|
||||||
trackEvent(eventName, parameters, req) {
|
trackEvent(eventName, parameters, req) {
|
||||||
return Promise.resolve({});
|
return Promise.resolve({});
|
||||||
|
|||||||
@@ -1,23 +1,29 @@
|
|||||||
/*eslint no-unused-vars: "off"*/
|
/*eslint no-unused-vars: "off"*/
|
||||||
|
/**
|
||||||
|
* @module Adapters
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @interface CacheAdapter
|
||||||
|
*/
|
||||||
export class CacheAdapter {
|
export class CacheAdapter {
|
||||||
/**
|
/**
|
||||||
* Get a value in the cache
|
* Get a value in the cache
|
||||||
* @param key Cache key to get
|
* @param {String} key Cache key to get
|
||||||
* @return Promise that will eventually resolve to the value in the cache.
|
* @return {Promise} that will eventually resolve to the value in the cache.
|
||||||
*/
|
*/
|
||||||
get(key) {}
|
get(key) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a value in the cache
|
* Set a value in the cache
|
||||||
* @param key Cache key to set
|
* @param {String} key Cache key to set
|
||||||
* @param value Value to set the key
|
* @param {String} value Value to set the key
|
||||||
* @param ttl Optional TTL
|
* @param {String} ttl Optional TTL
|
||||||
*/
|
*/
|
||||||
put(key, value, ttl) {}
|
put(key, value, ttl) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a value from the cache.
|
* Remove a value from the cache.
|
||||||
* @param key Cache key to remove
|
* @param {String} key Cache key to remove
|
||||||
*/
|
*/
|
||||||
del(key) {}
|
del(key) {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
/*eslint no-unused-vars: "off"*/
|
/*eslint no-unused-vars: "off"*/
|
||||||
/*
|
/**
|
||||||
Mail Adapter prototype
|
* @module Adapters
|
||||||
A MailAdapter should implement at least sendMail()
|
*/
|
||||||
|
/**
|
||||||
|
* @interface MailAdapter
|
||||||
|
* Mail Adapter prototype
|
||||||
|
* A MailAdapter should implement at least sendMail()
|
||||||
*/
|
*/
|
||||||
export class MailAdapter {
|
export class MailAdapter {
|
||||||
/*
|
/**
|
||||||
* A method for sending mail
|
* A method for sending mail
|
||||||
* @param options would have the parameters
|
* @param options would have the parameters
|
||||||
* - to: the recipient
|
* - to: the recipient
|
||||||
|
|||||||
@@ -14,10 +14,15 @@
|
|||||||
// database adapter.
|
// database adapter.
|
||||||
|
|
||||||
import type { Config } from '../../Config'
|
import type { Config } from '../../Config'
|
||||||
|
/**
|
||||||
|
* @module Adapters
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @interface FilesAdapter
|
||||||
|
*/
|
||||||
export class FilesAdapter {
|
export class FilesAdapter {
|
||||||
|
|
||||||
/* Responsible for storing the file in order to be retrieved later by its filename
|
/** Responsible for storing the file in order to be retrieved later by its filename
|
||||||
*
|
*
|
||||||
* @param {string} filename - the filename to save
|
* @param {string} filename - the filename to save
|
||||||
* @param {*} data - the buffer of data from the file
|
* @param {*} data - the buffer of data from the file
|
||||||
@@ -28,7 +33,7 @@ export class FilesAdapter {
|
|||||||
*/
|
*/
|
||||||
createFile(filename: string, data, contentType: string): Promise { }
|
createFile(filename: string, data, contentType: string): Promise { }
|
||||||
|
|
||||||
/* Responsible for deleting the specified file
|
/** Responsible for deleting the specified file
|
||||||
*
|
*
|
||||||
* @param {string} filename - the filename to delete
|
* @param {string} filename - the filename to delete
|
||||||
*
|
*
|
||||||
@@ -36,7 +41,7 @@ export class FilesAdapter {
|
|||||||
*/
|
*/
|
||||||
deleteFile(filename: string): Promise { }
|
deleteFile(filename: string): Promise { }
|
||||||
|
|
||||||
/* Responsible for retrieving the data of the specified file
|
/** Responsible for retrieving the data of the specified file
|
||||||
*
|
*
|
||||||
* @param {string} filename - the name of file to retrieve
|
* @param {string} filename - the name of file to retrieve
|
||||||
*
|
*
|
||||||
@@ -44,7 +49,7 @@ export class FilesAdapter {
|
|||||||
*/
|
*/
|
||||||
getFileData(filename: string): Promise<any> { }
|
getFileData(filename: string): Promise<any> { }
|
||||||
|
|
||||||
/* Returns an absolute URL where the file can be accessed
|
/** Returns an absolute URL where the file can be accessed
|
||||||
*
|
*
|
||||||
* @param {Config} config - server configuration
|
* @param {Config} config - server configuration
|
||||||
* @param {string} filename
|
* @param {string} filename
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
/*eslint no-unused-vars: "off"*/
|
/*eslint no-unused-vars: "off"*/
|
||||||
// Logger Adapter
|
/**
|
||||||
//
|
* @module Adapters
|
||||||
// Allows you to change the logger mechanism
|
*/
|
||||||
//
|
/**
|
||||||
// Adapter classes must implement the following functions:
|
* @interface LoggerAdapter
|
||||||
// * log() {}
|
* Logger Adapter
|
||||||
// * query(options, callback) /* optional */
|
* Allows you to change the logger mechanism
|
||||||
// Default is WinstonLoggerAdapter.js
|
* Default is WinstonLoggerAdapter.js
|
||||||
|
*/
|
||||||
export class LoggerAdapter {
|
export class LoggerAdapter {
|
||||||
constructor(options) {}
|
constructor(options) {}
|
||||||
|
/**
|
||||||
|
* log
|
||||||
|
* @param {String} level
|
||||||
|
* @param {String} message
|
||||||
|
* @param {Object} metadata
|
||||||
|
*/
|
||||||
log(level, message, /* meta */) {}
|
log(level, message, /* meta */) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
49
src/Adapters/PubSub/PubSubAdapter.js
Normal file
49
src/Adapters/PubSub/PubSubAdapter.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/*eslint no-unused-vars: "off"*/
|
||||||
|
/**
|
||||||
|
* @module Adapters
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @interface PubSubAdapter
|
||||||
|
*/
|
||||||
|
export class PubSubAdapter {
|
||||||
|
/**
|
||||||
|
* @returns {PubSubAdapter.Publisher}
|
||||||
|
*/
|
||||||
|
static createPublisher() {}
|
||||||
|
/**
|
||||||
|
* @returns {PubSubAdapter.Subscriber}
|
||||||
|
*/
|
||||||
|
static createSubscriber() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface Publisher
|
||||||
|
* @memberof PubSubAdapter
|
||||||
|
*/
|
||||||
|
interface Publisher {
|
||||||
|
/**
|
||||||
|
* @param {String} channel the channel in which to publish
|
||||||
|
* @param {String} message the message to publish
|
||||||
|
*/
|
||||||
|
publish(channel: string, message: string):void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface Subscriber
|
||||||
|
* @memberof PubSubAdapter
|
||||||
|
*/
|
||||||
|
interface Subscriber {
|
||||||
|
/**
|
||||||
|
* called when a new subscription the channel is required
|
||||||
|
* @param {String} channel the channel to subscribe
|
||||||
|
*/
|
||||||
|
subscribe(channel: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called when the subscription from the channel should be stopped
|
||||||
|
* @param {String} channel
|
||||||
|
*/
|
||||||
|
unsubscribe(channel: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PubSubAdapter;
|
||||||
@@ -11,7 +11,19 @@
|
|||||||
// Default is ParsePushAdapter, which uses GCM for
|
// Default is ParsePushAdapter, which uses GCM for
|
||||||
// android push and APNS for ios push.
|
// android push and APNS for ios push.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @module Adapters
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @interface PushAdapter
|
||||||
|
*/
|
||||||
export class PushAdapter {
|
export class PushAdapter {
|
||||||
|
/**
|
||||||
|
* @param {any} body
|
||||||
|
* @param {Parse.Installation[]} installations
|
||||||
|
* @param {any} pushStatus
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
send(body: any, installations: any[], pushStatus: any): ?Promise<*> {}
|
send(body: any, installations: any[], pushStatus: any): ?Promise<*> {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"masterKeyIps": {
|
"masterKeyIps": {
|
||||||
"env": "PARSE_SERVER_MASTER_KEY_IPS",
|
"env": "PARSE_SERVER_MASTER_KEY_IPS",
|
||||||
"help": "Restrict masterKey to be used by only these ips. defaults to [] (allow all ips)",
|
"help": "Restrict masterKey to be used by only these ips, defaults to [] (allow all ips)",
|
||||||
"action": parsers.arrayParser,
|
"action": parsers.arrayParser,
|
||||||
"default": []
|
"default": []
|
||||||
},
|
},
|
||||||
@@ -49,7 +49,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"scheduledPush": {
|
"scheduledPush": {
|
||||||
"env": "PARSE_SERVER_SCHEDULED_PUSH",
|
"env": "PARSE_SERVER_SCHEDULED_PUSH",
|
||||||
"help": "Configuration for push scheduling. Defaults to false.",
|
"help": "Configuration for push scheduling, defaults to false.",
|
||||||
"action": parsers.booleanParser,
|
"action": parsers.booleanParser,
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
@@ -84,7 +84,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"databaseURI": {
|
"databaseURI": {
|
||||||
"env": "PARSE_SERVER_DATABASE_URI",
|
"env": "PARSE_SERVER_DATABASE_URI",
|
||||||
"help": "The full URI to your mongodb database",
|
"help": "The full URI to your database. Supported databases are mongodb or postgres.",
|
||||||
"required": true,
|
"required": true,
|
||||||
"default": "mongodb://localhost:27017/parse"
|
"default": "mongodb://localhost:27017/parse"
|
||||||
},
|
},
|
||||||
@@ -166,7 +166,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"maxUploadSize": {
|
"maxUploadSize": {
|
||||||
"env": "PARSE_SERVER_MAX_UPLOAD_SIZE",
|
"env": "PARSE_SERVER_MAX_UPLOAD_SIZE",
|
||||||
"help": "Max file size for uploads. defaults to 20mb",
|
"help": "Max file size for uploads, defaults to 20mb",
|
||||||
"default": "20mb"
|
"default": "20mb"
|
||||||
},
|
},
|
||||||
"verifyUserEmails": {
|
"verifyUserEmails": {
|
||||||
@@ -183,7 +183,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"emailVerifyTokenValidityDuration": {
|
"emailVerifyTokenValidityDuration": {
|
||||||
"env": "PARSE_SERVER_EMAIL_VERIFY_TOKEN_VALIDITY_DURATION",
|
"env": "PARSE_SERVER_EMAIL_VERIFY_TOKEN_VALIDITY_DURATION",
|
||||||
"help": "Email verification token validity duration",
|
"help": "Email verification token validity duration, in seconds",
|
||||||
"action": parsers.numberParser("emailVerifyTokenValidityDuration")
|
"action": parsers.numberParser("emailVerifyTokenValidityDuration")
|
||||||
},
|
},
|
||||||
"accountLockout": {
|
"accountLockout": {
|
||||||
@@ -203,7 +203,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"emailAdapter": {
|
"emailAdapter": {
|
||||||
"env": "PARSE_SERVER_EMAIL_ADAPTER",
|
"env": "PARSE_SERVER_EMAIL_ADAPTER",
|
||||||
"help": "Adapter module for the email sending",
|
"help": "Adapter module for email sending",
|
||||||
"action": parsers.moduleOrObjectParser
|
"action": parsers.moduleOrObjectParser
|
||||||
},
|
},
|
||||||
"publicServerURL": {
|
"publicServerURL": {
|
||||||
@@ -264,7 +264,7 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"enableSingleSchemaCache": {
|
"enableSingleSchemaCache": {
|
||||||
"env": "PARSE_SERVER_ENABLE_SINGLE_SCHEMA_CACHE",
|
"env": "PARSE_SERVER_ENABLE_SINGLE_SCHEMA_CACHE",
|
||||||
"help": "Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA. Defaults to false, i.e. unique schema cache per request.",
|
"help": "Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA, defaults to false, i.e. unique schema cache per request.",
|
||||||
"action": parsers.booleanParser,
|
"action": parsers.booleanParser,
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
@@ -282,13 +282,13 @@ module.exports.ParseServerOptions = {
|
|||||||
},
|
},
|
||||||
"port": {
|
"port": {
|
||||||
"env": "PORT",
|
"env": "PORT",
|
||||||
"help": "The port to run the ParseServer. defaults to 1337.",
|
"help": "The port to run the ParseServer, defaults to 1337.",
|
||||||
"action": parsers.numberParser("port"),
|
"action": parsers.numberParser("port"),
|
||||||
"default": 1337
|
"default": 1337
|
||||||
},
|
},
|
||||||
"host": {
|
"host": {
|
||||||
"env": "PARSE_SERVER_HOST",
|
"env": "PARSE_SERVER_HOST",
|
||||||
"help": "The host to serve ParseServer on. defaults to 0.0.0.0",
|
"help": "The host to serve ParseServer on, defaults to 0.0.0.0",
|
||||||
"default": "0.0.0.0"
|
"default": "0.0.0.0"
|
||||||
},
|
},
|
||||||
"mountPath": {
|
"mountPath": {
|
||||||
@@ -370,21 +370,21 @@ module.exports.LiveQueryServerOptions = {
|
|||||||
},
|
},
|
||||||
"websocketTimeout": {
|
"websocketTimeout": {
|
||||||
"env": "PARSE_LIVE_QUERY_SERVER_WEBSOCKET_TIMEOUT",
|
"env": "PARSE_LIVE_QUERY_SERVER_WEBSOCKET_TIMEOUT",
|
||||||
"help": "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).",
|
"help": "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).",
|
||||||
"action": parsers.numberParser("websocketTimeout")
|
"action": parsers.numberParser("websocketTimeout")
|
||||||
},
|
},
|
||||||
"cacheTimeout": {
|
"cacheTimeout": {
|
||||||
"env": "PARSE_LIVE_QUERY_SERVER_CACHE_TIMEOUT",
|
"env": "PARSE_LIVE_QUERY_SERVER_CACHE_TIMEOUT",
|
||||||
"help": "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).",
|
"help": "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).",
|
||||||
"action": parsers.numberParser("cacheTimeout")
|
"action": parsers.numberParser("cacheTimeout")
|
||||||
},
|
},
|
||||||
"logLevel": {
|
"logLevel": {
|
||||||
"env": "PARSE_LIVE_QUERY_SERVER_LOG_LEVEL",
|
"env": "PARSE_LIVE_QUERY_SERVER_LOG_LEVEL",
|
||||||
"help": "This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE. Defaults to INFO."
|
"help": "This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE, defaults to INFO."
|
||||||
},
|
},
|
||||||
"port": {
|
"port": {
|
||||||
"env": "PARSE_LIVE_QUERY_SERVER_PORT",
|
"env": "PARSE_LIVE_QUERY_SERVER_PORT",
|
||||||
"help": "The port to run the LiveQuery server. Defaults to 1337.",
|
"help": "The port to run the LiveQuery server, defaults to 1337.",
|
||||||
"action": parsers.numberParser("port"),
|
"action": parsers.numberParser("port"),
|
||||||
"default": 1337
|
"default": 1337
|
||||||
},
|
},
|
||||||
|
|||||||
93
src/Options/docs.js
Normal file
93
src/Options/docs.js
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/**
|
||||||
|
* @interface ParseServerOptions
|
||||||
|
* @property {String} appId Your Parse Application ID
|
||||||
|
* @property {String} masterKey Your Parse Master Key
|
||||||
|
* @property {String} serverURL URL to your parse server with http:// or https://.
|
||||||
|
* @property {String[]} masterKeyIps Restrict masterKey to be used by only these ips, defaults to [] (allow all ips)
|
||||||
|
* @property {String} appName Sets the app name
|
||||||
|
* @property {Adapter<AnalyticsAdapter>} analyticsAdapter Adapter module for the analytics
|
||||||
|
* @property {Adapter<FilesAdapter>} filesAdapter Adapter module for the files sub-system
|
||||||
|
* @property {Any} push Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications
|
||||||
|
* @property {Boolean} scheduledPush Configuration for push scheduling, defaults to false.
|
||||||
|
* @property {Adapter<LoggerAdapter>} loggerAdapter Adapter module for the logging sub-system
|
||||||
|
* @property {Boolean} jsonLogs Log as structured JSON objects
|
||||||
|
* @property {String} logsFolder Folder for the logs (defaults to './logs'); set to null to disable file based logging
|
||||||
|
* @property {Boolean} verbose Set the logging to verbose
|
||||||
|
* @property {String} logLevel Sets the level for logs
|
||||||
|
* @property {Boolean} silent Disables console output
|
||||||
|
* @property {String} databaseURI The full URI to your database. Supported databases are mongodb or postgres.
|
||||||
|
* @property {Any} databaseOptions Options to pass to the mongodb client
|
||||||
|
* @property {Adapter<StorageAdapter>} databaseAdapter Adapter module for the database
|
||||||
|
* @property {String} cloud Full path to your cloud code main.js
|
||||||
|
* @property {String} collectionPrefix A collection prefix for the classes
|
||||||
|
* @property {String} clientKey Key for iOS, MacOS, tvOS clients
|
||||||
|
* @property {String} javascriptKey Key for the Javascript SDK
|
||||||
|
* @property {String} dotNetKey Key for Unity and .Net SDK
|
||||||
|
* @property {String} restAPIKey Key for REST calls
|
||||||
|
* @property {String} readOnlyMasterKey Read-only key, which has the same capabilities as MasterKey without writes
|
||||||
|
* @property {String} webhookKey Key sent with outgoing webhook calls
|
||||||
|
* @property {String} fileKey Key for your files
|
||||||
|
* @property {Boolean} preserveFileName Enable (or disable) the addition of a unique hash to the file names
|
||||||
|
* @property {String[]} userSensitiveFields Personally identifiable information fields in the user table the should be removed for non-authorized users.
|
||||||
|
* @property {Boolean} enableAnonymousUsers Enable (or disable) anon users, defaults to true
|
||||||
|
* @property {Boolean} allowClientClassCreation Enable (or disable) client class creation, defaults to true
|
||||||
|
* @property {Any} auth Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
|
||||||
|
* @property {String} maxUploadSize Max file size for uploads, defaults to 20mb
|
||||||
|
* @property {Boolean} verifyUserEmails Enable (or disable) user email validation, defaults to false
|
||||||
|
* @property {Boolean} preventLoginWithUnverifiedEmail Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false
|
||||||
|
* @property {Number} emailVerifyTokenValidityDuration Email verification token validity duration, in seconds
|
||||||
|
* @property {Any} accountLockout account lockout policy for failed login attempts
|
||||||
|
* @property {Any} passwordPolicy Password policy for enforcing password related rules
|
||||||
|
* @property {Adapter<CacheAdapter>} cacheAdapter Adapter module for the cache
|
||||||
|
* @property {Adapter<MailAdapter>} emailAdapter Adapter module for email sending
|
||||||
|
* @property {String} publicServerURL Public URL to your parse server with http:// or https://.
|
||||||
|
* @property {CustomPagesOptions} customPages custom pages for password validation and reset
|
||||||
|
* @property {LiveQueryOptions} liveQuery parse-server's LiveQuery configuration object
|
||||||
|
* @property {Number} sessionLength Session duration, in seconds, defaults to 1 year
|
||||||
|
* @property {Number} maxLimit Max value for limit option on queries, defaults to unlimited
|
||||||
|
* @property {Boolean} expireInactiveSessions Sets wether we should expire the inactive sessions, defaults to true
|
||||||
|
* @property {Boolean} revokeSessionOnPasswordReset When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.
|
||||||
|
* @property {Number} schemaCacheTTL The TTL for caching the schema for optimizing read/write operations. You should put a long TTL when your DB is in production. default to 5000; set 0 to disable.
|
||||||
|
* @property {Number} cacheTTL Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds)
|
||||||
|
* @property {Number} cacheMaxSize Sets the maximum size for the in memory cache, defaults to 10000
|
||||||
|
* @property {Boolean} enableSingleSchemaCache Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA, defaults to false, i.e. unique schema cache per request.
|
||||||
|
* @property {Boolean} enableExpressErrorHandler Enables the default express error handler for all errors
|
||||||
|
* @property {Number} objectIdSize Sets the number of characters in generated object id's, default 10
|
||||||
|
* @property {Number} port The port to run the ParseServer, defaults to 1337.
|
||||||
|
* @property {String} host The host to serve ParseServer on, defaults to 0.0.0.0
|
||||||
|
* @property {String} mountPath Mount path for the server, defaults to /parse
|
||||||
|
* @property {Number|Boolean} cluster Run with cluster, optionally set the number of processes default to os.cpus().length
|
||||||
|
* @property {Union} middleware middleware for express server, can be string or function
|
||||||
|
* @property {Boolean} startLiveQueryServer Starts the liveQuery server
|
||||||
|
* @property {LiveQueryServerOptions} liveQueryServerOptions Live query server configuration options (will start the liveQuery server)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface CustomPagesOptions
|
||||||
|
* @property {String} invalidLink invalid link page path
|
||||||
|
* @property {String} verifyEmailSuccess verify email success page path
|
||||||
|
* @property {String} choosePassword choose password page path
|
||||||
|
* @property {String} passwordResetSuccess password reset success page path
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface LiveQueryOptions
|
||||||
|
* @property {String[]} classNames parse-server's LiveQuery classNames
|
||||||
|
* @property {String} redisURL parse-server's LiveQuery redisURL
|
||||||
|
* @property {Adapter<PubSubAdapter>} pubSubAdapter LiveQuery pubsub adapter
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface LiveQueryServerOptions
|
||||||
|
* @property {String} appId 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.
|
||||||
|
* @property {String} masterKey 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.
|
||||||
|
* @property {String} serverURL 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.
|
||||||
|
* @property {Any} keyPairs 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.
|
||||||
|
* @property {Number} websocketTimeout 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).
|
||||||
|
* @property {Number} cacheTimeout 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).
|
||||||
|
* @property {String} logLevel This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE, defaults to INFO.
|
||||||
|
* @property {Number} port The port to run the LiveQuery server, defaults to 1337.
|
||||||
|
* @property {String} redisURL parse-server's LiveQuery redisURL
|
||||||
|
* @property {Adapter<PubSubAdapter>} pubSubAdapter LiveQuery pubsub adapter
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
// @flow
|
// @flow
|
||||||
type Adapter = string|any;
|
type Adapter<T> = string|any|T;
|
||||||
type NumberOrBoolean = number|boolean;
|
type NumberOrBoolean = number|boolean;
|
||||||
|
|
||||||
export interface ParseServerOptions {
|
export interface ParseServerOptions {
|
||||||
@@ -11,20 +19,20 @@ export interface ParseServerOptions {
|
|||||||
/* URL to your parse server with http:// or https://.
|
/* URL to your parse server with http:// or https://.
|
||||||
:ENV: PARSE_SERVER_URL */
|
:ENV: PARSE_SERVER_URL */
|
||||||
serverURL: string;
|
serverURL: string;
|
||||||
/* Restrict masterKey to be used by only these ips. defaults to [] (allow all ips) */
|
/* Restrict masterKey to be used by only these ips, defaults to [] (allow all ips) */
|
||||||
masterKeyIps: ?string[]; // = []
|
masterKeyIps: ?string[]; // = []
|
||||||
/* Sets the app name */
|
/* Sets the app name */
|
||||||
appName: ?string;
|
appName: ?string;
|
||||||
/* Adapter module for the analytics */
|
/* Adapter module for the analytics */
|
||||||
analyticsAdapter: ?Adapter;
|
analyticsAdapter: ?Adapter<AnalyticsAdapter>;
|
||||||
/* Adapter module for the files sub-system */
|
/* Adapter module for the files sub-system */
|
||||||
filesAdapter: ?Adapter;
|
filesAdapter: ?Adapter<FilesAdapter>;
|
||||||
/* Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications */
|
/* Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications */
|
||||||
push: ?any;
|
push: ?any;
|
||||||
/* Configuration for push scheduling. Defaults to false. */
|
/* Configuration for push scheduling, defaults to false. */
|
||||||
scheduledPush: ?boolean; // = false
|
scheduledPush: ?boolean; // = false
|
||||||
/* Adapter module for the logging sub-system */
|
/* Adapter module for the logging sub-system */
|
||||||
loggerAdapter: ?Adapter;
|
loggerAdapter: ?Adapter<LoggerAdapter>;
|
||||||
/* Log as structured JSON objects
|
/* Log as structured JSON objects
|
||||||
:ENV: JSON_LOGS */
|
:ENV: JSON_LOGS */
|
||||||
jsonLogs: ?boolean;
|
jsonLogs: ?boolean;
|
||||||
@@ -39,12 +47,12 @@ export interface ParseServerOptions {
|
|||||||
/* Disables console output
|
/* Disables console output
|
||||||
:ENV: SILENT */
|
:ENV: SILENT */
|
||||||
silent: ?boolean;
|
silent: ?boolean;
|
||||||
/* The full URI to your mongodb database */
|
/* The full URI to your database. Supported databases are mongodb or postgres. */
|
||||||
databaseURI: string; // = mongodb://localhost:27017/parse
|
databaseURI: string; // = mongodb://localhost:27017/parse
|
||||||
/* Options to pass to the mongodb client */
|
/* Options to pass to the mongodb client */
|
||||||
databaseOptions: ?any;
|
databaseOptions: ?any;
|
||||||
/* Adapter module for the database */
|
/* Adapter module for the database */
|
||||||
databaseAdapter: ?Adapter;
|
databaseAdapter: ?Adapter<StorageAdapter>;
|
||||||
/* Full path to your cloud code main.js */
|
/* Full path to your cloud code main.js */
|
||||||
cloud: ?string;
|
cloud: ?string;
|
||||||
/* A collection prefix for the classes */
|
/* A collection prefix for the classes */
|
||||||
@@ -78,22 +86,22 @@ export interface ParseServerOptions {
|
|||||||
/* Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
|
/* Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
|
||||||
:ENV: PARSE_SERVER_AUTH_PROVIDERS */
|
:ENV: PARSE_SERVER_AUTH_PROVIDERS */
|
||||||
auth: ?any;
|
auth: ?any;
|
||||||
/* Max file size for uploads. defaults to 20mb */
|
/* Max file size for uploads, defaults to 20mb */
|
||||||
maxUploadSize: ?string; // = 20mb
|
maxUploadSize: ?string; // = 20mb
|
||||||
/* Enable (or disable) user email validation, defaults to false */
|
/* Enable (or disable) user email validation, defaults to false */
|
||||||
verifyUserEmails: ?boolean; // = false
|
verifyUserEmails: ?boolean; // = false
|
||||||
/* Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false */
|
/* Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false */
|
||||||
preventLoginWithUnverifiedEmail: ?boolean; // = false
|
preventLoginWithUnverifiedEmail: ?boolean; // = false
|
||||||
/* Email verification token validity duration */
|
/* Email verification token validity duration, in seconds */
|
||||||
emailVerifyTokenValidityDuration: ?number;
|
emailVerifyTokenValidityDuration: ?number;
|
||||||
/* account lockout policy for failed login attempts */
|
/* account lockout policy for failed login attempts */
|
||||||
accountLockout: ?any;
|
accountLockout: ?any;
|
||||||
/* Password policy for enforcing password related rules */
|
/* Password policy for enforcing password related rules */
|
||||||
passwordPolicy: ?any;
|
passwordPolicy: ?any;
|
||||||
/* Adapter module for the cache */
|
/* Adapter module for the cache */
|
||||||
cacheAdapter: ?Adapter;
|
cacheAdapter: ?Adapter<CacheAdapter>;
|
||||||
/* Adapter module for the email sending */
|
/* Adapter module for email sending */
|
||||||
emailAdapter: ?Adapter;
|
emailAdapter: ?Adapter<MailAdapter>;
|
||||||
/* Public URL to your parse server with http:// or https://.
|
/* Public URL to your parse server with http:// or https://.
|
||||||
:ENV: PARSE_PUBLIC_SERVER_URL */
|
:ENV: PARSE_PUBLIC_SERVER_URL */
|
||||||
publicServerURL: ?string;
|
publicServerURL: ?string;
|
||||||
@@ -115,16 +123,16 @@ export interface ParseServerOptions {
|
|||||||
cacheTTL: ?number; // = 5000
|
cacheTTL: ?number; // = 5000
|
||||||
/* Sets the maximum size for the in memory cache, defaults to 10000 */
|
/* Sets the maximum size for the in memory cache, defaults to 10000 */
|
||||||
cacheMaxSize : ?number; // = 10000
|
cacheMaxSize : ?number; // = 10000
|
||||||
/* Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA. Defaults to false, i.e. unique schema cache per request. */
|
/* Use a single schema cache shared across requests. Reduces number of queries made to _SCHEMA, defaults to false, i.e. unique schema cache per request. */
|
||||||
enableSingleSchemaCache: ?boolean; // = false
|
enableSingleSchemaCache: ?boolean; // = false
|
||||||
/* Enables the default express error handler for all errors */
|
/* Enables the default express error handler for all errors */
|
||||||
enableExpressErrorHandler: ?boolean; // = false
|
enableExpressErrorHandler: ?boolean; // = false
|
||||||
/* Sets the number of characters in generated object id's, default 10 */
|
/* Sets the number of characters in generated object id's, default 10 */
|
||||||
objectIdSize: ?number; // = 10
|
objectIdSize: ?number; // = 10
|
||||||
/* The port to run the ParseServer. defaults to 1337.
|
/* The port to run the ParseServer, defaults to 1337.
|
||||||
:ENV: PORT */
|
:ENV: PORT */
|
||||||
port: ?number; // = 1337
|
port: ?number; // = 1337
|
||||||
/* The host to serve ParseServer on. defaults to 0.0.0.0 */
|
/* The host to serve ParseServer on, defaults to 0.0.0.0 */
|
||||||
host: ?string; // = 0.0.0.0
|
host: ?string; // = 0.0.0.0
|
||||||
/* Mount path for the server, defaults to /parse */
|
/* Mount path for the server, defaults to /parse */
|
||||||
mountPath: ?string; // = /parse
|
mountPath: ?string; // = /parse
|
||||||
@@ -158,7 +166,7 @@ export interface LiveQueryOptions {
|
|||||||
/* parse-server's LiveQuery redisURL */
|
/* parse-server's LiveQuery redisURL */
|
||||||
redisURL: ?string,
|
redisURL: ?string,
|
||||||
/* LiveQuery pubsub adapter */
|
/* LiveQuery pubsub adapter */
|
||||||
pubSubAdapter: ?Adapter,
|
pubSubAdapter: ?Adapter<PubSubAdapter>,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LiveQueryServerOptions {
|
export interface LiveQueryServerOptions {
|
||||||
@@ -170,16 +178,16 @@ export interface LiveQueryServerOptions {
|
|||||||
serverURL: ?string,
|
serverURL: ?string,
|
||||||
/* 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.*/
|
/* 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.*/
|
||||||
keyPairs: ?any,
|
keyPairs: ?any,
|
||||||
/* 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).*/
|
/* 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).*/
|
||||||
websocketTimeout: ?number,
|
websocketTimeout: ?number,
|
||||||
/* 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).*/
|
/* 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).*/
|
||||||
cacheTimeout: ?number,
|
cacheTimeout: ?number,
|
||||||
/* This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE. Defaults to INFO.*/
|
/* This string defines the log level of the LiveQuery server. We support VERBOSE, INFO, ERROR, NONE, defaults to INFO.*/
|
||||||
logLevel: ?string,
|
logLevel: ?string,
|
||||||
/* The port to run the LiveQuery server. Defaults to 1337.*/
|
/* The port to run the LiveQuery server, defaults to 1337.*/
|
||||||
port: ?number, // = 1337
|
port: ?number, // = 1337
|
||||||
/* parse-server's LiveQuery redisURL */
|
/* parse-server's LiveQuery redisURL */
|
||||||
redisURL: ?string,
|
redisURL: ?string,
|
||||||
/* LiveQuery pubsub adapter */
|
/* LiveQuery pubsub adapter */
|
||||||
pubSubAdapter: ?Adapter,
|
pubSubAdapter: ?Adapter<PubSubAdapter>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,10 @@ addParseCloud();
|
|||||||
// "maxLimit": optional upper bound for what can be specified for the 'limit' parameter on queries
|
// "maxLimit": optional upper bound for what can be specified for the 'limit' parameter on queries
|
||||||
|
|
||||||
class ParseServer {
|
class ParseServer {
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @param {ParseServerOptions} options the parse server initialization options
|
||||||
|
*/
|
||||||
constructor(options: ParseServerOptions) {
|
constructor(options: ParseServerOptions) {
|
||||||
injectDefaults(options);
|
injectDefaults(options);
|
||||||
const {
|
const {
|
||||||
@@ -128,6 +131,10 @@ class ParseServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @static
|
||||||
|
* Create an express app for the parse server
|
||||||
|
* @param {Object} options let you specify the maxUploadSize when creating the express app */
|
||||||
static app({maxUploadSize = '20mb', appId}) {
|
static app({maxUploadSize = '20mb', appId}) {
|
||||||
// This app serves the Parse API directly.
|
// This app serves the Parse API directly.
|
||||||
// It's the equivalent of https://api.parse.com/1 in the hosted Parse API.
|
// It's the equivalent of https://api.parse.com/1 in the hosted Parse API.
|
||||||
@@ -212,6 +219,12 @@ class ParseServer {
|
|||||||
return appRouter;
|
return appRouter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts the parse server's express app
|
||||||
|
* @param {ParseServerOptions} options to use to start the server
|
||||||
|
* @param {Function} callback called when the server has started
|
||||||
|
* @returns {ParseServer} the parse server instance
|
||||||
|
*/
|
||||||
start(options: ParseServerOptions, callback: ?()=>void) {
|
start(options: ParseServerOptions, callback: ?()=>void) {
|
||||||
const app = express();
|
const app = express();
|
||||||
if (options.middleware) {
|
if (options.middleware) {
|
||||||
@@ -239,11 +252,24 @@ class ParseServer {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new ParseServer and starts it.
|
||||||
|
* @param {ParseServerOptions} options used to start the server
|
||||||
|
* @param {Function} callback called when the server has started
|
||||||
|
* @returns {ParseServer} the parse server instance
|
||||||
|
*/
|
||||||
static start(options: ParseServerOptions, callback: ?()=>void) {
|
static start(options: ParseServerOptions, callback: ?()=>void) {
|
||||||
const parseServer = new ParseServer(options);
|
const parseServer = new ParseServer(options);
|
||||||
return parseServer.start(options, callback);
|
return parseServer.start(options, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to create a liveQuery server
|
||||||
|
* @static
|
||||||
|
* @param {Server} httpServer an optional http server to pass
|
||||||
|
* @param {LiveQueryServerOptions} config options fot he liveQueryServer
|
||||||
|
* @returns {ParseLiveQueryServer} the live query server instance
|
||||||
|
*/
|
||||||
static createLiveQueryServer(httpServer, config: LiveQueryServerOptions) {
|
static createLiveQueryServer(httpServer, config: LiveQueryServerOptions) {
|
||||||
if (!httpServer || (config && config.port)) {
|
if (!httpServer || (config && config.port)) {
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ ParseCloud.httpRequest = require("./httpRequest");
|
|||||||
module.exports = ParseCloud;
|
module.exports = ParseCloud;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Parse.Cloud.TriggerRequest
|
* @interface Parse.Cloud.TriggerRequest
|
||||||
* @property {String} installationId If set, the installationId triggering the request.
|
* @property {String} installationId If set, the installationId triggering the request.
|
||||||
* @property {Boolean} master If true, means the master key was used.
|
* @property {Boolean} master If true, means the master key was used.
|
||||||
* @property {Parse.User} user If set, the user that made the request.
|
* @property {Parse.User} user If set, the user that made the request.
|
||||||
@@ -240,7 +240,7 @@ module.exports = ParseCloud;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Parse.Cloud.BeforeFindRequest
|
* @interface Parse.Cloud.BeforeFindRequest
|
||||||
* @property {String} installationId If set, the installationId triggering the request.
|
* @property {String} installationId If set, the installationId triggering the request.
|
||||||
* @property {Boolean} master If true, means the master key was used.
|
* @property {Boolean} master If true, means the master key was used.
|
||||||
* @property {Parse.User} user If set, the user that made the request.
|
* @property {Parse.User} user If set, the user that made the request.
|
||||||
@@ -253,7 +253,7 @@ module.exports = ParseCloud;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Parse.Cloud.AfterFindRequest
|
* @interface Parse.Cloud.AfterFindRequest
|
||||||
* @property {String} installationId If set, the installationId triggering the request.
|
* @property {String} installationId If set, the installationId triggering the request.
|
||||||
* @property {Boolean} master If true, means the master key was used.
|
* @property {Boolean} master If true, means the master key was used.
|
||||||
* @property {Parse.User} user If set, the user that made the request.
|
* @property {Parse.User} user If set, the user that made the request.
|
||||||
@@ -266,7 +266,7 @@ module.exports = ParseCloud;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Parse.Cloud.FunctionRequest
|
* @interface Parse.Cloud.FunctionRequest
|
||||||
* @property {String} installationId If set, the installationId triggering the request.
|
* @property {String} installationId If set, the installationId triggering the request.
|
||||||
* @property {Boolean} master If true, means the master key was used.
|
* @property {Boolean} master If true, means the master key was used.
|
||||||
* @property {Parse.User} user If set, the user that made the request.
|
* @property {Parse.User} user If set, the user that made the request.
|
||||||
@@ -274,7 +274,7 @@ module.exports = ParseCloud;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Parse.Cloud.JobRequest
|
* @interface Parse.Cloud.JobRequest
|
||||||
* @property {Object} params The params passed to the background job.
|
* @property {Object} params The params passed to the background job.
|
||||||
* @property {function} message If message is called with a string argument, will update the current message to be stored in the job status.
|
* @property {function} message If message is called with a string argument, will update the current message to be stored in the job status.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user