@signalk/tracks-plugin 3.0.0-beta.0 → 3.0.0-beta.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.
@@ -30,6 +30,24 @@ export declare function parseTrackQuery(query: Record<string, unknown>, now?: nu
30
30
  * the first and last so the track keeps its extent.
31
31
  */
32
32
  export declare function thin(points: TimedPosition[], resolution: number | undefined): TimedPosition[];
33
+ /**
34
+ * Thin to at most `maxPoints`, widening the spacing until the budget fits.
35
+ *
36
+ * A budget, not a fidelity contract: the caller has said how many points it can
37
+ * afford to transfer and draw, whatever shape the track is. Returns the
38
+ * resolution actually applied so the response can report it — a client that is
39
+ * given 29 points instead of the 546 it would otherwise have received should be
40
+ * able to see the spacing that produced them.
41
+ *
42
+ * Widening by doubling from the span-derived estimate rather than binary
43
+ * searching: `thin` keeps the first point and the last unconditionally, so the
44
+ * count is not a clean function of the spacing and an exact solve would be
45
+ * false precision. Two or three passes settle it in practice.
46
+ */
47
+ export declare function thinToBudget(points: TimedPosition[], maxPoints: number, resolution: number | undefined): {
48
+ points: TimedPosition[];
49
+ resolution: number | undefined;
50
+ };
33
51
  /**
34
52
  * Split points into segments wherever recording stopped for longer than `gap`.
35
53
  *
@@ -15,13 +15,15 @@ export type TrackBoundingBox = [number, number, number, number];
15
15
  /**
16
16
  * A request as the server hands it to a provider.
17
17
  *
18
- * Not every field is honoured here. `maxPoints`, `simplify`, `epsilon` and
19
- * `properties` are accepted by the API and ignored by this provider: it serves
20
- * positions, and has no co-recorded values to attach or geometry simplifier to
21
- * run. A caller gets the full, unsimplified track for the window it asked for,
22
- * which is a superset of what it requested rather than a wrong answer. The
23
- * response echoes `resolution` when one was requested, so a client can tell a
24
- * thinned track from a full one.
18
+ * Not every field is honoured here. `simplify`, `epsilon` and `properties` are
19
+ * accepted by the API and ignored by this provider: it serves positions, and
20
+ * has no co-recorded values to attach or geometry simplifier to run. Geometry
21
+ * comes back unsimplified, which is a superset of what such a request asked for
22
+ * rather than a wrong answer.
23
+ *
24
+ * `resolution` and `maxPoints` are both applied, and the response reports the
25
+ * spacing actually used — which is not always the one asked for, since a
26
+ * budget widens it.
25
27
  *
26
28
  * Simplification and co-recorded properties are tracked separately; see
27
29
  * SignalK/tracks.
package/dist/types.d.ts CHANGED
@@ -48,6 +48,16 @@ export type QueryParameters = Record<string, unknown>;
48
48
  export interface TrackParams {
49
49
  bbox: GeoBounds | null;
50
50
  radius: number | null;
51
+ /**
52
+ * Match a track on *any* position rather than its last.
53
+ *
54
+ * The v1 routes answer "vessels near here now", so they match the last
55
+ * position — a vessel that has left is no longer near. The v2 Track API asks
56
+ * a different question, "tracks that passed through this box within the
57
+ * window", and its contract says a vessel that crossed an hour ago and has
58
+ * since left still matches. Same filter, two questions.
59
+ */
60
+ intersects?: boolean;
51
61
  }
52
62
  export interface Debug {
53
63
  (...args: unknown[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/tracks-plugin",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Plugin to keep track of tracks of vessels",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,9 +12,15 @@
12
12
  "//main": "Signal K resolves an installed plugin by directory. Node's CJS directory resolution and the server's esm-resolve fallback both read `main`, not `exports`, so dropping this makes the plugin unloadable.",
13
13
  "main": "./dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
+ "//files": "app-icon.svg ships alongside dist because `files` is an allowlist: the app store probes the declared signalk.appIcon path inside the published tarball, so an icon left out here 404s and the plugin falls back to a placeholder.",
15
16
  "files": [
16
- "dist"
17
+ "dist",
18
+ "app-icon.svg"
17
19
  ],
20
+ "signalk": {
21
+ "displayName": "Tracks",
22
+ "appIcon": "app-icon.svg"
23
+ },
18
24
  "keywords": [
19
25
  "signalk-node-server-plugin",
20
26
  "signalk-category-utility"