New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

freeboard-sk-helper

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freeboard-sk-helper - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

plugin/types/store.js

4

CHANGELOG.md
# CHANGELOG: Freeboard-SK-Helper
### v1.3.0
- **update**: Remove `./resources/tracks` provider. `signalk-resources-fs v1.3.0` plugin now has the ability to define additional resource paths and `tracks` can be served using this functionality.
### v1.2.5

@@ -4,0 +8,0 @@

3

package.json
{
"name": "freeboard-sk-helper",
"version": "1.2.5",
"version": "1.3.0",
"description": "Freeboard-SK helper plugin for SignalK Server.",

@@ -29,2 +29,3 @@ "main": "plugin/index.js",

"dependencies": {
"@panaaj/sk-types": "^1.1.1",
"geojson-validation": "^0.2.0",

@@ -31,0 +32,0 @@ "mkdirp": "^0.5.5",

@@ -29,3 +29,3 @@ "use strict";

*/
const server_1 = require("./types/signalk/server");
const sk_types_1 = require("@panaaj/sk-types");
const pouchdb_1 = __importDefault(require("pouchdb"));

@@ -36,5 +36,2 @@ const path_1 = __importDefault(require("path"));

const gribfiles_1 = require("./lib/gribfiles");
const trackfiles_1 = require("./lib/trackfiles");
const utils_1 = require("./lib/utils");
const uuid_1 = __importDefault(require("uuid"));
const alarms_1 = require("./lib/alarms");

@@ -54,3 +51,2 @@ const CONFIG_SCHEMA = {

let notifier = new alarms_1.Notifier(); // sends notifications
let utils = new utils_1.Utils();
let settings = { path: '' }; // ** applied configuration settings

@@ -74,3 +70,2 @@ let subscriptions = []; // stream subscriptions

let grib = new gribfiles_1.GribStore();
let tracks = new trackfiles_1.TrackStore();
// ******** REQUIRED PLUGIN DEFINITION *******

@@ -128,19 +123,2 @@ let plugin = {

.catch((err) => { server.debug(`*** GRIB ERROR: ${err} ***`); });
tracks.init(basePath)
.then(res => {
if (res.error) {
server.debug(`*** TRACKS ERROR: ${res.message} ***`);
}
else {
status += ' EXP:resources/tracks';
}
if (typeof server.setPluginStatus === 'function') {
server.setPluginStatus(status);
}
else {
server.setProviderStatus(status);
}
server.debug(`*** TRACKS provider initialised... ${(!res.error) ? 'OK' : 'with errors!'}`);
})
.catch((err) => { server.debug(`*** TRACKS ERROR: ${err} ***`); });
// **********

@@ -308,61 +286,2 @@ // **register HTTP PUT handlers

}));
// ** Tracks **
router.get('/resources/tracks', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
try {
let r = yield tracks.getResources('tracks', null, {});
if (typeof r.error !== 'undefined') {
res.status(r.status).send(r.message);
}
else {
res.json(r);
}
}
catch (err) {
res.status(500).send('Error fetching resources!');
}
}));
router.get(`/resources/tracks/*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
try {
let r = yield tracks.getResources('tracks', req.path.split('/')[3], {});
if (typeof r.error !== 'undefined') {
res.status(r.status).send(r.message);
}
else {
res.json(r);
}
}
catch (err) {
res.status(500).send('Error fetching resources!');
}
}));
router.post(`/resources/tracks`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
let pArr = req.path.slice(1).split('/');
let id = pArr[pArr.length - 1];
let pVal = {};
pVal[id] = (typeof req.body.value !== 'undefined') ? req.body.value : req.body;
actionTrackRequest('', 'tracks', pVal)
.then((r) => {
if (r.statusCode >= 400) {
res.status(r.statusCode).send(r.message);
}
else {
res.json(r);
}
}).catch(() => { res.status(500); });
}));
router.delete(`/resources/tracks/${utils.uuidPrefix}*-*-*-*-*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
let pArr = req.path.slice(1).split('/');
let id = pArr[pArr.length - 1];
let pVal = {};
pVal[id] = null;
actionTrackRequest('', 'tracks', pVal)
.then((r) => {
if (r.statusCode >= 400) {
res.status(r.statusCode).send(r.message);
}
else {
res.json(r);
}
}).catch(() => { res.status(500); });
}));
return router;

