Skip to content

Latest commit

 

History

History
1033 lines (636 loc) · 38.4 KB

File metadata and controls

1033 lines (636 loc) · 38.4 KB

API Reference

Constructs

AppsyncTypescriptFunction

Transpile and bundle Typescript to AWS Appsync JS function.

Initializers

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.

scopeRequired
  • Type: constructs.IConstruct

idRequired
  • Type: string

propsRequired

Methods

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.

toString
public toString(): string

Returns a string representation of this construct.

with
public with(mixins: ...IMixin[]): IConstruct

Applies 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.

mixinsRequired
  • Type: ...constructs.IMixin[]

The mixins to apply.


applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply 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).

policyRequired
  • Type: aws-cdk-lib.RemovalPolicy

Static Functions

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.

isConstruct
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.

xRequired
  • Type: any

Any object.


isOwnedResource
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'

AppsyncTypescriptFunction.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired
  • Type: constructs.IConstruct

isResource
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'

AppsyncTypescriptFunction.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired
  • Type: constructs.IConstruct

fromAppsyncFunctionAttributes
import { AppsyncTypescriptFunction } from 'cdk-appsync-typescript-resolver'

AppsyncTypescriptFunction.fromAppsyncFunctionAttributes(scope: Construct, id: string, attrs: AppsyncFunctionAttributes)

Import Appsync Function from arn.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

attrsRequired
  • Type: aws-cdk-lib.aws_appsync.AppsyncFunctionAttributes

Properties

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.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


envRequired
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.


stackRequired
public readonly stack: Stack;
  • Type: aws-cdk-lib.Stack

The stack in which this resource is defined.


dataSourceRequired
public readonly dataSource: BaseDataSource;
  • Type: aws-cdk-lib.aws_appsync.BaseDataSource

the data source of this AppSync Function.


functionArnRequired
public readonly functionArn: string;
  • Type: string

the ARN of the AppSync function.


functionIdRequired
public readonly functionId: string;
  • Type: string

the ID of the AppSync function.


functionNameRequired
public readonly functionName: string;
  • Type: string

the name of this AppSync Function.


TSExpressPipelineResolver

Appsync's JS pipeline resolver with default bolierplate code using AppsyncTypescriptFunction construct.

Initializers

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.

scopeRequired
  • Type: constructs.IConstruct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.
with Applies one or more mixins to this construct.

toString
public toString(): string

Returns a string representation of this construct.

with
public with(mixins: ...IMixin[]): IConstruct

Applies 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.

mixinsRequired
  • Type: ...constructs.IMixin[]

The mixins to apply.


Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
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.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
arn string the ARN of the resolver.

nodeRequired
  • Deprecated: - Use {@link TypescriptUnitResolver } instead
public readonly node: Node;
  • Type: constructs.Node

The tree node.


arnRequired
  • Deprecated: - Use {@link TypescriptUnitResolver } instead
public readonly arn: string;
  • Type: string

the ARN of the resolver.


TypescriptUnitResolver

Initializers

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.

scopeRequired
  • Type: constructs.IConstruct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.
with Applies one or more mixins to this construct.

toString
public toString(): string

Returns a string representation of this construct.

with
public with(mixins: ...IMixin[]): IConstruct

Applies 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.

mixinsRequired
  • Type: ...constructs.IMixin[]

The mixins to apply.


Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
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.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
arn string the ARN of the resolver.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


arnRequired
public readonly arn: string;
  • Type: string

the ARN of the resolver.


Structs

AppsyncTypescriptFunctionProps

AppsyncTypescriptFunctionProps.

Initializer

import { AppsyncTypescriptFunctionProps } from 'cdk-appsync-typescript-resolver'

const appsyncTypescriptFunctionProps: AppsyncTypescriptFunctionProps = { ... }

Properties

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.

apiRequired
public readonly api: IGraphqlApi;
  • Type: aws-cdk-lib.aws_appsync.IGraphqlApi

the GraphQL Api linked to this AppSync Function.


dataSourceRequired
public readonly dataSource: BaseDataSource;
  • Type: aws-cdk-lib.aws_appsync.BaseDataSource

the data source linked to this AppSync Function.


