From ef14ca530d8fd1ceb3997697738f912a3fd8c288 Mon Sep 17 00:00:00 2001 From: Douglas Muraoka Date: Fri, 2 Aug 2019 16:18:08 -0300 Subject: [PATCH] GraphQL Object constraints (#5715) * GraphQL Object constraints Implements the GraphQL Object constraints, which allows us to filter queries results using the `$eq`, `$lt`, `$gt`, `$in`, and other Parse supported constraints. Example: ``` query objects { findMyClass(where: { objField: { _eq: { key: 'foo.bar', value: 'hello' }, _gt: { key: 'foo.number', value: 10 }, _lt: { key: 'anotherNumber', value: 5 } } }) { results { objectId } } } ``` In the example above, we have the `findMyClass` query (automatically generated for the `MyClass` class), and a field named `objField` whose type is Object. The object below represents a valid `objField` value and would satisfy all constraints: ``` { "foo": { "bar": "hello", "number": 11 }, "anotherNumber": 4 } ``` The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as `get` and `find`, this type of constraint is not available. * Objects constraints not working on Postgres Fixes the $eq, $ne, $gt, and $lt constraints when applied on an Object type field. * Fix object constraint field name * Fix Postgres constraints indexes * fix: Object type composed constraints not working * fix: Rename key and value fields * refactor: Object constraints for generic queries * fix: Object constraints not working on Postgres --- spec/AuthenticationAdapters.spec.js | 4 +- spec/ParseGraphQLServer.spec.js | 168 +++- spec/ParseQuery.spec.js | 2 +- spec/ParseWebSocketServer.spec.js | 4 +- spec/Schema.spec.js | 4 +- spec/schemas.spec.js | 20 +- .../Postgres/PostgresStorageAdapter.js | 68 +- src/Adapters/WebSocketServer/WSSAdapter.js | 4 +- src/Controllers/SchemaController.js | 6 +- src/GraphQL/loaders/defaultGraphQLTypes.js | 29 +- src/GraphQL/loaders/objectsQueries.js | 44 +- src/LiveQuery/ParseLiveQueryServer.js | 8 +- src/Options/Definitions.js | 916 +++++++++--------- src/Options/docs.js | 1 - 14 files changed, 778 insertions(+), 500 deletions(-) diff --git a/spec/AuthenticationAdapters.spec.js b/spec/AuthenticationAdapters.spec.js index 9cb9d4b5..0f978d8f 100644 --- a/spec/AuthenticationAdapters.spec.js +++ b/spec/AuthenticationAdapters.spec.js @@ -1178,7 +1178,9 @@ describe('phant auth adapter', () => { }; const { adapter } = authenticationLoader.loadAuthAdapter('phantauth', {}); - spyOn(httpsRequest, 'get').and.callFake(() => Promise.resolve({ sub: 'invalidID' })); + spyOn(httpsRequest, 'get').and.callFake(() => + Promise.resolve({ sub: 'invalidID' }) + ); try { await adapter.validateAuthData(authData); fail(); diff --git a/spec/ParseGraphQLServer.spec.js b/spec/ParseGraphQLServer.spec.js index 92209ae8..37ec282e 100644 --- a/spec/ParseGraphQLServer.spec.js +++ b/spec/ParseGraphQLServer.spec.js @@ -5273,7 +5273,10 @@ describe('ParseGraphQLServer', () => { }); it('should support object values', async () => { - const someFieldValue = { foo: 'bar' }; + const someFieldValue = { + foo: { bar: 'baz' }, + number: 10, + }; const createResult = await apolloClient.mutate({ mutation: gql` @@ -5314,30 +5317,179 @@ describe('ParseGraphQLServer', () => { }, }); - const getResult = await apolloClient.query({ + const where = { + someField: { + _eq: { _key: 'foo.bar', _value: 'baz' }, + _ne: { _key: 'foo.bar', _value: 'bat' }, + _gt: { _key: 'number', _value: 9 }, + _lt: { _key: 'number', _value: 11 }, + }, + }; + const queryResult = await apolloClient.query({ query: gql` - query GetSomeObject($objectId: ID!) { + query GetSomeObject( + $objectId: ID! + $where: SomeClassConstraints + $genericWhere: Object + ) { objects { get(className: "SomeClass", objectId: $objectId) - findSomeClass(where: { someField: { _exists: true } }) { + findSomeClass(where: $where) { results { objectId + someField } } + find(className: "SomeClass", where: $genericWhere) { + results + } } } `, variables: { objectId: createResult.data.objects.create.objectId, + where, + genericWhere: where, // where and genericWhere types are different }, }); - const { someField } = getResult.data.objects.get; + const { + get: getResult, + findSomeClass, + find, + } = queryResult.data.objects; + + const { someField } = getResult; expect(typeof someField).toEqual('object'); expect(someField).toEqual(someFieldValue); - expect(getResult.data.objects.findSomeClass.results.length).toEqual( - 2 - ); + + // Checks class query results + expect(findSomeClass.results.length).toEqual(2); + expect(findSomeClass.results[0].someField).toEqual(someFieldValue); + expect(findSomeClass.results[1].someField).toEqual(someFieldValue); + + // Checks generic query results + expect(find.results.length).toEqual(2); + expect(find.results[0].someField).toEqual(someFieldValue); + expect(find.results[1].someField).toEqual(someFieldValue); + }); + + it('should support object composed queries', async () => { + const someFieldValue = { + lorem: 'ipsum', + number: 10, + }; + const someFieldValue2 = { + foo: { + test: 'bar', + }, + number: 10, + }; + + const createResult = await apolloClient.mutate({ + mutation: gql` + mutation CreateSomeObject($fields: Object, $fields2: Object) { + objects { + create1: create(className: "SomeClass", fields: $fields) { + objectId + } + create2: create(className: "SomeClass", fields: $fields2) { + objectId + } + } + } + `, + variables: { + fields: { + someField: someFieldValue, + }, + fields2: { + someField: someFieldValue2, + }, + }, + }); + + await parseGraphQLServer.parseGraphQLSchema.databaseController.schemaCache.clear(); + + const where = { + _and: [ + { + someField: { + _gt: { _key: 'number', _value: 9 }, + }, + }, + { + someField: { + _lt: { _key: 'number', _value: 11 }, + }, + }, + { + _or: [ + { + someField: { + _eq: { _key: 'lorem', _value: 'ipsum' }, + }, + }, + { + someField: { + _eq: { _key: 'foo.test', _value: 'bar' }, + }, + }, + ], + }, + ], + }; + const findResult = await apolloClient.query({ + query: gql` + query FindSomeObject( + $where: SomeClassConstraints + $genericWhere: Object + ) { + objects { + findSomeClass(where: $where) { + results { + objectId + someField + } + } + find(className: "SomeClass", where: $genericWhere) { + results + } + } + } + `, + variables: { + where, + genericWhere: where, // where and genericWhere types are different + }, + }); + + const { create1, create2 } = createResult.data.objects; + const { findSomeClass, find } = findResult.data.objects; + + // Checks class query results + const { results } = findSomeClass; + expect(results.length).toEqual(2); + expect( + results.find(result => result.objectId === create1.objectId) + .someField + ).toEqual(someFieldValue); + expect( + results.find(result => result.objectId === create2.objectId) + .someField + ).toEqual(someFieldValue2); + + // Checks generic query results + const { results: genericResults } = find; + expect(genericResults.length).toEqual(2); + expect( + genericResults.find(result => result.objectId === create1.objectId) + .someField + ).toEqual(someFieldValue); + expect( + genericResults.find(result => result.objectId === create2.objectId) + .someField + ).toEqual(someFieldValue2); }); it('should support array values', async () => { diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 866d9238..ce303422 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -369,7 +369,7 @@ describe('Parse.Query testing', () => { }); it('nested containedIn string with single quote', async () => { - const obj = new TestObject({ nested: { foo: ["single'quote"]} }); + const obj = new TestObject({ nested: { foo: ["single'quote"] } }); await obj.save(); const query = new Parse.Query(TestObject); query.containedIn('nested.foo', ["single'quote"]); diff --git a/spec/ParseWebSocketServer.spec.js b/spec/ParseWebSocketServer.spec.js index b8fb4d6d..e9a014dd 100644 --- a/spec/ParseWebSocketServer.spec.js +++ b/spec/ParseWebSocketServer.spec.js @@ -1,4 +1,6 @@ -const { ParseWebSocketServer } = require('../lib/LiveQuery/ParseWebSocketServer'); +const { + ParseWebSocketServer, +} = require('../lib/LiveQuery/ParseWebSocketServer'); describe('ParseWebSocketServer', function() { beforeEach(function(done) { diff --git a/spec/Schema.spec.js b/spec/Schema.spec.js index 56cf97f3..17e75a30 100644 --- a/spec/Schema.spec.js +++ b/spec/Schema.spec.js @@ -451,7 +451,9 @@ describe('SchemaController', () => { ) ) .then(actualSchema => { - expect(dd(actualSchema.classLevelPermissions, newLevelPermissions)).toEqual(undefined); + expect( + dd(actualSchema.classLevelPermissions, newLevelPermissions) + ).toEqual(undefined); done(); }) .catch(error => { diff --git a/spec/schemas.spec.js b/spec/schemas.spec.js index a48cf6f0..0ff8a22e 100644 --- a/spec/schemas.spec.js +++ b/spec/schemas.spec.js @@ -425,8 +425,12 @@ describe('schemas', () => { foo4: { type: 'Date', required: true }, foo5: { type: 'Number', defaultValue: 5 }, ptr: { type: 'Pointer', targetClass: 'SomeClass', required: false }, - defaultFalse: { type: 'Boolean', required: true, defaultValue: false }, - defaultZero: { type: 'Number', defaultValue: 0 } + defaultFalse: { + type: 'Boolean', + required: true, + defaultValue: false, + }, + defaultZero: { type: 'Number', defaultValue: 0 }, }, }, }).then(async response => { @@ -447,8 +451,12 @@ describe('schemas', () => { foo4: { type: 'Date', required: true }, foo5: { type: 'Number', defaultValue: 5 }, ptr: { type: 'Pointer', targetClass: 'SomeClass', required: false }, - defaultFalse: { type: 'Boolean', required: true, defaultValue: false }, - defaultZero: { type: 'Number', defaultValue: 0 } + defaultFalse: { + type: 'Boolean', + required: true, + defaultValue: false, + }, + defaultZero: { type: 'Number', defaultValue: 0 }, }, classLevelPermissions: defaultClassLevelPermissions, }); @@ -468,8 +476,8 @@ describe('schemas', () => { expect(obj.get('foo4')).toEqual(date); expect(obj.get('foo5')).toEqual(5); expect(obj.get('ptr')).toBeUndefined(); - expect(obj.get('defaultFalse')).toEqual(false) - expect(obj.get('defaultZero')).toEqual(0) + expect(obj.get('defaultFalse')).toEqual(false); + expect(obj.get('defaultZero')).toEqual(0); expect(obj.get('ptr')).toBeUndefined(); done(); }); diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index 28cbb677..791be6c5 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -288,7 +288,7 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => { index += 2; } else if (fieldValue.$regex) { // Handle later - } else { + } else if (typeof fieldValue !== 'object') { patterns.push(`$${index}:raw = $${index + 1}::text`); values.push(name, fieldValue); index += 2; @@ -358,9 +358,16 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => { 2}) OR $${index}:name IS NULL)` ); } else { - patterns.push( - `($${index}:name <> $${index + 1} OR $${index}:name IS NULL)` - ); + if (fieldName.indexOf('.') >= 0) { + const constraintFieldName = transformDotField(fieldName); + patterns.push( + `(${constraintFieldName} <> $${index} OR ${constraintFieldName} IS NULL)` + ); + } else { + patterns.push( + `($${index}:name <> $${index + 1} OR $${index}:name IS NULL)` + ); + } } } } @@ -380,9 +387,14 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => { values.push(fieldName); index += 1; } else { - patterns.push(`$${index}:name = $${index + 1}`); - values.push(fieldName, fieldValue.$eq); - index += 2; + if (fieldName.indexOf('.') >= 0) { + values.push(fieldValue.$eq); + patterns.push(`${transformDotField(fieldName)} = $${index++}`); + } else { + values.push(fieldName, fieldValue.$eq); + patterns.push(`$${index}:name = $${index + 1}`); + index += 2; + } } } const isInOrNin = @@ -749,9 +761,29 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => { Object.keys(ParseToPosgresComparator).forEach(cmp => { if (fieldValue[cmp] || fieldValue[cmp] === 0) { const pgComparator = ParseToPosgresComparator[cmp]; - patterns.push(`$${index}:name ${pgComparator} $${index + 1}`); - values.push(fieldName, toPostgresValue(fieldValue[cmp])); - index += 2; + const postgresValue = toPostgresValue(fieldValue[cmp]); + let constraintFieldName; + if (fieldName.indexOf('.') >= 0) { + let castType; + switch (typeof postgresValue) { + case 'number': + castType = 'double precision'; + break; + case 'boolean': + castType = 'boolean'; + break; + default: + castType = undefined; + } + constraintFieldName = castType + ? `CAST ((${transformDotField(fieldName)}) AS ${castType})` + : transformDotField(fieldName); + } else { + constraintFieldName = `$${index++}:name`; + values.push(fieldName); + } + values.push(postgresValue); + patterns.push(`${constraintFieldName} ${pgComparator} $${index++}`); } }); @@ -820,7 +852,7 @@ export class PostgresStorageAdapter implements StorageAdapter { setClassLevelPermissions(className: string, CLPs: any) { const self = this; - return this._client.task('set-class-level-permissions', async (t) => { + return this._client.task('set-class-level-permissions', async t => { await self._ensureSchemaCollectionExists(t); const values = [ className, @@ -885,7 +917,7 @@ export class PostgresStorageAdapter implements StorageAdapter { }); } }); - return conn.tx('set-indexes-with-schema-format', async (t) => { + return conn.tx('set-indexes-with-schema-format', async t => { if (insertedIndexes.length > 0) { await self.createIndexes(className, insertedIndexes, t); } @@ -981,7 +1013,7 @@ export class PostgresStorageAdapter implements StorageAdapter { const values = [className, ...valuesArray]; debug(qs, values); - return conn.task('create-table', async (t) => { + return conn.task('create-table', async t => { try { await self._ensureSchemaCollectionExists(t); await t.none(qs, values); @@ -1009,7 +1041,7 @@ export class PostgresStorageAdapter implements StorageAdapter { conn = conn || this._client; const self = this; - return conn.tx('schema-upgrade', async (t) => { + return conn.tx('schema-upgrade', async t => { const columns = await t.map( 'SELECT column_name FROM information_schema.columns WHERE table_name = $', { className }, @@ -1040,7 +1072,7 @@ export class PostgresStorageAdapter implements StorageAdapter { debug('addFieldIfNotExists', { className, fieldName, type }); conn = conn || this._client; const self = this; - return conn.tx('add-field-if-not-exists', async (t) => { + return conn.tx('add-field-if-not-exists', async t => { if (type.type !== 'Relation') { try { await t.none( @@ -1110,7 +1142,7 @@ export class PostgresStorageAdapter implements StorageAdapter { debug('deleteAllClasses'); return this._client - .task('delete-all-classes', async (t) => { + .task('delete-all-classes', async t => { try { const results = await t.any('SELECT * FROM "_SCHEMA"'); const joins = results.reduce((list: Array, schema: any) => { @@ -1180,7 +1212,7 @@ export class PostgresStorageAdapter implements StorageAdapter { }) .join(', DROP COLUMN'); - return this._client.tx('delete-fields', async (t) => { + return this._client.tx('delete-fields', async t => { await t.none( 'UPDATE "_SCHEMA" SET "schema"=$ WHERE "className"=$', { schema, className } @@ -1196,7 +1228,7 @@ export class PostgresStorageAdapter implements StorageAdapter { // rejection reason are TBD. getAllClasses() { const self = this; - return this._client.task('get-all-classes', async (t) => { + return this._client.task('get-all-classes', async t => { await self._ensureSchemaCollectionExists(t); return await t.map('SELECT * FROM "_SCHEMA"', null, row => toParseSchema({ className: row.className, ...row.schema }) diff --git a/src/Adapters/WebSocketServer/WSSAdapter.js b/src/Adapters/WebSocketServer/WSSAdapter.js index 23fc4b93..d801b151 100644 --- a/src/Adapters/WebSocketServer/WSSAdapter.js +++ b/src/Adapters/WebSocketServer/WSSAdapter.js @@ -20,8 +20,8 @@ export class WSSAdapter { * @param {Object} options - {http.Server|https.Server} server */ constructor(options) { - this.onListen = () => {} - this.onConnection = () => {} + this.onListen = () => {}; + this.onConnection = () => {}; } // /** diff --git a/src/Controllers/SchemaController.js b/src/Controllers/SchemaController.js index ac76ca1a..aa68ce76 100644 --- a/src/Controllers/SchemaController.js +++ b/src/Controllers/SchemaController.js @@ -768,7 +768,11 @@ export default class SchemaController { }) .then(results => { enforceFields = results.filter(result => !!result); - return this.setPermissions(className, classLevelPermissions, newSchema); + return this.setPermissions( + className, + classLevelPermissions, + newSchema + ); }) .then(() => this._dbAdapter.setIndexesWithSchemaFormat( diff --git a/src/GraphQL/loaders/defaultGraphQLTypes.js b/src/GraphQL/loaders/defaultGraphQLTypes.js index ad7b6033..7961132f 100644 --- a/src/GraphQL/loaders/defaultGraphQLTypes.js +++ b/src/GraphQL/loaders/defaultGraphQLTypes.js @@ -846,15 +846,34 @@ const ARRAY_CONSTRAINT = new GraphQLInputObjectType({ }, }); +const KEY_VALUE = new GraphQLInputObjectType({ + name: 'KeyValue', + description: 'An entry from an object, i.e., a pair of key and value.', + fields: { + _key: { + description: 'The key used to retrieve the value of this entry.', + type: new GraphQLNonNull(GraphQLString), + }, + _value: { + description: 'The value of the entry. Could be any type of scalar data.', + type: new GraphQLNonNull(ANY), + }, + }, +}); + const OBJECT_CONSTRAINT = new GraphQLInputObjectType({ name: 'ObjectConstraint', description: - 'The ObjectConstraint input type is used in operations that involve filtering objects by a field of type Object.', + 'The ObjectConstraint input type is used in operations that involve filtering result by a field of type Object.', fields: { - _eq: _eq(OBJECT), - _ne: _ne(OBJECT), - _in: _in(OBJECT), - _nin: _nin(OBJECT), + _eq: _eq(KEY_VALUE), + _ne: _ne(KEY_VALUE), + _in: _in(KEY_VALUE), + _nin: _nin(KEY_VALUE), + _lt: _lt(KEY_VALUE), + _lte: _lte(KEY_VALUE), + _gt: _gt(KEY_VALUE), + _gte: _gte(KEY_VALUE), _exists, _select, _dontSelect, diff --git a/src/GraphQL/loaders/objectsQueries.js b/src/GraphQL/loaders/objectsQueries.js index 210c8461..f7430196 100644 --- a/src/GraphQL/loaders/objectsQueries.js +++ b/src/GraphQL/loaders/objectsQueries.js @@ -96,13 +96,51 @@ const parseMap = { _point: '$point', }; -const transformToParse = constraints => { +const transformToParse = (constraints, parentFieldName, parentConstraints) => { if (!constraints || typeof constraints !== 'object') { return; } Object.keys(constraints).forEach(fieldName => { let fieldValue = constraints[fieldName]; - if (parseMap[fieldName]) { + + /** + * If we have a key-value pair, we need to change the way the constraint is structured. + * + * Example: + * From: + * { + * "someField": { + * "_lt": { + * "_key":"foo.bar", + * "_value": 100 + * }, + * "_gt": { + * "_key":"foo.bar", + * "_value": 10 + * } + * } + * } + * + * To: + * { + * "someField.foo.bar": { + * "$lt": 100, + * "$gt": 10 + * } + * } + */ + if ( + fieldValue._key && + fieldValue._value && + parentConstraints && + parentFieldName + ) { + delete parentConstraints[parentFieldName]; + parentConstraints[`${parentFieldName}.${fieldValue._key}`] = { + ...parentConstraints[`${parentFieldName}.${fieldValue._key}`], + [parseMap[fieldName]]: fieldValue._value, + }; + } else if (parseMap[fieldName]) { delete constraints[fieldName]; fieldName = parseMap[fieldName]; constraints[fieldName] = fieldValue; @@ -160,7 +198,7 @@ const transformToParse = constraints => { break; } if (typeof fieldValue === 'object') { - transformToParse(fieldValue); + transformToParse(fieldValue, fieldName, constraints); } }); }; diff --git a/src/LiveQuery/ParseLiveQueryServer.js b/src/LiveQuery/ParseLiveQueryServer.js index b3ee7c6a..b447e284 100644 --- a/src/LiveQuery/ParseLiveQueryServer.js +++ b/src/LiveQuery/ParseLiveQueryServer.js @@ -678,9 +678,7 @@ class ParseLiveQueryServer { client.pushSubscribe(request.requestId); logger.verbose( - `Create client ${parseWebsocket.clientId} new subscription: ${ - request.requestId - }` + `Create client ${parseWebsocket.clientId} new subscription: ${request.requestId}` ); logger.verbose('Current client number: %d', this.clients.size); runLiveQueryEventHandlers({ @@ -774,9 +772,7 @@ class ParseLiveQueryServer { client.pushUnsubscribe(request.requestId); logger.verbose( - `Delete client: ${parseWebsocket.clientId} | subscription: ${ - request.requestId - }` + `Delete client: ${parseWebsocket.clientId} | subscription: ${request.requestId}` ); } } diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index d5da0d20..27fad63f 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -3,480 +3,504 @@ This code has been generated by resources/buildConfigDefinitions.js Do not edit manually, but update Options/index.js */ -var parsers = require("./parsers"); +var parsers = require('./parsers'); module.exports.ParseServerOptions = { - "accountLockout": { - "env": "PARSE_SERVER_ACCOUNT_LOCKOUT", - "help": "account lockout policy for failed login attempts", - "action": parsers.objectParser - }, - "allowClientClassCreation": { - "env": "PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION", - "help": "Enable (or disable) client class creation, defaults to true", - "action": parsers.booleanParser, - "default": true - }, - "analyticsAdapter": { - "env": "PARSE_SERVER_ANALYTICS_ADAPTER", - "help": "Adapter module for the analytics", - "action": parsers.moduleOrObjectParser - }, - "appId": { - "env": "PARSE_SERVER_APPLICATION_ID", - "help": "Your Parse Application ID", - "required": true - }, - "appName": { - "env": "PARSE_SERVER_APP_NAME", - "help": "Sets the app name" - }, - "auth": { - "env": "PARSE_SERVER_AUTH_PROVIDERS", - "help": "Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication", - "action": parsers.objectParser - }, - "cacheAdapter": { - "env": "PARSE_SERVER_CACHE_ADAPTER", - "help": "Adapter module for the cache", - "action": parsers.moduleOrObjectParser - }, - "cacheMaxSize": { - "env": "PARSE_SERVER_CACHE_MAX_SIZE", - "help": "Sets the maximum size for the in memory cache, defaults to 10000", - "action": parsers.numberParser("cacheMaxSize"), - "default": 10000 - }, - "cacheTTL": { - "env": "PARSE_SERVER_CACHE_TTL", - "help": "Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds)", - "action": parsers.numberParser("cacheTTL"), - "default": 5000 - }, - "clientKey": { - "env": "PARSE_SERVER_CLIENT_KEY", - "help": "Key for iOS, MacOS, tvOS clients" - }, - "cloud": { - "env": "PARSE_SERVER_CLOUD", - "help": "Full path to your cloud code main.js" - }, - "cluster": { - "env": "PARSE_SERVER_CLUSTER", - "help": "Run with cluster, optionally set the number of processes default to os.cpus().length", - "action": parsers.numberOrBooleanParser - }, - "collectionPrefix": { - "env": "PARSE_SERVER_COLLECTION_PREFIX", - "help": "A collection prefix for the classes", - "default": "" - }, - "customPages": { - "env": "PARSE_SERVER_CUSTOM_PAGES", - "help": "custom pages for password validation and reset", - "action": parsers.objectParser, - "default": {} - }, - "databaseAdapter": { - "env": "PARSE_SERVER_DATABASE_ADAPTER", - "help": "Adapter module for the database", - "action": parsers.moduleOrObjectParser - }, - "databaseOptions": { - "env": "PARSE_SERVER_DATABASE_OPTIONS", - "help": "Options to pass to the mongodb client", - "action": parsers.objectParser - }, - "databaseURI": { - "env": "PARSE_SERVER_DATABASE_URI", - "help": "The full URI to your database. Supported databases are mongodb or postgres.", - "required": true, - "default": "mongodb://localhost:27017/parse" - }, - "directAccess": { - "env": "PARSE_SERVER_ENABLE_EXPERIMENTAL_DIRECT_ACCESS", - "help": "Replace HTTP Interface when using JS SDK in current node runtime, defaults to false. Caution, this is an experimental feature that may not be appropriate for production.", - "action": parsers.booleanParser, - "default": false - }, - "dotNetKey": { - "env": "PARSE_SERVER_DOT_NET_KEY", - "help": "Key for Unity and .Net SDK" - }, - "emailAdapter": { - "env": "PARSE_SERVER_EMAIL_ADAPTER", - "help": "Adapter module for email sending", - "action": parsers.moduleOrObjectParser - }, - "emailVerifyTokenValidityDuration": { - "env": "PARSE_SERVER_EMAIL_VERIFY_TOKEN_VALIDITY_DURATION", - "help": "Email verification token validity duration, in seconds", - "action": parsers.numberParser("emailVerifyTokenValidityDuration") - }, - "enableAnonymousUsers": { - "env": "PARSE_SERVER_ENABLE_ANON_USERS", - "help": "Enable (or disable) anon users, defaults to true", - "action": parsers.booleanParser, - "default": true - }, - "enableExpressErrorHandler": { - "env": "PARSE_SERVER_ENABLE_EXPRESS_ERROR_HANDLER", - "help": "Enables the default express error handler for all errors", - "action": parsers.booleanParser, - "default": false - }, - "enableSingleSchemaCache": { - "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.", - "action": parsers.booleanParser, - "default": false - }, - "expireInactiveSessions": { - "env": "PARSE_SERVER_EXPIRE_INACTIVE_SESSIONS", - "help": "Sets wether we should expire the inactive sessions, defaults to true", - "action": parsers.booleanParser, - "default": true - }, - "fileKey": { - "env": "PARSE_SERVER_FILE_KEY", - "help": "Key for your files" - }, - "filesAdapter": { - "env": "PARSE_SERVER_FILES_ADAPTER", - "help": "Adapter module for the files sub-system", - "action": parsers.moduleOrObjectParser - }, - "graphQLPath": { - "env": "PARSE_SERVER_GRAPHQL_PATH", - "help": "Mount path for the GraphQL endpoint, defaults to /graphql", - "default": "/graphql" - }, - "graphQLSchema": { - "env": "PARSE_SERVER_GRAPH_QLSCHEMA", - "help": "Full path to your GraphQL custom schema.graphql file" - }, - "host": { - "env": "PARSE_SERVER_HOST", - "help": "The host to serve ParseServer on, defaults to 0.0.0.0", - "default": "0.0.0.0" - }, - "javascriptKey": { - "env": "PARSE_SERVER_JAVASCRIPT_KEY", - "help": "Key for the Javascript SDK" - }, - "jsonLogs": { - "env": "JSON_LOGS", - "help": "Log as structured JSON objects", - "action": parsers.booleanParser - }, - "liveQuery": { - "env": "PARSE_SERVER_LIVE_QUERY", - "help": "parse-server's LiveQuery configuration object", - "action": parsers.objectParser - }, - "liveQueryServerOptions": { - "env": "PARSE_SERVER_LIVE_QUERY_SERVER_OPTIONS", - "help": "Live query server configuration options (will start the liveQuery server)", - "action": parsers.objectParser - }, - "loggerAdapter": { - "env": "PARSE_SERVER_LOGGER_ADAPTER", - "help": "Adapter module for the logging sub-system", - "action": parsers.moduleOrObjectParser - }, - "logLevel": { - "env": "PARSE_SERVER_LOG_LEVEL", - "help": "Sets the level for logs" - }, - "logsFolder": { - "env": "PARSE_SERVER_LOGS_FOLDER", - "help": "Folder for the logs (defaults to './logs'); set to null to disable file based logging", - "default": "./logs" - }, - "masterKey": { - "env": "PARSE_SERVER_MASTER_KEY", - "help": "Your Parse Master Key", - "required": true - }, - "masterKeyIps": { - "env": "PARSE_SERVER_MASTER_KEY_IPS", - "help": "Restrict masterKey to be used by only these ips, defaults to [] (allow all ips)", - "action": parsers.arrayParser, - "default": [] - }, - "maxLimit": { - "env": "PARSE_SERVER_MAX_LIMIT", - "help": "Max value for limit option on queries, defaults to unlimited", - "action": parsers.numberParser("maxLimit") - }, - "maxUploadSize": { - "env": "PARSE_SERVER_MAX_UPLOAD_SIZE", - "help": "Max file size for uploads, defaults to 20mb", - "default": "20mb" - }, - "middleware": { - "env": "PARSE_SERVER_MIDDLEWARE", - "help": "middleware for express server, can be string or function" - }, - "mountGraphQL": { - "env": "PARSE_SERVER_MOUNT_GRAPHQL", - "help": "Mounts the GraphQL endpoint", - "action": parsers.booleanParser, - "default": false - }, - "mountPath": { - "env": "PARSE_SERVER_MOUNT_PATH", - "help": "Mount path for the server, defaults to /parse", - "default": "/parse" - }, - "mountPlayground": { - "env": "PARSE_SERVER_MOUNT_PLAYGROUND", - "help": "Mounts the GraphQL Playground - never use this option in production", - "action": parsers.booleanParser, - "default": false - }, - "objectIdSize": { - "env": "PARSE_SERVER_OBJECT_ID_SIZE", - "help": "Sets the number of characters in generated object id's, default 10", - "action": parsers.numberParser("objectIdSize"), - "default": 10 - }, - "passwordPolicy": { - "env": "PARSE_SERVER_PASSWORD_POLICY", - "help": "Password policy for enforcing password related rules", - "action": parsers.objectParser - }, - "playgroundPath": { - "env": "PARSE_SERVER_PLAYGROUND_PATH", - "help": "Mount path for the GraphQL Playground, defaults to /playground", - "default": "/playground" - }, - "port": { - "env": "PORT", - "help": "The port to run the ParseServer, defaults to 1337.", - "action": parsers.numberParser("port"), - "default": 1337 - }, - "preserveFileName": { - "env": "PARSE_SERVER_PRESERVE_FILE_NAME", - "help": "Enable (or disable) the addition of a unique hash to the file names", - "action": parsers.booleanParser, - "default": false - }, - "preventLoginWithUnverifiedEmail": { - "env": "PARSE_SERVER_PREVENT_LOGIN_WITH_UNVERIFIED_EMAIL", - "help": "Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false", - "action": parsers.booleanParser, - "default": false - }, - "protectedFields": { - "env": "PARSE_SERVER_PROTECTED_FIELDS", - "help": "Protected fields that should be treated with extra security when fetching details.", - "action": parsers.objectParser, - "default": { - "_User": { - "*": ["email"] - } - } - }, - "publicServerURL": { - "env": "PARSE_PUBLIC_SERVER_URL", - "help": "Public URL to your parse server with http:// or https://." - }, - "push": { - "env": "PARSE_SERVER_PUSH", - "help": "Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications", - "action": parsers.objectParser - }, - "readOnlyMasterKey": { - "env": "PARSE_SERVER_READ_ONLY_MASTER_KEY", - "help": "Read-only key, which has the same capabilities as MasterKey without writes" - }, - "restAPIKey": { - "env": "PARSE_SERVER_REST_API_KEY", - "help": "Key for REST calls" - }, - "revokeSessionOnPasswordReset": { - "env": "PARSE_SERVER_REVOKE_SESSION_ON_PASSWORD_RESET", - "help": "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.", - "action": parsers.booleanParser, - "default": true - }, - "scheduledPush": { - "env": "PARSE_SERVER_SCHEDULED_PUSH", - "help": "Configuration for push scheduling, defaults to false.", - "action": parsers.booleanParser, - "default": false - }, - "schemaCacheTTL": { - "env": "PARSE_SERVER_SCHEMA_CACHE_TTL", - "help": "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.", - "action": parsers.numberParser("schemaCacheTTL"), - "default": 5000 - }, - "serverURL": { - "env": "PARSE_SERVER_URL", - "help": "URL to your parse server with http:// or https://.", - "required": true - }, - "sessionLength": { - "env": "PARSE_SERVER_SESSION_LENGTH", - "help": "Session duration, in seconds, defaults to 1 year", - "action": parsers.numberParser("sessionLength"), - "default": 31536000 - }, - "silent": { - "env": "SILENT", - "help": "Disables console output", - "action": parsers.booleanParser - }, - "skipMongoDBServer13732Workaround": { - "env": "PARSE_SKIP_MONGODB_SERVER_13732_WORKAROUND", - "help": "Circumvent Parse workaround for historical MongoDB bug SERVER-13732", - "action": parsers.booleanParser, - "default": false - }, - "startLiveQueryServer": { - "env": "PARSE_SERVER_START_LIVE_QUERY_SERVER", - "help": "Starts the liveQuery server", - "action": parsers.booleanParser - }, - "userSensitiveFields": { - "env": "PARSE_SERVER_USER_SENSITIVE_FIELDS", - "help": "Personally identifiable information fields in the user table the should be removed for non-authorized users. Deprecated @see protectedFields", - "action": parsers.arrayParser - }, - "verbose": { - "env": "VERBOSE", - "help": "Set the logging to verbose", - "action": parsers.booleanParser - }, - "verifyUserEmails": { - "env": "PARSE_SERVER_VERIFY_USER_EMAILS", - "help": "Enable (or disable) user email validation, defaults to false", - "action": parsers.booleanParser, - "default": false - }, - "webhookKey": { - "env": "PARSE_SERVER_WEBHOOK_KEY", - "help": "Key sent with outgoing webhook calls" - } + accountLockout: { + env: 'PARSE_SERVER_ACCOUNT_LOCKOUT', + help: 'account lockout policy for failed login attempts', + action: parsers.objectParser, + }, + allowClientClassCreation: { + env: 'PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION', + help: 'Enable (or disable) client class creation, defaults to true', + action: parsers.booleanParser, + default: true, + }, + analyticsAdapter: { + env: 'PARSE_SERVER_ANALYTICS_ADAPTER', + help: 'Adapter module for the analytics', + action: parsers.moduleOrObjectParser, + }, + appId: { + env: 'PARSE_SERVER_APPLICATION_ID', + help: 'Your Parse Application ID', + required: true, + }, + appName: { + env: 'PARSE_SERVER_APP_NAME', + help: 'Sets the app name', + }, + auth: { + env: 'PARSE_SERVER_AUTH_PROVIDERS', + help: + 'Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication', + action: parsers.objectParser, + }, + cacheAdapter: { + env: 'PARSE_SERVER_CACHE_ADAPTER', + help: 'Adapter module for the cache', + action: parsers.moduleOrObjectParser, + }, + cacheMaxSize: { + env: 'PARSE_SERVER_CACHE_MAX_SIZE', + help: 'Sets the maximum size for the in memory cache, defaults to 10000', + action: parsers.numberParser('cacheMaxSize'), + default: 10000, + }, + cacheTTL: { + env: 'PARSE_SERVER_CACHE_TTL', + help: + 'Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds)', + action: parsers.numberParser('cacheTTL'), + default: 5000, + }, + clientKey: { + env: 'PARSE_SERVER_CLIENT_KEY', + help: 'Key for iOS, MacOS, tvOS clients', + }, + cloud: { + env: 'PARSE_SERVER_CLOUD', + help: 'Full path to your cloud code main.js', + }, + cluster: { + env: 'PARSE_SERVER_CLUSTER', + help: + 'Run with cluster, optionally set the number of processes default to os.cpus().length', + action: parsers.numberOrBooleanParser, + }, + collectionPrefix: { + env: 'PARSE_SERVER_COLLECTION_PREFIX', + help: 'A collection prefix for the classes', + default: '', + }, + customPages: { + env: 'PARSE_SERVER_CUSTOM_PAGES', + help: 'custom pages for password validation and reset', + action: parsers.objectParser, + default: {}, + }, + databaseAdapter: { + env: 'PARSE_SERVER_DATABASE_ADAPTER', + help: 'Adapter module for the database', + action: parsers.moduleOrObjectParser, + }, + databaseOptions: { + env: 'PARSE_SERVER_DATABASE_OPTIONS', + help: 'Options to pass to the mongodb client', + action: parsers.objectParser, + }, + databaseURI: { + env: 'PARSE_SERVER_DATABASE_URI', + help: + 'The full URI to your database. Supported databases are mongodb or postgres.', + required: true, + default: 'mongodb://localhost:27017/parse', + }, + directAccess: { + env: 'PARSE_SERVER_ENABLE_EXPERIMENTAL_DIRECT_ACCESS', + help: + 'Replace HTTP Interface when using JS SDK in current node runtime, defaults to false. Caution, this is an experimental feature that may not be appropriate for production.', + action: parsers.booleanParser, + default: false, + }, + dotNetKey: { + env: 'PARSE_SERVER_DOT_NET_KEY', + help: 'Key for Unity and .Net SDK', + }, + emailAdapter: { + env: 'PARSE_SERVER_EMAIL_ADAPTER', + help: 'Adapter module for email sending', + action: parsers.moduleOrObjectParser, + }, + emailVerifyTokenValidityDuration: { + env: 'PARSE_SERVER_EMAIL_VERIFY_TOKEN_VALIDITY_DURATION', + help: 'Email verification token validity duration, in seconds', + action: parsers.numberParser('emailVerifyTokenValidityDuration'), + }, + enableAnonymousUsers: { + env: 'PARSE_SERVER_ENABLE_ANON_USERS', + help: 'Enable (or disable) anon users, defaults to true', + action: parsers.booleanParser, + default: true, + }, + enableExpressErrorHandler: { + env: 'PARSE_SERVER_ENABLE_EXPRESS_ERROR_HANDLER', + help: 'Enables the default express error handler for all errors', + action: parsers.booleanParser, + default: false, + }, + enableSingleSchemaCache: { + 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.', + action: parsers.booleanParser, + default: false, + }, + expireInactiveSessions: { + env: 'PARSE_SERVER_EXPIRE_INACTIVE_SESSIONS', + help: + 'Sets wether we should expire the inactive sessions, defaults to true', + action: parsers.booleanParser, + default: true, + }, + fileKey: { + env: 'PARSE_SERVER_FILE_KEY', + help: 'Key for your files', + }, + filesAdapter: { + env: 'PARSE_SERVER_FILES_ADAPTER', + help: 'Adapter module for the files sub-system', + action: parsers.moduleOrObjectParser, + }, + graphQLPath: { + env: 'PARSE_SERVER_GRAPHQL_PATH', + help: 'Mount path for the GraphQL endpoint, defaults to /graphql', + default: '/graphql', + }, + graphQLSchema: { + env: 'PARSE_SERVER_GRAPH_QLSCHEMA', + help: 'Full path to your GraphQL custom schema.graphql file', + }, + host: { + env: 'PARSE_SERVER_HOST', + help: 'The host to serve ParseServer on, defaults to 0.0.0.0', + default: '0.0.0.0', + }, + javascriptKey: { + env: 'PARSE_SERVER_JAVASCRIPT_KEY', + help: 'Key for the Javascript SDK', + }, + jsonLogs: { + env: 'JSON_LOGS', + help: 'Log as structured JSON objects', + action: parsers.booleanParser, + }, + liveQuery: { + env: 'PARSE_SERVER_LIVE_QUERY', + help: "parse-server's LiveQuery configuration object", + action: parsers.objectParser, + }, + liveQueryServerOptions: { + env: 'PARSE_SERVER_LIVE_QUERY_SERVER_OPTIONS', + help: + 'Live query server configuration options (will start the liveQuery server)', + action: parsers.objectParser, + }, + loggerAdapter: { + env: 'PARSE_SERVER_LOGGER_ADAPTER', + help: 'Adapter module for the logging sub-system', + action: parsers.moduleOrObjectParser, + }, + logLevel: { + env: 'PARSE_SERVER_LOG_LEVEL', + help: 'Sets the level for logs', + }, + logsFolder: { + env: 'PARSE_SERVER_LOGS_FOLDER', + help: + "Folder for the logs (defaults to './logs'); set to null to disable file based logging", + default: './logs', + }, + masterKey: { + env: 'PARSE_SERVER_MASTER_KEY', + help: 'Your Parse Master Key', + required: true, + }, + masterKeyIps: { + env: 'PARSE_SERVER_MASTER_KEY_IPS', + help: + 'Restrict masterKey to be used by only these ips, defaults to [] (allow all ips)', + action: parsers.arrayParser, + default: [], + }, + maxLimit: { + env: 'PARSE_SERVER_MAX_LIMIT', + help: 'Max value for limit option on queries, defaults to unlimited', + action: parsers.numberParser('maxLimit'), + }, + maxUploadSize: { + env: 'PARSE_SERVER_MAX_UPLOAD_SIZE', + help: 'Max file size for uploads, defaults to 20mb', + default: '20mb', + }, + middleware: { + env: 'PARSE_SERVER_MIDDLEWARE', + help: 'middleware for express server, can be string or function', + }, + mountGraphQL: { + env: 'PARSE_SERVER_MOUNT_GRAPHQL', + help: 'Mounts the GraphQL endpoint', + action: parsers.booleanParser, + default: false, + }, + mountPath: { + env: 'PARSE_SERVER_MOUNT_PATH', + help: 'Mount path for the server, defaults to /parse', + default: '/parse', + }, + mountPlayground: { + env: 'PARSE_SERVER_MOUNT_PLAYGROUND', + help: 'Mounts the GraphQL Playground - never use this option in production', + action: parsers.booleanParser, + default: false, + }, + objectIdSize: { + env: 'PARSE_SERVER_OBJECT_ID_SIZE', + help: "Sets the number of characters in generated object id's, default 10", + action: parsers.numberParser('objectIdSize'), + default: 10, + }, + passwordPolicy: { + env: 'PARSE_SERVER_PASSWORD_POLICY', + help: 'Password policy for enforcing password related rules', + action: parsers.objectParser, + }, + playgroundPath: { + env: 'PARSE_SERVER_PLAYGROUND_PATH', + help: 'Mount path for the GraphQL Playground, defaults to /playground', + default: '/playground', + }, + port: { + env: 'PORT', + help: 'The port to run the ParseServer, defaults to 1337.', + action: parsers.numberParser('port'), + default: 1337, + }, + preserveFileName: { + env: 'PARSE_SERVER_PRESERVE_FILE_NAME', + help: 'Enable (or disable) the addition of a unique hash to the file names', + action: parsers.booleanParser, + default: false, + }, + preventLoginWithUnverifiedEmail: { + env: 'PARSE_SERVER_PREVENT_LOGIN_WITH_UNVERIFIED_EMAIL', + help: + 'Prevent user from login if email is not verified and PARSE_SERVER_VERIFY_USER_EMAILS is true, defaults to false', + action: parsers.booleanParser, + default: false, + }, + protectedFields: { + env: 'PARSE_SERVER_PROTECTED_FIELDS', + help: + 'Protected fields that should be treated with extra security when fetching details.', + action: parsers.objectParser, + default: { + _User: { + '*': ['email'], + }, + }, + }, + publicServerURL: { + env: 'PARSE_PUBLIC_SERVER_URL', + help: 'Public URL to your parse server with http:// or https://.', + }, + push: { + env: 'PARSE_SERVER_PUSH', + help: + 'Configuration for push, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#push-notifications', + action: parsers.objectParser, + }, + readOnlyMasterKey: { + env: 'PARSE_SERVER_READ_ONLY_MASTER_KEY', + help: + 'Read-only key, which has the same capabilities as MasterKey without writes', + }, + restAPIKey: { + env: 'PARSE_SERVER_REST_API_KEY', + help: 'Key for REST calls', + }, + revokeSessionOnPasswordReset: { + env: 'PARSE_SERVER_REVOKE_SESSION_ON_PASSWORD_RESET', + help: + "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.", + action: parsers.booleanParser, + default: true, + }, + scheduledPush: { + env: 'PARSE_SERVER_SCHEDULED_PUSH', + help: 'Configuration for push scheduling, defaults to false.', + action: parsers.booleanParser, + default: false, + }, + schemaCacheTTL: { + env: 'PARSE_SERVER_SCHEMA_CACHE_TTL', + help: + '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.', + action: parsers.numberParser('schemaCacheTTL'), + default: 5000, + }, + serverURL: { + env: 'PARSE_SERVER_URL', + help: 'URL to your parse server with http:// or https://.', + required: true, + }, + sessionLength: { + env: 'PARSE_SERVER_SESSION_LENGTH', + help: 'Session duration, in seconds, defaults to 1 year', + action: parsers.numberParser('sessionLength'), + default: 31536000, + }, + silent: { + env: 'SILENT', + help: 'Disables console output', + action: parsers.booleanParser, + }, + skipMongoDBServer13732Workaround: { + env: 'PARSE_SKIP_MONGODB_SERVER_13732_WORKAROUND', + help: 'Circumvent Parse workaround for historical MongoDB bug SERVER-13732', + action: parsers.booleanParser, + default: false, + }, + startLiveQueryServer: { + env: 'PARSE_SERVER_START_LIVE_QUERY_SERVER', + help: 'Starts the liveQuery server', + action: parsers.booleanParser, + }, + userSensitiveFields: { + env: 'PARSE_SERVER_USER_SENSITIVE_FIELDS', + help: + 'Personally identifiable information fields in the user table the should be removed for non-authorized users. Deprecated @see protectedFields', + action: parsers.arrayParser, + }, + verbose: { + env: 'VERBOSE', + help: 'Set the logging to verbose', + action: parsers.booleanParser, + }, + verifyUserEmails: { + env: 'PARSE_SERVER_VERIFY_USER_EMAILS', + help: 'Enable (or disable) user email validation, defaults to false', + action: parsers.booleanParser, + default: false, + }, + webhookKey: { + env: 'PARSE_SERVER_WEBHOOK_KEY', + help: 'Key sent with outgoing webhook calls', + }, }; module.exports.CustomPagesOptions = { - "choosePassword": { - "env": "PARSE_SERVER_CUSTOM_PAGES_CHOOSE_PASSWORD", - "help": "choose password page path" + choosePassword: { + env: 'PARSE_SERVER_CUSTOM_PAGES_CHOOSE_PASSWORD', + help: 'choose password page path', }, - "invalidLink": { - "env": "PARSE_SERVER_CUSTOM_PAGES_INVALID_LINK", - "help": "invalid link page path" + invalidLink: { + env: 'PARSE_SERVER_CUSTOM_PAGES_INVALID_LINK', + help: 'invalid link page path', }, - "invalidVerificationLink": { - "env": "PARSE_SERVER_CUSTOM_PAGES_INVALID_VERIFICATION_LINK", - "help": "invalid verification link page path" + invalidVerificationLink: { + env: 'PARSE_SERVER_CUSTOM_PAGES_INVALID_VERIFICATION_LINK', + help: 'invalid verification link page path', }, - "linkSendFail": { - "env": "PARSE_SERVER_CUSTOM_PAGES_LINK_SEND_FAIL", - "help": "verification link send fail page path" + linkSendFail: { + env: 'PARSE_SERVER_CUSTOM_PAGES_LINK_SEND_FAIL', + help: 'verification link send fail page path', }, - "linkSendSuccess": { - "env": "PARSE_SERVER_CUSTOM_PAGES_LINK_SEND_SUCCESS", - "help": "verification link send success page path" + linkSendSuccess: { + env: 'PARSE_SERVER_CUSTOM_PAGES_LINK_SEND_SUCCESS', + help: 'verification link send success page path', }, - "parseFrameURL": { - "env": "PARSE_SERVER_CUSTOM_PAGES_PARSE_FRAME_URL", - "help": "for masking user-facing pages" + parseFrameURL: { + env: 'PARSE_SERVER_CUSTOM_PAGES_PARSE_FRAME_URL', + help: 'for masking user-facing pages', }, - "passwordResetSuccess": { - "env": "PARSE_SERVER_CUSTOM_PAGES_PASSWORD_RESET_SUCCESS", - "help": "password reset success page path" + passwordResetSuccess: { + env: 'PARSE_SERVER_CUSTOM_PAGES_PASSWORD_RESET_SUCCESS', + help: 'password reset success page path', + }, + verifyEmailSuccess: { + env: 'PARSE_SERVER_CUSTOM_PAGES_VERIFY_EMAIL_SUCCESS', + help: 'verify email success page path', }, - "verifyEmailSuccess": { - "env": "PARSE_SERVER_CUSTOM_PAGES_VERIFY_EMAIL_SUCCESS", - "help": "verify email success page path" - } }; module.exports.LiveQueryOptions = { - "classNames": { - "env": "PARSE_SERVER_LIVEQUERY_CLASSNAMES", - "help": "parse-server's LiveQuery classNames", - "action": parsers.arrayParser + classNames: { + env: 'PARSE_SERVER_LIVEQUERY_CLASSNAMES', + help: "parse-server's LiveQuery classNames", + action: parsers.arrayParser, }, - "pubSubAdapter": { - "env": "PARSE_SERVER_LIVEQUERY_PUB_SUB_ADAPTER", - "help": "LiveQuery pubsub adapter", - "action": parsers.moduleOrObjectParser + pubSubAdapter: { + env: 'PARSE_SERVER_LIVEQUERY_PUB_SUB_ADAPTER', + help: 'LiveQuery pubsub adapter', + action: parsers.moduleOrObjectParser, }, - "redisOptions": { - "env": "PARSE_SERVER_LIVEQUERY_REDIS_OPTIONS", - "help": "parse-server's LiveQuery redisOptions", - "action": parsers.objectParser + redisOptions: { + env: 'PARSE_SERVER_LIVEQUERY_REDIS_OPTIONS', + help: "parse-server's LiveQuery redisOptions", + action: parsers.objectParser, }, - "redisURL": { - "env": "PARSE_SERVER_LIVEQUERY_REDIS_URL", - "help": "parse-server's LiveQuery redisURL" + redisURL: { + env: 'PARSE_SERVER_LIVEQUERY_REDIS_URL', + help: "parse-server's LiveQuery redisURL", + }, + wssAdapter: { + env: 'PARSE_SERVER_LIVEQUERY_WSS_ADAPTER', + help: 'Adapter module for the WebSocketServer', + action: parsers.moduleOrObjectParser, }, - "wssAdapter": { - "env": "PARSE_SERVER_LIVEQUERY_WSS_ADAPTER", - "help": "Adapter module for the WebSocketServer", - "action": parsers.moduleOrObjectParser - } }; module.exports.LiveQueryServerOptions = { - "appId": { - "env": "PARSE_LIVE_QUERY_SERVER_APP_ID", - "help": "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." + appId: { + env: 'PARSE_LIVE_QUERY_SERVER_APP_ID', + help: + '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.', }, - "cacheTimeout": { - "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).", - "action": parsers.numberParser("cacheTimeout") + cacheTimeout: { + 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).", + action: parsers.numberParser('cacheTimeout'), }, - "keyPairs": { - "env": "PARSE_LIVE_QUERY_SERVER_KEY_PAIRS", - "help": "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.", - "action": parsers.objectParser + keyPairs: { + env: 'PARSE_LIVE_QUERY_SERVER_KEY_PAIRS', + help: + '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.', + action: parsers.objectParser, }, - "logLevel": { - "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." + logLevel: { + 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.', }, - "masterKey": { - "env": "PARSE_LIVE_QUERY_SERVER_MASTER_KEY", - "help": "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." + masterKey: { + env: 'PARSE_LIVE_QUERY_SERVER_MASTER_KEY', + help: + '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.', }, - "port": { - "env": "PARSE_LIVE_QUERY_SERVER_PORT", - "help": "The port to run the LiveQuery server, defaults to 1337.", - "action": parsers.numberParser("port"), - "default": 1337 + port: { + env: 'PARSE_LIVE_QUERY_SERVER_PORT', + help: 'The port to run the LiveQuery server, defaults to 1337.', + action: parsers.numberParser('port'), + default: 1337, }, - "pubSubAdapter": { - "env": "PARSE_LIVE_QUERY_SERVER_PUB_SUB_ADAPTER", - "help": "LiveQuery pubsub adapter", - "action": parsers.moduleOrObjectParser + pubSubAdapter: { + env: 'PARSE_LIVE_QUERY_SERVER_PUB_SUB_ADAPTER', + help: 'LiveQuery pubsub adapter', + action: parsers.moduleOrObjectParser, }, - "redisOptions": { - "env": "PARSE_LIVE_QUERY_SERVER_REDIS_OPTIONS", - "help": "parse-server's LiveQuery redisOptions", - "action": parsers.objectParser + redisOptions: { + env: 'PARSE_LIVE_QUERY_SERVER_REDIS_OPTIONS', + help: "parse-server's LiveQuery redisOptions", + action: parsers.objectParser, }, - "redisURL": { - "env": "PARSE_LIVE_QUERY_SERVER_REDIS_URL", - "help": "parse-server's LiveQuery redisURL" + redisURL: { + env: 'PARSE_LIVE_QUERY_SERVER_REDIS_URL', + help: "parse-server's LiveQuery redisURL", }, - "serverURL": { - "env": "PARSE_LIVE_QUERY_SERVER_SERVER_URL", - "help": "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." + serverURL: { + env: 'PARSE_LIVE_QUERY_SERVER_SERVER_URL', + help: + '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.', }, - "websocketTimeout": { - "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).", - "action": parsers.numberParser("websocketTimeout") + websocketTimeout: { + 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).', + action: parsers.numberParser('websocketTimeout'), + }, + wssAdapter: { + env: 'PARSE_LIVE_QUERY_SERVER_WSS_ADAPTER', + help: 'Adapter module for the WebSocketServer', + action: parsers.moduleOrObjectParser, }, - "wssAdapter": { - "env": "PARSE_LIVE_QUERY_SERVER_WSS_ADAPTER", - "help": "Adapter module for the WebSocketServer", - "action": parsers.moduleOrObjectParser - } }; diff --git a/src/Options/docs.js b/src/Options/docs.js index 72834c30..1ecd8616 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -106,4 +106,3 @@ * @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 {Adapter} wssAdapter Adapter module for the WebSocketServer */ -