Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ResourceFactory.prototype.makeElasticSearchDataSource = function () {
var logicalName = ResourceFactory.ElasticSearchDomainLogicalID;
return new appSync_1.default.DataSource({
ApiId: cloudform_1.Fn.GetAtt(ResourceFactory.GraphQLAPILogicalID, 'ApiId'),
Name: logicalName,
Type: 'AMAZON_ELASTICSEARCH',
ServiceRoleArn: cloudform_1.Fn.GetAtt(ResourceFactory.IAMRoleLogicalID, 'Arn'),
ElasticsearchConfig: {
AwsRegion: cloudform_1.Fn.Select(3, cloudform_1.Fn.Split(':', cloudform_1.Fn.GetAtt(logicalName, 'DomainArn'))),
Endpoint: cloudform_1.Fn.Join('', [
'https://',
cloudform_1.Fn.GetAtt(logicalName, 'DomainEndpoint')
])
}
});
};
/**
ResourceFactory.prototype.makeElasticSearchDataSource = function () {
var logicalName = amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.ElasticSearchDomainLogicalID;
return new appSync_1.default.DataSource({
ApiId: cloudform_1.Fn.GetAtt(amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: logicalName,
Type: 'AMAZON_ELASTICSEARCH',
ServiceRoleArn: cloudform_1.Fn.GetAtt(amplify_graphql_transformer_common_1.ResourceConstants.RESOURCES.ElasticSearchAccessIAMRoleLogicalID, 'Arn'),
ElasticsearchConfig: {
AwsRegion: cloudform_1.Fn.Select(3, cloudform_1.Fn.Split(':', cloudform_1.Fn.GetAtt(logicalName, 'DomainArn'))),
Endpoint: cloudform_1.Fn.Join('', [
'https://',
cloudform_1.Fn.GetAtt(logicalName, 'DomainEndpoint')
])
}
});
};
/**
ResourceFactory.prototype.makeQueryResolver = function (type, nameOverride) {
var fieldName = nameOverride ? nameOverride : graphql_transformer_common_1.graphqlName("query" + graphql_transformer_common_1.toUpper(type));
var defaultPageLimit = 10;
return new appSync_1.default.Resolver({
ApiId: cloudform_1.Fn.GetAtt(graphql_transformer_common_1.ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
DataSourceName: cloudform_1.Fn.GetAtt(graphql_transformer_common_1.ModelResourceIDs.ModelTableDataSourceID(type), 'Name'),
FieldName: fieldName,
TypeName: 'Query',
RequestMappingTemplate: graphql_mapping_template_1.print(graphql_mapping_template_1.compoundExpression([
graphql_mapping_template_1.set(graphql_mapping_template_1.ref('limit'), graphql_mapping_template_1.ref("util.defaultIfNull($context.args.limit, " + defaultPageLimit + ")")),
graphql_mapping_template_1.DynamoDBMappingTemplate.query({
query: graphql_mapping_template_1.obj({
'expression': graphql_mapping_template_1.str('#typename = :typename'),
'expressionNames': graphql_mapping_template_1.obj({
'#typename': graphql_mapping_template_1.str('__typename')
}),
'expressionValues': graphql_mapping_template_1.obj({
':typename': graphql_mapping_template_1.obj({
'S': graphql_mapping_template_1.str(type)
})