@aws-amplify/graphql-transformer-interfaces
Version:
Amplify GraphQL transformer interface definitions
95 lines • 3.68 kB
TypeScript
import { CfnResource, IAsset } from 'aws-cdk-lib';
import { Construct, IConstruct } from 'constructs';
import { Grant, IGrantable, IRole } from 'aws-cdk-lib/aws-iam';
import { TransformHostProvider } from './transform-host-provider';
import { AssetProvider } from './asset-provider';
import { IamResource } from 'aws-cdk-lib/aws-appsync';
export type AppSyncAuthMode = 'API_KEY' | 'AMAZON_COGNITO_USER_POOLS' | 'AWS_IAM' | 'OPENID_CONNECT' | 'AWS_LAMBDA';
export type AppSyncAuthConfiguration = {
defaultAuthentication: AppSyncAuthConfigurationEntry;
additionalAuthenticationProviders: Array<AppSyncAuthConfigurationEntry>;
};
export type AppSyncAuthConfigurationEntry = AppSyncAuthConfigurationUserPoolEntry | AppSyncAuthConfigurationAPIKeyEntry | AppSyncAuthConfigurationIAMEntry | AppSyncAuthConfigurationOIDCEntry | AppSyncAuthConfigurationLambdaEntry;
export type AppSyncAuthConfigurationAPIKeyEntry = {
authenticationType: 'API_KEY';
apiKeyConfig?: ApiKeyConfig;
};
export type AppSyncAuthConfigurationUserPoolEntry = {
authenticationType: 'AMAZON_COGNITO_USER_POOLS';
userPoolConfig?: UserPoolConfig;
};
export type AppSyncAuthConfigurationIAMEntry = {
authenticationType: 'AWS_IAM';
};
export type AppSyncAuthConfigurationOIDCEntry = {
authenticationType: 'OPENID_CONNECT';
openIDConnectConfig?: OpenIDConnectConfig;
};
export type AppSyncAuthConfigurationLambdaEntry = {
authenticationType: 'AWS_LAMBDA';
lambdaAuthorizerConfig?: LambdaConfig;
};
export interface ApiKeyConfig {
description?: string;
apiKeyExpirationDays: number;
apiKeyExpirationDate?: Date;
}
export interface UserPoolConfig {
userPoolId: string;
}
export interface OpenIDConnectConfig {
name: string;
issuerUrl: string;
clientId?: string;
iatTTL?: number;
authTTL?: number;
}
export interface LambdaConfig {
lambdaFunction: string;
lambdaArn?: string;
ttlSeconds?: number;
}
export interface AppSyncFunctionConfigurationProvider extends IConstruct {
readonly arn: string;
readonly functionId: string;
}
export interface DataSourceOptions {
readonly name?: string;
readonly description?: string;
}
export interface SearchableDataSourceOptions extends DataSourceOptions {
readonly serviceRole: IRole;
}
export declare enum TemplateType {
INLINE = "INLINE",
S3_LOCATION = "S3_LOCATION"
}
export interface InlineMappingTemplateProvider {
type: TemplateType.INLINE;
bind: (scope: Construct) => string;
getTemplateHash: () => string;
}
export interface S3MappingTemplateProvider {
type: TemplateType.S3_LOCATION;
bind: (scope: Construct, assetProvider: AssetProvider) => string;
getTemplateHash: () => string;
}
export interface S3MappingFunctionCodeProvider {
type: TemplateType.S3_LOCATION;
bind: (scope: Construct, assetProvider: AssetProvider) => IAsset;
}
export type MappingTemplateProvider = InlineMappingTemplateProvider | S3MappingTemplateProvider;
export interface GraphQLAPIProvider extends IConstruct {
readonly apiId: string;
readonly graphqlUrl: string;
readonly host: TransformHostProvider;
readonly name: string;
readonly assetProvider: AssetProvider;
addToSchema: (addition: string) => void;
addSchemaDependency: (construct: CfnResource) => boolean;
grant: (grantee: IGrantable, resources: IamResource, ...actions: string[]) => Grant;
grantMutation: (grantee: IGrantable, ...fields: string[]) => Grant;
grantQuery: (grantee: IGrantable, ...fields: string[]) => Grant;
grantSubscription: (grantee: IGrantable, ...fields: string[]) => Grant;
}
//# sourceMappingURL=graphql-api-provider.d.ts.map