@quadnix/octo-aws-cdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factories/aws-client.factory.d.ts +28 -0
- package/dist/factories/aws-client.factory.js +36 -0
- package/dist/factories/aws-client.factory.js.map +1 -1
- package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.d.ts +6 -0
- package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.js +11 -1
- package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.js.map +1 -1
- package/dist/modules/service/aws-s3-static-website-service/index.schema.d.ts +58 -0
- package/dist/modules/service/aws-s3-static-website-service/index.schema.js +96 -0
- package/dist/modules/service/aws-s3-static-website-service/index.schema.js.map +1 -1
- package/dist/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.js +89 -4
- package/dist/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.js.map +1 -1
- package/dist/modules/service/aws-s3-static-website-service/models/service/actions/update-aws-s3-static-website-service-source-paths.model.action.js +17 -1
- package/dist/modules/service/aws-s3-static-website-service/models/service/actions/update-aws-s3-static-website-service-source-paths.model.action.js.map +1 -1
- package/dist/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.js +6 -3
- package/dist/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.js.map +1 -1
- package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.d.ts +97 -0
- package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.js +613 -0
- package/dist/resources/cloudfront-distribution/cloudfront-distribution.resource.js.map +1 -0
- package/dist/resources/cloudfront-distribution/index.d.ts +1 -0
- package/dist/resources/cloudfront-distribution/index.js +2 -0
- package/dist/resources/cloudfront-distribution/index.js.map +1 -0
- package/dist/resources/cloudfront-distribution/index.schema.d.ts +522 -0
- package/dist/resources/cloudfront-distribution/index.schema.js +754 -0
- package/dist/resources/cloudfront-distribution/index.schema.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.d.ts +36 -0
- package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.js +90 -0
- package/dist/resources/cloudfront-invalidation/actions/add-cloudfront-invalidation.resource.action.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.d.ts +39 -0
- package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.js +69 -0
- package/dist/resources/cloudfront-invalidation/actions/delete-cloudfront-invalidation.resource.action.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.d.ts +37 -0
- package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.js +91 -0
- package/dist/resources/cloudfront-invalidation/actions/update-cloudfront-invalidation.resource.action.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.d.ts +62 -0
- package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.js +89 -0
- package/dist/resources/cloudfront-invalidation/cloudfront-invalidation.resource.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/index.d.ts +5 -0
- package/dist/resources/cloudfront-invalidation/index.js +6 -0
- package/dist/resources/cloudfront-invalidation/index.js.map +1 -0
- package/dist/resources/cloudfront-invalidation/index.schema.d.ts +61 -0
- package/dist/resources/cloudfront-invalidation/index.schema.js +110 -0
- package/dist/resources/cloudfront-invalidation/index.schema.js.map +1 -0
- package/dist/resources/s3-website/index.schema.d.ts +20 -0
- package/dist/resources/s3-website/index.schema.js +38 -0
- package/dist/resources/s3-website/index.schema.js.map +1 -1
- package/dist/resources/s3-website/s3-website.resource.d.ts +20 -3
- package/dist/resources/s3-website/s3-website.resource.js +82 -26
- package/dist/resources/s3-website/s3-website.resource.js.map +1 -1
- package/package.json +4 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CloudFrontClient } from '@aws-sdk/client-cloudfront';
|
|
1
2
|
import { ECRClient } from '@aws-sdk/client-ecr';
|
|
2
3
|
import type { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@smithy/types';
|
|
3
4
|
/**
|
|
@@ -10,6 +11,9 @@ export type AwsClientCredentials = AwsCredentialIdentity | AwsCredentialIdentity
|
|
|
10
11
|
/**
|
|
11
12
|
* Serves the AWS SDK clients an external resource action needs, one per account and region.
|
|
12
13
|
*
|
|
14
|
+
* A global service - one whose endpoint is not a region a caller picks - overrides `create()` to
|
|
15
|
+
* supply the region itself, so its callers name the account alone.
|
|
16
|
+
*
|
|
13
17
|
* A resource terraform manages needs no client - the provider talks to AWS. Only an external
|
|
14
18
|
* resource, whose lifecycle octo drives itself, resolves one of these, and it must authenticate as
|
|
15
19
|
* the account that owns the resource rather than as whoever the ambient credential chain happens to
|
|
@@ -59,4 +63,28 @@ export declare class ECRClientFactory extends AwsClientFactory {
|
|
|
59
63
|
*/
|
|
60
64
|
static createInstance(awsRegionId: string, credentials: AwsClientCredentials, endpoint?: string): ECRClient;
|
|
61
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* CloudFront is one global service with one endpoint, so a caller names the account and nothing
|
|
68
|
+
* else. The region a global service is reached at is a fact about that service rather than
|
|
69
|
+
* something a caller chooses, so the factory supplies it - which is also what keeps the cache
|
|
70
|
+
* keyed the same way as every other client's.
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare class CloudFrontClientFactory extends AwsClientFactory {
|
|
75
|
+
protected static readonly serviceName: string;
|
|
76
|
+
/**
|
|
77
|
+
* The region every CloudFront call is made to, whichever region the origins behind a distribution
|
|
78
|
+
* live in.
|
|
79
|
+
*/
|
|
80
|
+
private static readonly awsRegionId;
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
static create(awsAccountId: string): Promise<CloudFrontClient>;
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
static createInstance(awsRegionId: string, credentials: AwsClientCredentials, endpoint?: string): CloudFrontClient;
|
|
89
|
+
}
|
|
62
90
|
export {};
|
|
@@ -4,11 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
import { CloudFrontClient } from '@aws-sdk/client-cloudfront';
|
|
7
8
|
import { ECRClient } from '@aws-sdk/client-ecr';
|
|
8
9
|
import { Container, ContainerResolutionError, Factory } from '@quadnix/octo';
|
|
9
10
|
/**
|
|
10
11
|
* Serves the AWS SDK clients an external resource action needs, one per account and region.
|
|
11
12
|
*
|
|
13
|
+
* A global service - one whose endpoint is not a region a caller picks - overrides `create()` to
|
|
14
|
+
* supply the region itself, so its callers name the account alone.
|
|
15
|
+
*
|
|
12
16
|
* A resource terraform manages needs no client - the provider talks to AWS. Only an external
|
|
13
17
|
* resource, whose lifecycle octo drives itself, resolves one of these, and it must authenticate as
|
|
14
18
|
* the account that owns the resource rather than as whoever the ambient credential chain happens to
|
|
@@ -99,4 +103,36 @@ ECRClientFactory = __decorate([
|
|
|
99
103
|
Factory(ECRClient, { metadata: { package: '@octo' } })
|
|
100
104
|
], ECRClientFactory);
|
|
101
105
|
export { ECRClientFactory };
|
|
106
|
+
/**
|
|
107
|
+
* CloudFront is one global service with one endpoint, so a caller names the account and nothing
|
|
108
|
+
* else. The region a global service is reached at is a fact about that service rather than
|
|
109
|
+
* something a caller chooses, so the factory supplies it - which is also what keeps the cache
|
|
110
|
+
* keyed the same way as every other client's.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
let CloudFrontClientFactory = class CloudFrontClientFactory extends AwsClientFactory {
|
|
115
|
+
static { this.serviceName = 'cloudfront'; }
|
|
116
|
+
/**
|
|
117
|
+
* The region every CloudFront call is made to, whichever region the origins behind a distribution
|
|
118
|
+
* live in.
|
|
119
|
+
*/
|
|
120
|
+
static { this.awsRegionId = 'us-east-1'; }
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
static async create(awsAccountId) {
|
|
125
|
+
return super.create(awsAccountId, this.awsRegionId);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
static createInstance(awsRegionId, credentials, endpoint) {
|
|
131
|
+
return new CloudFrontClient({ credentials, endpoint, region: awsRegionId });
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
CloudFrontClientFactory = __decorate([
|
|
135
|
+
Factory(CloudFrontClient, { metadata: { package: '@octo' } })
|
|
136
|
+
], CloudFrontClientFactory);
|
|
137
|
+
export { CloudFrontClientFactory };
|
|
102
138
|
//# sourceMappingURL=aws-client.factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-client.factory.js","sourceRoot":"","sources":["../../src/factories/aws-client.factory.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAW7E
|
|
1
|
+
{"version":3,"file":"aws-client.factory.js","sourceRoot":"","sources":["../../src/factories/aws-client.factory.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAW7E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,gBAAgB;IACpB;;O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Q,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IACvE,CAAC;;AARU,gBAAgB;IAD5B,OAAO,CAAY,SAAS,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;GACrD,gBAAgB,CAS5B;;AAED;;;;;;;GAOG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,gBAAgB;aACxB,gBAAW,GAAW,YAAY,AAAvB,CAAwB;IAEtE;;;OAGG;aACqB,gBAAW,GAAW,WAAW,AAAtB,CAAuB;IAE1D;;OAEG;IACH,MAAM,CAAU,KAAK,CAAC,MAAM,CAAC,YAAoB;QAC/C,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,MAAM,CAAU,cAAc,CAC5B,WAAmB,EACnB,WAAiC,EACjC,QAAiB;QAEjB,OAAO,IAAI,gBAAgB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9E,CAAC;;AAzBU,uBAAuB;IADnC,OAAO,CAAmB,gBAAgB,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;GACnE,uBAAuB,CA0BnC"}
|
package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ import { AwsS3StaticWebsiteService } from './models/service/index.js';
|
|
|
19
19
|
* account: myAccount,
|
|
20
20
|
* awsRegionId: 'us-east-1',
|
|
21
21
|
* bucketName: 'my-static-website',
|
|
22
|
+
* cloudFront: {
|
|
23
|
+
* aliases: ['www.example.com'],
|
|
24
|
+
* certificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/<id>',
|
|
25
|
+
* },
|
|
22
26
|
* directoryPath: join(__dirname, 'website'),
|
|
23
27
|
* filter: (filePath) => !filePath.includes('.DS_Store'),
|
|
24
28
|
* subDirectoryOrFilePath: 'public',
|
|
@@ -28,6 +32,8 @@ import { AwsS3StaticWebsiteService } from './models/service/index.js';
|
|
|
28
32
|
*
|
|
29
33
|
* @group Modules/Service/AwsS3StaticWebsiteService
|
|
30
34
|
*
|
|
35
|
+
* @reference Resources {@link CloudFrontDistributionSchema}
|
|
36
|
+
* @reference Resources {@link CloudFrontInvalidationSchema}
|
|
31
37
|
* @reference Resources {@link S3WebsiteSchema}
|
|
32
38
|
*
|
|
33
39
|
* @see {@link AwsS3StaticWebsiteServiceModuleSchema} for the input schema.
|
package/dist/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AModule, Module } from '@quadnix/octo';
|
|
7
|
+
import { AModule, Module, ModuleError } from '@quadnix/octo';
|
|
8
8
|
import { AwsS3StaticWebsiteServiceModuleSchema } from './index.schema.js';
|
|
9
9
|
import { AwsS3StaticWebsiteService } from './models/service/index.js';
|
|
10
10
|
/**
|
|
@@ -25,6 +25,10 @@ import { AwsS3StaticWebsiteService } from './models/service/index.js';
|
|
|
25
25
|
* account: myAccount,
|
|
26
26
|
* awsRegionId: 'us-east-1',
|
|
27
27
|
* bucketName: 'my-static-website',
|
|
28
|
+
* cloudFront: {
|
|
29
|
+
* aliases: ['www.example.com'],
|
|
30
|
+
* certificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/<id>',
|
|
31
|
+
* },
|
|
28
32
|
* directoryPath: join(__dirname, 'website'),
|
|
29
33
|
* filter: (filePath) => !filePath.includes('.DS_Store'),
|
|
30
34
|
* subDirectoryOrFilePath: 'public',
|
|
@@ -34,6 +38,8 @@ import { AwsS3StaticWebsiteService } from './models/service/index.js';
|
|
|
34
38
|
*
|
|
35
39
|
* @group Modules/Service/AwsS3StaticWebsiteService
|
|
36
40
|
*
|
|
41
|
+
* @reference Resources {@link CloudFrontDistributionSchema}
|
|
42
|
+
* @reference Resources {@link CloudFrontInvalidationSchema}
|
|
37
43
|
* @reference Resources {@link S3WebsiteSchema}
|
|
38
44
|
*
|
|
39
45
|
* @see {@link AwsS3StaticWebsiteServiceModuleSchema} for the input schema.
|
|
@@ -46,6 +52,10 @@ let AwsS3StaticWebsiteServiceModule = class AwsS3StaticWebsiteServiceModule exte
|
|
|
46
52
|
*/
|
|
47
53
|
async onInit(inputs) {
|
|
48
54
|
const { app } = await this.registerMetadata(inputs);
|
|
55
|
+
// Validate the distribution can serve the domains it answers on.
|
|
56
|
+
if (inputs.cloudFront?.aliases?.length && !inputs.cloudFront.certificateArn) {
|
|
57
|
+
throw new ModuleError('A CloudFront certificate is required to serve an alias!', this.constructor.name);
|
|
58
|
+
}
|
|
49
59
|
// Create a new s3-website service.
|
|
50
60
|
const s3StaticWebsiteService = new AwsS3StaticWebsiteService(inputs.bucketName);
|
|
51
61
|
app.addService(s3StaticWebsiteService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-s3-static-website-service.module.js","sourceRoot":"","sources":["../../../../src/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"aws-s3-static-website-service.module.js","sourceRoot":"","sources":["../../../../src/modules/service/aws-s3-static-website-service/aws-s3-static-website-service.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAC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ACF,CAAA;AA7CY,+BAA+B;IAD3C,MAAM,CAAkC,OAAO,EAAE,qCAAqC,CAAC;GAC3E,+BAA+B,CA6C3C"}
|
|
@@ -1,4 +1,56 @@
|
|
|
1
1
|
import { type Account } from '@quadnix/octo';
|
|
2
|
+
/**
|
|
3
|
+
* Puts a CloudFront distribution in front of the website bucket.
|
|
4
|
+
*
|
|
5
|
+
* Declaring this closes the bucket: it is no longer reachable on its own, and the distribution
|
|
6
|
+
* becomes the only way in, serving the site over HTTPS from CloudFront's edge locations. It also
|
|
7
|
+
* means a deploy invalidates the edge caches, without which new files would sit behind the old ones
|
|
8
|
+
* for as long as a day.
|
|
9
|
+
*
|
|
10
|
+
* The distribution this builds is one opinion about serving a website out of a bucket. The resource
|
|
11
|
+
* underneath it can do a great deal more - several origins, a routing table over them, policies of
|
|
12
|
+
* its own - and a module wanting that writes its own distribution rather than widening this input.
|
|
13
|
+
*
|
|
14
|
+
* @group Modules/Service/AwsS3StaticWebsiteService
|
|
15
|
+
*
|
|
16
|
+
* @hideconstructor
|
|
17
|
+
*/
|
|
18
|
+
export declare class AwsS3StaticWebsiteServiceModuleCloudFrontSchema {
|
|
19
|
+
/**
|
|
20
|
+
* The custom domain names the distribution answers on, e.g. `docs.example.com`.
|
|
21
|
+
* Each one needs a DNS record pointing at the distribution, which this module does not create.
|
|
22
|
+
* Leaving this empty serves the site on the `*.cloudfront.net` domain CloudFront assigns.
|
|
23
|
+
*/
|
|
24
|
+
aliases?: string[] | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The ARN of the ACM certificate covering every entry in `aliases`.
|
|
27
|
+
* CloudFront only reads certificates from `us-east-1`, wherever the bucket itself lives.
|
|
28
|
+
* Required when `aliases` is set, and pointless without it.
|
|
29
|
+
*/
|
|
30
|
+
certificateArn?: string | null | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* What a visitor gets for a path the bucket has nothing at. The two answers are opposites, and
|
|
33
|
+
* which one is right is a fact about the site rather than about CloudFront.
|
|
34
|
+
*
|
|
35
|
+
* * `error-document` returns a real `404` carrying the site's error document. This is what a
|
|
36
|
+
* content site wants: a missing page is missing, and a search engine should be told so.
|
|
37
|
+
* * `single-page-app` returns a `200` carrying the index document, so that the app's own router
|
|
38
|
+
* decides what the path means. A single-page app needs this, and a content site using it would
|
|
39
|
+
* report every typo as a working page.
|
|
40
|
+
*/
|
|
41
|
+
notFoundBehavior?: "error-document" | "single-page-app" | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Which edge locations serve the site, which is what the distribution costs.
|
|
44
|
+
* `PriceClass_100` is North America and Europe alone and is the cheapest;
|
|
45
|
+
* `PriceClass_All` serves from everywhere.
|
|
46
|
+
*/
|
|
47
|
+
priceClass?: "PriceClass_100" | "PriceClass_200" | "PriceClass_All" | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The ARN of a web ACL to put in front of the distribution, or `null` for none.
|
|
50
|
+
* The ACL is not created here, and CloudFront only reads one from `us-east-1`.
|
|
51
|
+
*/
|
|
52
|
+
webAclArn?: string | null | undefined;
|
|
53
|
+
}
|
|
2
54
|
/**
|
|
3
55
|
* `AwsS3StaticWebsiteServiceModuleSchema` is the input schema for the `AwsS3StaticWebsiteServiceModule` module.
|
|
4
56
|
* This schema defines the configuration for S3-based static website services including bucket naming,
|
|
@@ -26,6 +78,12 @@ export declare class AwsS3StaticWebsiteServiceModuleSchema {
|
|
|
26
78
|
* Must follow S3 bucket naming conventions.
|
|
27
79
|
*/
|
|
28
80
|
bucketName: string;
|
|
81
|
+
/**
|
|
82
|
+
* Serves the bucket through a CloudFront distribution, and closes the bucket to everything else.
|
|
83
|
+
* Omitting this serves the bucket directly from its S3 website endpoint, over plain HTTP.
|
|
84
|
+
* See {@link AwsS3StaticWebsiteServiceModuleCloudFrontSchema} for options.
|
|
85
|
+
*/
|
|
86
|
+
cloudFront?: AwsS3StaticWebsiteServiceModuleCloudFrontSchema | null | undefined;
|
|
29
87
|
/**
|
|
30
88
|
* The local directory path containing the static website files.
|
|
31
89
|
* This is the source directory that will be synchronized to S3.
|
|
@@ -9,6 +9,89 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { AccountSchema, Schema, Validate } from '@quadnix/octo';
|
|
11
11
|
import { AwsAccountAnchorSchema } from '../../../anchors/aws-account/aws-account.anchor.schema.js';
|
|
12
|
+
/**
|
|
13
|
+
* Puts a CloudFront distribution in front of the website bucket.
|
|
14
|
+
*
|
|
15
|
+
* Declaring this closes the bucket: it is no longer reachable on its own, and the distribution
|
|
16
|
+
* becomes the only way in, serving the site over HTTPS from CloudFront's edge locations. It also
|
|
17
|
+
* means a deploy invalidates the edge caches, without which new files would sit behind the old ones
|
|
18
|
+
* for as long as a day.
|
|
19
|
+
*
|
|
20
|
+
* The distribution this builds is one opinion about serving a website out of a bucket. The resource
|
|
21
|
+
* underneath it can do a great deal more - several origins, a routing table over them, policies of
|
|
22
|
+
* its own - and a module wanting that writes its own distribution rather than widening this input.
|
|
23
|
+
*
|
|
24
|
+
* @group Modules/Service/AwsS3StaticWebsiteService
|
|
25
|
+
*
|
|
26
|
+
* @hideconstructor
|
|
27
|
+
*/
|
|
28
|
+
export class AwsS3StaticWebsiteServiceModuleCloudFrontSchema {
|
|
29
|
+
constructor() {
|
|
30
|
+
/**
|
|
31
|
+
* The custom domain names the distribution answers on, e.g. `docs.example.com`.
|
|
32
|
+
* Each one needs a DNS record pointing at the distribution, which this module does not create.
|
|
33
|
+
* Leaving this empty serves the site on the `*.cloudfront.net` domain CloudFront assigns.
|
|
34
|
+
*/
|
|
35
|
+
this.aliases = Schema([]);
|
|
36
|
+
/**
|
|
37
|
+
* The ARN of the ACM certificate covering every entry in `aliases`.
|
|
38
|
+
* CloudFront only reads certificates from `us-east-1`, wherever the bucket itself lives.
|
|
39
|
+
* Required when `aliases` is set, and pointless without it.
|
|
40
|
+
*/
|
|
41
|
+
this.certificateArn = Schema(null);
|
|
42
|
+
/**
|
|
43
|
+
* What a visitor gets for a path the bucket has nothing at. The two answers are opposites, and
|
|
44
|
+
* which one is right is a fact about the site rather than about CloudFront.
|
|
45
|
+
*
|
|
46
|
+
* * `error-document` returns a real `404` carrying the site's error document. This is what a
|
|
47
|
+
* content site wants: a missing page is missing, and a search engine should be told so.
|
|
48
|
+
* * `single-page-app` returns a `200` carrying the index document, so that the app's own router
|
|
49
|
+
* decides what the path means. A single-page app needs this, and a content site using it would
|
|
50
|
+
* report every typo as a working page.
|
|
51
|
+
*/
|
|
52
|
+
this.notFoundBehavior = Schema('error-document');
|
|
53
|
+
/**
|
|
54
|
+
* Which edge locations serve the site, which is what the distribution costs.
|
|
55
|
+
* `PriceClass_100` is North America and Europe alone and is the cheapest;
|
|
56
|
+
* `PriceClass_All` serves from everywhere.
|
|
57
|
+
*/
|
|
58
|
+
this.priceClass = Schema('PriceClass_All');
|
|
59
|
+
/**
|
|
60
|
+
* The ARN of a web ACL to put in front of the distribution, or `null` for none.
|
|
61
|
+
* The ACL is not created here, and CloudFront only reads one from `us-east-1`.
|
|
62
|
+
*/
|
|
63
|
+
this.webAclArn = Schema(null);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
__decorate([
|
|
67
|
+
Validate({
|
|
68
|
+
destruct: (value) => value,
|
|
69
|
+
options: { minLength: 1 },
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], AwsS3StaticWebsiteServiceModuleCloudFrontSchema.prototype, "aliases", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Validate({
|
|
75
|
+
destruct: (value) => value ? [value] : [],
|
|
76
|
+
options: { minLength: 1 },
|
|
77
|
+
}),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], AwsS3StaticWebsiteServiceModuleCloudFrontSchema.prototype, "certificateArn", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Validate({ options: { minLength: 1 } }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], AwsS3StaticWebsiteServiceModuleCloudFrontSchema.prototype, "notFoundBehavior", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
Validate({ options: { minLength: 1 } }),
|
|
86
|
+
__metadata("design:type", Object)
|
|
87
|
+
], AwsS3StaticWebsiteServiceModuleCloudFrontSchema.prototype, "priceClass", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
Validate({
|
|
90
|
+
destruct: (value) => (value ? [value] : []),
|
|
91
|
+
options: { minLength: 1 },
|
|
92
|
+
}),
|
|
93
|
+
__metadata("design:type", Object)
|
|
94
|
+
], AwsS3StaticWebsiteServiceModuleCloudFrontSchema.prototype, "webAclArn", void 0);
|
|
12
95
|
/**
|
|
13
96
|
* `AwsS3StaticWebsiteServiceModuleSchema` is the input schema for the `AwsS3StaticWebsiteServiceModule` module.
|
|
14
97
|
* This schema defines the configuration for S3-based static website services including bucket naming,
|
|
@@ -37,6 +120,12 @@ export class AwsS3StaticWebsiteServiceModuleSchema {
|
|
|
37
120
|
* Must follow S3 bucket naming conventions.
|
|
38
121
|
*/
|
|
39
122
|
this.bucketName = Schema();
|
|
123
|
+
/**
|
|
124
|
+
* Serves the bucket through a CloudFront distribution, and closes the bucket to everything else.
|
|
125
|
+
* Omitting this serves the bucket directly from its S3 website endpoint, over plain HTTP.
|
|
126
|
+
* See {@link AwsS3StaticWebsiteServiceModuleCloudFrontSchema} for options.
|
|
127
|
+
*/
|
|
128
|
+
this.cloudFront = Schema(null);
|
|
40
129
|
/**
|
|
41
130
|
* The local directory path containing the static website files.
|
|
42
131
|
* This is the source directory that will be synchronized to S3.
|
|
@@ -89,6 +178,13 @@ __decorate([
|
|
|
89
178
|
Validate({ options: { minLength: 1 } }),
|
|
90
179
|
__metadata("design:type", Object)
|
|
91
180
|
], AwsS3StaticWebsiteServiceModuleSchema.prototype, "bucketName", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
Validate({
|
|
183
|
+
destruct: (value) => (value ? [value] : []),
|
|
184
|
+
options: { isSchema: { schema: AwsS3StaticWebsiteServiceModuleCloudFrontSchema } },
|
|
185
|
+
}),
|
|
186
|
+
__metadata("design:type", Object)
|
|
187
|
+
], AwsS3StaticWebsiteServiceModuleSchema.prototype, "cloudFront", void 0);
|
|
92
188
|
__decorate([
|
|
93
189
|
Validate({ options: { minLength: 1 } }),
|
|
94
190
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.schema.js","sourceRoot":"","sources":["../../../../src/modules/service/aws-s3-static-website-service/index.schema.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AAEnG;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qCAAqC;IAAlD;QACE;;;WAGG;QAcH,YAAO,GAAG,MAAM,EAAW,CAAC;QAE5B;;WAEG;QAEH,gBAAW,GAAG,MAAM,EAAU,CAAC;QAE/B;;;;WAIG;QAEH,eAAU,GAAG,MAAM,EAAU,CAAC;QAE9B;;;WAGG;QAEH,kBAAa,GAAG,MAAM,EAAU,CAAC;QAEjC;;;;WAIG;QAaH,WAAM,GAAI,MAAM,CAAyC,IAAI,CAAC,CAAC;QAE/D;;;;;;;WAOG;QAWH,2BAAsB,GAAI,MAAM,CAAgB,IAAI,CAAC,CAAC;QAEtD;;;;WAIG;QAaH,cAAS,GAAI,MAAM,CAAwC,IAAI,CAAC,CAAC;IACnE,CAAC;CAAA;
|
|
1
|
+
{"version":3,"file":"index.schema.js","sourceRoot":"","sources":["../../../../src/modules/service/aws-s3-static-website-service/index.schema.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AAEnG;;;;;;;;;;;;;;;GAeG;AACH,MAA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,UAAU,CAAC;SAC1G;KACF,CAAC;;wEAC+D"}
|
|
@@ -4,7 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Action, DiffAction, Factory, hasNodeName, } from '@quadnix/octo';
|
|
7
|
+
import { Action, DiffAction, Factory, MatchingResource, hasNodeName, } from '@quadnix/octo';
|
|
8
|
+
import { CloudFrontDistribution } from '../../../../../../resources/cloudfront-distribution/index.js';
|
|
9
|
+
import { CloudFrontInvalidation } from '../../../../../../resources/cloudfront-invalidation/index.js';
|
|
8
10
|
import { S3Website } from '../../../../../../resources/s3-website/index.js';
|
|
9
11
|
import { AwsS3StaticWebsiteService } from '../aws-s3-static-website-service.model.js';
|
|
10
12
|
/**
|
|
@@ -26,15 +28,98 @@ let AddAwsS3StaticWebsiteServiceModelAction = class AddAwsS3StaticWebsiteService
|
|
|
26
28
|
async handle(diff, actionInputs, actionOutputs) {
|
|
27
29
|
const { bucketName } = diff.node;
|
|
28
30
|
const { awsAccountId, awsRegionId } = actionInputs.metadata;
|
|
31
|
+
const { cloudFront } = actionInputs.inputs;
|
|
32
|
+
const errorDocument = 'error.html';
|
|
33
|
+
const indexDocument = 'index.html';
|
|
34
|
+
const sanitizedBucketName = bucketName.replace(/[^\w-]/g, '-');
|
|
29
35
|
// Create S3 Website.
|
|
30
|
-
const s3Website = new S3Website(`bucket-${
|
|
36
|
+
const s3Website = new S3Website(`bucket-${sanitizedBucketName}`, {
|
|
31
37
|
awsAccountId,
|
|
32
38
|
awsRegionId,
|
|
33
39
|
Bucket: bucketName,
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
// Filled in by the grant below, which is also what closes the bucket.
|
|
41
|
+
distributionResourceIds: [],
|
|
42
|
+
ErrorDocument: errorDocument,
|
|
43
|
+
IndexDocument: indexDocument,
|
|
36
44
|
});
|
|
37
45
|
actionOutputs[s3Website.resourceId] = s3Website;
|
|
46
|
+
if (!cloudFront) {
|
|
47
|
+
return actionOutputs;
|
|
48
|
+
}
|
|
49
|
+
const originId = `${sanitizedBucketName}-origin`;
|
|
50
|
+
// Create CloudFront Distribution. This is one website-shaped setup out of what the resource can
|
|
51
|
+
// express: a single private bucket, everything cached the same way, and misses answered
|
|
52
|
+
// according to whether the site routes on the client or on the server.
|
|
53
|
+
const cloudFrontDistribution = new CloudFrontDistribution(`cloudfront-${sanitizedBucketName}`, {
|
|
54
|
+
aliases: [...(cloudFront.aliases || [])],
|
|
55
|
+
awsAccountId,
|
|
56
|
+
behaviors: [
|
|
57
|
+
{
|
|
58
|
+
allowedMethods: ['GET', 'HEAD'],
|
|
59
|
+
cachedMethods: ['GET', 'HEAD'],
|
|
60
|
+
cachePolicy: { kind: 'managed', name: 'Managed-CachingOptimized' },
|
|
61
|
+
compress: true,
|
|
62
|
+
functionAssociations: [],
|
|
63
|
+
originRequestPolicy: null,
|
|
64
|
+
pathPattern: null,
|
|
65
|
+
responseHeadersPolicy: null,
|
|
66
|
+
targetOriginId: originId,
|
|
67
|
+
viewerProtocolPolicy: 'redirect-to-https',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
cachePolicies: [],
|
|
71
|
+
comment: cloudFront.aliases?.[0] || bucketName,
|
|
72
|
+
customErrorResponses: [403, 404].map((errorCode) => cloudFront.notFoundBehavior === 'single-page-app'
|
|
73
|
+
? {
|
|
74
|
+
// A short TTL, because what is missing today is the app's next route tomorrow.
|
|
75
|
+
errorCachingMinTtl: 10,
|
|
76
|
+
errorCode,
|
|
77
|
+
responseCode: 200,
|
|
78
|
+
responsePagePath: `/${indexDocument}`,
|
|
79
|
+
}
|
|
80
|
+
: { errorCachingMinTtl: 10, errorCode, responseCode: 404, responsePagePath: `/${errorDocument}` }),
|
|
81
|
+
defaultRootObject: indexDocument,
|
|
82
|
+
distributionName: sanitizedBucketName,
|
|
83
|
+
enabled: true,
|
|
84
|
+
geoRestriction: { kind: 'none' },
|
|
85
|
+
httpVersion: 'http2and3',
|
|
86
|
+
isIpv6Enabled: true,
|
|
87
|
+
logging: null,
|
|
88
|
+
originGroups: [],
|
|
89
|
+
originRequestPolicies: [],
|
|
90
|
+
origins: [
|
|
91
|
+
{
|
|
92
|
+
connectionAttempts: 3,
|
|
93
|
+
connectionTimeout: 10,
|
|
94
|
+
customHeaders: {},
|
|
95
|
+
kind: { bucketName, bucketRegion: awsRegionId, kind: 's3' },
|
|
96
|
+
originId,
|
|
97
|
+
originPath: '',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
priceClass: cloudFront.priceClass || 'PriceClass_All',
|
|
101
|
+
responseHeadersPolicies: [],
|
|
102
|
+
viewerCertificate: cloudFront.certificateArn
|
|
103
|
+
? {
|
|
104
|
+
certificateArn: cloudFront.certificateArn,
|
|
105
|
+
kind: 'acm',
|
|
106
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
107
|
+
minimumProtocolVersion: 'TLSv1.2_2021',
|
|
108
|
+
}
|
|
109
|
+
: { kind: 'default' },
|
|
110
|
+
webAclArn: cloudFront.webAclArn || null,
|
|
111
|
+
});
|
|
112
|
+
actionOutputs[cloudFrontDistribution.resourceId] = cloudFrontDistribution;
|
|
113
|
+
// Admit the distribution to the bucket. The grant lives on the bucket, in the one policy the
|
|
114
|
+
// bucket owns, so a second distribution in front of the same bucket would add a statement rather
|
|
115
|
+
// than overwrite this one. It also closes the bucket: a bucket with a distribution in front of it
|
|
116
|
+
// publishes nothing of its own.
|
|
117
|
+
const matchingCloudFrontDistribution = new MatchingResource(cloudFrontDistribution);
|
|
118
|
+
s3Website.addCloudFrontAccess(matchingCloudFrontDistribution);
|
|
119
|
+
// Drop what the edges are holding whenever the published files change. The version is a
|
|
120
|
+
// placeholder until the source paths are read, which happens in the same transaction.
|
|
121
|
+
const cloudFrontInvalidation = new CloudFrontInvalidation(`cloudfront-invalidation-${sanitizedBucketName}`, { awsAccountId, contentVersion: 'initial', paths: ['/*'] }, [matchingCloudFrontDistribution]);
|
|
122
|
+
actionOutputs[cloudFrontInvalidation.resourceId] = cloudFrontInvalidation;
|
|
38
123
|
return actionOutputs;
|
|
39
124
|
}
|
|
40
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-aws-s3-static-website-service.model.action.js","sourceRoot":"","sources":["../../../../../../../src/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,MAAM,EAGN,UAAU,EAEV,OAAO,EAEP,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAEtF;;GAEG;AAEI,IAAM,uCAAuC,GAA7C,MAAM,uCAAuC;IAClD;;OAEG;IACH,MAAM,CAAC,IAAU;QACf,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,GAAG;YAC9B,IAAI,CAAC,IAAI,YAAY,yBAAyB;YAC9C,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;YACjC,IAAI,CAAC,KAAK,KAAK,WAAW,CAC3B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,IAAqC,EACrC,YAAmE,EACnE,aAA4B;QAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAEjC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"add-aws-s3-static-website-service.model.action.js","sourceRoot":"","sources":["../../../../../../../src/modules/service/aws-s3-static-website-service/models/service/actions/add-aws-s3-static-website-service.model.action.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AC,CAAC;QAE9D,wFAAwF;QACxF,sFAAsF;QACtF,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,CACvD,2BAA2B,mBAAmB,EAAE,EAChD,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,EAC1D,CAAC,8BAA8B,CAAC,CACjC,CAAC;QAEF,aAAa,CAAC,sBAAsB,CAAC,UAAU,CAAC,GAAG,sBAAsB,CAAC;QAE1E,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAA;AAvIY,uCAAuC;IADnD,MAAM,CAAC,yBAAyB,CAAC;GACrB,uCAAuC,CAuInD;;AAED;;GAEG;AAEI,IAAM,8CAA8C,GAApD,MAAM,8CAA8C;IAGzD;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,uCAAuC,EAAE,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF,CAAA;AAZY,8CAA8C;IAD1D,OAAO,CAA0C,uCAAuC,CAAC;GAC7E,8CAA8C,CAY1D"}
|
|
@@ -4,6 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
import { createHash } from 'crypto';
|
|
7
8
|
import { Action, DiffAction, Factory, hasNodeName, } from '@quadnix/octo';
|
|
8
9
|
import { AwsS3StaticWebsiteService } from '../aws-s3-static-website-service.model.js';
|
|
9
10
|
/**
|
|
@@ -24,9 +25,24 @@ let UpdateAwsS3StaticWebsiteServiceSourcePathsModelAction = class UpdateAwsS3Sta
|
|
|
24
25
|
*/
|
|
25
26
|
async handle(diff, actionInputs, actionOutputs) {
|
|
26
27
|
const { bucketName } = diff.node;
|
|
27
|
-
const
|
|
28
|
+
const sanitizedBucketName = bucketName.replace(/[^\w-]/g, '-');
|
|
29
|
+
const s3Website = actionInputs.resources[`bucket-${sanitizedBucketName}`];
|
|
28
30
|
s3Website.updateManifest(diff.value);
|
|
29
31
|
actionOutputs[s3Website.resourceId] = s3Website;
|
|
32
|
+
// What the distribution is serving has moved, so the edges have to be told. The version is a
|
|
33
|
+
// digest over the manifest rather than the manifest itself: it only ever has to differ from the
|
|
34
|
+
// last one, and an invalidation that named every file would be billed per path.
|
|
35
|
+
const cloudFrontInvalidation = actionInputs.resources[`cloudfront-invalidation-${sanitizedBucketName}`];
|
|
36
|
+
if (cloudFrontInvalidation) {
|
|
37
|
+
const manifestDigest = createHash('sha1')
|
|
38
|
+
.update(Object.keys(diff.value)
|
|
39
|
+
.sort()
|
|
40
|
+
.map((remotePath) => `${remotePath}:${diff.value[remotePath].digest}`)
|
|
41
|
+
.join('\n'))
|
|
42
|
+
.digest('hex');
|
|
43
|
+
cloudFrontInvalidation.properties.contentVersion = manifestDigest;
|
|
44
|
+
actionOutputs[cloudFrontInvalidation.resourceId] = cloudFrontInvalidation;
|
|
45
|
+
}
|
|
30
46
|
return actionOutputs;
|
|
31
47
|
}
|
|
32
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-aws-s3-static-website-service-source-paths.model.action.js","sourceRoot":"","sources":["../../../../../../../src/modules/service/aws-s3-static-website-service/models/service/actions/update-aws-s3-static-website-service-source-paths.model.action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,MAAM,EAGN,UAAU,EAEV,OAAO,EAEP,WAAW,GACZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"update-aws-s3-static-website-service-source-paths.model.action.js","sourceRoot":"","sources":["../../../../../../../src/modules/service/aws-s3-static-website-service/models/service/actions/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AAK,CAAC;iBACpB,IAAI,EAAE;iBACN,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;iBACrE,IAAI,CAAC,IAAI,CAAC,CACd;iBACA,MAAM,CAAC,KAAK,CAAC,CAAC;YACjB,sBAAsB,CAAC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;YAElE,aAAa,CAAC,sBAAsB,CAAC,UAAU,CAAC,GAAG,sBAAsB,CAAC;QAC5E,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAA;AArDY,qDAAqD;IADjE,MAAM,CAAC,yBAAyB,CAAC;GACrB,qDAAqD,CAqDjE;;AAED;;GAEG;AAEI,IAAM,4DAA4D,GAAlE,MAAM,4DAA4D;IAGvE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,qDAAqD,EAAE,CAAC;QAC9E,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF,CAAA;AAZY,4DAA4D;IADxE,OAAO,CAAwD,qDAAqD,CAAC;GACzG,4DAA4D,CAYxE"}
|
|
@@ -9,8 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var AwsS3StaticWebsiteService_1;
|
|
11
11
|
import { lstat, readdir } from 'fs/promises';
|
|
12
|
-
import { join, parse
|
|
13
|
-
import { Diff, DiffAction, Model, ModelError, Service, Validate } from '@quadnix/octo';
|
|
12
|
+
import { join, parse } from 'path';
|
|
13
|
+
import { Diff, DiffAction, Model, ModelError, ProjectUtility, Service, Validate } from '@quadnix/octo';
|
|
14
14
|
import { FileUtility } from '../../../../../utilities/file/file.utility.js';
|
|
15
15
|
import { AwsS3StaticWebsiteServiceSchema } from './aws-s3-static-website-service.schema.js';
|
|
16
16
|
/**
|
|
@@ -36,7 +36,10 @@ let AwsS3StaticWebsiteService = AwsS3StaticWebsiteService_1 = class AwsS3StaticW
|
|
|
36
36
|
* @internal
|
|
37
37
|
*/
|
|
38
38
|
async addSource(directoryPath, subDirectoryOrFilePath, filter, transform) {
|
|
39
|
-
|
|
39
|
+
// Against the project root rather than the working directory. A module composes the graph in
|
|
40
|
+
// every mode, including the `octo run-action` callback terraform makes mid-apply, and terraform
|
|
41
|
+
// makes that call from a terragrunt cache directory.
|
|
42
|
+
directoryPath = ProjectUtility.resolveFromProjectRoot(directoryPath);
|
|
40
43
|
if (!subDirectoryOrFilePath) {
|
|
41
44
|
subDirectoryOrFilePath = '';
|
|
42
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-s3-static-website-service.model.js","sourceRoot":"","sources":["../../../../../../src/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"aws-s3-static-website-service.model.js","sourceRoot":"","sources":["../../../../../../src/modules/service/aws-s3-static-website-service/models/service/aws-s3-static-website-service.model.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;A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