@skyvexsoftware/stratos-sdk 0.1.7 → 0.1.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.
@@ -12,8 +12,8 @@ import type { PluginBackgroundModule } from "../types/module";
12
12
  * async onStart(ctx) {
13
13
  * ctx.logger.info("MyPlugin", "Starting up...");
14
14
  * },
15
- * async onStop() {
16
- * // cleanup
15
+ * async onStop(ctx) {
16
+ * ctx.logger.info("MyPlugin", "Shutting down...");
17
17
  * },
18
18
  * });
19
19
  * ```
@@ -11,8 +11,8 @@
11
11
  * async onStart(ctx) {
12
12
  * ctx.logger.info("MyPlugin", "Starting up...");
13
13
  * },
14
- * async onStop() {
15
- * // cleanup
14
+ * async onStop(ctx) {
15
+ * ctx.logger.info("MyPlugin", "Shutting down...");
16
16
  * },
17
17
  * });
18
18
  * ```
@@ -24,9 +24,6 @@ export function createPlugin(module) {
24
24
  if (typeof module.onStop !== "function") {
25
25
  throw new Error("Plugin module must export an onStop function");
26
26
  }
27
- if (module.onResume !== undefined && typeof module.onResume !== "function") {
28
- throw new Error("Plugin module onResume must be a function if provided");
29
- }
30
27
  return module;
31
28
  }
32
29
  //# sourceMappingURL=createPlugin.js.map
@@ -1,14 +1,10 @@
1
1
  /**
2
2
  * Access the shell's auth state from a plugin component.
3
- *
4
- * @example
5
- * ```tsx
6
- * const { isAuthenticated, token, user } = useShellAuth();
7
- * ```
3
+ * Must be used within a PluginShellProvider (provided by the shell).
8
4
  */
9
5
  export declare function useShellAuth(): {
10
6
  isAuthenticated: boolean;
11
7
  token: string | null;
12
- user: unknown;
8
+ user: import("..").PluginPilotUser | null;
13
9
  };
14
10
  //# sourceMappingURL=useShellAuth.d.ts.map
@@ -1,11 +1,7 @@
1
1
  import { usePluginContext } from "./context";
2
2
  /**
3
3
  * Access the shell's auth state from a plugin component.
4
- *
5
- * @example
6
- * ```tsx
7
- * const { isAuthenticated, token, user } = useShellAuth();
8
- * ```
4
+ * Must be used within a PluginShellProvider (provided by the shell).
9
5
  */
