@fauna-labs/graphql-tool
v0.1.4
Published
Fauna GraphQL tool is an automation library that is used to easily add features such as `authentication`, `custom resolver (UDF)`, `sorting of subgraphs`, `fuzzy full-text search`, etc.
Readme
Fauna Labs
Fauna GraphQL tool is an automation library that is used to easily add features such as authentication, custom resolver (UDF), sorting of subgraphs, fuzzy full-text search, etc.
FGT works with the fauna-graphql-upload library as well as fauna-schema-migrate
Get Started
Define your GraphQL schema. @auth will define the model that is being used as membership model. Currently supports only 1 member model. @protected will define the rules for accessing a record.
type Comment @protected(membership: "User", rule: ["read", "write", "create"]) {
content: String!
talk: Talk!
user: User!
}
type User @auth(primary: "email") {
email: String! @unique
username: String
comments: [Comment!] @relation
}npm i @fauna-labs/graphql-tool fauna-gql-upload --save-devCreate a script to run the tool.
// package.json
"scripts": {
"fgu": "fgu",
"fgt": "fgt"
}In this example I am using the fauna-graphql-upload tool. Create a new .env file and add your admin key.
FGU_SECRET=<your key>Now run npm run fgt. Notice all resources are generated in the /fauna/ file in your project directory.
Run npm run fgu to update all resources in the cloud environment.
Features in Progress
- Fuzzy Search
@searchbledirective. Can be used as a full-text search as well. - Sorting and filtering
@sortabledirective [Priority] - Custom geolocation query
@geodirective. Based on community solution. [Priority] - Multiple auth model support
updated_atfield and custom sorting
