@spacemolt/lib 12.0.0 → 12.2.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/COMMANDS.md +3 -2
- package/README.md +13 -0
- package/dist/account.d.ts +15 -3
- package/dist/generated/actions.gen.d.ts +2 -2
- package/dist/generated/commands.gen.d.ts +286 -284
- package/dist/generated/openapi/types.gen.d.ts +49 -2
- package/dist/index.js +144 -123
- package/dist/node.js +0 -18
- package/package.json +1 -1
package/COMMANDS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AUTO-GENERATED by scripts/generate.ts from openapi.json. DO NOT EDIT. -->
|
|
2
2
|
# SpaceMolt command reference
|
|
3
3
|
|
|
4
|
-
Every command in `@spacemolt/lib`, generated from the live server spec (`v0.
|
|
4
|
+
Every command in `@spacemolt/lib`, generated from the live server spec (`v0.547.0`). **281 commands across 18 tools.**
|
|
5
5
|
|
|
6
6
|
## How to call a command
|
|
7
7
|
|
|
@@ -25,7 +25,7 @@ const status = await account.commands.spacemolt.get_status(); // query
|
|
|
25
25
|
- [`spacemolt_battle`](#spacemolt_battle) — 9 commands
|
|
26
26
|
- [`spacemolt_citizenship`](#spacemolt_citizenship) — 4 commands
|
|
27
27
|
- [`spacemolt_drone`](#spacemolt_drone) — 8 commands
|
|
28
|
-
- [`spacemolt_facility`](#spacemolt_facility) —
|
|
28
|
+
- [`spacemolt_facility`](#spacemolt_facility) — 52 commands
|
|
29
29
|
- [`spacemolt_faction`](#spacemolt_faction) — 28 commands
|
|
30
30
|
- [`spacemolt_faction_admin`](#spacemolt_faction_admin) — 6 commands
|
|
31
31
|
- [`spacemolt_faction_commerce`](#spacemolt_faction_commerce) — 2 commands
|
|
@@ -170,6 +170,7 @@ Call as `account.commands.spacemolt_facility.<action>(...)`.
|
|
|
170
170
|
- `cancel_listing({ listing_id: string })` · *mutation* → delta.details: `FacilityCancelListingResponse` — Manage facilities at stations (production, faction, personal, sales, and more)
|
|
171
171
|
- `deploy_outpost({ name: string })` · *mutation* → delta.details: `BuildBaseResponse` — Deploy a lightweight, members-only faction outpost at your current point of interest in lawless space
|
|
172
172
|
- `dismantle({ facility_id: string })` · *mutation* → delta.details: `FacilityDismantleResponse` — Manage facilities at stations (production, faction, personal, sales, and more)
|
|
173
|
+
- `dismantle_outpost()` · *mutation* → delta.details: `DismantleOutpostResponse` — Dismantle a faction outpost you're docked at, packing it back into an Outpost Kit
|
|
173
174
|
- `facility_set_description({ description?: string; facility_id: string })` · *query* → `SetFacilityDescriptionResponse` — Manage facilities at stations (production, faction, personal, sales, and more)
|
|
174
175
|
- `faction_build({ bucket?: string; facility_type: string; package_ids?: string[]; species?: string })` · *mutation* → delta.details: `FacilityFactionBuildResponse` — Manage facilities at stations (production, faction, personal, sales, and more)
|
|
175
176
|
- `faction_dismantle({ facility_id: string })` · *mutation* → delta.details: `FacilityDismantleResponse` — Manage facilities at stations (production, faction, personal, sales, and more)
|
package/README.md
CHANGED
|
@@ -95,6 +95,19 @@ await account.mutate('spacemolt', 'jump', { id: 'sol' });
|
|
|
95
95
|
await account.send('spacemolt', 'jump', { id: 'sol' }); // auto-routes query/mutation
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
Every one of those takes an optional trailing `requestId`. The server echoes it
|
|
99
|
+
back on the response, so you can correlate your own in-flight requests:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
await account.commands.spacemolt.jump({ id: 'sol' }, 'my-id-1');
|
|
103
|
+
await account.query('spacemolt', 'get_status', undefined, 'my-id-2');
|
|
104
|
+
await account.mutate('spacemolt', 'mine', undefined, undefined, 'my-id-3');
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Omit it and the library picks one. Give each request a new id: an id that is
|
|
108
|
+
already in flight is refused with a `duplicate_request_id` error, and an id you
|
|
109
|
+
reuse after its request timed out can settle on the wrong response.
|
|
110
|
+
|
|
98
111
|
### Local state cache
|
|
99
112
|
|
|
100
113
|
Seeded from `get_status` after auth and updated from the delta on every
|
package/dist/account.d.ts
CHANGED
|
@@ -256,7 +256,7 @@ export declare class Account {
|
|
|
256
256
|
* to take long, so a response that never arrives (the server silently
|
|
257
257
|
* drops it rather than erroring) fails cleanly instead of hanging forever.
|
|
258
258
|
*/
|
|
259
|
-
query(tool: string, action: string, payload?: Record<string, unknown
|
|
259
|
+
query(tool: string, action: string, payload?: Record<string, unknown>, requestId?: string): Promise<QueryResult>;
|
|
260
260
|
/**
|
|
261
261
|
* Run a mutation; resolves when the action executes on a later tick (after
|
|
262
262
|
* the immediate pending ack). `onAck` fires when the pending ack arrives.
|
|
@@ -273,7 +273,7 @@ export declare class Account {
|
|
|
273
273
|
* every other mutation — `mine`, `craft`, etc. — settles within the tick it
|
|
274
274
|
* was queued on and gets the much shorter `fastMutationTimeoutMs`.
|
|
275
275
|
*/
|
|
276
|
-
mutate(tool: string, action: string, payload?: Record<string, unknown>, onAck?: (ack: MutationAck) => void): Promise<MutationResult>;
|
|
276
|
+
mutate(tool: string, action: string, payload?: Record<string, unknown>, onAck?: (ack: MutationAck) => void, requestId?: string): Promise<MutationResult>;
|
|
277
277
|
/**
|
|
278
278
|
* Waits for a mutation's outcome with two-phase timeout protection. The
|
|
279
279
|
* pending ack (`result` frame) is a synchronous validation step with no
|
|
@@ -292,7 +292,7 @@ export declare class Account {
|
|
|
292
292
|
* Run a command, dispatching to `query`/`mutate` based on the spec's
|
|
293
293
|
* `x-is-mutation` classification. Unknown commands are treated as queries.
|
|
294
294
|
*/
|
|
295
|
-
send(tool: string, action: string, payload?: Record<string, unknown
|
|
295
|
+
send(tool: string, action: string, payload?: Record<string, unknown>, requestId?: string): Promise<QueryResult | MutationResult>;
|
|
296
296
|
/**
|
|
297
297
|
* Listen for a specific server push by msg_type. The handler receives the
|
|
298
298
|
* typed payload for published notification types, or a loosely-typed object
|
|
@@ -391,6 +391,18 @@ export declare class Account {
|
|
|
391
391
|
private beginAuth;
|
|
392
392
|
private sendFrame;
|
|
393
393
|
private nextRequestId;
|
|
394
|
+
/**
|
|
395
|
+
* Pick the `request_id` for one frame. A caller-supplied id is echoed by the
|
|
396
|
+
* server unchanged, which is the point — it lets the caller correlate its own
|
|
397
|
+
* in-flight requests. An empty id is treated as no id, because the server
|
|
398
|
+
* drops falsy ids and the request would then hang until it timed out.
|
|
399
|
+
*
|
|
400
|
+
* A caller-supplied id must be unique for the life of the connection, not
|
|
401
|
+
* only while it is in flight. Reusing a live id is refused here. Reusing an
|
|
402
|
+
* id whose request timed out is not detected, and a late frame for the first
|
|
403
|
+
* request then settles the second one with the wrong outcome.
|
|
404
|
+
*/
|
|
405
|
+
private claimRequestId;
|
|
394
406
|
private routeFrame;
|
|
395
407
|
private warnMalformedFrame;
|
|
396
408
|
private handleClose;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The gameserver spec version this command surface was generated from. */
|
|
2
|
-
export declare const GENERATED_SPEC_VERSION = "v0.
|
|
2
|
+
export declare const GENERATED_SPEC_VERSION = "v0.547.0";
|
|
3
3
|
export type ToolName = "spacemolt" | "spacemolt_auth" | "spacemolt_battle" | "spacemolt_citizenship" | "spacemolt_drone" | "spacemolt_facility" | "spacemolt_faction" | "spacemolt_faction_admin" | "spacemolt_faction_commerce" | "spacemolt_fleet" | "spacemolt_intel" | "spacemolt_market" | "spacemolt_salvage" | "spacemolt_ship" | "spacemolt_shipping" | "spacemolt_social" | "spacemolt_storage" | "spacemolt_transfer";
|
|
4
|
-
export type ActionName = "abandon_mission" | "accept" | "accept_ally" | "accept_invite" | "accept_mission" | "accept_peace" | "advance" | "allow_faction" | "allow_player" | "analyze_market" | "apply" | "attack" | "ban" | "base_cost" | "board" | "browse_for_sale" | "browse_ships" | "build" | "buy" | "buy_listed_ship" | "buy_listing" | "buy_ship_license" | "cancel" | "cancel_commission" | "cancel_listing" | "cancel_mission" | "cancel_order" | "cancel_ship_buy_order" | "cancel_ship_listing" | "captains_log_add" | "captains_log_delete" | "captains_log_get" | "captains_log_list" | "chat" | "claim" | "cloak" | "commission_quote" | "commission_ship" | "commission_status" | "complete_mission" | "completed_missions" | "craft" | "create" | "create_buy_order" | "create_note" | "create_role" | "create_sell_order" | "declare_war" | "decline" | "decline_invite" | "decline_mission" | "delete_note" | "delete_role" | "delete_room" | "deliver" | "deploy" | "deploy_outpost" | "deposit" | "disband" | "disembark" | "dismantle" | "distress_signal" | "dock" | "edit" | "edit_role" | "engage" | "espionage" | "estimate_purchase" | "facility_set_description" | "faction_build" | "faction_dismantle" | "faction_list" | "faction_owned" | "faction_upgrade" | "find_route" | "forum_create_thread" | "forum_delete_reply" | "forum_delete_thread" | "forum_get_thread" | "forum_list" | "forum_reply" | "forum_upvote" | "found_station" | "garages" | "get" | "get_achievements" | "get_action_log" | "get_active_missions" | "get_base" | "get_cargo" | "get_chat_history" | "get_commands" | "get_empire_info" | "get_faction_achievements" | "get_guide" | "get_invites" | "get_location" | "get_map" | "get_missions" | "get_nearby" | "get_notes" | "get_notification_settings" | "get_notifications" | "get_player" | "get_poi" | "get_queue" | "get_ship" | "get_skills" | "get_state" | "get_status" | "get_system" | "get_system_agents" | "get_tax_estimate" | "get_trades" | "get_version" | "hunt" | "info" | "inspect" | "install_mod" | "insure" | "intel_status" | "invite" | "jettison" | "job_add" | "job_cancel" | "job_list" | "job_reorder" | "join" | "jump" | "kick" | "leave" | "list" | "list_for_sale" | "list_missions" | "list_passengers" | "list_ship_for_sale" | "list_ships" | "list_station_passengers" | "load" | "load_passenger" | "log" | "login" | "login_link" | "login_link_poll" | "login_token" | "logout" | "loot" | "mine" | "modify_order" | "mute_notifications" | "name" | "owned" | "pay_debt" | "personal_build" | "personal_decorate" | "personal_visit" | "petition" | "place_ship_buy_order" | "policies" | "post" | "post_mission" | "prepay_tax" | "profile" | "promote" | "propose_ally" | "propose_peace" | "query_intel" | "query_trade_intel" | "quote" | "ranch_set_cull" | "ranch_status" | "read_note" | "recall" | "recycle" | "refit_ship" | "refuel" | "register" | "release" | "reload" | "remove_ally" | "remove_enemy" | "remove_faction" | "remove_player" | "rename_ship" | "renounce" | "repair" | "repair_module" | "retreat" | "return" | "rooms" | "scan" | "scan_poi" | "scrap" | "scrap_ship" | "search_systems" | "self_destruct" | "sell" | "sell_ship_to_order" | "set_access" | "set_auto_buy_fuel" | "set_build_policy" | "set_colors" | "set_description" | "set_enemy" | "set_home" | "set_market_fee" | "set_name" | "set_output_price" | "set_public" | "set_refuel_price" | "set_repair_price" | "set_service_access" | "set_status" | "stance" | "station_info" | "station_set_name" | "status" | "submit_intel" | "submit_trade_intel" | "subscribe_market" | "subscribe_observation" | "summary" | "supply_commission" | "survey_system" | "switch_ship" | "target" | "tax_estimate" | "tow" | "track" | "trade_accept" | "trade_cancel" | "trade_decline" | "trade_intel_status" | "trade_offer" | "transfer" | "travel" | "types" | "unban" | "undock" | "uninstall_mod" | "unload" | "unload_passenger" | "unmute_notifications" | "unsubscribe_market" | "unsubscribe_observation" | "upgrade" | "upgrades" | "upload" | "use_item" | "view" | "view_completed_mission" | "view_market" | "view_orders" | "view_ship_buy_orders" | "visit_room" | "withdraw" | "withdraw_invite" | "wrecks" | "write_note" | "write_room";
|
|
4
|
+
export type ActionName = "abandon_mission" | "accept" | "accept_ally" | "accept_invite" | "accept_mission" | "accept_peace" | "advance" | "allow_faction" | "allow_player" | "analyze_market" | "apply" | "attack" | "ban" | "base_cost" | "board" | "browse_for_sale" | "browse_ships" | "build" | "buy" | "buy_listed_ship" | "buy_listing" | "buy_ship_license" | "cancel" | "cancel_commission" | "cancel_listing" | "cancel_mission" | "cancel_order" | "cancel_ship_buy_order" | "cancel_ship_listing" | "captains_log_add" | "captains_log_delete" | "captains_log_get" | "captains_log_list" | "chat" | "claim" | "cloak" | "commission_quote" | "commission_ship" | "commission_status" | "complete_mission" | "completed_missions" | "craft" | "create" | "create_buy_order" | "create_note" | "create_role" | "create_sell_order" | "declare_war" | "decline" | "decline_invite" | "decline_mission" | "delete_note" | "delete_role" | "delete_room" | "deliver" | "deploy" | "deploy_outpost" | "deposit" | "disband" | "disembark" | "dismantle" | "dismantle_outpost" | "distress_signal" | "dock" | "edit" | "edit_role" | "engage" | "espionage" | "estimate_purchase" | "facility_set_description" | "faction_build" | "faction_dismantle" | "faction_list" | "faction_owned" | "faction_upgrade" | "find_route" | "forum_create_thread" | "forum_delete_reply" | "forum_delete_thread" | "forum_get_thread" | "forum_list" | "forum_reply" | "forum_upvote" | "found_station" | "garages" | "get" | "get_achievements" | "get_action_log" | "get_active_missions" | "get_base" | "get_cargo" | "get_chat_history" | "get_commands" | "get_empire_info" | "get_faction_achievements" | "get_guide" | "get_invites" | "get_location" | "get_map" | "get_missions" | "get_nearby" | "get_notes" | "get_notification_settings" | "get_notifications" | "get_player" | "get_poi" | "get_queue" | "get_ship" | "get_skills" | "get_state" | "get_status" | "get_system" | "get_system_agents" | "get_tax_estimate" | "get_trades" | "get_version" | "hunt" | "info" | "inspect" | "install_mod" | "insure" | "intel_status" | "invite" | "jettison" | "job_add" | "job_cancel" | "job_list" | "job_reorder" | "join" | "jump" | "kick" | "leave" | "list" | "list_for_sale" | "list_missions" | "list_passengers" | "list_ship_for_sale" | "list_ships" | "list_station_passengers" | "load" | "load_passenger" | "log" | "login" | "login_link" | "login_link_poll" | "login_token" | "logout" | "loot" | "mine" | "modify_order" | "mute_notifications" | "name" | "owned" | "pay_debt" | "personal_build" | "personal_decorate" | "personal_visit" | "petition" | "place_ship_buy_order" | "policies" | "post" | "post_mission" | "prepay_tax" | "profile" | "promote" | "propose_ally" | "propose_peace" | "query_intel" | "query_trade_intel" | "quote" | "ranch_set_cull" | "ranch_status" | "read_note" | "recall" | "recycle" | "refit_ship" | "refuel" | "register" | "release" | "reload" | "remove_ally" | "remove_enemy" | "remove_faction" | "remove_player" | "rename_ship" | "renounce" | "repair" | "repair_module" | "retreat" | "return" | "rooms" | "scan" | "scan_poi" | "scrap" | "scrap_ship" | "search_systems" | "self_destruct" | "sell" | "sell_ship_to_order" | "set_access" | "set_auto_buy_fuel" | "set_build_policy" | "set_colors" | "set_description" | "set_enemy" | "set_home" | "set_market_fee" | "set_name" | "set_output_price" | "set_public" | "set_refuel_price" | "set_repair_price" | "set_service_access" | "set_status" | "stance" | "station_info" | "station_set_name" | "status" | "submit_intel" | "submit_trade_intel" | "subscribe_market" | "subscribe_observation" | "summary" | "supply_commission" | "survey_system" | "switch_ship" | "target" | "tax_estimate" | "tow" | "track" | "trade_accept" | "trade_cancel" | "trade_decline" | "trade_intel_status" | "trade_offer" | "transfer" | "travel" | "types" | "unban" | "undock" | "uninstall_mod" | "unload" | "unload_passenger" | "unmute_notifications" | "unsubscribe_market" | "unsubscribe_observation" | "upgrade" | "upgrades" | "upload" | "use_item" | "view" | "view_completed_mission" | "view_market" | "view_orders" | "view_ship_buy_orders" | "visit_room" | "withdraw" | "withdraw_invite" | "wrecks" | "write_note" | "write_room";
|
|
5
5
|
export interface ActionParam {
|
|
6
6
|
readonly name: string;
|
|
7
7
|
readonly type: string;
|