@aws-amplify/graphql-searchable-transformer
Advanced tools
Comparing version 0.3.0 to 0.3.1-beta.0
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.3.1-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.3.0...@aws-amplify/graphql-searchable-transformer@0.3.1-beta.0) (2021-07-16) | ||
**Note:** Version bump only for package @aws-amplify/graphql-searchable-transformer | ||
# [0.3.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-searchable-transformer@0.2.3...@aws-amplify/graphql-searchable-transformer@0.3.0) (2021-07-12) | ||
@@ -8,0 +16,0 @@ |
@@ -7,3 +7,3 @@ "use strict"; | ||
function createParametersStack(stack) { | ||
const { ElasticsearchAccessIAMRoleName, ElasticsearchStreamingLambdaHandlerName, ElasticsearchStreamingLambdaRuntime, ElasticsearchStreamingFunctionName, ElasticsearchStreamingIAMRoleName, ElasticsearchDebugStreamingLambda, ElasticsearchInstanceCount, ElasticsearchInstanceType, ElasticsearchEBSVolumeGB, } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
const { ElasticsearchAccessIAMRoleName, ElasticsearchStreamingLambdaHandlerName, ElasticsearchStreamingLambdaRuntime, ElasticsearchStreamingFunctionName, ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds, ElasticsearchStreamingIAMRoleName, ElasticsearchDebugStreamingLambda, ElasticsearchInstanceCount, ElasticsearchInstanceType, ElasticsearchEBSVolumeGB, } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
return new Map([ | ||
@@ -40,2 +40,18 @@ [ | ||
[ | ||
ElasticsearchStreamBatchSize, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to Elasticsearch per batch.', | ||
type: 'Number', | ||
default: 100 | ||
}) | ||
], | ||
[ | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
new core_1.CfnParameter(stack, ElasticsearchStreamMaximumBatchingWindowInSeconds, { | ||
description: "The maximum amount of time in seconds to wait for DynamoDB stream records before sending to streaming lambda.", | ||
type: 'Number', | ||
default: 1 | ||
}) | ||
], | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
@@ -42,0 +58,0 @@ new core_1.CfnParameter(stack, ElasticsearchStreamingIAMRoleName, { |
@@ -7,3 +7,3 @@ import { GraphQLAPIProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
export declare const createLambdaRole: (stack: Construct, parameterMap: Map<string, CfnParameter>) => IRole; | ||
export declare const createEventSourceMapping: (stack: Construct, type: string, target: IFunction, tableStreamArn?: string | undefined) => EventSourceMapping; | ||
export declare const createEventSourceMapping: (stack: Construct, type: string, target: IFunction, parameterMap: Map<string, CfnParameter>, tableStreamArn?: string | undefined) => EventSourceMapping; | ||
//# sourceMappingURL=create-streaming-lambda.d.ts.map |
@@ -67,3 +67,4 @@ "use strict"; | ||
exports.createLambdaRole = createLambdaRole; | ||
const createEventSourceMapping = (stack, type, target, tableStreamArn) => { | ||
const createEventSourceMapping = (stack, type, target, parameterMap, tableStreamArn) => { | ||
const { ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds } = graphql_transformer_common_1.ResourceConstants.PARAMETERS; | ||
assert_1.default(tableStreamArn); | ||
@@ -73,3 +74,4 @@ return new aws_lambda_1.EventSourceMapping(stack, graphql_transformer_common_1.SearchableResourceIDs.SearchableEventSourceMappingID(type), { | ||
target, | ||
batchSize: 1, | ||
batchSize: parameterMap.get(ElasticsearchStreamBatchSize).valueAsNumber, | ||
maxBatchingWindow: core_1.Duration.seconds(parameterMap.get(ElasticsearchStreamMaximumBatchingWindowInSeconds).valueAsNumber), | ||
enabled: true, | ||
@@ -76,0 +78,0 @@ startingPosition: aws_lambda_1.StartingPosition.LATEST, |
@@ -57,3 +57,3 @@ "use strict"; | ||
ddbTable.grantStreamRead(lambdaRole); | ||
create_streaming_lambda_1.createEventSourceMapping(stack, type, lambda, ddbTable.tableStreamArn); | ||
create_streaming_lambda_1.createEventSourceMapping(stack, type, lambda, parameterMap, ddbTable.tableStreamArn); | ||
const { attributeName } = table.keySchema.find((att) => att.keyType === 'HASH'); | ||
@@ -60,0 +60,0 @@ assert_1.default(typeName); |
{ | ||
"name": "@aws-amplify/graphql-searchable-transformer", | ||
"version": "0.3.0", | ||
"version": "0.3.1-beta.0", | ||
"description": "Amplfy GraphQL @searchable transformer", | ||
@@ -30,3 +30,3 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-core": "0.7.0", | ||
"@aws-amplify/graphql-transformer-core": "0.7.1-beta.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.7.0", | ||
@@ -42,3 +42,3 @@ "@aws-cdk/aws-appsync": "~1.72.0", | ||
"graphql-mapping-template": "4.18.1", | ||
"graphql-transformer-common": "4.19.4" | ||
"graphql-transformer-common": "4.19.5-beta.0" | ||
}, | ||
@@ -66,3 +66,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "753a7379c2600988a7b68b9c9f5e2cc6b1bf2fb4" | ||
"gitHead": "3aeb8a23fd1c07303db71c30379188d9dad407e7" | ||
} |
@@ -10,2 +10,4 @@ import { ResourceConstants } from 'graphql-transformer-common'; | ||
ElasticsearchStreamingFunctionName, | ||
ElasticsearchStreamBatchSize, | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
ElasticsearchStreamingIAMRoleName, | ||
@@ -52,2 +54,20 @@ ElasticsearchDebugStreamingLambda, | ||
[ | ||
ElasticsearchStreamBatchSize, | ||
new CfnParameter(stack, ElasticsearchStreamBatchSize, { | ||
description: 'The maximum number of records to stream to Elasticsearch per batch.', | ||
type: 'Number', | ||
default: 100 | ||
}) | ||
], | ||
[ | ||
ElasticsearchStreamMaximumBatchingWindowInSeconds, | ||
new CfnParameter(stack, ElasticsearchStreamMaximumBatchingWindowInSeconds, { | ||
description: "The maximum amount of time in seconds to wait for DynamoDB stream records before sending to streaming lambda.", | ||
type: 'Number', | ||
default: 1 | ||
}) | ||
], | ||
[ | ||
ElasticsearchAccessIAMRoleName, | ||
@@ -54,0 +74,0 @@ new CfnParameter(stack, ElasticsearchStreamingIAMRoleName, { |
import { GraphQLAPIProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { EventSourceMapping, IFunction, LayerVersion, Runtime, StartingPosition } from '@aws-cdk/aws-lambda'; | ||
import { CfnParameter, Construct, Fn, Stack } from '@aws-cdk/core'; | ||
import { CfnParameter, Construct, Fn, Stack, Duration } from '@aws-cdk/core'; | ||
import { Effect, IRole, Policy, PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; | ||
@@ -74,4 +74,6 @@ import { ResourceConstants, SearchableResourceIDs } from 'graphql-transformer-common'; | ||
target: IFunction, | ||
parameterMap: Map<string, CfnParameter>, | ||
tableStreamArn?: string, | ||
): EventSourceMapping => { | ||
const { ElasticsearchStreamBatchSize, ElasticsearchStreamMaximumBatchingWindowInSeconds } = ResourceConstants.PARAMETERS; | ||
assert(tableStreamArn); | ||
@@ -81,3 +83,4 @@ return new EventSourceMapping(stack, SearchableResourceIDs.SearchableEventSourceMappingID(type), { | ||
target, | ||
batchSize: 1, | ||
batchSize: parameterMap.get(ElasticsearchStreamBatchSize)!.valueAsNumber, | ||
maxBatchingWindow: Duration.seconds(parameterMap.get(ElasticsearchStreamMaximumBatchingWindowInSeconds)!.valueAsNumber), | ||
enabled: true, | ||
@@ -84,0 +87,0 @@ startingPosition: StartingPosition.LATEST, |
@@ -122,3 +122,3 @@ import { TransformerPluginBase, InvalidDirectiveError, MappingTemplate, DirectiveWrapper } from '@aws-amplify/graphql-transformer-core'; | ||
// creates event source mapping from ddb to lambda | ||
createEventSourceMapping(stack, type, lambda, ddbTable.tableStreamArn); | ||
createEventSourceMapping(stack, type, lambda, parameterMap, ddbTable.tableStreamArn); | ||
@@ -125,0 +125,0 @@ const { attributeName } = (table as any).keySchema.find((att: any) => att.keyType === 'HASH'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
931498
2098
+ Added@aws-amplify/graphql-transformer-core@0.7.1-beta.0(transitive)
+ Addedgraphql-transformer-common@4.19.5-beta.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@0.7.0(transitive)
- Removedgraphql-transformer-common@4.19.4(transitive)