nameRequired
public readonly name: string;
  • Type: string

the name of the AppSync Function.


pathRequired
public readonly path: string;
  • Type: string

Path of typescript file that will be transpiled and bundled.


descriptionOptional
public readonly description: string;
  • Type: string
  • Default: no description

the description for this AppSync Function.


maxBatchSizeOptional
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.


replaceStringsOptional
public readonly replaceStrings: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

A map of replacement strings in the bundled code.

e.g { ENV: "PROD" }


requestMappingTemplateOptional
public readonly requestMappingTemplate: MappingTemplate;
  • Type: aws-cdk-lib.aws_appsync.MappingTemplate
  • Default: no request mapping template

the request mapping template for the AppSync Function.


responseMappingTemplateOptional
public readonly responseMappingTemplate: MappingTemplate;
  • Type: aws-cdk-lib.aws_appsync.MappingTemplate
  • Default: no response mapping template

the response mapping template for the AppSync Function.


sourceMapOptional
public readonly sourceMap: boolean;
  • Type: boolean

Flag to enable or disable source maps in bundled code.

defaults to false


TSExpressPipelineResolverProps

TSExpressPipelineResolverProps.

Initializer

import { TSExpressPipelineResolverProps } from 'cdk-appsync-typescript-resolver'

const tSExpressPipelineResolverProps: TSExpressPipelineResolverProps = { ... }

Properties

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.

apiRequired
public readonly api: IGraphqlApi;
  • Type: aws-cdk-lib.aws_appsync.IGraphqlApi

The API this resolver is attached to.


fieldNameRequired
public readonly fieldName: string;
  • Type: string

name of the GraphQL field in the given type this resolver is attached to.


tsFunctionRequired
public readonly tsFunction: AppsyncTypescriptFunction;

Instance of AppsyncTypescriptFunction construct.


typeNameRequired
public readonly typeName: string;
  • Type: string

name of the GraphQL type this resolver is attached to.


cachingConfigOptional
public readonly cachingConfig: CachingConfig;
  • Type: aws-cdk-lib.aws_appsync.CachingConfig
  • Default: No caching configuration

The caching configuration for this resolver.


dataSourceOptional
public readonly dataSource: BaseDataSource;
  • Type: aws-cdk-lib.aws_appsync.BaseDataSource
  • Default: No datasource

The data source this resolver is using.


maxBatchSizeOptional
public readonly maxBatchSize: number;
  • Type: number
  • Default: No max batch size

The maximum number of elements per batch, when using batch invoke.


TypescriptUnitResolverProps

TypescriptUnitResolverProps.

Initializer

import { TypescriptUnitResolverProps } from 'cdk-appsync-typescript-resolver'

const typescriptUnitResolverProps: TypescriptUnitResolverProps = { ... }

Properties

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.

apiRequired
public readonly api: IGraphqlApi;
  • Type: aws-cdk-lib.aws_appsync.IGraphqlApi

The API this resolver is attached to.


fieldNameRequired
public readonly fieldName: string;
  • Type: string

name of the GraphQL field in the given type this resolver is attached to.


pathRequired
public readonly path: string;
  • Type: string

Path of typescript file that will be transpiled and bundled.


typeNameRequired
public readonly typeName: string;
  • Type: string

name of the GraphQL type this resolver is attached to.


cachingConfigOptional
public readonly cachingConfig: CachingConfig;
  • Type: aws-cdk-lib.aws_appsync.CachingConfig
  • Default: No caching configuration

The caching configuration for this resolver.


dataSourceOptional
public readonly dataSource: BaseDataSource;
  • Type: aws-cdk-lib.aws_appsync.BaseDataSource
  • Default: No datasource

The data source this resolver is using.


maxBatchSizeOptional
public readonly maxBatchSize: number;
  • Type: number
  • Default: No max batch size

The maximum number of elements per batch, when using batch invoke.


replaceStringsOptional
public readonly replaceStrings: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

A map of replacement strings in the bundled code.

e.g { ENV: "PROD" }


sourceMapOptional
public readonly sourceMap: boolean;
  • Type: boolean

Flag to enable or disable source maps in bundled code.

defaults to false