@signalk/tracks-plugin 3.0.1 → 3.0.2
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/README.md +7 -4
- package/dist/asyncTrackStore.d.ts +62 -0
- package/dist/asyncTrackStore.test.d.ts +1 -0
- package/dist/harness.test-utils.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +449 -12160
- package/dist/index.js.map +1 -1
- package/dist/sqliteStore.d.ts +11 -1
- package/dist/store.d.ts +1 -1
- package/dist/trackStoreProtocol.d.ts +38 -0
- package/dist/trackStoreWorker.d.ts +1 -0
- package/dist/trackStoreWorker.js +11717 -0
- package/dist/trackStoreWorker.js.map +1 -0
- package/dist/utils-OGjP1B0D.js +482 -0
- package/dist/utils-OGjP1B0D.js.map +1 -0
- package/dist/workerTestSetup.d.ts +2 -0
- package/docs/history-and-storage.md +56 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -217,10 +217,13 @@ npm run format # prettier --write
|
|
|
217
217
|
|
|
218
218
|
`npm run test:e2e` packs the plugin, installs it into a throwaway config directory, boots a real
|
|
219
219
|
Signal K server against it and feeds positions as deltas — so it covers plugin loading, route
|
|
220
|
-
mounting and the delta path, none of which the unit suite can. It needs a
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
mounting and the delta path, none of which the unit suite can. It needs a server to boot: a built
|
|
221
|
+
checkout, by default at `~/dev/xxx_signalk-server`, or an installed package's
|
|
222
|
+
`node_modules/signalk-server`, named with `SIGNALK_SERVER_DIR`. A second tier installs a real
|
|
223
|
+
history provider (signalk-questdb) into that server and exercises the reconciliation through it; it
|
|
224
|
+
skips itself if no QuestDB is reachable at `QUESTDB_URL`, unless `QUESTDB_REQUIRED` is set. CI runs
|
|
225
|
+
both tiers against the oldest supported signalk-server release and the latest, with QuestDB as a
|
|
226
|
+
service container.
|
|
224
227
|
|
|
225
228
|
The package is ESM only and targets Node >= 22.5.0, the release that added `node:sqlite`. ESM alone
|
|
226
229
|
would only need 20.19, the first release in which the Signal K server's `require()`-based plugin
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TrackStore } from './store.js';
|
|
2
|
+
import { SqliteStoreConfig } from './sqliteStore.js';
|
|
3
|
+
import { Debug, Context, LatLngTuple, TimeWindow, TrackParams } from './types.js';
|
|
4
|
+
import { TrackQuery } from './timeWindow.js';
|
|
5
|
+
interface Limits {
|
|
6
|
+
maxItems?: number;
|
|
7
|
+
maxBytes?: number;
|
|
8
|
+
}
|
|
9
|
+
/** One database owner; the server never waits synchronously for storage. */
|
|
10
|
+
export declare class AsyncTrackStore implements TrackStore {
|
|
11
|
+
private queue;
|
|
12
|
+
private active;
|
|
13
|
+
private names;
|
|
14
|
+
private sequence;
|
|
15
|
+
private pendingBytes;
|
|
16
|
+
private maxItems;
|
|
17
|
+
private maxBytes;
|
|
18
|
+
private onError;
|
|
19
|
+
private debug;
|
|
20
|
+
private initialized;
|
|
21
|
+
private closing;
|
|
22
|
+
private failed;
|
|
23
|
+
private statusError;
|
|
24
|
+
private overloaded;
|
|
25
|
+
private dropped;
|
|
26
|
+
private gapStarted;
|
|
27
|
+
private writeFailed;
|
|
28
|
+
private readonly admitted;
|
|
29
|
+
private readonly resolution;
|
|
30
|
+
private readonly onResume;
|
|
31
|
+
readonly ready: Promise<void>;
|
|
32
|
+
private resolveReady;
|
|
33
|
+
private rejectReady;
|
|
34
|
+
private worker;
|
|
35
|
+
private exited;
|
|
36
|
+
private closeAcknowledged;
|
|
37
|
+
private scheduled;
|
|
38
|
+
private closePromise;
|
|
39
|
+
constructor(config: SqliteStoreConfig, debug: Debug, onError?: (error: Error) => void, limits?: Limits, onResume?: (message: string) => void);
|
|
40
|
+
private report;
|
|
41
|
+
private resumeIfDrained;
|
|
42
|
+
private fail;
|
|
43
|
+
private enqueue;
|
|
44
|
+
private schedule;
|
|
45
|
+
private pump;
|
|
46
|
+
private receive;
|
|
47
|
+
newPosition(context: Context, position: LatLngTuple, timestamp?: number): void;
|
|
48
|
+
recordName(context: Context, name: string, timestamp?: number): void;
|
|
49
|
+
nameFor(context: Context): string | undefined;
|
|
50
|
+
initialTrack(context: Context, track: LatLngTuple[], timestamps?: number[]): void;
|
|
51
|
+
prune(maxAge: number, keep?: Context): void;
|
|
52
|
+
get(context: Context, window?: TimeWindow): Promise<LatLngTuple[]>;
|
|
53
|
+
getTimed(context: Context, window?: TimeWindow): Promise<import('./types.js').TimedPosition[]>;
|
|
54
|
+
getAllTracks(query?: TrackQuery): Promise<{
|
|
55
|
+
context: string;
|
|
56
|
+
track: LatLngTuple[];
|
|
57
|
+
}[]>;
|
|
58
|
+
getFilteredTracks(params: TrackParams, selfPosition?: LatLngTuple, _debug?: Debug, query?: TrackQuery): Promise<import('./types.js').TrackCollection>;
|
|
59
|
+
getFilteredTimedTracks(params: TrackParams, selfPosition?: LatLngTuple, _debug?: Debug, query?: TrackQuery): Promise<import('./types.js').TimedTrackCollection>;
|
|
60
|
+
close(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -33,7 +33,7 @@ export interface TestHarness {
|
|
|
33
33
|
setSelfPosition: (position: LatLngTuple | undefined) => void;
|
|
34
34
|
/** The own vessel's navigation.state, as reported by `getSelfPath`. */
|
|
35
35
|
setSelfState: (state: string | undefined) => void;
|
|
36
|
-
stop: () => void
|
|
36
|
+
stop: () => Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Start the same plugin instance again, with the config it was built with.
|
|
39
39
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -94,10 +94,10 @@ interface App {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
interface Plugin {
|
|
97
|
-
start: (c: TracksPluginConfig) => void
|
|
97
|
+
start: (c: TracksPluginConfig) => void | Promise<void>;
|
|
98
98
|
/** Enable on install, without waiting for a visit to the plugin config page. */
|
|
99
99
|
enabledByDefault: boolean;
|
|
100
|
-
stop: () => void
|
|
100
|
+
stop: () => Promise<void>;
|
|
101
101
|
signalKApiRoutes: (r: Router) => Router;
|
|
102
102
|
id: string;
|
|
103
103
|
name: string;
|