Transpile and bundle Typescript to AWS Appsync JS function.
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
new AppsyncTypescriptFunction(scope: IConstruct, id: string, props: AppsyncTypescriptFunctionProps)| Name | Type | Description |
|---|---|---|
scope |
constructs.IConstruct |
No description. |
id |
string |
No description. |
props |
AppsyncTypescriptFunctionProps |
No description. |
- Type: constructs.IConstruct
- Type: string
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
with |
Applies one or more mixins to this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
public toString(): stringReturns a string representation of this construct.
public with(mixins: ...IMixin[]): IConstructApplies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
- Type: ...constructs.IMixin[]
The mixins to apply.
public applyRemovalPolicy(policy: RemovalPolicy): voidApply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
- Type: aws-cdk-lib.RemovalPolicy
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
fromAppsyncFunctionAttributes |
Import Appsync Function from arn. |
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
AppsyncTypescriptFunction.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
AppsyncTypescriptFunction.isOwnedResource(construct: IConstruct)Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
AppsyncTypescriptFunction.isResource(construct: IConstruct)Check whether the given construct is a Resource.
- Type: constructs.IConstruct
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'
AppsyncTypescriptFunction.fromAppsyncFunctionAttributes(scope: Construct, id: string, attrs: AppsyncFunctionAttributes)Import Appsync Function from arn.
- Type: constructs.Construct
- Type: string
- Type: aws-cdk-lib.aws_appsync.AppsyncFunctionAttributes
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
dataSource |
aws-cdk-lib.aws_appsync.BaseDataSource |
the data source of this AppSync Function. |
functionArn |
string |
the ARN of the AppSync function. |
functionId |
string |
the ID of the AppSync function. |
functionName |
string |
the name of this AppSync Function. |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
public readonly dataSource: BaseDataSource;- Type: aws-cdk-lib.aws_appsync.BaseDataSource
the data source of this AppSync Function.
public readonly functionArn: string;- Type: string
the ARN of the AppSync function.
public readonly functionId: string;- Type: string
the ID of the AppSync function.
public readonly functionName: string;- Type: string
the name of this AppSync Function.
Appsync's JS pipeline resolver with default bolierplate code using AppsyncTypescriptFunction construct.
import { TSExpressPipelineResolver } from 'cdk-appsync-typescript-resolver'
new TSExpressPipelineResolver(scope: IConstruct, id: string, props: TSExpressPipelineResolverProps)| Name | Type | Description |
|---|---|---|
scope |
constructs.IConstruct |
No description. |
id |
string |
No description. |
props |
TSExpressPipelineResolverProps |
No description. |
- Type: constructs.IConstruct
- Type: string
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
with |
Applies one or more mixins to this construct. |
public toString(): stringReturns a string representation of this construct.
public with(mixins: ...IMixin[]): IConstructApplies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
- Type: ...constructs.IMixin[]
The mixins to apply.
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
import { TSExpressPipelineResolver } from 'cdk-appsync-typescript-resolver'
TSExpressPipelineResolver.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
arn |
string |
the ARN of the resolver. |
- Deprecated: - Use {@link TypescriptUnitResolver } instead
public readonly node: Node;- Type: constructs.Node
The tree node.
- Deprecated: - Use {@link TypescriptUnitResolver } instead
public readonly arn: string;- Type: string
the ARN of the resolver.
import { TypescriptUnitResolver } from 'cdk-appsync-typescript-resolver'
new TypescriptUnitResolver(scope: IConstruct, id: string, props: TypescriptUnitResolverProps)| Name | Type | Description |
|---|---|---|
scope |
constructs.IConstruct |
No description. |
id |
string |
No description. |
props |
TypescriptUnitResolverProps |
No description. |
- Type: constructs.IConstruct
- Type: string
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
with |
Applies one or more mixins to this construct. |
public toString(): stringReturns a string representation of this construct.
public with(mixins: ...IMixin[]): IConstructApplies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
- Type: ...constructs.IMixin[]
The mixins to apply.
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
import { TypescriptUnitResolver } from 'cdk-appsync-typescript-resolver'
TypescriptUnitResolver.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
arn |
string |
the ARN of the resolver. |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly arn: string;- Type: string
the ARN of the resolver.
AppsyncTypescriptFunctionProps.
import { AppsyncTypescriptFunctionProps } from 'cdk-appsync-typescript-resolver'
const appsyncTypescriptFunctionProps: AppsyncTypescriptFunctionProps = { ... }| Name | Type | Description |
|---|---|---|
api |
aws-cdk-lib.aws_appsync.IGraphqlApi |
the GraphQL Api linked to this AppSync Function. |
dataSource |
aws-cdk-lib.aws_appsync.BaseDataSource |
the data source linked to this AppSync Function. |
name |
string |
the name of the AppSync Function. |
path |
string |
Path of typescript file that will be transpiled and bundled. |
description |
string |
the description for this AppSync Function. |
maxBatchSize |
number |
The maximum number of resolver request inputs that will be sent to a single AWS Lambda function in a BatchInvoke operation. |
replaceStrings |
{[ key: string ]: string} |
A map of replacement strings in the bundled code. |
requestMappingTemplate |
aws-cdk-lib.aws_appsync.MappingTemplate |
the request mapping template for the AppSync Function. |
responseMappingTemplate |
aws-cdk-lib.aws_appsync.MappingTemplate |
the response mapping template for the AppSync Function. |
sourceMap |
boolean |
Flag to enable or disable source maps in bundled code. |
public readonly api: IGraphqlApi;- Type: aws-cdk-lib.aws_appsync.IGraphqlApi
the GraphQL Api linked to this AppSync Function.
public readonly dataSource: BaseDataSource;- Type: aws-cdk-lib.aws_appsync.BaseDataSource
the data source linked to this AppSync Function.
public readonly name: string;- Type: string
the name of the AppSync Function.
public readonly path: string;- Type: string
Path of typescript file that will be transpiled and bundled.
public readonly description: string;- Type: string
- Default: no description
the description for this AppSync Function.
public readonly maxBatchSize: number;- Type: number
- Default: No max batch size
The maximum number of resolver request inputs that will be sent to a single AWS Lambda function in a BatchInvoke operation.
Can only be set when using LambdaDataSource.
public readonly replaceStrings: {[ key: string ]: string};- Type: {[ key: string ]: string}
A map of replacement strings in the bundled code.
e.g { ENV: "PROD" }
public readonly requestMappingTemplate: MappingTemplate;- Type: aws-cdk-lib.aws_appsync.MappingTemplate
- Default: no request mapping template
the request mapping template for the AppSync Function.
public readonly responseMappingTemplate: MappingTemplate;- Type: aws-cdk-lib.aws_appsync.MappingTemplate
- Default: no response mapping template
the response mapping template for the AppSync Function.
public readonly sourceMap: boolean;- Type: boolean
Flag to enable or disable source maps in bundled code.
defaults to false
TSExpressPipelineResolverProps.
import { TSExpressPipelineResolverProps } from 'cdk-appsync-typescript-resolver'
const tSExpressPipelineResolverProps: TSExpressPipelineResolverProps = { ... }| Name | Type | Description |
|---|---|---|
api |
aws-cdk-lib.aws_appsync.IGraphqlApi |
The API this resolver is attached to. |
fieldName |
string |
name of the GraphQL field in the given type this resolver is attached to. |
tsFunction |
AppsyncTypescriptFunction |
Instance of AppsyncTypescriptFunction construct. |
typeName |
string |
name of the GraphQL type this resolver is attached to. |
cachingConfig |
aws-cdk-lib.aws_appsync.CachingConfig |
The caching configuration for this resolver. |
dataSource |
aws-cdk-lib.aws_appsync.BaseDataSource |
The data source this resolver is using. |
maxBatchSize |
number |
The maximum number of elements per batch, when using batch invoke. |
public readonly api: IGraphqlApi;- Type: aws-cdk-lib.aws_appsync.IGraphqlApi
The API this resolver is attached to.
public readonly fieldName: string;- Type: string
name of the GraphQL field in the given type this resolver is attached to.
public readonly tsFunction: AppsyncTypescriptFunction;Instance of AppsyncTypescriptFunction construct.
public readonly typeName: string;- Type: string
name of the GraphQL type this resolver is attached to.
public readonly cachingConfig: CachingConfig;- Type: aws-cdk-lib.aws_appsync.CachingConfig
- Default: No caching configuration
The caching configuration for this resolver.
public readonly dataSource: BaseDataSource;- Type: aws-cdk-lib.aws_appsync.BaseDataSource
- Default: No datasource
The data source this resolver is using.
public readonly maxBatchSize: number;- Type: number
- Default: No max batch size
The maximum number of elements per batch, when using batch invoke.
TypescriptUnitResolverProps.
import { TypescriptUnitResolverProps } from 'cdk-appsync-typescript-resolver'
const typescriptUnitResolverProps: TypescriptUnitResolverProps = { ... }| Name | Type | Description |
|---|---|---|
api |
aws-cdk-lib.aws_appsync.IGraphqlApi |
The API this resolver is attached to. |
fieldName |
string |
name of the GraphQL field in the given type this resolver is attached to. |
path |
string |
Path of typescript file that will be transpiled and bundled. |
typeName |
string |
name of the GraphQL type this resolver is attached to. |
cachingConfig |
aws-cdk-lib.aws_appsync.CachingConfig |
The caching configuration for this resolver. |
dataSource |
aws-cdk-lib.aws_appsync.BaseDataSource |
The data source this resolver is using. |
maxBatchSize |
number |
The maximum number of elements per batch, when using batch invoke. |
replaceStrings |
{[ key: string ]: string} |
A map of replacement strings in the bundled code. |
sourceMap |
boolean |
Flag to enable or disable source maps in bundled code. |
public readonly api: IGraphqlApi;- Type: aws-cdk-lib.aws_appsync.IGraphqlApi
The API this resolver is attached to.
public readonly fieldName: string;- Type: string
name of the GraphQL field in the given type this resolver is attached to.
public readonly path: string;- Type: string
Path of typescript file that will be transpiled and bundled.
public readonly typeName: string;- Type: string
name of the GraphQL type this resolver is attached to.
public readonly cachingConfig: CachingConfig;- Type: aws-cdk-lib.aws_appsync.CachingConfig
- Default: No caching configuration
The caching configuration for this resolver.
public readonly dataSource: BaseDataSource;- Type: aws-cdk-lib.aws_appsync.BaseDataSource
- Default: No datasource
The data source this resolver is using.
public readonly maxBatchSize: number;- Type: number
- Default: No max batch size
The maximum number of elements per batch, when using batch invoke.
public readonly replaceStrings: {[ key: string ]: string};- Type: {[ key: string ]: string}
A map of replacement strings in the bundled code.
e.g { ENV: "PROD" }
public readonly sourceMap: boolean;- Type: boolean
Flag to enable or disable source maps in bundled code.
defaults to false