@stacksjs/cloud 0.66.0 → 0.68.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/{src/cloud/ai.ts → dist/ai.d.ts} +5 -9
- package/{src/cloud/cdn.ts → dist/cdn.d.ts} +9 -28
- package/dist/cli.d.ts +12 -0
- package/{src/cloud/compute.ts → dist/compute.d.ts} +13 -37
- package/{src/cloud/database.ts → dist/database.d.ts} +5 -10
- package/{src/cloud/deployment.ts → dist/deployment.d.ts} +5 -16
- package/{src/cloud/dns.ts → dist/dns.d.ts} +4 -11
- package/dist/docs.d.ts +34 -0
- package/{src/cloud/email.ts → dist/email.d.ts} +9 -29
- package/{src/cloud/file-system.ts → dist/file-system.d.ts} +6 -9
- package/dist/helpers.d.ts +50 -50
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -23
- package/{src/cloud/jump-box.ts → dist/jump-box.d.ts} +7 -12
- package/{src/cloud/network.ts → dist/network.d.ts} +5 -8
- package/dist/origin-request.d.ts +5 -0
- package/dist/origin-request.js +6 -6
- package/{src/cloud/permissions.ts → dist/permissions.d.ts} +5 -13
- package/{src/cloud/queue.ts → dist/queue.d.ts} +9 -29
- package/{src/cloud/redirects.ts → dist/redirects.d.ts} +7 -14
- package/{src/cloud/security.ts → dist/security.d.ts} +5 -128
- package/{src/cloud/storage.ts → dist/storage.d.ts} +7 -15
- package/dist/types.d.ts +26 -25
- package/package.json +30 -32
- package/dist/cloud/ai.d.ts +0 -6
- package/dist/cloud/cache.d.ts +0 -0
- package/dist/cloud/cdn.d.ts +0 -34
- package/dist/cloud/cli.d.ts +0 -6
- package/dist/cloud/compute.d.ts +0 -17
- package/dist/cloud/dashboard.d.ts +0 -0
- package/dist/cloud/database.d.ts +0 -11
- package/dist/cloud/deployment.d.ts +0 -17
- package/dist/cloud/dns.d.ts +0 -7
- package/dist/cloud/docs.d.ts +0 -8
- package/dist/cloud/email.d.ts +0 -10
- package/dist/cloud/file-system.d.ts +0 -12
- package/dist/cloud/index.d.ts +0 -42
- package/dist/cloud/jump-box.d.ts +0 -12
- package/dist/cloud/network.d.ts +0 -8
- package/dist/cloud/permissions.d.ts +0 -6
- package/dist/cloud/queue.d.ts +0 -22
- package/dist/cloud/redirects.d.ts +0 -8
- package/dist/cloud/search-engine.d.ts +0 -0
- package/dist/cloud/security.d.ts +0 -15
- package/dist/cloud/storage.d.ts +0 -21
- package/dist/edge/origin-request.d.ts +0 -1
- package/dist/index.js.map +0 -1867
- package/src/cloud/cache.ts +0 -0
- package/src/cloud/cli.ts +0 -14
- package/src/cloud/dashboard.ts +0 -85
- package/src/cloud/docs.ts +0 -50
- package/src/cloud/index.ts +0 -141
- package/src/cloud/router-layer/nodejs/package.json +0 -15
- package/src/cloud/search-engine.ts +0 -108
- package/src/edge/origin-request.ts +0 -55
- package/src/helpers.ts +0 -800
- package/src/index.ts +0 -2
- package/src/types.ts +0 -28
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
import { aws_ec2 as ec2, aws_iam as iam, CfnOutput as Output } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
5
3
|
|
|
6
|
-
export interface JumpBoxStackProps extends NestedCloudProps {
|
|
4
|
+
export declare interface JumpBoxStackProps extends NestedCloudProps {
|
|
7
5
|
vpc: ec2.Vpc
|
|
8
6
|
fileSystem: efs.FileSystem
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
// export class DocsStack extends NestedStack {
|
|
12
|
-
export class JumpBoxStack {
|
|
8
|
+
export declare class JumpBoxStack {
|
|
13
9
|
jumpBox?: ec2.Instance
|
|
14
10
|
|
|
15
11
|
constructor(scope: Construct, props: JumpBoxStackProps) {
|
|
@@ -21,7 +17,6 @@ export class JumpBoxStack {
|
|
|
21
17
|
],
|
|
22
18
|
})
|
|
23
19
|
|
|
24
|
-
// this instance needs to be created once to mount the EFS & clone the Stacks repo
|
|
25
20
|
this.jumpBox = new ec2.Instance(scope, 'JumpBox', {
|
|
26
21
|
vpc: props.vpc,
|
|
27
22
|
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO),
|
|
@@ -32,10 +27,10 @@ export class JumpBoxStack {
|
|
|
32
27
|
yum update -y
|
|
33
28
|
yum install -y amazon-efs-utils
|
|
34
29
|
yum install -y git
|
|
35
|
-
yum install -y https
|
|
30
|
+
yum install -y https:
|
|
36
31
|
mkdir /mnt/efs
|
|
37
32
|
mount -t efs ${props.fileSystem.fileSystemId}:/ /mnt/efs
|
|
38
|
-
git clone https
|
|
33
|
+
git clone https:
|
|
39
34
|
`),
|
|
40
35
|
})
|
|
41
36
|
|
|
@@ -44,4 +39,4 @@ export class JumpBoxStack {
|
|
|
44
39
|
description: 'The ID of the EC2 instance that can be used to SSH into the Stacks Cloud.',
|
|
45
40
|
})
|
|
46
41
|
}
|
|
47
|
-
}
|
|
42
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
import { aws_ec2 as ec2 } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
4
3
|
|
|
5
|
-
export interface NetworkStackProps extends NestedCloudProps {
|
|
6
|
-
//
|
|
4
|
+
export declare interface NetworkStackProps extends NestedCloudProps {
|
|
7
5
|
}
|
|
8
|
-
|
|
9
|
-
export class NetworkStack {
|
|
6
|
+
export declare class NetworkStack {
|
|
10
7
|
vpc: ec2.Vpc
|
|
11
8
|
|
|
12
9
|
constructor(scope: Construct, props: NetworkStackProps) {
|
|
@@ -29,4 +26,4 @@ export class NetworkStack {
|
|
|
29
26
|
],
|
|
30
27
|
})
|
|
31
28
|
}
|
|
32
|
-
}
|
|
29
|
+
}
|
package/dist/origin-request.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// src/edge/origin-request.ts
|
|
2
|
+
var config = {
|
|
3
|
+
suffix: ".html",
|
|
4
|
+
removeTrailingSlash: false
|
|
5
|
+
};
|
|
6
|
+
var regexSuffixless = /\/[^/.]+$/;
|
|
7
|
+
var regexTrailingSlash = /.+\/$/;
|
|
2
8
|
function handler(event, context, callback) {
|
|
3
9
|
const { request } = event.Records[0].cf;
|
|
4
10
|
const { uri } = request;
|
|
@@ -20,12 +26,6 @@ function handler(event, context, callback) {
|
|
|
20
26
|
}
|
|
21
27
|
callback(null, request);
|
|
22
28
|
}
|
|
23
|
-
var config = {
|
|
24
|
-
suffix: ".html",
|
|
25
|
-
removeTrailingSlash: false
|
|
26
|
-
};
|
|
27
|
-
var regexSuffixless = /\/[^/.]+$/;
|
|
28
|
-
var regexTrailingSlash = /.+\/$/;
|
|
29
29
|
export {
|
|
30
30
|
handler
|
|
31
31
|
};
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
import { config } from '@stacksjs/config'
|
|
4
|
-
import { env } from '@stacksjs/env'
|
|
5
|
-
import { string } from '@stacksjs/strings'
|
|
6
|
-
import { aws_iam as iam, SecretValue } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
7
3
|
|
|
8
|
-
export interface PermissionsStackProps extends NestedCloudProps {
|
|
9
|
-
//
|
|
4
|
+
export declare interface PermissionsStackProps extends NestedCloudProps {
|
|
10
5
|
}
|
|
11
|
-
|
|
12
|
-
export class PermissionsStack {
|
|
6
|
+
export declare class PermissionsStack {
|
|
13
7
|
constructor(scope: Construct) {
|
|
14
8
|
const teamName = config.team.name
|
|
15
9
|
const users = config.team.members
|
|
16
10
|
const password = env.AWS_DEFAULT_PASSWORD || string.random()
|
|
17
11
|
|
|
18
12
|
for (const name in users) {
|
|
19
|
-
// const userEmail = users[userName]
|
|
20
13
|
const id = `User${string.pascalCase(teamName)}${string.pascalCase(name)}`
|
|
21
14
|
const userName = string.slug(`${teamName}-${name}`)
|
|
22
15
|
const user = new iam.User(scope, id, {
|
|
@@ -27,7 +20,6 @@ export class PermissionsStack {
|
|
|
27
20
|
|
|
28
21
|
user.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'))
|
|
29
22
|
|
|
30
|
-
// TODO: email the userEmail their credentials
|
|
31
23
|
}
|
|
32
24
|
}
|
|
33
|
-
}
|
|
25
|
+
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import type { Cluster, TaskDefinition } from 'aws-cdk-lib/aws-ecs'
|
|
2
|
-
import type { Construct } from 'constructs'
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { pascalCase, slug } from '@stacksjs/strings'
|
|
7
|
-
import { aws_ec2 as ec2 } from 'aws-cdk-lib'
|
|
8
|
-
import { Rule, Schedule } from 'aws-cdk-lib/aws-events'
|
|
9
|
-
import { EcsTask } from 'aws-cdk-lib/aws-events-targets'
|
|
10
|
-
|
|
11
|
-
export interface QueueStackProps extends NestedCloudProps {
|
|
1
|
+
import type { Cluster, TaskDefinition } from 'aws-cdk-lib/aws-ecs';
|
|
2
|
+
import type { Construct } from 'constructs';
|
|
3
|
+
import type { NestedCloudProps } from '../types';
|
|
4
|
+
|
|
5
|
+
export declare interface QueueStackProps extends NestedCloudProps {
|
|
12
6
|
cluster: Cluster
|
|
13
7
|
taskDefinition: TaskDefinition
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
export class QueueStack {
|
|
9
|
+
export declare class QueueStack {
|
|
17
10
|
scope: Construct
|
|
18
11
|
props: QueueStackProps
|
|
19
12
|
|
|
@@ -32,14 +25,12 @@ export class QueueStack {
|
|
|
32
25
|
const ormActionFiles = await fs.readdir(ormActionDir)
|
|
33
26
|
const jobs = []
|
|
34
27
|
|
|
35
|
-
// then, need to loop through all app/Jobs/*.ts and create a rule for each, potentially overwriting the Schedule.ts jobs
|
|
36
28
|
for (const file of jobFiles) {
|
|
37
29
|
if (!file.endsWith('.ts'))
|
|
38
30
|
continue
|
|
39
31
|
|
|
40
32
|
const jobPath = path.jobsPath(file)
|
|
41
33
|
|
|
42
|
-
// Await the loading of the job module
|
|
43
34
|
const job = await this.loadModule(jobPath)
|
|
44
35
|
this.createQueueRule(job, file)
|
|
45
36
|
jobs.push(job)
|
|
@@ -51,7 +42,6 @@ export class QueueStack {
|
|
|
51
42
|
|
|
52
43
|
const ormActionPath = path.builtUserActionsPath(`src/${ormFile}`)
|
|
53
44
|
|
|
54
|
-
// Await the loading of the job module
|
|
55
45
|
const ormAction = await this.loadModule(ormActionPath)
|
|
56
46
|
this.createQueueRule(ormAction, ormFile)
|
|
57
47
|
jobs.push(ormAction)
|
|
@@ -63,14 +53,12 @@ export class QueueStack {
|
|
|
63
53
|
|
|
64
54
|
const actionPath = path.appPath(`Actions/${file}`)
|
|
65
55
|
|
|
66
|
-
// Await the loading of the job module
|
|
67
56
|
const action = await this.loadModule(actionPath)
|
|
68
57
|
this.createQueueRule(action, file)
|
|
69
58
|
jobs.push(action)
|
|
70
59
|
}
|
|
71
60
|
}
|
|
72
61
|
|
|
73
|
-
// Helper function to convert a rate string to a cron object for AWS Schedule
|
|
74
62
|
cronScheduleFromRate(rate: string): {
|
|
75
63
|
minute?: string
|
|
76
64
|
hour?: string
|
|
@@ -78,7 +66,6 @@ export class QueueStack {
|
|
|
78
66
|
weekDay?: string
|
|
79
67
|
year?: string
|
|
80
68
|
} {
|
|
81
|
-
// Assuming the rate is in standard cron format, split it to map to the AWS Schedule.cron() parameters
|
|
82
69
|
const parts = rate.split(' ')
|
|
83
70
|
return {
|
|
84
71
|
minute: parts[0],
|
|
@@ -95,23 +82,17 @@ export class QueueStack {
|
|
|
95
82
|
return jobModule
|
|
96
83
|
}
|
|
97
84
|
|
|
98
|
-
// TODO: narrow any type -> jobs & actions are allowed
|
|
99
85
|
createQueueRule(module: { default: any }, file: string): void {
|
|
100
|
-
// Now you can safely access module.default.rate
|
|
101
86
|
const rate = module.default?.rate
|
|
102
87
|
|
|
103
|
-
// if no rate or job is disabled, no need to schedule, skip
|
|
104
88
|
if (!rate || module.default?.enabled === false)
|
|
105
89
|
return
|
|
106
90
|
|
|
107
|
-
// Convert the rate to a Schedule object
|
|
108
91
|
const schedule = Schedule.cron(this.cronScheduleFromRate(rate))
|
|
109
92
|
|
|
110
93
|
const id = `QueueRule${pascalCase(file.replace('.ts', ''))}`
|
|
111
94
|
|
|
112
|
-
// Perform operations with the jobModule.default as needed
|
|
113
95
|
const rule = new Rule(this.scope, id, {
|
|
114
|
-
// schedule to run every second
|
|
115
96
|
ruleName: `${this.props.appName}-${this.props.appEnv}-queue-rule-${slug(file.replace('.ts', ''))}`,
|
|
116
97
|
schedule,
|
|
117
98
|
})
|
|
@@ -152,13 +133,12 @@ export class QueueStack {
|
|
|
152
133
|
},
|
|
153
134
|
],
|
|
154
135
|
|
|
155
|
-
retryAttempts: 1,
|
|
156
|
-
// retryAttempts: module.default.tries || 3,
|
|
136
|
+
retryAttempts: 1,
|
|
157
137
|
|
|
158
138
|
subnetSelection: {
|
|
159
|
-
subnetType: ec2.SubnetType.PUBLIC,
|
|
139
|
+
subnetType: ec2.SubnetType.PUBLIC,
|
|
160
140
|
},
|
|
161
141
|
}),
|
|
162
142
|
)
|
|
163
143
|
}
|
|
164
|
-
}
|
|
144
|
+
}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
import { config } from '@stacksjs/config'
|
|
4
|
-
import { RemovalPolicy, aws_route53 as route53, aws_s3 as s3 } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
5
3
|
|
|
6
|
-
export interface RedirectsStackProps extends NestedCloudProps {
|
|
7
|
-
//
|
|
4
|
+
export declare interface RedirectsStackProps extends NestedCloudProps {
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
export class RedirectsStack {
|
|
6
|
+
export declare class RedirectsStack {
|
|
11
7
|
redirectZones: route53.IHostedZone[] = []
|
|
12
8
|
|
|
13
9
|
constructor(scope: Construct, props: RedirectsStackProps) {
|
|
14
|
-
// for each redirect, create a bucket & redirect it to the APP_URL
|
|
15
10
|
config.dns.redirects?.forEach((redirect: string) => {
|
|
16
|
-
// TODO: use string-ts function here instead
|
|
17
11
|
const slug = redirect
|
|
18
12
|
.split('.')
|
|
19
13
|
.map((part: string, index: number) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
|
|
20
|
-
.join('')
|
|
14
|
+
.join('')
|
|
21
15
|
const hostedZone = route53.HostedZone.fromLookup(scope, 'HostedZone', {
|
|
22
16
|
domainName: redirect,
|
|
23
17
|
})
|
|
@@ -39,14 +33,13 @@ export class RedirectsStack {
|
|
|
39
33
|
})
|
|
40
34
|
})
|
|
41
35
|
|
|
42
|
-
// TODO: fix this – redirects do not work yet
|
|
43
36
|
config.dns.redirects?.forEach((redirect: string) => {
|
|
44
37
|
const slug = redirect
|
|
45
38
|
.split('.')
|
|
46
39
|
.map((part: string, index: number) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
|
|
47
|
-
.join('')
|
|
40
|
+
.join('')
|
|
48
41
|
const hostedZone = route53.HostedZone.fromLookup(scope, `RedirectHostedZone${slug}`, { domainName: redirect })
|
|
49
42
|
this.redirectZones.push(hostedZone)
|
|
50
43
|
})
|
|
51
44
|
}
|
|
52
|
-
}
|
|
45
|
+
}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
// waf and encryption
|
|
5
|
-
import { config } from '@stacksjs/config'
|
|
6
|
-
import {
|
|
7
|
-
aws_certificatemanager as acm,
|
|
8
|
-
aws_cloudfront as cloudfront,
|
|
9
|
-
Duration,
|
|
10
|
-
aws_kms as kms,
|
|
11
|
-
RemovalPolicy,
|
|
12
|
-
Tags,
|
|
13
|
-
aws_wafv2 as wafv2,
|
|
14
|
-
} from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
15
3
|
|
|
16
|
-
export interface StorageStackProps extends NestedCloudProps {
|
|
4
|
+
export declare interface StorageStackProps extends NestedCloudProps {
|
|
17
5
|
zone: route53.IHostedZone
|
|
18
6
|
}
|
|
19
|
-
|
|
20
|
-
export class SecurityStack {
|
|
7
|
+
export declare class SecurityStack {
|
|
21
8
|
firewall: wafv2.CfnWebACL
|
|
22
9
|
kmsKey: kms.Key
|
|
23
10
|
certificate: acm.Certificate
|
|
@@ -153,120 +140,10 @@ export class SecurityStack {
|
|
|
153
140
|
})
|
|
154
141
|
}
|
|
155
142
|
|
|
156
|
-
// if (config.security.firewall?.queryString?.length) {
|
|
157
|
-
// priorities.push(1)
|
|
158
|
-
// rules.push({
|
|
159
|
-
// name: 'QueryStringRule',
|
|
160
|
-
// priority: priorities.length,
|
|
161
|
-
// statement: {
|
|
162
|
-
// byteMatchStatement: {
|
|
163
|
-
// fieldToMatch: {
|
|
164
|
-
// queryString: {},
|
|
165
|
-
// },
|
|
166
|
-
// positionalConstraint: 'EXACTLY',
|
|
167
|
-
// searchString: config.security.firewall.queryString.join(', '),
|
|
168
|
-
// textTransformations: [
|
|
169
|
-
// {
|
|
170
|
-
// priority: 0,
|
|
171
|
-
// type: 'NONE',
|
|
172
|
-
// },
|
|
173
|
-
// ],
|
|
174
|
-
// },
|
|
175
|
-
// },
|
|
176
|
-
// action: {
|
|
177
|
-
// block: {},
|
|
178
|
-
// },
|
|
179
|
-
// visibilityConfig: {
|
|
180
|
-
// sampledRequestsEnabled: true,
|
|
181
|
-
// cloudWatchMetricsEnabled: true,
|
|
182
|
-
// metricName: 'QueryStringRule',
|
|
183
|
-
// },
|
|
184
|
-
// })
|
|
185
|
-
// }
|
|
186
143
|
|
|
187
|
-
// if (config.security.firewall?.rateLimitPerMinute) {
|
|
188
|
-
// priorities.push(1)
|
|
189
|
-
// rules.push({
|
|
190
|
-
// name: 'RateLimitRule',
|
|
191
|
-
// priority: priorities.length,
|
|
192
|
-
// statement: {
|
|
193
|
-
// rateBasedStatement: {
|
|
194
|
-
// limit: config.security.firewall.rateLimitPerMinute,
|
|
195
|
-
// aggregateKeyType: 'IP',
|
|
196
|
-
// },
|
|
197
|
-
// },
|
|
198
|
-
// action: {
|
|
199
|
-
// block: {},
|
|
200
|
-
// },
|
|
201
|
-
// visibilityConfig: {
|
|
202
|
-
// sampledRequestsEnabled: true,
|
|
203
|
-
// cloudWatchMetricsEnabled: true,
|
|
204
|
-
// metricName: 'RateLimitRule',
|
|
205
|
-
// },
|
|
206
|
-
// })
|
|
207
|
-
// }
|
|
208
144
|
|
|
209
|
-
// if (config.security.firewall?.useIpReputationLists) {
|
|
210
|
-
// priorities.push(1)
|
|
211
|
-
// rules.push({
|
|
212
|
-
// name: 'IpReputationRule',
|
|
213
|
-
// priority: priorities.length,
|
|
214
|
-
// statement: {
|
|
215
|
-
// managedRuleGroupStatement: {
|
|
216
|
-
// vendorName: 'AWS',
|
|
217
|
-
// name: 'AWSManagedRulesAmazonIpReputationList',
|
|
218
|
-
// },
|
|
219
|
-
// },
|
|
220
|
-
// action: {
|
|
221
|
-
// block: {},
|
|
222
|
-
// },
|
|
223
|
-
// visibilityConfig: {
|
|
224
|
-
// sampledRequestsEnabled: true,
|
|
225
|
-
// cloudWatchMetricsEnabled: true,
|
|
226
|
-
// metricName: 'IpReputationRule',
|
|
227
|
-
// },
|
|
228
|
-
// })
|
|
229
|
-
// }
|
|
230
145
|
|
|
231
|
-
// if (config.security.firewall?.useKnownBadInputsRuleSet) {
|
|
232
|
-
// priorities.push(1)
|
|
233
|
-
// rules.push({
|
|
234
|
-
// name: 'KnownBadInputsRule',
|
|
235
|
-
// priority: priorities.length,
|
|
236
|
-
// statement: {
|
|
237
|
-
// managedRuleGroupStatement: {
|
|
238
|
-
// vendorName: 'AWS',
|
|
239
|
-
// name: 'AWSManagedRulesKnownBadInputsRuleSet',
|
|
240
|
-
// },
|
|
241
|
-
// },
|
|
242
|
-
// action: {
|
|
243
|
-
// block: {},
|
|
244
|
-
// },
|
|
245
|
-
// visibilityConfig: {
|
|
246
|
-
// sampledRequestsEnabled: true,
|
|
247
|
-
// cloudWatchMetricsEnabled: true,
|
|
248
|
-
// metricName: 'KnownBadInputsRule',
|
|
249
|
-
// },
|
|
250
|
-
// })
|
|
251
|
-
// }
|
|
252
|
-
// also add
|
|
253
|
-
// }, {
|
|
254
|
-
// "name": "AWSManagedRulesAnonymousIpList",
|
|
255
|
-
// "priority": 40,
|
|
256
|
-
// "overrideAction": "none",
|
|
257
|
-
// "excludedRules": []
|
|
258
|
-
// }, {
|
|
259
|
-
// "name": "AWSManagedRulesLinuxRuleSet",
|
|
260
|
-
// "priority": 50,
|
|
261
|
-
// "overrideAction": "none",
|
|
262
|
-
// "excludedRules": []
|
|
263
|
-
// }, {
|
|
264
|
-
// "name": "AWSManagedRulesUnixRuleSet",
|
|
265
|
-
// "priority": 60,
|
|
266
|
-
// "overrideAction": "none",
|
|
267
|
-
// "excludedRules": [],
|
|
268
|
-
// }];
|
|
269
146
|
|
|
270
147
|
return rules
|
|
271
148
|
}
|
|
272
|
-
}
|
|
149
|
+
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { path as p } from '@stacksjs/path'
|
|
6
|
-
import { hasFiles } from '@stacksjs/storage'
|
|
7
|
-
import { aws_backup as backup, aws_iam as iam, RemovalPolicy, aws_s3 as s3, Tags } from 'aws-cdk-lib'
|
|
8
|
-
|
|
9
|
-
export interface StorageStackProps extends NestedCloudProps {
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare interface StorageStackProps extends NestedCloudProps {
|
|
10
5
|
kmsKey: kms.Key
|
|
11
6
|
originAccessIdentity: cloudfront.OriginAccessIdentity
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
export class StorageStack {
|
|
8
|
+
export declare class StorageStack {
|
|
15
9
|
publicBucket: s3.Bucket
|
|
16
10
|
privateBucket: s3.Bucket
|
|
17
11
|
docsBucket?: s3.Bucket
|
|
@@ -74,8 +68,7 @@ export class StorageStack {
|
|
|
74
68
|
|
|
75
69
|
this.logBucket = new s3.Bucket(scope, 'LogsBucket', {
|
|
76
70
|
bucketName: `${this.bucketPrefix}-logs-${props.timestamp}`,
|
|
77
|
-
removalPolicy: RemovalPolicy.RETAIN,
|
|
78
|
-
// autoDeleteObjects: true,
|
|
71
|
+
removalPolicy: RemovalPolicy.RETAIN,
|
|
79
72
|
blockPublicAccess: new s3.BlockPublicAccess({
|
|
80
73
|
blockPublicAcls: false,
|
|
81
74
|
ignorePublicAcls: true,
|
|
@@ -89,7 +82,6 @@ export class StorageStack {
|
|
|
89
82
|
|
|
90
83
|
this.backupRole = this.createBackupRole(scope)
|
|
91
84
|
|
|
92
|
-
// Daily 35 day retention
|
|
93
85
|
this.vault = new backup.BackupVault(scope, 'BackupVault', {
|
|
94
86
|
backupVaultName: `${props.slug}-${props.appEnv}-daily-backup-vault`,
|
|
95
87
|
encryptionKey: props.kmsKey,
|
|
@@ -194,4 +186,4 @@ export class StorageStack {
|
|
|
194
186
|
shouldDeployDocs(): boolean {
|
|
195
187
|
return (hasFiles(p.projectPath('docs')) || config.app.docMode) ?? false
|
|
196
188
|
}
|
|
197
|
-
}
|
|
189
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import type { AppEnvType } from
|
|
2
|
-
import type { StackProps } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface NestedCloudProps {
|
|
16
|
-
name: string;
|
|
17
|
-
env: {
|
|
18
|
-
account: string;
|
|
19
|
-
region: string;
|
|
20
|
-
};
|
|
21
|
-
slug: string;
|
|
22
|
-
appEnv: AppEnvType;
|
|
23
|
-
appName: string;
|
|
24
|
-
domain: string;
|
|
25
|
-
timestamp: string;
|
|
1
|
+
import type { AppEnvType } from '@stacksjs/types';
|
|
2
|
+
import type { StackProps } from 'aws-cdk-lib';
|
|
3
|
+
|
|
4
|
+
export declare interface CloudOptions extends StackProps {
|
|
5
|
+
name: string
|
|
6
|
+
env: {
|
|
7
|
+
account: string
|
|
8
|
+
region: string
|
|
9
|
+
}
|
|
10
|
+
slug: string
|
|
11
|
+
appEnv: AppEnvType
|
|
12
|
+
appName: string
|
|
13
|
+
domain: string
|
|
14
|
+
timestamp: string
|
|
26
15
|
}
|
|
16
|
+
export declare interface NestedCloudProps {
|
|
17
|
+
name: string
|
|
18
|
+
env: {
|
|
19
|
+
account: string
|
|
20
|
+
region: string
|
|
21
|
+
}
|
|
22
|
+
slug: string
|
|
23
|
+
appEnv: AppEnvType
|
|
24
|
+
appName: string
|
|
25
|
+
domain: string
|
|
26
|
+
timestamp: string
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cloud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.68.0",
|
|
5
5
|
"description": "The Stacks cloud/serverless integration & implementation.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -26,18 +26,16 @@
|
|
|
26
26
|
],
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"bun": "./src/index.ts",
|
|
30
29
|
"types": "./dist/index.d.ts",
|
|
31
30
|
"import": "./dist/index.js"
|
|
32
31
|
},
|
|
33
32
|
"./*": {
|
|
34
|
-
"bun": "./src/*",
|
|
35
33
|
"import": "./dist/*"
|
|
36
34
|
}
|
|
37
35
|
},
|
|
38
36
|
"module": "dist/index.js",
|
|
39
37
|
"types": "dist/index.d.ts",
|
|
40
|
-
"files": ["README.md", "dist"
|
|
38
|
+
"files": ["README.md", "dist"],
|
|
41
39
|
"scripts": {
|
|
42
40
|
"bootstrap": "bunx --bun cdk bootstrap",
|
|
43
41
|
"deploy": "cd ../.. && bun run build && cd ../docs && bun run build && cd ../core/cloud && bunx --bun cdk deploy --require-approval never",
|
|
@@ -47,37 +45,37 @@
|
|
|
47
45
|
"prepublishOnly": "bun run build"
|
|
48
46
|
},
|
|
49
47
|
"dependencies": {
|
|
50
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
51
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
52
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
53
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
54
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
55
|
-
"@aws-sdk/client-ec2": "^3.
|
|
56
|
-
"@aws-sdk/client-efs": "^3.
|
|
57
|
-
"@aws-sdk/client-iam": "^3.
|
|
58
|
-
"@aws-sdk/client-lambda": "^3.
|
|
59
|
-
"@aws-sdk/client-route-53-domains": "^3.
|
|
60
|
-
"@aws-sdk/client-s3": "^3.
|
|
61
|
-
"@aws-sdk/client-ses": "^3.
|
|
62
|
-
"@aws-sdk/client-sesv2": "^3.
|
|
63
|
-
"@aws-sdk/client-ssm": "^3.
|
|
64
|
-
"@stacksjs/config": "0.
|
|
65
|
-
"@stacksjs/dns": "0.
|
|
66
|
-
"@stacksjs/logging": "0.
|
|
67
|
-
"@stacksjs/path": "0.
|
|
68
|
-
"@stacksjs/router": "0.
|
|
69
|
-
"@stacksjs/storage": "0.
|
|
70
|
-
"@stacksjs/utils": "0.
|
|
71
|
-
"@stacksjs/validation": "0.
|
|
72
|
-
"aws-cdk": "^2.
|
|
73
|
-
"aws-cdk-lib": "^2.
|
|
48
|
+
"@aws-sdk/client-bedrock": "^3.679.0",
|
|
49
|
+
"@aws-sdk/client-cloudformation": "^3.679.0",
|
|
50
|
+
"@aws-sdk/client-cloudfront": "^3.679.0",
|
|
51
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.680.0",
|
|
52
|
+
"@aws-sdk/client-dynamodb": "3.679.0",
|
|
53
|
+
"@aws-sdk/client-ec2": "^3.679.0",
|
|
54
|
+
"@aws-sdk/client-efs": "^3.679.0",
|
|
55
|
+
"@aws-sdk/client-iam": "^3.679.0",
|
|
56
|
+
"@aws-sdk/client-lambda": "^3.680.0",
|
|
57
|
+
"@aws-sdk/client-route-53-domains": "^3.679.0",
|
|
58
|
+
"@aws-sdk/client-s3": "^3.679.0",
|
|
59
|
+
"@aws-sdk/client-ses": "^3.679.0",
|
|
60
|
+
"@aws-sdk/client-sesv2": "^3.679.0",
|
|
61
|
+
"@aws-sdk/client-ssm": "^3.679.0",
|
|
62
|
+
"@stacksjs/config": "0.67.0",
|
|
63
|
+
"@stacksjs/dns": "0.67.0",
|
|
64
|
+
"@stacksjs/logging": "0.67.0",
|
|
65
|
+
"@stacksjs/path": "0.67.0",
|
|
66
|
+
"@stacksjs/router": "0.67.0",
|
|
67
|
+
"@stacksjs/storage": "0.67.0",
|
|
68
|
+
"@stacksjs/utils": "0.67.0",
|
|
69
|
+
"@stacksjs/validation": "0.67.0",
|
|
70
|
+
"aws-cdk": "^2.164.1",
|
|
71
|
+
"aws-cdk-lib": "^2.164.1",
|
|
74
72
|
"aws4fetch": "^1.0.20",
|
|
75
|
-
"constructs": "^10.
|
|
73
|
+
"constructs": "^10.4.2"
|
|
76
74
|
},
|
|
77
75
|
"devDependencies": {
|
|
78
|
-
"@stacksjs/cli": "0.
|
|
79
|
-
"@stacksjs/development": "0.
|
|
80
|
-
"@stacksjs/env": "0.
|
|
76
|
+
"@stacksjs/cli": "0.67.0",
|
|
77
|
+
"@stacksjs/development": "0.67.0",
|
|
78
|
+
"@stacksjs/env": "0.67.0",
|
|
81
79
|
"source-map-support": "^0.5.21"
|
|
82
80
|
}
|
|
83
81
|
}
|
package/dist/cloud/ai.d.ts
DELETED
package/dist/cloud/cache.d.ts
DELETED
|
File without changes
|