Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalk/resources-provider

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalk/resources-provider - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "@signalk/resources-provider",
"version": "1.0.0",
"version": "1.1.0",
"description": "Resources provider plugin for Signal K server.",

@@ -5,0 +5,0 @@ "main": "plugin/index.js",

@@ -15,8 +15,2 @@ "use strict";

properties: {
path: {
type: 'string',
title: 'Path to store resources:',
description: 'File system path relative to home/<user>/.signalk',
default: './resources'
},
standard: {

@@ -64,6 +58,2 @@ type: 'object',

const CONFIG_UISCHEMA = {
path: {
'ui:emptyValue': './resources',
'ui:help': ' '
},
standard: {

@@ -146,3 +136,3 @@ routes: {

// initialise resource storage
db.init({ settings: config, path: server.config.configPath })
db.init({ settings: config, basePath: server.getDataDirPath() })
.then((res) => {

@@ -149,0 +139,0 @@ if (res.error) {

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

if (typeof config.settings.path === 'undefined') {
this.savePath = config.path + '/resources';
this.savePath = config.basePath + '/resources';
}

@@ -42,3 +42,3 @@ else if (config.settings.path[0] == '/') {

else {
this.savePath = path_1.default.join(config.path, config.settings.path);
this.savePath = path_1.default.join(config.basePath, config.settings.path);
}

@@ -138,3 +138,3 @@ // std resources

const rt = this.resources[type];
const files = yield (0, promises_1.readdir)(rt.path);
const files = yield (0, promises_1.readdir)(rt.path, { withFileTypes: true });
// check resource count

@@ -146,2 +146,6 @@ const fcount = params.limit && files.length > params.limit

for (const f in files) {
if (!files[f].isFile()) {
this.debug(`${files[f].name} is not a File => ignore.`);
continue;
}
if (++count > fcount) {

@@ -151,8 +155,8 @@ break;

try {
const res = JSON.parse(yield (0, promises_1.readFile)(path_1.default.join(rt.path, files[f]), 'utf8'));
const res = JSON.parse(yield (0, promises_1.readFile)(path_1.default.join(rt.path, files[f].name), 'utf8'));
// apply param filters
if ((0, utils_1.passFilter)(res, type, params)) {
const uuid = files[f];
const uuid = files[f].name;
result[uuid] = res;
const stats = yield (0, promises_1.stat)(path_1.default.join(rt.path, files[f]));
const stats = yield (0, promises_1.stat)(path_1.default.join(rt.path, files[f].name));
result[uuid].timestamp = stats.mtime;

@@ -159,0 +163,0 @@ result[uuid].$source = this.pkg.id;

@@ -15,9 +15,9 @@ # Signal K Resources Provider Plugin:

as well as providing the capability to serve custom resource types provisioned as additional paths under `/signalk/v1/api/resources`.
as well as providing the capability to serve custom resource types provisioned as additional paths under `/signalk/v2/api/resources`.
- _example:_ `resources/fishingZones`
- _example:_ `/signalk/v2/api/resources/fishingZones`
Each path is provisioned with `GET`, `PUT`, `POST` and `DELETE` operations enabled.
Operation of all paths is as set out in the Signal K specification.
Operation of all paths is as set out in the OpenAPI resources definition available in the Signal K server Admin console.

@@ -28,5 +28,5 @@

1. Install the plugin via the Signal K server __AppStore__
Signal K server v2 includes this plugin as part of the installation / upgrade process.
1. Re-start the Signal K server to load the plugin. The plugin will be active with all managed resource types enabled.
By default the plugin is enabled with all standdard resource types enabled.

@@ -36,8 +36,5 @@ 1. `(optional)` De-select any resource types you want to disable.

1. `(optional)` Specify any custom resource paths you require.
1. By default resources will be stored under the path `~/.signalk/resources`. You can define an alternative path in the plugin configuration screen. The path will be created if it does not exist. _(Note: The path you enter is relative to the `~/.signalk` folder.)_
1. Click __Submit__
![image](https://user-images.githubusercontent.com/38519157/150449889-5049a624-821c-4f33-ba8b-596b6b643d07.png)
![image](https://user-images.githubusercontent.com/38519157/227807566-966a5640-87e1-4db8-a7f2-aadf06deb3f3.png)

@@ -48,3 +45,3 @@ ---

Resources are stored in the server's filesystem under the path entered in the configuration screen.
Resources are stored in the server's filesystem under the path `~/.signalk/plugin-config-data/resources-provider/resources`.

@@ -51,0 +48,0 @@ A separate file is created for each resource with a name that reflects the resources `id`.

Sorry, the diff of this file is not supported yet

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