1.0.2 • Published 1 year ago

@dmamontov/graphql-mesh-resolve-to-by-condition-transform v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Resolve To By Condition Transform for GraphQL Mesh

Resolve To By Condition Transform - is a transformer for GraphQL Mesh that adds a directive to enable the creation of relationships with pre- and post-conditions.

Installation

Before you can use the Resolve To By Condition Transform, you need to install it along with GraphQL Mesh if you haven't already done so. You can install these using npm or yarn.

npm install @dmamontov/graphql-mesh-resolve-to-by-condition-transform

or

yarn add @dmamontov/graphql-mesh-resolve-to-by-condition-transform

Configuration

Modifying tsconfig.json

To make TypeScript recognize the Resolve To By Condition Transform, you need to add an alias in your tsconfig.json.

Add the following paths configuration under the compilerOptions in your tsconfig.json file:

{
  "compilerOptions": {
    "paths": {
       "resolve-to-by": ["node_modules/@dmamontov/graphql-mesh-resolve-to-by-condition-transform"]
    }
  }
}

Adding the Transform to GraphQL Mesh

You need to include the Resolve To By Condition Transform in your GraphQL Mesh configuration file (usually .meshrc.yaml). Below is an example configuration that demonstrates how to use this transform:

transforms:
  - resolveToBy: []

additionalTypeDefs:
  - node_modules/@dmamontov/graphql-mesh-resolve-to-by-condition-transform/esm/resolve-to-by-directive.graphql

Conclusion

Remember, always test your configurations in a development environment before applying them in production to ensure that everything works as expected.