agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

13
cdk/node_modules/aws-cdk-lib/aws-appsync/.jsiirc.json generated vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.appsync"
},
"dotnet": {
"namespace": "Amazon.CDK.AWS.AppSync"
},
"python": {
"module": "aws_cdk.aws_appsync"
}
}
}

1465
cdk/node_modules/aws-cdk-lib/aws-appsync/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
cdk/node_modules/aws-cdk-lib/aws-appsync/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './lib';

1
cdk/node_modules/aws-cdk-lib/aws-appsync/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
import type { IResource } from '../../core';
import { Resource } from '../../core';
import type { IApiRef, ApiReference } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Interface for an API
*/
export interface IApi extends IResource, IApiRef {
/**
* The unique identifier for the AWS AppSync Api generated by the service.
*
* @attribute
*/
readonly apiId: string;
/**
* The ARN of the AWS AppSync Api.
*
* @attribute
*/
readonly apiArn: string;
}
/**
* Base Class for API
*/
export declare abstract class ApiBase extends Resource implements IApi {
/**
* The unique identifier for the AWS AppSync Api generated by the service.
*/
abstract readonly apiId: string;
/**
* The ARN of the AWS AppSync Api.
*/
abstract readonly apiArn: string;
get apiRef(): ApiReference;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiBase=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class ApiBase extends core_1().Resource{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.ApiBase",version:"2.252.0"};get apiRef(){return{apiArn:this.apiArn}}}exports.ApiBase=ApiBase;

View File

@@ -0,0 +1,23 @@
export interface MetricWithDims<D> {
readonly namespace: string;
readonly metricName: string;
readonly statistic: string;
readonly dimensionsMap: D;
}
export declare class AppSyncMetrics {
static _4XxErrorSum(this: void, dimensions: {
GraphQLAPIId: string;
}): MetricWithDims<{
GraphQLAPIId: string;
}>;
static _5XxErrorSum(this: void, dimensions: {
GraphQLAPIId: string;
}): MetricWithDims<{
GraphQLAPIId: string;
}>;
static latencyAverage(this: void, dimensions: {
GraphQLAPIId: string;
}): MetricWithDims<{
GraphQLAPIId: string;
}>;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppSyncMetrics=void 0;class AppSyncMetrics{static _4XxErrorSum(dimensions){return{namespace:"AWS/AppSync",metricName:"4XXError",dimensionsMap:dimensions,statistic:"Sum"}}static _5XxErrorSum(dimensions){return{namespace:"AWS/AppSync",metricName:"5XXError",dimensionsMap:dimensions,statistic:"Sum"}}static latencyAverage(dimensions){return{namespace:"AWS/AppSync",metricName:"Latency",dimensionsMap:dimensions,statistic:"Average"}}}exports.AppSyncMetrics=AppSyncMetrics;

View File

@@ -0,0 +1,107 @@
import type { EventApiBase } from './eventapi';
import type { IRoleRef } from '../../aws-iam';
import type { RetentionDays } from '../../aws-logs';
import type { ICertificateRef } from '../../interfaces/generated/aws-certificatemanager-interfaces.generated';
/**
* A class used to generate resource arns for AppSync Event APIs
*/
export declare class AppSyncEventResource {
/**
* Generate a resource for the calling API
*/
static forAPI(): AppSyncEventResource;
/**
* Generate the resource names given a channel namespace
*
* @param channelNamespace The channel namespace that needs to be allowed
*
* Example: ofChannelNamespace('default')
*/
static ofChannelNamespace(channelNamespace: string): AppSyncEventResource;
/**
* Generate the resource names that accepts all types: `*`
*/
static all(): AppSyncEventResource;
/**
* Generate the resource names that accepts all channel namespaces: `*`
*/
static allChannelNamespaces(): AppSyncEventResource;
private arns;
private constructor();
/**
* Return the Resource ARN
*
* @param api The AppSync API to give permissions
*/
resourceArns(api: EventApiBase): string[];
}
/**
* log-level for fields in AppSync
*/
export declare enum AppSyncFieldLogLevel {
/**
* Resolver logging is disabled
*/
NONE = "NONE",
/**
* Only Error messages appear in logs
*/
ERROR = "ERROR",
/**
* Info and Error messages appear in logs
*/
INFO = "INFO",
/**
* Debug, Info, and Error messages, appear in logs
*/
DEBUG = "DEBUG",
/**
* All messages (Debug, Error, Info, and Trace) appear in logs
*/
ALL = "ALL"
}
/**
* Logging configuration for AppSync
*/
export interface AppSyncLogConfig {
/**
* exclude verbose content
*
* @default false
*/
readonly excludeVerboseContent?: boolean;
/**
* log level for fields
*
* @default - Use AppSync default
*/
readonly fieldLogLevel?: AppSyncFieldLogLevel;
/**
* The role for CloudWatch Logs
*
* @default - None
*/
readonly role?: IRoleRef;
/**
* The number of days log events are kept in CloudWatch Logs.
* By default AppSync keeps the logs infinitely. When updating this property,
* unsetting it doesn't remove the log retention policy.
* To remove the retention policy, set the value to `INFINITE`
*
* @default RetentionDays.INFINITE
*/
readonly retention?: RetentionDays;
}
/**
* Domain name configuration for AppSync
*/
export interface AppSyncDomainOptions {
/**
* The certificate to use with the domain name.
*/
readonly certificate: ICertificateRef;
/**
* The actual domain name. For example, `api.example.com`.
*/
readonly domainName: string;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppSyncFieldLogLevel=exports.AppSyncEventResource=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class AppSyncEventResource{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AppSyncEventResource",version:"2.252.0"};static forAPI(){return new AppSyncEventResource([""])}static ofChannelNamespace(channelNamespace){const arns=[`channelNamespace/${channelNamespace}`];return new AppSyncEventResource(arns)}static all(){return new AppSyncEventResource(["*"])}static allChannelNamespaces(){const arns=["channelNamespace/*"];return new AppSyncEventResource(arns)}arns;constructor(arns){this.arns=arns}resourceArns(api){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_EventApiBase(api)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.resourceArns),error}return this.arns.map(arn=>arn===""?core_1().Stack.of(api).formatArn({service:"appsync",resource:`apis/${api.apiId}`,arnFormat:core_1().ArnFormat.NO_RESOURCE_NAME}):core_1().Stack.of(api).formatArn({service:"appsync",resource:`apis/${api.apiId}`,arnFormat:core_1().ArnFormat.SLASH_RESOURCE_NAME,resourceName:arn}))}}exports.AppSyncEventResource=AppSyncEventResource;var AppSyncFieldLogLevel;(function(AppSyncFieldLogLevel2){AppSyncFieldLogLevel2.NONE="NONE",AppSyncFieldLogLevel2.ERROR="ERROR",AppSyncFieldLogLevel2.INFO="INFO",AppSyncFieldLogLevel2.DEBUG="DEBUG",AppSyncFieldLogLevel2.ALL="ALL"})(AppSyncFieldLogLevel||(exports.AppSyncFieldLogLevel=AppSyncFieldLogLevel={}));

View File

@@ -0,0 +1,138 @@
import type { Construct } from 'constructs';
import type { Code } from './code';
import type { BaseDataSource } from './data-source';
import type { IGraphqlApi } from './graphqlapi-base';
import type { MappingTemplate } from './mapping-template';
import type { FunctionRuntime } from './runtime';
import type { IResource } from '../../core';
import { Resource } from '../../core';
import type { IFunctionConfigurationRef, FunctionConfigurationReference } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* the base properties for AppSync Functions
*/
export interface BaseAppsyncFunctionProps {
/**
* the name of the AppSync Function
*/
readonly name: string;
/**
* the description for this AppSync Function
*
* @default - no description
*/
readonly description?: string;
/**
* the request mapping template for the AppSync Function
*
* @default - no request mapping template
*/
readonly requestMappingTemplate?: MappingTemplate;
/**
* the response mapping template for the AppSync Function
*
* @default - no response mapping template
*/
readonly responseMappingTemplate?: MappingTemplate;
/**
* The functions runtime
*
* @default - no function runtime, VTL mapping templates used
*/
readonly runtime?: FunctionRuntime;
/**
* The function code
*
* @default - no code is used
*/
readonly code?: Code;
/**
* 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.
*
* @default - No max batch size
*/
readonly maxBatchSize?: number;
}
/**
* the CDK properties for AppSync Functions
*/
export interface AppsyncFunctionProps extends BaseAppsyncFunctionProps {
/**
* the GraphQL Api linked to this AppSync Function
*/
readonly api: IGraphqlApi;
/**
* the data source linked to this AppSync Function
*/
readonly dataSource: BaseDataSource;
}
/**
* The attributes for imported AppSync Functions
*/
export interface AppsyncFunctionAttributes {
/**
* the ARN of the AppSync function
*/
readonly functionArn: string;
}
/**
* Interface for AppSync Functions
*/
export interface IAppsyncFunction extends IResource, IFunctionConfigurationRef {
/**
* the name of this AppSync Function
*
* @attribute
*/
readonly functionId: string;
/**
* the ARN of the AppSync function
*
* @attribute
*/
readonly functionArn: string;
}
/**
* AppSync Functions are local functions that perform certain operations
* onto a backend data source. Developers can compose operations (Functions)
* and execute them in sequence with Pipeline Resolvers.
*
* @resource AWS::AppSync::FunctionConfiguration
*/
export declare class AppsyncFunction extends Resource implements IAppsyncFunction {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import Appsync Function from arn
*/
static fromAppsyncFunctionAttributes(scope: Construct, id: string, attrs: AppsyncFunctionAttributes): IAppsyncFunction;
/**
* the name of this AppSync Function
*
* @attribute Name
*/
readonly functionName: string;
/**
* the ARN of the AppSync function
*
* @attribute
*/
readonly functionArn: string;
/**
* the ID of the AppSync function
*
* @attribute
*/
readonly functionId: string;
/**
* the data source of this AppSync Function
*
* @attribute DataSourceName
*/
readonly dataSource: BaseDataSource;
private readonly function;
constructor(scope: Construct, id: string, props: AppsyncFunctionProps);
get functionConfigurationRef(): FunctionConfigurationReference;
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,175 @@
import type { Construct } from 'constructs';
import { CfnApiKey } from './appsync.generated';
import type { IUserPool } from '../../aws-cognito';
import type { IFunction } from '../../aws-lambda';
import type { Expiration } from '../../core';
import { Duration } from '../../core';
/**
* Auth provider settings for AppSync Event APIs
*
* @see https://docs.aws.amazon.com/appsync/latest/eventapi/configure-event-api-auth.html
*/
export interface AppSyncAuthProvider {
/**
* One of possible authorization types AppSync supports
*
* @default - `AuthorizationType.API_KEY`
*/
readonly authorizationType: AppSyncAuthorizationType;
/**
* If authorizationType is `AuthorizationType.USER_POOL`, this option is required.
* @default - none
*/
readonly cognitoConfig?: AppSyncCognitoConfig;
/**
* If authorizationType is `AuthorizationType.API_KEY`, this option can be configured.
* @default - name: 'DefaultAPIKey'
*/
readonly apiKeyConfig?: AppSyncApiKeyConfig;
/**
* If authorizationType is `AuthorizationType.OIDC`, this option is required.
* @default - none
*/
readonly openIdConnectConfig?: AppSyncOpenIdConnectConfig;
/**
* If authorizationType is `AuthorizationType.LAMBDA`, this option is required.
* @default - none
*/
readonly lambdaAuthorizerConfig?: AppSyncLambdaAuthorizerConfig;
}
/**
* enum with all possible values for AppSync authorization type
*/
export declare enum AppSyncAuthorizationType {
/**
* API Key authorization type
*/
API_KEY = "API_KEY",
/**
* AWS IAM authorization type. Can be used with Cognito Identity Pool federated credentials
*/
IAM = "AWS_IAM",
/**
* Cognito User Pool authorization type
*/
USER_POOL = "AMAZON_COGNITO_USER_POOLS",
/**
* OpenID Connect authorization type
*/
OIDC = "OPENID_CONNECT",
/**
* Lambda authorization type
*/
LAMBDA = "AWS_LAMBDA"
}
/**
* Configuration for Cognito user-pools in AppSync for Api
*/
export interface AppSyncCognitoConfig {
/**
* The Cognito user pool to use as identity source
*/
readonly userPool: IUserPool;
/**
* the optional app id regex
*
* @default - None
*/
readonly appIdClientRegex?: string;
}
/**
* Configuration for API Key authorization in AppSync
*/
export interface AppSyncApiKeyConfig {
/**
* Unique name of the API Key
* @default - 'DefaultAPIKey'
*/
readonly name?: string;
/**
* Description of API key
* @default - 'Default API Key created by CDK'
*/
readonly description?: string;
/**
* The time from creation time after which the API key expires.
* It must be a minimum of 1 day and a maximum of 365 days from date of creation.
* Rounded down to the nearest hour.
*
* @default - 7 days rounded down to nearest hour
*/
readonly expires?: Expiration;
}
/**
* Configuration for OpenID Connect authorization in AppSync
*/
export interface AppSyncOpenIdConnectConfig {
/**
* The number of milliseconds an OIDC token is valid after being authenticated by OIDC provider.
* `auth_time` claim in OIDC token is required for this validation to work.
* @default - no validation
*/
readonly tokenExpiryFromAuth?: number;
/**
* The number of milliseconds an OIDC token is valid after being issued to a user.
* This validation uses `iat` claim of OIDC token.
* @default - no validation
*/
readonly tokenExpiryFromIssue?: number;
/**
* The client identifier of the Relying party at the OpenID identity provider.
* A regular expression can be specified so AppSync can validate against multiple client identifiers at a time.
* @example - 'ABCD|CDEF' // where ABCD and CDEF are two different clientId
* @default - * (All)
*/
readonly clientId?: string;
/**
* The issuer for the OIDC configuration. The issuer returned by discovery must exactly match the value of `iss` in the OIDC token.
*/
readonly oidcProvider: string;
}
/**
* Configuration for Lambda authorization in AppSync. Note that you can only have a single AWS Lambda function configured to authorize your API.
*/
export interface AppSyncLambdaAuthorizerConfig {
/**
* The authorizer lambda function.
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-lambdaauthorizerconfig.html
*/
readonly handler: IFunction;
/**
* How long the results are cached.
* Disable caching by setting this to 0.
*
* @default Duration.minutes(5)
*/
readonly resultsCacheTtl?: Duration;
/**
* A regular expression for validation of tokens before the Lambda function is called.
*
* @default - no regex filter will be applied.
*/
readonly validationRegex?: string;
}
/**
* Exposes methods for defining authorization config for AppSync APIs
*/
export interface IAppSyncAuthConfig {
/**
* Set up OIDC Authorization configuration for AppSync APIs
*/
setupOpenIdConnectConfig(config?: AppSyncOpenIdConnectConfig): any;
/**
* Set up Cognito Authorization configuration for AppSync APIs
*/
setupCognitoConfig(config?: AppSyncCognitoConfig): any;
/**
* Set up Lambda Authorization configuration AppSync APIs
*/
setupLambdaAuthorizerConfig(config?: AppSyncLambdaAuthorizerConfig): any;
}
/**
* Create an API Key for GraphQL APIs and Event APIs
*/
export declare function createAPIKey(scope: Construct, apiId: string, config?: AppSyncApiKeyConfig): CfnApiKey;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppSyncAuthorizationType=void 0,exports.createAPIKey=createAPIKey;var appsync_generated_1=()=>{var tmp=require("./appsync.generated");return appsync_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},AppSyncAuthorizationType;(function(AppSyncAuthorizationType2){AppSyncAuthorizationType2.API_KEY="API_KEY",AppSyncAuthorizationType2.IAM="AWS_IAM",AppSyncAuthorizationType2.USER_POOL="AMAZON_COGNITO_USER_POOLS",AppSyncAuthorizationType2.OIDC="OPENID_CONNECT",AppSyncAuthorizationType2.LAMBDA="AWS_LAMBDA"})(AppSyncAuthorizationType||(exports.AppSyncAuthorizationType=AppSyncAuthorizationType={}));function createAPIKey(scope,apiId,config){if(config?.expires?.isBefore(core_1().Duration.days(1))||config?.expires?.isAfter(core_1().Duration.days(365)))throw Error("API key expiration must be between 1 and 365 days.");const expires=config?.expires?config?.expires.toEpoch():void 0;return new(appsync_generated_1()).CfnApiKey(scope,`${config?.name||"Default"}ApiKey`,{expires,description:config?.description,apiId})}

View File

@@ -0,0 +1,19 @@
import type { Duration } from '../../core';
/**
* CachingConfig for AppSync resolvers
*/
export interface CachingConfig {
/**
* The caching keys for a resolver that has caching enabled.
* Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.
*
* @default - No caching keys
*/
readonly cachingKeys?: string[];
/**
* The TTL in seconds for a resolver that has caching enabled.
* Valid values are between 1 and 3600 seconds.
*
*/
readonly ttl: Duration;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});

View File

@@ -0,0 +1,4 @@
export declare const CONTEXT_ARGUMENTS_CACHING_KEY = "$context.arguments";
export declare const CONTEXT_SOURCE_CACHING_KEY = "$context.source";
export declare const CONTEXT_IDENTITY_CACHING_KEY = "$context.identity";
export declare const BASE_CACHING_KEYS: string[];

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BASE_CACHING_KEYS=exports.CONTEXT_IDENTITY_CACHING_KEY=exports.CONTEXT_SOURCE_CACHING_KEY=exports.CONTEXT_ARGUMENTS_CACHING_KEY=void 0,exports.CONTEXT_ARGUMENTS_CACHING_KEY="$context.arguments",exports.CONTEXT_SOURCE_CACHING_KEY="$context.source",exports.CONTEXT_IDENTITY_CACHING_KEY="$context.identity",exports.BASE_CACHING_KEYS=[exports.CONTEXT_ARGUMENTS_CACHING_KEY,exports.CONTEXT_SOURCE_CACHING_KEY,exports.CONTEXT_IDENTITY_CACHING_KEY];

View File

@@ -0,0 +1,196 @@
import type { Construct } from 'constructs';
import type { AppSyncAuthorizationType } from './auth-config';
import type { Code } from './code';
import type { AppSyncBackedDataSource } from './data-source-common';
import { LambdaInvokeType } from './data-source-common';
import type { IEventApi } from './eventapi';
import type { IGrantable } from '../../aws-iam';
import type { IResource } from '../../core';
import { Resource } from '../../core';
import type { IChannelNamespaceRef, ChannelNamespaceReference } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* An AppSync channel namespace
*/
export interface IChannelNamespace extends IResource, IChannelNamespaceRef {
/**
* The ARN of the AppSync channel namespace
*
* @attribute
*/
readonly channelNamespaceArn: string;
}
/**
* Authorization configuration for the Channel Namespace
*/
export interface NamespaceAuthConfig {
/**
* The publish auth modes for this Event Api
* @default - API Key authorization
*/
readonly publishAuthModeTypes?: AppSyncAuthorizationType[];
/**
* The subscribe auth modes for this Event Api
* @default - API Key authorization
*/
readonly subscribeAuthModeTypes?: AppSyncAuthorizationType[];
}
/**
* Enumerated type for the handler behavior for a channel namespace
*/
export declare enum HandlerBehavior {
/**
* Code handler
*/
CODE = "CODE",
/**
* Direct integration handler
*/
DIRECT = "DIRECT"
}
/**
* Handler configuration construct for onPublish and onSubscribe
*/
export interface HandlerConfig {
/**
* If the Event Handler should invoke the data source directly
*
* @default - false
*/
readonly direct?: boolean;
/**
* The Event Handler data source
*
* @default - no data source is used
*/
readonly dataSource?: AppSyncBackedDataSource;
/**
* The Lambda invocation type for direct integrations
*
* @default - LambdaInvokeType.REQUEST_RESPONSE
*/
readonly lambdaInvokeType?: LambdaInvokeType;
}
/**
* the base properties for a channel namespace
*/
export interface BaseChannelNamespaceProps {
/**
* the name of the channel namespace
*
* @default - the construct's id will be used
*/
readonly channelNamespaceName?: string;
/**
* The Event Handler code
*
* @default - no code is used
*/
readonly code?: Code;
/**
* onPublish handler config
*
* @default - no handler config
*/
readonly publishHandlerConfig?: HandlerConfig;
/**
* onSubscribe handler config
*
* @default - no handler config
*/
readonly subscribeHandlerConfig?: HandlerConfig;
/**
* Authorization config for channel namespace
*
* @default - defaults to Event API default auth config
*/
readonly authorizationConfig?: NamespaceAuthConfig;
}
/**
* Additional property for an AppSync channel namespace for an Event API reference
*/
export interface ChannelNamespaceProps extends BaseChannelNamespaceProps {
/**
* The API this channel namespace is associated with
*/
readonly api: IEventApi;
}
/**
* Option configuration for channel namespace
*/
export interface ChannelNamespaceOptions {
/**
* The Channel Namespace name
*
* @default - the construct's id will be used
*/
readonly channelNamespaceName?: string;
/**
* The Event Handler code
*
* @default - no code is used
*/
readonly code?: Code;
/**
* onPublish handler config
*
* @default - no handler config
*/
readonly publishHandlerConfig?: HandlerConfig;
/**
* onSubscribe handler config
*
* @default - no handler config
*/
readonly subscribeHandlerConfig?: HandlerConfig;
/**
* Authorization config for channel namespace
*
* @default - defaults to Event API default auth config
*/
readonly authorizationConfig?: NamespaceAuthConfig;
}
/**
* A Channel Namespace
*/
export declare class ChannelNamespace extends Resource implements IChannelNamespace {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Use an existing channel namespace by ARN
*/
static fromChannelNamespaceArn(scope: Construct, id: string, channelNamespaceArn: string): IChannelNamespace;
/**
* the ARN of the channel namespace
*/
readonly channelNamespaceArn: string;
private channelNamespace;
private api;
constructor(scope: Construct, id: string, props: ChannelNamespaceProps);
/**
* Adds an IAM policy statement for EventSubscribe access to this channel namespace to an IAM
* principal's policy.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantSubscribe(grantee: IGrantable): import("../../aws-iam").Grant;
/**
* Adds an IAM policy statement for EventPublish access to this channel namespace to an IAM
* principal's policy.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantPublish(grantee: IGrantable): import("../../aws-iam").Grant;
/**
* Adds an IAM policy statement for EventPublish and EventSubscribe access to this channel namespace to an IAM
* principal's policy.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantPublishAndSubscribe(grantee: IGrantable): import("../../aws-iam").Grant;
private validateAuthorizationConfig;
private validateHandlerConfig;
get channelNamespaceRef(): ChannelNamespaceReference;
}

File diff suppressed because one or more lines are too long

59
cdk/node_modules/aws-cdk-lib/aws-appsync/lib/code.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import type { Construct } from 'constructs';
import * as s3_assets from '../../aws-s3-assets';
/**
* Result of binding `Code` into a `Function`.
*/
export interface CodeConfig {
/**
* The location of the code in S3 (mutually exclusive with `inlineCode`.
* @default - code is not an s3 location
*/
readonly s3Location?: string;
/**
* Inline code (mutually exclusive with `s3Location`).
* @default - code is not inline code
*/
readonly inlineCode?: string;
}
/**
* Represents source code for an AppSync Function or Resolver.
*/
export declare abstract class Code {
/**
* Loads the function code from a local disk path.
*
* @param path The path to the source code file.
*/
static fromAsset(path: string, options?: s3_assets.AssetOptions): AssetCode;
/**
* Inline code for AppSync function
* @returns `InlineCode` with inline code.
* @param code The actual handler code (the resulting zip file cannot exceed 4MB)
*/
static fromInline(code: string): InlineCode;
/**
* Bind source code to an AppSync Function or resolver.
*/
abstract bind(scope: Construct): CodeConfig;
}
/**
* Represents a local file with source code used for an AppSync Function or Resolver.
*/
export declare class AssetCode extends Code {
readonly path: string;
private readonly options;
private asset?;
/**
* @param path The path to the asset file.
*/
constructor(path: string, options?: s3_assets.AssetOptions);
bind(scope: Construct): CodeConfig;
}
/**
* AppSync function code from an inline string.
*/
export declare class InlineCode extends Code {
private code;
constructor(code: string);
bind(_scope: Construct): CodeConfig;
}

1
cdk/node_modules/aws-cdk-lib/aws-appsync/lib/code.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InlineCode=exports.AssetCode=exports.Code=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var s3_assets=()=>{var tmp=require("../../aws-s3-assets");return s3_assets=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class Code{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Code",version:"2.252.0"};static fromAsset(path,options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_assets_AssetOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAsset),error}return new AssetCode(path,options)}static fromInline(code){return new InlineCode(code)}}exports.Code=Code;class AssetCode extends Code{path;options;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AssetCode",version:"2.252.0"};asset;constructor(path,options={}){super(),this.path=path,this.options=options;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_assets_AssetOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AssetCode),error}}bind(scope){if(!this.asset)this.asset=new(s3_assets()).Asset(scope,"Code",{path:this.path,...this.options});else if(cdk().Stack.of(this.asset)!==cdk().Stack.of(scope))throw new(cdk()).ValidationError((0,literal_string_1().lit)`AssetAlreadyAssociated`,`Asset is already associated with another stack '${cdk().Stack.of(this.asset).stackName}'. Create a new Code instance for every stack.`,scope);return{s3Location:this.asset.s3ObjectUrl}}}exports.AssetCode=AssetCode;class InlineCode extends Code{code;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.InlineCode",version:"2.252.0"};constructor(code){if(super(),this.code=code,code.length===0)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`InlineCodeEmpty`,"AppSync Inline code cannot be empty")}bind(_scope){return{inlineCode:this.code}}}exports.InlineCode=InlineCode;

View File

@@ -0,0 +1,352 @@
import { Construct } from 'constructs';
import type { IApi } from './api-base';
import { CfnDataSource } from './appsync.generated';
import type { ITable } from '../../aws-dynamodb';
import type { IEventBus } from '../../aws-events';
import type { IRole, IPrincipal, IGrantable } from '../../aws-iam';
import type { IFunction } from '../../aws-lambda';
import type { IDomain } from '../../aws-opensearchservice';
import type { IDatabaseCluster, IServerlessCluster } from '../../aws-rds';
import type { ISecret } from '../../aws-secretsmanager';
import type { IResolvable } from '../../core';
import type { IApiRef } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Valid data source types for AppSync
*/
export declare enum AppSyncDataSourceType {
/**
* Lambda data source type
*/
LAMBDA = "AWS_LAMBDA",
/**
* DynamoDB data source type
*/
DYNAMODB = "AMAZON_DYNAMODB",
/**
* EventBridge data source type
*/
EVENTBRIDGE = "AMAZON_EVENTBRIDGE",
/**
* OpenSearch service data source type
*/
OPENSEARCH_SERVICE = "AMAZON_OPENSEARCH_SERVICE",
/**
* HTTP data source type
*/
HTTP = "HTTP",
/**
* Relational DB data source type
*/
RELATIONAL_DATABASE = "RELATIONAL_DATABASE",
/**
* Bedrock runtime data source type
*/
BEDROCK = "AMAZON_BEDROCK_RUNTIME",
/**
* Elasticsearch data source type
*/
ELASTICSEARCH = "AMAZON_ELASTICSEARCH"
}
/**
* Invoke types for direct Lambda data sources
*/
export declare enum LambdaInvokeType {
/**
* Invoke function asynchronously
*/
EVENT = "EVENT",
/**
* Invoke function synchronously
*/
REQUEST_RESPONSE = "REQUEST_RESPONSE"
}
/**
* Base properties for an AppSync datasource
*/
export interface AppSyncBaseDataSourceProps {
/**
* The API to attach this data source to
*/
readonly api: IApiRef;
/**
* The name of the data source. The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}.
* Any invalid characters will be automatically removed.
*
* @default - id of data source
*/
readonly name?: string;
/**
* The description of the data source
*
* @default - None
*/
readonly description?: string;
}
/**
* Properties for an AppSync datasource backed by a resource
*/
export interface AppSyncBackedDataSourceProps extends AppSyncBaseDataSourceProps {
/**
* The IAM service role to be assumed by AppSync to interact with the data source
*
* @default - Create a new role
*/
readonly serviceRole?: IRole;
}
/**
* Props used by implementations of BaseDataSource to provide configuration. Should not be used directly.
*/
export interface AppSyncExtendedDataSourceProps {
/**
* The type of the AppSync datasource
*/
readonly type: AppSyncDataSourceType;
/**
* Configuration for DynamoDB Datasource
*
* @default - No config
*/
readonly dynamoDbConfig?: CfnDataSource.DynamoDBConfigProperty | IResolvable;
/**
* Configuration for OpenSearch data source
*
* @default - No config
*/
readonly openSearchServiceConfig?: CfnDataSource.OpenSearchServiceConfigProperty | IResolvable;
/**
* Configuration for HTTP Datasource
*
* @default - No config
*/
readonly httpConfig?: CfnDataSource.HttpConfigProperty | IResolvable;
/**
* Configuration for EventBridge Datasource
*
* @default - No config
*/
readonly eventBridgeConfig?: CfnDataSource.EventBridgeConfigProperty | IResolvable;
/**
* Configuration for Lambda Datasource
*
* @default - No config
*/
readonly lambdaConfig?: CfnDataSource.LambdaConfigProperty | IResolvable;
/**
* Configuration for RDS Datasource
*
* @default - No config
*/
readonly relationalDatabaseConfig?: CfnDataSource.RelationalDatabaseConfigProperty | IResolvable;
}
/**
* Abstract AppSync datasource implementation. Do not use directly but use subclasses for concrete datasources
*/
export declare abstract class AppSyncBaseDataSource extends Construct {
/**
* The name of the data source
*/
readonly name: string;
/**
* The underlying CFN data source resource
*/
readonly resource: CfnDataSource;
private _api;
protected serviceRole?: IRole;
constructor(scope: Construct, id: string, props: AppSyncBackedDataSourceProps, extended: AppSyncExtendedDataSourceProps);
/**
* The API this data source is attached to
*/
protected get api(): IApi;
/**
* Set the API this data source is attached to
*/
protected set api(api: IApi);
}
/**
* Abstract AppSync datasource implementation. Do not use directly but use subclasses for resource backed datasources
*/
export declare abstract class AppSyncBackedDataSource extends AppSyncBaseDataSource implements IGrantable {
/**
* The principal of the data source to be IGrantable
*/
readonly grantPrincipal: IPrincipal;
constructor(scope: Construct, id: string, props: AppSyncBackedDataSourceProps, extended: AppSyncExtendedDataSourceProps);
}
/**
* Properties for an AppSync DynamoDB datasource
*/
export interface AppSyncDynamoDbDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The DynamoDB table backing this data source
*/
readonly table: ITable;
/**
* Specify whether this Data Source is read only or has read and write permissions to the DynamoDB table
*
* @default false
*/
readonly readOnlyAccess?: boolean;
/**
* Use credentials of caller to access DynamoDB
*
* @default false
*/
readonly useCallerCredentials?: boolean;
}
/**
* An AppSync datasource backed by a DynamoDB table
*/
export declare class AppSyncDynamoDbDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncDynamoDbDataSourceProps);
}
/**
* The authorization config in case the HTTP endpoint requires authorization
*/
export interface AppSyncAwsIamConfig {
/**
* The signing region for AWS IAM authorization
*/
readonly signingRegion: string;
/**
* The signing service name for AWS IAM authorization
*/
readonly signingServiceName: string;
}
/**
* Optional configuration for data sources
*/
export interface AppSyncDataSourceOptions {
/**
* The name of the data source, overrides the id given by CDK
*
* @default - generated by CDK given the id
*/
readonly name?: string;
/**
* The description of the data source
*
* @default - No description
*/
readonly description?: string;
}
/**
* Optional configuration for Http data sources
*/
export interface AppSyncHttpDataSourceOptions extends AppSyncDataSourceOptions {
/**
* The authorization config in case the HTTP endpoint requires authorization
*
* @default - none
*/
readonly authorizationConfig?: AppSyncAwsIamConfig;
}
/**
* Properties for an AppSync http datasource
*/
export interface AppSyncHttpDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The http endpoint
*/
readonly endpoint: string;
/**
* The authorization config in case the HTTP endpoint requires authorization
*
* @default - none
*/
readonly authorizationConfig?: AppSyncAwsIamConfig;
}
/**
* An AppSync datasource backed by a http endpoint
*/
export declare class AppSyncHttpDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncHttpDataSourceProps);
}
/**
* Properties for an AppSync EventBridge datasource
*/
export interface AppSyncEventBridgeDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The EventBridge EventBus
*/
readonly eventBus: IEventBus;
}
/**
* An AppSync datasource backed by EventBridge
*/
export declare class AppSyncEventBridgeDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncEventBridgeDataSourceProps);
}
/**
* Properties for an AppSync Lambda datasource
*/
export interface AppSyncLambdaDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The Lambda function to call to interact with this data source
*/
readonly lambdaFunction: IFunction;
}
/**
* An AppSync datasource backed by a Lambda function
*/
export declare class AppSyncLambdaDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncLambdaDataSourceProps);
}
/**
* Properties for an AppSync RDS datasource Aurora Serverless V1
*/
export interface AppSyncRdsDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The serverless cluster to call to interact with this data source
*/
readonly serverlessCluster: IServerlessCluster;
/**
* The secret containing the credentials for the database
*/
readonly secretStore: ISecret;
/**
* The name of the database to use within the cluster
*
* @default - None
*/
readonly databaseName?: string;
}
/**
* Properties for an AppSync RDS datasource Aurora Serverless V2
*/
export interface AppSyncRdsDataSourcePropsV2 extends AppSyncBackedDataSourceProps {
/**
* The serverless cluster to call to interact with this data source
*/
readonly serverlessCluster: IDatabaseCluster;
/**
* The secret containing the credentials for the database
*/
readonly secretStore: ISecret;
/**
* The name of the database to use within the cluster
*
* @default - None
*/
readonly databaseName?: string;
}
/**
* An AppSync datasource backed by RDS
*/
export declare class AppSyncRdsDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncRdsDataSourceProps);
}
/**
* Properties for the OpenSearch Data Source
*/
export interface AppSyncOpenSearchDataSourceProps extends AppSyncBackedDataSourceProps {
/**
* The OpenSearch domain containing the endpoint for the data source
*/
readonly domain: IDomain;
}
/**
* An Appsync datasource backed by OpenSearch
*/
export declare class AppSyncOpenSearchDataSource extends AppSyncBackedDataSource {
constructor(scope: Construct, id: string, props: AppSyncOpenSearchDataSourceProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,368 @@
import { Construct } from 'constructs';
import type { BaseAppsyncFunctionProps } from './appsync-function';
import { AppsyncFunction } from './appsync-function';
import { CfnDataSource } from './appsync.generated';
import type { IGraphqlApi } from './graphqlapi-base';
import type { BaseResolverProps } from './resolver';
import { Resolver } from './resolver';
import type { ITable } from '../../aws-dynamodb';
import type { IDomain as IElasticsearchDomain } from '../../aws-elasticsearch';
import type { IEventBus } from '../../aws-events';
import type { IGrantable, IPrincipal, IRole } from '../../aws-iam';
import type { IFunction } from '../../aws-lambda';
import type { IDomain as IOpenSearchDomain } from '../../aws-opensearchservice';
import type { IServerlessCluster, IDatabaseCluster } from '../../aws-rds';
import type { ISecret } from '../../aws-secretsmanager';
import type { IResolvable } from '../../core';
import type { IGraphQLApiRef } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Enum for enhanced data source metrics for specified data sources
*/
export declare enum DataSourceMetricsConfig {
/**
* Enables enhanced data source metrics for specified data sources
*/
ENABLED = "ENABLED",
/**
* Disables enhanced data source metrics for specified data sources
*/
DISABLED = "DISABLED"
}
/**
* Base properties for an AppSync datasource
*/
export interface BaseDataSourceProps {
/**
* The API to attach this data source to
*/
readonly api: IGraphQLApiRef;
/**
* The name of the data source
*
* @default - id of data source
*/
readonly name?: string;
/**
* the description of the data source
*
* @default - None
*/
readonly description?: string;
/**
* Whether to enable enhanced metrics of the data source
* Value will be ignored, if `enhancedMetricsConfig.dataSourceLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_DATA_SOURCE_METRICS`
*
* @default - no metrics configuration
*/
readonly metricsConfig?: DataSourceMetricsConfig;
}
/**
* properties for an AppSync datasource backed by a resource
*/
export interface BackedDataSourceProps extends BaseDataSourceProps {
/**
* The IAM service role to be assumed by AppSync to interact with the data source
*
* @default - Create a new role
*/
readonly serviceRole?: IRole;
}
/**
* props used by implementations of BaseDataSource to provide configuration. Should not be used directly.
*/
export interface ExtendedDataSourceProps {
/**
* the type of the AppSync datasource
*/
readonly type: string;
/**
* configuration for DynamoDB Datasource
*
* @default - No config
*/
readonly dynamoDbConfig?: CfnDataSource.DynamoDBConfigProperty | IResolvable;
/**
* configuration for Elasticsearch data source
*
* @deprecated - use `openSearchConfig`
* @default - No config
*/
readonly elasticsearchConfig?: CfnDataSource.ElasticsearchConfigProperty | IResolvable;
/**
* configuration for OpenSearch data source
*
* @default - No config
*/
readonly openSearchServiceConfig?: CfnDataSource.OpenSearchServiceConfigProperty | IResolvable;
/**
* configuration for HTTP Datasource
*
* @default - No config
*/
readonly httpConfig?: CfnDataSource.HttpConfigProperty | IResolvable;
/**
* configuration for EventBridge Datasource
*
* @default - No config
*/
readonly eventBridgeConfig?: CfnDataSource.EventBridgeConfigProperty | IResolvable;
/**
* configuration for Lambda Datasource
*
* @default - No config
*/
readonly lambdaConfig?: CfnDataSource.LambdaConfigProperty | IResolvable;
/**
* configuration for RDS Datasource
*
* @default - No config
*/
readonly relationalDatabaseConfig?: CfnDataSource.RelationalDatabaseConfigProperty | IResolvable;
}
/**
* Abstract AppSync datasource implementation. Do not use directly but use subclasses for concrete datasources
*/
export declare abstract class BaseDataSource extends Construct {
/**
* the name of the data source
*/
readonly name: string;
/**
* the underlying CFN data source resource
*/
readonly ds: CfnDataSource;
private _api;
protected serviceRole?: IRole;
constructor(scope: Construct, id: string, props: BackedDataSourceProps, extended: ExtendedDataSourceProps);
/**
* The API this data source is attached to
*/
protected get api(): IGraphqlApi;
/**
* Set the API this data source is attached to
*/
protected set api(api: IGraphqlApi);
/**
* creates a new resolver for this datasource and API using the given properties
*/
createResolver(id: string, props: BaseResolverProps): Resolver;
/**
* creates a new appsync function for this datasource and API using the given properties
*/
createFunction(id: string, props: BaseAppsyncFunctionProps): AppsyncFunction;
}
/**
* Abstract AppSync datasource implementation. Do not use directly but use subclasses for resource backed datasources
*/
export declare abstract class BackedDataSource extends BaseDataSource implements IGrantable {
/**
* the principal of the data source to be IGrantable
*/
readonly grantPrincipal: IPrincipal;
constructor(scope: Construct, id: string, props: BackedDataSourceProps, extended: ExtendedDataSourceProps);
}
/**
* Properties for an AppSync dummy datasource
*/
export interface NoneDataSourceProps extends BaseDataSourceProps {
}
/**
* An AppSync dummy datasource
*/
export declare class NoneDataSource extends BaseDataSource {
constructor(scope: Construct, id: string, props: NoneDataSourceProps);
}
/**
* Properties for an AppSync DynamoDB datasource
*/
export interface DynamoDbDataSourceProps extends BackedDataSourceProps {
/**
* The DynamoDB table backing this data source
*/
readonly table: ITable;
/**
* Specify whether this DS is read only or has read and write permissions to the DynamoDB table
*
* @default false
*/
readonly readOnlyAccess?: boolean;
/**
* use credentials of caller to access DynamoDB
*
* @default false
*/
readonly useCallerCredentials?: boolean;
}
/**
* An AppSync datasource backed by a DynamoDB table
*/
export declare class DynamoDbDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: DynamoDbDataSourceProps);
}
/**
* The authorization config in case the HTTP endpoint requires authorization
*/
export interface AwsIamConfig {
/**
* The signing region for AWS IAM authorization
*/
readonly signingRegion: string;
/**
* The signing service name for AWS IAM authorization
*/
readonly signingServiceName: string;
}
/**
* Properties for an AppSync http datasource
*/
export interface HttpDataSourceProps extends BackedDataSourceProps {
/**
* The http endpoint
*/
readonly endpoint: string;
/**
* The authorization config in case the HTTP endpoint requires authorization
*
* @default - none
*
*/
readonly authorizationConfig?: AwsIamConfig;
}
/**
* An AppSync datasource backed by a http endpoint
*/
export declare class HttpDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: HttpDataSourceProps);
}
/**
* Properties for an AppSync EventBridge datasource
*/
export interface EventBridgeDataSourceProps extends BackedDataSourceProps {
/**
* The EventBridge EventBus
*/
readonly eventBus: IEventBus;
}
/**
* An AppSync datasource backed by EventBridge
*/
export declare class EventBridgeDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: EventBridgeDataSourceProps);
}
/**
* Properties for an AppSync Lambda datasource
*/
export interface LambdaDataSourceProps extends BackedDataSourceProps {
/**
* The Lambda function to call to interact with this data source
*/
readonly lambdaFunction: IFunction;
}
/**
* An AppSync datasource backed by a Lambda function
*/
export declare class LambdaDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: LambdaDataSourceProps);
}
/**
* Properties for an AppSync RDS datasource Aurora Serverless V1
*/
export interface RdsDataSourceProps extends BackedDataSourceProps {
/**
* The serverless cluster to call to interact with this data source
*/
readonly serverlessCluster: IServerlessCluster;
/**
* The secret containing the credentials for the database
*/
readonly secretStore: ISecret;
/**
* The name of the database to use within the cluster
*
* @default - None
*/
readonly databaseName?: string;
}
/**
* Properties for an AppSync RDS datasource Aurora Serverless V2
*/
export interface RdsDataSourcePropsV2 extends BackedDataSourceProps {
/**
* The serverless cluster to call to interact with this data source
*/
readonly serverlessCluster: IDatabaseCluster;
/**
* The secret containing the credentials for the database
*/
readonly secretStore: ISecret;
/**
* The name of the database to use within the cluster
*
* @default - None
*/
readonly databaseName?: string;
}
/**
* An AppSync datasource backed by RDS
*/
export declare class RdsDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: RdsDataSourceProps);
}
/**
* Properties for the Elasticsearch Data Source
*
* @deprecated - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`
*/
export interface ElasticsearchDataSourceProps extends BackedDataSourceProps {
/**
* The elasticsearch domain containing the endpoint for the data source
*/
readonly domain: IElasticsearchDomain;
}
/**
* An Appsync datasource backed by Elasticsearch
*
* @deprecated - use `OpenSearchDataSource`
*/
export declare class ElasticsearchDataSource extends BackedDataSource {
constructor(scope: Construct, id: string, props: ElasticsearchDataSourceProps);
}
/**
* Properties for the OpenSearch Data Source
*/
export interface OpenSearchDataSourceProps extends BackedDataSourceProps {
/**
* The OpenSearch domain containing the endpoint for the data source
*/
readonly domain: IOpenSearchDomain;
}
/**
* An Appsync datasource backed by OpenSearch
*/
export declare class OpenSearchDataSource extends BackedDataSource {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: OpenSearchDataSourceProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,436 @@
import type { Construct } from 'constructs';
import type { IApi } from './api-base';
import { ApiBase } from './api-base';
import type { AppSyncLogConfig, AppSyncDomainOptions } from './appsync-common';
import { AppSyncEventResource } from './appsync-common';
import type { CfnApiKey } from './appsync.generated';
import type { AppSyncAuthProvider } from './auth-config';
import { AppSyncAuthorizationType } from './auth-config';
import type { ChannelNamespaceOptions } from './channel-namespace';
import { ChannelNamespace } from './channel-namespace';
import type { AppSyncDataSourceOptions, AppSyncHttpDataSourceOptions } from './data-source-common';
import { AppSyncDynamoDbDataSource, AppSyncHttpDataSource, AppSyncLambdaDataSource, AppSyncRdsDataSource, AppSyncOpenSearchDataSource, AppSyncEventBridgeDataSource } from './data-source-common';
import type { ITable } from '../../aws-dynamodb';
import type { IEventBus } from '../../aws-events';
import type { IGrantable } from '../../aws-iam';
import { Grant } from '../../aws-iam';
import type { IFunction } from '../../aws-lambda';
import type { ILogGroup } from '../../aws-logs';
import type { IDomain } from '../../aws-opensearchservice';
import type { IDatabaseCluster, IServerlessCluster } from '../../aws-rds';
import type { ISecret } from '../../aws-secretsmanager';
/**
* Authorization configuration for the Event API
*/
export interface EventApiAuthConfig {
/**
* Auth providers for use in connection,
* publish, and subscribe operations.
* @default - API Key authorization
*/
readonly authProviders?: AppSyncAuthProvider[];
/**
* Connection auth modes
* @default - API Key authorization
*/
readonly connectionAuthModeTypes?: AppSyncAuthorizationType[];
/**
* Default publish auth modes
* @default - API Key authorization
*/
readonly defaultPublishAuthModeTypes?: AppSyncAuthorizationType[];
/**
* Default subscribe auth modes
* @default - API Key authorization
*/
readonly defaultSubscribeAuthModeTypes?: AppSyncAuthorizationType[];
}
/**
* Interface for Event API
*/
export interface IEventApi extends IApi {
/**
* The Authorization Types for this Event Api
*/
readonly authProviderTypes: AppSyncAuthorizationType[];
/**
* The domain name of the Api's HTTP endpoint.
*
* @attribute
*/
readonly httpDns: string;
/**
* The domain name of the Api's real-time endpoint.
*
* @attribute
*/
readonly realtimeDns: string;
/**
* add a new channel namespace.
* @param id the id of the channel namespace
* @param options the options for the channel namespace
* @returns the channel namespace
*/
addChannelNamespace(id: string, options?: ChannelNamespaceOptions): ChannelNamespace;
/**
* Add a new DynamoDB data source to this API
*
* @param id The data source's id
* @param table The DynamoDB table backing this data source
* @param options The optional configuration for this data source
*/
addDynamoDbDataSource(id: string, table: ITable, options?: AppSyncDataSourceOptions): AppSyncDynamoDbDataSource;
/**
* add a new http data source to this API
*
* @param id The data source's id
* @param endpoint The http endpoint
* @param options The optional configuration for this data source
*/
addHttpDataSource(id: string, endpoint: string, options?: AppSyncHttpDataSourceOptions): AppSyncHttpDataSource;
/**
* Add an EventBridge data source to this api
* @param id The data source's id
* @param eventBus The EventBridge EventBus on which to put events
* @param options The optional configuration for this data source
*/
addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: AppSyncDataSourceOptions): AppSyncEventBridgeDataSource;
/**
* add a new Lambda data source to this API
*
* @param id The data source's id
* @param lambdaFunction The Lambda function to call to interact with this data source
* @param options The optional configuration for this data source
*/
addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: AppSyncDataSourceOptions): AppSyncLambdaDataSource;
/**
* add a new Rds data source to this API
*
* @param id The data source's id
* @param serverlessCluster The database cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the database cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSource(id: string, serverlessCluster: IServerlessCluster | IDatabaseCluster, secretStore: ISecret, databaseName?: string, options?: AppSyncDataSourceOptions): AppSyncRdsDataSource;
/**
* Add a new OpenSearch data source to this API
*
* @param id The data source's id
* @param domain The OpenSearch domain for this data source
* @param options The optional configuration for this data source
*/
addOpenSearchDataSource(id: string, domain: IDomain, options?: AppSyncDataSourceOptions): AppSyncOpenSearchDataSource;
/**
* Adds an IAM policy statement associated with this Event API to an IAM
* principal's policy.
*
* @param grantee The principal
* @param resources The set of resources to allow (i.e. ...:[region]:[accountId]:apis/EventApiId/...)
* @param actions The actions that should be granted to the principal (i.e. appsync:EventPublish )
*/
grant(grantee: IGrantable, resources: AppSyncEventResource, ...actions: string[]): Grant;
/**
* Adds an IAM policy statement for EventPublish access to this EventApi to an IAM
* principal's policy.
*
* @param grantee The principal
*/
grantPublish(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement for EventSubscribe access to this EventApi to an IAM
* principal's policy.
*
* @param grantee The principal
*/
grantSubscribe(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement to publish and subscribe to this API for an IAM principal's policy.
*
* @param grantee The principal
*/
grantPublishAndSubscribe(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement for EventConnect access to this EventApi to an IAM principal's policy.
*
* @param grantee The principal
*/
grantConnect(grantee: IGrantable): Grant;
}
/**
* Base Class for Event API
*/
export declare abstract class EventApiBase extends ApiBase implements IEventApi {
/**
* The domain name of the Api's HTTP endpoint.
*/
abstract readonly httpDns: string;
/**
* The domain name of the Api's real-time endpoint.
*/
abstract readonly realtimeDns: string;
/**
* The Authorization Types for this Event Api
*/
abstract readonly authProviderTypes: AppSyncAuthorizationType[];
/**
* add a new Channel Namespace to this API
*/
addChannelNamespace(id: string, options?: ChannelNamespaceOptions): ChannelNamespace;
/**
* add a new DynamoDB data source to this API
*
* @param id The data source's id
* @param table The DynamoDB table backing this data source
* @param options The optional configuration for this data source
*/
addDynamoDbDataSource(id: string, table: ITable, options?: AppSyncDataSourceOptions): AppSyncDynamoDbDataSource;
/**
* add a new http data source to this API
*
* @param id The data source's id
* @param endpoint The http endpoint
* @param options The optional configuration for this data source
*/
addHttpDataSource(id: string, endpoint: string, options?: AppSyncHttpDataSourceOptions): AppSyncHttpDataSource;
/**
* add a new Lambda data source to this API
*
* @param id The data source's id
* @param lambdaFunction The Lambda function to call to interact with this data source
* @param options The optional configuration for this data source
*/
addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: AppSyncDataSourceOptions): AppSyncLambdaDataSource;
/**
* add a new Rds data source to this API
* @param id The data source's id
* @param serverlessCluster The database cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the database cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSource(id: string, serverlessCluster: IServerlessCluster | IDatabaseCluster, secretStore: ISecret, databaseName?: string, options?: AppSyncDataSourceOptions): AppSyncRdsDataSource;
/**
* Add an EventBridge data source to this api
* @param id The data source's id
* @param eventBus The EventBridge EventBus on which to put events
* @param options The optional configuration for this data source
*/
addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: AppSyncDataSourceOptions): AppSyncEventBridgeDataSource;
/**
* add a new OpenSearch data source to this API
*
* @param id The data source's id
* @param domain The OpenSearch domain for this data source
* @param options The optional configuration for this data source
*/
addOpenSearchDataSource(id: string, domain: IDomain, options?: AppSyncDataSourceOptions): AppSyncOpenSearchDataSource;
/**
* Adds an IAM policy statement associated with this Event API to an IAM
* principal's policy.
* [disable-awslint:no-grants]
*
* @param grantee The principal
* @param resources The set of resources to allow (i.e. ...:[region]:[accountId]:apis/EventApiId/...)
* @param actions The actions that should be granted to the principal (i.e. appsync:EventPublish )
*/
grant(grantee: IGrantable, resources: AppSyncEventResource, ...actions: string[]): Grant;
/**
* Adds an IAM policy statement for EventPublish access to this EventApi to an IAM
* principal's policy. This grants publish permission for all channels within the API.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantPublish(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement for EventSubscribe access to this EventApi to an IAM
* principal's policy. This grants subscribe permission for all channels within the API.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantSubscribe(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement to publish and subscribe to this API for an IAM principal's policy.
* This grants publish & subscribe permission for all channels within the API.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantPublishAndSubscribe(grantee: IGrantable): Grant;
/**
* Adds an IAM policy statement for EventConnect access to this EventApi to an IAM principal's policy.
* [disable-awslint:no-grants]
*
* @param grantee The principal
*/
grantConnect(grantee: IGrantable): Grant;
}
/**
* Properties for an AppSync Event API
*/
export interface EventApiProps {
/**
* the name of the Event API
*/
readonly apiName: string;
/**
* Optional authorization configuration
*
* @default - API Key authorization
*/
readonly authorizationConfig?: EventApiAuthConfig;
/**
* Logging configuration for this api
*
* @default - None
*/
readonly logConfig?: AppSyncLogConfig;
/**
* The owner contact information for an API resource.
*
* This field accepts any string input with a length of 0 - 256 characters.
*
* @default - No owner contact.
*/
readonly ownerContact?: string;
/**
* The domain name configuration for the Event API
*
* The Route 53 hosted zone and CName DNS record must be configured in addition to this setting to
* enable custom domain URL
*
* @default - no domain name
*/
readonly domainName?: AppSyncDomainOptions;
}
/**
* Attributes for Event API imports
*/
export interface EventApiAttributes {
/**
* the name of the Event API
* @default - not needed to import API
*/
readonly apiName?: string;
/**
* an unique AWS AppSync Event API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*/
readonly apiId: string;
/**
* the ARN of the Event API
* @default - constructed arn
*/
readonly apiArn?: string;
/**
* the domain name of the Api's HTTP endpoint.
*/
readonly httpDns: string;
/**
* the domain name of the Api's real-time endpoint.
*/
readonly realtimeDns: string;
/**
* The Authorization Types for this Event Api
* @default - none, required to construct event rules from imported APIs
*/
readonly authProviderTypes?: AppSyncAuthorizationType[];
}
/**
* An AppSync Event API
*
* @resource AWS::AppSync::Api
*/
export declare class EventApi extends EventApiBase {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import a Event API through this function
*
* @param scope scope
* @param id id
* @param attrs Event API Attributes of an API
*/
static fromEventApiAttributes(scope: Construct, id: string, attrs: EventApiAttributes): IEventApi;
/**
* an unique AWS AppSync Event API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*/
readonly apiId: string;
/**
* the ARN of the API
*/
readonly apiArn: string;
/**
* the domain name of the Api's HTTP endpoint.
*/
readonly httpDns: string;
/**
* the domain name of the Api's real-time endpoint.
*/
readonly realtimeDns: string;
/**
* The Authorization Types for this Event Api
*/
readonly authProviderTypes: AppSyncAuthorizationType[];
/**
* The connection auth modes for this Event Api
*/
readonly connectionModeTypes: AppSyncAuthorizationType[];
/**
* The default publish auth modes for this Event Api
*/
readonly defaultPublishModeTypes: AppSyncAuthorizationType[];
/**
* The default subscribe auth modes for this Event Api
*/
readonly defaultSubscribeModeTypes: AppSyncAuthorizationType[];
/**
* The configured API keys, if present.
* The key of this object is an apiKey name (apiKeyConfig.name) if specified, `Default` otherwise.
*
* @default - no api key
* @attribute ApiKeys
*/
readonly apiKeys: {
[key: string]: CfnApiKey;
};
/**
* the CloudWatch Log Group for this API
*/
readonly logGroup: ILogGroup;
private api;
private eventConfig;
private domainNameResource?;
constructor(scope: Construct, id: string, props: EventApiProps);
/**
* Validate Event API configuration
*/
private validateEventApiConfiguration;
/**
* Validate ownerContact property
*/
private validateOwnerContact;
private setupLogConfig;
private setupAuthProviderTypes;
private mapAuthorizationProviders;
private mapAuthorizationConfig;
private validateAuthorizationProps;
private validateAuthorizationConfig;
/**
* The AppSyncDomainName of the associated custom domain
*/
get appSyncDomainName(): string;
/**
* The HTTP Endpoint of the associated custom domain
*/
get customHttpEndpoint(): string;
/**
* The Realtime Endpoint of the associated custom domain
*/
get customRealtimeEndpoint(): string;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,424 @@
import type { AwsIamConfig, DataSourceMetricsConfig } from './data-source';
import { DynamoDbDataSource, HttpDataSource, LambdaDataSource, NoneDataSource, RdsDataSource, ElasticsearchDataSource, OpenSearchDataSource, EventBridgeDataSource } from './data-source';
import type { ExtendedResolverProps } from './resolver';
import { Resolver } from './resolver';
import type { ITable } from '../../aws-dynamodb';
import type { IDomain as IElasticsearchDomain } from '../../aws-elasticsearch';
import type { IEventBus } from '../../aws-events';
import type { IGrantable } from '../../aws-iam';
import { Grant } from '../../aws-iam';
import type { IFunction } from '../../aws-lambda';
import type { IDomain as IOpenSearchDomain } from '../../aws-opensearchservice';
import type { IDatabaseCluster, IServerlessCluster } from '../../aws-rds';
import type { ISecret } from '../../aws-secretsmanager';
import type { CfnResource, IResource } from '../../core';
import { Resource } from '../../core';
import type { IGraphQLApiRef, GraphQLApiReference } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Optional configuration for data sources
*/
export interface DataSourceOptions {
/**
* The name of the data source, overrides the id given by cdk
*
* @default - generated by cdk given the id
*/
readonly name?: string;
/**
* The description of the data source
*
* @default - No description
*/
readonly description?: string;
/**
* Whether to enable enhanced metrics of the data source
* Value will be ignored, if `enhancedMetricsConfig.dataSourceLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_DATA_SOURCE_METRICS`
*
* @default - Enhance metrics are disabled
*/
readonly metricsConfig?: DataSourceMetricsConfig;
}
/**
* Optional configuration for Http data sources
*/
export interface HttpDataSourceOptions extends DataSourceOptions {
/**
* The authorization config in case the HTTP endpoint requires authorization
*
* @default - none
*/
readonly authorizationConfig?: AwsIamConfig;
}
/**
* A class used to generate resource arns for AppSync
*/
export declare class IamResource {
/**
* Generate the resource names given custom arns
*
* @param arns The custom arns that need to be permissioned
*
* Example: custom('/types/Query/fields/getExample')
*/
static custom(...arns: string[]): IamResource;
/**
* Generate the resource names given a type and fields
*
* @param type The type that needs to be allowed
* @param fields The fields that need to be allowed, if empty grant permissions to ALL fields
*
* Example: ofType('Query', 'GetExample')
*/
static ofType(type: string, ...fields: string[]): IamResource;
/**
* Generate the resource names that accepts all types: `*`
*/
static all(): IamResource;
private arns;
private constructor();
/**
* Return the Resource ARN
*
* @param api The GraphQL API to give permissions
*/
resourceArns(api: GraphqlApiBase): string[];
}
/**
* Visibility type for a GraphQL API
*/
export declare enum Visibility {
/**
* Public, open to the internet
*/
GLOBAL = "GLOBAL",
/**
* Only accessible through a VPC
*/
PRIVATE = "PRIVATE"
}
/**
* enum with all possible values for AppSync authorization type
*/
export declare enum AuthorizationType {
/**
* API Key authorization type
*/
API_KEY = "API_KEY",
/**
* AWS IAM authorization type. Can be used with Cognito Identity Pool federated credentials
*/
IAM = "AWS_IAM",
/**
* Cognito User Pool authorization type
*/
USER_POOL = "AMAZON_COGNITO_USER_POOLS",
/**
* OpenID Connect authorization type
*/
OIDC = "OPENID_CONNECT",
/**
* Lambda authorization type
*/
LAMBDA = "AWS_LAMBDA"
}
/**
* Interface for GraphQL
*/
export interface IGraphqlApi extends IResource, IGraphQLApiRef {
/**
* an unique AWS AppSync GraphQL API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*
* @attribute
*/
readonly apiId: string;
/**
* the ARN of the API
*
* @attribute
*/
readonly arn: string;
/**
* The GraphQL endpoint ARN
*/
readonly graphQLEndpointArn: string;
/**
* the visibility of the API
*/
readonly visibility: Visibility;
/**
* The Authorization Types for this GraphQL Api
*/
readonly modes: AuthorizationType[];
/**
* add a new dummy data source to this API. Useful for pipeline resolvers
* and for backend changes that don't require a data source.
*
* @param id The data source's id
* @param options The optional configuration for this data source
*/
addNoneDataSource(id: string, options?: DataSourceOptions): NoneDataSource;
/**
* add a new DynamoDB data source to this API
*
* @param id The data source's id
* @param table The DynamoDB table backing this data source
* @param options The optional configuration for this data source
*/
addDynamoDbDataSource(id: string, table: ITable, options?: DataSourceOptions): DynamoDbDataSource;
/**
* add a new http data source to this API
*
* @param id The data source's id
* @param endpoint The http endpoint
* @param options The optional configuration for this data source
*/
addHttpDataSource(id: string, endpoint: string, options?: HttpDataSourceOptions): HttpDataSource;
/**
* Add an EventBridge data source to this api
* @param id The data source's id
* @param eventBus The EventBridge EventBus on which to put events
* @param options The optional configuration for this data source
*/
addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: DataSourceOptions): EventBridgeDataSource;
/**
* add a new Lambda data source to this API
*
* @param id The data source's id
* @param lambdaFunction The Lambda function to call to interact with this data source
* @param options The optional configuration for this data source
*/
addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: DataSourceOptions): LambdaDataSource;
/**
* add a new Rds data source to this API
*
* @param id The data source's id
* @param serverlessCluster The serverless cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the serverless cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSource(id: string, serverlessCluster: IServerlessCluster, secretStore: ISecret, databaseName?: string, options?: DataSourceOptions): RdsDataSource;
/**
* add a new Rds Serverless V2 data source to this API
*
* @param id The data source's id
* @param serverlessCluster The serverless V2 cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the serverless cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSourceV2(id: string, serverlessCluster: IDatabaseCluster, secretStore: ISecret, databaseName?: string, options?: DataSourceOptions): RdsDataSource;
/**
* add a new elasticsearch data source to this API
*
* @deprecated - use `addOpenSearchDataSource`
* @param id The data source's id
* @param domain The elasticsearch domain for this data source
* @param options The optional configuration for this data source
*/
addElasticsearchDataSource(id: string, domain: IElasticsearchDomain, options?: DataSourceOptions): ElasticsearchDataSource;
/**
* Add a new OpenSearch data source to this API
*
* @param id The data source's id
* @param domain The OpenSearch domain for this data source
* @param options The optional configuration for this data source
*/
addOpenSearchDataSource(id: string, domain: IOpenSearchDomain, options?: DataSourceOptions): OpenSearchDataSource;
/**
* creates a new resolver for this datasource and API using the given properties
*/
createResolver(id: string, props: ExtendedResolverProps): Resolver;
/**
* Add schema dependency if not imported
*
* @param construct the dependee
*/
addSchemaDependency(construct: CfnResource): boolean;
/**
* Adds an IAM policy statement associated with this GraphQLApi to an IAM
* principal's policy.
*
* @param grantee The principal
* @param resources The set of resources to allow (i.e. ...:[region]:[accountId]:apis/GraphQLId/...)
* @param actions The actions that should be granted to the principal (i.e. appsync:graphql )
*/
grant(grantee: IGrantable, resources: IamResource, ...actions: string[]): Grant;
/**
* Adds an IAM policy statement for Mutation access to this GraphQLApi to an IAM
* principal's policy.
*
* @param grantee The principal
* @param fields The fields to grant access to that are Mutations (leave blank for all)
*/
grantMutation(grantee: IGrantable, ...fields: string[]): Grant;
/**
* Adds an IAM policy statement for Query access to this GraphQLApi to an IAM
* principal's policy.
*
* @param grantee The principal
* @param fields The fields to grant access to that are Queries (leave blank for all)
*/
grantQuery(grantee: IGrantable, ...fields: string[]): Grant;
/**
* Adds an IAM policy statement for Subscription access to this GraphQLApi to an IAM
* principal's policy.
*
* @param grantee The principal
* @param fields The fields to grant access to that are Subscriptions (leave blank for all)
*/
grantSubscription(grantee: IGrantable, ...fields: string[]): Grant;
}
/**
* Base Class for GraphQL API
*/
export declare abstract class GraphqlApiBase extends Resource implements IGraphqlApi {
/**
* an unique AWS AppSync GraphQL API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*/
abstract readonly apiId: string;
/**
* The GraphQL endpoint ARN
*/
abstract readonly graphQLEndpointArn: string;
/**
* The visibility of the API
*/
abstract readonly visibility: Visibility;
/**
* the ARN of the API
*/
abstract readonly arn: string;
/**
* The Authorization Types for this GraphQL Api
*/
abstract readonly modes: AuthorizationType[];
/**
* add a new dummy data source to this API. Useful for pipeline resolvers
* and for backend changes that don't require a data source.
*
* @param id The data source's id
* @param options The optional configuration for this data source
*/
addNoneDataSource(id: string, options?: DataSourceOptions): NoneDataSource;
/**
* add a new DynamoDB data source to this API
*
* @param id The data source's id
* @param table The DynamoDB table backing this data source
* @param options The optional configuration for this data source
*/
addDynamoDbDataSource(id: string, table: ITable, options?: DataSourceOptions): DynamoDbDataSource;
/**
* add a new http data source to this API
*
* @param id The data source's id
* @param endpoint The http endpoint
* @param options The optional configuration for this data source
*/
addHttpDataSource(id: string, endpoint: string, options?: HttpDataSourceOptions): HttpDataSource;
/**
* add a new Lambda data source to this API
*
* @param id The data source's id
* @param lambdaFunction The Lambda function to call to interact with this data source
* @param options The optional configuration for this data source
*/
addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: DataSourceOptions): LambdaDataSource;
/**
* add a new Rds data source to this API
* @param id The data source's id
* @param serverlessCluster The serverless cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the serverless cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSource(id: string, serverlessCluster: IServerlessCluster, secretStore: ISecret, databaseName?: string, options?: DataSourceOptions): RdsDataSource;
/**
* add a new Rds data source to this API
* @param id The data source's id
* @param serverlessCluster The serverless V2 cluster to interact with this data source
* @param secretStore The secret store that contains the username and password for the serverless cluster
* @param databaseName The optional name of the database to use within the cluster
* @param options The optional configuration for this data source
*/
addRdsDataSourceV2(id: string, serverlessCluster: IDatabaseCluster, secretStore: ISecret, databaseName?: string, options?: DataSourceOptions): RdsDataSource;
/**
* add a new elasticsearch data source to this API
*
* @deprecated - use `addOpenSearchDataSource`
* @param id The data source's id
* @param domain The elasticsearch domain for this data source
* @param options The optional configuration for this data source
*/
addElasticsearchDataSource(id: string, domain: IElasticsearchDomain, options?: DataSourceOptions): ElasticsearchDataSource;
/**
* Add an EventBridge data source to this api
* @param id The data source's id
* @param eventBus The EventBridge EventBus on which to put events
* @param options The optional configuration for this data source
*/
addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: DataSourceOptions): EventBridgeDataSource;
/**
* add a new OpenSearch data source to this API
*
* @param id The data source's id
* @param domain The OpenSearch domain for this data source
* @param options The optional configuration for this data source
*/
addOpenSearchDataSource(id: string, domain: IOpenSearchDomain, options?: DataSourceOptions): OpenSearchDataSource;
/**
* creates a new resolver for this datasource and API using the given properties
*/
createResolver(id: string, props: ExtendedResolverProps): Resolver;
/**
* Add schema dependency if not imported
*
* @param construct the dependee
*/
addSchemaDependency(construct: CfnResource): boolean;
/**
* Adds an IAM policy statement associated with this GraphQLApi to an IAM
* principal's policy.
*
* [disable-awslint:no-grants]
*
* @param grantee The principal
* @param resources The set of resources to allow (i.e. ...:[region]:[accountId]:apis/GraphQLId/...)
* @param actions The actions that should be granted to the principal (i.e. appsync:graphql )
*/
grant(grantee: IGrantable, resources: IamResource, ...actions: string[]): Grant;
/**
* Adds an IAM policy statement for Mutation access to this GraphQLApi to an IAM
* principal's policy.
*
* [disable-awslint:no-grants]
*
* @param grantee The principal
* @param fields The fields to grant access to that are Mutations (leave blank for all)
*/
grantMutation(grantee: IGrantable, ...fields: string[]): Grant;
/**
* Adds an IAM policy statement for Query access to this GraphQLApi to an IAM
* principal's policy.
*
* [disable-awslint:no-grants]
*
* @param grantee The principal
* @param fields The fields to grant access to that are Queries (leave blank for all)
*/
grantQuery(grantee: IGrantable, ...fields: string[]): Grant;
/**
* Adds an IAM policy statement for Subscription access to this GraphQLApi to an IAM
* principal's policy.
*
* [disable-awslint:no-grants]
*
* @param grantee The principal
* @param fields The fields to grant access to that are Subscriptions (leave blank for all)
*/
grantSubscription(grantee: IGrantable, ...fields: string[]): Grant;
get graphQlApiRef(): GraphQLApiReference;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,614 @@
import type { Construct } from 'constructs';
import type { IGraphqlApi } from './graphqlapi-base';
import { GraphqlApiBase, Visibility, AuthorizationType } from './graphqlapi-base';
import type { ISchema } from './schema';
import { MergeType } from './source-api-association';
import type { IUserPool } from '../../aws-cognito';
import type { IRoleRef } from '../../aws-iam';
import { Role } from '../../aws-iam';
import type { IFunction } from '../../aws-lambda';
import type { ILogGroup } from '../../aws-logs';
import { RetentionDays } from '../../aws-logs';
import type { CfnResource, Expiration, IResolvable } from '../../core';
import { Duration } from '../../core';
import type { ICertificateRef } from '../../interfaces/generated/aws-certificatemanager-interfaces.generated';
/**
* Interface to specify default or additional authorization(s)
*/
export interface AuthorizationMode {
/**
* One of possible four values AppSync supports
*
* @see https://docs.aws.amazon.com/appsync/latest/devguide/security.html
*
* @default - `AuthorizationType.API_KEY`
*/
readonly authorizationType: AuthorizationType;
/**
* If authorizationType is `AuthorizationType.USER_POOL`, this option is required.
* @default - none
*/
readonly userPoolConfig?: UserPoolConfig;
/**
* If authorizationType is `AuthorizationType.API_KEY`, this option can be configured.
* @default - name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'
*/
readonly apiKeyConfig?: ApiKeyConfig;
/**
* If authorizationType is `AuthorizationType.OIDC`, this option is required.
* @default - none
*/
readonly openIdConnectConfig?: OpenIdConnectConfig;
/**
* If authorizationType is `AuthorizationType.LAMBDA`, this option is required.
* @default - none
*/
readonly lambdaAuthorizerConfig?: LambdaAuthorizerConfig;
}
/**
* enum with all possible values for Cognito user-pool default actions
*/
export declare enum UserPoolDefaultAction {
/**
* ALLOW access to API
*/
ALLOW = "ALLOW",
/**
* DENY access to API
*/
DENY = "DENY"
}
/**
* Configuration for Cognito user-pools in AppSync
*/
export interface UserPoolConfig {
/**
* The Cognito user pool to use as identity source
*/
readonly userPool: IUserPool;
/**
* the optional app id regex
*
* @default - None
*/
readonly appIdClientRegex?: string;
/**
* Default auth action
*
* @default ALLOW
*/
readonly defaultAction?: UserPoolDefaultAction;
}
/**
* Configuration for API Key authorization in AppSync
*/
export interface ApiKeyConfig {
/**
* Unique name of the API Key
* @default - 'DefaultAPIKey'
*/
readonly name?: string;
/**
* Description of API key
* @default - 'Default API Key created by CDK'
*/
readonly description?: string;
/**
* The time from creation time after which the API key expires.
* It must be a minimum of 1 day and a maximum of 365 days from date of creation.
* Rounded down to the nearest hour.
*
* @default - 7 days rounded down to nearest hour
*/
readonly expires?: Expiration;
}
/**
* Configuration for OpenID Connect authorization in AppSync
*/
export interface OpenIdConnectConfig {
/**
* The number of milliseconds an OIDC token is valid after being authenticated by OIDC provider.
* `auth_time` claim in OIDC token is required for this validation to work.
* @default - no validation
*/
readonly tokenExpiryFromAuth?: number;
/**
* The number of milliseconds an OIDC token is valid after being issued to a user.
* This validation uses `iat` claim of OIDC token.
* @default - no validation
*/
readonly tokenExpiryFromIssue?: number;
/**
* The client identifier of the Relying party at the OpenID identity provider.
* A regular expression can be specified so AppSync can validate against multiple client identifiers at a time.
* @example - 'ABCD|CDEF' // where ABCD and CDEF are two different clientId
* @default - * (All)
*/
readonly clientId?: string;
/**
* The issuer for the OIDC configuration. The issuer returned by discovery must exactly match the value of `iss` in the OIDC token.
*/
readonly oidcProvider: string;
}
/**
* Configuration for Lambda authorization in AppSync. Note that you can only have a single AWS Lambda function configured to authorize your API.
*/
export interface LambdaAuthorizerConfig {
/**
* The authorizer lambda function.
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-lambdaauthorizerconfig.html
*/
readonly handler: IFunction;
/**
* How long the results are cached.
* Disable caching by setting this to 0.
*
* @default Duration.minutes(5)
*/
readonly resultsCacheTtl?: Duration;
/**
* A regular expression for validation of tokens before the Lambda function is called.
*
* @default - no regex filter will be applied.
*/
readonly validationRegex?: string;
}
/**
* Configuration of the API authorization modes.
*/
export interface AuthorizationConfig {
/**
* Optional authorization configuration
*
* @default - API Key authorization
*/
readonly defaultAuthorization?: AuthorizationMode;
/**
* Additional authorization modes
*
* @default - No other modes
*/
readonly additionalAuthorizationModes?: AuthorizationMode[];
}
/**
* log-level for fields in AppSync
*/
export declare enum FieldLogLevel {
/**
* Resolver logging is disabled
*/
NONE = "NONE",
/**
* Only Error messages appear in logs
*/
ERROR = "ERROR",
/**
* Info and Error messages appear in logs
*/
INFO = "INFO",
/**
* Debug, Info, and Error messages, appear in logs
*/
DEBUG = "DEBUG",
/**
* All messages (Debug, Error, Info, and Trace) appear in logs
*/
ALL = "ALL"
}
/**
* Logging configuration for AppSync
*/
export interface LogConfig {
/**
* exclude verbose content
*
* @default false
*/
readonly excludeVerboseContent?: boolean | IResolvable;
/**
* log level for fields
*
* @default - Use AppSync default
*/
readonly fieldLogLevel?: FieldLogLevel;
/**
* The role for CloudWatch Logs
*
* @default - None
*/
readonly role?: IRoleRef;
/**
* The number of days log events are kept in CloudWatch Logs.
* By default AppSync keeps the logs infinitely. When updating this property,
* unsetting it doesn't remove the log retention policy.
* To remove the retention policy, set the value to `INFINITE`
*
* @default RetentionDays.INFINITE
*/
readonly retention?: RetentionDays;
}
/**
* Controls how data source metrics will be emitted to CloudWatch.
*/
export declare enum DataSourceLevelMetricsBehavior {
/**
* Records and emits metric data for all data sources in the request.
*/
FULL_REQUEST_DATA_SOURCE_METRICS = "FULL_REQUEST_DATA_SOURCE_METRICS",
/**
* Records and emits metric data for data sources that have the MetricsConfig value set to ENABLED.
*/
PER_DATA_SOURCE_METRICS = "PER_DATA_SOURCE_METRICS"
}
/**
* Controls how operation metrics will be emitted to CloudWatch.
*/
export declare enum OperationLevelMetricsConfig {
/**
* Sends operation metrics to CloudWatch.
*/
ENABLED = "ENABLED",
/**
* Does not send operation metrics to CloudWatch.
*/
DISABLED = "DISABLED"
}
/**
* Controls how resolver metrics will be emitted to CloudWatch.
*/
export declare enum ResolverLevelMetricsBehavior {
/**
* Records and emits metric data for all resolvers in the request.
*/
FULL_REQUEST_RESOLVER_METRICS = "FULL_REQUEST_RESOLVER_METRICS",
/**
* Records and emits metric data for resolvers that have the MetricsConfig value set to ENABLED.
*/
PER_RESOLVER_METRICS = "PER_RESOLVER_METRICS"
}
/**
* Enhanced metrics configuration for AppSync
*/
export interface EnhancedMetricsConfig {
/**
* Controls how data source metrics will be emitted to CloudWatch.
*/
readonly dataSourceLevelMetricsBehavior: DataSourceLevelMetricsBehavior;
/**
* Controls how operation metrics will be emitted to CloudWatch.
*/
readonly operationLevelMetricsConfig: OperationLevelMetricsConfig;
/**
* Controls how resolver metrics will be emitted to CloudWatch.
*/
readonly resolverLevelMetricsBehavior: ResolverLevelMetricsBehavior;
}
/**
* Domain name configuration for AppSync
*/
export interface DomainOptions {
/**
* The certificate to use with the domain name.
*/
readonly certificate: ICertificateRef;
/**
* The actual domain name. For example, `api.example.com`.
*/
readonly domainName: string;
}
/**
* Additional API configuration for creating a AppSync Merged API
*/
export interface SourceApiOptions {
/**
* Definition of source APIs associated with this Merged API
*/
readonly sourceApis: SourceApi[];
/**
* IAM Role used to validate access to source APIs at runtime and to update the merged API endpoint with the source API changes
*
* @default - An IAM Role with acccess to source schemas will be created
*/
readonly mergedApiExecutionRole?: Role;
}
/**
* Configuration of source API
*/
export interface SourceApi {
/**
* Source API that is associated with the merged API
*
* @jsii suppress JSII5019 For historic reasons
*/
readonly sourceApi: IGraphqlApi;
/**
* Merging option used to associate the source API to the Merged API
*
* @default - Auto merge. The merge is triggered automatically when the source API has changed
*/
readonly mergeType?: MergeType;
/**
* Description of the Source API asssociation.
*/
readonly description?: string;
}
/**
* AppSync definition. Specify how you want to define your AppSync API.
*/
export declare abstract class Definition {
/**
* Schema from schema object.
* @param schema SchemaFile.fromAsset(filePath: string) allows schema definition through schema.graphql file
* @returns Definition with schema from file
*/
static fromSchema(schema: ISchema): Definition;
/**
* Schema from file, allows schema definition through schema.graphql file
* @param filePath the file path of the schema file
* @returns Definition with schema from file
*/
static fromFile(filePath: string): Definition;
/**
* Schema from existing AppSync APIs - used for creating a AppSync Merged API
* @param sourceApiOptions Configuration for AppSync Merged API
* @returns Definition with for AppSync Merged API
*/
static fromSourceApis(sourceApiOptions: SourceApiOptions): Definition;
/**
* Schema, when AppSync API is created from schema file
*/
readonly schema?: ISchema;
/**
* Source APIs for Merged API
*/
readonly sourceApiOptions?: SourceApiOptions;
}
/**
* Properties for an AppSync GraphQL API
*/
export interface GraphqlApiProps {
/**
* the name of the GraphQL API
*/
readonly name: string;
/**
* Optional authorization configuration
*
* @default - API Key authorization
*/
readonly authorizationConfig?: AuthorizationConfig;
/**
* Logging configuration for this api
*
* @default - None
*/
readonly logConfig?: LogConfig;
/**
* Definition (schema file or source APIs) for this GraphQL Api
*/
readonly definition?: Definition;
/**
* GraphQL schema definition. Specify how you want to define your schema.
*
* SchemaFile.fromAsset(filePath: string) allows schema definition through schema.graphql file
*
* @default - schema will be generated code-first (i.e. addType, addObjectType, etc.)
* @deprecated use Definition.schema instead
*/
readonly schema?: ISchema;
/**
* A flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.
*
* @default - false
*/
readonly xrayEnabled?: boolean;
/**
* A value indicating whether the API is accessible from anywhere (GLOBAL) or can only be access from a VPC (PRIVATE).
*
* @default - GLOBAL
*/
readonly visibility?: Visibility;
/**
* The domain name configuration for the GraphQL API
*
* The Route 53 hosted zone and CName DNS record must be configured in addition to this setting to
* enable custom domain URL
*
* @default - no domain name
*/
readonly domainName?: DomainOptions;
/**
* A value indicating whether the API to enable (ENABLED) or disable (DISABLED) introspection.
*
* @default IntrospectionConfig.ENABLED
*/
readonly introspectionConfig?: IntrospectionConfig;
/**
* A number indicating the maximum depth resolvers should be accepted when handling queries.
* Value must be withing range of 0 to 75
*
* @default - The default value is 0 (or unspecified) which indicates no maximum depth.
*/
readonly queryDepthLimit?: number;
/**
* A number indicating the maximum number of resolvers that should be accepted when handling queries.
* Value must be withing range of 0 to 10000
*
* @default - The default value is 0 (or unspecified), which will set the limit to 10000
*/
readonly resolverCountLimit?: number;
/**
* A map containing the list of resources with their properties and environment variables.
*
* There are a few rules you must follow when creating keys and values:
* - Keys must begin with a letter.
* - Keys must be between 2 and 64 characters long.
* - Keys can only contain letters, numbers, and the underscore character (_).
* - Values can be up to 512 characters long.
* - You can configure up to 50 key-value pairs in a GraphQL API.
*
* @default - No environment variables.
*/
readonly environmentVariables?: {
[key: string]: string;
};
/**
* The owner contact information for an API resource.
*
* This field accepts any string input with a length of 0 - 256 characters.
*
* @default - No owner contact.
*/
readonly ownerContact?: string;
/**
* Enables and controls the enhanced metrics feature.
*
* @default - Enhanced metrics disabled.
*/
readonly enhancedMetricsConfig?: EnhancedMetricsConfig;
}
/**
* Attributes for GraphQL imports
*/
export interface GraphqlApiAttributes {
/**
* an unique AWS AppSync GraphQL API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*/
readonly graphqlApiId: string;
/**
* the arn for the GraphQL Api
* @default - autogenerated arn
*/
readonly graphqlApiArn?: string;
/**
* The GraphQl endpoint arn for the GraphQL API
*
* @default - none, required to construct event rules from imported APIs
*/
readonly graphQLEndpointArn?: string;
/**
* The GraphQl API visibility
*
* @default - GLOBAL
*/
readonly visibility?: Visibility;
/**
* The Authorization Types for this GraphQL Api
*
* @default - none, required to construct event rules from imported APIs
*/
readonly modes?: AuthorizationType[];
}
/**
* Introspection configuration for a GraphQL API
*/
export declare enum IntrospectionConfig {
/**
* Enable introspection
*/
ENABLED = "ENABLED",
/**
* Disable introspection
*/
DISABLED = "DISABLED"
}
/**
* An AppSync GraphQL API
*
* @resource AWS::AppSync::GraphQLApi
*/
export declare class GraphqlApi extends GraphqlApiBase {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import a GraphQL API through this function
*
* @param scope scope
* @param id id
* @param attrs GraphQL API Attributes of an API
*/
static fromGraphqlApiAttributes(scope: Construct, id: string, attrs: GraphqlApiAttributes): IGraphqlApi;
/**
* an unique AWS AppSync GraphQL API identifier
* i.e. 'lxz775lwdrgcndgz3nurvac7oa'
*/
readonly apiId: string;
/**
* the ARN of the API
*/
readonly arn: string;
/**
* The GraphQL endpoint ARN
*/
readonly graphQLEndpointArn: string;
/**
* the URL of the endpoint created by AppSync
*
* @attribute GraphQlUrl
*/
readonly graphqlUrl: string;
/**
* the name of the API
*/
readonly name: string;
/**
* the visibility of the API
*/
readonly visibility: Visibility;
/**
* the schema attached to this api (only available for GraphQL APIs, not available for merged APIs)
*/
get schema(): ISchema;
/**
* The Authorization Types for this GraphQL Api
*/
readonly modes: AuthorizationType[];
/**
* the configured API key, if present
*
* @default - no api key
*/
readonly apiKey?: string;
/**
* the CloudWatch Log Group for this API
*/
readonly logGroup: ILogGroup;
private definition;
private schemaResource?;
private api;
private apiKeyResource?;
private domainNameResource?;
private mergedApiExecutionRole?;
private environmentVariables;
constructor(scope: Construct, id: string, props: GraphqlApiProps);
private setupSourceApiAssociations;
private setupMergedApiExecutionRole;
private validateAuthorizationProps;
/**
* Add schema dependency to a given construct
*
* @param construct the dependee
*/
addSchemaDependency(construct: CfnResource): boolean;
/**
* Add an environment variable to the construct.
*/
addEnvironmentVariable(key: string, value: string): void;
private validateEnvironmentVariables;
private renderEnvironmentVariables;
private setupLogConfig;
private setupOpenIdConnectConfig;
private setupUserPoolConfig;
private setupLambdaAuthorizerConfig;
private setupAdditionalAuthorizationModes;
private setupEnhancedMetricsConfig;
private createAPIKey;
/**
* The AppSyncDomainName of the associated custom domain
*/
get appSyncDomainName(): string;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
export * from './api-base';
export * from './appsync-function';
export * from './appsync.generated';
export * from './caching-config';
export * from './caching-key';
export * from './key';
export * from './data-source';
export * from './data-source-common';
export * from './mapping-template';
export * from './resolver';
export * from './schema';
export * from './graphqlapi';
export * from './graphqlapi-base';
export * from './code';
export * from './runtime';
export * from './source-api-association';
export * from './appsync-common';
export * from './auth-config';
export * from './eventapi';
export * from './channel-namespace';

File diff suppressed because one or more lines are too long

169
cdk/node_modules/aws-cdk-lib/aws-appsync/lib/key.d.ts generated vendored Normal file
View File

@@ -0,0 +1,169 @@
/**
* Factory class for DynamoDB key conditions.
*/
export declare class KeyCondition {
private readonly cond;
/**
* Condition k = arg, true if the key attribute k is equal to the Query argument
*/
static eq(keyName: string, arg: string): KeyCondition;
/**
* Condition k < arg, true if the key attribute k is less than the Query argument
*/
static lt(keyName: string, arg: string): KeyCondition;
/**
* Condition k <= arg, true if the key attribute k is less than or equal to the Query argument
*/
static le(keyName: string, arg: string): KeyCondition;
/**
* Condition k > arg, true if the key attribute k is greater than the Query argument
*/
static gt(keyName: string, arg: string): KeyCondition;
/**
* Condition k >= arg, true if the key attribute k is greater or equal to the Query argument
*/
static ge(keyName: string, arg: string): KeyCondition;
/**
* Condition (k, arg). True if the key attribute k begins with the Query argument.
*/
static beginsWith(keyName: string, arg: string): KeyCondition;
/**
* Condition k BETWEEN arg1 AND arg2, true if k >= arg1 and k <= arg2.
*/
static between(keyName: string, arg1: string, arg2: string): KeyCondition;
private constructor();
/**
* Conjunction between two conditions.
*/
and(keyCond: KeyCondition): KeyCondition;
/**
* Renders the key condition to a VTL string.
*/
renderTemplate(): string;
}
/**
* Utility class representing the assigment of a value to an attribute.
*/
export declare class Assign {
private readonly attr;
private readonly arg;
constructor(attr: string, arg: string);
/**
* Renders the assignment as a VTL string.
*/
renderAsAssignment(): string;
/**
* Renders the assignment as a map element.
*/
putInMap(map: string): string;
}
/**
* Utility class to allow assigning a value or an auto-generated id
* to a partition key.
*/
export declare class PartitionKeyStep {
private readonly key;
constructor(key: string);
/**
* Assign an auto-generated value to the partition key.
*/
is(val: string): PartitionKey;
/**
* Assign an auto-generated value to the partition key.
*/
auto(): PartitionKey;
}
/**
* Utility class to allow assigning a value or an auto-generated id
* to a sort key.
*/
export declare class SortKeyStep {
private readonly pkey;
private readonly skey;
constructor(pkey: Assign, skey: string);
/**
* Assign an auto-generated value to the sort key.
*/
is(val: string): PrimaryKey;
/**
* Assign an auto-generated value to the sort key.
*/
auto(): PrimaryKey;
}
/**
* Specifies the assignment to the primary key. It either
* contains the full primary key or only the partition key.
*/
export declare class PrimaryKey {
protected readonly pkey: Assign;
private readonly skey?;
/**
* Allows assigning a value to the partition key.
*/
static partition(key: string): PartitionKeyStep;
constructor(pkey: Assign, skey?: Assign | undefined);
/**
* Renders the key assignment to a VTL string.
*/
renderTemplate(): string;
}
/**
* Specifies the assignment to the partition key. It can be
* enhanced with the assignment of the sort key.
*/
export declare class PartitionKey extends PrimaryKey {
constructor(pkey: Assign);
/**
* Allows assigning a value to the sort key.
*/
sort(key: string): SortKeyStep;
}
/**
* Specifies the attribute value assignments.
*/
export declare class AttributeValues {
private readonly container;
private readonly assignments;
constructor(container: string, assignments?: Assign[]);
/**
* Allows assigning a value to the specified attribute.
*/
attribute(attr: string): AttributeValuesStep;
/**
* Renders the variables required for `renderTemplate`.
*/
renderVariables(): string;
/**
* Renders the attribute value assingments to a VTL string.
*/
renderTemplate(): string;
}
/**
* Utility class to allow assigning a value to an attribute.
*/
export declare class AttributeValuesStep {
private readonly attr;
private readonly container;
private readonly assignments;
constructor(attr: string, container: string, assignments: Assign[]);
/**
* Assign the value to the current attribute.
*/
is(val: string): AttributeValues;
}
/**
* Factory class for attribute value assignments.
*/
export declare class Values {
/**
* Treats the specified object as a map of assignments, where the property
* names represent attribute names. Its opinionated about how it represents
* some of the nested objects: e.g., it will use lists (“L”) rather than sets
* (“SS”, “NS”, “BS”). By default it projects the argument container ("$ctx.args").
*/
static projecting(arg?: string): AttributeValues;
/**
* Allows assigning a value to the specified attribute.
*/
static attribute(attr: string): AttributeValuesStep;
}

13
cdk/node_modules/aws-cdk-lib/aws-appsync/lib/key.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Values=exports.AttributeValuesStep=exports.AttributeValues=exports.PartitionKey=exports.PrimaryKey=exports.SortKeyStep=exports.PartitionKeyStep=exports.Assign=exports.KeyCondition=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var private_1=()=>{var tmp=require("./private");return private_1=()=>tmp,tmp};class KeyCondition{cond;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.KeyCondition",version:"2.252.0"};static eq(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"=",arg))}static lt(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"<",arg))}static le(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,"<=",arg))}static gt(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,">",arg))}static ge(keyName,arg){return new KeyCondition(new(private_1()).BinaryCondition(keyName,">=",arg))}static beginsWith(keyName,arg){return new KeyCondition(new(private_1()).BeginsWith(keyName,arg))}static between(keyName,arg1,arg2){return new KeyCondition(new(private_1()).Between(keyName,arg1,arg2))}constructor(cond){this.cond=cond}and(keyCond){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_KeyCondition(keyCond)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.and),error}return new KeyCondition(this.cond.and(keyCond.cond))}renderTemplate(){return`"query" : {
"expression" : "${this.cond.renderCondition()}",
"expressionNames" : {
${this.cond.renderExpressionNames()}
},
"expressionValues" : {
${this.cond.renderExpressionValues()}
}
}`}}exports.KeyCondition=KeyCondition;class Assign{attr;arg;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Assign",version:"2.252.0"};constructor(attr,arg){this.attr=attr,this.arg=arg}renderAsAssignment(){return`"${this.attr}" : $util.dynamodb.toDynamoDBJson(${this.arg})`}putInMap(map){return`$util.qr($${map}.put("${this.attr}", ${this.arg}))`}}exports.Assign=Assign;class PartitionKeyStep{key;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PartitionKeyStep",version:"2.252.0"};constructor(key){this.key=key}is(val){return new PartitionKey(new Assign(this.key,`$ctx.args.${val}`))}auto(){return new PartitionKey(new Assign(this.key,"$util.autoId()"))}}exports.PartitionKeyStep=PartitionKeyStep;class SortKeyStep{pkey;skey;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.SortKeyStep",version:"2.252.0"};constructor(pkey,skey){this.pkey=pkey,this.skey=skey;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SortKeyStep),error}}is(val){return new PrimaryKey(this.pkey,new Assign(this.skey,`$ctx.args.${val}`))}auto(){return new PrimaryKey(this.pkey,new Assign(this.skey,"$util.autoId()"))}}exports.SortKeyStep=SortKeyStep;class PrimaryKey{pkey;skey;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PrimaryKey",version:"2.252.0"};static partition(key){return new PartitionKeyStep(key)}constructor(pkey,skey){this.pkey=pkey,this.skey=skey;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey),jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(skey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,PrimaryKey),error}}renderTemplate(){const assignments=[this.pkey.renderAsAssignment()];return this.skey&&assignments.push(this.skey.renderAsAssignment()),`"key" : {
${assignments.join(",")}
}`}}exports.PrimaryKey=PrimaryKey;class PartitionKey extends PrimaryKey{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.PartitionKey",version:"2.252.0"};constructor(pkey){super(pkey);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_Assign(pkey)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,PartitionKey),error}}sort(key){return new SortKeyStep(this.pkey,key)}}exports.PartitionKey=PartitionKey;class AttributeValues{container;assignments;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AttributeValues",version:"2.252.0"};constructor(container,assignments=[]){this.container=container,this.assignments=assignments}attribute(attr){return new AttributeValuesStep(attr,this.container,this.assignments)}renderVariables(){return`#set($input = ${this.container})
${this.assignments.map(a=>a.putInMap("input")).join(`
`)}`}renderTemplate(){return'"attributeValues": $util.dynamodb.toMapValuesJson($input)'}}exports.AttributeValues=AttributeValues;class AttributeValuesStep{attr;container;assignments;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.AttributeValuesStep",version:"2.252.0"};constructor(attr,container,assignments){this.attr=attr,this.container=container,this.assignments=assignments}is(val){return this.assignments.push(new Assign(this.attr,val)),new AttributeValues(this.container,this.assignments)}}exports.AttributeValuesStep=AttributeValuesStep;class Values{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Values",version:"2.252.0"};static projecting(arg){return new AttributeValues("$ctx.args"+(arg?`.${arg}`:""))}static attribute(attr){return new AttributeValues("{}").attribute(attr)}}exports.Values=Values;

View File

@@ -0,0 +1,69 @@
import type { AttributeValues, KeyCondition, PrimaryKey } from './key';
/**
* MappingTemplates for AppSync resolvers
*/
export declare abstract class MappingTemplate {
/**
* Create a mapping template from the given string
*/
static fromString(template: string): MappingTemplate;
/**
* Create a mapping template from the given file
*/
static fromFile(fileName: string): MappingTemplate;
/**
* Mapping template for a result list from DynamoDB
*/
static dynamoDbResultList(): MappingTemplate;
/**
* Mapping template for a single result item from DynamoDB
*/
static dynamoDbResultItem(): MappingTemplate;
/**
* Mapping template to scan a DynamoDB table to fetch all entries
*/
static dynamoDbScanTable(consistentRead?: boolean): MappingTemplate;
/**
* Mapping template to query a set of items from a DynamoDB table
*
* @param cond the key condition for the query
*/
static dynamoDbQuery(cond: KeyCondition, indexName?: string, consistentRead?: boolean): MappingTemplate;
/**
* Mapping template to get a single item from a DynamoDB table
*
* @param keyName the name of the hash key field
* @param idArg the name of the Query argument
*/
static dynamoDbGetItem(keyName: string, idArg: string, consistentRead?: boolean): MappingTemplate;
/**
* Mapping template to delete a single item from a DynamoDB table
*
* @param keyName the name of the hash key field
* @param idArg the name of the Mutation argument
*/
static dynamoDbDeleteItem(keyName: string, idArg: string): MappingTemplate;
/**
* Mapping template to save a single item to a DynamoDB table
*
* @param key the assigment of Mutation values to the primary key
* @param values the assignment of Mutation values to the table attributes
*/
static dynamoDbPutItem(key: PrimaryKey, values: AttributeValues): MappingTemplate;
/**
* Mapping template to invoke a Lambda function
*
* @param payload the VTL template snippet of the payload to send to the lambda.
* If no payload is provided all available context fields are sent to the Lambda function
* @param operation the type of operation AppSync should perform on the data source
*/
static lambdaRequest(payload?: string, operation?: string): MappingTemplate;
/**
* Mapping template to return the Lambda result to the caller
*/
static lambdaResult(): MappingTemplate;
/**
* this is called to render the mapping template to a VTL string
*/
abstract renderTemplate(): string;
}

View File

@@ -0,0 +1,8 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MappingTemplate=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var fs_1=()=>{var tmp=require("fs");return fs_1=()=>tmp,tmp};class MappingTemplate{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.MappingTemplate",version:"2.252.0"};static fromString(template){return new StringMappingTemplate(template)}static fromFile(fileName){return new StringMappingTemplate((0,fs_1().readFileSync)(fileName).toString("utf-8"))}static dynamoDbResultList(){return this.fromString("$util.toJson($ctx.result.items)")}static dynamoDbResultItem(){return this.fromString("$util.toJson($ctx.result)")}static dynamoDbScanTable(consistentRead=!1){return this.fromString(`{"version" : "2017-02-28", "operation" : "Scan", "consistentRead": ${consistentRead}}`)}static dynamoDbQuery(cond,indexName,consistentRead=!1){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_KeyCondition(cond)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.dynamoDbQuery),error}return this.fromString(`{"version" : "2017-02-28", "operation" : "Query", "consistentRead": ${consistentRead}, ${indexName?`"index" : "${indexName}", `:""}${cond.renderTemplate()}}`)}static dynamoDbGetItem(keyName,idArg,consistentRead=!1){return this.fromString(`{"version": "2017-02-28", "operation": "GetItem", "consistentRead": ${consistentRead}, "key": {"${keyName}": $util.dynamodb.toDynamoDBJson($ctx.args.${idArg})}}`)}static dynamoDbDeleteItem(keyName,idArg){return this.fromString(`{"version": "2017-02-28", "operation": "DeleteItem", "key": {"${keyName}": $util.dynamodb.toDynamoDBJson($ctx.args.${idArg})}}`)}static dynamoDbPutItem(key,values){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_PrimaryKey(key),jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_AttributeValues(values)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.dynamoDbPutItem),error}return this.fromString(`
${values.renderVariables()}
{
"version": "2017-02-28",
"operation": "PutItem",
${key.renderTemplate()},
${values.renderTemplate()}
}`)}static lambdaRequest(payload="$util.toJson($ctx)",operation="Invoke"){return this.fromString(`{"version": "2017-02-28", "operation": "${operation}", "payload": ${payload}}`)}static lambdaResult(){return this.fromString("$util.toJson($ctx.result)")}}exports.MappingTemplate=MappingTemplate;class StringMappingTemplate extends MappingTemplate{template;constructor(template){super(),this.template=template}renderTemplate(){return this.template}}

View File

@@ -0,0 +1,46 @@
/**
* Utility class to represent DynamoDB key conditions.
*/
export declare abstract class BaseKeyCondition {
and(cond: BaseKeyCondition): BaseKeyCondition;
renderExpressionNames(): string;
renderExpressionValues(): string;
abstract renderCondition(): string;
abstract keyNames(): string[];
abstract args(): string[];
}
/**
* Utility class to represent DynamoDB "begins_with" key conditions.
*/
export declare class BeginsWith extends BaseKeyCondition {
private readonly keyName;
private readonly arg;
constructor(keyName: string, arg: string);
renderCondition(): string;
keyNames(): string[];
args(): string[];
}
/**
* Utility class to represent DynamoDB binary key conditions.
*/
export declare class BinaryCondition extends BaseKeyCondition {
private readonly keyName;
private readonly op;
private readonly arg;
constructor(keyName: string, op: string, arg: string);
renderCondition(): string;
keyNames(): string[];
args(): string[];
}
/**
* Utility class to represent DynamoDB "between" key conditions.
*/
export declare class Between extends BaseKeyCondition {
private readonly keyName;
private readonly arg1;
private readonly arg2;
constructor(keyName: string, arg1: string, arg2: string);
renderCondition(): string;
keyNames(): string[];
args(): string[];
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Between=exports.BinaryCondition=exports.BeginsWith=exports.BaseKeyCondition=void 0;class BaseKeyCondition{and(cond){return new class extends BaseKeyCondition{left;right;constructor(left,right){super(),this.left=left,this.right=right}renderCondition(){return`${this.left.renderCondition()} AND ${this.right.renderCondition()}`}keyNames(){return concatAndDedup(this.left.keyNames(),this.right.keyNames())}args(){return concatAndDedup(this.left.args(),this.right.args())}}(this,cond)}renderExpressionNames(){return this.keyNames().map(keyName=>`"#${keyName}" : "${keyName}"`).join(", ")}renderExpressionValues(){return this.args().map(arg=>`":${arg}" : $util.dynamodb.toDynamoDBJson($ctx.args.${arg})`).join(", ")}}exports.BaseKeyCondition=BaseKeyCondition;class BeginsWith extends BaseKeyCondition{keyName;arg;constructor(keyName,arg){super(),this.keyName=keyName,this.arg=arg}renderCondition(){return`begins_with(#${this.keyName}, :${this.arg})`}keyNames(){return[this.keyName]}args(){return[this.arg]}}exports.BeginsWith=BeginsWith;class BinaryCondition extends BaseKeyCondition{keyName;op;arg;constructor(keyName,op,arg){super(),this.keyName=keyName,this.op=op,this.arg=arg}renderCondition(){return`#${this.keyName} ${this.op} :${this.arg}`}keyNames(){return[this.keyName]}args(){return[this.arg]}}exports.BinaryCondition=BinaryCondition;class Between extends BaseKeyCondition{keyName;arg1;arg2;constructor(keyName,arg1,arg2){super(),this.keyName=keyName,this.arg1=arg1,this.arg2=arg2}renderCondition(){return`#${this.keyName} BETWEEN :${this.arg1} AND :${this.arg2}`}keyNames(){return[this.keyName]}args(){return[this.arg1,this.arg2]}}exports.Between=Between;function concatAndDedup(left,right){return left.concat(right).filter((elem,index,self)=>index===self.indexOf(elem))}

View File

@@ -0,0 +1,14 @@
import type { IGraphQLApiRef, IApiRef, IFunctionConfigurationRef } from '../../../interfaces/generated/aws-appsync-interfaces.generated';
import type { IApi } from '../api-base';
import type { IGraphqlApi } from '../graphqlapi-base';
/**
* Converts an IGraphQLApiRef to IGraphqlApi, validating that it implements the full interface
*/
export declare function toIGraphqlApi(api: IGraphQLApiRef): IGraphqlApi;
/**
* Converts an IApiRef to IApi, validating that it implements the full interface
*/
export declare function toIApi(api: IApiRef): IApi;
export declare function extractApiIdFromApiRef(apiRef: IApiRef): string;
export declare function extractApiIdFromGraphQLApiRef(apiRef: IGraphQLApiRef): string;
export declare function extractFunctionIdFromFunctionRef(funcRef: IFunctionConfigurationRef): string;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toIGraphqlApi=toIGraphqlApi,exports.toIApi=toIApi,exports.extractApiIdFromApiRef=extractApiIdFromApiRef,exports.extractApiIdFromGraphQLApiRef=extractApiIdFromGraphQLApiRef,exports.extractFunctionIdFromFunctionRef=extractFunctionIdFromFunctionRef;var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};function toIGraphqlApi(api){if(!isGraphQlApi(api))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ApiInstanceShouldImplement`,`'api' instance should implement IGraphqlApi, but doesn't: ${api.constructor?.name??"unknown"}`);return api}function isGraphQlApi(apiRef){const api=apiRef;return"apiId"in api&&"arn"in api&&"addNoneDataSource"in api}function isIApi(apiRef){const api=apiRef;return"apiId"in api&&"apiArn"in api&&"addDynamoDbDataSource"in api}function toIApi(api){if(!isIApi(api))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ApiInstanceShouldImplement`,`'api' instance should implement IApi, but doesn't: ${api.constructor?.name??"unknown"}`);return api}function extractApiIdFromApiRef(apiRef){return isIApi(apiRef)?apiRef.apiId:core_1().Fn.select(1,core_1().Fn.split("/",apiRef.apiRef.apiArn))}function extractApiIdFromGraphQLApiRef(apiRef){return isGraphQlApi(apiRef)?apiRef.apiId:core_1().Fn.select(1,core_1().Fn.split("/",apiRef.graphQlApiRef.graphQlApiArn))}function isIFunctionConfiguration(funcRef){return!!funcRef.functionId}function extractFunctionIdFromFunctionRef(funcRef){return isIFunctionConfiguration(funcRef)?funcRef.functionId:core_1().Fn.select(3,core_1().Fn.split("/",funcRef.functionConfigurationRef.functionArn))}

View File

@@ -0,0 +1,116 @@
import { Construct } from 'constructs';
import type { CachingConfig } from './caching-config';
import type { Code } from './code';
import type { BaseDataSource } from './data-source';
import type { IGraphqlApi } from './graphqlapi-base';
import type { MappingTemplate } from './mapping-template';
import type { FunctionRuntime } from './runtime';
import type { IFunctionConfigurationRef } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Enum for enhanced resolver metrics for specified resolvers
*/
export declare enum ResolverMetricsConfig {
/**
* Enables enhanced resolver metrics for specified resolvers
*/
ENABLED = "ENABLED",
/**
* Disables enhanced resolver metrics for specified resolvers
*/
DISABLED = "DISABLED"
}
/**
* Basic properties for an AppSync resolver
*/
export interface BaseResolverProps {
/**
* name of the GraphQL type this resolver is attached to
*/
readonly typeName: string;
/**
* name of the GraphQL field in the given type this resolver is attached to
*/
readonly fieldName: string;
/**
* configuration of the pipeline resolver
*
* @default - no pipeline resolver configuration
* An empty array | undefined sets resolver to be of kind, unit
*/
readonly pipelineConfig?: IFunctionConfigurationRef[];
/**
* The request mapping template for this resolver
*
* @default - No mapping template
*/
readonly requestMappingTemplate?: MappingTemplate;
/**
* The response mapping template for this resolver
*
* @default - No mapping template
*/
readonly responseMappingTemplate?: MappingTemplate;
/**
* The caching configuration for this resolver
*
* @default - No caching configuration
*/
readonly cachingConfig?: CachingConfig;
/**
* The maximum number of elements per batch, when using batch invoke
*
* @default - No max batch size
*/
readonly maxBatchSize?: number;
/**
* The functions runtime
*
* @default - no function runtime, VTL mapping templates used
*/
readonly runtime?: FunctionRuntime;
/**
* The function code
*
* @default - no code is used
*/
readonly code?: Code;
/**
* Whether to enable enhanced metrics
* Value will be ignored, if `enhancedMetricsConfig.resolverLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_RESOLVER_METRICS`
*
* @default - no metrics configuration
*/
readonly metricsConfig?: ResolverMetricsConfig;
}
/**
* Additional property for an AppSync resolver for data source reference
*/
export interface ExtendedResolverProps extends BaseResolverProps {
/**
* The data source this resolver is using
*
* @default - No datasource
*/
readonly dataSource?: BaseDataSource;
}
/**
* Additional property for an AppSync resolver for GraphQL API reference
*/
export interface ResolverProps extends ExtendedResolverProps {
/**
* The API this resolver is attached to
*/
readonly api: IGraphqlApi;
}
/**
* An AppSync resolver
*/
export declare class Resolver extends Construct {
/**
* the ARN of the resolver
*/
readonly arn: string;
private resolver;
constructor(scope: Construct, id: string, props: ResolverProps);
private createCachingConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Resolver=exports.ResolverMetricsConfig=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},appsync_generated_1=()=>{var tmp=require("./appsync.generated");return appsync_generated_1=()=>tmp,tmp},caching_key_1=()=>{var tmp=require("./caching-key");return caching_key_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},ref_utils_1=()=>{var tmp=require("./private/ref-utils");return ref_utils_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},ResolverMetricsConfig;(function(ResolverMetricsConfig2){ResolverMetricsConfig2.ENABLED="ENABLED",ResolverMetricsConfig2.DISABLED="DISABLED"})(ResolverMetricsConfig||(exports.ResolverMetricsConfig=ResolverMetricsConfig={}));class Resolver extends constructs_1().Construct{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.Resolver",version:"2.252.0"};arn;resolver;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_ResolverProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Resolver),error}const pipelineConfig=props.pipelineConfig&&props.pipelineConfig.length?{functions:props.pipelineConfig.map(func=>(0,ref_utils_1().extractFunctionIdFromFunctionRef)(func))}:void 0;if(props.runtime&&!props.code)throw new(core_1()).ValidationError((0,literal_string_1().lit)`CodeRequiredSpecifyingRuntime`,"Code is required when specifying a runtime",scope);if(props.code&&(props.requestMappingTemplate||props.responseMappingTemplate))throw new(core_1()).ValidationError((0,literal_string_1().lit)`MappingTemplatesCannotAlongsideCode`,"Mapping templates cannot be used alongside code",scope);if(pipelineConfig&&props.dataSource)throw new(core_1()).ValidationError((0,literal_string_1().lit)`PipelineResolverCannotDataSource`,`Pipeline Resolver cannot have data source. Received: ${props.dataSource.name}`,scope);if(props.cachingConfig?.ttl&&(props.cachingConfig.ttl.toSeconds()<1||props.cachingConfig.ttl.toSeconds()>3600))throw new(core_1()).ValidationError((0,literal_string_1().lit)`CachingConfigSecondsReceived`,`Caching config TTL must be between 1 and 3600 seconds. Received: ${props.cachingConfig.ttl.toSeconds()}`,scope);if(props.cachingConfig?.cachingKeys&&props.cachingConfig.cachingKeys.find(cachingKey=>!core_1().Token.isUnresolved(cachingKey)&&!caching_key_1().BASE_CACHING_KEYS.find(baseCachingKey=>cachingKey.startsWith(baseCachingKey))))throw new(core_1()).ValidationError((0,literal_string_1().lit)`CachingConfigKeysBeginContext`,`Caching config keys must begin with $context.arguments, $context.source or $context.identity. Received: ${props.cachingConfig.cachingKeys}`,scope);const code=props.code?.bind(this);this.resolver=new(appsync_generated_1()).CfnResolver(this,"Resource",{apiId:props.api.apiId,typeName:props.typeName,fieldName:props.fieldName,dataSourceName:props.dataSource?props.dataSource.name:void 0,kind:pipelineConfig?"PIPELINE":"UNIT",runtime:props.runtime?.toProperties(),codeS3Location:code?.s3Location,code:code?.inlineCode,pipelineConfig,requestMappingTemplate:props.requestMappingTemplate?props.requestMappingTemplate.renderTemplate():void 0,responseMappingTemplate:props.responseMappingTemplate?props.responseMappingTemplate.renderTemplate():void 0,cachingConfig:this.createCachingConfig(props.cachingConfig),maxBatchSize:props.maxBatchSize,metricsConfig:props.metricsConfig}),props.api.addSchemaDependency(this.resolver),props.dataSource&&this.resolver.addDependency(props.dataSource.ds),this.arn=this.resolver.attrResolverArn}createCachingConfig(config){return config?{cachingKeys:config.cachingKeys,ttl:config.ttl?.toSeconds()}:void 0}}exports.Resolver=Resolver;

View File

@@ -0,0 +1,44 @@
/**
* Config for binding runtime to a function or resolver
*/
export interface RuntimeConfig {
/**
* The name of the runtime
*/
readonly name: string;
/**
* The version string of the runtime
*/
readonly runtimeVersion: string;
}
/**
* Appsync supported runtimes. Only JavaScript as of now
*/
export declare enum FunctionRuntimeFamily {
/**
* AppSync JavaScript runtime
*/
JS = "APPSYNC_JS"
}
/**
* Utility class for specifying specific appsync runtime versions
*/
export declare class FunctionRuntime {
/**
* APPSYNC_JS v1.0.0 runtime
*/
static readonly JS_1_0_0: FunctionRuntime;
/**
* The name of the runtime
*/
readonly name: string;
/**
* The runtime version
*/
readonly version: string;
constructor(family: FunctionRuntimeFamily, version: string);
/**
* Convert to Cfn runtime configuration property format
*/
toProperties(): RuntimeConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FunctionRuntime=exports.FunctionRuntimeFamily=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var FunctionRuntimeFamily;(function(FunctionRuntimeFamily2){FunctionRuntimeFamily2.JS="APPSYNC_JS"})(FunctionRuntimeFamily||(exports.FunctionRuntimeFamily=FunctionRuntimeFamily={}));class FunctionRuntime{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.FunctionRuntime",version:"2.252.0"};static JS_1_0_0=new FunctionRuntime(FunctionRuntimeFamily.JS,"1.0.0");name;version;constructor(family,version){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_FunctionRuntimeFamily(family)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FunctionRuntime),error}this.name=family,this.version=version}toProperties(){return{name:this.name,runtimeVersion:this.version}}}exports.FunctionRuntime=FunctionRuntime;

View File

@@ -0,0 +1,77 @@
import type { IGraphQLApiRef } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Configuration for bound graphql schema
*
* Returned from ISchema.bind allowing late binding of schemas to graphqlapi-base
*/
export interface ISchemaConfig {
/**
* The ID of the api the schema is bound to
*/
apiId: string;
/**
* The schema definition string
*/
definition: string;
}
/**
* Used for configuring schema bind behavior.
*
* This is intended to prevent breaking changes to implementors of ISchema
* if needing to add new behavior.
*/
export interface SchemaBindOptions {
}
/**
* Interface for implementing your own schema
*
* Useful for providing schema's from sources other than assets
*/
export interface ISchema {
/**
* Binds a schema string to a GraphQlApi
*
* @returns ISchemaConfig with apiId and schema definition string
* @param api the api to bind the schema to
* @param options configuration for bind behavior
*/
bind(api: IGraphQLApiRef, options?: SchemaBindOptions): ISchemaConfig;
}
/**
* The options for configuring a schema from an existing file
*/
export interface SchemaProps {
/**
* The file path for the schema. When this option is
* configured, then the schema will be generated from an
* existing file from disk.
*/
readonly filePath: string;
}
/**
* The Schema for a GraphQL Api
*
* If no options are configured, schema will be generated
* code-first.
*/
export declare class SchemaFile implements ISchema {
/**
* Generate a Schema from file
*
* @returns `SchemaAsset` with immutable schema definition
* @param filePath the file path of the schema file
*/
static fromAsset(filePath: string): SchemaFile;
/**
* The definition for this schema
*/
definition: string;
constructor(options: SchemaProps);
/**
* Called when the GraphQL Api is initialized to allow this object to bind
* to the stack.
*
* @param api The binding GraphQL Api
*/
bind(api: IGraphQLApiRef, _options?: SchemaBindOptions): ISchemaConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SchemaFile=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var fs_1=()=>{var tmp=require("fs");return fs_1=()=>tmp,tmp},ref_utils_1=()=>{var tmp=require("./private/ref-utils");return ref_utils_1=()=>tmp,tmp};class SchemaFile{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appsync.SchemaFile",version:"2.252.0"};static fromAsset(filePath){return new SchemaFile({filePath})}definition;constructor(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_SchemaProps(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SchemaFile),error}this.definition=(0,fs_1().readFileSync)(options.filePath).toString("utf-8")}bind(api,_options){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_appsync_IGraphQLApiRef(api),jsiiDeprecationWarnings().aws_cdk_lib_aws_appsync_SchemaBindOptions(_options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return{apiId:(0,ref_utils_1().extractApiIdFromGraphQLApiRef)(api),definition:this.definition}}}exports.SchemaFile=SchemaFile;

View File

@@ -0,0 +1,143 @@
import type { Construct } from 'constructs';
import { CfnSourceApiAssociation } from './appsync.generated';
import type { IGraphqlApi } from './graphqlapi-base';
import type { IRole } from '../../aws-iam';
import type { IResource } from '../../core';
import { Resource } from '../../core';
import type { ISourceApiAssociationRef, SourceApiAssociationReference } from '../../interfaces/generated/aws-appsync-interfaces.generated';
/**
* Merge type used to associate the source API
*/
export declare enum MergeType {
/**
* Manual merge. The merge must be triggered manually when the source API has changed.
*/
MANUAL_MERGE = "MANUAL_MERGE",
/**
* Auto merge. The merge is triggered automatically when the source API has changed.
*/
AUTO_MERGE = "AUTO_MERGE"
}
/**
* Interface for AppSync Source Api Association
*/
export interface ISourceApiAssociation extends IResource, ISourceApiAssociationRef {
/**
* The association id.
*/
readonly associationId: string;
/**
* The association arn.
*/
readonly associationArn: string;
/**
* The source api in the association.
*/
readonly sourceApi: IGraphqlApi;
/**
* The merged api in the association.
*/
readonly mergedApi: IGraphqlApi;
}
/**
* The attributes for imported AppSync Source Api Association.
*/
export interface SourceApiAssociationAttributes {
/**
* The association arn.
*/
readonly associationArn: string;
/**
* The source api in the association.
*/
readonly sourceApi: IGraphqlApi;
/**
* The merged api in the association.
*/
readonly mergedApi: IGraphqlApi;
}
/**
* Properties for SourceApiAssociation which associates an AppSync Source API with an AppSync Merged API
*/
export interface SourceApiAssociationProps {
/**
* The source api to associate.
*/
readonly sourceApi: IGraphqlApi;
/**
* The merged api to associate.
*/
readonly mergedApi: IGraphqlApi;
/**
* The merged api execution role for adding the access policy for the source api.
*/
readonly mergedApiExecutionRole: IRole;
/**
* The merge type for the source
*
* @default - AUTO_MERGE
*/
readonly mergeType?: MergeType;
/**
* The description of the source api association
*
* @default - None
*/
readonly description?: string;
}
/**
* AppSync SourceApiAssociation which associates an AppSync source API to an AppSync Merged API.
* The initial creation of the SourceApiAssociation merges the source API into the Merged API schema.
*/
export declare class SourceApiAssociation extends Resource implements ISourceApiAssociation {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import Appsync Source Api Association from source API, merged api, and merge type.
*/
static fromSourceApiAssociationAttributes(scope: Construct, id: string, attrs: SourceApiAssociationAttributes): ISourceApiAssociation;
/**
* The association id.
*/
readonly associationId: string;
/**
* The association arn.
*/
readonly associationArn: string;
/**
* The underlying CFN source api association resource.
*/
readonly association: CfnSourceApiAssociation;
/**
* The merged api in the association.
*/
readonly mergedApi: IGraphqlApi;
/**
* The source api in the association.
*/
readonly sourceApi: IGraphqlApi;
/**
* The merge type for the source api association.
*/
readonly mergeType: MergeType;
/**
* The merged api execution role for attaching the access policy.
*/
private readonly mergedApiExecutionRole?;
constructor(scope: Construct, id: string, props: SourceApiAssociationProps);
get sourceApiAssociationRef(): SourceApiAssociationReference;
}
/**
* Adds an IAM permission to the Merged API execution role for GraphQL access on the source AppSync api.
*
* @param sourceApiAssociation The CfnSourceApiAssociation resource which to add a permission to access at runtime.
* @param mergedApiExecutionRole The merged api execution role on which to add the permission.
*/
export declare function addSourceGraphQLPermission(sourceApiAssociation: CfnSourceApiAssociation, mergedApiExecutionRole: IRole): import("../../aws-iam").AddToPrincipalPolicyResult;
/**
* Adds an IAM permission to the Merged API execution role for automatically merging the source API metadata whenever
* the source API is updated.
* @param sourceApiAssociation The CfnSourceApiAssociation resource which to add permission to perform merge operations on.
* @param mergedApiExecutionRole The merged api execution role on which to add the permission.
*/
export declare function addSourceApiAutoMergePermission(sourceApiAssociation: CfnSourceApiAssociation, mergedApiExecutionRole: IRole): import("../../aws-iam").AddToPrincipalPolicyResult;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var appsync_js_pipeline_exports={};__export(appsync_js_pipeline_exports,{request:()=>request,response:()=>response});module.exports=__toCommonJS(appsync_js_pipeline_exports);function request(...args){return{}}function response(ctx){return ctx.prev.result}0&&(module.exports={request,response});

View File

@@ -0,0 +1 @@
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var appsync_js_resolver_exports={};__export(appsync_js_resolver_exports,{request:()=>request,response:()=>response});module.exports=__toCommonJS(appsync_js_resolver_exports);var import_utils=require("@aws-appsync/utils");function request(ctx){const id=import_utils.util.autoId(),name=ctx.args.name;return ctx.args.input={id,name},{version:"2018-05-29",operation:"PutItem",key:{id:import_utils.util.dynamodb.toDynamoDB(ctx.args.input.id)},attributeValues:import_utils.util.dynamodb.toMapValues(ctx.args.input)}}function response(ctx){return ctx.result}0&&(module.exports={request,response});

View File

@@ -0,0 +1,6 @@
"use strict";exports.handler=async function(event){console.log(event);let myHeaders=new Headers;myHeaders.append("x-api-key",event.apiKey),myHeaders.append("Content-Type","application/json");const query=JSON.stringify({query:`mutation MyMutation {
addTest(name: "123") {
id
name
}
}`,variables:{}}),requestOptions={method:"POST",headers:myHeaders,body:query,redirect:"follow"};return await fetch(event.hostname,requestOptions).then(response2=>response2.json())};

View File

@@ -0,0 +1 @@
"use strict";exports.handler=async context=>{if(context.info.operation==="PUBLISH")return{events:context.events.map(ev=>({id:ev.id,payload:{...ev.payload,with:`hello world from ${ev.id}`}}))};if(context.info.operation!=="SUBSCRIBE")throw new Error("Unknown operation")};

View File

@@ -0,0 +1 @@
"use strict";exports.handler=async(event,context)=>{console.log("Do something with the events!"),console.log(event)};

View File

@@ -0,0 +1,6 @@
"use strict";require("isomorphic-fetch");const AWS=require("aws-sdk/global"),gql=require("graphql-tag"),appsync=require("aws-appsync"),config={url:process.env.APPSYNC_ENDPOINT,region:process.env.AWS_REGION,auth:{type:appsync.AUTH_TYPE.AWS_IAM,credentials:AWS.config.credentials},disableOffline:!0},getTests=`query getTests {
getTests {
id
version
}
}`,client=new appsync.AWSAppSyncClient(config);exports.handler=(event,context,callback)=>{(async()=>{try{const result=await client.query({query:gql(getTests)});console.log(result.data),callback(null,result.data)}catch(e){console.warn("Error sending mutation: ",e),callback(Error(e))}})()};

View File

@@ -0,0 +1 @@
"use strict";exports.handler=(event,context,callback)=>{console.log("Received event {}",JSON.stringify(event,3));var posts={1:{id:"1",title:"First book",author:"Author1",url:"https://amazon.com/",content:"SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1",ups:"100",downs:"10"},2:{id:"2",title:"Second book",author:"Author2",url:"https://amazon.com",content:"SAMPLE TEXT AUTHOR 2 SAMPLE TEXT AUTHOR 2 SAMPLE TEXT",ups:"100",downs:"10"},3:{id:"3",title:"Third book",author:"Author3",url:null,content:null,ups:null,downs:null},4:{id:"4",title:"Fourth book",author:"Author4",url:"https://www.amazon.com/",content:"SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4",ups:"1000",downs:"0"},5:{id:"5",title:"Fifth book",author:"Author5",url:"https://www.amazon.com/",content:"SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT",ups:"50",downs:"0"}},relatedPosts={1:[posts[4]],2:[posts[3],posts[5]],3:[posts[2],posts[1]],4:[posts[2],posts[1]],5:[]};if(Array.isArray(event)){console.log("Got an BatchInvoke Request. The payload has %d items to resolve.",event.length);const field=event[0].field;switch(field){case"relatedPostsMaxBatchSize":case"relatedPosts":for(var results=[],i=0;i<event.length;i++)console.log("post {}",JSON.stringify(event[i].source)),results.push(relatedPosts[event[i].source.id]);console.log("results {}",JSON.stringify(results)),callback(null,results);break;default:callback("Unknown field, unable to resolve"+field,null);break}}else switch(console.log("Got an Invoke Request."),event.field){case"getPost":var id=event.arguments.id;callback(null,posts[id]);break;case"allPosts":var values=[];for(var d in posts)values.push(posts[d]);callback(null,values);break;case"addPost":callback(null,event.arguments);break;case"addPostErrorWithData":var id=event.arguments.id,result=posts[id];result.errorMessage="Error with the mutation, data has changed",result.errorType="MUTATION_ERROR",callback(null,result);break;default:callback("Unknown field, unable to resolve"+event.field,null);break}};