@@ -442,10 +361,10 @@ };

watcher.onInRange = (val) => {
notifier.notification = new alarms_1.Notification('arrivalCircleEntered', `Approaching Destination: ${val}m`, server_1.ALARM_STATE.warn, [server_1.ALARM_METHOD.sound, server_1.ALARM_METHOD.visual]);
notifier.notification = new alarms_1.Notification('arrivalCircleEntered', `Approaching Destination: ${val}m`, sk_types_1.ALARM_STATE.warn, [sk_types_1.ALARM_METHOD.sound, sk_types_1.ALARM_METHOD.visual]);
};
watcher.onEnterRange = (val) => {
emitNotification(new alarms_1.Notification('arrivalCircleEntered', `Approaching Destination: ${val}m`, server_1.ALARM_STATE.warn, [server_1.ALARM_METHOD.sound, server_1.ALARM_METHOD.visual]));
emitNotification(new alarms_1.Notification('arrivalCircleEntered', `Approaching Destination: ${val}m`, sk_types_1.ALARM_STATE.warn, [sk_types_1.ALARM_METHOD.sound, sk_types_1.ALARM_METHOD.visual]));
notifier.start();
};
watcher.onExitRange = (val) => {
emitNotification(new alarms_1.Notification('arrivalCircleEntered', `${val} > (${navData.nextPoint.arrivalCircle})`, server_1.ALARM_STATE.normal, []));
emitNotification(new alarms_1.Notification('arrivalCircleEntered', `${val} > (${navData.nextPoint.arrivalCircle})`, sk_types_1.ALARM_STATE.normal, []));
notifier.stop();

@@ -651,43 +570,4 @@ };

});
/** handle Track POST, DELETE requests **/
const actionTrackRequest = (context, path, value) => __awaiter(void 0, void 0, void 0, function* () {
server.debug(`Path= ${JSON.stringify(path)}, value= ${JSON.stringify(value)}`);
let r = {};
let result;
let v = Object.entries(value); // ** value= { uuid: { resource_data} }
r.id = (v[0][0] != 'tracks') ? v[0][0] : utils.uuidPrefix + uuid_1.default(); // uuid
r.value = v[0][1]; // resource_data
r.type = path; // ** get resource type from path **
// ** test for valid resource identifier
if (!utils.isUUID(r.id)) {
return {
state: 'COMPLETED',
statusCode: 400,
message: `Invalid resource id!`
};
}
if (r.type == 'tracks') {
let dbop = yield tracks.setResource(r);
if (typeof dbop.error === 'undefined') { // OK
result = { state: 'COMPLETED', message: 'COMPLETED', statusCode: 200 };
}
else { // error
result = {
state: 'COMPLETED',
statusCode: 502,
message: `Error updating resource!`
};
}
}
else {
result = {
state: 'COMPLETED',
statusCode: 400,
message: `Invalid resource type (${r.type})!`
};
}
return result;
});
// ******************************************
return plugin;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Watcher = exports.Notifier = exports.Notification = void 0;
const server_1 = require("../types/signalk/server");
const sk_types_1 = require("@panaaj/sk-types");
class Notification {

@@ -10,4 +10,4 @@ constructor(path, msg, state, method) {

value: {
state: server_1.ALARM_STATE.alarm,
method: [server_1.ALARM_METHOD.sound, server_1.ALARM_METHOD.visual],
state: sk_types_1.ALARM_STATE.alarm,
method: [sk_types_1.ALARM_METHOD.sound, sk_types_1.ALARM_METHOD.visual],
message: 'Alarm!'

@@ -14,0 +14,0 @@ }

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./store"), exports);

@@ -91,6 +91,1 @@ # Freeboard-SK-Helper:

#### Tracks provider:
Serves GeoJSON "MultiLineString" features to the path `./resources/tracks`in order to make imported Track data available from your Signal K server.
`Freeboard-SK` v1.11.0 or greater with `Experiments` enabled will allow GPX Track data to be uploaded a the Signal K server with this plugin installed.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc