Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
},
DefaultRootObject: "index.html",
Enabled: true,
HttpVersion: "http2",
// Logging: {
// IncludeCookies: false,
// Bucket: '', // TODO:
// Prefix: '' // TODO:
// },
Origins: [
{
Id: "s3Origin",
DomainName: cloudform_1.Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: cloudform_1.Fn.Join("/", [
"origin-access-identity/cloudfront",
cloudform_1.Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100",
ViewerCertificate: {
AcmCertificateArn: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}Certificate`),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
ResourceFactory.prototype.makeDynamoDBStreamEventSourceMapping = function () {
return new cloudform_1.Lambda.EventSourceMapping({
BatchSize: 100,
Enabled: true,
EventSourceArn: cloudform_1.Fn.GetAtt(ResourceFactory.DynamoDBTableLogicalID, 'StreamArn'),
FunctionName: cloudform_1.Fn.GetAtt(ResourceFactory.StreamingLambdaFunctionLogicalID, 'Arn'),
StartingPosition: 'TRIM_HORIZON'
});
};
/**
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
exports.ClientBucket = new cloudform_1.S3.Bucket({
BucketName: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
AccessControl: "PublicRead",
WebsiteConfiguration: {
ErrorDocument: "index.html",
IndexDocument: "index.html"
},
CorsConfiguration: {
CorsRules: [
{
AllowedHeaders: ["*"],
AllowedMethods: ["GET", "HEAD"],
AllowedOrigins: ["*"]
}
]
}
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ServerRecordSet = new cloudform_1.Route53.RecordSet({
Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
Type: "A",
HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
AliasTarget: {
DNSName: cloudform_1.Fn.GetAtt("DomainName", "DistributionDomainName"),
HostedZoneId: cloudform_1.Fn.GetAtt("DomainName", "DistributionHostedZoneId")
}
}).dependsOn("DomainName");
ResourceFactory.prototype.makeApiKeyOutput = function () {
return {
Description: "Your GraphQL API key. Provide via 'x-api-key' header.",
Value: cloudform_1.Fn.GetAtt(graphql_transformer_common_1.ResourceConstants.RESOURCES.APIKeyLogicalID, 'ApiKey'),
Export: {
Name: cloudform_1.Fn.Join(':', [cloudform_1.Refs.StackName, "GraphQLApiKey"])
}
};
};
/**
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
/**
*
* Fn.Ref('OriginAccessIdentity') returns access identity, such as E15MNIMTCFKK4C.
* Fn.GetAtt('OriginAccessIdentity', 'S3CanonicalUserId') returns Amazon S3 canonical user ID
* - for example: b970b42360b81c8ddbd79d2f5df0069ba9033c8a79655752abe380cd6d63ba8bcf23384d568fcf89fc49700b5e11a0fd
*
*/
exports.ClientOriginAccessIdentity = new cloudform_1.CloudFront.CloudFrontOriginAccessIdentity({
CloudFrontOriginAccessIdentityConfig: {
Comment: cloudform_1.Fn.Join("", [
`origin access identity for `,
cloudform_1.Fn.Ref("SubDomain"),
".",
config_1.config.ROOT_DOMAIN
])
}
});
exports.BasePathMapping = (branch) => {
const basePathMapping = new cloudform_1.ApiGateway.BasePathMapping({
RestApiId: cloudform_1.Fn.Ref("ApiGateway"),
DomainName: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
BasePath: cloudform_1.Fn.Ref("BasePath"),
Stage: cloudform_1.Fn.Ref("GitHubBranch")
});
if (branch === "master") {
basePathMapping.dependsOn("DomainName");
}
else {
basePathMapping.dependsOn("ApiGatewayStage");
}
return basePathMapping;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ServerRecordSet = new cloudform_1.Route53.RecordSet({
Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
Type: "A",
HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
AliasTarget: {
DNSName: cloudform_1.Fn.GetAtt("DomainName", "DistributionDomainName"),
HostedZoneId: cloudform_1.Fn.GetAtt("DomainName", "DistributionHostedZoneId")
}
}).dependsOn("DomainName");
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ClientRecordSet = new cloudform_1.Route53.RecordSet({
Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
Type: "A",
HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
AliasTarget: {
DNSName: cloudform_1.Fn.GetAtt("ClientDistribution", "DomainName"),
HostedZoneId: "Z2FDTNDATAQYW2"
}
}).dependsOn("ClientDistribution");
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
/**
*
* Fn.Ref('OriginAccessIdentity') returns access identity, such as E15MNIMTCFKK4C.
* Fn.GetAtt('OriginAccessIdentity', 'S3CanonicalUserId') returns Amazon S3 canonical user ID
* - for example: b970b42360b81c8ddbd79d2f5df0069ba9033c8a79655752abe380cd6d63ba8bcf23384d568fcf89fc49700b5e11a0fd
*
*/
exports.ClientOriginAccessIdentity = new cloudform_1.CloudFront.CloudFrontOriginAccessIdentity({
CloudFrontOriginAccessIdentityConfig: {
Comment: cloudform_1.Fn.Join("", [
`origin access identity for `,
cloudform_1.Fn.Ref("SubDomain"),
".",
config_1.config.ROOT_DOMAIN
])
}
});