Skip to content

Commit 74a483c

Browse files
authored
Merge branch 'main' into dsingh14/linkry
2 parents ae80735 + 2a566c6 commit 74a483c

32 files changed

+557
-645
lines changed

.github/workflows/deploy-dev.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Node
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: 20.x
20+
node-version: 22.x
2121
- uses: actions/checkout@v4
2222
env:
2323
HUSKY: "0"
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up Node for testing
4242
uses: actions/setup-node@v4
4343
with:
44-
node-version: 20.x
44+
node-version: 22.x
4545
- uses: actions/checkout@v4
4646
env:
4747
HUSKY: "0"
@@ -85,7 +85,7 @@ jobs:
8585
- name: Set up Node
8686
uses: actions/setup-node@v4
8787
with:
88-
node-version: 20.x
88+
node-version: 22.x
8989
- uses: actions/checkout@v4
9090
env:
9191
HUSKY: "0"

.github/workflows/deploy-prod.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Node
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20.x
17+
node-version: 22.x
1818
- uses: actions/checkout@v4
1919
env:
2020
HUSKY: "0"
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Node for testing
3838
uses: actions/setup-node@v4
3939
with:
40-
node-version: 20.x
40+
node-version: 22.x
4141
- uses: actions/checkout@v4
4242
env:
4343
HUSKY: "0"
@@ -80,7 +80,7 @@ jobs:
8080
- name: Set up Node
8181
uses: actions/setup-node@v4
8282
with:
83-
node-version: 20.x
83+
node-version: 22.x
8484
- uses: actions/checkout@v4
8585
env:
8686
HUSKY: "0"
@@ -109,7 +109,7 @@ jobs:
109109
- name: Set up Node for testing
110110
uses: actions/setup-node@v4
111111
with:
112-
node-version: 20.x
112+
node-version: 22.x
113113
- uses: actions/checkout@v4
114114
env:
115115
HUSKY: "0"
@@ -152,7 +152,7 @@ jobs:
152152
- name: Set up Node for testing
153153
uses: actions/setup-node@v4
154154
with:
155-
node-version: 20.x
155+
node-version: 22.x
156156
- uses: actions/checkout@v4
157157
env:
158158
HUSKY: "0"

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ deploy_dev: check_account_dev build
6666

6767
install:
6868
yarn -D
69+
pip install cfn-lint
6970

7071
test_live_integration: install
7172
yarn test:live
7273

7374
test_unit: install
7475
yarn typecheck
7576
yarn lint
77+
cfn-lint cloudformation/**/* --ignore-templates cloudformation/phony-swagger.yml
7678
yarn prettier
7779
yarn test:unit
7880

cloudformation/main.yml

+51-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Parameters:
2525

2626
Conditions:
2727
IsProd: !Equals [!Ref RunEnvironment, 'prod']
28-
IsDev: !Equals [!Ref RunEnvironment, 'dev']
2928
ShouldAttachVpc:
3029
!Equals [true, !Ref VpcRequired]
3130

