Commit Graph

385 Commits

Author SHA1 Message Date
Ivan SZKIBA
dfe0ff753c support PhantAuth authentication (#5850)
* support PhantAuth authentication

* fix spelling issues

* Add test case
2019-07-29 00:58:43 -05:00
Diamond Lewis
95208e96e0 Postgres: Safely escape strings in nested objects (#5855)
* Postgres: Safely handle string in nested objects

* fix failing tests
2019-07-28 23:54:13 -05:00
greenkeeper[bot]
80bb2b6389 Update pg-promise to the latest version 🚀 (#5857)
* fix(package): update pg-promise to version 9.0.0

* chore(package): update lockfile package-lock.json

* remove es6 generators
2019-07-27 19:07:36 +00:00
Antonio Davi Macedo Coelho de Castro
fd637ff4f8 Required fields and default values (#5835)
* Add field options to mongo schema metadata

* Add/fix test with fields options

* Add required validation failing test

* Add more tests

* Only set default value if field is undefined

* Fix redis test

* Fix tests

* Test for creating a new class with field options

* Validate default value type

* fix lint (weird)

* Fix lint another way

* Add tests for beforeSave trigger and solve small issue regarding the use of unset in the beforeSave trigger
2019-07-25 21:13:59 -07:00
Omair Vaiyani
d3810c2eba GraphQL Configuration Options (#5782)
* add parse-graph-ql configuration for class schema customisation

Not yet tested - essentially an RFC

* refactor and add graphql router, controller and config cache

* fix(GraphQLController): add missing check isEnabled

* chore(GraphQLController): remove awaits from cache put

* chore(GraphQLController): remove check for if its enabled

* refactor(GraphQLController): only use cache if mounted

* chore(GraphQLController): group all validation errors and throw at once

* chore(GraphQLSchema): move transformations into controller validation

* refactor(GraphQL): improve ctrl validation and fix schema usage of config

* refactor(GraphQLSchema): remove code related to additional schema

This code has been moved into a separate feature branch.

* fix(GraphQLSchema): fix incorrect default return type for class configs

* refactor(GraphQLSchema): update staleness check code to account for config

* fix(GraphQLServer): fix regressed tests due to internal schema changes

This will be followed up with a backwards compatability fix for the `ClassFields` issue to avoid breakages for our users

* refactor: rename to ParseGraphQLController for consistency

* fix(ParseGraphQLCtrl): numerous fixes for validity checking

Also includes some minor code refactoring

* chore(GraphQL): minor syntax cleanup

* fix(SchemaController): add _GraphQLConfig to volatile classes

* refactor(ParseGraphQLServer): return update config value in setGraphQLConfig

* testing(ParseGraphQL): add test cases for new graphQLConfig

* fix(GraphQLController): fix issue where config with multiple items was not being mapped to the db

* fix(postgres): add _GraphQLConfig default schema on load

fixes failing postgres tests

* GraphQL @mock directive (#5836)

* Add mock directive
* Include tests for @mock directive

* Fix existing tests due to the change from ClassFields to ClassCreateFields

* fix(parseClassMutations): safer type transformation based on input type

* fix(parseClassMutations): only define necessary input fields

* fix(GraphQL): fix incorrect import paths
2019-07-25 12:46:25 -07:00
Antonio Davi Macedo Coelho de Castro
8a925177e1 Cache apple public key for the case it fails to fetch again (#5848) 2019-07-25 10:20:28 -07:00
Douglas Muraoka
4fe0ff6ebf feat: Add "count" to CLP initial value (#5841)
* feat: count CLP default values

* fix tests
2019-07-24 12:41:18 -05:00
Diamond Lewis
3a7b0c4c75 Fix: Linking with Apple Auth (#5755)
Rename from apple-signin to apple (key names can't have hyphens
Rename id_token to id (auth adapters require id)
2019-07-03 16:28:29 -05:00
Diamond Lewis
e08f4f8023 Fix: Winston Logger string interpolation (#5729) 2019-06-25 18:01:00 -05:00
Jeff Gu Kang
ad7fc48c97 Postgres: Regex support foreign characters (#5598)
* Fix issue #5293

* Fix issue #5293

* add test

* Revert "add test"

This reverts commit 38b32a627a9d2c9a9b852b48194f173d8b7254f3.

* fix conflicts

* use native package
2019-06-24 16:13:34 -05:00
Diamond Lewis
6385deeb6e Add AppSecret to Facebook Auth (#5695)
Closes: https://github.com/parse-community/parse-server/issues/5448
2019-06-20 14:15:57 -05:00
Jack Wearden
559096f1c2 Allow disabling workaround for since-fixed MongoDB bug (#5617)
* Allow disabling workaround for fixed MongoDB bug

* skipMongoDBServer13732Workaround description fix

* flip test boolean

* Remove CLI flag, use databaseVersion & engine

* Revert "Remove CLI flag, use databaseVersion & engine"

This reverts commit 042d1ba19f636fe0da06074168c6fd5db37ea048.

* clean up
2019-06-19 17:30:08 -05:00
Diamond Lewis
fcdf2d7947 Sign in with Apple Auth Provider (#5694)
* Sign in with Apple Auth Provider

Closes: https://github.com/parse-community/parse-server/issues/5632

Should work out of the box.

* remove required options
2019-06-19 16:05:09 -05:00
Diamond Lewis
7590ee9799 Fix #5678 (#5681)
* Fix #5678

* Revert "Fix #5678"

This reverts commit 106b6ddd9535da6ec323226c1b9ad649022aeb1e.

* revert #5627
2019-06-13 13:40:58 -05:00
greenkeeper[bot]
af82dd7bdd Update eslint-plugin-flowtype to the latest version 🚀 (#5656)
* chore(package): update eslint-plugin-flowtype to version 3.10.0

* chore(package): update lockfile package-lock.json
2019-06-12 05:41:21 +00:00
Faysal Ahmed
a58653ada8 Support LinkedIn v2 API (#5660) 2019-06-11 11:23:08 -05:00
Olivier Allouch
7fc0d45b89 Database version in features (#5627)
* adding database.version in the serverInfo (only MongoDB, it gives undefined when using Postgres)

* . correction of old 'features' tests
. adding engine and database in the StorageAdapter interface and implementations

* . version retrieval done in performInitialization
. PostgreSQL version

* performInitialization now returns a Promise
2019-06-03 16:58:21 -05:00
Antonio Davi Macedo Coelho de Castro
afa74d655d Futzing with read preference (#3963)
* allow setting readpreference when using rest api.

* take out partially complete unit test.

* oops. nit

* Include read preference option for find directly from api and adding few more tests

* Adding catch for all tests

* Keep same check for get and find

* Turn read preference case insensitive

* Includes and subqueries read preferences through API

* Fixing bugs regarding changes that were done in master branch during the last year

* Changing behavior to make includeReadPreference and subqueryReadPreference to follow readPreference by default
2019-05-14 12:58:02 -07:00
Diamond Lewis
0ce4eeae72 LiveQuery: Add options for Redis (#5584)
Closes: https://github.com/parse-community/parse-server/issues/5387
2019-05-11 19:13:41 -05:00
Arthur Cinader
87da62bca2 Logger: Fix timestamp and format (#5571)
* remove no-op config of logger

* add a test to check on the timestamp

* add a test to verify that we
get non json console loggging by default

* configure transports to include
timestamps in files

* Add failing test to confirm that WinstonLoggerAdapter
is not filtering on level.

* actually fix the test to refelect the facth that this isn't the problem

* Remove bogus date ranges that are now failing
becuase we have timestamps.
2019-05-09 14:58:54 -05:00
Diamond Lewis
005fd78275 PG: Fix updating mixed array (#5552)
* PG: Fix updating mixed array

* Revert "PG: Fix updating mixed array"

This reverts commit 5a441413c083747d9e51767be7b2e9298bd4f8ba.

* simple fix
2019-05-02 12:44:17 -05:00
Diamond Lewis
9594c4b59f Add useNewUrlParser options to GridFSBucketAdapter (#5548)
* Add useNewUrlParser options to GridFSBucketAdapter

* allow overriding default
2019-05-01 00:44:10 -05:00
Diamond Lewis
057fc40c1d Postgres: Query notEqualTo GeoPoint (#5549)
* Postgres: Query notEqualTo GeoPoint

* remove templated strings
2019-04-30 23:29:44 -05:00
Antonio Davi Macedo Coelho de Castro
db994ed473 Aggregate supports group by date fields (#5538)
* it actually supports group by date fields

* Changing the field name again to see Travis logs

* Adding match stage to the test

* Adding test for group by date fields on postgres
2019-04-26 20:33:03 -05:00
Julien Quéré
7122ca05c4 Fix issue on count with Geo constraints and mongo (issue #5285) (#5286)
* Add a tests that fails due to issue #5285

* Make test code much simpler

* Fix #5285 by rewriting query (replacing $nearSphere by $geoWithin)

All credit goes to @dplewis !

* move logic to transform
2019-04-24 20:28:13 -05:00
Sam Ilic
6ffc41345f Winston 3 upgrade (#5496)
*  Release 3.1.3 (#5267)

*  Release 3.1.3

* Update CHANGELOG.md

* ⬆️ Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.1.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.1.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.5.1
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Rewrote WinstonLogger to work with winston 3.x api

* Changed winston logger test to use winston-transport

* Added winston-transport dependency

* Close and remove transports before adding them again

* Changed to strict equal

* Override adapter name

* Updated and added getLogs tests

* Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.2.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.2.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.6.0
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fixed tests, updated parse logging

* Fixed tests, better error logging

* Fix failing tests

* Updates as per review
2019-04-14 18:03:33 -05:00
Müller Zsolt
019cf0a986 added an RFC 7662 compliant OAuth2 auth adapter (#4910)
* added an RFC 7662 compliant OAuth2 auth adapter

* forgot to add the actual auth adapter to the previous commit

* fixed lint errors

* * added test coverage
* changed option names in auth adapter from snake case to camel case
* added underscore prefix to helper function names
* merged consecutive logger calls into one call and use JSON.stringify() to convert JSON objects to strings
* changed error handling (ParseErrors are no longer thrown, but returned)

* added description of the "debug" option and added this option to the tests too

* added a check of the "debug" option to the unittests and replaced require() of the logger with an import (the former does not work correctly)

* added AuthAdapter based auth adapter runtime validation to src/Adapters/Auth/index.js, added capability to define arbitrary providernames with an "adapter" property in auth config, replaced various "var" keywords with "const" in oauth2.js

* incorporated changes requested by flovilmart (mainly that oauth2 is now not a standalone adapter, but can be selected by setting the "oauth2" property to true in auth config

* modified oauth2 adapter as requested by flovilmart

* bugfix: defaultAdapter can be null in loadAuthAdapter() of index.js (my change broke the tests)

* added TODO on need for a validateAdapter() to validate auth adapters

* test cases and cleanup
2019-04-11 11:05:55 -05:00
CoderickLamar
c7eb7daeae Fix for count being very slow on large Parse Classes' collections (Postgres) (#5330)
* Changed count to be approximate. Should help with postgres slowness

* refactored last commit to only fall back to estimate if no complex query

* handlign variables correctly

* Trying again because it was casting to lowercase table names which doesnt work for us/

* syntax error

* Adding quotations to pg query

* hopefully final pg fix

* Postgres will now use an approximate count unless there is a more complex query specified

* handling edge case

* Fix for count being very slow on large Parse Classes' collections in Postgres. Replicating fix for Mongo in issue 5264

* Fixed silly spelling error resulting from copying over notes

* Lint fixes

* limiting results to 1 on approximation

* suppress test that we can no longer run for postgres

* removed tests from Postgres that no longer apply

* made changes requested by dplewis

* fixed count errors

* updated package.json

* removed test exclude for pg

* removed object types from method

* test disabled for postgres

* returned type

* add estimate count test

* fix mongo test
2019-04-08 17:59:15 -05:00
Georges Jamous
214aa2e450 using per-key basis queue (#5420)
* adding KeyPromiseQueue

* nit

* removing secondary object and using a tuple

* using array

* nits

* some tests

* Minor refinements

* removing old adapter

* dummy change, travis test not found

* travis test missing, dummy change

* revrting mistake

* reverting mistake

* indentation fix

* additional tests for coverage

* extending coverage

* nits

* fixing mistake

* better code
2019-04-02 10:07:31 -07:00
Diamond Lewis
730f5c5c3d Allow test credentials for Facebook Auth (#5466)
* Allow test credentials for Facebook Auth

* node_env testing
2019-03-30 18:21:41 -05:00
awgeorge
b343de0c70 Set default protectedFields and remove previous filter logic 2019-02-23 07:28:39 -08:00
Steve Clay
038d7bd727 postgres: Refuse to build unsafe JSON lists for contains in Postgres (#5337) 2019-01-31 12:23:40 -05:00
dependabot[bot]
3851641b5a Bump flow-bin from 0.83.0 to 0.91.0 (#5302)
* Bump flow-bin from 0.83.0 to 0.91.0

Bumps [flow-bin](https://github.com/flowtype/flow-bin) from 0.83.0 to 0.91.0.
- [Release notes](https://github.com/flowtype/flow-bin/releases)
- [Commits](https://github.com/flowtype/flow-bin/compare/v0.83.0...v0.91.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix flow issue
2019-01-19 13:08:42 -05:00
Benjamin Simonsson
de92ce5c49 Fix for count being very slow on large Parse Classes' collections (#5264)
* * Added fix for MongoCollection's count function, so that it uses the much more effecient estimatedDocumentCount if no queries were specified

* * Added missing options when running estimatedDocumentCount for Mongo Collections

* * Fixed issue with checking for zero query for Mongo Collections count
2018-12-28 09:45:36 -05:00
Diamond Lewis
ab32dbc9a2 PG: Fix containedIn query on empty array (#5254)
* PG: Fix containedIn query on empty array

* improve logic
2018-12-19 17:57:55 -06:00
Diamond Lewis
631b1684e2 PG: Updating mixed array test (#5252)
* PG: Updating mixed array test

Currently we can save a mixed array but not update

* build array instead of casting

* fix test

* add recursion
2018-12-18 17:38:05 -06:00
Diamond Lewis
7b3da8b744 PG: Fix updating numeric array (#5251)
* PG: Fix updating numeric array

* lint
2018-12-18 12:11:24 -06:00
Diamond Lewis
d478e001b5 PG: Support multiple global config (#5242)
* PG: Support Multiple Configs

* rename test

* refactor
2018-12-14 17:39:07 -06:00
Diamond Lewis
daab3781a2 Support Distinct for special fields (#5144)
* Support Distinct for special fields

* update changelog
2018-10-26 10:21:42 -05:00
Ben Briggs
45ff23bde2 postgres: Ensure that setting a value to undefined is a no-op on writes. (#5065) (#5069) 2018-09-26 16:42:06 -04:00
Florent Vilmart
a42101531a Silences warnings from mongodb client (#5025)
* Silences warnings from mongodb client

* Update count, delete and finds to recommended implementations

* With new parser, readPref will be null by default

* Update flaky specs wih async/await style

* Adds gridstore adapter spec

* Use GridFSBucketStorage adapter
2018-09-04 16:15:09 -04:00
Florent Vilmart
d83a0b6808 Use Prettier JS (#5017)
* Adds prettier

* Run lint before tests
2018-09-01 13:58:06 -04:00
orette
c7357ed109 Use the correct function when validating google auth tokens (#5018)
* Use the correct function when validating google auth tokens

httpsRequest.request expects the param postData and has no default value
or validation to check if it is missing before using it. As a result, an
error `TypeError: First argument must be a string or Buffer` is
thrown when an attempt is made to authenticate with Google.

A quick check on the LinkedIn, FB, and twitter authentication adapters
shows they are using httpsRequest.get for their validation calls.

* Correct google auth adapter tests
2018-08-30 20:17:46 -04:00
eddyLazar
41acaa0570 fixed vkontakte validateAuthData (#4977)
* fixed vkontakte validateAuthData

* updated changelog
2018-08-17 15:38:07 -04:00
Florent Vilmart
b740db335b Allows undefined values to pass from mongo to database controler (#4973)
* Allows undefined values to pass from mongo to database controler

* Adds changelog
2018-08-16 11:24:33 -04:00
Florent Vilmart
942b9b5b1a Adds documentations for adapters and main constructors (#4951)
* wip

* Adds documentations for adapters, and constructors

* nits

* nit
2018-08-15 10:47:21 -04:00
Florent Vilmart
bf9fdb41ed Ensure the ACL is always part of the payload when using select (#4967)
* Ensure the ACL is always part of the payload when using select

* Update changelog

* fix for PG
2018-08-15 09:48:32 -04:00
Florent Vilmart
b9673da07b Refactor all auth adapters to reduce duplications (#4954)
* Refactor all auth adapters to reduce duplications

* Adds mocking and proper testing for all auth adapters

* Proper testing of the google auth adapter

* noit
2018-08-12 11:05:28 -04:00
Florent Vilmart
960431b92d Even faster tests (#4868)
* Various improvements in test name / de-duplications

* Reverts to class by class deletion, introduced fast mode that just delete data for mongo

- Speeds up are incredible Executed 1695 of 1713 specs INCOMPLETE (18 PENDING) in 4 mins 19 secs.

* Adds documentation about the deleteEverything
2018-07-03 11:13:08 -04:00
Florent Vilmart
e97df073df Testing improvements (#4863)
* Adds supports-color so spec reporter dont output colors when not supported

* Adds babelrc so breakpoints dont jump around in specs

* Rename test to avoid duplicated name

* Removes unused methods

* Better naming for it_exclude
2018-07-01 00:00:37 -04:00