10
6
  export function useShellAuth() {
11
7
  return usePluginContext().auth;
@@ -1,11 +1,6 @@
1
1
  /**
2
2
  * Access the shell's config store from a plugin component.
3
- *
4
- * @example
5
- * ```tsx
6
- * const config = useShellConfig();
7
- * const value = config.get<string>("myKey", "default");
8
- * ```
3
+ * Must be used within a PluginShellProvider (provided by the shell).
9
4
  */
10
5
  export declare function useShellConfig(): {
11
6
  get<T>(key: string): T | undefined;
@@ -1,12 +1,7 @@
1
1
  import { usePluginContext } from "./context";
2
2
  /**
3
3
  * Access the shell's config store from a plugin component.
4
- *
5
- * @example
6
- * ```tsx
7
- * const config = useShellConfig();
8
- * const value = config.get<string>("myKey", "default");
9
- * ```
4
+ * Must be used within a PluginShellProvider (provided by the shell).
10
5
  */
11
6
  export function useShellConfig() {
12
7
  return usePluginContext().config;
@@ -1,12 +1,6 @@
1
1
  /**
2
2
  * Access the shell's navigation helpers from a plugin component.
3
- *
4
- * @example
5
- * ```tsx
6
- * const nav = useShellNavigation();
7
- * nav.navigateTo("settings");
8
- * nav.navigateToPlugin("flight-tracking", "history");
9
- * ```
3
+ * Must be used within a PluginShellProvider (provided by the shell).
10
4
  */
11
5
  export declare function useShellNavigation(): import("..").PluginNavigationHelper;
12
6
  //# sourceMappingURL=useShellNavigation.d.ts.map
@@ -1,13 +1,7 @@
1
1
  import { usePluginContext } from "./context";
2
2
  /**
3
3
  * Access the shell's navigation helpers from a plugin component.
4
- *
5
- * @example
6
- * ```tsx
7
- * const nav = useShellNavigation();
8
- * nav.navigateTo("settings");
9
- * nav.navigateToPlugin("flight-tracking", "history");
10
- * ```
4
+ * Must be used within a PluginShellProvider (provided by the shell).
11
5
  */
12
6
  export function useShellNavigation() {
13
7
  return usePluginContext().navigation;
@@ -1,12 +1,6 @@
1
1
  /**
2
2
  * Access the shell's toast/notification API from a plugin component.
3
- *
4
- * @example
5
- * ```tsx
6
- * const toast = useShellToast();
7
- * toast.success("Flight saved!");
8
- * toast.error("Connection lost");
9
- * ```
3
+ * Must be used within a PluginShellProvider (provided by the shell).
10
4
  */
11
5
  export declare function useShellToast(): import("..").PluginToastAPI;
12
6
  //# sourceMappingURL=useShellToast.d.ts.map
@@ -1,13 +1,7 @@
1
1
  import { usePluginContext } from "./context";
2
2
  /**
3
3
  * Access the shell's toast/notification API from a plugin component.
4
- *
5
- * @example
6
- * ```tsx
7
- * const toast = useShellToast();
8
- * toast.success("Flight saved!");
9
- * toast.error("Connection lost");
10
- * ```
4
+ * Must be used within a PluginShellProvider (provided by the shell).
11
5
  */
12
6
  export function useShellToast() {
13
7
  return usePluginContext().toast;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { PluginAuthor, PluginManifest } from "./types/manifest";
2
- export type { PluginAuthAccessor, PluginConfigStore, PluginContext, PluginDatabaseAccessor, PluginIPCRegistrar, PluginLogger, PluginNavigationHelper, PluginServerRegistrar, PluginToastAPI, PluginUIContext, PluginSettingType, PluginSettingOption, PluginSettingDefinition, PluginAvailableSettings, BooleanSettingDef, TextSettingDef, LongtextSettingDef, NumberSettingDef, RangeSettingDef, ListSettingDef, RadioSettingDef, DateSettingDef, JsonSettingDef, } from "./types/context";
2
+ export type { PluginAuthAccessor, 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";
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, HistoryReportEntry, LandingAnalysis, LandingAnalysisSnapshot, LandingAnalyzerDebugState, LandingSample, PendingPhaseTransition, SimDataSnapshot, SimulatorStatus, } from "./shared-types/simulator";
@@ -144,6 +144,18 @@ export type PluginContext = {
144
144
  /** SQLite database accessor (files stored in plugin's data directory) */
145
145
  database: PluginDatabaseAccessor;
146
146
  };
147
+ /** Pilot user profile provided by the shell's auth system */
148
+ export type PluginPilotUser = {
149
+ dbID: number;
150
+ pilotID: string;
151
+ firstName: string;
152
+ lastName: string;
153
+ email: string;
154
+ rank: string;
155
+ rankLevel: number;
156
+ rankImage: string;
157
+ avatar: string;
158
+ };
147
159
  /** Navigation helper for plugin UI components */
148
160
  export type PluginNavigationHelper = {
149
161
  /** Navigate to a route within this plugin */
@@ -169,11 +181,11 @@ export type PluginToastAPI = {
169
181
  export type PluginUIContext = {
170
182
  /** The plugin's unique ID */
171
183
  pluginId: string;
172
- /** Auth hooks (useAuth pattern) */
184
+ /** Auth state from the shell */
173
185
  auth: {
174
186
  isAuthenticated: boolean;
175
187
  token: string | null;
176
- user: unknown;
188
+ user: PluginPilotUser | null;
177
189
  };
178
190
  /** Current airline info (from Stratos API) */
179
191
  airline?: {
@@ -13,9 +13,7 @@ export type PluginBackgroundModule = {
13
13
  /** Called during shell startup after auth is initialized */
14
14
  onStart(ctx: PluginContext): Promise<void>;
15
15
  /** Called during shell shutdown for graceful teardown */
16
- onStop(): Promise<void>;
17
- /** Optional: called when a plugin is reloaded after an update */
18
- onResume?(ctx: PluginContext): Promise<void>;
16
+ onStop(ctx: PluginContext): Promise<void>;
19
17
  };
20
18
  /**
21
19
  * A plugin UI route component — either a regular React component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyvexsoftware/stratos-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Plugin SDK for Stratos — types, hooks, and UI components",
5
5
  "author": {
6
6
  "name": "Skyvex Software",
@@ -52,6 +52,13 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
+ "scripts": {
56
+ "build": "tsc -b",
57
+ "lint": "eslint src --ext .ts,.tsx",
58
+ "tsc": "tsc --noEmit",
59
+ "typecheck": "tsc --noEmit",
60
+ "prepublishOnly": "tsc -b"
61
+ },
55
62
  "peerDependencies": {
56
63
  "@radix-ui/react-alert-dialog": "^1.1.0",
57
64
  "@radix-ui/react-dialog": "^1.1.0",
@@ -95,11 +102,5 @@
95
102
  "socket.io-client": "^4.8.3",
96
103
  "typescript": "^5.8.3",
97
104
  "vite": "^7.3.1"
98
- },
99
- "scripts": {
100
- "build": "tsc -b",
101
- "lint": "eslint src --ext .ts,.tsx",
102
- "tsc": "tsc --noEmit",
103
- "typecheck": "tsc --noEmit"
104
105
  }
105
- }
106
+ }