@signalk/freeboard-sk 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG: Freeboard
2
2
 
3
+ ### v2.2.1
4
+
5
+ - **Fixed**: Issue where waypoint was not centered on the screen when the center waypoint button was clicked from the entry in the waypoint list.
6
+
7
+ - **Fixed**: Issue where invalid fixed location postion was being written to settings.
8
+
9
+
3
10
  ### v2.2.0
4
11
 
5
12
  - **Added**: Ability to center a vessel in the Vessels List.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/freeboard-sk",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Openlayers chart plotter implementation for Signal K",
5
5
  "keywords": [
6
6
  "signalk-webapp",
@@ -20,9 +20,7 @@
20
20
  "build": "ng build",
21
21
  "test": "ng test",
22
22
  "format": "prettier --ignore-path .gitignore --write \"src/**/*.+(ts|html)\"",
23
- "format:projects": "prettier --ignore-path .gitignore --write \"projects/**/*.+(ts|html)\"",
24
23
  "format:helper": "prettier --ignore-path .gitignore --write \"helper/**/*.+(ts|html)\"",
25
- "e2e": "ng e2e",
26
24
  "build:helper": "tsc -p tsconfig-helper.json",
27
25
  "build:web": "ng build -c production --output-hashing all",
28
26
  "build:all": "npm run build:helper && npm run build:web",
@@ -44,19 +42,19 @@
44
42
  "tslib": "^2.0.0"
45
43
  },
46
44
  "devDependencies": {
47
- "@angular-devkit/build-angular": "^14.0.1",
48
- "@angular/animations": "^14.0.1",
49
- "@angular/cdk": "^14.0.1",
50
- "@angular/cli": "^14.0.1",
51
- "@angular/common": "^14.0.1",
52
- "@angular/compiler": "^14.0.1",
53
- "@angular/compiler-cli": "^14.0.1",
54
- "@angular/core": "^14.0.1",
55
- "@angular/forms": "^14.0.1",
56
- "@angular/language-service": "^14.0.1",
57
- "@angular/material": "^14.0.1",
58
- "@angular/platform-browser": "^14.0.1",
59
- "@angular/platform-browser-dynamic": "^14.0.1",
45
+ "@angular-devkit/build-angular": "^16.2.0",
46
+ "@angular/animations": "^16.2.0",
47
+ "@angular/cdk": "^16.2.0",
48
+ "@angular/cli": "^16.2.0",
49
+ "@angular/common": "^16.2.0",
50
+ "@angular/compiler": "^16.2.0",
51
+ "@angular/compiler-cli": "^16.2.0",
52
+ "@angular/core": "^16.2.0",
53
+ "@angular/forms": "^16.2.0",
54
+ "@angular/language-service": "^16.2.0",
55
+ "@angular/material": "^16.2.0",
56
+ "@angular/platform-browser": "^16.2.0",
57
+ "@angular/platform-browser-dynamic": "^16.2.0",
60
58
  "@kolkov/angular-editor": "^2.1.0",
61
59
  "@signalk/server-api": "^2.0.0",
62
60
  "@types/arcgis-rest-api": "^10.4.5",
@@ -78,7 +76,7 @@
78
76
  "karma-coverage-istanbul-reporter": "~3.0.2",
79
77
  "karma-jasmine": "~4.0.0",
80
78
  "karma-jasmine-html-reporter": "^1.5.0",
81
- "ng-packagr": "^14.0.2",
79
+ "ng-packagr": "^16.2.0",
82
80
  "ngeohash": "^0.6.3",
83
81
  "ol": "^7.4.0",
84
82
  "pmtiles": "^2.7.0",
@@ -91,7 +89,7 @@
91
89
  "signalk-worker-angular": "^1.1.4",
92
90
  "simplify-ts": "^1.0.2",
93
91
  "ts-node": "~7.0.0",
94
- "typescript": "~4.7.3",
95
- "zone.js": "~0.11.4"
92
+ "typescript": "~4.9.5",
93
+ "zone.js": "~0.13.1"
96
94
  }
97
- }
95
+ }
@@ -77,7 +77,6 @@ const initAlarmEndpoints = () => {
77
77
  });
78
78
  };
