Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
MICROSOFT_API_KEY = secret
MICROSOFT_TENANT_ID = secret
MICROSOFT_CLIENT_ID = secret

AWS_ACCESS_KEY_ID = secret
AWS_SECRET_ACCESS_KEY = secret

AUTH_HEADER = secret
URL_ORIGIN = lara.exampleCompany
DEBUG = true
Expand All @@ -26,3 +29,4 @@ ALEXA_AMAZON_CLIENT_ID = secret
ALEXA_AMAZON_CLIENT_SECRET = secret

LARA_SECRET = secret
STAGE = dev
8 changes: 4 additions & 4 deletions .github/workflows/reusable-build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
.yarn
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-in-${{ github.ref_name }}
##############
# Set BACKEND_URL env varibale this way, so not all variables have to be passed to the reusable workflow
##############
# Set BACKEND_URL env varibale this way, so not all variables have to be passed to the reusable workflow
- name: Set production BE Url
if: env.ENVIRONMENT_NAME == 'production'
run: |
Expand All @@ -67,7 +67,7 @@ jobs:
run: |
echo "MICROSOFT_CLIENT_ID=${{ secrets.STAGING_MICROSOFT_CLIENT_ID }}" >> $GITHUB_ENV

##############
##############
- name: Compile and build
run: yarn clean && yarn compile && yarn build
- name: Upload dist and lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-deploy-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'

- uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-install-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/reusable-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -23,15 +23,15 @@ jobs:
.yarn
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-in-${{ github.ref_name }}
- run: yarn lint:verify

format:
name: format-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -57,15 +57,15 @@ jobs:
.yarn
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-in-${{ github.ref_name }}
- run: yarn sort-package-jsons:verify

