Commit Graph

87 Commits

Author SHA1 Message Date
Diamond Lewis
e6ac3b6932 fix(prettier): Properly handle lint-stage files (#6970)
Now handles top level files and recursive files in folders.

Set max line length to be 100
2020-10-25 15:06:58 -05:00
dblythy
c2f2281e6d Validation Handler Update (#6968)
* Initial Commit

* Update FunctionsRouter.js

* Update FunctionsRouter.js

* Change params to fields

* Changes requested

* Fix failing tests

* More tests

* More tests

* Remove existing functionality

* Remove legacy tests

* fix array typo

* Update triggers.js

* Docs

* Allow requireUserKeys to be object

* validateMasterKey

* Improve documentation

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
2020-10-25 12:36:54 -05:00
Florent Vilmart
045d941aef Remove request and request-promise from dev dependencies (#5077)
* removes from emailverificationtoken spec

* updates winston

* Updates ValidationAndPasswordsReset

* Use local request in schemas

* Removes request in rest.spec

* Removes request from PushRouter0

* removes request from public API

* removes request from index.spec

* Removes request form parse.push spec

* removes request from ParseInstallation spec

* Removes from ParseHooks

* removes request from ParseGlobalConfig.spec

* Removes request from ParseAPI.spec.js

* removes request from LogsRouter

* removes in features

* Filters undefined headers instead of crashing

* Removes request from ParseUser spec

* Removes usage of request in ParseFile.spec.js

* Removes request from AuthAdapters.js

* removes request-promise from ParseGeoPoint.spec

* Removes request-promise from ParseQuery spec

* remove request-promise from UserPII

* removes request-promise from EnableExpressErrorHandler

* Updates RevocableSessionUpgrade spec

* Update RestQuery

* Removes read preferenceOptionM

* ensure we forward auth from URL

* use request in CloudCode.spec.js

* Removes request-promise from JobSchedule.spec

* Removes rp from VerifyUserPassword.spec.js

* Removes rp from PasswordPolicy spec

* Removes rp from ParsePolygon spec

* Removes rp from fullTextSearch spec

* Removes rp from PArseQuery.Aggregate

* Ensure we properly forward errors

* Removes request and request-promise
2018-09-24 17:07:51 -04:00
Florent Vilmart
d83a0b6808 Use Prettier JS (#5017)
* Adds prettier

* Run lint before tests
2018-09-01 13:58:06 -04:00
Florent Vilmart
488b2ff231 Migrate to new cloud code interfaces
removes job status object, moves messasge method on req object

Adds 3.0.0 migration guide

Fixes nits about 3.0.0 documentation

Adds update guide to README
2018-08-15 10:47:21 -04:00
Florent Vilmart
ff25ae254d Update parse SDK to 2.0.0 (#4925)
* WIP: Integrate JS SDK v2

- Removes backbone style callbacks
- Use Promise instead of Parse.Promise

* Fixes ParseObject and ParseRelation

* Updates Parse.Query with promises

* Alls tests should pass

* Ensure a fresh user is used for each test

* Use REST implementation to avoid side effects for username/email duplicates

* Uses js sdk v2
2018-08-05 13:58:07 -04:00
Florent Vilmart
ae1a8226d5 Removes need to use babel-register (#4865)
* Removes need to use babel-register

- Adds watch to watch changes when running the test to regenerate
- Tests are now pure node 8

* Adds timing to helper.js

* Update contribution guide

* Adds inline sourcemaps generation to restore coverage

* nits
2018-07-02 23:30:14 -04:00
Florent Vilmart
3bcb5a0997 Ensure User ACL's are more flexible and secure #3588 (#4860)
* Fixes an issue that would let the beforeDelete be called when user has no access to the object

* Ensure we properly lock user

- Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey
- This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios

* nits

* Caps insufficient
2018-06-28 16:31:22 -04:00
Diamond Lewis
0fd8493929 Fix purging empty class (#4676)
* Fix purging empty class

* remove fit
2018-03-25 08:41:25 -05:00
Florent Vilmart
b754d51e8e chore(package): update jasmine to version 3.0.0 (#4553)
* chore(package): update jasmine to version 3.0.0

Closes #4547

* Fixes failing tests for jasmine 3.0

Starting 3.0, done(something) will fail

* Update tests so they dont leverage var, but let and const

With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var`

* Remove randomizer

* Use same adapter for PG tests, drop table to ensure the tests dont side effect
2018-02-17 09:55:30 -05:00
Florent Vilmart
9de4b8b2a7 Refactors configuration management (#4271)
* Adds flow types / Configuration interfaces

* Lets call it options

* Use a single interface to generate the configurations

* Translates options to definitions only if comments are set

* improves logic

* Moves objects around

* Fixes issue affecting logging of circular objects

* fixes undefined env

* Moves all defaults to defaults

* Adds back CLI defaults

* Restored defaults in commander.js

* Merge provided defaults and platform defaults

* Addresses visual nits

* Improves Config.js code

* Adds ability to pass the default value in trailing comments

* Load platform defaults from the definitions file

* proper default values on various options

* Adds ParseServer.start and server.start(options) as quick startup methods

* Moves creating liveQueryServer http into ParseServer.js

* removes dead code

* Adds tests to guarantee we can start a LQ Server from main module

* Fixes incorrect code regading liveQuery init port

* Start a http server for LQ if port is specified

* ensure we dont fail if config.port is not set

* Specify port

* ignore other path skipped in tests

* Adds test for custom middleware setting

* Refactors new Config into Config.get

- Hides AppCache from ParseServer.js, use Config.put which validates

* Extracts controller creation into Controllers/index.js

- This makes the ParseServer init way simpler

* Move serverURL inference into ParseServer

* review nits
2017-10-23 08:43:05 -04:00
greenkeeper[bot]
e94991b368 Update dependencies to enable Greenkeeper 🌴 (#3940)
* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* Fix indent issues with eslint 4.0

see http://eslint.org/docs/user-guide/migrating-to-4.0.0\#-the-indent-rule-is-more-strict
2017-06-20 09:15:26 -07:00
Arthur Cinader
4cb6e7d209 Add lint rule space-infix-ops (#3237)
Disallows: 1+1.  Must be 1 + 1.
2017-01-11 12:31:40 -08:00
Arthur Cinader
ca286b7108 Enable prefer-const lint rule (#3202) 2016-12-07 18:17:05 -05:00
Arthur Cinader
a270632570 More lint tweaking (#3164)
1. Add no space in paren rule
2. fix spec/eslintrc.json so it allow for inheriting from root rc.

Because the spce rc specified reccomended, it "turned off" all of the
rule tweaks in the root.  This fixes that.
2016-12-02 19:11:54 -05:00
Florent Vilmart
8c2c76dd26 Adds liniting into the workflow (#3082)
* initial linting of src

* fix indent to 2 spaces

* Removes unnecessary rules

* ignore spec folder for now

* Spec linting

* Fix spec indent

* nits

* nits

* no no-empty rule
2016-11-24 15:47:41 -05:00
Kulshekhar Kabra
78646a3e91 Enable API related tests for Postgres (#2970) 2016-10-31 12:11:21 -04:00
Michael Helvey
94178df4d2 Add functionName to invalid function error (#2963)
Currently in the logs if an invalid function is called the error
message just says "invalid function" which is decidedly unhelpful
when looking through server logs.  Now it will say
"Invalid function: "functionName""
2016-10-30 11:58:34 -04:00
Florent Vilmart
364604e181 Run Schema validations after beforeSave #2672 (#2677)
* Adds test to repro #2672

* Run schema validation after beforeSave is run

* Makes authData part of base _User object

* exclude flaky pg test
2016-09-09 14:41:03 -04:00
Florent Vilmart
9ab488b6a0 Postgres: $all, $and CLP and more (#2551)
* Adds passing tests

* Better containsAll implementation

* Full Geopoint support, fix inverted lat/lng

* Adds support for $and operator / PointerPermissions specs

* Fix issue updating CLPs on schema

* Extends query support

* Adds RestCreate to the specs

* Adds User specs

* Adds error handlers for failing tests

* nits

* Proper JSON update of AuthData

* fix for #1259 with PG

* Fix for Installations _PushStatus test

* Adds support for GlobalConfig

* Enables relations tests

* Exclude spec as legacy

* Makes corner case for 1 in GlobalConfig
2016-08-20 16:07:48 -04:00
Florent Vilmart
9ecb9a3595 Postgres: Operations, Hooks, OAuth login, Files support (#2528)
* Adds files related tests through fs-adapter with PG

* Schema deletions implementations

* Adds Hooks spec

* Fix test

* Adds support for containsAll (numbers and strings)

* Better support for deleteFields and deleteClass

* Recursive JSON update for authData

* Adds node_modules to travis cache

* Disable temporarily to make tests pass

* Adds _perishable_token support for _User class

* ignore when a table creation fails at init (table exists)

* Adds support for AddUnique and Remove

* PG 9.4 compatible functions

* Re-enable tests

* nit

* Better handling of schema creation race
2016-08-18 18:05:26 -04:00
Florent Vilmart
c0249283ac Advancements with postgres (#2510)
* Start DB runner from tests

* Connect GridstoreAdapter only when needed

* removes unused package

* better test errors reporting

* Adds support for __op.Delete

* Better test error reporting

* Makes sure all tests can run without crashing

* Use xdescribe to skip test suite

* Removes unused dependencies

* Let volatiles classes be created with PG on start

* Do not fail if class dont exist

* adds index.spec.js to the pg suite

* Use a new config each test to prevent side effects

* Enable EmailVerificationToken specs with pg

* Makes sure failure output is not cut

* Reduces number of ignored tests in ParseObject.spec

* Inspect reconfiguration errors

* Mark GlobalConfig is incompatible with PG

- Problem is with nested updates (param.prop = value)

* PG: Nested JSON queries and updates

- Adds support for nested json and . operator queries
- Adds debug support for PG adapter
- Adds loglevel support in helper

* Enable working specs in ParseUser

* Sets default logLevel in tests to undefined

* Adds File type support, retores purchaseValidation specs

* Adds support for updating jsonb objects

- Restores PushController tests

* Proper implementation of deleteByQuery and ORs

- Adds ParseInstallation spec to the test suite

* xit only failing tests

* Nit on ParseAPI spec

* add sorting operator

* properly bound order keys

* reverts describe_only_db behavior

* Enables passing tests

* Adds basic support for relations, upsertOneObject aliased to createObject

* progress on queries options

* Fix ACL update related problems

* Creates relation tables on class creation

* Adds Relation tests

* remove flaky tests

* use promises instead of CB

* disable flaky test

* nits

* Fixes on schema spec

- Next thing is to implemenet geopoint and files correctly

* fix failues

* Basic GeoPoint support

* Adds support for $nearSphere/$maxDistance geopoint queries

* enable passing tests

* drop tables afterEach for PG, clean up relation tables too

* Better initialization/dropTables
2016-08-15 16:48:39 -04:00
Florent Vilmart
2f1ee2186b Makes sure _acl is set as empty {} (#2495)
* regression test for #2465

* Makes sure _acl is set when locked down

- Fixes #2465
2016-08-12 13:15:55 -07:00
Florent Vilmart
fc3ebd0bd0 Style improvements (#2475)
* HooksRouter is enabled by default

* Adds middleswares on PromiseRouter, fixes #2410

* Move testing line to helper

* Modernize middlewares.js

* Moves DB uniqueness initialization to DBController, modernize

* Moves testing related code to spec folder

* remove unused _removeHook function

* Adds tests, docs for Analytics and improvements

* nit

* moves back TestUtils
2016-08-07 20:02:53 -07:00
Drew
ae36200d1f Disable tests that don't work in Postgres, and don't start a mongo for postgres tests (#2481)
* Disable tests that don't work in Postgres, and don't start a mongo for postgres tests

* Remove unnecessary chages

* remove more unnecessary chagnes
2016-08-07 22:21:01 -04:00
Florent Vilmart
8719afdc1b Parses correctly Parse.Files and Dates when sent to Cloud Code Functions (#2297)
* fix for #2294

* fail tests

* Makes sure dates are compatible with Parse.com CloudCode #2214

* Adds regression tests for #2204
2016-07-18 23:14:32 -07:00
Florent Vilmart
033bc317e6 Report validation errors with correct error code (#2299) 2016-07-18 23:03:43 -07:00
Drew
ab06055369 Postgres exclude failing tests (#2081)
* reload the right data

More passing postgres tests

Handle schema updates, and $in for non array columns

remove authdata from user and implement ensureUniqueness

Make some tests work, detect existing classes

Throw proper error for unique index violation

fix findOneAndUpdate

Support more types

support more type

Support boolean, fix _rperm/_wperm, add TODO

Support string types and also simplify tests

Move operator flattening into Parse Server and out of mongo adapters

Move authdata transform for create into Parse Server

Move authdata transforms completely in to Parse Server

Fix test setup

inline addSchema

Inject default schema to response from DB adapter

* Mark tests that don't work in Postgres

* Exclude one more test

* Exclude some more failing tests

* Exclude more tests
2016-06-17 12:59:16 -04:00
Drew
0ff35e18f0 Add more postgres support (#2080)
* reload the right data

More passing postgres tests

Handle schema updates, and $in for non array columns

remove authdata from user and implement ensureUniqueness

Make some tests work, detect existing classes

Throw proper error for unique index violation

* fix findOneAndUpdate
2016-06-16 15:39:05 -07:00
Drew
9ed3fcc536 Remove duplicate test 2016-06-15 17:23:29 -07:00
Drew Gross
452b737be4 WIP 2016-06-15 13:11:51 -07:00
Drew Gross
634d672ad1 passing another test 2016-06-15 13:11:51 -07:00
Drew Gross
803b9be97a Add unique indexing for username/email
WIP

Notes on how to upgrade to 2.3.0 safely

index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"

reconfigure username/email tests

Start dealing with test shittyness

most tests passing

Make specific server config for tests async

Fix more tests

Save callback to variable

undo

remove uses of _collection

reorder some params

reorder find() arguments

finishsh touching up argument order

Accept a database adapter as a parameter

First passing test with postgres!

Fix tests

Setup travis

sudo maybe?

use postgres username

reorder find() arguments

Build objects with default fields correctly

Don't tell adapter about ACL

WIP

Passing postgres test with user

Fix up createdAt, updatedAt, nad _hashed_password handling
2016-06-15 13:11:51 -07:00
Drew Gross
f75c8b3a4d index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"
reconfigure username/email tests

Fix broken cloud code

Save callback to variable

undo

Fix all tests where connections are left open after server closes.

Fix issues caused by missing gridstore adapter

remove uses of _collection

reorder find() arguments

Accept a database adapter as a parameter

sudo maybe?

use postgres username

reorder find() arguments

Build objects with default fields correctly

Don't tell adapter about ACL

WIP
2016-06-15 13:11:51 -07:00
Marco Cheung
b2a5092627 Endpoint for purging all objects in class (#2032)
* Endpoint for purging all objects in class

* Use deleteObjectsByQuery

* Standalone handling function and purge cache

* Change endpoint url
2016-06-14 15:52:49 -07:00
Drew
5518edc2a5 Postgres adapter (#2012)
* Remove adaptiveCollection

* Remove an adaptiveCollection use

* Remove an adaptiveCollection

* make adaptiveCollection private

* Remove collection from mongoadapter

* Move schema collection usage into mongo adapter

* stop relying on mongo format for removing join tables

* reduce usage of schemaCollection

* remove uses of _collection

* Move CLP setting into mongo adapter

* remove all uses of schemaCollection

* make schemaCollection private

* remove transform from schemaCollection

* rename some stuff

* Tweak paramaters and stuff

* reorder some params

* reorder find() arguments

* finishsh touching up argument order

* Accept a database adapter as a parameter

* First passing test with postgres!

* Actually use the provided className

* index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"

* Start dealing with test shittyness

* Make specific server config for tests async

* Fix email validation

* Fix broken cloud code

* Save callback to variable

* undo

* Fix tests

* Setup travis

* fix travis maybe

* try removing db user

* indentation?

* remove postgres version setting

* sudo maybe?

* use postgres username

* fix check for _PushStatus

* excludes

* remove db=mongo

* allow postgres to fail

* Fix allow failure

* postgres 9.4

* Remove mongo implementations and fix test

* Fix test leaving behind connections
2016-06-12 16:35:13 -07:00
Drew
7e868b2dcc Unique indexes (#1971)
* Add unique indexing

* Add unique indexing for username/email

* WIP

* Finish unique indexes

* Notes on how to upgrade to 2.3.0 safely

* index on unique-indexes: c454180 Revert "Log objects rather than JSON stringified objects (#1922)"

* reconfigure username/email tests

* Start dealing with test shittyness

* Remove tests for files that we are removing

* most tests passing

* fix failing test

* Make specific server config for tests async

* Fix more tests

* fix more tests

* Fix another test

* fix more tests

* Fix email validation

* move some stuff around

* Destroy server to ensure all connections are gone

* Fix broken cloud code

* Save callback to variable

* no need to delete non existant cloud

* undo

* Fix all tests where connections are left open after server closes.

* Fix issues caused by missing gridstore adapter

* Update guide for 2.3.0 and fix final tests

* use strict

* don't use features that won't work in node 4

* Fix syntax error

* Fix typos

* Add duplicate finding command

* Update 2.3.0.md
2016-06-10 20:27:21 -07:00
Jeremy Pease
c6c9c97b54 Allow custom error codes with response.error from Cloud Code functions and before/after hooks (#1955) 2016-06-01 10:28:06 -04:00
Drew
cd525802a6 Remove mongoFind and mostly remove adaptiveCollection (#1924)
* Use adapter.count

* use adapter.upsertOneObject

* Use adapter.deleteObjectsByQuery

* Use adapter.find

* use adapter.find

* Update tests to avoid mongoFind

* Fix a test to not use mongoFind

* Fix a test to not use mongoFind

* remove some mongoFind

* Remove some mongoFind

* Remove some mongoFind

* Remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* remove more mongoFind

* Restore update ios device token with duplicate device token to original

* remove a mongoFind

* remove a mongoFind

* formatting

* formatting

* remove a mongoFind

* remove a mongoFind

* remove a mongoFind

* kill mongoFind

* Fix tests

* Fix tests

* fix syntax

* Fix test
2016-05-28 12:25:09 -04:00
Madhav Bhagat
181b12771d Make beforeSave work when object is passed to success (#1937) 2016-05-28 12:21:22 -04:00
Drew Gross
74ee8613d8 Fix inner keys named _rperm, _wperm 2016-05-23 18:39:19 -07:00
Drew Gross
c928dcc118 Prevent untransforming inner object keys named _p_* 2016-05-23 18:38:48 -07:00
Drew Gross
9f149e6db5 Don't mess with inner object keys called _auth_data_* 2016-05-23 18:38:16 -07:00
Drew
614e1ac8e5 Move query logic into mongo (#1885)
* Move Parse Server logic into Parse Server and out of MongoAdapter

* Move untransforming up one level

* Make find() in MongoStorageAdapter

* Put nested object untransforming into it's own function

* Simplfy nested untransform

* Don't mess with inner object keys called _auth_data_*

* Prevent untransforming inner object keys named _p_*

* Fix inner keys named _rperm, _wperm

* Fix bugs with inner objects behaving strange when other fields have same name as key in specific circumstances

* remove params from untransform nested object

* Revert changes to find
2016-05-23 19:31:51 -04:00
Drew
b2183680be Refactor cloud code tests (#1837)
* Move cloud code tests

* Remove _removeHook calls that are no longer necessary

* Use Strict
2016-05-19 13:38:16 -07:00
Drew
4d4361451c Refactor MongoTransform.js (#1823)
* Split transformAtom into transfromTopLevelAtom and transformInteriorAtom

* Use single param for inArray and inObject

* Tidyness in transformKeyValue

* Add transformInteriorKeyValue

* Remove update from tranformInteriorKeyValue

* Split out transform update

* Move validation out of transfromUpdate

* Remove force paramater from transformTopLevelAtom throw error after if necessary

* Turn transformKeyValue into transfromKey since it is only used for that purpose

* Remove unnecessary stuff from transformKey

* convert transformKey to use parse format schema

* interior keys fixes

* Add test for interior keys with special names

* Correct validation of inner keys
2016-05-18 18:14:54 -07:00
Tyler Brock
1854928fe7 Add test to ensure you can set ACL in beforeSave (#1772) 2016-05-13 18:17:22 -07:00
Marco Cheung
19e7407f55 Return correct error when violating unique index (#1763) 2016-05-11 17:24:15 -07:00
Drew
e698f61a58 Handle null param in cloud code. Fixes #1472 (#1746) 2016-05-10 10:43:02 -07:00
Drew
957b5927b1 Ignore _RevoableSession "header" that is sent by JS SDK. Fixes #1548. (#1627) 2016-04-25 15:52:21 -04:00