79
79
  const handlePutAlarmState = (context, path, value) => {
80
- var _a, _b;
81
80
  server.debug(context);
82
81
  server.debug(path);
83
82
  server.debug(JSON.stringify(value));
@@ -95,7 +94,7 @@ const handlePutAlarmState = (context, path, value) => {
95
94
  server.debug(JSON.stringify(alarmType));
96
95
  let noti;
97
96
  if (value) {
98
- noti = new types_1.Notification(alarmType, buildAlarmMessage(value.message, alarmType), (_a = value.state) !== null && _a !== void 0 ? _a : null, (_b = value.method) !== null && _b !== void 0 ? _b : null);
97
+ noti = new types_1.Notification(alarmType, buildAlarmMessage(value.message, alarmType), value.state ?? null, value.method ?? null);
99
98
  }
100
99
  else {
101
100
  noti = {
@@ -123,7 +122,7 @@ const buildAlarmMessage = (message, alarmType) => {
123
122
  if (['mob', 'sinking'].includes(alarmType)) {
124
123
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
125
124
  const pos = server.getSelfPath('navigation.position');
126
- msgAttrib = pos ? JSON.stringify(pos === null || pos === void 0 ? void 0 : pos.value) : '';
125
+ msgAttrib = pos ? JSON.stringify(pos?.value) : '';
127
126
  }
128
127
  return `${message}\n\r${msgAttrib}`;
129
128
  };
package/plugin/index.js CHANGED
@@ -122,32 +122,31 @@ module.exports = (server) => {
122
122
  };
123
123
  // ************************************
124
124
  const doStartup = (options) => {
125
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
126
125
  try {
127
126
  server.debug(`${plugin.name} starting.......`);
128
127
  if (typeof options !== 'undefined') {
129
128
  settings = options;
130
129
  }
131
- settings.weather = (_a = options.weather) !== null && _a !== void 0 ? _a : {
130
+ settings.weather = options.weather ?? {
132
131
  enable: false,
133
132
  apiKey: '',
134
133
  service: 'openweather'
135
134
  };
136
- settings.weather.enable = (_b = options.weather.enable) !== null && _b !== void 0 ? _b : false;
137
- settings.weather.apiKey = (_c = options.weather.apiKey) !== null && _c !== void 0 ? _c : '';
138
- settings.weather.service = (_d = options.weather.service) !== null && _d !== void 0 ? _d : 'openweather';
139
- settings.alarms = (_e = options.alarms) !== null && _e !== void 0 ? _e : {
135
+ settings.weather.enable = options.weather.enable ?? false;
136
+ settings.weather.apiKey = options.weather.apiKey ?? '';
137
+ settings.weather.service = options.weather.service ?? 'openweather';
138
+ settings.alarms = options.alarms ?? {
140
139
  enable: true
141
140
  };
142
- settings.alarms.enable = (_f = options.alarms.enable) !== null && _f !== void 0 ? _f : true;
143
- settings.pypilot = (_g = options.pypilot) !== null && _g !== void 0 ? _g : {
141
+ settings.alarms.enable = options.alarms.enable ?? true;
142
+ settings.pypilot = options.pypilot ?? {
144
143
  enable: false,
145
144
  host: 'localhost',
146
145
  port: 8000
147
146
  };
148
- settings.pypilot.enable = (_h = options.pypilot.enable) !== null && _h !== void 0 ? _h : false;
149
- settings.pypilot.host = (_j = options.pypilot.host) !== null && _j !== void 0 ? _j : 'localhost';
150
- settings.pypilot.port = (_k = options.pypilot.port) !== null && _k !== void 0 ? _k : 8000;
147
+ settings.pypilot.enable = options.pypilot.enable ?? false;
148
+ settings.pypilot.host = options.pypilot.host ?? 'localhost';
149
+ settings.pypilot.port = options.pypilot.port ?? 8000;
151
150
  server.debug(`Applied config: ${JSON.stringify(settings)}`);
152
151
  if (settings.alarms.enable) {
153
152
  (0, alarms_1.initAlarms)(server, plugin.id);
@@ -2,7 +2,6 @@
2
2
  // NOAA
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.NOAA = void 0;
5
- const tslib_1 = require("tslib");
6
5
  const fetch_1 = require("./fetch");
7
6
  var CARDINAL_POINTS;
8
7
  (function (CARDINAL_POINTS) {
@@ -24,55 +23,8 @@ var CARDINAL_POINTS;
24
23
  CARDINAL_POINTS[CARDINAL_POINTS["NNW"] = 337.5] = "NNW";
25
24
  })(CARDINAL_POINTS || (CARDINAL_POINTS = {}));
26
25
  class NOAA {
26
+ settings;
27
27
  constructor(config) {
28
- this.fetchData = (position) => tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- var _a, _b, _c, _d, _e, _f;
30
- const url = this.getUrl(position);
31
- try {
32
- //console.log(`url`, url)
33
- const response = yield (0, fetch_1.fetch)(url);
34
- let forecasts = [];
35
- let observations = [];
36
- // observations
37
- if ((_a = response === null || response === void 0 ? void 0 : response.properties) === null || _a === void 0 ? void 0 : _a.observationStations) {
38
- const stations = yield (0, fetch_1.fetch)(response.properties.observationStations);
39
- observations = yield (0, fetch_1.fetch)(`${stations.features[0].id}/observations/latest`);
40
- //console.log(`observations`, observations)
41
- }
42
- // forecasts
43
- if ((_b = response === null || response === void 0 ? void 0 : response.properties) === null || _b === void 0 ? void 0 : _b.forecastHourly) {
44
- forecasts = yield (0, fetch_1.fetch)(response.properties.forecastHourly);
45
- //console.log(`forecasts`, forecasts)
46
- }
47
- // warnings
48
- const warnings = yield (0, fetch_1.fetch)(`https://api.weather.gov/alerts/active?point=${position.latitude.toFixed(4)},${position.longitude.toFixed(4)}`);
49
- //console.log(`warnings`, warnings)
50
- return this.parseResponse({
51
- position: position,
52
- forecasts: (_d = (_c = forecasts === null || forecasts === void 0 ? void 0 : forecasts.properties) === null || _c === void 0 ? void 0 : _c.periods) !== null && _d !== void 0 ? _d : [],
53
- observations: (_e = observations === null || observations === void 0 ? void 0 : observations.properties) !== null && _e !== void 0 ? _e : null,
54
- warnings: (_f = warnings === null || warnings === void 0 ? void 0 : warnings.features) !== null && _f !== void 0 ? _f : []
55
- });
56
- }
57
- catch (error) {
58
- throw error;
59
- }
60
- });
61
- this.parseResponse = (wData) => {
62
- return {
63
- self: {
64
- id: 'self',
65
- name: 'Weather data relative to supplied position.',
66
- position: {
67
- latitude: wData.latitude,
68
- longitude: wData.longitude
69
- },
70
- observations: this.parseNoaaObservations(wData.observations),
71
- forecasts: this.parseNoaaForecasts(wData.forecasts),
72
- warnings: this.parseNoaaWarnings(wData.warnings)
73
- }
74
- };
75
- };
76
28
  this.settings = config;
77
29
  }
78
30
  getUrl(position) {
@@ -84,14 +36,60 @@ class NOAA {
84
36
  return `${api}/${position.latitude.toFixed(4)},${position.longitude.toFixed(4)}`;
85
37
  }
86
38
  }
39
+ fetchData = async (position) => {
40
+ const url = this.getUrl(position);
41
+ try {
42
+ //console.log(`url`, url)
43
+ const response = await (0, fetch_1.fetch)(url);
44
+ let forecasts = [];
45
+ let observations = [];
46
+ // observations
47
+ if (response?.properties?.observationStations) {
48
+ const stations = await (0, fetch_1.fetch)(response.properties.observationStations);
49
+ observations = await (0, fetch_1.fetch)(`${stations.features[0].id}/observations/latest`);
50
+ //console.log(`observations`, observations)
51
+ }
52
+ // forecasts
53
+ if (response?.properties?.forecastHourly) {
54
+ forecasts = await (0, fetch_1.fetch)(response.properties.forecastHourly);
55
+ //console.log(`forecasts`, forecasts)
56
+ }
57
+ // warnings
58
+ const warnings = await (0, fetch_1.fetch)(`https://api.weather.gov/alerts/active?point=${position.latitude.toFixed(4)},${position.longitude.toFixed(4)}`);
59
+ //console.log(`warnings`, warnings)
60
+ return this.parseResponse({
61
+ position: position,
62
+ forecasts: forecasts?.properties?.periods ?? [],
63
+ observations: observations?.properties ?? null,
64
+ warnings: warnings?.features ?? []
65
+ });
66
+ }
67
+ catch (error) {
68
+ throw error;
69
+ }
70
+ };
71
+ parseResponse = (wData) => {
72
+ return {
73
+ self: {
74
+ id: 'self',
75
+ name: 'Weather data relative to supplied position.',
76
+ position: {
77
+ latitude: wData.latitude,
78
+ longitude: wData.longitude
79
+ },
80
+ observations: this.parseNoaaObservations(wData.observations),
81
+ forecasts: this.parseNoaaForecasts(wData.forecasts),
82
+ warnings: this.parseNoaaWarnings(wData.warnings)
83
+ }
84
+ };
85
+ };
87
86
  parseNoaaObservations(wData) {
88
- var _a, _b;
89
87
  const data = [];
90
88
  const obs = {};
91
89
  let v;
92
90
  if (wData) {
93
- obs.timestamp = (_a = wData.timestamp) !== null && _a !== void 0 ? _a : null;
94
- obs.description = (_b = wData.textDescription) !== null && _b !== void 0 ? _b : null;
91
+ obs.timestamp = wData.timestamp ?? null;
92
+ obs.description = wData.textDescription ?? null;
95
93
  v = wData.visibility.value
96
94
  ? wData.visibility.unitCode === 'wmoUnit:m'
97
95
  ? wData.visibility.value
@@ -176,10 +174,9 @@ class NOAA {
176
174
  const data = [];
177
175
  if (forecasts && Array.isArray(forecasts)) {
178
176
  forecasts.forEach((f) => {
179
- var _a, _b, _c;
180
177
  const forecast = {};
181
- forecast.timestamp = (_a = f.startTime) !== null && _a !== void 0 ? _a : null;
182
- forecast.description = (_b = f.shortForecast) !== null && _b !== void 0 ? _b : null;
178
+ forecast.timestamp = f.startTime ?? null;
179
+ forecast.description = f.shortForecast ?? null;
183
180
  forecast.temperature = {};
184
181
  forecast.temperature.air = {
185
182
  value: typeof f.temperature !== 'undefined'
@@ -189,7 +186,7 @@ class NOAA {
189
186
  };
190
187
  forecast.wind = {};
191
188
  forecast.wind.speed = {
192
- value: (_c = parseInt(f.windSpeed.split(' ')[0]) / 2.237) !== null && _c !== void 0 ? _c : null,
189
+ value: parseInt(f.windSpeed.split(' ')[0]) / 2.237 ?? null,
193
190
  units: 'm/s'
194
191
  };
195
192
  const wd = f.windDirection
@@ -208,13 +205,12 @@ class NOAA {
208
205
  const data = [];
209
206
  if (alerts && Array.isArray(alerts)) {
210
207
  alerts.forEach((alert) => {
211
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
212
208
  const warn = {
213
- startTime: (_b = (_a = alert === null || alert === void 0 ? void 0 : alert.properties) === null || _a === void 0 ? void 0 : _a.effective) !== null && _b !== void 0 ? _b : null,
214
- endTime: (_d = (_c = alert === null || alert === void 0 ? void 0 : alert.properties) === null || _c === void 0 ? void 0 : _c.ends) !== null && _d !== void 0 ? _d : null,
215
- details: (_f = (_e = alert === null || alert === void 0 ? void 0 : alert.properties) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : null,
216
- source: (_h = (_g = alert === null || alert === void 0 ? void 0 : alert.properties) === null || _g === void 0 ? void 0 : _g.senderName) !== null && _h !== void 0 ? _h : null,
217
- type: (_k = (_j = alert === null || alert === void 0 ? void 0 : alert.properties) === null || _j === void 0 ? void 0 : _j.messageType) !== null && _k !== void 0 ? _k : null
209
+ startTime: alert?.properties?.effective ?? null,
210
+ endTime: alert?.properties?.ends ?? null,
211
+ details: alert?.properties?.description ?? null,
212
+ source: alert?.properties?.senderName ?? null,
213
+ type: alert?.properties?.messageType ?? null
218
214
  };
219
215
  data.push(warn);
220
216
  });
@@ -2,35 +2,10 @@
2
2
  // OpenWeather
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.OpenWeather = void 0;
5
- const tslib_1 = require("tslib");
6
5
  const fetch_1 = require("./fetch");
7
6
  class OpenWeather {
7
+ settings;
8
8
  constructor(config) {
9
- this.fetchData = (position) => tslib_1.__awaiter(this, void 0, void 0, function* () {
10
- const url = this.getUrl(position);
11
- try {
12
- const response = yield (0, fetch_1.fetch)(url);
13
- return this.parseResponse(response);
14
- }
15
- catch (error) {
16
- throw error;
17
- }
18
- });
19
- this.parseResponse = (owData) => {
20
- return {
21
- self: {
22
- id: 'self',
23
- name: 'Weather data relative to supplied position.',
24
- position: {
25
- latitude: owData.lat,
26
- longitude: owData.lon
27
- },
28
- observations: this.parseOWObservations(owData),
29
- forecasts: this.parseOWForecasts(owData),
30
- warnings: this.parseOWWarnings(owData)
31
- }
32
- };
33
- };
34
9
  this.settings = config;
35
10
  }
36
11
  getUrl(position) {
@@ -42,8 +17,32 @@ class OpenWeather {
42
17
  return `${api}?lat=${position.latitude}&lon=${position.longitude}&exclude=minutely,daily&appid=${this.settings.apiKey}`;
43
18
  }
44
19
  }
20
+ fetchData = async (position) => {
21
+ const url = this.getUrl(position);
22
+ try {
23
+ const response = await (0, fetch_1.fetch)(url);
24
+ return this.parseResponse(response);
25
+ }
26
+ catch (error) {
27
+ throw error;
28
+ }
29
+ };
30
+ parseResponse = (owData) => {
31
+ return {
32
+ self: {
33
+ id: 'self',
34
+ name: 'Weather data relative to supplied position.',
35
+ position: {
36
+ latitude: owData.lat,
37
+ longitude: owData.lon
38
+ },
39
+ observations: this.parseOWObservations(owData),
40
+ forecasts: this.parseOWForecasts(owData),
41
+ warnings: this.parseOWWarnings(owData)
42
+ }
43
+ };
44
+ };
45
45
  parseOWObservations(owData) {
46
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
47
46
  //server.debug(JSON.stringify(weatherData.current))
48
47
  const data = [];
49
48
  const obs = {};
@@ -52,32 +51,32 @@ class OpenWeather {
52
51
  obs.timestamp = current.dt
53
52
  ? new Date(current.dt * 1000).toISOString()
54
53
  : null;
55
- obs.description = (_a = current.weather[0].description) !== null && _a !== void 0 ? _a : null;
56
- obs.sunrise = (_b = new Date(current.sunrise * 1000).toISOString()) !== null && _b !== void 0 ? _b : null;
57
- obs.sunset = (_c = new Date(current.sunset * 1000).toISOString()) !== null && _c !== void 0 ? _c : null;
54
+ obs.description = current.weather[0].description ?? null;
55
+ obs.sunrise = new Date(current.sunrise * 1000).toISOString() ?? null;
56
+ obs.sunset = new Date(current.sunset * 1000).toISOString() ?? null;
58
57
  obs.uvIndex = {
59
- value: (_d = current.uvi) !== null && _d !== void 0 ? _d : null,
58
+ value: current.uvi ?? null,
60
59
  units: null
61
60
  };
62
61
  obs.clouds = {
63
- value: (_e = current.clouds) !== null && _e !== void 0 ? _e : null,
62
+ value: current.clouds ?? null,
64
63
  units: '%'
65
64
  };
66
65
  obs.visibility = {
67
- value: (_f = current.visibility) !== null && _f !== void 0 ? _f : null,
66
+ value: current.visibility ?? null,
68
67
  units: 'm'
69
68
  };
70
69
  obs.temperature = {};
71
70
  obs.temperature.air = {
72
- value: (_g = current.temp) !== null && _g !== void 0 ? _g : null,
71
+ value: current.temp ?? null,
73
72
  units: 'K'
74
73
  };
75
74
  obs.temperature.feelsLike = {
76
- value: (_h = current.feels_like) !== null && _h !== void 0 ? _h : null,
75
+ value: current.feels_like ?? null,
77
76
  units: 'K'
78
77
  };
79
78
  obs.temperature.dewPoint = {
80
- value: (_j = current.dew_point) !== null && _j !== void 0 ? _j : null,
79
+ value: current.dew_point ?? null,
81
80
  units: 'K'
82
81
  };
83
82
  obs.pressure = {};
@@ -87,12 +86,12 @@ class OpenWeather {
87
86
  };
88
87
  obs.humidity = {};
89
88
  obs.humidity.absolute = {
90
- value: (_k = current.humidity) !== null && _k !== void 0 ? _k : null,
89
+ value: current.humidity ?? null,
91
90
  units: '%'
92
91
  };
93
92
  obs.wind = {};
94
93
  obs.wind.speed = {
95
- value: (_l = current.wind_speed) !== null && _l !== void 0 ? _l : null,
94
+ value: current.wind_speed ?? null,
96
95
  units: 'm/s'
97
96
  };
98
97
  obs.wind.direction = {
@@ -127,47 +126,46 @@ class OpenWeather {
127
126
  if (owData && owData[period] && Array.isArray(owData[period])) {
128
127
  const forecasts = owData[period];
129
128
  forecasts.forEach((f) => {
130
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
131
129
  const forecast = {};
132
130
  forecast.timestamp = f.dt ? new Date(f.dt * 1000).toISOString() : null;
133
- forecast.description = (_a = f.weather[0].description) !== null && _a !== void 0 ? _a : null;
131
+ forecast.description = f.weather[0].description ?? null;
134
132
  forecast.temperature = {};
135
133
  forecast.temperature.air = {
136
- value: (_b = f.temp) !== null && _b !== void 0 ? _b : null,
134
+ value: f.temp ?? null,
137
135
  units: 'K'
138
136
  };
139
137
  if (period === 'daily') {
140
- forecast.sunrise = (_c = new Date(f.sunrise * 1000).toISOString()) !== null && _c !== void 0 ? _c : null;
141
- forecast.sunset = (_d = new Date(f.sunset * 1000).toISOString()) !== null && _d !== void 0 ? _d : null;
138
+ forecast.sunrise = new Date(f.sunrise * 1000).toISOString() ?? null;
139
+ forecast.sunset = new Date(f.sunset * 1000).toISOString() ?? null;
142
140
  forecast.temperature.minimum = {
143
- value: (_e = f.temp.min) !== null && _e !== void 0 ? _e : null,
141
+ value: f.temp.min ?? null,
144
142
  units: 'K'
145
143
  };
146
144
  forecast.temperature.maximum = {
147
- value: (_f = f.temp.max) !== null && _f !== void 0 ? _f : null,
145
+ value: f.temp.max ?? null,
148
146
  units: 'K'
149
147
  };
150
148
  forecast.temperature.feelsLike = {
151
- value: (_g = f.feels_like.day) !== null && _g !== void 0 ? _g : null,
149
+ value: f.feels_like.day ?? null,
152
150
  units: 'K'
153
151
  };
154
152
  }
155
153
  else {
156
154
  forecast.temperature.feelsLike = {
157
- value: (_h = f.feels_like) !== null && _h !== void 0 ? _h : null,
155
+ value: f.feels_like ?? null,
158
156
  units: 'K'
159
157
  };
160
158
  }
161
159
  forecast.temperature.dewPoint = {
162
- value: (_j = f.dew_point) !== null && _j !== void 0 ? _j : null,
160
+ value: f.dew_point ?? null,
163
161
  units: 'K'
164
162
  };
165
163
  forecast.uvIndex = {
166
- value: (_k = f.uvi) !== null && _k !== void 0 ? _k : null,
164
+ value: f.uvi ?? null,
167
165
  units: null
168
166
  };
169
167
  forecast.clouds = {
170
- value: (_l = f.clouds) !== null && _l !== void 0 ? _l : null,
168
+ value: f.clouds ?? null,
171
169
  units: '%'
172
170
  };
173
171
  forecast.pop = {
@@ -180,12 +178,12 @@ class OpenWeather {
180
178
  };
181
179
  forecast.humidity = {};
182
180
  forecast.humidity.absolute = {
183
- value: (_m = f.humidity) !== null && _m !== void 0 ? _m : null,
181
+ value: f.humidity ?? null,
184
182
  units: '%'
185
183
  };
186
184
  forecast.wind = {};
187
185
  forecast.wind.speed = {
188
- value: (_o = f.wind_speed) !== null && _o !== void 0 ? _o : null,
186
+ value: f.wind_speed ?? null,
189
187
  units: 'm/s'
190
188
  };
191
189
  forecast.wind.direction = {
@@ -195,7 +193,7 @@ class OpenWeather {
195
193
  units: 'rad'
196
194
  };
197
195
  forecast.wind.gust = {
198
- value: (_p = f.wind_gust) !== null && _p !== void 0 ? _p : null,
196
+ value: f.wind_gust ?? null,
199
197
  units: 'm/s'
200
198
  };
201
199
  forecast.precipitation = {
@@ -221,7 +219,6 @@ class OpenWeather {
221
219
  if (owData && owData.alerts) {
222
220
  const alerts = owData.alerts;
223
221
  alerts.forEach((alert) => {
224
- var _a, _b, _c;
225
222
  const warn = {
226
223
  startTime: alert.start
227
224
  ? new Date(alert.start * 1000).toISOString()
@@ -229,9 +226,9 @@ class OpenWeather {
229
226
  endTime: alert.end
230
227
  ? new Date(alert.start * 1000).toISOString()
231
228
  : null,
232
- details: (_a = alert.description) !== null && _a !== void 0 ? _a : null,
233
- source: (_b = alert.sender_name) !== null && _b !== void 0 ? _b : null,
234
- type: (_c = alert.event) !== null && _c !== void 0 ? _c : null
229
+ details: alert.description ?? null,
230
+ source: alert.sender_name ?? null,
231
+ type: alert.event ?? null
235
232
  };
236
233
  data.push(warn);
237
234
  });
@@ -18,15 +18,15 @@ var ALARM_METHOD;
18
18
  })(ALARM_METHOD = exports.ALARM_METHOD || (exports.ALARM_METHOD = {}));
19
19
  // Class encapsulating Signal K Notification
20
20
  class Notification {
21
+ _message = {
22
+ path: `notifications.`,
23
+ value: {
24
+ state: ALARM_STATE.alarm,
25
+ method: [ALARM_METHOD.sound, ALARM_METHOD.visual],
26
+ message: 'Alarm!'
27
+ }
28
+ };
21
29
  constructor(path, msg, state, method) {
22
- this._message = {
23
- path: `notifications.`,
24
- value: {
25
- state: ALARM_STATE.alarm,
26
- method: [ALARM_METHOD.sound, ALARM_METHOD.visual],
27
- message: 'Alarm!'
28
- }
29
- };
30
30
  this._message.path += path;
31
31
  this._message.value.message = msg;
32
32
  if (state) {
package/plugin/weather.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWeather = exports.listWeather = exports.stopWeather = exports.initWeather = exports.WEATHER_SERVICES = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const types_1 = require("./lib/types");
6
5
  const openweather_1 = require("./lib/openweather");
7
6
  const noaa_1 = require("./lib/noaa");
@@ -41,7 +40,7 @@ const stopWeather = () => {
41
40
  };
42
41
  exports.stopWeather = stopWeather;
43
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- const listWeather = (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
43
+ const listWeather = async (params) => {
45
44
  server.debug(`getWeather ${JSON.stringify(params)}`);
46
45
  const res = {};
47
46
  if (weatherData) {
@@ -51,11 +50,11 @@ const listWeather = (params) => tslib_1.__awaiter(void 0, void 0, void 0, functi
51
50
  }
52
51
  }
53
52
  return res;
54
- });
53
+ };
55
54
  exports.listWeather = listWeather;
56
- const getWeather = (path, property
55
+ const getWeather = async (path, property
57
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- ) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
57
+ ) => {
59
58
  server.debug(`getWeather ${path}, ${property}`);
60
59
  if (!weatherData) {
61
60
  return {};
@@ -68,12 +67,12 @@ const getWeather = (path, property
68
67
  const value = property.split('.').reduce((acc, val) => {
69
68
  return acc[val];
70
69
  }, station);
71
- return value !== null && value !== void 0 ? value : {};
70
+ return value ?? {};
72
71
  }
73
72
  else {
74
73
  return station;
75
74
  }
76
- });
75
+ };
77
76
  exports.getWeather = getWeather;
78
77
  const fetchWeatherData = () => {
79
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -155,7 +154,6 @@ const checkForWarnings = () => {
155
154
  };
156
155
  // emit weather warning notification
157
156
  const emitWarningNotification = (warning) => {
158
- var _a;
159
157
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
160
158
  let delta;
161
159
  if (warning) {
@@ -168,7 +166,7 @@ const emitWarningNotification = (warning) => {
168
166
  method: [types_1.ALARM_METHOD.visual],
169
167
  message: warning.details
170
168
  ? warning.details
171
- : (_a = warning.type) !== null && _a !== void 0 ? _a : warning.source
169
+ : warning.type ?? warning.source
172
170
  }
173
171
  };
174
172
  }