test:
name: test-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.17.4
v18
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
}
},
"resolutions": {
"**/@types/node": "^15.0.1",
"**/@types/node": "^18.8.0",
"@types/react": "^17.0.4"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@types/node": "^15.0.1",
"@types/node": "^18.8.1",
"@types/webpack-env": "^1.15.3",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
Expand All @@ -64,6 +64,6 @@
"serverless-s3-local": "^0.6.22",
"serverless-s3-sync": "3.1.0",
"sort-package-json": "^1.46.0",
"typescript": "^4.3.2"
"typescript": "^5.2.2"
}
}
4 changes: 2 additions & 2 deletions packages/alexa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"ask-sdk-core": "^2.11.0",
"ask-sdk-express-adapter": "^2.12.1",
"ask-sdk-model": "^1.36.1",
"aws-sdk": "^2.950.0",
"date-fns": "^2.28.0",
"graphql": "^16.6.0",
"graphql-request": "^5.0.0",
"iso8601-duration": "^1.3.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.76",
"aws-sdk": "^2.950.0"
"@types/aws-lambda": "^8.10.76"
}
}
3 changes: 2 additions & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@graphql-tools/schema": "^8.2.0",
"@lara/api": "^1.0.0",
"apollo-server-lambda": "^3.3.0",
"aws-sdk": "^2.950.0",
"casual": "^1.6.2",
"cors": "^2.8.5",
"date-fns": "^2.22.1",
Expand All @@ -35,10 +36,10 @@
"@types/cookie": "^0.4.1",
"@types/i18n": "^0.13.0",
"@types/jest": "^29.1.2",
"@types/jsonwebtoken": "^9.0.3",
"@types/node-fetch": "^2.5.10",
"@types/object-hash": "^2.2.1",
"@types/uuid": "^8.3.0",
"aws-sdk": "^2.950.0",
"jest": "^29.2.0",
"ts-jest": "^29.0.3"
}
Expand Down
20 changes: 10 additions & 10 deletions packages/backend/src/db/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@ const queryItems = async <T>(
* @param filterOptions Keys and values to filter after the query
* @returns Items from the DDB
*/
export const queryObjects = <O>(
tablename: string,
export const queryObjects = <T>(
tableName: string,
index: string,
keyOptions: Partial<O>,
filterOptions: Partial<O> = {}
): Promise<O[]> => {
const keyConditionKeys = Object.keys(keyOptions) as Keys<Partial<O>>
keyOptions: Partial<T>,
filterOptions: Partial<T> = {}
): Promise<T[]> => {
const keyConditionKeys = Object.keys(keyOptions) as Keys<Partial<T>>

// DDB key/index condition structs
const keyConditionValues = createExpressionAttributeValues(keyOptions, keyConditionKeys)
const keyConditionValues = createExpressionAttributeValues(keyOptions as T, keyConditionKeys)
const keyConditionNames = createExpressionAttributeNames(keyConditionKeys)
const keyConditionExpression = createKeyConditionExpression(keyConditionKeys)

const filterConditionKeys = Object.keys(filterOptions) as Keys<Partial<O>>
const filterConditionKeys = Object.keys(filterOptions) as Keys<Partial<T>>

// DDB filter structs that run after the key condition
const filterConditionValues = createExpressionAttributeValues(filterOptions, filterConditionKeys)
const filterConditionValues = createExpressionAttributeValues(filterOptions as T, filterConditionKeys)
const filterConditionNames = createExpressionAttributeNames(filterConditionKeys)
const filterConditionExpression = createKeyConditionExpression(filterConditionKeys) || undefined

return queryItems(tablename, {
return queryItems(tableName, {
IndexName: index,
ExpressionAttributeValues: { ...keyConditionValues, ...filterConditionValues },
ExpressionAttributeNames: { ...keyConditionNames, ...filterConditionNames },
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/services/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const translations = (user: User): EmailTranslations =>
const envLink = (path: string) => {
const envDomain = STAGE === 'staging' ? 'staging.' : ''

return `https://${envDomain}${URL_ORIGIN}.com${path}`
return `https://${envDomain}${URL_ORIGIN}${path}`
}

const trainerNotificationMailPayload = (receiver: Trainer, sender: Trainee, report: Report): EmailPayload => ({
Expand Down
4 changes: 1 addition & 3 deletions packages/cleanup/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ const query = gql`
`

export const handler: CloudWatchLogsHandler = async () => {
const res = await client.request(query)

return res
return await client.request(query)
}
4 changes: 2 additions & 2 deletions packages/email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"@lara/api": "^1.0.0",
"aws-sdk": "^2.938.0",
"handlebars": "^4.7.7",
"mjml": "^4.11.0",
"nodemailer": "^6.6.3"
},
"devDependencies": {
"@types/mjml": "^4.7.0",
"@types/nodemailer": "^6.4.2",
"aws-sdk": "^2.938.0"
"@types/nodemailer": "^6.4.2"
}
}
13 changes: 6 additions & 7 deletions packages/print/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
"dependencies": {
"@lara/api": "^1.0.0",
"@lara/components": "^1.0.0",
"adm-zip": "^0.5.5",
"chrome-aws-lambda": "^10.1.0",
"puppeteer-core": "^10.1.0",
"@sparticuz/chromium": "^117.0.0",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.950.0",
"puppeteer-core": "^21.3.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"styled-components": "^5.3.0"
},
"devDependencies": {
"@types/adm-zip": "^0.4.34",
"@types/aws-lambda": "^8.10.76",
"aws-sdk": "^2.950.0",
"puppeteer": "^10.1.0"
"@types/adm-zip": "^0.5.2",
"@types/aws-lambda": "^8.10.122"
}
}
10 changes: 5 additions & 5 deletions packages/print/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Lambda } from 'aws-sdk'
import AdmZip from 'adm-zip'
import { Handler } from 'aws-lambda'
import chromium from 'chrome-aws-lambda'
import { Browser, Page } from 'puppeteer-core'
import chromium from '@sparticuz/chromium'
import { launch, Browser, Page } from 'puppeteer-core'

import { EmailPayload, PrintData, PrintPayload } from '@lara/api'

Expand Down Expand Up @@ -51,10 +51,10 @@ export const handler: Handler<PrintPayload, 'success' | 'error'> = async (payloa
const { reportsData, userData, printTranslations, emailTranslations } = exportData

try {
browser = await chromium.puppeteer.launch({
browser = await launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
executablePath: await chromium.executablePath(),
headless: IS_OFFLINE ? true : chromium.headless,
ignoreHTTPSErrors: true,
})
Expand All @@ -78,7 +78,7 @@ export const handler: Handler<PrintPayload, 'success' | 'error'> = async (payloa
}

if (!outputFile) {
throw new Error('"generatedReport" is undefind')
throw new Error('"generatedReport" is undefined')
}

await saveAttachments(filename, outputFile)
Expand Down
Loading