@ingissa/navcore-react-native 1.0.7 → 1.0.9
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/dist/index.d.mts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +233 -0
- package/dist/index.mjs +223 -0
- package/package.json +7 -15
- package/dist/core/src/NavCore.d.ts +0 -142
- package/dist/core/src/NavCore.d.ts.map +0 -1
- package/dist/core/src/NavCore.js +0 -390
- package/dist/core/src/bearing/BearingEngine.d.ts +0 -24
- package/dist/core/src/bearing/BearingEngine.d.ts.map +0 -1
- package/dist/core/src/bearing/BearingEngine.js +0 -50
- package/dist/core/src/constants.d.ts +0 -34
- package/dist/core/src/constants.d.ts.map +0 -1
- package/dist/core/src/constants.js +0 -41
- package/dist/core/src/corridor/DeviationDetector.d.ts +0 -33
- package/dist/core/src/corridor/DeviationDetector.d.ts.map +0 -1
- package/dist/core/src/corridor/DeviationDetector.js +0 -83
- package/dist/core/src/corridor/DynamicCorridor.d.ts +0 -13
- package/dist/core/src/corridor/DynamicCorridor.d.ts.map +0 -1
- package/dist/core/src/corridor/DynamicCorridor.js +0 -26
- package/dist/core/src/dead-reckoning/DeadReckoning.d.ts +0 -35
- package/dist/core/src/dead-reckoning/DeadReckoning.d.ts.map +0 -1
- package/dist/core/src/dead-reckoning/DeadReckoning.js +0 -49
- package/dist/core/src/directions/DirectionsProvider.d.ts +0 -70
- package/dist/core/src/directions/DirectionsProvider.d.ts.map +0 -1
- package/dist/core/src/directions/DirectionsProvider.js +0 -7
- package/dist/core/src/directions/OSRMDirectionsProvider.d.ts +0 -26
- package/dist/core/src/directions/OSRMDirectionsProvider.d.ts.map +0 -1
- package/dist/core/src/directions/OSRMDirectionsProvider.js +0 -90
- package/dist/core/src/directions/OpenRouteServiceProvider.d.ts +0 -30
- package/dist/core/src/directions/OpenRouteServiceProvider.d.ts.map +0 -1
- package/dist/core/src/directions/OpenRouteServiceProvider.js +0 -111
- package/dist/core/src/directions/ValhallaDirectionsProvider.d.ts +0 -33
- package/dist/core/src/directions/ValhallaDirectionsProvider.d.ts.map +0 -1
- package/dist/core/src/directions/ValhallaDirectionsProvider.js +0 -155
- package/dist/core/src/eta/ETAEngine.d.ts +0 -61
- package/dist/core/src/eta/ETAEngine.d.ts.map +0 -1
- package/dist/core/src/eta/ETAEngine.js +0 -74
- package/dist/core/src/features.d.ts +0 -76
- package/dist/core/src/features.d.ts.map +0 -1
- package/dist/core/src/features.js +0 -76
- package/dist/core/src/geo/bearing.d.ts +0 -11
- package/dist/core/src/geo/bearing.d.ts.map +0 -1
- package/dist/core/src/geo/bearing.js +0 -25
- package/dist/core/src/geo/cumulative.d.ts +0 -9
- package/dist/core/src/geo/cumulative.d.ts.map +0 -1
- package/dist/core/src/geo/cumulative.js +0 -20
- package/dist/core/src/geo/haversine.d.ts +0 -13
- package/dist/core/src/geo/haversine.d.ts.map +0 -1
- package/dist/core/src/geo/haversine.js +0 -39
- package/dist/core/src/geo/projection.d.ts +0 -7
- package/dist/core/src/geo/projection.d.ts.map +0 -1
- package/dist/core/src/geo/projection.js +0 -17
- package/dist/core/src/geofencing/GeofencingEngine.d.ts +0 -93
- package/dist/core/src/geofencing/GeofencingEngine.d.ts.map +0 -1
- package/dist/core/src/geofencing/GeofencingEngine.js +0 -154
- package/dist/core/src/index.d.ts +0 -66
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/index.js +0 -62
- package/dist/core/src/kalman/KalmanFilter2D.d.ts +0 -46
- package/dist/core/src/kalman/KalmanFilter2D.d.ts.map +0 -1
- package/dist/core/src/kalman/KalmanFilter2D.js +0 -77
- package/dist/core/src/license/LicenseManager.d.ts +0 -40
- package/dist/core/src/license/LicenseManager.d.ts.map +0 -1
- package/dist/core/src/license/LicenseManager.js +0 -119
- package/dist/core/src/license/verifyP256Signature.d.ts +0 -2
- package/dist/core/src/license/verifyP256Signature.d.ts.map +0 -1
- package/dist/core/src/license/verifyP256Signature.js +0 -26
- package/dist/core/src/off-route/NavigationFSM.d.ts +0 -42
- package/dist/core/src/off-route/NavigationFSM.d.ts.map +0 -1
- package/dist/core/src/off-route/NavigationFSM.js +0 -56
- package/dist/core/src/off-route/OffRouteFSM.d.ts +0 -70
- package/dist/core/src/off-route/OffRouteFSM.d.ts.map +0 -1
- package/dist/core/src/off-route/OffRouteFSM.js +0 -151
- package/dist/core/src/predictor/RouteOffsetPredictor.d.ts +0 -24
- package/dist/core/src/predictor/RouteOffsetPredictor.d.ts.map +0 -1
- package/dist/core/src/predictor/RouteOffsetPredictor.js +0 -55
- package/dist/core/src/progress/InstructionEditor.d.ts +0 -77
- package/dist/core/src/progress/InstructionEditor.d.ts.map +0 -1
- package/dist/core/src/progress/InstructionEditor.js +0 -151
- package/dist/core/src/progress/InstructionResolver.d.ts +0 -25
- package/dist/core/src/progress/InstructionResolver.d.ts.map +0 -1
- package/dist/core/src/progress/InstructionResolver.js +0 -78
- package/dist/core/src/progress/ProgressTracker.d.ts +0 -12
- package/dist/core/src/progress/ProgressTracker.d.ts.map +0 -1
- package/dist/core/src/progress/ProgressTracker.js +0 -22
- package/dist/core/src/renderer/MapRendererAdapter.d.ts +0 -72
- package/dist/core/src/renderer/MapRendererAdapter.d.ts.map +0 -1
- package/dist/core/src/renderer/MapRendererAdapter.js +0 -19
- package/dist/core/src/route-builder/CustomRouteBuilder.d.ts +0 -83
- package/dist/core/src/route-builder/CustomRouteBuilder.d.ts.map +0 -1
- package/dist/core/src/route-builder/CustomRouteBuilder.js +0 -160
- package/dist/core/src/route-plan/RoutePlan.d.ts +0 -38
- package/dist/core/src/route-plan/RoutePlan.d.ts.map +0 -1
- package/dist/core/src/route-plan/RoutePlan.js +0 -102
- package/dist/core/src/session/NavigationSession.d.ts +0 -81
- package/dist/core/src/session/NavigationSession.d.ts.map +0 -1
- package/dist/core/src/session/NavigationSession.js +0 -115
- package/dist/core/src/snapper/ParallelRoadResolver.d.ts +0 -86
- package/dist/core/src/snapper/ParallelRoadResolver.d.ts.map +0 -1
- package/dist/core/src/snapper/ParallelRoadResolver.js +0 -83
- package/dist/core/src/snapper/RouteSnapper.d.ts +0 -38
- package/dist/core/src/snapper/RouteSnapper.d.ts.map +0 -1
- package/dist/core/src/snapper/RouteSnapper.js +0 -80
- package/dist/core/src/voice/VoiceTriggerEngine.d.ts +0 -80
- package/dist/core/src/voice/VoiceTriggerEngine.d.ts.map +0 -1
- package/dist/core/src/voice/VoiceTriggerEngine.js +0 -108
- package/dist/react-native/src/NavCoreProvider.d.ts +0 -33
- package/dist/react-native/src/NavCoreProvider.d.ts.map +0 -1
- package/dist/react-native/src/NavCoreProvider.js +0 -41
- package/dist/react-native/src/index.d.ts +0 -10
- package/dist/react-native/src/index.d.ts.map +0 -1
- package/dist/react-native/src/index.js +0 -8
- package/dist/react-native/src/useNavCore.d.ts +0 -60
- package/dist/react-native/src/useNavCore.d.ts.map +0 -1
- package/dist/react-native/src/useNavCore.js +0 -119
- package/dist/react-native/src/useNavSelectors.d.ts +0 -42
- package/dist/react-native/src/useNavSelectors.d.ts.map +0 -1
- package/dist/react-native/src/useNavSelectors.js +0 -103
- package/src/NavCoreProvider.tsx +0 -59
- package/src/index.ts +0 -18
- package/src/useNavCore.ts +0 -208
- package/src/useNavSelectors.ts +0 -143
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GeofencingEngine
|
|
3
|
-
*
|
|
4
|
-
* Circular and polygon geofences — zero server dependency.
|
|
5
|
-
* Uses haversine distance for circles and ray-casting for polygons.
|
|
6
|
-
*
|
|
7
|
-
* FEATURE: GEOFENCING
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const geo = new GeofencingEngine({ dwellThresholdMs: 5000 });
|
|
12
|
-
* geo.addCircle('school-zone', 'School Zone', [2.347, 48.859], 50, { speedLimit: 30 });
|
|
13
|
-
* geo.addPolygon('exam-area', 'Exam District', [[2.34, 48.85], [2.36, 48.85], [2.36, 48.87], [2.34, 48.87]]);
|
|
14
|
-
*
|
|
15
|
-
* engine.on('update', ({ snappedCoord }) => {
|
|
16
|
-
* const events = geo.update(snappedCoord);
|
|
17
|
-
* for (const evt of events) {
|
|
18
|
-
* // evt.name is the human-readable zone name
|
|
19
|
-
* console.log(`${evt.type}: ${evt.name} (${evt.id})`);
|
|
20
|
-
* }
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
import type { Coordinate } from '../geo/haversine';
|
|
25
|
-
export type GeofenceType = 'circle' | 'polygon';
|
|
26
|
-
export type GeofenceEventType = 'enter' | 'exit' | 'dwell';
|
|
27
|
-
export interface GeofenceEvent {
|
|
28
|
-
/** Geofence ID that triggered the event */
|
|
29
|
-
id: string;
|
|
30
|
-
/** Human-readable name of the geofence */
|
|
31
|
-
name: string;
|
|
32
|
-
type: GeofenceEventType;
|
|
33
|
-
/** Coordinate that triggered the event */
|
|
34
|
-
coord: Coordinate;
|
|
35
|
-
/** Milliseconds spent inside (for dwell events) */
|
|
36
|
-
dwellMs?: number;
|
|
37
|
-
/** Custom metadata passed at creation */
|
|
38
|
-
meta?: unknown;
|
|
39
|
-
}
|
|
40
|
-
export interface ZoneDefinition {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
type: 'circle' | 'polygon';
|
|
44
|
-
center?: Coordinate;
|
|
45
|
-
radiusMeters?: number;
|
|
46
|
-
coords?: Coordinate[];
|
|
47
|
-
meta?: unknown;
|
|
48
|
-
}
|
|
49
|
-
export interface GeofencingOptions {
|
|
50
|
-
/**
|
|
51
|
-
* Milliseconds a vehicle must remain inside a geofence before a 'dwell' event fires.
|
|
52
|
-
* Default: 10000ms (10 seconds).
|
|
53
|
-
*/
|
|
54
|
-
dwellThresholdMs?: number;
|
|
55
|
-
/** Initial zones to register on creation */
|
|
56
|
-
zones?: ZoneDefinition[];
|
|
57
|
-
/** Callback for all geofence events */
|
|
58
|
-
onEvent?: (event: GeofenceEvent) => void;
|
|
59
|
-
}
|
|
60
|
-
export declare class GeofencingEngine {
|
|
61
|
-
private fences;
|
|
62
|
-
private states;
|
|
63
|
-
private readonly options;
|
|
64
|
-
constructor(options?: GeofencingOptions);
|
|
65
|
-
/** Add a circular geofence. Returns the ID. */
|
|
66
|
-
addCircle(id: string, name: string, center: Coordinate, radiusM: number, meta?: unknown): string;
|
|
67
|
-
/**
|
|
68
|
-
* Add a polygon geofence. Coords are [lng, lat] pairs.
|
|
69
|
-
* The polygon is auto-closed (first == last not required).
|
|
70
|
-
*/
|
|
71
|
-
addPolygon(id: string, name: string, coords: Coordinate[], meta?: unknown): string;
|
|
72
|
-
/** Remove a geofence by ID */
|
|
73
|
-
remove(id: string): void;
|
|
74
|
-
/** Remove all geofences */
|
|
75
|
-
clear(): void;
|
|
76
|
-
/** List all registered geofence IDs */
|
|
77
|
-
listIds(): string[];
|
|
78
|
-
/**
|
|
79
|
-
* Feed the current coordinate and receive a (possibly empty) list of events.
|
|
80
|
-
* Call this on every NavCore state update.
|
|
81
|
-
*/
|
|
82
|
-
update(coord: Coordinate): GeofenceEvent[];
|
|
83
|
-
/** Check if a coordinate is currently inside a named geofence */
|
|
84
|
-
isInside(id: string, coord: Coordinate): boolean;
|
|
85
|
-
private contains;
|
|
86
|
-
/**
|
|
87
|
-
* Ray-casting point-in-polygon algorithm.
|
|
88
|
-
* Works in [lng, lat] space (sufficient for small areas; use projected
|
|
89
|
-
* coords for very large polygons spanning many degrees).
|
|
90
|
-
*/
|
|
91
|
-
private pointInPolygon;
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=GeofencingEngine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GeofencingEngine.d.ts","sourceRoot":"","sources":["../../../../../core/src/geofencing/GeofencingEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;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,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM;IAMhG;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM;IAOlF,8BAA8B;IAC9B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKxB,2BAA2B;IAC3B,KAAK,IAAI,IAAI;IAKb,uCAAuC;IACvC,OAAO,IAAI,MAAM,EAAE;IAMnB;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,EAAE;IA2C1C,iEAAiE;IACjE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO;IAQhD,OAAO,CAAC,QAAQ;IAWhB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAkBvB"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GeofencingEngine
|
|
3
|
-
*
|
|
4
|
-
* Circular and polygon geofences — zero server dependency.
|
|
5
|
-
* Uses haversine distance for circles and ray-casting for polygons.
|
|
6
|
-
*
|
|
7
|
-
* FEATURE: GEOFENCING
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const geo = new GeofencingEngine({ dwellThresholdMs: 5000 });
|
|
12
|
-
* geo.addCircle('school-zone', 'School Zone', [2.347, 48.859], 50, { speedLimit: 30 });
|
|
13
|
-
* geo.addPolygon('exam-area', 'Exam District', [[2.34, 48.85], [2.36, 48.85], [2.36, 48.87], [2.34, 48.87]]);
|
|
14
|
-
*
|
|
15
|
-
* engine.on('update', ({ snappedCoord }) => {
|
|
16
|
-
* const events = geo.update(snappedCoord);
|
|
17
|
-
* for (const evt of events) {
|
|
18
|
-
* // evt.name is the human-readable zone name
|
|
19
|
-
* console.log(`${evt.type}: ${evt.name} (${evt.id})`);
|
|
20
|
-
* }
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
import { haversineDistance } from '../geo/haversine';
|
|
25
|
-
const DEFAULTS = {
|
|
26
|
-
dwellThresholdMs: 10000,
|
|
27
|
-
};
|
|
28
|
-
export class GeofencingEngine {
|
|
29
|
-
constructor(options) {
|
|
30
|
-
this.fences = new Map();
|
|
31
|
-
this.states = new Map();
|
|
32
|
-
this.options = { ...DEFAULTS, ...options };
|
|
33
|
-
if (this.options.zones) {
|
|
34
|
-
for (const z of this.options.zones) {
|
|
35
|
-
if (z.type === 'circle' && z.center && z.radiusMeters) {
|
|
36
|
-
this.addCircle(z.id, z.name, z.center, z.radiusMeters, z.meta);
|
|
37
|
-
}
|
|
38
|
-
else if (z.type === 'polygon' && z.coords) {
|
|
39
|
-
this.addPolygon(z.id, z.name, z.coords, z.meta);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// ── Registration ────────────────────────────────────────────────────────────
|
|
45
|
-
/** Add a circular geofence. Returns the ID. */
|
|
46
|
-
addCircle(id, name, center, radiusM, meta) {
|
|
47
|
-
this.fences.set(id, { kind: 'circle', id, name, center, radiusM, meta });
|
|
48
|
-
this.states.set(id, { inside: false, enteredAtMs: null });
|
|
49
|
-
return id;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Add a polygon geofence. Coords are [lng, lat] pairs.
|
|
53
|
-
* The polygon is auto-closed (first == last not required).
|
|
54
|
-
*/
|
|
55
|
-
addPolygon(id, name, coords, meta) {
|
|
56
|
-
if (coords.length < 3)
|
|
57
|
-
throw new Error('[Geofencing] Polygon requires at least 3 coordinates');
|
|
58
|
-
this.fences.set(id, { kind: 'polygon', id, name, coords, meta });
|
|
59
|
-
this.states.set(id, { inside: false, enteredAtMs: null });
|
|
60
|
-
return id;
|
|
61
|
-
}
|
|
62
|
-
/** Remove a geofence by ID */
|
|
63
|
-
remove(id) {
|
|
64
|
-
this.fences.delete(id);
|
|
65
|
-
this.states.delete(id);
|
|
66
|
-
}
|
|
67
|
-
/** Remove all geofences */
|
|
68
|
-
clear() {
|
|
69
|
-
this.fences.clear();
|
|
70
|
-
this.states.clear();
|
|
71
|
-
}
|
|
72
|
-
/** List all registered geofence IDs */
|
|
73
|
-
listIds() {
|
|
74
|
-
return Array.from(this.fences.keys());
|
|
75
|
-
}
|
|
76
|
-
// ── Update ──────────────────────────────────────────────────────────────────
|
|
77
|
-
/**
|
|
78
|
-
* Feed the current coordinate and receive a (possibly empty) list of events.
|
|
79
|
-
* Call this on every NavCore state update.
|
|
80
|
-
*/
|
|
81
|
-
update(coord) {
|
|
82
|
-
if (!coord)
|
|
83
|
-
return [];
|
|
84
|
-
const events = [];
|
|
85
|
-
const now = Date.now();
|
|
86
|
-
for (const [id, fence] of this.fences) {
|
|
87
|
-
const state = this.states.get(id);
|
|
88
|
-
const isNowInside = this.contains(fence, coord);
|
|
89
|
-
if (!state.inside && isNowInside) {
|
|
90
|
-
// Enter
|
|
91
|
-
state.inside = true;
|
|
92
|
-
state.enteredAtMs = now;
|
|
93
|
-
const event = { id, name: fence.name, type: 'enter', coord, meta: fence.meta };
|
|
94
|
-
events.push(event);
|
|
95
|
-
this.options.onEvent?.(event);
|
|
96
|
-
}
|
|
97
|
-
else if (state.inside && !isNowInside) {
|
|
98
|
-
// Exit
|
|
99
|
-
state.inside = false;
|
|
100
|
-
const dwellMs = state.enteredAtMs ? now - state.enteredAtMs : 0;
|
|
101
|
-
state.enteredAtMs = null;
|
|
102
|
-
const event = { id, name: fence.name, type: 'exit', coord, dwellMs, meta: fence.meta };
|
|
103
|
-
events.push(event);
|
|
104
|
-
this.options.onEvent?.(event);
|
|
105
|
-
}
|
|
106
|
-
else if (state.inside && state.enteredAtMs !== null) {
|
|
107
|
-
// Dwell check
|
|
108
|
-
const dwellMs = now - state.enteredAtMs;
|
|
109
|
-
if (dwellMs >= this.options.dwellThresholdMs) {
|
|
110
|
-
const event = { id, name: fence.name, type: 'dwell', coord, dwellMs, meta: fence.meta };
|
|
111
|
-
events.push(event);
|
|
112
|
-
this.options.onEvent?.(event);
|
|
113
|
-
// Reset so dwell fires every threshold interval
|
|
114
|
-
state.enteredAtMs = now;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return events;
|
|
119
|
-
}
|
|
120
|
-
/** Check if a coordinate is currently inside a named geofence */
|
|
121
|
-
isInside(id, coord) {
|
|
122
|
-
const fence = this.fences.get(id);
|
|
123
|
-
if (!fence)
|
|
124
|
-
return false;
|
|
125
|
-
return this.contains(fence, coord);
|
|
126
|
-
}
|
|
127
|
-
// ── Geometry ────────────────────────────────────────────────────────────────
|
|
128
|
-
contains(fence, coord) {
|
|
129
|
-
if (fence.kind === 'circle') {
|
|
130
|
-
const distM = haversineDistance(coord[1], coord[0], fence.center[1], fence.center[0]);
|
|
131
|
-
return distM <= fence.radiusM;
|
|
132
|
-
}
|
|
133
|
-
return this.pointInPolygon(coord, fence.coords);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Ray-casting point-in-polygon algorithm.
|
|
137
|
-
* Works in [lng, lat] space (sufficient for small areas; use projected
|
|
138
|
-
* coords for very large polygons spanning many degrees).
|
|
139
|
-
*/
|
|
140
|
-
pointInPolygon(point, polygon) {
|
|
141
|
-
const [px, py] = point;
|
|
142
|
-
let inside = false;
|
|
143
|
-
const n = polygon.length;
|
|
144
|
-
for (let i = 0, j = n - 1; i < n; j = i++) {
|
|
145
|
-
const [xi, yi] = polygon[i];
|
|
146
|
-
const [xj, yj] = polygon[j];
|
|
147
|
-
const intersects = yi > py !== yj > py &&
|
|
148
|
-
px < ((xj - xi) * (py - yi)) / (yj - yi) + xi;
|
|
149
|
-
if (intersects)
|
|
150
|
-
inside = !inside;
|
|
151
|
-
}
|
|
152
|
-
return inside;
|
|
153
|
-
}
|
|
154
|
-
}
|
package/dist/core/src/index.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @navcore/core — Navigation Engine
|
|
3
|
-
*
|
|
4
|
-
* Navigation logic is pure TypeScript; license verification includes a portable P-256 fallback.
|
|
5
|
-
* Works in Node.js, browsers, React Native, and CI/CD.
|
|
6
|
-
*
|
|
7
|
-
* Tier model:
|
|
8
|
-
* CORE — free / MIT. Import from '@ingissa/navcore-core/core'
|
|
9
|
-
* PRO — commercial. Import from '@ingissa/navcore-core/pro'
|
|
10
|
-
* Full engine (NavCore class) — available from '@ingissa/navcore-core'
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
export { haversineDistance, destinationPoint, getBearingBetweenPoints as geoGetBearing } from './geo/haversine';
|
|
15
|
-
export { normalizeAngle, getBearingBetweenPoints, interpolatePoint } from './geo/bearing';
|
|
16
|
-
export { projectPointOnSegment } from './geo/projection';
|
|
17
|
-
export { buildForwardCumulativeDistances, buildReverseCumulativeDistances } from './geo/cumulative';
|
|
18
|
-
export { KalmanFilter2D, kalmanUpdate2D } from './kalman/KalmanFilter2D';
|
|
19
|
-
export type { Kalman2DState } from './kalman/KalmanFilter2D';
|
|
20
|
-
export { RouteSnapper } from './snapper/RouteSnapper';
|
|
21
|
-
export type { SnapResult, SnapperOptions } from './snapper/RouteSnapper';
|
|
22
|
-
export { ParallelRoadResolver } from './snapper/ParallelRoadResolver';
|
|
23
|
-
export type { SnapCandidate, ResolvedCandidate, ParallelRoadResolverOptions, } from './snapper/ParallelRoadResolver';
|
|
24
|
-
export { DeadReckoningEngine, computeDeadReckoningOnRoute } from './dead-reckoning/DeadReckoning';
|
|
25
|
-
export { DeviationDetector } from './corridor/DeviationDetector';
|
|
26
|
-
export { calculateDynamicCorridor } from './corridor/DynamicCorridor';
|
|
27
|
-
export { calculateRobustBearing, blendBearing, getSpeedAdaptiveAlpha, applyBearingSmoothing, } from './bearing/BearingEngine';
|
|
28
|
-
export { validateProgressUpdate } from './progress/ProgressTracker';
|
|
29
|
-
export { resolveNextInstruction } from './progress/InstructionResolver';
|
|
30
|
-
export type { NavInstruction } from './progress/InstructionResolver';
|
|
31
|
-
export { InstructionEditor } from './progress/InstructionEditor';
|
|
32
|
-
export type { RichInstruction, InstructionType } from './progress/InstructionEditor';
|
|
33
|
-
export { advancePredictor, applyGpsCorrection, pointAtOffset } from './predictor/RouteOffsetPredictor';
|
|
34
|
-
export { NavigationFSM } from './off-route/NavigationFSM';
|
|
35
|
-
export type { NavLifecycleState, LifecycleEvent, LifecycleContext } from './off-route/NavigationFSM';
|
|
36
|
-
export { OffRouteFSM } from './off-route/OffRouteFSM';
|
|
37
|
-
export type { OffRouteState, OffRouteEvent, OffRouteContext, TempRoute, RejoinTarget } from './off-route/OffRouteFSM';
|
|
38
|
-
export { CustomRouteBuilder } from './route-builder/CustomRouteBuilder';
|
|
39
|
-
export type { CustomWaypoint, WaypointOptions, BuildOptions } from './route-builder/CustomRouteBuilder';
|
|
40
|
-
export type { DirectionsProvider, DirectionsOptions, DirectionsResult, DirectionsLeg, DirectionsStep, DirectionsManeuver, } from './directions/DirectionsProvider';
|
|
41
|
-
export { OSRMDirectionsProvider } from './directions/OSRMDirectionsProvider';
|
|
42
|
-
export type { OSRMConfig } from './directions/OSRMDirectionsProvider';
|
|
43
|
-
export { ValhallaDirectionsProvider } from './directions/ValhallaDirectionsProvider';
|
|
44
|
-
export type { ValhallaConfig, ValhallaCostingModel } from './directions/ValhallaDirectionsProvider';
|
|
45
|
-
export { OpenRouteServiceProvider } from './directions/OpenRouteServiceProvider';
|
|
46
|
-
export type { ORSConfig, ORSProfile } from './directions/OpenRouteServiceProvider';
|
|
47
|
-
export { createRoutePlan } from './route-plan/RoutePlan';
|
|
48
|
-
export type { RoutePlan, CreateRoutePlanOptions } from './route-plan/RoutePlan';
|
|
49
|
-
export { NavigationSession, createNavigationSession } from './session/NavigationSession';
|
|
50
|
-
export type { NavigationSessionOptions, NavigationSessionEventMap, NavigationRequest, OriginDestinationNavigationRequest, CoordinatesNavigationRequest, } from './session/NavigationSession';
|
|
51
|
-
export type { MapRendererAdapter, RouteStyle, VehicleStyle, CameraOptions, } from './renderer/MapRendererAdapter';
|
|
52
|
-
export { VoiceTriggerEngine } from './voice/VoiceTriggerEngine';
|
|
53
|
-
export type { VoiceCue, VoicePriority, VoiceTriggerOptions } from './voice/VoiceTriggerEngine';
|
|
54
|
-
export { ETAEngine } from './eta/ETAEngine';
|
|
55
|
-
export type { ETAResult, ETAOptions } from './eta/ETAEngine';
|
|
56
|
-
export { GeofencingEngine } from './geofencing/GeofencingEngine';
|
|
57
|
-
export type { GeofenceEvent, GeofenceEventType, GeofenceType, GeofencingOptions, ZoneDefinition, } from './geofencing/GeofencingEngine';
|
|
58
|
-
export { LicenseManager } from './license/LicenseManager';
|
|
59
|
-
export type { LicenseStatus, LicensePayload } from './license/LicenseManager';
|
|
60
|
-
export * as Constants from './constants';
|
|
61
|
-
export { FEATURES } from './features';
|
|
62
|
-
export type { FeatureKey } from './features';
|
|
63
|
-
export { NavCore } from './NavCore';
|
|
64
|
-
export type { NavCoreOptions, NavGpsUpdate, NavCoreState } from './NavCore';
|
|
65
|
-
export type { Coordinate } from './geo/haversine';
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,uBAAuB,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAGpG,OAAO,EAAE,cAAc,EAAE,cAA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E,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG9E,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG5E,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/core/src/index.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @navcore/core — Navigation Engine
|
|
3
|
-
*
|
|
4
|
-
* Navigation logic is pure TypeScript; license verification includes a portable P-256 fallback.
|
|
5
|
-
* Works in Node.js, browsers, React Native, and CI/CD.
|
|
6
|
-
*
|
|
7
|
-
* Tier model:
|
|
8
|
-
* CORE — free / MIT. Import from '@ingissa/navcore-core/core'
|
|
9
|
-
* PRO — commercial. Import from '@ingissa/navcore-core/pro'
|
|
10
|
-
* Full engine (NavCore class) — available from '@ingissa/navcore-core'
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
// ── CORE — Geo Utilities (free) ───────────────────────────────────────────────
|
|
15
|
-
export { haversineDistance, destinationPoint, getBearingBetweenPoints as geoGetBearing } from './geo/haversine';
|
|
16
|
-
export { normalizeAngle, getBearingBetweenPoints, interpolatePoint } from './geo/bearing';
|
|
17
|
-
export { projectPointOnSegment } from './geo/projection';
|
|
18
|
-
export { buildForwardCumulativeDistances, buildReverseCumulativeDistances } from './geo/cumulative';
|
|
19
|
-
// ── CORE — Kalman Filter (free) ───────────────────────────────────────────────
|
|
20
|
-
export { KalmanFilter2D, kalmanUpdate2D } from './kalman/KalmanFilter2D';
|
|
21
|
-
// ── CORE — Basic Route Snapper (free) ─────────────────────────────────────────
|
|
22
|
-
export { RouteSnapper } from './snapper/RouteSnapper';
|
|
23
|
-
// ── PRO — Parallel Road Resolver (license required) ───────────────────────────
|
|
24
|
-
export { ParallelRoadResolver } from './snapper/ParallelRoadResolver';
|
|
25
|
-
// ── PRO — Dead Reckoning (license required) ───────────────────────────────────
|
|
26
|
-
export { DeadReckoningEngine, computeDeadReckoningOnRoute } from './dead-reckoning/DeadReckoning';
|
|
27
|
-
// ── PRO — Corridor & Deviation (license required) ─────────────────────────────
|
|
28
|
-
export { DeviationDetector } from './corridor/DeviationDetector';
|
|
29
|
-
export { calculateDynamicCorridor } from './corridor/DynamicCorridor';
|
|
30
|
-
// ── PRO — Bearing Engine (license required) ───────────────────────────────────
|
|
31
|
-
export { calculateRobustBearing, blendBearing, getSpeedAdaptiveAlpha, applyBearingSmoothing, } from './bearing/BearingEngine';
|
|
32
|
-
// ── PRO — Progress & Instructions (license required) ──────────────────────────
|
|
33
|
-
export { validateProgressUpdate } from './progress/ProgressTracker';
|
|
34
|
-
export { resolveNextInstruction } from './progress/InstructionResolver';
|
|
35
|
-
// ── PRO — Instruction Editor (license required) ───────────────────────────────
|
|
36
|
-
export { InstructionEditor } from './progress/InstructionEditor';
|
|
37
|
-
// ── PRO — Route Offset Predictor (license required) ───────────────────────────
|
|
38
|
-
export { advancePredictor, applyGpsCorrection, pointAtOffset } from './predictor/RouteOffsetPredictor';
|
|
39
|
-
// ── PRO — Navigation FSM (license required) ───────────────────────────────────
|
|
40
|
-
export { NavigationFSM } from './off-route/NavigationFSM';
|
|
41
|
-
export { OffRouteFSM } from './off-route/OffRouteFSM';
|
|
42
|
-
// ── CORE — Route Builder (free) ───────────────────────────────────────────────
|
|
43
|
-
export { CustomRouteBuilder } from './route-builder/CustomRouteBuilder';
|
|
44
|
-
export { OSRMDirectionsProvider } from './directions/OSRMDirectionsProvider';
|
|
45
|
-
export { ValhallaDirectionsProvider } from './directions/ValhallaDirectionsProvider';
|
|
46
|
-
export { OpenRouteServiceProvider } from './directions/OpenRouteServiceProvider';
|
|
47
|
-
// ── Route Plan — provider response → navigation-ready engine input ───────────
|
|
48
|
-
export { createRoutePlan } from './route-plan/RoutePlan';
|
|
49
|
-
// ── Navigation Session — ergonomic provider → engine workflow ───────────────
|
|
50
|
-
export { NavigationSession, createNavigationSession } from './session/NavigationSession';
|
|
51
|
-
// ── PRO — Voice Trigger Engine (license required) ─────────────────────────────
|
|
52
|
-
export { VoiceTriggerEngine } from './voice/VoiceTriggerEngine';
|
|
53
|
-
// ── PRO — ETA Engine (license required) ───────────────────────────────────────
|
|
54
|
-
export { ETAEngine } from './eta/ETAEngine';
|
|
55
|
-
// ── PRO — Geofencing Engine (license required) ────────────────────────────────
|
|
56
|
-
export { GeofencingEngine } from './geofencing/GeofencingEngine';
|
|
57
|
-
export { LicenseManager } from './license/LicenseManager';
|
|
58
|
-
// ── CORE — Constants & Features (free) ────────────────────────────────────────
|
|
59
|
-
export * as Constants from './constants';
|
|
60
|
-
export { FEATURES } from './features';
|
|
61
|
-
// ── Main Orchestrator (full engine — license-gated internally) ────────────────
|
|
62
|
-
export { NavCore } from './NavCore';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module 1: KalmanFilter2D
|
|
3
|
-
* GPS noise reduction using a 2D Kalman filter.
|
|
4
|
-
* ZERO dependencies — pure math.
|
|
5
|
-
*/
|
|
6
|
-
export interface Kalman2DState {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
vx: number;
|
|
10
|
-
vy: number;
|
|
11
|
-
P: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Perform a single Kalman update step.
|
|
15
|
-
*
|
|
16
|
-
* @param state Current state (mutated in place for perf)
|
|
17
|
-
* @param measX Measured longitude
|
|
18
|
-
* @param measY Measured latitude
|
|
19
|
-
* @param accuracy GPS accuracy in metres (used to scale R)
|
|
20
|
-
* @param dt Time delta in seconds
|
|
21
|
-
* @param Q Process noise (default 0.00001)
|
|
22
|
-
* @param rBase Measurement noise base (default 0.00005)
|
|
23
|
-
* @returns Updated state
|
|
24
|
-
*/
|
|
25
|
-
export declare function kalmanUpdate2D(state: Kalman2DState, measX: number, measY: number, accuracy: number, dt: number, Q?: number, rBase?: number): Kalman2DState;
|
|
26
|
-
/**
|
|
27
|
-
* KalmanFilter2D class wrapper for stateful usage.
|
|
28
|
-
*/
|
|
29
|
-
export declare class KalmanFilter2D {
|
|
30
|
-
private state;
|
|
31
|
-
private readonly Q;
|
|
32
|
-
private readonly rBase;
|
|
33
|
-
private lastTimestamp;
|
|
34
|
-
constructor(Q?: number, rBase?: number);
|
|
35
|
-
/** Initialize with a known position */
|
|
36
|
-
init(lng: number, lat: number, timestamp: number): void;
|
|
37
|
-
/** Process a GPS measurement, returns filtered [lng, lat] */
|
|
38
|
-
update(lng: number, lat: number, accuracy: number, timestamp: number): [number, number];
|
|
39
|
-
/** Get current filtered position */
|
|
40
|
-
getPosition(): [number, number];
|
|
41
|
-
/** Get the internal state for inspection/serialization */
|
|
42
|
-
getState(): Kalman2DState;
|
|
43
|
-
/** Reset the filter */
|
|
44
|
-
reset(): void;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=KalmanFilter2D.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KalmanFilter2D.d.ts","sourceRoot":"","sources":["../../../../../core/src/kalman/KalmanFilter2D.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,CAAC,GAAE,MAAgB,EACnB,KAAK,GAAE,MAAgB,GACtB,aAAa,CAyBf;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAa;gBAEtB,CAAC,GAAE,MAAgB,EAAE,KAAK,GAAE,MAAgB;IAMxD,uCAAuC;IACvC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAKvD,6DAA6D;IAC7D,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAavF,oCAAoC;IACpC,WAAW,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAI/B,0DAA0D;IAC1D,QAAQ,IAAI,aAAa;IAIzB,uBAAuB;IACvB,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module 1: KalmanFilter2D
|
|
3
|
-
* GPS noise reduction using a 2D Kalman filter.
|
|
4
|
-
* ZERO dependencies — pure math.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Perform a single Kalman update step.
|
|
8
|
-
*
|
|
9
|
-
* @param state Current state (mutated in place for perf)
|
|
10
|
-
* @param measX Measured longitude
|
|
11
|
-
* @param measY Measured latitude
|
|
12
|
-
* @param accuracy GPS accuracy in metres (used to scale R)
|
|
13
|
-
* @param dt Time delta in seconds
|
|
14
|
-
* @param Q Process noise (default 0.00001)
|
|
15
|
-
* @param rBase Measurement noise base (default 0.00005)
|
|
16
|
-
* @returns Updated state
|
|
17
|
-
*/
|
|
18
|
-
export function kalmanUpdate2D(state, measX, measY, accuracy, dt, Q = 0.00001, rBase = 0.00005) {
|
|
19
|
-
// Predict
|
|
20
|
-
state.x += state.vx * dt;
|
|
21
|
-
state.y += state.vy * dt;
|
|
22
|
-
state.P += Q;
|
|
23
|
-
// Measurement noise: higher accuracy = lower R
|
|
24
|
-
const R = rBase * Math.max(1, accuracy / 5);
|
|
25
|
-
// Update
|
|
26
|
-
const K = state.P / (state.P + R);
|
|
27
|
-
const innovX = measX - state.x;
|
|
28
|
-
const innovY = measY - state.y;
|
|
29
|
-
state.x += K * innovX;
|
|
30
|
-
state.y += K * innovY;
|
|
31
|
-
if (dt > 0) {
|
|
32
|
-
state.vx = innovX / dt * K;
|
|
33
|
-
state.vy = innovY / dt * K;
|
|
34
|
-
}
|
|
35
|
-
state.P = (1 - K) * state.P;
|
|
36
|
-
return state;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* KalmanFilter2D class wrapper for stateful usage.
|
|
40
|
-
*/
|
|
41
|
-
export class KalmanFilter2D {
|
|
42
|
-
constructor(Q = 0.00001, rBase = 0.00005) {
|
|
43
|
-
this.lastTimestamp = 0;
|
|
44
|
-
this.Q = Q;
|
|
45
|
-
this.rBase = rBase;
|
|
46
|
-
this.state = { x: 0, y: 0, vx: 0, vy: 0, P: 1 };
|
|
47
|
-
}
|
|
48
|
-
/** Initialize with a known position */
|
|
49
|
-
init(lng, lat, timestamp) {
|
|
50
|
-
this.state = { x: lng, y: lat, vx: 0, vy: 0, P: 1 };
|
|
51
|
-
this.lastTimestamp = timestamp;
|
|
52
|
-
}
|
|
53
|
-
/** Process a GPS measurement, returns filtered [lng, lat] */
|
|
54
|
-
update(lng, lat, accuracy, timestamp) {
|
|
55
|
-
if (this.lastTimestamp === 0) {
|
|
56
|
-
this.init(lng, lat, timestamp);
|
|
57
|
-
return [lng, lat];
|
|
58
|
-
}
|
|
59
|
-
const dt = Math.max(0.001, (timestamp - this.lastTimestamp) / 1000);
|
|
60
|
-
this.lastTimestamp = timestamp;
|
|
61
|
-
kalmanUpdate2D(this.state, lng, lat, accuracy, dt, this.Q, this.rBase);
|
|
62
|
-
return [this.state.x, this.state.y];
|
|
63
|
-
}
|
|
64
|
-
/** Get current filtered position */
|
|
65
|
-
getPosition() {
|
|
66
|
-
return [this.state.x, this.state.y];
|
|
67
|
-
}
|
|
68
|
-
/** Get the internal state for inspection/serialization */
|
|
69
|
-
getState() {
|
|
70
|
-
return { ...this.state };
|
|
71
|
-
}
|
|
72
|
-
/** Reset the filter */
|
|
73
|
-
reset() {
|
|
74
|
-
this.state = { x: 0, y: 0, vx: 0, vy: 0, P: 1 };
|
|
75
|
-
this.lastTimestamp = 0;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LicenseManager — Handles offline asymmetric license verification
|
|
3
|
-
* using P-256 + granular feature licensing.
|
|
4
|
-
*
|
|
5
|
-
* Matching nav-sdk/src/shared/LicenseManager.ts contract exactly.
|
|
6
|
-
*/
|
|
7
|
-
import { FeatureKey } from '../features';
|
|
8
|
-
export type LicenseStatus = 'VALID' | 'INVALID' | 'EXPIRED' | 'MISSING';
|
|
9
|
-
export interface LicensePayload {
|
|
10
|
-
/** Legacy tier — 'pro' grants all features ('*') */
|
|
11
|
-
t?: 'core' | 'pro';
|
|
12
|
-
/** Expiration timestamp (ms since epoch) */
|
|
13
|
-
exp: number;
|
|
14
|
-
/** Bundle ID / domain */
|
|
15
|
-
bid: string;
|
|
16
|
-
/** Granular feature flags */
|
|
17
|
-
f?: string[];
|
|
18
|
-
}
|
|
19
|
-
export declare class LicenseManager {
|
|
20
|
-
private status;
|
|
21
|
-
private payload;
|
|
22
|
-
private enabledFeatures;
|
|
23
|
-
private warnedFeatures;
|
|
24
|
-
private isDev;
|
|
25
|
-
private static PUBLIC_KEY_RAW;
|
|
26
|
-
constructor(licenseKey?: string, isDev?: boolean);
|
|
27
|
-
validate(key: string): Promise<LicenseStatus>;
|
|
28
|
-
private extractFeatures;
|
|
29
|
-
hasFeature(feature: FeatureKey): boolean;
|
|
30
|
-
/** Warn once per feature when a consumer tries to use a gated feature. */
|
|
31
|
-
warnOnce(feature: FeatureKey): void;
|
|
32
|
-
/** Returns true if the license grants the full Pro tier (all features). */
|
|
33
|
-
isProEnabled(): boolean;
|
|
34
|
-
isAIEnabled(): boolean;
|
|
35
|
-
getStatus(): LicenseStatus;
|
|
36
|
-
getPayload(): LicensePayload | null;
|
|
37
|
-
getEnabledFeatures(): string[];
|
|
38
|
-
private verifySignature;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=LicenseManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../../../core/src/license/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAY,UAAU,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACnB,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;CACd;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,KAAK,CAAkB;IAG/B,OAAO,CAAC,MAAM,CAAC,cAAc,CACgE;gBAEjF,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IASnC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA4C1D,OAAO,CAAC,eAAe;IAiBhB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO;IAO/C,0EAA0E;IACnE,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAU1C,2EAA2E;IACpE,YAAY,IAAI,OAAO;IAKvB,WAAW,IAAI,OAAO;IAItB,SAAS,IAAI,aAAa;IAI1B,UAAU,IAAI,cAAc,GAAG,IAAI;IAInC,kBAAkB,IAAI,MAAM,EAAE;YAMvB,eAAe;CAe9B"}
|