graphql-workspace-authorizer-transformer

0.9.5-alpha • Public • Published

🚒 Add workspaces based auth flow to all queries and mutations!

graphql-workspace-authorizer-transformer

Installation

npm install --save graphql-workspace-authorizer-transformer

How to use

Setup custom transformer

Edit amplify/backend/api/<YOUR_API>/transform.conf.json and append "graphql-workspace-authorizer-transformer" to the transformers field.

"transformers": [
    "graphql-workspace-authorizer-transformer"
]

Use @workspaceAuth directive

Append @workspaceAuth to target types and add the params.

type Todo @model @workspaceAuth(ownershipModelName:"Ownership", userField:"userID", indexName:"byUser", roleField:"role", allowedRoles:["Editor", "Admin", "Owner"], relatedWorkspaceIDField:"companyID") {
  id: ID!
  title: String!
  description: String
}

Contribute 🦸

Please feel free to create, comment and of course solve some of the issues. To get started you can also go for the easier issues marked with the good first issue label if you like.

Development

  • It is important to always make sure the version of the installed graphql dependency matches the graphql version the graphql-transformer-core depends on.

License

The MIT License

Credits

The graphql-workspace-authorizer-transformer library is maintained by Porter Metrics

Package Sidebar

Install

npm i graphql-workspace-authorizer-transformer

Weekly Downloads

2

Version

0.9.5-alpha

License

MIT

Unpacked Size

29.3 kB

Total Files

9

Last publish

Collaborators

  • alexisgo