Constructs to transpile and bundle Typescript to valid AWS Appsync's JS resolvers
- TypescriptUnitResolver - Unit resolver with typescript source
- AppsyncTypescriptFunction - Appsync function with typescript source
- TypescriptUnitResolver
import { TypescriptUnitResolver } from 'cdk-appsync-typescript-resolver'
const resolver = new TypescriptUnitResolver(stack, "DemoResolver", {
api: new appsync.GraphqlApi(...),
typeName: "Query",
fieldName: "hello",
path: path.join(__dirname, "path", "to", "file.ts"),
sourceMap: true,
});
- AppsyncTypescriptFunction
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
...
const appsyncFunction = new AppsyncTypescriptFunction(stack, "TSDemoFunction", {
name: "TSDemoFunction",
api: new appsync.GraphqlApi(...),
path: path.join(__dirname, "path", "to", "file.ts"),
dataSource: new appsync.DynamoDbDataSource(...),
sourceMap: true,
});
Tip: Use GraphQL Code Generator to generate Typescript types from GraphQL schema(s) to use in resolvers
Checkout the demo project for examples cdk-appsync-typescript-resolver-demo