@signalk/tracks-plugin 3.0.0 → 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 +488 -12171
- package/dist/index.js.map +1 -1
- package/dist/sqliteStore.d.ts +17 -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/dist/sqliteStore.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TrackQuery } from './timeWindow.js';
|
|
2
2
|
import { TrackStore } from './store.js';
|
|
3
3
|
import { Context, Debug, LatLngTuple, TimedPosition, TimedTrackCollection, TimeWindow, TrackCollection, TrackParams } from './types.js';
|
|
4
|
+
export declare class TransactionStateError extends Error {
|
|
5
|
+
}
|
|
4
6
|
export interface SqliteStoreConfig {
|
|
5
7
|
/** Absolute path to the database file, or ':memory:'. */
|
|
6
8
|
file: string;
|
|
@@ -43,6 +45,12 @@ export declare class SqliteTrackStore implements TrackStore {
|
|
|
43
45
|
private readonly debug;
|
|
44
46
|
/** Timestamp of the last position stored per context, for throttling. */
|
|
45
47
|
private readonly lastStored;
|
|
48
|
+
/**
|
|
49
|
+
* The stored name per context, dated by its newest report. A name arrives
|
|
50
|
+
* with every position, so a repeat is answered here instead of committing a
|
|
51
|
+
* row that has not changed.
|
|
52
|
+
*/
|
|
53
|
+
private readonly lastName;
|
|
46
54
|
constructor(config: SqliteStoreConfig, debug: Debug);
|
|
47
55
|
newPosition(context: Context, position: LatLngTuple, timestamp?: number): void;
|
|
48
56
|
private store;
|
|
@@ -96,7 +104,15 @@ export declare class SqliteTrackStore implements TrackStore {
|
|
|
96
104
|
segments(context: Context, window?: TimeWindow): LatLngTuple[][];
|
|
97
105
|
recordName(context: Context, name: string, timestamp?: number): void;
|
|
98
106
|
nameFor(context: Context): string | undefined;
|
|
99
|
-
prune(maxAge: number, keep?: Context): void;
|
|
107
|
+
prune(maxAge: number, keep?: Context, now?: number): void;
|
|
108
|
+
/** Worker startup snapshot; queries and name lookups must not open a second database. */
|
|
109
|
+
storedNames(): {
|
|
110
|
+
context: string;
|
|
111
|
+
name: string;
|
|
112
|
+
timestamp: number;
|
|
113
|
+
}[];
|
|
114
|
+
/** A failed batch stops writes in its worker; reads remain available. */
|
|
115
|
+
transaction(write: () => void): void;
|
|
100
116
|
close(): void;
|
|
101
117
|
/** Unsigned round-trip check, used by the tests. */
|
|
102
118
|
cellIdsFor(context: Context): bigint[];
|
package/dist/store.d.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SqliteTrackStore } from './sqliteStore.js';
|
|
2
|
+
export type StoreMethod = 'newPosition' | 'recordName' | 'initialTrack' | 'prune' | 'get' | 'getTimed' | 'getAllTracks' | 'getFilteredTracks' | 'getFilteredTimedTracks' | 'close';
|
|
3
|
+
export type Operation = {
|
|
4
|
+
[K in StoreMethod]: {
|
|
5
|
+
id: number;
|
|
6
|
+
method: K;
|
|
7
|
+
args: Parameters<SqliteTrackStore[K]>;
|
|
8
|
+
};
|
|
9
|
+
}[StoreMethod];
|
|
10
|
+
export interface StoredName {
|
|
11
|
+
context: string;
|
|
12
|
+
name: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
}
|
|
15
|
+
export type WorkerMessage = {
|
|
16
|
+
kind: 'ready';
|
|
17
|
+
names: StoredName[];
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'debug';
|
|
20
|
+
text: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'fatal';
|
|
23
|
+
error: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'result';
|
|
26
|
+
results: {
|
|
27
|
+
id: number;
|
|
28
|
+
value?: unknown;
|
|
29
|
+
error?: string;
|
|
30
|
+
writeFailed?: boolean;
|
|
31
|
+
selfPositionUnavailable?: boolean;
|
|
32
|
+
name?: {
|
|
33
|
+
context: string;
|
|
34
|
+
value: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
names?: string[];
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|