Skip to content

AppSyncResolver

Reference doc for the `sst.aws.AppSyncResolver` component.

The AppSyncResolver component is internally used by the AppSync component to add resolvers to AWS AppSync.

You’ll find this component returned by the addResolver method of the AppSync component.


Constructor

new AppSyncResolver(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.resolver

Type Resolver

The Amazon AppSync Resolver.

ResolverArgs

apiId

Type Input<string>

The AppSync GraphQL API ID.

code?

Type Input<string>

The function code that contains the request and response functions.

{
code: fs.readFileSync("functions.js")
}

dataSource?

Type Input<string>

The data source this resolver is using. This only applies for unit resolvers.

{
dataSource: "lambdaDS"
}

field

Type Input<string>

The field name from the schema defined.

functions?

Type Input<string[]>

The functions this resolver is using. This only applies for pipeline resolvers.

{
functions: ["myFunction1", "myFunction2"]
}

kind?

Type Input<unit | pipeline>

Default “unit”

The type of the resolver.

{
kind: "pipeline"
}

requestTemplate?

Type Input<string>

For unit resolvers, this is the request mapping template. And for pipeline resolvers, this is the before mapping template.

{
requestTemplate: `{
"version": "2017-02-28",
"operation": "Scan"
}`
}

responseTemplate?

Type Input<string>

For unit resolvers, this is the response mapping template. And for pipeline resolvers, this is the after mapping template.

{
responseTemplate: `{
"users": $utils.toJson($context.result.items)
}`
}

transform?

Type Object

Transform how this component creates its underlying resources.

transform.resolver?

Type ResolverArgs | (args: ResolverArgs, opts: ComponentResourceOptions, name: string) => void

Transform the AppSync Resolver resource.

type

Type Input<string>

The type name from the schema defined.