Gathering detailed insights and metrics for @aws-amplify/graphql-api-construct
Gathering detailed insights and metrics for @aws-amplify/graphql-api-construct
Gathering detailed insights and metrics for @aws-amplify/graphql-api-construct
Gathering detailed insights and metrics for @aws-amplify/graphql-api-construct
@aws-amplify/data-construct
AppSync GraphQL Api Construct using Amplify GraphQL Transformer - Aliased to use `Data` name scheme.
@aws-amplify/graphql-construct-alpha
AppSync GraphQL Api Construct using Amplify GraphQL Transformer.
agqlac
AppSync GraphQL Api Construct using Amplify GraphQL Transformer.
amplify-graphql-api-cdk-typesense-transformer
Typesense transformer for AWS AppSync to use with AmplifyGraphqlApi construct
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
npm install @aws-amplify/graphql-api-construct
Typescript
Module System
Node Version
NPM Version
@aws-amplify/graphql-api-construct@1.16.3 @aws-amplify/graphql-api-construct@1.20.3
Updated on Jun 17, 2025
@aws-amplify/graphql-api-construct@1.20.2, @aws-amplify/data-construct@1.16.2
Updated on Jun 10, 2025
@aws-amplify/graphql-api-construct@1.20.1, @aws-amplify/data-construct@1.16.1
Updated on Apr 17, 2025
@aws-amplify/graphql-api-construct@1.20.0, @aws-amplify/data-construct@1.16.0
Updated on Apr 09, 2025
Amplify API Category 5.15.0
Updated on Apr 07, 2025
Amplify API Category 5.14.2
Updated on Mar 18, 2025
TypeScript (97.95%)
JavaScript (1.33%)
Shell (0.56%)
Python (0.14%)
HTML (0.02%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
92 Stars
8,079 Commits
87 Forks
46 Watchers
141 Branches
150 Contributors
Updated on Jul 13, 2025
Latest Version
1.20.2
Package Id
@aws-amplify/graphql-api-construct@1.20.2
Unpacked Size
85.22 MB
Size
47.50 MB
File Count
19,890
NPM Version
lerna/5.6.2/node@v20.9.0+x64 (linux)
Node Version
20.9.0
Published on
Jun 09, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
126
2
This package vends an L3 CDK Construct wrapping the behavior of the Amplify GraphQL Transformer. This enables quick development and interation of AppSync APIs which support the Amplify GraphQL Directives. For more information on schema modeling in GraphQL, please refer to the amplify developer docs.
The primary way to use this construct is to invoke it with a provided schema (either as an inline graphql string, or as one or more appsync.SchemaFile
) objects, and with authorization config provided. There are 5 supported methods for authorization of an AppSync API, all of which are supported by this construct. For more information on authorization rule definitions in Amplify, refer to the authorization docs. Note: currently at least one authorization rule is required, and if multiple are specified, a defaultAuthorizationMode
must be specified on the api as well. Specified authorization modes must be a superset of those configured in the graphql schema.
In this example, we create a single model, which will use user pool
auth in order to allow logged in users to create and manage their own todos
privately.
We create a cdk App and Stack, though you may be deploying this to a custom stack, this is purely illustrative for a concise demo.
We then wire this through to import a user pool which was already deployed (creating and deploying is out of scope for this example).
1import { App, Stack } from 'aws-cdk-lib'; 2import { UserPool } from 'aws-cdk-lib/aws-cognito'; 3import { AmplifyGraphqlApi, AmplifyGraphqlDefinition } from '@aws-amplify/graphql-api-construct'; 4 5const app = new App(); 6const stack = new Stack(app, 'TodoStack'); 7 8new AmplifyGraphqlApi(stack, 'TodoApp', { 9 definition: AmplifyGraphqlDefinition.fromString(/* GraphQL */ ` 10 type Todo @model @auth(rules: [{ allow: owner }]) { 11 description: String! 12 completed: Boolean 13 } 14 `), 15 authorizationModes: { 16 userPoolConfig: { 17 userPool: UserPool.fromUserPoolId(stack, 'ImportedUserPool', '<YOUR_USER_POOL_ID>'), 18 }, 19 }, 20});
In this example, we create a two related models, which will use which logged in users in the 'Author' and 'Admin' user groups will have full access to, and customers requesting with api key will only have read permissions on.
1import { App, Stack } from 'aws-cdk-lib'; 2import { UserPool } from 'aws-cdk-lib/aws-cognito'; 3import { AmplifyGraphqlApi, AmplifyGraphqlDefinition } from '@aws-amplify/graphql-api-construct'; 4 5const app = new App(); 6const stack = new Stack(app, 'BlogStack'); 7 8new AmplifyGraphqlApi(stack, 'BlogApp', { 9 definition: AmplifyGraphqlDefinition.fromString(/* GraphQL */ ` 10 type Blog @model @auth(rules: [{ allow: public, operations: [read] }, { allow: groups, groups: ["Author", "Admin"] }]) { 11 title: String! 12 description: String 13 posts: [Post] @hasMany 14 } 15 16 type Post @model @auth(rules: [{ allow: public, operations: [read] }, { allow: groups, groups: ["Author", "Admin"] }]) { 17 title: String! 18 content: [String] 19 blog: Blog @belongsTo 20 } 21 `), 22 authorizationModes: { 23 defaultAuthorizationMode: 'API_KEY', 24 apiKeyConfig: { 25 description: 'Api Key for public access', 26 expires: cdk.Duration.days(7), 27 }, 28 userPoolConfig: { 29 userPool: UserPool.fromUserPoolId(stack, 'ImportedUserPool', '<YOUR_USER_POOL_ID>'), 30 }, 31 }, 32});
In this example, we import the schema definition itself from one or more local files, rather than an inline graphql string.
1# todo.graphql 2type Todo @model @auth(rules: [{ allow: owner }]) { 3 content: String! 4 done: Boolean 5}
1# blog.graphql 2type Blog @model @auth(rules: [{ allow: owner }, { allow: public, operations: [read] }]) { 3 title: String! 4 description: String 5 posts: [Post] @hasMany 6} 7 8type Post @model @auth(rules: [{ allow: owner }, { allow: public, operations: [read] }]) { 9 title: String! 10 content: [String] 11 blog: Blog @belongsTo 12}
1// app.ts 2import { App, Stack } from 'aws-cdk-lib'; 3import { UserPool } from 'aws-cdk-lib/aws-cognito'; 4import { AmplifyGraphqlApi, AmplifyGraphqlDefinition } from '@aws-amplify/graphql-api-construct'; 5 6const app = new App(); 7const stack = new Stack(app, 'MultiFileStack'); 8 9new AmplifyGraphqlApi(stack, 'MultiFileDefinition', { 10 definition: AmplifyGraphqlDefinition.fromFiles(path.join(__dirname, 'todo.graphql'), path.join(__dirname, 'blog.graphql')), 11 authorizationModes: { 12 defaultAuthorizationMode: 'API_KEY', 13 apiKeyConfig: { 14 description: 'Api Key for public access', 15 expires: cdk.Duration.days(7), 16 }, 17 userPoolConfig: { 18 userPool: UserPool.fromUserPoolId(stack, 'ImportedUserPool', '<YOUR_USER_POOL_ID>'), 19 }, 20 }, 21});
L3 Construct which invokes the Amplify Transformer Pattern over an input Graphql Schema.
This can be used to quickly define appsync apis which support full CRUD+List and Subscriptions, relationships, auth, search over data, the ability to inject custom business logic and query/mutation operations, and connect to ML services.
For more information, refer to the docs links below: Data Modeling - https://docs.amplify.aws/cli/graphql/data-modeling/ Authorization - https://docs.amplify.aws/cli/graphql/authorization-rules/ Custom Business Logic - https://docs.amplify.aws/cli/graphql/custom-business-logic/ Search - https://docs.amplify.aws/cli/graphql/search-and-result-aggregations/ ML Services - https://docs.amplify.aws/cli/graphql/connect-to-machine-learning-services/
For a full reference of the supported custom graphql directives - https://docs.amplify.aws/cli/graphql/directives-reference/
The output of this construct is a mapping of L2 or L1 resources generated by the transformer, which generally follow the access pattern
1 const api = new AmplifyGraphQlApi(this, 'api', { <params> }); 2 // Access L2 resources under `.resources` 3 api.resources.tables["Todo"].tableArn; 4 5 // Access L1 resources under `.resources.cfnResources` 6 api.resources.cfnResources.cfnGraphqlApi.xrayEnabled = true; 7 Object.values(api.resources.cfnResources.cfnTables).forEach(table => { 8 table.pointInTimeRecoverySpecification = { pointInTimeRecoveryEnabled: false }; 9 });
resources.<ResourceType>.<ResourceName>
- you can then perform any CDK action on these resulting resoureces.
1import { AmplifyGraphqlApi } from '@aws-amplify/graphql-api-construct' 2 3new AmplifyGraphqlApi(scope: Construct, id: string, props: AmplifyGraphqlApiProps)
Name | Type | Description |
---|---|---|
scope | constructs.Construct | the scope to create this construct within. |
id | string | the id to use for this api. |
props | AmplifyGraphqlApiProps | the properties used to configure the generated api. |
scope
Required the scope to create this construct within.
id
Required the id to use for this api.
props
Required the properties used to configure the generated api.
Name | Description |
---|---|
toString | Returns a string representation of this construct. |
addDynamoDbDataSource | Add a new DynamoDB data source to this API. |
addElasticsearchDataSource | Add a new elasticsearch data source to this API. |
addEventBridgeDataSource | Add an EventBridge data source to this api. |
addFunction | Add an appsync function to the api. |
addHttpDataSource | Add a new http data source to this API. |
addLambdaDataSource | Add a new Lambda data source to this API. |
addNoneDataSource | Add a new dummy data source to this API. |
addOpenSearchDataSource | dd a new OpenSearch data source to this API. |
addRdsDataSource | Add a new Rds data source to this API. |
addResolver | Add a resolver to the api. |
toString
1public toString(): string
Returns a string representation of this construct.
addDynamoDbDataSource
1public addDynamoDbDataSource(id: string, table: ITable, options?: DataSourceOptions): DynamoDbDataSource
Add a new DynamoDB data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
table
Required The DynamoDB table backing this data source.
options
Optional The optional configuration for this data source.
addElasticsearchDataSource
1public addElasticsearchDataSource(id: string, domain: IDomain, options?: DataSourceOptions): ElasticsearchDataSource
Add a new elasticsearch data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
domain
Required The elasticsearch domain for this data source.
options
Optional The optional configuration for this data source.
addEventBridgeDataSource
1public addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: DataSourceOptions): EventBridgeDataSource
Add an EventBridge data source to this api.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
eventBus
Required The EventBridge EventBus on which to put events.
options
Optional The optional configuration for this data source.
addFunction
1public addFunction(id: string, props: AddFunctionProps): AppsyncFunction
Add an appsync function to the api.
id
Required the function's id.
props
Required addHttpDataSource
1public addHttpDataSource(id: string, endpoint: string, options?: HttpDataSourceOptions): HttpDataSource
Add a new http data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
endpoint
Required The http endpoint.
options
Optional The optional configuration for this data source.
addLambdaDataSource
1public addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: DataSourceOptions): LambdaDataSource
Add a new Lambda data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
lambdaFunction
Required The Lambda function to call to interact with this data source.
options
Optional The optional configuration for this data source.
addNoneDataSource
1public addNoneDataSource(id: string, options?: DataSourceOptions): NoneDataSource
Add a new dummy data source to this API.
This is a proxy method to the L2 GraphqlApi Construct. Useful for pipeline resolvers and for backend changes that don't require a data source.
id
Required The data source's id.
options
Optional The optional configuration for this data source.
addOpenSearchDataSource
1public addOpenSearchDataSource(id: string, domain: IDomain, options?: DataSourceOptions): OpenSearchDataSource
dd a new OpenSearch data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
domain
Required The OpenSearch domain for this data source.
options
Optional The optional configuration for this data source.
addRdsDataSource
1public addRdsDataSource(id: string, serverlessCluster: IServerlessCluster, secretStore: ISecret, databaseName?: string, options?: DataSourceOptions): RdsDataSource
Add a new Rds data source to this API.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The data source's id.
serverlessCluster
Required The serverless cluster to interact with this data source.
secretStore
Required The secret store that contains the username and password for the serverless cluster.
databaseName
Optional The optional name of the database to use within the cluster.
options
Optional The optional configuration for this data source.
addResolver
1public addResolver(id: string, props: ExtendedResolverProps): Resolver
Add a resolver to the api.
This is a proxy method to the L2 GraphqlApi Construct.
id
Required The resolver's id.
props
Required the resolver properties.
Name | Description |
---|---|
isConstruct | Checks if x is a construct. |
isConstruct
1import { AmplifyGraphqlApi } from '@aws-amplify/graphql-api-construct' 2 3AmplifyGraphqlApi.isConstruct(x: any)
Checks if x
is a construct.
x
Required Any object.
Name | Type | Description |
---|---|---|
node | constructs.Node | The tree node. |
apiId | string | Generated Api Id. |
generatedFunctionSlots | MutationFunctionSlot | QueryFunctionSlot | SubscriptionFunctionSlot[] | Resolvers generated by the transform process, persisted on the side in order to facilitate pulling a manifest for the purposes of inspecting and producing overrides. |
graphqlUrl | string | Graphql URL For the generated API. |
realtimeUrl | string | Realtime URL For the generated API. |
resources | AmplifyGraphqlApiResources | Generated L1 and L2 CDK resources. |
apiKey | string | Generated Api Key if generated. |
node
Required 1public readonly node: Node;
The tree node.
apiId
Required 1public readonly apiId: string;
Generated Api Id.
May be a CDK Token.
generatedFunctionSlots
Required 1public readonly generatedFunctionSlots: MutationFunctionSlot | QueryFunctionSlot | SubscriptionFunctionSlot[];
Resolvers generated by the transform process, persisted on the side in order to facilitate pulling a manifest for the purposes of inspecting and producing overrides.
graphqlUrl
Required 1public readonly graphqlUrl: string;
Graphql URL For the generated API.
May be a CDK Token.
realtimeUrl
Required 1public readonly realtimeUrl: string;
Realtime URL For the generated API.
May be a CDK Token.
resources
Required 1public readonly resources: AmplifyGraphqlApiResources;
Generated L1 and L2 CDK resources.
apiKey
Optional 1public readonly apiKey: string;
Generated Api Key if generated.
May be a CDK Token.
Input type properties when adding a new appsync.AppsyncFunction to the generated API. This is equivalent to the Omit<appsync.AppsyncFunctionProps, 'api'>.
1import { AddFunctionProps } from '@aws-amplify/graphql-api-construct' 2 3const addFunctionProps: AddFunctionProps = { ... }
Name | Type | Description |
---|---|---|
dataSource | aws-cdk-lib.aws_appsync.BaseDataSource | the data source linked to this AppSync Function. |
name | string | the name of the AppSync Function. |
code | aws-cdk-lib.aws_appsync.Code | The function code. |
description | string | the description for this AppSync Function. |
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. |
runtime | aws-cdk-lib.aws_appsync.FunctionRuntime | The functions runtime. |
dataSource
Required 1public readonly dataSource: BaseDataSource;
the data source linked to this AppSync Function.
name
Required 1public readonly name: string;
the name of the AppSync Function.
code
Optional 1public readonly code: Code;
The function code.
description
Optional 1public readonly description: string;
the description for this AppSync Function.
requestMappingTemplate
Optional 1public readonly requestMappingTemplate: MappingTemplate;
the request mapping template for the AppSync Function.
responseMappingTemplate
Optional 1public readonly responseMappingTemplate: MappingTemplate;
the response mapping template for the AppSync Function.
runtime
Optional 1public readonly runtime: FunctionRuntime;
The functions runtime.
Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
1import { AmplifyDynamoDbModelDataSourceStrategy } from '@aws-amplify/graphql-api-construct' 2 3const amplifyDynamoDbModelDataSourceStrategy: AmplifyDynamoDbModelDataSourceStrategy = { ... }
Name | Type | Description |
---|---|---|
dbType | string | No description. |
provisionStrategy | string | No description. |
dbType
Required 1public readonly dbType: string;
provisionStrategy
Required 1public readonly provisionStrategy: string;
L1 CDK resources from the Api which were generated as part of the transform.
These are potentially stored under nested stacks, but presented organized by type instead.
1import { AmplifyGraphqlApiCfnResources } from '@aws-amplify/graphql-api-construct' 2 3const amplifyGraphqlApiCfnResources: AmplifyGraphqlApiCfnResources = { ... }
Name | Type | Description |
---|---|---|
additionalCfnResources | {[ key: string ]: aws-cdk-lib.CfnResource} | Remaining L1 resources generated, keyed by logicalId. |
amplifyDynamoDbTables | {[ key: string ]: AmplifyDynamoDbTableWrapper} | The Generated Amplify DynamoDb Table L1 resource wrapper, keyed by model type name. |
cfnDataSources | {[ key: string ]: aws-cdk-lib.aws_appsync.CfnDataSource} | The Generated AppSync DataSource L1 Resources, keyed by logicalId. |
cfnFunctionConfigurations | {[ key: string ]: aws-cdk-lib.aws_appsync.CfnFunctionConfiguration} | The Generated AppSync Function L1 Resources, keyed by logicalId. |
cfnFunctions | {[ key: string ]: aws-cdk-lib.aws_lambda.CfnFunction} | The Generated Lambda Function L1 Resources, keyed by function name. |
cfnGraphqlApi | aws-cdk-lib.aws_appsync.CfnGraphQLApi | The Generated AppSync Api L1 Resource. |
cfnGraphqlSchema | aws-cdk-lib.aws_appsync.CfnGraphQLSchema | The Generated AppSync Schema L1 Resource. |
cfnResolvers | {[ key: string ]: aws-cdk-lib.aws_appsync.CfnResolver} | The Generated AppSync Resolver L1 Resources, keyed by logicalId. |
cfnRoles | {[ key: string ]: aws-cdk-lib.aws_iam.CfnRole} | The Generated IAM Role L1 Resources, keyed by logicalId. |
cfnTables | {[ key: string ]: aws-cdk-lib.aws_dynamodb.CfnTable} | The Generated DynamoDB Table L1 Resources, keyed by logicalId. |
cfnApiKey | aws-cdk-lib.aws_appsync.CfnApiKey | The Generated AppSync Api Key L1 Resource. |
additionalCfnResources
Required 1public readonly additionalCfnResources: {[ key: string ]: CfnResource};
Remaining L1 resources generated, keyed by logicalId.
amplifyDynamoDbTables
Required 1public readonly amplifyDynamoDbTables: {[ key: string ]: AmplifyDynamoDbTableWrapper};
The Generated Amplify DynamoDb Table L1 resource wrapper, keyed by model type name.
cfnDataSources
Required 1public readonly cfnDataSources: {[ key: string ]: CfnDataSource};
The Generated AppSync DataSource L1 Resources, keyed by logicalId.
cfnFunctionConfigurations
Required 1public readonly cfnFunctionConfigurations: {[ key: string ]: CfnFunctionConfiguration};
The Generated AppSync Function L1 Resources, keyed by logicalId.
cfnFunctions
Required 1public readonly cfnFunctions: {[ key: string ]: CfnFunction};
The Generated Lambda Function L1 Resources, keyed by function name.
cfnGraphqlApi
Required 1public readonly cfnGraphqlApi: CfnGraphQLApi;
The Generated AppSync Api L1 Resource.
cfnGraphqlSchema
Required 1public readonly cfnGraphqlSchema: CfnGraphQLSchema;
The Generated AppSync Schema L1 Resource.
cfnResolvers
Required 1public readonly cfnResolvers: {[ key: string ]: CfnResolver};
The Generated AppSync Resolver L1 Resources, keyed by logicalId.
cfnRoles
Required 1public readonly cfnRoles: {[ key: string ]: CfnRole};
The Generated IAM Role L1 Resources, keyed by logicalId.
cfnTables
Required 1public readonly cfnTables: {[ key: string ]: CfnTable};
The Generated DynamoDB Table L1 Resources, keyed by logicalId.
cfnApiKey
Optional 1public readonly cfnApiKey: CfnApiKey;
The Generated AppSync Api Key L1 Resource.
Input props for the AmplifyGraphqlApi construct.
Specifies what the input to transform into an Api, and configurations for the transformation process.
1import { AmplifyGraphqlApiProps } from '@aws-amplify/graphql-api-construct' 2 3const amplifyGraphqlApiProps: AmplifyGraphqlApiProps = { ... }
Name | Type | Description |
---|---|---|
authorizationModes | AuthorizationModes | Required auth modes for the Api. |
definition | IAmplifyGraphqlDefinition | The definition to transform in a full Api. |
apiName | string | Name to be used for the AppSync Api. |
conflictResolution | ConflictResolution | Configure conflict resolution on the Api, which is required to enable DataStore Api functionality. |
dataStoreConfiguration | DataStoreConfiguration | Configure DataStore conflict resolution on the Api. |
disableOutputStorage | boolean | Disables storing construct output. |
functionNameMap | {[ key: string ]: aws-cdk-lib.aws_lambda.IFunction} | Lambda functions referenced in the definitions's. |
functionSlots | MutationFunctionSlot | QueryFunctionSlot | SubscriptionFunctionSlot[] | Overrides for a given slot in the generated resolver pipelines. |
outputStorageStrategy | IBackendOutputStorageStrategy | Strategy to store construct outputs. |
predictionsBucket | aws-cdk-lib.aws_s3.IBucket | If using predictions, a bucket must be provided which will be used to search for assets. |
stackMappings | {[ key: string ]: string} | StackMappings override the assigned nested stack on a per-resource basis. |
transformerPlugins | any[] | Provide a list of additional custom transformers which are injected into the transform process. |
translationBehavior | PartialTranslationBehavior | This replaces feature flags from the Api construct, for general information on what these parameters do, refer to https://docs.amplify.aws/cli/reference/feature-flags/#graphQLTransformer. |
authorizationModes
Required 1public readonly authorizationModes: AuthorizationModes;
Required auth modes for the Api.
This object must be a superset of the configured auth providers in the Api definition. For more information, refer to https://docs.amplify.aws/cli/graphql/authorization-rules/
definition
Required 1public readonly definition: IAmplifyGraphqlDefinition;
The definition to transform in a full Api.
Can be constructed via the AmplifyGraphqlDefinition class.
apiName
Optional 1public readonly apiName: string;
Name to be used for the AppSync Api.
Default: construct id.
conflictResolution
1public readonly conflictResolution: ConflictResolution;
Configure conflict resolution on the Api, which is required to enable DataStore Api functionality.
For more information, refer to https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/
dataStoreConfiguration
Optional 1public readonly dataStoreConfiguration: DataStoreConfiguration;
Configure DataStore conflict resolution on the Api.
Conflict resolution is required to enable DataStore Api functionality. For more information, refer to https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/
disableOutputStorage
Optional 1public readonly disableOutputStorage: boolean;
Disables storing construct output.
Output storage should be disabled when creating multiple GraphQL APIs in a single CDK synthesis. outputStorageStrategy will be ignored if this is set to true.
functionNameMap
Optional 1public readonly functionNameMap: {[ key: string ]: IFunction};
Lambda functions referenced in the definitions's.
functionSlots
Optional 1public readonly functionSlots: MutationFunctionSlot | QueryFunctionSlot | SubscriptionFunctionSlot[];
Overrides for a given slot in the generated resolver pipelines.
For more information about what slots are available, refer to https://docs.amplify.aws/cli/graphql/custom-business-logic/#override-amplify-generated-resolvers.
outputStorageStrategy
Optional 1public readonly outputStorageStrategy: IBackendOutputStorageStrategy;
Strategy to store construct outputs.
If no outputStorageStrategey is provided a default strategy will be used.
predictionsBucket
Optional 1public readonly predictionsBucket: IBucket;
If using predictions, a bucket must be provided which will be used to search for assets.
stackMappings
Optional 1public readonly stackMappings: {[ key: string ]: string};
StackMappings override the assigned nested stack on a per-resource basis.
Only applies to resolvers, and takes the form
{
transformerPlugins
Optional 1public readonly transformerPlugins: any[];
Provide a list of additional custom transformers which are injected into the transform process.
These custom transformers must be implemented with aws-cdk-lib >=2.80.0, and
translationBehavior
Optional 1public readonly translationBehavior: PartialTranslationBehavior;
This replaces feature flags from the Api construct, for general information on what these parameters do, refer to https://docs.amplify.aws/cli/reference/feature-flags/#graphQLTransformer.
Accessible resources from the Api which were generated as part of the transform.
These are potentially stored under nested stacks, but presented organized by type instead.
1import { AmplifyGraphqlApiResources } from '@aws-amplify/graphql-api-construct' 2 3const amplifyGraphqlApiResources: AmplifyGraphqlApiResources = { ... }
Name | Type | Description |
---|---|---|
cfnResources | AmplifyGraphqlApiCfnResources | L1 Cfn Resources, for when dipping down a level of abstraction is desirable. |
functions | {[ key: string ]: aws-cdk-lib.aws_lambda.IFunction} | The Generated Lambda Function L1 Resources, keyed by function name. |
graphqlApi | aws-cdk-lib.aws_appsync.IGraphqlApi | The Generated AppSync Api L2 Resource, includes the Schema. |
nestedStacks | {[ key: string ]: aws-cdk-lib.NestedStack} | Nested Stacks generated by the Api Construct. |
roles | {[ key: string ]: aws-cdk-lib.aws_iam.IRole} | The Generated IAM Role L2 Resources, keyed by logicalId. |
tables | {[ key: string ]: aws-cdk-lib.aws_dynamodb.ITable} | The Generated DynamoDB Table L2 Resources, keyed by logicalId. |
cfnResources
Required 1public readonly cfnResources: AmplifyGraphqlApiCfnResources;
L1 Cfn Resources, for when dipping down a level of abstraction is desirable.
functions
Required 1public readonly functions: {[ key: string ]: IFunction};
The Generated Lambda Function L1 Resources, keyed by function name.
graphqlApi
Required 1public readonly graphqlApi: IGraphqlApi;
The Generated AppSync Api L2 Resource, includes the Schema.
nestedStacks
Required 1public readonly nestedStacks: {[ key: string ]: NestedStack};
Nested Stacks generated by the Api Construct.
roles
Required 1public readonly roles: {[ key: string ]: IRole};
The Generated IAM Role L2 Resources, keyed by logicalId.
tables
Required 1public readonly tables: {[ key: string ]: ITable};
The Generated DynamoDB Table L2 Resources, keyed by logicalId.
Configuration for Api Keys on the Graphql Api.
1import { ApiKeyAuthorizationConfig } from '@aws-amplify/graphql-api-construct' 2 3const apiKeyAuthorizationConfig: ApiKeyAuthorizationConfig = { ... }
Name | Type | Description |
---|---|---|
expires | aws-cdk-lib.Duration | A duration representing the time from Cloudformation deploy until expiry. |
description | string | Optional description for the Api Key to attach to the Api. |
expires
Required 1public readonly expires: Duration;
A duration representing the time from Cloudformation deploy until expiry.
description
Optional 1public readonly description: string;
Optional description for the Api Key to attach to the Api.
Authorization Modes to apply to the Api.
At least one modes must be provided, and if more than one are provided a defaultAuthorizationMode must be specified. For more information on Amplify Api auth, refer to https://docs.amplify.aws/cli/graphql/authorization-rules/#authorization-strategies
1import { AuthorizationModes } from '@aws-amplify/graphql-api-construct' 2 3const authorizationModes: AuthorizationModes = { ... }
Name | Type | Description |
---|---|---|
adminRoles | aws-cdk-lib.aws_iam.IRole[] | A list of roles granted full R/W access to the Api. |
apiKeyConfig | ApiKeyAuthorizationConfig | AppSync Api Key config, required if a 'apiKey' auth provider is specified in the Api. |
defaultAuthorizationMode | string | Default auth mode to provide to the Api, required if more than one config type is specified. |
iamConfig | IAMAuthorizationConfig | IAM Auth config, required if an 'iam' auth provider is specified in the Api. |
lambdaConfig | LambdaAuthorizationConfig | Lambda config, required if a 'function' auth provider is specified in the Api. |
oidcConfig | OIDCAuthorizationConfig | Cognito OIDC config, required if a 'oidc' auth provider is specified in the Api. |
userPoolConfig | UserPoolAuthorizationConfig | Cognito UserPool config, required if a 'userPools' auth provider is specified in the Api. |
adminRoles
1public readonly adminRoles: IRole[];
A list of roles granted full R/W access to the Api.
apiKeyConfig
Optional 1public readonly apiKeyConfig: ApiKeyAuthorizationConfig;
AppSync Api Key config, required if a 'apiKey' auth provider is specified in the Api.
Applies to 'public' auth strategy.
defaultAuthorizationMode
Optional 1public readonly defaultAuthorizationMode: string;
Default auth mode to provide to the Api, required if more than one config type is specified.
iamConfig
Optional 1public readonly iamConfig: IAMAuthorizationConfig;
IAM Auth config, required if an 'iam' auth provider is specified in the Api.
Applies to 'public' and 'private' auth strategies.
lambdaConfig
Optional 1public readonly lambdaConfig: LambdaAuthorizationConfig;
Lambda config, required if a 'function' auth provider is specified in the Api.
Applies to 'custom' auth strategy.
oidcConfig
Optional 1public readonly oidcConfig: OIDCAuthorizationConfig;
Cognito OIDC config, required if a 'oidc' auth provider is specified in the Api.
Applies to 'owner', 'private', and 'group' auth strategies.
userPoolConfig
Optional 1public readonly userPoolConfig: UserPoolAuthorizationConfig;
Cognito UserPool config, required if a 'userPools' auth provider is specified in the Api.
Applies to 'owner', 'private', and 'group' auth strategies.
Enable optimistic concurrency on the project.
1import { AutomergeConflictResolutionStrategy } from '@aws-amplify/graphql-api-construct' 2 3const automergeConflictResolutionStrategy: AutomergeConflictResolutionStrategy = { ... }
Name | Type | Description |
---|---|---|
detectionType | string | The conflict detection type used for resolution. |
handlerType | string | This conflict resolution strategy executes an auto-merge. |
detectionType
Required 1public readonly detectionType: string;
The conflict detection type used for resolution.
handlerType
Required 1public readonly handlerType: string;
This conflict resolution strategy executes an auto-merge.
For more information, refer to https://docs.aws.amazon.com/appsync/latest/devguide/conflict-detection-and-sync.html#conflict-detection-and-resolution
No vulnerabilities found.
No security vulnerabilities found.