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

@signalk/signalk-schema

Package Overview
Dependencies
Maintainers
6
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalk/signalk-schema - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

dist/i18n/en.json

27

dist/fullsignalk.js

@@ -109,3 +109,8 @@ 'use strict';

}
addValues(context, contextPath, update.source || update['$source'], update.timestamp, update.values);
if (update.values) {
addValues(context, contextPath, update.source || update['$source'], update.timestamp, update.values);
}
if (update.meta) {
addMetas(context, contextPath, update.source || update['$source'], update.timestamp, update.meta);
}
};

@@ -204,8 +209,4 @@

if (i === splitPath.length - 1 && typeof previous[pathPart].value === 'undefined') {
var meta = signalkSchema.getMetadata(contextPath + '.' + pathValue.path);
var meta = signalkSchema.internalGetMetadata(contextPath + '.' + pathValue.path);
if (meta) {
//ignore properties from keyswithmetadata.json
meta = JSON.parse(JSON.stringify(meta));
delete meta.properties;
_.assign(meta, previous[pathPart].meta);

@@ -274,2 +275,16 @@ previous[pathPart].meta = meta;

function addMetas(context, contextPath, source, timestamp, metas) {
metas.forEach(function (metaPathValue) {
return addMeta(context, contextPath, source, timestamp, metaPathValue);
});
}
function addMeta(context, contextPath, source, timestamp, pathValue) {
if (_.isUndefined(pathValue.path) || _.isUndefined(pathValue.value)) {
console.error("Illegal value in delta:" + JSON.stringify(pathValue));
return;
}
signalkSchema.addMetaData(contextPath, pathValue.path, pathValue.value);
}
module.exports = FullSignalK;

@@ -45,14 +45,14 @@ 'use strict';

var vesselSchema = require('../schemas/vessel.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/vessel.json', vesselSchema);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/vessel.json', vesselSchema);
var aircraftSchema = require('../schemas/aircraft.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/aircraft.json', aircraftSchema);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/aircraft.json', aircraftSchema);
var atonSchema = require('../schemas/aton.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/aton.json', atonSchema);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/aton.json', atonSchema);
var sarSchema = require('../schemas/sar.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/sar.json', sarSchema);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/sar.json', sarSchema);
var definitions = require('../schemas/definitions.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/definitions.json', definitions);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/definitions.json', definitions);
for (var schema in subSchemas) {
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/groups/' + schema + '.json', subSchemas[schema]);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/groups/' + schema + '.json', subSchemas[schema]);
}

@@ -62,3 +62,3 @@

var externalGeometry = require('../schemas/external/geojson/geometry.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/external/geojson/geometry.json', externalGeometry);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/external/geojson/geometry.json', externalGeometry);
tv4.addSchema('http://json-schema.org/geojson/geometry.json', externalGeometry);

@@ -87,3 +87,3 @@

var definitions = require('../schemas/definitions.json');
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/definitions.json', definitions);
tv4.addSchema('https://signalk.org/specification/1.5.0/schemas/definitions.json', definitions);

@@ -314,5 +314,51 @@ if (ignoreContext) {

});
return result ? result.metadata : undefined;
return result && Object.keys(result.metadata).length > 0 ? result.metadata : undefined;
};
module.exports.internalGetMetadata = function (path) {
var result = metadataByRegex.find(function (entry) {
return entry.regexp.test('/' + path.replace(/\./g, '/'));
});
var meta = result ? result.metadata : undefined;
var parts = path.split('.');
var key = '/' + parts[0] + '/*/' + parts.slice(2).join('/');
if (!module.exports.metadata[key]) {
meta = result ? JSON.parse(JSON.stringify(result.metadata)) : {};
module.exports.metadata[key] = meta;
var regexpKey = '^' + key.replace(/\*/g, '.*').replace(/RegExp/g, '.*') + '$';
metadataByRegex.unshift({
regexp: new RegExp(regexpKey),
metadata: meta
});
}
return meta;
};
module.exports.addMetaData = function (context, path, meta) {
var root = context.split('.')[0];
var key = '/' + root + '/*/' + path.replace(/\./g, '/');
var existing = module.exports.metadata[key];
if (existing) {
_.merge(existing, meta);
} else {
var regexMeta = module.exports.getMetadata(context + '.' + path);
if (regexMeta) {
var newMeta = JSON.parse(JSON.stringify(regexMeta));
_.merge(newMeta, meta);
meta = newMeta;
}
module.exports.metadata[key] = meta;
var regexpKey = '^' + key.replace(/\*/g, '.*').replace(/RegExp/g, '.*') + '$';
metadataByRegex.unshift({
regexp: new RegExp(regexpKey),
metadata: meta
});
}
};
module.exports.getAISShipTypeName = function (id) {

@@ -319,0 +365,0 @@ var the_enum = subSchemas['design'].properties.aisShipType.allOf[1].properties.value.allOf[1].enum;

{
"name": "@signalk/signalk-schema",
"version": "1.5.0",
"version": "1.5.1",
"description": "SignalK specification schema as an npm module with tests",

@@ -11,3 +11,3 @@ "main": "dist/index.js",

"js:dist": "babel src --out-dir dist --copy-files",
"schema:version": "cross-var replace-in-file /https:\\/\\/signalk.org\\/specification\\/[\\w\\.]+\\/schemas\\//g https://signalk.org/specification/$npm_package_version/schemas/ ./**/*.j* --ignore=./package.json,./node_modules/** --isRegex --verbose",
"schema:version": "cross-var replace-in-file /https:\\\\/\\\\/signalk.org\\\\/specification\\\\/[\\\\w\\\\.]+\\\\/schemas\\\\//g https://signalk.org/specification/$npm_package_version/schemas/ ./**/*.j* --ignore=./package.json,./node_modules/** --isRegex --verbose",
"schema:publish": "git checkout gh-pages && git checkout master -- schemas && cross-var mkdir $npm_package_version && cross-var git add $npm_package_version && cross-var git mv schemas/ $npm_package_version/ && git commit -m \"Schemas from master\" && git push",

@@ -14,0 +14,0 @@ "docs:changelog": "github-changes -f gitbook-docs/changelog.md -o signalk -r specification -a --only-pulls --use-commit-body --data=pulls",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/aircraft.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/aircraft.json#",
"description": "An object describing an individual aircraft. It should be an object in aircraft, named using MMSI or a UUID",

@@ -6,0 +6,0 @@ "title": "aircraft",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/aton.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/aton.json#",
"description": "An object describing an individual aid to navigation. It should be an object in aton, named using MMSI or a UUID",

@@ -6,0 +6,0 @@ "title": "aid to navigation",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/definitions.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/definitions.json#",
"title": "definitions",

@@ -6,0 +6,0 @@ "description": "Reusable definitions of core object types",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/delta.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/delta.json#",
"title": "SignalK Delta message schema",

@@ -6,0 +6,0 @@ "description": "Schema for defining updates and subscriptions to parts of a SignalK data model, for example for communicating updates of data",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/discovery.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/discovery.json#",
"title": "SignalK Discovery",

@@ -6,0 +6,0 @@ "description": "Schema for SignalK discovery resources used to locate server endpoints.",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/hello.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/hello.json#",
"title": "SignalK Websockets Hello message schema",

@@ -6,0 +6,0 @@ "description": "Schema for defining the hello message passed from the server to a client following succesful websocket connection",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/aton.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/aton.json#",
"description": "An object describing an individual SAR beacon, eg EPIRB or transponser. It should be an object in sar, named using MMSI or a UUID",

@@ -6,0 +6,0 @@ "title": "Search and rescue beacons",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/signalk.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/signalk.json#",
"title": "SignalK",

@@ -6,0 +6,0 @@ "description": "Root schema of Signal K. Contains the list of vessels plus a reference to the local boat (also contained in the vessels list).",

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://signalk.org/specification/1.0.0/schemas/vessel.json#",
"id": "https://signalk.org/specification/1.5.0/schemas/vessel.json#",
"description": "An object describing an individual vessel. It should be an object in vessels, named using MMSI or a UUID",

@@ -6,0 +6,0 @@ "title": "vessel",

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