@signalk/charts-plugin 2.2.0 → 2.3.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.
@@ -0,0 +1,18 @@
1
+ name: Publish to npm
2
+ on:
3
+ workflow_run:
4
+ workflows: ["Release on tag"]
5
+ types: [completed]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: actions/setup-node@v1
13
+ with:
14
+ node-version: '16.x'
15
+ registry-url: 'https://registry.npmjs.org'
16
+ - run: npm publish --access public
17
+ env:
18
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,27 @@
1
+ name: 'Release on tag'
2
+ on:
3
+ push:
4
+ tags:
5
+ - '*'
6
+
7
+ jobs:
8
+ release:
9
+ permissions:
10
+ contents: write
11
+ if: startsWith(github.ref, 'refs/tags/')
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Build Changelog
15
+ id: github_release
16
+ uses: mikepenz/release-changelog-builder-action@v1
17
+ env:
18
+ GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
19
+
20
+ - name: Create Release
21
+ uses: actions/create-release@v1
22
+ with:
23
+ tag_name: ${{ github.ref }}
24
+ release_name: ${{ github.ref }}
25
+ body: ${{steps.github_release.outputs.changelog}}
26
+ env:
27
+ GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
@@ -0,0 +1,13 @@
1
+ name: Pull Request Labels
2
+ on:
3
+ pull_request:
4
+ types: [opened, labeled, unlabeled, synchronize]
5
+ jobs:
6
+ label:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: mheap/github-action-required-labels@v1
10
+ with:
11
+ mode: exactly
12
+ count: 1
13
+ labels: "fix, feature, doc, chore, test, ignore, other, dependencies"
@@ -0,0 +1,22 @@
1
+ name: CI test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ node-version: [10.x, 16.x]
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Use Node.js ${{ matrix.node-version }}
16
+ uses: actions/setup-node@v1
17
+ with:
18
+ node-version: ${{ matrix.node-version }}
19
+ - run: npm install
20
+ - run: npm test
21
+ env:
22
+ CI: true
package/README.md CHANGED
@@ -16,6 +16,9 @@ Signal K Node server plugin to provide chart metadata, such as name, description
16
16
 
17
17
  <img src="https://user-images.githubusercontent.com/1435910/45048136-c65d2e80-b083-11e8-99db-01e8cece9f89.png" alt="Online chart providers configuration" width="450"/>
18
18
 
19
+ _WMS example:_
20
+ ![image](https://user-images.githubusercontent.com/38519157/102832518-90077100-443e-11eb-9a1d-d0806bb2b10b.png)
21
+
19
22
  5. Activate plugin
20
23
 
21
24
  6. Use one of the client apps supporting Signal K charts, for example:
@@ -40,7 +43,7 @@ Plugin adds support for `/resources/charts` endpoints described in [Signal K spe
40
43
 
41
44
  - `GET /signalk/v1/api/resources/charts/` returns metadata for all available charts
42
45
  - `GET /signalk/v1/api/resources/charts/${identifier}/` returns metadata for selected chart
43
- - `GET /signalk/v1/api/resources/charts/${identifier}/${z}/${x}/${y}` returns a single tile for selected chart
46
+ - `GET /signalk/v1/api/resources/charts/${identifier}/${z}/${x}/${y}` returns a single tile for selected offline chart. As charts-plugin isn't proxy, online charts is not available via this request. You should look the metadata to find proper request.
44
47
 
45
48
  License
46
49
  -------
@@ -56,4 +59,4 @@ Unless required by applicable law or agreed to in writing, software
56
59
  distributed under the License is distributed on an "AS IS" BASIS,
57
60
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58
61
  See the License for the specific language governing permissions and
59
- limitations under the License.
62
+ limitations under the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/charts-plugin",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Signal K plugin to provide chart support for Signal K server",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,9 @@
21
21
  "email": "mikko.vesikkala@iki.fi"
22
22
  },
23
23
  "dependencies": {
24
- "@mapbox/mbtiles": "0.10.0",
24
+ "@mapbox/mbtiles": "^0.12.1",
25
25
  "baconjs": "1.0.1",
26
26
  "bluebird": "3.5.1",
27
- "debug": "3.1.0",
28
27
  "lodash": "^4.17.11",
29
28
  "xml2js": "0.4.19"
30
29
  },
package/src/plugin.js CHANGED
@@ -1,4 +1,3 @@
1
- const debug = require('debug')('signalk-charts-plugin')
2
1
  const Promise = require('bluebird')
3
2
  const _ = require('lodash')
4
3
  const path = require('path')
@@ -25,12 +24,12 @@ module.exports = function(app) {
25
24
  result[provider.identifier] = provider
26
25
  return result
27
26
  }, {})
