* Batch transaction boilerplate
* Refactoring transaction boilerplate
* Independent sessions test
* Transactions - partial
* Missing only one test
* All tests passing for mongo db
* Tests on Travis
* Transactions on postgres
* Fix travis to restart mongodb
* Remove mongodb service and keep only mongodb runner
* MongoDB service back
* Initialize replicaset
* Remove mongodb runner again
* Again only with mongodb-runner and removing cache
* Trying with pretest and posttest
* WiredTiger
* Pretest and posttest again
* Removing inexistent scripts
* wiredTiger
* One more attempt
* Trying another way to run mongodb-runner
* Fixing tests
* Include batch transaction on direct access
* Add tests to direct access
* Update ParseWebSocketServer.js
fix wss:// error by requiring 'ws' module, remove uws as it has been deprecated and removed from npm
* Update ParseWebSocketServer.js
* remove uws
* fix(package): update @parse/push-adapter to version 3.0.5
* chore(package): update lockfile package-lock.json
* Update flow-bin to the latest version 🚀 (#5853)
* chore(package): update flow-bin to version 0.104.0
* chore(package): update lockfile package-lock.json
* Update package.json
* Pin to 3.0.8
This PR empowers the Parse GraphQL API with custom user-defined schema. The developers can now write their own types, queries, and mutations, which will merged with the ones that are automatically generated. The new types are resolved by the application's cloud code functions.
Therefore, regarding https://github.com/parse-community/parse-server/issues/5777, this PR closes the cloud functions needs and also addresses the graphql customization topic. In my view, I think that this PR, together with https://github.com/parse-community/parse-server/pull/5782 and https://github.com/parse-community/parse-server/pull/5818, when merged, closes the issue.
How it works:
1. When initializing ParseGraphQLServer, now the developer can pass a custom schema that will be merged to the auto-generated one:
```
parseGraphQLServer = new ParseGraphQLServer(parseServer, {
graphQLPath: '/graphql',
graphQLCustomTypeDefs: gql`
extend type Query {
custom: Custom @namespace
}
type Custom {
hello: String @resolve
hello2: String @resolve(to: "hello")
userEcho(user: _UserFields!): _UserClass! @resolve
}
`,
});
```
Note:
- This PR includes a @namespace directive that can be used to the top level field of the nested queries and mutations (it basically just returns an empty object);
- This PR includes a @resolve directive that can be used to notify the Parse GraphQL Server to resolve that field using a cloud code function. The `to` argument specifies the function name. If the `to` argument is not passed, the Parse GraphQL Server will look for a function with the same name of the field;
- This PR allows creating custom types using the auto-generated ones as in `userEcho(user: _UserFields!): _UserClass! @resolve`;
- This PR allows to extend the auto-generated types, as in `extend type Query { ... }`.
2. Once the schema was set, you just need to write regular cloud code functions:
```
Parse.Cloud.define('hello', async () => {
return 'Hello world!';
});
Parse.Cloud.define('userEcho', async req => {
return req.params.user;
});
```
3. Now you are ready to play with your new custom api:
```
query {
custom {
hello
hello2
userEcho(user: { username: "somefolk" }) {
username
}
}
}
```
should return
```
{
"data": {
"custom": {
"hello": "Hello world!",
"hello2": "Hello world!",
"userEcho": {
"username": "somefolk"
}
}
}
}
```
* chore(package): update @babel/cli to version 7.5.5
* chore(package): update @babel/core to version 7.5.5
* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.5
* chore(package): update @babel/preset-env to version 7.5.5
* chore(package): update lockfile package-lock.json
* chore(package): update @babel/core to version 7.5.4
* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.4
* chore(package): update @babel/preset-env to version 7.5.4
* chore(package): update lockfile package-lock.json
* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.3
* chore(package): update @babel/preset-env to version 7.5.3
* chore(package): update lockfile package-lock.json
* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.2
* chore(package): update @babel/preset-env to version 7.5.2
* chore(package): update lockfile package-lock.json