https://github.com/sudokar/cdk-appsync-typescript-resolver
AWS CDK construct to build AppSync JS resolvers using Typescript
https://github.com/sudokar/cdk-appsync-typescript-resolver
appsync aws-appsync aws-cdk cdk javascript resolver typescript
Last synced: 2 months ago
JSON representation
AWS CDK construct to build AppSync JS resolvers using Typescript
- Host: GitHub
- URL: https://github.com/sudokar/cdk-appsync-typescript-resolver
- Owner: sudokar
- License: apache-2.0
- Created: 2023-07-29T16:04:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-20T05:06:51.000Z (3 months ago)
- Last Synced: 2026-01-20T09:16:24.579Z (3 months ago)
- Topics: appsync, aws-appsync, aws-cdk, cdk, javascript, resolver, typescript
- Language: TypeScript
- Homepage: https://constructs.dev/packages/cdk-appsync-typescript-resolver/v/0.0.4?lang=typescript
- Size: 601 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cdk-appsync-typescript-resolver
[](https://www.npmjs.com/package/cdk-appsync-typescript-resolver)
[](https://app.codacy.com/gh/sudokar/cdk-appsync-typescript-resolver/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://github.com/sudokar/cdk-appsync-typescript-resolver/actions/workflows/release.yml)
[](https://github.com/sudokar/cdk-appsync-typescript-resolver/releases)
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/sudokar/nx-serverless)

[](https://gitpod.io/#https://github.com/sudokar/cdk-appsync-typescript-resolver)
Constructs to transpile and bundle Typescript to valid AWS Appsync's JS resolvers
[](https://constructs.dev/packages/cdk-appsync-typescript-resolver)
# ✨ Constructs
- [TypescriptUnitResolver](src%2Flib%2FJSExpressPipelineResolver.ts) - Unit resolver with typescript source
- [AppsyncTypescriptFunction](src%2Flib%2FAppsyncTypescriptFunction.ts) - Appsync function with typescript source
# 🚀 Usage
- TypescriptUnitResolver
```typescript
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
```typescript
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](https://the-guild.dev/graphql/codegen) to generate Typescript types from GraphQL schema(s) to use in resolvers
Checkout the demo project for examples [cdk-appsync-typescript-resolver-demo](https://github.com/sudokar/cdk-appsync-typescript-resolver-demo)
# References
[JavaScript resolvers overview](https://docs.aws.amazon.com/appsync/latest/devguide/resolver-reference-overview-js.html)
[Bundling, TypeScript, and source maps](https://docs.aws.amazon.com/appsync/latest/devguide/resolver-reference-overview-js.html#additional-utilities)
[GraphQL Code Generator](https://the-guild.dev/graphql/codegen)