@skyvexsoftware/stratos-sdk 0.11.1 → 0.12.0
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.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PluginAuthor, PluginManifest } from "./types/manifest";
|
|
2
|
-
export type { PluginAirline, PluginAirlineAccessor, PluginAuthAccessor, PluginVaApiClient, PluginConfigStore, PluginContext, PluginDatabaseAccessor, PluginIPCRegistrar, PluginLogger, PluginNavigationHelper, PluginPilotUser, PluginServerRegistrar, PluginToastAPI, PluginUIContext, PluginSettingType, PluginSettingOption, PluginSettingDefinition, PluginAvailableSettings, BooleanSettingDef, TextSettingDef, LongtextSettingDef, NumberSettingDef, RangeSettingDef, ListSettingDef, RadioSettingDef, DateSettingDef, JsonSettingDef, } from "./types/context";
|
|
2
|
+
export type { PluginAirline, PluginAirlineAccessor, PluginAuthAccessor, PluginVaApiClient, PluginConfigStore, PluginContext, PluginDatabaseAccessor, PluginIPCRegistrar, PluginLogger, PluginNavigationHelper, PluginPilotUser, PluginServerRegistrar, PluginToastAPI, PluginUIContext, PluginFlightAccessor, PluginFlightLogWriter, PluginFlightLogInput, PluginFlightLogPatch, PluginStartGuard, PluginStartContext, PluginStartDecision, PluginNotifier, PluginToastInput, PluginAlertSound, PluginSettingType, PluginSettingOption, PluginSettingDefinition, PluginAvailableSettings, BooleanSettingDef, TextSettingDef, LongtextSettingDef, NumberSettingDef, RangeSettingDef, ListSettingDef, RadioSettingDef, DateSettingDef, JsonSettingDef, } from "./types/context";
|
|
3
3
|
export type { PluginBackgroundModule, PluginRouteComponent, PluginUIModule, } from "./types/module";
|
|
4
4
|
export { FlightPhase, SimulatorType, EventCategory, } from "./shared-types/simulator";
|
|
5
5
|
export type { BounceData, CapturePoint, FlightData, FlightDataSnapshot, FlightEventPayload, FlightEventsSnapshot, FlightLandingPayload, FlightLogEvent, FlightPhasePayload, FlightPhaseSnapshot, FlightStateDebugInfo, FlightTrends, GateCapture, HistoryReportEntry, LandingAnalysis, LandingAnalysisSnapshot, LandingAnalyzerDebugState, LandingSample, PendingPhaseTransition, SimDataSnapshot, SimulatorStatus, } from "./shared-types/simulator";
|
|
@@ -79,6 +79,8 @@ export type PreflightCheckResult = {
|
|
|
79
79
|
/** Options for startFlight */
|
|
80
80
|
export type StartFlightOptions = {
|
|
81
81
|
forceStart?: boolean;
|
|
82
|
+
/** True when the start was triggered by auto-start (not a manual click). Surfaced to plugin start guards. */
|
|
83
|
+
isAutoStart?: boolean;
|
|
82
84
|
};
|
|
83
85
|
/** Lean subset of stored flight data for recovery prompt in the renderer */
|
|
84
86
|
export type RecoverableFlight = {
|
package/dist/types/context.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* for both background (main process) and UI (renderer) usage.
|
|
6
6
|
*/
|
|
7
7
|
import type { AxiosInstance } from "axios";
|
|
8
|
+
import type { EventCategory, FlightLogEvent, FlightPhasePayload, FlightPhaseSnapshot, FlightLandingPayload, LandingAnalysisSnapshot, SimDataSnapshot } from "../shared-types/simulator";
|
|
9
|
+
import type { FlightManagerPayload, FlightPlan } from "../shared-types/flight-manager";
|
|
8
10
|
/** All supported setting control types */
|
|
9
11
|
export type PluginSettingType = "boolean" | "text" | "longtext" | "number" | "range" | "list" | "radio" | "date" | "json";
|
|
10
12
|
/** Option entry for list and radio settings */
|
|
@@ -171,6 +173,105 @@ export type PluginDatabaseAccessor = {
|
|
|
171
173
|
*/
|
|
172
174
|
open(filename: string): unknown;
|
|
173
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Writer for the authoritative flight log. Backs `ctx.flight.log`.
|
|
178
|
+
*
|
|
179
|
+
* Replaces the rejected pattern of importing core's FlightEventManager and
|
|
180
|
+
* mutating its private `flightLog` array. All mutations are routed through the
|
|
181
|
+
* shell so persistence, the event bus, and the pirep split stay consistent.
|
|
182
|
+
*/
|
|
183
|
+
export type PluginFlightLogWriter = {
|
|
184
|
+
/**
|
|
185
|
+
* Append an event to the flight log. Returns the created event, or null when
|
|
186
|
+
* there is no active tracking session (mirrors `addComment`).
|
|
187
|
+
*/
|
|
188
|
+
add(event: PluginFlightLogInput): Promise<FlightLogEvent | null>;
|
|
189
|
+
/** Remove a previously-added event by id. Returns true if it existed. */
|
|
190
|
+
remove(eventId: string): Promise<boolean>;
|
|
191
|
+
/** Patch an existing event in place. Returns true if it existed. */
|
|
192
|
+
update(eventId: string, patch: PluginFlightLogPatch): Promise<boolean>;
|
|
193
|
+
};
|
|
194
|
+
/** Input for `ctx.flight.log.add`. */
|
|
195
|
+
export type PluginFlightLogInput = {
|
|
196
|
+
category: EventCategory;
|
|
197
|
+
condition: string;
|
|
198
|
+
message: string;
|
|
199
|
+
data?: Record<string, unknown>;
|
|
200
|
+
};
|
|
201
|
+
/** Patch shape for `ctx.flight.log.update`. */
|
|
202
|
+
export type PluginFlightLogPatch = Partial<Pick<PluginFlightLogInput, "category" | "message" | "data">>;
|
|
203
|
+
/**
|
|
204
|
+
* Read/subscribe accessor for live flight state. Backs `ctx.flight`.
|
|
205
|
+
*
|
|
206
|
+
* Reads return serialisable snapshots; subscriptions deliver the same payloads
|
|
207
|
+
* the shell broadcasts over Socket.io. Every `onX` returns an unsubscribe.
|
|
208
|
+
*/
|
|
209
|
+
export type PluginFlightAccessor = {
|
|
210
|
+
/** Current flight-manager state (flight, pending recovery, sim-disconnect). */
|
|
211
|
+
getState(): Promise<FlightManagerPayload>;
|
|
212
|
+
/** Latest simulator data snapshot, or null when no sim is connected. */
|
|
213
|
+
getSnapshot(): Promise<SimDataSnapshot | null>;
|
|
214
|
+
/** Current flight-phase snapshot. */
|
|
215
|
+
getPhase(): Promise<FlightPhaseSnapshot>;
|
|
216
|
+
/** Current landing-analysis snapshot. */
|
|
217
|
+
getLandingReport(): Promise<LandingAnalysisSnapshot>;
|
|
218
|
+
/** Subscribe to flight-manager state changes. Returns an unsubscribe. */
|
|
219
|
+
onUpdate(cb: (state: FlightManagerPayload) => void): () => void;
|
|
220
|
+
/** Subscribe to flight-phase changes. Returns an unsubscribe. */
|
|
221
|
+
onPhaseChange(cb: (payload: FlightPhasePayload) => void): () => void;
|
|
222
|
+
/** Subscribe to live simulator data frames. Returns an unsubscribe. */
|
|
223
|
+
onSimData(cb: (snapshot: SimDataSnapshot) => void): () => void;
|
|
224
|
+
/** Subscribe to landing events (touchdown/bounce/settled). Returns an unsubscribe. */
|
|
225
|
+
onLanding(cb: (payload: FlightLandingPayload) => void): () => void;
|
|
226
|
+
/** Authoritative flight-log writer. */
|
|
227
|
+
log: PluginFlightLogWriter;
|
|
228
|
+
/**
|
|
229
|
+
* Register a guard consulted inside `startFlight` BEFORE the flight is
|
|
230
|
+
* created or persisted. A guard returning `{ allow: false, reason }` vetoes
|
|
231
|
+
* the start (surfaced via the existing preflight-failure path). Guards are
|
|
232
|
+
* fail-open: a throw or timeout (~5s) allows the start with a loud warning.
|
|
233
|
+
* Multiple guards: the first `allow: false` wins. Returns an unsubscribe.
|
|
234
|
+
*/
|
|
235
|
+
registerStartGuard(guard: PluginStartGuard): () => void;
|
|
236
|
+
};
|
|
237
|
+
/** Context handed to a start guard. */
|
|
238
|
+
export type PluginStartContext = {
|
|
239
|
+
plan: FlightPlan;
|
|
240
|
+
snapshot: SimDataSnapshot | null;
|
|
241
|
+
isAutoStart: boolean;
|
|
242
|
+
};
|
|
243
|
+
/** Decision returned by a start guard. */
|
|
244
|
+
export type PluginStartDecision = {
|
|
245
|
+
allow: true;
|
|
246
|
+
} | {
|
|
247
|
+
allow: false;
|
|
248
|
+
reason: string;
|
|
249
|
+
};
|
|
250
|
+
/** Guard run inside `startFlight` before the flight is created/persisted. */
|
|
251
|
+
export type PluginStartGuard = (ctx: PluginStartContext) => PluginStartDecision | Promise<PluginStartDecision>;
|
|
252
|
+
/**
|
|
253
|
+
* Toast + sound surface. Backs `ctx.notify`.
|
|
254
|
+
*
|
|
255
|
+
* Replaces the rejected pattern of `webContents.executeJavaScript` to build
|
|
256
|
+
* DOM toasts and play `new Audio(...)`. The shell owns the DOM and the sound
|
|
257
|
+
* catalogue; the plugin only describes what to show / which sound to play.
|
|
258
|
+
*/
|
|
259
|
+
export type PluginNotifier = {
|
|
260
|
+
/** Show a toast in the renderer. */
|
|
261
|
+
toast(n: PluginToastInput): Promise<void>;
|
|
262
|
+
/** Play a shell-bundled sound by name (no plugin-supplied audio). */
|
|
263
|
+
sound(name: PluginAlertSound): Promise<void>;
|
|
264
|
+
};
|
|
265
|
+
/** Input for `ctx.notify.toast`. */
|
|
266
|
+
export type PluginToastInput = {
|
|
267
|
+
type: "info" | "success" | "warning" | "error";
|
|
268
|
+
title: string;
|
|
269
|
+
message: string;
|
|
270
|
+
durationMs?: number;
|
|
271
|
+
id?: string;
|
|
272
|
+
};
|
|
273
|
+
/** Fixed shell-bundled sound catalogue. No plugin-supplied audio. */
|
|
274
|
+
export type PluginAlertSound = "alert" | "warning" | "error" | "success" | "chime";
|
|
174
275
|
/**
|
|
175
276
|
* Context passed to a plugin's background onStart() function.
|
|
176
277
|
* Provides scoped access to shell infrastructure.
|
|
@@ -190,6 +291,13 @@ export type PluginContext = {
|
|
|
190
291
|
server: PluginServerRegistrar;
|
|
191
292
|
/** SQLite database accessor (files stored in plugin's data directory) */
|
|
192
293
|
database: PluginDatabaseAccessor;
|
|
294
|
+
/**
|
|
295
|
+
* Live flight state: reads, subscriptions, the authoritative flight-log
|
|
296
|
+
* writer, and start guards.
|
|
297
|
+
*/
|
|
298
|
+
flight: PluginFlightAccessor;
|
|
299
|
+
/** Toast + sound surface. */
|
|
300
|
+
notify: PluginNotifier;
|
|
193
301
|
};
|
|
194
302
|
/** Pilot user profile provided by the shell's auth system */
|
|
195
303
|
export type PluginPilotUser = {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { PluginAuthor, PluginManifest } from "./manifest";
|
|
2
|
-
export type { PluginAirline, PluginAirlineAccessor, PluginAuthAccessor, PluginConfigStore, PluginContext, PluginDatabaseAccessor, PluginIPCRegistrar, PluginLogger, PluginNavigationHelper, PluginServerRegistrar, PluginToastAPI, PluginUIContext, } from "./context";
|
|
2
|
+
export type { PluginAirline, PluginAirlineAccessor, PluginAuthAccessor, PluginConfigStore, PluginContext, PluginDatabaseAccessor, PluginIPCRegistrar, PluginLogger, PluginNavigationHelper, PluginServerRegistrar, PluginToastAPI, PluginUIContext, PluginFlightAccessor, PluginFlightLogWriter, PluginFlightLogInput, PluginFlightLogPatch, PluginStartGuard, PluginStartContext, PluginStartDecision, PluginNotifier, PluginToastInput, PluginAlertSound, } from "./context";
|
|
3
3
|
export type { PluginBackgroundModule, PluginRouteComponent, PluginUIModule, } from "./module";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|