28
- debug(`Start charts plugin. Chart paths: ${chartPaths.join(', ')}, online charts: ${onlineProviders.length}`)
27
+ app.debug(`Start charts plugin. Chart paths: ${chartPaths.join(', ')}, online charts: ${onlineProviders.length}`)
29
28
 
30
29
  const loadProviders = Promise.mapSeries(chartPaths, chartPath => Charts.findCharts(chartPath))
31
30
  .then(list => _.reduce(list, (result, charts) => _.merge({}, result, charts), {}))
32
31
  return loadProviders.then(charts => {
33
- console.log(`Chart plugin: Found ${_.keys(charts).length} charts from ${chartPaths.join(', ')}`)
32
+ app.debug(`Chart plugin: Found ${_.keys(charts).length} charts from ${chartPaths.join(', ')}`)
34
33
  chartProviders = _.merge({}, charts, onlineProviders)
35
34
  // Do not register routes if plugin has been started once already
36
35
  pluginStarted === false && registerRoutes()
@@ -42,7 +41,6 @@ module.exports = function(app) {
42
41
  }
43
42
 
44
43
  function stop() {
45
- debug("Chart plugin stopped")
46
44
  }
47
45
 
48
46
  function registerRoutes() {
@@ -128,6 +126,12 @@ module.exports = function(app) {
128
126
  minimum: MIN_ZOOM,
129
127
  default: 15,
130
128
  },
129
+ serverType: {
130
+ type: 'string',
131
+ title: 'Server Type',
132
+ default: 'tilelayer',
133
+ enum: ['tilelayer', 'WMS']
134
+ },
131
135
  format: {
132
136
  type: 'string',
133
137
  title: 'Format',
@@ -137,7 +141,17 @@ module.exports = function(app) {
137
141
  url: {
138
142
  type: 'string',
139
143
  title: 'URL',
140
- description: 'Tileset URL containing {z}, {x} and {y} parameters, for example "http://example.org/{z}/{x}/{y}.png"'
144
+ description: 'Map URL (for tilelayer include {z}, {x} and {y} parameters, e.g. "http://example.org/{z}/{x}/{y}.png")'
145
+ },
146
+ layers: {
147
+ type: 'array',
148
+ title: 'Layers',
149
+ description: '(WMS only) ',
150
+ items: {
151
+ title: 'Layer Name',
152
+ description: 'Name of layer to display',
153
+ type: 'string'
154
+ }
141
155
  }
142
156
  }
143
157
  }
@@ -170,10 +184,11 @@ function convertOnlineProviderConfig(provider) {
170
184
  minzoom: Math.min(Math.max(1, provider.minzoom), 19),
171
185
  maxzoom: Math.min(Math.max(1, provider.maxzoom), 19),
172
186
  format: provider.format,
173
- type: 'tilelayer',
174
187
  scale: 'N/A',
175
188
  identifier: id,
176
- tilemapUrl: provider.url
189
+ tilemapUrl: provider.url,
190
+ type: (provider.serverType) ? provider.serverType : 'tilelayer',
191
+ chartLayers: (provider.layers) ? provider.layers : null
177
192
  }
178
193
  }
179
194