@skyvexsoftware/stratos-sdk 0.10.0 → 0.10.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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/shared-types/additional-fields.d.ts +26 -0
- package/dist/shared-types/additional-fields.js +30 -0
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/index.js +1 -0
- package/dist/vite/plugin-config.js +19 -30
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type { PluginBackgroundModule, PluginRouteComponent, PluginUIModule, } fr
|
|
|
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";
|
|
6
6
|
export type { ThemeMode } from "./shared-types/theme";
|
|
7
|
+
export { ADDITIONAL_FIELD_PHASES, toPhaseKey, } from "./shared-types/additional-fields";
|
|
8
|
+
export type { AdditionalFieldsConfig, FieldDelivery, } from "./shared-types/additional-fields";
|
|
7
9
|
export type { FlightPlan, FlightStatus, CurrentFlight, FlightComment, PreflightCheck, PreflightCheckResult, StartFlightOptions, FlightManagerPayload, StartFlightResult, RecoverableFlight, } from "./shared-types/flight-manager";
|
|
8
10
|
export { createPlugin } from "./helpers/createPlugin";
|
|
9
11
|
export { STRATOS_APP_PORT, STRATOS_APP_BASE } from "./helpers/server";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// ── Shared Types ───────────────────────────────────────────────────────
|
|
2
2
|
export { FlightPhase, SimulatorType, EventCategory, } from "./shared-types/simulator";
|
|
3
|
+
export { ADDITIONAL_FIELD_PHASES, toPhaseKey, } from "./shared-types/additional-fields";
|
|
3
4
|
// ── Helper Functions ───────────────────────────────────────────────────
|
|
4
5
|
export { createPlugin } from "./helpers/createPlugin";
|
|
5
6
|
export { STRATOS_APP_PORT, STRATOS_APP_BASE } from "./helpers/server";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FlightPhase } from "./simulator";
|
|
2
|
+
/**
|
|
3
|
+
* Per-field delivery rule. `phases` lists the uppercase flight-phase keys in
|
|
4
|
+
* which the field is appended to position-update ticks; `submission` controls
|
|
5
|
+
* whether the field is included in the `/flights/complete` payload.
|
|
6
|
+
*/
|
|
7
|
+
export type FieldDelivery = {
|
|
8
|
+
phases: string[];
|
|
9
|
+
submission: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Airline-scoped `additionalFields` config: a map keyed by field key, each
|
|
13
|
+
* value a {@link FieldDelivery} rule. A field absent from the map is sent
|
|
14
|
+
* nowhere.
|
|
15
|
+
*/
|
|
16
|
+
export type AdditionalFieldsConfig = Record<string, FieldDelivery>;
|
|
17
|
+
/** The 15 canonical phase keys (uppercase), in flight order. Excludes UNKNOWN. */
|
|
18
|
+
export declare const ADDITIONAL_FIELD_PHASES: readonly ["BOARDING", "PUSH_BACK", "TAXI", "TAKE_OFF", "REJECTED_TAKE_OFF", "CLIMB", "CRUISE", "DESCENT", "APPROACH", "FINAL", "LANDED", "GO_AROUND", "TAXI_IN", "ARRIVED", "DEBOARDING"];
|
|
19
|
+
/**
|
|
20
|
+
* Map a FlightPhase enum value to its uppercase config phase key, or null if it
|
|
21
|
+
* has no column (UNKNOWN, or a missing/undefined phase). Defensive against
|
|
22
|
+
* runtime flight data that arrives before phase detection has populated
|
|
23
|
+
* `phase` — never assume the flight starts in a known phase.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toPhaseKey(phase: FlightPhase | undefined | null): string | null;
|
|
26
|
+
//# sourceMappingURL=additional-fields.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FlightPhase } from "./simulator";
|
|
2
|
+
/** The 15 canonical phase keys (uppercase), in flight order. Excludes UNKNOWN. */
|
|
3
|
+
export const ADDITIONAL_FIELD_PHASES = [
|
|
4
|
+
"BOARDING",
|
|
5
|
+
"PUSH_BACK",
|
|
6
|
+
"TAXI",
|
|
7
|
+
"TAKE_OFF",
|
|
8
|
+
"REJECTED_TAKE_OFF",
|
|
9
|
+
"CLIMB",
|
|
10
|
+
"CRUISE",
|
|
11
|
+
"DESCENT",
|
|
12
|
+
"APPROACH",
|
|
13
|
+
"FINAL",
|
|
14
|
+
"LANDED",
|
|
15
|
+
"GO_AROUND",
|
|
16
|
+
"TAXI_IN",
|
|
17
|
+
"ARRIVED",
|
|
18
|
+
"DEBOARDING",
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Map a FlightPhase enum value to its uppercase config phase key, or null if it
|
|
22
|
+
* has no column (UNKNOWN, or a missing/undefined phase). Defensive against
|
|
23
|
+
* runtime flight data that arrives before phase detection has populated
|
|
24
|
+
* `phase` — never assume the flight starts in a known phase.
|
|
25
|
+
*/
|
|
26
|
+
export function toPhaseKey(phase) {
|
|
27
|
+
if (phase == null || phase === FlightPhase.UNKNOWN)
|
|
28
|
+
return null;
|
|
29
|
+
return phase.toUpperCase();
|
|
30
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { FlightPhase, SimulatorType, EventCategory } from "./simulator";
|
|
2
2
|
export type { BounceData, CapturePoint, FlightData, FlightDataSnapshot, FlightEventPayload, FlightEventsSnapshot, FlightLandingPayload, FlightLogEvent, FlightPhasePayload, FlightPhaseSnapshot, FlightStateDebugInfo, FlightTrends, GateCapture, HistoryReportEntry, LandingAnalysis, LandingAnalysisSnapshot, LandingAnalyzerDebugState, PendingPhaseTransition, SimDataSnapshot, SimulatorStatus, } from "./simulator";
|
|
3
3
|
export type { ThemeMode } from "./theme";
|
|
4
|
+
export { ADDITIONAL_FIELD_PHASES, toPhaseKey } from "./additional-fields";
|
|
5
|
+
export type { AdditionalFieldsConfig, FieldDelivery, } from "./additional-fields";
|
|
4
6
|
export type { FlightPlan, FlightStatus, CurrentFlight, FlightComment, PreflightCheck, PreflightCheckResult, StartFlightOptions, FlightManagerPayload, StartFlightResult, RecoverableFlight, } from "./flight-manager";
|
|
5
7
|
export { SOCKET_EVENTS } from "./socket-events";
|
|
6
8
|
export type { ConnectionState, LogEntryPayload, NotificationPayload, ProtocolUrlPayload, SimulatorDataPayload, SimulatorStatusPayload, SocketEventName, SystemMetricsPayload, } from "./socket-events";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { FlightPhase, SimulatorType, EventCategory } from "./simulator";
|
|
2
|
+
export { ADDITIONAL_FIELD_PHASES, toPhaseKey } from "./additional-fields";
|
|
2
3
|
// ── Socket.io Event Catalog ──────────────────────────────────────────────
|
|
3
4
|
export { SOCKET_EVENTS } from "./socket-events";
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as fs from "fs";
|
|
19
19
|
import * as path from "path";
|
|
20
|
+
import { builtinModules } from "module";
|
|
20
21
|
import { UI_EXTERNALS } from "./externals.js";
|
|
21
22
|
import { stratosExternals } from "./stratos-externals.js";
|
|
22
23
|
import { serveExternals } from "./serve-externals.js";
|
|
@@ -26,35 +27,16 @@ import { hmrBaseRewrite } from "./hmr-base-rewrite.js";
|
|
|
26
27
|
import { reactShimAliases } from "./react-shim.js";
|
|
27
28
|
/** Modules external in background builds (available in Electron main process) */
|
|
28
29
|
const BG_EXTERNALS = ["electron", "socket.io-client"];
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"fs",
|
|
40
|
-
"http",
|
|
41
|
-
"https",
|
|
42
|
-
"module",
|
|
43
|
-
"net",
|
|
44
|
-
"os",
|
|
45
|
-
"path",
|
|
46
|
-
"perf_hooks",
|
|
47
|
-
"querystring",
|
|
48
|
-
"readline",
|
|
49
|
-
"stream",
|
|
50
|
-
"tls",
|
|
51
|
-
"url",
|
|
52
|
-
"util",
|
|
53
|
-
"v8",
|
|
54
|
-
"vm",
|
|
55
|
-
"worker_threads",
|
|
56
|
-
"zlib",
|
|
57
|
-
];
|
|
30
|
+
/**
|
|
31
|
+
* Node.js built-in modules to externalize in background builds. Derived from
|
|
32
|
+
* Node's own registry (with both bare `fs` and prefixed `node:fs` forms) so it
|
|
33
|
+
* can never drift — the old hand-maintained list omitted modules like
|
|
34
|
+
* `async_hooks`, which then got browser-stubbed and broke at runtime.
|
|
35
|
+
*/
|
|
36
|
+
const NODE_BUILTINS = new Set([
|
|
37
|
+
...builtinModules,
|
|
38
|
+
...builtinModules.map((m) => `node:${m}`),
|
|
39
|
+
]);
|
|
58
40
|
/**
|
|
59
41
|
* Rollup plugin that copies plugin.json and assets/ to dist/ after the build.
|
|
60
42
|
* Only runs during the UI build (not background) to avoid duplicate copies.
|
|
@@ -211,6 +193,13 @@ export function backgroundBuildOptions(pluginDir, entry) {
|
|
|
211
193
|
alias: [
|
|
212
194
|
{ find: /^@\//, replacement: path.resolve(pluginDir, "src") + "/" },
|
|
213
195
|
],
|
|
196
|
+
// Resolve dependencies for Node, not the browser. Vite's default
|
|
197
|
+
// resolution is browser-first, which picks the "browser" build of
|
|
198
|
+
// packages like `ws` (whose browser shim has no WebSocketServer). The
|
|
199
|
+
// background module runs in the Electron main process, so it needs the
|
|
200
|
+
// Node build of everything it bundles.
|
|
201
|
+
conditions: ["node", "module", "import", "default"],
|
|
202
|
+
mainFields: ["module", "jsnext:main", "main"],
|
|
214
203
|
},
|
|
215
204
|
build: {
|
|
216
205
|
outDir: path.resolve(pluginDir, "dist/background"),
|
|
@@ -228,7 +217,7 @@ export function backgroundBuildOptions(pluginDir, entry) {
|
|
|
228
217
|
return true;
|
|
229
218
|
if (BG_EXTERNALS.some((ext) => id === ext || id.startsWith(`${ext}/`)))
|
|
230
219
|
return true;
|
|
231
|
-
if (NODE_BUILTINS.
|
|
220
|
+
if (NODE_BUILTINS.has(id))
|
|
232
221
|
return true;
|
|
233
222
|
return false;
|
|
234
223
|
},
|