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
5 changes: 3 additions & 2 deletions .github/workflows/test-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ jobs:
- name: Print failed End-to-End tests
if: failure()
run:
cat e2e-test-result.json | npx tsx --no-warnings
./feature-runner/console-reporter.ts --only-failed --with-timestamps
cat e2e-test-result.json | node --experimental-transform-types
--no-warnings ./feature-runner/console-reporter.ts --only-failed
--with-timestamps

- uses: actions/upload-artifact@v4
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "npx tsx --no-warnings cdk/backend.ts"
"app": "node --experimental-transform-types --no-warnings cdk/backend.ts"
}
2 changes: 1 addition & 1 deletion cdk/BackendApp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { App } from 'aws-cdk-lib'
import { BackendStack } from './BackendStack.js'
import { BackendStack } from './BackendStack.ts'

export class BackendApp extends App {
public constructor({
Expand Down
28 changes: 14 additions & 14 deletions cdk/BackendStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import {
aws_lambda as Lambda,
Stack,
} from 'aws-cdk-lib'
import { ContainerRepositoryId } from '../aws/ecr.js'
import type { BackendLambdas } from './packBackendLambdas.js'
import { API } from './resources/api/API.js'
import { ContainerRepositoryId } from '../aws/ecr.ts'
import type { BackendLambdas } from './packBackendLambdas.ts'
import { API } from './resources/api/API.ts'
import {
CustomDomain,
type CustomDomainDetails,
} from './resources/api/CustomDomain.js'
import { ApiHealthCheck } from './resources/api/HealthCheck.js'
import { CreateDeviceAPI } from './resources/DeviceManagementAPI.js'
import { DevicesAPI } from './resources/DevicesAPI.js'
import { EmailConfirmationTokens } from './resources/EmailConfirmationTokens.js'
import { JWKS } from './resources/JWKS.js'
import { Notifications } from './resources/Notifications.js'
import { PublicDevices } from './resources/PublicDevices.js'
import { ShareAPI } from './resources/ShareAPI.js'
import { UserAuthAPI } from './resources/UserAuthAPI.js'
import { STACK_NAME } from './stackConfig.js'
} from './resources/api/CustomDomain.ts'
import { ApiHealthCheck } from './resources/api/HealthCheck.ts'
import { CreateDeviceAPI } from './resources/DeviceManagementAPI.ts'
import { DevicesAPI } from './resources/DevicesAPI.ts'
import { EmailConfirmationTokens } from './resources/EmailConfirmationTokens.ts'
import { JWKS } from './resources/JWKS.ts'
import { Notifications } from './resources/Notifications.ts'
import { PublicDevices } from './resources/PublicDevices.ts'
import { ShareAPI } from './resources/ShareAPI.ts'
import { UserAuthAPI } from './resources/UserAuthAPI.ts'
import { STACK_NAME } from './stackConfig.ts'

/**
* Provides resources for the backend serving data to hello.nrfcloud.com/map
Expand Down
12 changes: 6 additions & 6 deletions cdk/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { ACMClient } from '@aws-sdk/client-acm'
import { IAMClient } from '@aws-sdk/client-iam'
import { ensureGitHubOIDCProvider } from '@bifravst/ci'
import { fromEnv } from '@bifravst/from-env'
import { getCertificateArnForDomain } from '../aws/acm.js'
import { getCertificateArnForDomain } from '../aws/acm.ts'
import pJSON from '../package.json' assert { type: 'json' }
import { BackendApp } from './BackendApp.js'
import { pack as packBaseLayer } from './baseLayer.js'
import { pack as packCDKLayer } from './cdkLayer.js'
import { pack as packJWTLayer } from './jwtLayer.js'
import { packBackendLambdas } from './packBackendLambdas.js'
import { BackendApp } from './BackendApp.ts'
import { pack as packBaseLayer } from './baseLayer.ts'
import { pack as packCDKLayer } from './cdkLayer.ts'
import { pack as packJWTLayer } from './jwtLayer.ts'
import { packBackendLambdas } from './packBackendLambdas.ts'

const repoUrl = new URL(pJSON.repository.url)
const repository = {
Expand Down
6 changes: 3 additions & 3 deletions cdk/resources/DeviceManagementAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
import type { aws_ecr as ECR } from 'aws-cdk-lib'
import { Duration, aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import { STACK_NAME } from '../stackConfig.js'
import type { PublicDevices } from './PublicDevices.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'
import { STACK_NAME } from '../stackConfig.ts'
import type { PublicDevices } from './PublicDevices.ts'

export class CreateDeviceAPI extends Construct {
public readonly createDevice: Lambda.IFunction
Expand Down
4 changes: 2 additions & 2 deletions cdk/resources/DevicesAPI.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PackedLambdaFn } from '@bifravst/aws-cdk-lambda-helpers/cdk'
import { aws_iam as IAM, type aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import type { PublicDevices } from './PublicDevices.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'
import type { PublicDevices } from './PublicDevices.ts'

export class DevicesAPI extends Construct {
public readonly devicesFn: Lambda.IFunction
Expand Down
2 changes: 1 addition & 1 deletion cdk/resources/JWKS.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PackedLambdaFn } from '@bifravst/aws-cdk-lambda-helpers/cdk'
import { type aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'

/**
* Provides the .well-known/jwks.json endpoint
Expand Down
6 changes: 3 additions & 3 deletions cdk/resources/Notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
aws_events as Events,
} from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import type { PublicDevices } from './PublicDevices.js'
import { permissions } from './ses.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'
import type { PublicDevices } from './PublicDevices.ts'
import { permissions } from './ses.ts'

export class Notifications extends Construct {
constructor(
Expand Down
4 changes: 2 additions & 2 deletions cdk/resources/ShareAPI.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PackedLambdaFn } from '@bifravst/aws-cdk-lambda-helpers/cdk'
import { type aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import type { PublicDevices } from './PublicDevices.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'
import type { PublicDevices } from './PublicDevices.ts'

export class ShareAPI extends Construct {
public readonly shareFn: Lambda.IFunction
Expand Down
6 changes: 3 additions & 3 deletions cdk/resources/UserAuthAPI.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PackedLambdaFn } from '@bifravst/aws-cdk-lambda-helpers/cdk'
import { type aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../packBackendLambdas.js'
import type { EmailConfirmationTokens } from './EmailConfirmationTokens.js'
import { permissions } from './ses.js'
import type { BackendLambdas } from '../packBackendLambdas.ts'
import type { EmailConfirmationTokens } from './EmailConfirmationTokens.ts'
import { permissions } from './ses.ts'

export class UserAuthAPI extends Construct {
public readonly requestTokenFn: Lambda.IFunction
Expand Down
2 changes: 1 addition & 1 deletion cdk/resources/api/API.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { aws_lambda as Lambda } from 'aws-cdk-lib'
import { aws_apigatewayv2 as HttpApi, Stack } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import { ApiRoute } from './ApiRoute.js'
import { ApiRoute } from './ApiRoute.ts'

export class API extends Construct {
public readonly api: HttpApi.CfnApi
Expand Down
4 changes: 2 additions & 2 deletions cdk/resources/api/CustomDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
type aws_lambda as Lambda,
} from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../../packBackendLambdas.js'
import type { API } from './API.js'
import type { BackendLambdas } from '../../packBackendLambdas.ts'
import type { API } from './API.ts'

export type CustomDomainDetails = {
domainName: string
Expand Down
2 changes: 1 addition & 1 deletion cdk/resources/api/HealthCheck.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LambdaLogGroup } from '@bifravst/aws-cdk-lambda-helpers/cdk'
import { Duration, aws_lambda as Lambda } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import type { BackendLambdas } from '../../packBackendLambdas.js'
import type { BackendLambdas } from '../../packBackendLambdas.ts'

/**
* API health check
Expand Down
4 changes: 2 additions & 2 deletions cdk/resources/containers/buildOpenSSLLambdaImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import fs from 'node:fs/promises'
import os from 'node:os'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { ContainerRepositoryId } from '../../../aws/ecr.js'
import type { logFn } from '../../../cli/log.js'
import { ContainerRepositoryId } from '../../../aws/ecr.ts'
import type { logFn } from '../../../cli/log.ts'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

Expand Down
2 changes: 1 addition & 1 deletion cli.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

export NODE_NO_WARNINGS=1
node --import tsx ./cli/cli.ts "$@"
node --experimental-transform-types ./cli/cli.ts "$@"
26 changes: 13 additions & 13 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import { STSClient } from '@aws-sdk/client-sts'
import { stackOutput } from '@bifravst/cloudformation-helpers'
import chalk from 'chalk'
import { program } from 'commander'
import { env } from '../aws/env.js'
import type { StackOutputs } from '../cdk/BackendStack.js'
import { STACK_NAME } from '../cdk/stackConfig.js'
import { env } from '../aws/env.ts'
import type { StackOutputs } from '../cdk/BackendStack.ts'
import { STACK_NAME } from '../cdk/stackConfig.ts'
import psjon from '../package.json' assert { type: 'json' }
import type { CommandDefinition } from './commands/CommandDefinition.js'
import { buildContainersCommand } from './commands/build-container.js'
import { configureHelloCommand } from './commands/configure-hello.js'
import { configureNrfCloudAccountCommand } from './commands/configure-nrfcloud-account.js'
import { generateJWTKeypairCommand } from './commands/generate-jwt-keypair.js'
import { listDevicesCommand } from './commands/listDevices.js'
import { logsCommand } from './commands/logs.js'
import { registerDeviceCommand } from './commands/register-device.js'
import { removeDeviceCommand } from './commands/remove-device.js'
import { shareDeviceCommand } from './commands/share-device.js'
import type { CommandDefinition } from './commands/CommandDefinition.ts'
import { buildContainersCommand } from './commands/build-container.ts'
import { configureHelloCommand } from './commands/configure-hello.ts'
import { configureNrfCloudAccountCommand } from './commands/configure-nrfcloud-account.ts'
import { generateJWTKeypairCommand } from './commands/generate-jwt-keypair.ts'
import { listDevicesCommand } from './commands/listDevices.ts'
import { logsCommand } from './commands/logs.ts'
import { registerDeviceCommand } from './commands/register-device.ts'
import { removeDeviceCommand } from './commands/remove-device.ts'
import { shareDeviceCommand } from './commands/share-device.ts'

const ssm = new SSMClient({})
const db = new DynamoDBClient({})
Expand Down
10 changes: 5 additions & 5 deletions cli/commands/build-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {
checkIfImageExists,
} from '@bifravst/aws-cdk-ecr-helpers/image'
import { getOrCreateRepository } from '@bifravst/aws-cdk-ecr-helpers/repository'
import { ContainerRepositoryId } from '../../aws/ecr.js'
import { buildOpenSSLLambdaImage } from '../../cdk/resources/containers/buildOpenSSLLambdaImage.js'
import { STACK_NAME } from '../../cdk/stackConfig.js'
import { debug as debugFn } from '../log.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { ContainerRepositoryId } from '../../aws/ecr.ts'
import { buildOpenSSLLambdaImage } from '../../cdk/resources/containers/buildOpenSSLLambdaImage.ts'
import { STACK_NAME } from '../../cdk/stackConfig.ts'
import { debug as debugFn } from '../log.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

export const buildContainersCommand = ({
ecr,
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/configure-hello.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { SSMClient } from '@aws-sdk/client-ssm'
import chalk from 'chalk'
import { STACK_NAME } from '../../cdk/stackConfig.js'
import { STACK_NAME } from '../../cdk/stackConfig.ts'
import {
deleteSettings,
putSetting,
type Settings,
} from '../../settings/hello.js'
import type { CommandDefinition } from './CommandDefinition.js'
} from '../../settings/hello.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

export const configureHelloCommand = ({
ssm,
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/configure-nrfcloud-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
type Settings,
} from '@hello.nrfcloud.com/nrfcloud-api-helpers/settings'
import chalk from 'chalk'
import { STACK_NAME } from '../../cdk/stackConfig.js'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { STACK_NAME } from '../../cdk/stackConfig.ts'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

export const configureNrfCloudAccountCommand = ({
ssm,
Expand Down
8 changes: 4 additions & 4 deletions cli/commands/generate-jwt-keypair.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SSMClient } from '@aws-sdk/client-ssm'
import chalk from 'chalk'
import { STACK_NAME } from '../../cdk/stackConfig.js'
import { generateJWTKeyPair } from '../../jwt/generateJWTKeyPair.js'
import { deleteSetting, putSetting, type Settings } from '../../settings/jwt.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { STACK_NAME } from '../../cdk/stackConfig.ts'
import { generateJWTKeyPair } from '../../jwt/generateJWTKeyPair.ts'
import { deleteSetting, putSetting, type Settings } from '../../settings/jwt.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

export const generateJWTKeypairCommand = ({
ssm,
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/listDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ScanCommand, type DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { unmarshall } from '@aws-sdk/util-dynamodb'
import chalk from 'chalk'
import { table } from 'table'
import type { CommandDefinition } from './CommandDefinition.js'
import type { CommandDefinition } from './CommandDefinition.ts'

export const listDevicesCommand = ({
db,
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@aws-sdk/client-cloudwatch-logs'
import { listStackResources } from '@bifravst/cloudformation-helpers'
import chalk from 'chalk'
import type { CommandDefinition } from './CommandDefinition.js'
import type { CommandDefinition } from './CommandDefinition.ts'

export const logsCommand = ({
stackName,
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/register-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import chalk from 'chalk'
import { randomUUID } from 'node:crypto'
import fs from 'node:fs/promises'
import path from 'node:path'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.js'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.ts'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

const modelIDs = Object.keys(models)

Expand Down
6 changes: 3 additions & 3 deletions cli/commands/remove-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { SSMClient } from '@aws-sdk/client-ssm'
import { devices as devicesApi } from '@hello.nrfcloud.com/nrfcloud-api-helpers/api'
import { getAPISettings } from '@hello.nrfcloud.com/nrfcloud-api-helpers/settings'
import chalk from 'chalk'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.js'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.ts'
import { NRF_CLOUD_ACCOUNT } from '../../settings/account.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

export const removeDeviceCommand = ({
ssm,
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/share-device.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { models } from '@hello.nrfcloud.com/proto-map/models'
import chalk from 'chalk'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.js'
import type { CommandDefinition } from './CommandDefinition.js'
import { publicDevicesRepo } from '../../devices/publicDevicesRepo.ts'
import type { CommandDefinition } from './CommandDefinition.ts'

const modelIDs = Object.keys(models)

Expand Down
4 changes: 2 additions & 2 deletions devices/getDeviceId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QueryCommand, type DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { unmarshall } from '@aws-sdk/util-dynamodb'
import type { PublicDeviceRecord } from './PublicDeviceRecord.js'
import type { PublicDeviceRecordError } from './PublicDeviceRecordError.js'
import type { PublicDeviceRecord } from './PublicDeviceRecord.ts'
import type { PublicDeviceRecordError } from './PublicDeviceRecordError.ts'

export const getDeviceId =
({
Expand Down
4 changes: 2 additions & 2 deletions devices/getDevicebyDeviceId.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GetItemCommand, type DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
import { models } from '@hello.nrfcloud.com/proto-map/models'
import type { PublicDeviceRecord } from './PublicDeviceRecord.js'
import type { PublicDeviceRecordError } from './PublicDeviceRecordError.js'
import type { PublicDeviceRecord } from './PublicDeviceRecord.ts'
import type { PublicDeviceRecordError } from './PublicDeviceRecordError.ts'

const modelNames = Object.keys(models)

Expand Down
6 changes: 3 additions & 3 deletions devices/listDevicesByEmail.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { QueryCommand, type DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { unmarshall } from '@aws-sdk/util-dynamodb'
import { normalizeEmail } from '../users/normalizeEmail.js'
import { hasItems } from './hasItems.js'
import type { PublicDeviceRecord } from './PublicDeviceRecord.js'
import { normalizeEmail } from '../users/normalizeEmail.ts'
import { hasItems } from './hasItems.ts'
import type { PublicDeviceRecord } from './PublicDeviceRecord.ts'

export const listDevicesByEmail =
({
Expand Down
4 changes: 2 additions & 2 deletions devices/listExpiringDevices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ScanCommand, type DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { unmarshall } from '@aws-sdk/util-dynamodb'
import { hasItems } from './hasItems.js'
import type { PublicDeviceRecord } from './PublicDeviceRecord.js'
import { hasItems } from './hasItems.ts'
import type { PublicDeviceRecord } from './PublicDeviceRecord.ts'

export const listExpiringDevices =
({ db, TableName }: { db: DynamoDBClient; TableName: string }) =>
Expand Down
Loading