graphql-claim-transformer
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

graphql-claim-transformer

Populate fields from identity claims.

Installation

npm install --save graphql-claim-transformer

How to use

Setup custom transformer

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

"transformers": [
    "graphql-claim-transformer"
]

Use @claim directive

Append @claim to target fields.

type Todo @model {
  id: ID!
  title: String!
  description: String
  foo: String @claim(name: "bar")
}

In the above example the create and update mutations will set the foo field to the value of the bar claim on the user identity object ($ctx.identity.claims.get("bar")).

Readme

Keywords

none

Package Sidebar

Install

npm i graphql-claim-transformer

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

8.7 kB

Total Files

9

Last publish

Collaborators

  • mnightingale