Commit Graph

1090 Commits

Author SHA1 Message Date
Eduard Bosch Bertran
c0e3672e32 New query condition support to match all strings that starts with some other given strings (#3864)
* feat: Convert $regex value to RegExp object

* feat: Add lib folder

* Revert "feat: Add lib folder"

This reverts commit c9dfbcbf699ff220baeb2df5586a944d19808e5e.

* feat: Add $regex test in $all array

* test: Test regex with $all only in MongoDB

* Revert "test: Test regex with $all only in MongoDB"

This reverts commit d7194c7869dee98d924fbc2502593a198385dba1.

* feat: Add tests for containsAllStartingWith

* feat: Add postgres support

Thanks to @dplewis

* feat: Check that all values in $all must be regex or none

* test: Check that $all vaules must be regex or none

* feat: Update tests to use only REST API

* refactor: Move $all regex check to adapter

* feat: Check for valid $all values in progres

* refactor: Update function name

* fix:  Postgres $all values regex checking

* fix: Check starts with as string

* fix: Define contains all regex sql function

* fix: Wrong value check

* fix: Check valid data

* fix: Check regex when there is only one value

* fix: Constains all starting with string returns empty with bad params

* fix: Pass correct regex value

* feat: Add missing tests

* feat: Add missing tests

* feat: Add more tests

* fix: Unify MongoDB and PostgreSQL functionality

* fix: Lint checks

* fix: Test broken

$regex in $all list must be { $regex: "string" }

* test for empty $all
2018-05-15 20:42:32 -05:00
Florent Vilmart
fad7b46c65 chore: Fixes issue related to flow types (#4724)
* Fixes issue related to flow types

* Improves type inference on where clause, index

* run parse-server start on liveQueryServer only on mongo, state leaks on postgres
2018-05-01 07:37:38 -04:00
Claire Neveu
04588bccb9 Allow creation of indices on default fields (#4738)
* Allow creation of indexes on default fields

* Update test

* Try to address flaky cache test
2018-04-25 16:06:10 -07:00
oleg
b1017ac17c Send version for Vkontakte API (#4725) 2018-04-15 15:09:28 -04:00
dblythy
22801d2d8f Ensure we respond with invalid password even if email is unverified (#4708) 2018-04-11 15:39:32 -04:00
Jong Eun Lee
b0bcbd8731 add _password_history to default sensitive data (#4699) 2018-04-10 13:54:35 -04:00
Diamond Lewis
0fd8493929 Fix purging empty class (#4676)
* Fix purging empty class

* remove fit
2018-03-25 08:41:25 -05:00
Diamond Lewis
710848938f PG: Fixes issues comparing to zero or false (#4667)
* initial test

* more test

* clean up

* added correct errors

* test fix

* $eq null test

* type check
2018-03-24 17:45:34 -05:00
SebC
6abf29dd97 Remove FB Graph API version from URL to use the oldest non deprecated version (2.5 for now, which will be deprecated soon) (#4650) 2018-03-15 14:05:41 -05:00
Diamond Lewis
c36ef99368 Fix Aggregate Match Pointer (#4643) 2018-03-14 21:57:30 -05:00
Diamond Lewis
c6bc81caef Mongo: Fix reversing polygon coordinates (#4609)
* Fix reversing polygon coordinates

* comments fix

* real data test

* improved tests
2018-03-10 14:27:03 -06:00
AreyouHappy
d768211ab9 fix purge command issue affecting readonly masterKey (#4619) (#4621) 2018-03-10 10:07:31 -05:00
Arthur Cinader
d19ac077b6 Live query defaults reference ParseServer instead of LiverQuery server. (#4613)
* fix workding for live query defaults help

* generate the definition file.
2018-03-08 17:30:18 -05:00
Diamond Lewis
f0674df424 Fixes Issue unsetting in beforeSave doesn't allow object creation (#4610)
* skip unset fields on canAddField

* removed fit

* add null check
2018-03-08 10:31:53 -06:00
Florent Vilmart
60eea59c76 Handle mongodb auth errors that may occur after running the server for a while (#4576) 2018-03-02 10:24:58 -05:00
Diamond Lewis
d8f3fb16bd Skip afterFind for Aggregate and Distinct Queries (#4596) 2018-02-28 19:32:01 -06:00
6thfdwp
213801c4b1 auth: add adapter for Facebook accountkit login (#4434)
* Integrate auth adapter for Facebook accountkit login

* Also verify Facebook app id associated with account kit login

* Add appsecret_proof as extra graph request parameter

* Specific error message for Account kit and more test coverage

* One more test to cover when AppIds for Facebook account kit not configured properly
2018-02-23 07:37:55 -05:00
Florent Vilmart
11c40dce97 Adds session creation code in Auth.js (#4574) 2018-02-19 11:15:54 -05:00
Diamond Lewis
143b0f01cf PG: Add dates to group aggregate (#4549)
* PG: Add dates to group aggregate

* returns dates as UTC
2018-02-16 12:41:02 -06:00
Diamond Lewis
848a6cf7ae Distinct support for null (#4559)
* distinct support for null

* better testing
2018-02-16 10:44:42 -05:00
fridays
8be7491595 Fix server crash on invalid LiveQuery socket event (#4533)
* add failing test for missing command message

* don't mock tv4.validate

* fix existing tests

* make request.op required

* Update comment
2018-02-16 08:40:04 -05:00
Diamond Lewis
3cd77eeb7c duplicate value on unique index error (#4560) 2018-02-09 07:39:35 -06:00
Tyson Andre
83a0d7b685 Fix "undefined property '__op'" in postgres update (#4541)
* Fix "undefined property '__op'" in postgres update

This causes a TypeError which becomes a regular Error,
before the update can be issued. (I think)

This happens when there is an object schema,
and there is also an unrelated field in originalUpdate
which is null or undefined.

e.g. when 'location' is a mandatory object in postgres,
and 'middleName' is an optional string,
PostgresStorageAdapter would throw when a query similar
to the below was performed:
(Object.keys(originalUpdate) would include "middleName" as a value of `k`)

    query.set('location', {'country': 'US'})
    query.set('middleName', undefined);

* Fix lint error
2018-02-07 08:16:54 -05:00
Benjamin Wilson Friedman
db8594dd33 Regenerate Email Verification Token on Email Request (#4439)
* regenerate email verification token & expiration in /verificationEmailRequest

* Remove password field when saving on postgres
2018-02-01 18:35:08 -05:00
Florent Vilmart
401cc357e5 Fixes issue affecting sorting in beforeFind (#4519)
* Fixes issue affecting sorting in beforeFind

* Update CloudCode.spec.js
2018-01-24 15:15:05 -05:00
Diamond Lewis
64e568d000 Improved match aggregate (#4495)
* Improve aggregate queries

* using pg-promise query formatting

* match multiple comparison

* $or and complex match
2018-01-20 08:00:36 -06:00
Florent Vilmart
33890bbbfc Do not mark the empty pushs as failed (#4497) 2018-01-13 15:12:19 -05:00
Diamond Lewis
8ec07b83d0 Support pointer in aggregate query (#4493) 2018-01-08 20:42:08 -06:00
Paulo Reis
cb8f038ca8 #4338 pg schema upgrade (#4375)
* Method to upgrade schemas in Postgres;

Adds:
  - schemaUpgrade method which check the fields to add and delete from old schema;

* Remove the columns delete in schemaUpgrade method;

* ESLint fix and PostgresStorageAdapter.schemaUpgrade spec test

Adds:
  - Add PostgresStorageAdapter.schemaUpgrade spec tests: creates a table,
    simulates the addition of a new field and checks if its present in the database
Chores:
  - ESLint eol-last fix;

* Add check columns before and after schema upgrade, and remove the unnecessary piece of code

Add:
  - Check the right columns is present before schema upgrade and the new field is not,
    then check if the right columns is present and the new field;
Remove:
  - Piece of code unnecessary because it not need to remove diff columns;

* Optimize the schemaUpgrade method following @vitaly-t instructions, and more tests;

* If the class does not have any columns and needs an upgrade the code would
return without doing so. Fixed this.

Chore:
  - Allows class with no column to be upgraded;
  - Test for class with no columns being upgraded;

* Update PostgresStorageAdapter.js

rewriting method schemaUpgrade

* Update PostgresStorageAdapter.spec.js

* Update PostgresStorageAdapter.spec.js
2018-01-03 03:23:05 +00:00
Vitaly Tomilov
fc6a2fddc4 New Year cosmetics :) (#4475)
* cosmetics

* making nicer promise pattern + if->else blocks
* removing return if unwanted data from an `UPDATE`

* Update PostgresStorageAdapter.js

* Update PostgresStorageAdapter.js

* Update PostgresStorageAdapter.js

Restoring the `UPDATE` result, as apparently it is in fact used. Ouch! 😄

* Update PostgresStorageAdapter.js
2018-01-01 20:33:41 +00:00
Florent Vilmart
10631371e6 Introduces flow types for storage (#4349)
* Introduces flow types for storage

* Better typing of QueryOptions

* Adds flow types to SchemaCOntroller,

- runs flow on pre tests
- fixes flow

* Adds ClassLevelPermissions type

* Moves Controller types into a single file

* Changes import styles

* Changes import styles

* fixing method setIndexesWithSchemaFormat (#4454)

Fixing invalid database code in method `setIndexesWithSchemaFormat`:

* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters

* nits

* Fixes tests, improves flow typing
2017-12-30 20:44:18 -05:00
greenkeeper[bot]
f0f1870aa3 Update mongodb to the latest version 🚀 (#4449)
* fix(package): update mongodb to version 3.0.0

* Compatibility with MongoDB client 3.0

* Updates Gridstore as well

* Set Read preference to Primary when not specified, to match original implementation

* Update MongoStorageAdapter.js

* Bumps to 3.0.1
2017-12-30 00:23:43 -05:00
Diamond Lewis
6143988a82 Support pointer in distinct query (#4471)
* Support pointer in distinct query

* extract transform pointer string
2017-12-29 21:32:40 -06:00
Benjamin Wilson Friedman
7a9d4044af Scrub Passwords with URL Encoded Characters (#4433)
* scrub passwords with url encoded characters from logs

* compose query string from parsed params, redacting based on key if needed
2017-12-29 13:16:32 -05:00
Diamond Lewis
04f8673edd PG: Support for multiple projection in aggregate (#4469) 2017-12-29 17:39:16 +00:00
Vitaly Tomilov
6ba939994d consistent error throwing (#4470)
should use `throw` inside `.catch`.
2017-12-29 17:06:55 +00:00
Vitaly Tomilov
bb053301e5 refactoring method createClass (#4465)
* refactoring method createClass

Removing error-analysis conditions that are irrelevant, i.e. since we are only returning the batch, the error will always have `data` set to the size of the input array, as per [the library's API](http://vitaly-t.github.io/spex/errors.BatchError.html).

* Update PostgresStorageAdapter.js

removing the use of the default separator.
2017-12-28 01:43:34 +00:00
Vitaly Tomilov
7bb9c6da59 refactoring deleteAllClasses (#4464)
* refactoring deleteAllClasses

...to re-use the connection.

* Update PostgresStorageAdapter.js

removing extra spaces.
2017-12-27 22:41:50 +00:00
Vitaly Tomilov
b4aca8afc9 Reuse connection in getAllClasses (#4463)
as per the title.
2017-12-27 20:44:11 +00:00
Vitaly Tomilov
5681b3f902 Refactoring method addFieldIfNotExists (#4461)
* Refactoring method `addFieldIfNotExists`

* Using ES6 Generators syntax
* Passing in the context into method `createClass`, to reuse the connection
* Extending method `createClass` to reuse connections

* Update PostgresStorageAdapter.js

forgot: extending method `createClass` to reuse the connection.

* Update PostgresStorageAdapter.js

fixing the re-throw logic.
2017-12-27 18:14:15 +00:00
Vitaly Tomilov
820ae2b894 Better connection use in setClassLevelPermissions (#4460)
Method `setClassLevelPermissions` should use `.task` to share the connection for the two consecutive operations. It doesn't need a transaction, because the first operation does not need to roll back when the second one fails.
2017-12-27 00:30:50 +00:00
Vitaly Tomilov
a868beda93 Refactoring method createTable (#4456)
* Refactoring method createTable

Replacing the weird task + transaction chain, by replacing it with just one transaction that encapsulates the complete logic.

* Update PostgresStorageAdapter.js

correcting the sequence to match the original exactly.

* Update PostgresStorageAdapter.js

Nesting the transaction inside a task, so it can execute successfully no matter if the containing task succeeds or fails.

* Update PostgresStorageAdapter.js

adding the missing bracket.
2017-12-26 00:14:16 +00:00
Vitaly Tomilov
34453bff46 PostgreSQL performance optimization (#4457)
Performance-optimizing transactions to execute all non-result queries as a single operation.
2017-12-25 21:08:04 +00:00
Vitaly Tomilov
415ee3a1fd fixing method setIndexesWithSchemaFormat (#4454)
Fixing invalid database code in method `setIndexesWithSchemaFormat`:

* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters
2017-12-24 19:03:35 +00:00
Vitaly Tomilov
a2b2f18927 db connection context fix (#4453)
fixing use of the wrong connection context inside a task
2017-12-24 17:56:23 +00:00
Vitaly Tomilov
e0a31d2aeb improving database logic. (#4451)
improving database logic.
2017-12-24 16:34:01 +00:00
Vitaly Tomilov
08ba738227 refactoring database code (#4448)
* refactoring database code

Starting to refactor the database code for better use of promises + ES6 generators, to prepare for ES7 await/async.

* Update PostgresStorageAdapter.js

* Update PostgresStorageAdapter.js

naming the transaction.
2017-12-24 15:58:20 +00:00
Florent Vilmart
bad217911c Adds ability to login with email when provided as username (#4420) 2017-12-12 08:49:45 -05:00
Florent Vilmart
1f22ee36e7 Release 2.7.1
(#4410)
* Adds failing test for 4409

* Adds fix

*  Release 2.7.1
2017-12-01 09:16:58 -05:00
Arthur Cinader
1876d3f3fd Add doesNotMatchKeyInQuery case... 2017-11-30 12:40:39 -08:00