Skip to content

Commit

Permalink
Added Chirpstack plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bgelatti committed Oct 14, 2024
1 parent 537c338 commit 39de83e
Show file tree
Hide file tree
Showing 28 changed files with 192 additions and 247 deletions.
130 changes: 123 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
},
"dependencies": {
"@tago-io/sdk": "10.4.4",
"axios": "0.24.0",
"axios": "0.26.0",
"chalk": "5.3.0",
"luxon": "3.5.0",
"nanoid": "5.0.7",
"ora": "8.1.0",
"semver": "7.6.3",
"uuid": "10.0.0",
"zod": "3.23.8",
"systeminformation": "5.23.5"
"systeminformation": "5.23.5",
"express": "4.21.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
Expand All @@ -48,6 +49,7 @@
"@types/node": "20.14.8",
"@types/semver": "7.5.8",
"@types/uuid": "10.0.0",
"@types/express": "5.0.0",
"concurrently": "9.0.1",
"esbuild": "0.24.0",
"jest": "29.7.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/tcore-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"cors": "2.8.5",
"cron-parser": "4.4.0",
"dayjs": "1.11.13",
"express": "4.21.1",
"extract-zip": "2.0.1",
"js-yaml": "4.1.0",
"md5": "2.3.0",
Expand All @@ -19,7 +18,6 @@
"devDependencies": {
"@types/compression": "1.7.5",
"@types/cors": "2.8.17",
"@types/express": "5.0.0",
"@types/js-yaml": "4.0.9",
"@types/md5": "2.3.5",
"@types/method-override": "0.0.35"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
36 changes: 36 additions & 0 deletions plugins/network-chirpstack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@tago-io/tcore-plugin-network-chirpstack",
"version": "0.7.0",
"private": false,
"main": "./src/index.ts",
"type": "module",
"engines": {
"tcore": ">= 0.7.0 < 1.0.0"
},
"files": [
"build/**/*",
"assets/**/*"
],
"tcore": {
"name": "Chirpstack LoRaWAN",
"short_description": "Adds support for Chirpstack LoRaWAN",
"full_description": "./README.md",
"icon": "./assets/icon.png",
"cluster": true,
"types": [
"service",
"encoder",
"action-type"
],
"permissions": [
"device",
"action",
"device-data"
]
},
"dependencies": {
"body-parser": "2.0.1"
},
"devDependencies": {
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios, { AxiosRequestConfig } from "axios";
import { Request, Response } from "express";
import axios, { type AxiosRequestConfig } from "axios";
import type { Request, Response } from "express";
import { core } from "@tago-io/tcore-sdk";
import sendResponse from "../lib/sendResponse";
import { IConfigParam } from "../types";
import { getDevice } from "./uplink";
import sendResponse from "../lib/sendResponse.ts";
import type { IConfigParam } from "../types.ts";
import { getDevice } from "./uplink.ts";

interface IDownlinkBuild {
token: string;
Expand Down Expand Up @@ -102,4 +102,4 @@ async function downlinkService(config: IConfigParam, req: Request, res: Response
}

export default downlinkService;
export { IClassAConfig, IDownlinkParams };
export type { IClassAConfig, IDownlinkParams };
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { core } from "@tago-io/tcore-sdk";
import { IDeviceData } from "@tago-io/tcore-sdk/build/Types";
import { IConfigParam } from "../types";
import downlinkService, { IDownlinkParams } from "./downlink";
import type { IDeviceData } from "@tago-io/tcore-sdk/build/Types";
import type { IConfigParam } from "../types.ts";
import downlinkService, { type IDownlinkParams } from "./downlink.ts";

class ResMockup {
_status = 200;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import toTagoFormat, { IDeviceDataLatLng } from "../lib/toTagoFormat";
import toTagoFormat, { type IDeviceDataLatLng } from "../lib/toTagoFormat.ts";

interface IRXInfo {
time: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { core } from "@tago-io/tcore-sdk";
import { Request, Response } from "express";
import { IDevice } from "@tago-io/tcore-sdk/build/Types";
import { IConfigParam } from "../types";
import sendResponse from "../lib/sendResponse";
import type { Request, Response } from "express";
import type { IConfigParam } from "../types.ts";
import sendResponse from "../lib/sendResponse.ts";

interface IChirpstackPayload {
applicationID: string;
applicationName: string;
deviceName: string;
devEUI: string;
devAddr: string;
rxInfo: {}[];
txInfo: {};
rxInfo: any[];
txInfo: any;
adr: boolean;
dr: number;
fCnt: number;
fPort: number;
data?: string;
payload?: string;
objectJSON: string;
tags: {};
tags: any;
margin: number;
externalPowerSource: boolean;
batteryLevelUnavailable: boolean;
Expand Down Expand Up @@ -100,4 +99,5 @@ async function uplinkService(config: IConfigParam, req: Request, res: Response)
}

export default uplinkService;
export { getDevice, IChirpstackPayload };
export { getDevice };
export type { IChirpstackPayload };
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Server } from "http";
import type { Server } from "node:http";
import { ActionTypeModule, PayloadEncoderModule, ServiceModule } from "@tago-io/tcore-sdk";
import bodyParser from "body-parser";
import express, { Express } from "express";
import sendResponse from "./lib/sendResponse";
import downlinkService from "./Services/downlink";
import downlinkAction from "./Services/downlinkAction";
import parser from "./Services/parser";
import uplinkService from "./Services/uplink";
import { IConfigParam } from "./types";
import express, { type Express } from "express";
import sendResponse from "./lib/sendResponse.ts";
import downlinkService from "./Services/downlink.ts";
import downlinkAction from "./Services/downlinkAction.ts";
import parser from "./Services/parser.ts";
import uplinkService from "./Services/uplink.ts";
import type { IConfigParam } from "./types.ts";

const NetworkService = new ServiceModule({
id: "network-chirpstack",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Response } from "express";
import type { Response } from "express";

/**
* Resolve response for AWS Lambda Proxy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDeviceDataCreate } from "@tago-io/tcore-sdk/build/Types";
import type { IDeviceDataCreate } from "@tago-io/tcore-sdk/build/Types";

interface IDeviceDataLatLng extends Omit<IDeviceDataCreate, "location"> {
location?: { lat: number; lng: number };
Expand Down Expand Up @@ -44,4 +44,4 @@ function toTagoFormat(objectItem: IToTagoObject, group?: string, prefix = "") {
}

export default toTagoFormat;
export { IToTagoObject, IDeviceDataLatLng };
export type { IToTagoObject, IDeviceDataLatLng };
File renamed without changes.
10 changes: 0 additions & 10 deletions standalone-plugins/network-chirpstack/.eslintignore

This file was deleted.

Loading

0 comments on commit 39de83e

Please sign in to comment.