Skip to content

Commit e098c68

Browse files
authored
refactor: move lwm2m ingest to backend (#28)
Because also the OOB devices will send LwM2M Fixes #74 Fixes #73 Fixes #72 Fixes #70 Fixes #69 Fixes #66 Fixes #43 Fixes #42 Fixes #31 Fixes #30 BREAKING CHANGE: this removes the API endpoints for device data
1 parent 3555839 commit e098c68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+10274
-8746
lines changed

aws/acm.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import {
2-
ACMClient,
3-
CertificateStatus,
4-
ListCertificatesCommand,
5-
} from '@aws-sdk/client-acm'
1+
import type { ACMClient } from '@aws-sdk/client-acm'
2+
import { CertificateStatus, ListCertificatesCommand } from '@aws-sdk/client-acm'
63
import chalk from 'chalk'
74

85
export type DomainCert = {

aws/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts'
1+
import type { STSClient } from '@aws-sdk/client-sts'
2+
import { GetCallerIdentityCommand } from '@aws-sdk/client-sts'
23
import type { Environment } from 'aws-cdk-lib'
34

45
export const env = async ({

cdk/BackendStack.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import type { App } from 'aws-cdk-lib'
12
import {
2-
App,
33
CfnOutput,
44
aws_lambda as Lambda,
55
Stack,
@@ -8,15 +8,11 @@ import {
88
import type { BackendLambdas } from './packBackendLambdas.js'
99
import type { PackedLayer } from '@bifravst/aws-cdk-lambda-helpers/layer'
1010
import { LambdaSource } from '@bifravst/aws-cdk-lambda-helpers/cdk'
11-
import { ConnectionInformationGeoLocation } from './resources/ConnectionInformationGeoLocation.js'
12-
import { LwM2MShadow } from './resources/LwM2MShadow.js'
1311
import { PublicDevices } from './resources/PublicDevices.js'
1412
import { ShareAPI } from './resources/ShareAPI.js'
1513
import { STACK_NAME } from './stackConfig.js'
1614
import { DevicesAPI } from './resources/DevicesAPI.js'
17-
import { LwM2MObjectsHistory } from './resources/LwM2MObjectsHistory.js'
1815
import { CustomDevicesAPI } from './resources/CustomDevicesAPI.js'
19-
import { SenMLMessages } from './resources/SenMLMessage.js'
2016
import { ContainerRepositoryId } from '../aws/ecr.js'
2117
import { repositoryName } from '@bifravst/aws-cdk-ecr-helpers/repository'
2218
import { ContinuousDeployment } from '@bifravst/ci'
@@ -107,24 +103,6 @@ export class BackendStack extends Stack {
107103
})
108104
}
109105

110-
new LwM2MShadow(this, {
111-
baseLayer,
112-
lambdaSources,
113-
publicDevices,
114-
})
115-
116-
const senMLMessages = new SenMLMessages(this, {
117-
baseLayer,
118-
lambdaSources,
119-
publicDevices,
120-
})
121-
api.addRoute('GET /device/{id}/senml-imports', senMLMessages.importLogsFn)
122-
123-
new ConnectionInformationGeoLocation(this, {
124-
baseLayer,
125-
lambdaSources,
126-
})
127-
128106
const shareAPI = new ShareAPI(this, {
129107
domain,
130108
baseLayer,
@@ -143,12 +121,6 @@ export class BackendStack extends Stack {
143121
})
144122
api.addRoute('GET /devices', devicesAPI.devicesFn)
145123

146-
const lwm2mObjectHistory = new LwM2MObjectsHistory(this, {
147-
baseLayer,
148-
lambdaSources,
149-
})
150-
api.addRoute('GET /history', lwm2mObjectHistory.historyFn)
151-
152124
const customDevicesAPI = new CustomDevicesAPI(this, {
153125
baseLayer,
154126
lambdaSources,

cdk/baseLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
packLayer,
33
type PackedLayer,
44
} from '@bifravst/aws-cdk-lambda-helpers/layer'
5-
import pJson from '../package.json'
5+
import type pJson from '../package.json'
66

77
const dependencies: Array<keyof (typeof pJson)['dependencies']> = [
88
'@nordicsemiconductor/from-env',

cdk/packBackendLambdas.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,25 @@ import { packLambdaFromPath } from '@bifravst/aws-cdk-lambda-helpers'
22
import type { PackedLambda } from '@bifravst/aws-cdk-lambda-helpers'
33

44
export type BackendLambdas = {
5-
updatesToLwM2M: PackedLambda
65
shareDevice: PackedLambda
76
sharingStatus: PackedLambda
87
sharingStatusFingerprint: PackedLambda
98
confirmOwnership: PackedLambda
10-
connectionInformationGeoLocation: PackedLambda
119
devicesData: PackedLambda
12-
storeObjectsInTimestream: PackedLambda
13-
queryHistory: PackedLambda
1410
createCredentials: PackedLambda
1511
openSSL: PackedLambda
16-
senMLToLwM2M: PackedLambda
17-
senMLImportLogs: PackedLambda
1812
apiHealthCheck: PackedLambda
1913
}
2014

2115
const pack = async (id: string) => packLambdaFromPath(id, `lambda/${id}.ts`)
2216

2317
export const packBackendLambdas = async (): Promise<BackendLambdas> => ({
24-
updatesToLwM2M: await pack('updatesToLwM2M'),
2518
shareDevice: await pack('shareDevice'),
2619
sharingStatus: await pack('sharingStatus'),
2720
sharingStatusFingerprint: await pack('sharingStatusFingerprint'),
2821
confirmOwnership: await pack('confirmOwnership'),
29-
connectionInformationGeoLocation: await pack(
30-
'connectionInformationGeoLocation',
31-
),
3222
devicesData: await pack('devicesData'),
33-
storeObjectsInTimestream: await pack('storeObjectsInTimestream'),
34-
queryHistory: await pack('queryHistory'),
3523
createCredentials: await pack('createCredentials'),
3624
openSSL: await pack('openSSL'),
37-
senMLToLwM2M: await pack('senMLToLwM2M'),
38-
senMLImportLogs: await pack('senMLImportLogs'),
3925
apiHealthCheck: await pack('apiHealthCheck'),
4026
})

cdk/resources/ConnectionInformationGeoLocation.ts

Lines changed: 0 additions & 111 deletions
This file was deleted.

cdk/resources/CustomDevicesAPI.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { LambdaLogGroup } from '@bifravst/aws-cdk-lambda-helpers/cdk'
22
import { Permissions as SettingsPermissions } from '@bifravst/aws-ssm-settings-helpers/cdk'
3-
import {
4-
Duration,
5-
aws_ecr as ECR,
6-
aws_lambda as Lambda,
7-
Stack,
8-
} from 'aws-cdk-lib'
3+
import type { aws_ecr as ECR } from 'aws-cdk-lib'
4+
import { Duration, aws_lambda as Lambda, Stack } from 'aws-cdk-lib'
95
import { Construct } from 'constructs'
106
import type { BackendLambdas } from '../packBackendLambdas.js'
117
import { STACK_NAME } from '../stackConfig.js'

0 commit comments

Comments
 (0)