@@ -34,7 +33,7 @@ Mappings:
3433
dev:
3534
LogRetentionDays: 7
3635
prod:
37-
LogRetentionDays: 30
36+
LogRetentionDays: 365
3837
ApiGwConfig:
3938
dev:
4039
ApiCertificateArn: arn:aws:acm:us-east-1:427040638965:certificate/63ccdf0b-d2b5-44f0-b589-eceffb935c23
@@ -121,13 +120,34 @@ Resources:
121120
Type: AWS::Serverless::Function
122121
DependsOn:
123122
- AppLogGroups
123+
Metadata:
124+
BuildMethod: esbuild
125+
BuildProperties:
126+
Format: esm
127+
Minify: true
128+
OutExtension:
129+
- .js=.mjs
130+
Target: "es2022"
131+
Sourcemap: false
132+
EntryPoints:
133+
- api/lambda.js
134+
External:
135+
- aws-sdk
136+
Banner:
137+
- js=import path from 'path';
138+
import { fileURLToPath } from 'url';
139+
import { createRequire as topLevelCreateRequire } from 'module';
140+
const require = topLevelCreateRequire(import.meta.url);
141+
const __filename = fileURLToPath(import.meta.url);
142+
const __dirname = path.dirname(__filename);
124143
Properties:
144+
Architectures: [arm64]
125145
CodeUri: ../dist
126146
AutoPublishAlias: live
127-
Runtime: nodejs20.x
147+
Runtime: nodejs22.x
128148
Description: !Sub "${ApplicationFriendlyName} API Lambda"
129149
FunctionName: !Sub ${ApplicationPrefix}-lambda
130-
Handler: api/lambda.handler
150+
Handler: lambda.handler
131151
MemorySize: 512
132152
Role: !GetAtt AppSecurityRoles.Outputs.MainFunctionRoleArn
133153
Timeout: 60
@@ -149,6 +169,7 @@ Resources:
149169
IamGroupRolesTable:
150170
Type: 'AWS::DynamoDB::Table'
151171
DeletionPolicy: "Retain"
172+
UpdateReplacePolicy: "Retain"
152173
Properties:
153174
BillingMode: 'PAY_PER_REQUEST'
154175
TableName: infra-core-api-iam-grouproles
@@ -165,6 +186,7 @@ Resources:
165186
IamUserRolesTable:
166187
Type: 'AWS::DynamoDB::Table'
167188
DeletionPolicy: "Retain"
189+
UpdateReplacePolicy: "Retain"
168190
Properties:
169191
BillingMode: 'PAY_PER_REQUEST'
170192
TableName: infra-core-api-iam-userroles
@@ -181,6 +203,7 @@ Resources:
181203
EventRecordsTable:
182204
Type: 'AWS::DynamoDB::Table'
183205
DeletionPolicy: "Retain"
206+
UpdateReplacePolicy: "Retain"
184207
Properties:
185208
BillingMode: 'PAY_PER_REQUEST'
186209
TableName: infra-core-api-events
@@ -234,6 +257,7 @@ Resources:
234257
CacheRecordsTable:
235258
Type: 'AWS::DynamoDB::Table'
236259
DeletionPolicy: "Retain"
260+
UpdateReplacePolicy: "Retain"
237261
Properties:
238262
BillingMode: 'PAY_PER_REQUEST'
239263
TableName: infra-core-api-cache
@@ -317,14 +341,33 @@ Resources:
317341
Condition: IsProd
318342
Properties:
319343
AlarmName: !Sub ${ApplicationPrefix}-gateway-latency-high
320-
AlarmDescription: !Sub 'Alarm if ${ApplicationPrefix} API gateway latency is > 3s.'
344+
AlarmDescription: 'Average API gateway latency is > 1.25s for 2 minutes.'
321345
Namespace: 'AWS/ApiGateway'
322346
MetricName: 'Latency'
323347
Statistic: 'Average'
324-
Period: '60'
348+
Period: '120'
325349
EvaluationPeriods: '1'
326350
ComparisonOperator: 'GreaterThanThreshold'
327-
Threshold: '3000'
351+
Threshold: '1250'
352+
AlarmActions:
353+
- !Ref AlertSNSArn
354+
Dimensions:
355+
- Name: 'ApiName'
356+
Value: !Sub ${ApplicationPrefix}-gateway
357+
358+
AppApiGatewayNoRequestsAlarm:
359+
Type: 'AWS::CloudWatch::Alarm'
360+
Condition: IsProd
361+
Properties:
362+
AlarmName: !Sub ${ApplicationPrefix}-gateway-no-requests
363+
AlarmDescription: 'No requests have been received in the past 5 minutes.'
364+
Namespace: 'AWS/ApiGateway'
365+
MetricName: 'Count'
366+
Statistic: 'Sum'
367+
Period: '300'
368+
EvaluationPeriods: '1'
369+
ComparisonOperator: 'LessThanThreshold'
370+
Threshold: '1'
328371
AlarmActions:
329372
- !Ref AlertSNSArn
330373
Dimensions:
@@ -336,7 +379,7 @@ Resources:
336379
Condition: IsProd
337380
Properties:
338381
AlarmName: !Sub ${ApplicationPrefix}-gateway-5xx
339-
AlarmDescription: !Sub 'Alarm if ${ApplicationPrefix} API gateway 5XX errors are detected.'
382+
AlarmDescription: 'More than 2 API gateway 5XX errors were detected.'
340383
Namespace: 'AWS/ApiGateway'
341384
MetricName: '5XXError'
342385
Statistic: 'Average'

