@spacemolt/lib 18.1.0 → 18.1.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.
@@ -19,7 +19,10 @@
19
19
  * does not compile on `OkPush` — guard with `'action' in p` first, or narrow to
20
20
  * `OkActionPush` / `OkTypePush`. `FleetPush` has a single key and needs no guard.
21
21
  *
22
- * **The unions are closed**, derived from gameserver v0.596.2. A member typed
22
+ * **The unions are closed**, with arrival actions checked against the generated
23
+ * response enums by `tests/push-frames.test.ts`. A spec sync that drops a
24
+ * documented arrival action must fail typecheck, not hide the contract change.
25
+ * A member typed
23
26
  * `{ action: string }` to absorb later frames would join every literal's
24
27
  * narrowing and make all of them useless. The cost is that a variant the server
25
28
  * adds after that build still arrives at your `on('ok')` handler — nothing
@@ -120,10 +123,22 @@ export type OkArrived = TravelResponse & {
120
123
  action: 'arrived';
121
124
  };
122
125
  /**
123
- * A jump or Pathfinder drift completed. `pathfinder_arrival` is the off-network
124
- * variant. v1 transports only, for the same reason as `OkArrived`.
126
+ * A jump completed. v1 transports only, for the same reason as `OkArrived`.
127
+ *
128
+ * `JumpResponse.action` also includes `pathfinder_arrival`; that push is
129
+ * documented separately by `OkPathfinderArrival`.
125
130
  */
126
- export type OkJumped = JumpResponse;
131
+ export type OkJumped = JumpResponse & {
132
+ action: 'jumped';
133
+ };
134
+ /**
135
+ * A Pathfinder drift dropped out at a system. Unsolicited — no `request_id`, on
136
+ * every transport — so it is an `ok` push rather than a command result, and it
137
+ * carries the `JumpResponse` fields (`poi` is the POI ID here).
138
+ */
139
+ export type OkPathfinderArrival = JumpResponse & {
140
+ action: 'pathfinder_arrival';
141
+ };
127
142
  /** Docking completed. */
128
143
  export type OkDocked = DockResponse & {
129
144
  action: 'dock';
@@ -276,8 +291,8 @@ export interface FleetPassengerDisembarked extends PushBase {
276
291
  player_id: string;
277
292
  player_name: string;
278
293
  }
279
- /** Every `ok` push known as of gameserver v0.596.2. */
280
- export type OkPush = OkTravelStarted | OkJumpStarted | OkFleetTravelStarted | OkFleetJumpStarted | OkFleetDocked | OkFleetUndocked | OkPassengerStranded | OkMobileCapitalTransit | OkEspionage | OkArrived | OkJumped | OkDocked | OkAttack | OkPathfinderPlot | OkAutoDock | OkAutoUndock | OkEmergencyWarpStabilizer | OkPassengerArrivals | OkPassengersTransferred | OkShipProcessing | OkTransitLoungeDepartures | OkShipmentOverdue | OkNewForumPost | OkMessageOnly;
294
+ /** Every `ok` push represented by this closed union. */
295
+ export type OkPush = OkTravelStarted | OkJumpStarted | OkFleetTravelStarted | OkFleetJumpStarted | OkFleetDocked | OkFleetUndocked | OkPassengerStranded | OkMobileCapitalTransit | OkEspionage | OkArrived | OkJumped | OkPathfinderArrival | OkDocked | OkAttack | OkPathfinderPlot | OkAutoDock | OkAutoUndock | OkEmergencyWarpStabilizer | OkPassengerArrivals | OkPassengersTransferred | OkShipProcessing | OkTransitLoungeDepartures | OkShipmentOverdue | OkNewForumPost | OkMessageOnly;
281
296
  /** The `ok` variants keyed on `action`. `Extract`ed for an exhaustive switch. */
282
297
  export type OkActionPush = Extract<OkPush, {
283
298
  action: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacemolt/lib",
3
- "version": "18.1.0",
3
+ "version": "18.1.2",
4
4
  "description": "The definitive TypeScript library for SpaceMolt. WebSocket-v2-first, multi-account, with local state caches. Internals are regenerated from the server's OpenAPI spec.",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",