package.json

+6-29
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,25 @@
1111
"scripts": {
1212
"build": "yarn workspaces run build && yarn lockfile-manage",
1313
"dev": "concurrently --names 'api,ui' 'yarn workspace infra-core-api run dev' 'yarn workspace infra-core-ui run dev'",
14-
"lockfile-manage": "synp --with-workspace --source-file yarn.lock && cp package-lock.json dist/ && cp package.json dist/ && rm package-lock.json",
14+
"lockfile-manage": "synp --with-workspace --source-file yarn.lock && cp package-lock.json dist/ && cp src/api/package.json dist/ && rm package-lock.json",
1515
"prettier": "yarn workspaces run prettier && prettier --check tests/**/*.ts",
1616
"prettier:write": "yarn workspaces run prettier:write && prettier --write tests/**/*.ts",
1717
"lint": "yarn workspaces run lint",
1818
"prepare": "node .husky/install.mjs || true",
1919
"typecheck": "yarn workspaces run typecheck",
20-
"test:unit": "vitest run tests/unit && yarn workspace infra-core-ui run test:unit",
20+
"test:unit": "vitest run tests/unit --config tests/unit/vitest.config.ts && yarn workspace infra-core-ui run test:unit",
2121
"test:unit-ui": "yarn test:unit --ui",
2222
"test:unit-watch": "vitest tests/unit",
2323
"test:live": "vitest tests/live",
2424
"test:live-ui": "yarn test:live --ui",
2525
"test:e2e": "playwright test",
2626
"test:e2e-ui": "playwright test --ui"
2727
},
28-
"dependencies": {
29-
"@aws-sdk/client-dynamodb": "^3.624.0",
30-
"@aws-sdk/client-secrets-manager": "^3.624.0",
31-
"@aws-sdk/util-dynamodb": "^3.624.0",
32-
"@azure/msal-node": "^2.16.1",
33-
"@fastify/auth": "^5.0.1",
34-
"@fastify/aws-lambda": "^5.0.0",
35-
"@fastify/caching": "^9.0.1",
36-
"@fastify/cors": "^10.0.1",
37-
"@touch4it/ical-timezones": "^1.9.0",
38-
"discord.js": "^14.15.3",
39-
"dotenv": "^16.4.5",
40-
"fastify": "^5.1.0",
41-
"fastify-plugin": "^4.5.1",
42-
"ical-generator": "^7.2.0",
43-
"jsonwebtoken": "^9.0.2",
44-
"jwks-rsa": "^3.1.0",
45-
"moment": "^2.30.1",
46-
"moment-timezone": "^0.5.45",
47-
"pluralize": "^8.0.0",
48-
"zod": "^3.23.8",
49-
"zod-to-json-schema": "^3.23.2",
50-
"zod-validation-error": "^3.3.1"
51-
},
28+
"dependencies": {},
5229
"devDependencies": {
5330
"@eslint/compat": "^1.1.1",
5431
"@playwright/test": "^1.49.1",
55-
"@tsconfig/node20": "^20.1.4",
32+
"@tsconfig/node22": "^22.0.0",
5633
"@types/node": "^22.1.0",
5734
"@types/pluralize": "^0.0.33",
5835
"@types/react": "^18.3.3",
@@ -81,7 +58,7 @@
8158
"husky": "^9.1.4",
8259
"identity-obj-proxy": "^3.0.0",
8360
"jsdom": "^24.1.1",
84-
"node-ical": "^0.18.0",
61+
"node-ical": "^0.20.1",
8562
"postcss": "^8.4.41",
8663
"postcss-preset-mantine": "^1.17.0",
8764
"postcss-simple-vars": "^7.0.1",
@@ -105,4 +82,4 @@
10582
"resolutions": {
10683
"pdfjs-dist": "^4.8.69"
10784
}
108-
}
85+
}

0 commit comments

Comments
 (0)