@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.
@@ -1497,6 +1497,16 @@ export type DepositItemsResponse = {
1497
1497
  quantity: number;
1498
1498
  storage_total: number;
1499
1499
  };
1500
+ export type DismantleOutpostResponse = {
1501
+ auto_docked?: boolean;
1502
+ auto_undocked?: boolean;
1503
+ base_id: string;
1504
+ fee_refunded: number;
1505
+ hint: string;
1506
+ kit_item: string;
1507
+ kit_refunded: boolean;
1508
+ name: string;
1509
+ };
1500
1510
  export type DistressSignalResponse = {
1501
1511
  action: string;
1502
1512
  auto_docked?: boolean;
@@ -2434,6 +2444,9 @@ export type FactionGiftResponse = {
2434
2444
  export type FactionInfoResponse = {
2435
2445
  alliance_proposals?: Array<FactionAllianceProposal>;
2436
2446
  allies?: Array<FactionListItem>;
2447
+ ally_facility_access?: boolean;
2448
+ ally_fuel_access?: boolean;
2449
+ ally_intel_opt_out?: boolean;
2437
2450
  at_war: boolean;
2438
2451
  charter: string;
2439
2452
  created_at: string;
@@ -4721,6 +4734,7 @@ export type ParticipantSnapshot = {
4721
4734
  export type ParticipantSummary = {
4722
4735
  damage_dealt: number;
4723
4736
  damage_taken: number;
4737
+ is_boss?: boolean;
4724
4738
  kill_count: number;
4725
4739
  kind?: string;
4726
4740
  player_id: string;
@@ -11501,6 +11515,39 @@ export type SpacemoltFacilityDismantleResponses = {
11501
11515
  };
11502
11516
  };
11503
11517
  export type SpacemoltFacilityDismantleResponse = SpacemoltFacilityDismantleResponses[keyof SpacemoltFacilityDismantleResponses];
11518
+ export type SpacemoltFacilityDismantleOutpostData = {
11519
+ body?: {
11520
+ [key: string]: unknown;
11521
+ };
11522
+ path?: never;
11523
+ query?: never;
11524
+ url: '/api/v2/spacemolt_facility/dismantle_outpost';
11525
+ };
11526
+ export type SpacemoltFacilityDismantleOutpostErrors = {
11527
+ /**
11528
+ * Bad request — invalid params, unknown command, or game error
11529
+ */
11530
+ 400: unknown;
11531
+ /**
11532
+ * Not authenticated — missing or invalid session
11533
+ */
11534
+ 401: unknown;
11535
+ /**
11536
+ * Rate limited — mutations allow 1 per tick (10 seconds)
11537
+ */
11538
+ 429: unknown;
11539
+ };
11540
+ export type SpacemoltFacilityDismantleOutpostResponses = {
11541
+ /**
11542
+ * Result. structuredContent: V2GameState post-mutation delta (changed ship/cargo/location/queue sections); the command result is under `details` (DismantleOutpostResponse)
11543
+ */
11544
+ 200: V2Response & {
11545
+ structuredContent?: V2GameState & {
11546
+ details?: DismantleOutpostResponse;
11547
+ };
11548
+ };
11549
+ };
11550
+ export type SpacemoltFacilityDismantleOutpostResponse = SpacemoltFacilityDismantleOutpostResponses[keyof SpacemoltFacilityDismantleOutpostResponses];
11504
11551
  export type SpacemoltFacilityFacilitySetDescriptionData = {
11505
11552
  body?: {
11506
11553
  /**
@@ -18548,7 +18595,7 @@ export type SpacemoltStorageDepositData = {
18548
18595
  */
18549
18596
  dest_bucket?: string;
18550
18597
  /**
18551
- * Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay (carrier required), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.
18598
+ * Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay, or — if your active ship is a non-carrier with a tow rig fitted — attaches/releases it as a tow (its class scale must be no larger than your active ship's), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.
18552
18599
  */
18553
18600
  item_id?: string;
18554
18601
  /**
@@ -18788,7 +18835,7 @@ export type SpacemoltStorageWithdrawData = {
18788
18835
  */
18789
18836
  dest_bucket?: string;
18790
18837
  /**
18791
- * Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay (carrier required), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.
18838
+ * Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay, or — if your active ship is a non-carrier with a tow rig fitted — attaches/releases it as a tow (its class scale must be no larger than your active ship's), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.
18792
18839
  */
18793
18840
  item_id?: string;
18794
18841
  /**
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ var STATE_SECTIONS = [
44
44
  "skills"
45
45
  ];
46
46
  // src/generated/actions.gen.ts
47
- var GENERATED_SPEC_VERSION = "v0.543.1";
47
+ var GENERATED_SPEC_VERSION = "v0.547.0";
48
48
  var ACTIONS = {
49
49
  "spacemolt_auth/claim": {
50
50
  tool: "spacemolt_auth",
@@ -434,6 +434,14 @@ var ACTIONS = {
434
434
  { name: "facility_id", type: "string", required: true, description: "Facility instance ID (required for 'upgrade', 'dismantle', 'faction_dismantle', 'job_add', 'job_list', 'set_output_price', 'set_access', 'set_name', 'set_description' actions). Use action 'list' to see facility IDs.", positional: 1 }
435
435
  ]
436
436
  },
437
+ "spacemolt_facility/dismantle_outpost": {
438
+ tool: "spacemolt_facility",
439
+ action: "dismantle_outpost",
440
+ kind: "mutation",
441
+ summary: "Dismantle a faction outpost you're docked at, packing it back into an Outpost Kit",
442
+ detailsType: "DismantleOutpostResponse",
443
+ params: []
444
+ },
437
445
  "spacemolt_facility/facility_set_description": {
438
446
  tool: "spacemolt_facility",
439
447
  action: "facility_set_description",
@@ -2244,7 +2252,7 @@ var ACTIONS = {
2244
2252
  { name: "bucket", type: "string", required: false, description: "Optional (target=faction only): a Storage Extension bucket by name or id to deposit into / withdraw from instead of the main store. For an intra-faction move (source=faction target=faction) this is the SOURCE compartment. Empty means the main store. See bucket names in action=view target=faction." },
2245
2253
  { name: "credits", type: "number", required: false, description: "For 'deposit' with target=<player name/id>: the amount of credits to gift that player. (Faction credit deposits use item_id='credits' with quantity instead.)" },
2246
2254
  { name: "dest_bucket", type: "string", required: false, description: "Optional destination compartment for an intra-faction move (source=faction target=faction): items go from 'bucket' into 'dest_bucket'. Either may be empty to mean the main store, so this covers main↔bucket and bucket↔bucket moves. Requires manage_treasury." },
2247
- { name: "item_id", type: "string", required: false, description: "Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay (carrier required), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.", positional: 1 },
2255
+ { name: "item_id", type: "string", required: false, description: "Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay, or — if your active ship is a non-carrier with a tow rig fitted — attaches/releases it as a tow (its class scale must be no larger than your active ship's), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.", positional: 1 },
2248
2256
  { name: "items", type: "{ item_id: string; quantity: number }[]", required: false, description: "Bulk deposit/withdraw: array of {item_id, quantity} objects moved in a single action (one write) instead of one per tick. Items only. Honors target/source like single-item (cargo↔personal, cargo↔faction, personal↔faction transfers, gifts). Omit item_id/quantity when using this. The response reports per-item success/failure." },
2249
2257
  { name: "message", type: "string", required: false, description: "Optional message when gifting to another player" },
2250
2258
  { name: "quantity", type: "number", required: false, description: "Amount to transfer", positional: 2 },
@@ -2297,7 +2305,7 @@ var ACTIONS = {
2297
2305
  params: [
2298
2306
  { name: "bucket", type: "string", required: false, description: "Optional (target=faction only): a Storage Extension bucket by name or id to deposit into / withdraw from instead of the main store. For an intra-faction move (source=faction target=faction) this is the SOURCE compartment. Empty means the main store. See bucket names in action=view target=faction." },
2299
2307
  { name: "dest_bucket", type: "string", required: false, description: "Optional destination compartment for an intra-faction move (source=faction target=faction): items go from 'bucket' into 'dest_bucket'. Either may be empty to mean the main store, so this covers main↔bucket and bucket↔bucket moves. Requires manage_treasury." },
2300
- { name: "item_id", type: "string", required: false, description: "Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay (carrier required), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.", positional: 1 },
2308
+ { name: "item_id", type: "string", required: false, description: "Item ID for normal item transfers, 'credits' for credit operations (faction target only), or a stored ship instance UUID for ship operations: target=self loads/unloads the ship into your active carrier's bay, or — if your active ship is a non-carrier with a tow rig fitted — attaches/releases it as a tow (its class scale must be no larger than your active ship's), and target=<player_name> with action=deposit gifts the ship (triggers gift_ship action). Use list_ships to find ship instance IDs.", positional: 1 },
2301
2309
  { name: "items", type: "{ item_id: string; quantity: number }[]", required: false, description: "Bulk deposit/withdraw: array of {item_id, quantity} objects moved in a single action (one write) instead of one per tick. Items only. Honors target/source like single-item (cargo↔personal, cargo↔faction, personal↔faction transfers, gifts). Omit item_id/quantity when using this. The response reports per-item success/failure." },
2302
2310
  { name: "quantity", type: "number", required: false, description: "Amount to transfer", positional: 2 },
2303
2311
  { name: "source", type: "string", required: false, description: "Optional source for deposit/withdraw: 'cargo' (default — your ship's cargo hold or wallet), 'storage' (personal storage; use with target=faction or a player name to transfer directly, bypassing cargo), or 'faction' (faction storage; use with target=self to transfer faction→personal, or with target=faction to move items between faction compartments — both require manage_treasury)." },
@@ -2980,7 +2988,8 @@ var ACTIONS = {
2980
2988
 
2981
2989
  // src/generated/commands.gen.ts
2982
2990
  function buildCommands(dispatch) {
2983
- const bind = (tool, action) => (params) => dispatch(tool, action, params);
2991
+ const bind = (tool, action) => (params, requestId) => dispatch(tool, action, params, requestId);
2992
+ const bindBare = (tool, action) => (requestId) => dispatch(tool, action, undefined, requestId);
2984
2993
  return {
2985
2994
  spacemolt: {
2986
2995
  abandon_mission: bind("spacemolt", "abandon_mission"),
@@ -2989,45 +2998,45 @@ function buildCommands(dispatch) {
2989
2998
  buy: bind("spacemolt", "buy"),
2990
2999
  cloak: bind("spacemolt", "cloak"),
2991
3000
  complete_mission: bind("spacemolt", "complete_mission"),
2992
- completed_missions: bind("spacemolt", "completed_missions"),
3001
+ completed_missions: bindBare("spacemolt", "completed_missions"),
2993
3002
  craft: bind("spacemolt", "craft"),
2994
3003
  decline_mission: bind("spacemolt", "decline_mission"),
2995
3004
  distress_signal: bind("spacemolt", "distress_signal"),
2996
- dock: bind("spacemolt", "dock"),
3005
+ dock: bindBare("spacemolt", "dock"),
2997
3006
  find_route: bind("spacemolt", "find_route"),
2998
- get_achievements: bind("spacemolt", "get_achievements"),
2999
- get_active_missions: bind("spacemolt", "get_active_missions"),
3000
- get_base: bind("spacemolt", "get_base"),
3001
- get_cargo: bind("spacemolt", "get_cargo"),
3002
- get_commands: bind("spacemolt", "get_commands"),
3007
+ get_achievements: bindBare("spacemolt", "get_achievements"),
3008
+ get_active_missions: bindBare("spacemolt", "get_active_missions"),
3009
+ get_base: bindBare("spacemolt", "get_base"),
3010
+ get_cargo: bindBare("spacemolt", "get_cargo"),
3011
+ get_commands: bindBare("spacemolt", "get_commands"),
3003
3012
  get_empire_info: bind("spacemolt", "get_empire_info"),
3004
- get_faction_achievements: bind("spacemolt", "get_faction_achievements"),
3013
+ get_faction_achievements: bindBare("spacemolt", "get_faction_achievements"),
3005
3014
  get_guide: bind("spacemolt", "get_guide"),
3006
- get_location: bind("spacemolt", "get_location"),
3015
+ get_location: bindBare("spacemolt", "get_location"),
3007
3016
  get_map: bind("spacemolt", "get_map"),
3008
- get_missions: bind("spacemolt", "get_missions"),
3009
- get_nearby: bind("spacemolt", "get_nearby"),
3017
+ get_missions: bindBare("spacemolt", "get_missions"),
3018
+ get_nearby: bindBare("spacemolt", "get_nearby"),
3010
3019
  get_notifications: bind("spacemolt", "get_notifications"),
3011
- get_player: bind("spacemolt", "get_player"),
3012
- get_poi: bind("spacemolt", "get_poi"),
3013
- get_queue: bind("spacemolt", "get_queue"),
3014
- get_ship: bind("spacemolt", "get_ship"),
3015
- get_skills: bind("spacemolt", "get_skills"),
3016
- get_state: bind("spacemolt", "get_state"),
3017
- get_status: bind("spacemolt", "get_status"),
3018
- get_system: bind("spacemolt", "get_system"),
3019
- get_system_agents: bind("spacemolt", "get_system_agents"),
3020
- get_tax_estimate: bind("spacemolt", "get_tax_estimate"),
3020
+ get_player: bindBare("spacemolt", "get_player"),
3021
+ get_poi: bindBare("spacemolt", "get_poi"),
3022
+ get_queue: bindBare("spacemolt", "get_queue"),
3023
+ get_ship: bindBare("spacemolt", "get_ship"),
3024
+ get_skills: bindBare("spacemolt", "get_skills"),
3025
+ get_state: bindBare("spacemolt", "get_state"),
3026
+ get_status: bindBare("spacemolt", "get_status"),
3027
+ get_system: bindBare("spacemolt", "get_system"),
3028
+ get_system_agents: bindBare("spacemolt", "get_system_agents"),
3029
+ get_tax_estimate: bindBare("spacemolt", "get_tax_estimate"),
3021
3030
  get_version: bind("spacemolt", "get_version"),
3022
3031
  hunt: bind("spacemolt", "hunt"),
3023
3032
  inspect: bind("spacemolt", "inspect"),
3024
3033
  install_mod: bind("spacemolt", "install_mod"),
3025
3034
  jettison: bind("spacemolt", "jettison"),
3026
3035
  jump: bind("spacemolt", "jump"),
3027
- list_passengers: bind("spacemolt", "list_passengers"),
3028
- list_station_passengers: bind("spacemolt", "list_station_passengers"),
3036
+ list_passengers: bindBare("spacemolt", "list_passengers"),
3037
+ list_station_passengers: bindBare("spacemolt", "list_station_passengers"),
3029
3038
  load_passenger: bind("spacemolt", "load_passenger"),
3030
- mine: bind("spacemolt", "mine"),
3039
+ mine: bindBare("spacemolt", "mine"),
3031
3040
  prepay_tax: bind("spacemolt", "prepay_tax"),
3032
3041
  recycle: bind("spacemolt", "recycle"),
3033
3042
  refuel: bind("spacemolt", "refuel"),
@@ -3035,48 +3044,48 @@ function buildCommands(dispatch) {
3035
3044
  repair_module: bind("spacemolt", "repair_module"),
3036
3045
  scan: bind("spacemolt", "scan"),
3037
3046
  search_systems: bind("spacemolt", "search_systems"),
3038
- self_destruct: bind("spacemolt", "self_destruct"),
3047
+ self_destruct: bindBare("spacemolt", "self_destruct"),
3039
3048
  sell: bind("spacemolt", "sell"),
3040
3049
  subscribe_observation: bind("spacemolt", "subscribe_observation"),
3041
- survey_system: bind("spacemolt", "survey_system"),
3050
+ survey_system: bindBare("spacemolt", "survey_system"),
3042
3051
  travel: bind("spacemolt", "travel"),
3043
- undock: bind("spacemolt", "undock"),
3052
+ undock: bindBare("spacemolt", "undock"),
3044
3053
  uninstall_mod: bind("spacemolt", "uninstall_mod"),
3045
3054
  unload_passenger: bind("spacemolt", "unload_passenger"),
3046
- unsubscribe_observation: bind("spacemolt", "unsubscribe_observation"),
3055
+ unsubscribe_observation: bindBare("spacemolt", "unsubscribe_observation"),
3047
3056
  use_item: bind("spacemolt", "use_item"),
3048
3057
  view_completed_mission: bind("spacemolt", "view_completed_mission")
3049
3058
  },
3050
3059
  spacemolt_auth: {
3051
3060
  claim: bind("spacemolt_auth", "claim"),
3052
3061
  login: bind("spacemolt_auth", "login"),
3053
- login_link: bind("spacemolt_auth", "login_link"),
3062
+ login_link: bindBare("spacemolt_auth", "login_link"),
3054
3063
  login_link_poll: bind("spacemolt_auth", "login_link_poll"),
3055
3064
  login_token: bind("spacemolt_auth", "login_token"),
3056
- logout: bind("spacemolt_auth", "logout"),
3065
+ logout: bindBare("spacemolt_auth", "logout"),
3057
3066
  register: bind("spacemolt_auth", "register")
3058
3067
  },
3059
3068
  spacemolt_battle: {
3060
- advance: bind("spacemolt_battle", "advance"),
3069
+ advance: bindBare("spacemolt_battle", "advance"),
3061
3070
  engage: bind("spacemolt_battle", "engage"),
3062
3071
  log: bind("spacemolt_battle", "log"),
3063
3072
  reload: bind("spacemolt_battle", "reload"),
3064
- retreat: bind("spacemolt_battle", "retreat"),
3073
+ retreat: bindBare("spacemolt_battle", "retreat"),
3065
3074
  stance: bind("spacemolt_battle", "stance"),
3066
- status: bind("spacemolt_battle", "status"),
3075
+ status: bindBare("spacemolt_battle", "status"),
3067
3076
  summary: bind("spacemolt_battle", "summary"),
3068
3077
  target: bind("spacemolt_battle", "target")
3069
3078
  },
3070
3079
  spacemolt_citizenship: {
3071
3080
  apply: bind("spacemolt_citizenship", "apply"),
3072
- list: bind("spacemolt_citizenship", "list"),
3081
+ list: bindBare("spacemolt_citizenship", "list"),
3073
3082
  renounce: bind("spacemolt_citizenship", "renounce"),
3074
3083
  withdraw: bind("spacemolt_citizenship", "withdraw")
3075
3084
  },
3076
3085
  spacemolt_drone: {
3077
3086
  deploy: bind("spacemolt_drone", "deploy"),
3078
3087
  get: bind("spacemolt_drone", "get"),
3079
- list: bind("spacemolt_drone", "list"),
3088
+ list: bindBare("spacemolt_drone", "list"),
3080
3089
  load: bind("spacemolt_drone", "load"),
3081
3090
  name: bind("spacemolt_drone", "name"),
3082
3091
  recall: bind("spacemolt_drone", "recall"),
@@ -3087,7 +3096,7 @@ function buildCommands(dispatch) {
3087
3096
  allow_faction: bind("spacemolt_facility", "allow_faction"),
3088
3097
  allow_player: bind("spacemolt_facility", "allow_player"),
3089
3098
  ban: bind("spacemolt_facility", "ban"),
3090
- base_cost: bind("spacemolt_facility", "base_cost"),
3099
+ base_cost: bindBare("spacemolt_facility", "base_cost"),
3091
3100
  browse_for_sale: bind("spacemolt_facility", "browse_for_sale"),
3092
3101
  build: bind("spacemolt_facility", "build"),
3093
3102
  buy_listing: bind("spacemolt_facility", "buy_listing"),
@@ -3095,20 +3104,21 @@ function buildCommands(dispatch) {
3095
3104
  cancel_listing: bind("spacemolt_facility", "cancel_listing"),
3096
3105
  deploy_outpost: bind("spacemolt_facility", "deploy_outpost"),
3097
3106
  dismantle: bind("spacemolt_facility", "dismantle"),
3107
+ dismantle_outpost: bindBare("spacemolt_facility", "dismantle_outpost"),
3098
3108
  facility_set_description: bind("spacemolt_facility", "facility_set_description"),
3099
3109
  faction_build: bind("spacemolt_facility", "faction_build"),
3100
3110
  faction_dismantle: bind("spacemolt_facility", "faction_dismantle"),
3101
- faction_list: bind("spacemolt_facility", "faction_list"),
3102
- faction_owned: bind("spacemolt_facility", "faction_owned"),
3111
+ faction_list: bindBare("spacemolt_facility", "faction_list"),
3112
+ faction_owned: bindBare("spacemolt_facility", "faction_owned"),
3103
3113
  faction_upgrade: bind("spacemolt_facility", "faction_upgrade"),
3104
3114
  found_station: bind("spacemolt_facility", "found_station"),
3105
3115
  job_add: bind("spacemolt_facility", "job_add"),
3106
3116
  job_cancel: bind("spacemolt_facility", "job_cancel"),
3107
3117
  job_list: bind("spacemolt_facility", "job_list"),
3108
3118
  job_reorder: bind("spacemolt_facility", "job_reorder"),
3109
- list: bind("spacemolt_facility", "list"),
3119
+ list: bindBare("spacemolt_facility", "list"),
3110
3120
  list_for_sale: bind("spacemolt_facility", "list_for_sale"),
3111
- owned: bind("spacemolt_facility", "owned"),
3121
+ owned: bindBare("spacemolt_facility", "owned"),
3112
3122
  personal_build: bind("spacemolt_facility", "personal_build"),
3113
3123
  personal_decorate: bind("spacemolt_facility", "personal_decorate"),
3114
3124
  personal_visit: bind("spacemolt_facility", "personal_visit"),
@@ -3128,13 +3138,13 @@ function buildCommands(dispatch) {
3128
3138
  set_refuel_price: bind("spacemolt_facility", "set_refuel_price"),
3129
3139
  set_repair_price: bind("spacemolt_facility", "set_repair_price"),
3130
3140
  set_service_access: bind("spacemolt_facility", "set_service_access"),
3131
- station_info: bind("spacemolt_facility", "station_info"),
3141
+ station_info: bindBare("spacemolt_facility", "station_info"),
3132
3142
  station_set_name: bind("spacemolt_facility", "station_set_name"),
3133
3143
  transfer: bind("spacemolt_facility", "transfer"),
3134
3144
  types: bind("spacemolt_facility", "types"),
3135
3145
  unban: bind("spacemolt_facility", "unban"),
3136
3146
  upgrade: bind("spacemolt_facility", "upgrade"),
3137
- upgrades: bind("spacemolt_facility", "upgrades")
3147
+ upgrades: bindBare("spacemolt_facility", "upgrades")
3138
3148
  },
3139
3149
  spacemolt_faction: {
3140
3150
  accept_ally: bind("spacemolt_faction", "accept_ally"),
@@ -3146,23 +3156,23 @@ function buildCommands(dispatch) {
3146
3156
  decline_invite: bind("spacemolt_faction", "decline_invite"),
3147
3157
  delete_role: bind("spacemolt_faction", "delete_role"),
3148
3158
  delete_room: bind("spacemolt_faction", "delete_room"),
3149
- garages: bind("spacemolt_faction", "garages"),
3150
- get_invites: bind("spacemolt_faction", "get_invites"),
3159
+ garages: bindBare("spacemolt_faction", "garages"),
3160
+ get_invites: bindBare("spacemolt_faction", "get_invites"),
3151
3161
  info: bind("spacemolt_faction", "info"),
3152
3162
  invite: bind("spacemolt_faction", "invite"),
3153
3163
  join: bind("spacemolt_faction", "join"),
3154
3164
  kick: bind("spacemolt_faction", "kick"),
3155
- leave: bind("spacemolt_faction", "leave"),
3165
+ leave: bindBare("spacemolt_faction", "leave"),
3156
3166
  list: bind("spacemolt_faction", "list"),
3157
- list_missions: bind("spacemolt_faction", "list_missions"),
3167
+ list_missions: bindBare("spacemolt_faction", "list_missions"),
3158
3168
  prepay_tax: bind("spacemolt_faction", "prepay_tax"),
3159
3169
  propose_ally: bind("spacemolt_faction", "propose_ally"),
3160
3170
  propose_peace: bind("spacemolt_faction", "propose_peace"),
3161
3171
  remove_ally: bind("spacemolt_faction", "remove_ally"),
3162
3172
  remove_enemy: bind("spacemolt_faction", "remove_enemy"),
3163
- rooms: bind("spacemolt_faction", "rooms"),
3173
+ rooms: bindBare("spacemolt_faction", "rooms"),
3164
3174
  set_enemy: bind("spacemolt_faction", "set_enemy"),
3165
- tax_estimate: bind("spacemolt_faction", "tax_estimate"),
3175
+ tax_estimate: bindBare("spacemolt_faction", "tax_estimate"),
3166
3176
  visit_room: bind("spacemolt_faction", "visit_room"),
3167
3177
  withdraw_invite: bind("spacemolt_faction", "withdraw_invite")
3168
3178
  },
@@ -3179,50 +3189,50 @@ function buildCommands(dispatch) {
3179
3189
  create_sell_order: bind("spacemolt_faction_commerce", "create_sell_order")
3180
3190
  },
3181
3191
  spacemolt_fleet: {
3182
- accept: bind("spacemolt_fleet", "accept"),
3192
+ accept: bindBare("spacemolt_fleet", "accept"),
3183
3193
  board: bind("spacemolt_fleet", "board"),
3184
- create: bind("spacemolt_fleet", "create"),
3185
- decline: bind("spacemolt_fleet", "decline"),
3186
- disband: bind("spacemolt_fleet", "disband"),
3187
- disembark: bind("spacemolt_fleet", "disembark"),
3194
+ create: bindBare("spacemolt_fleet", "create"),
3195
+ decline: bindBare("spacemolt_fleet", "decline"),
3196
+ disband: bindBare("spacemolt_fleet", "disband"),
3197
+ disembark: bindBare("spacemolt_fleet", "disembark"),
3188
3198
  invite: bind("spacemolt_fleet", "invite"),
3189
3199
  kick: bind("spacemolt_fleet", "kick"),
3190
- leave: bind("spacemolt_fleet", "leave"),
3191
- status: bind("spacemolt_fleet", "status")
3200
+ leave: bindBare("spacemolt_fleet", "leave"),
3201
+ status: bindBare("spacemolt_fleet", "status")
3192
3202
  },
3193
3203
  spacemolt_intel: {
3194
- espionage: bind("spacemolt_intel", "espionage"),
3195
- intel_status: bind("spacemolt_intel", "intel_status"),
3204
+ espionage: bindBare("spacemolt_intel", "espionage"),
3205
+ intel_status: bindBare("spacemolt_intel", "intel_status"),
3196
3206
  query_intel: bind("spacemolt_intel", "query_intel"),
3197
3207
  query_trade_intel: bind("spacemolt_intel", "query_trade_intel"),
3198
3208
  scan_poi: bind("spacemolt_intel", "scan_poi"),
3199
3209
  submit_intel: bind("spacemolt_intel", "submit_intel"),
3200
3210
  submit_trade_intel: bind("spacemolt_intel", "submit_trade_intel"),
3201
- trade_intel_status: bind("spacemolt_intel", "trade_intel_status")
3211
+ trade_intel_status: bindBare("spacemolt_intel", "trade_intel_status")
3202
3212
  },
3203
3213
  spacemolt_market: {
3204
- analyze_market: bind("spacemolt_market", "analyze_market"),
3214
+ analyze_market: bindBare("spacemolt_market", "analyze_market"),
3205
3215
  cancel_order: bind("spacemolt_market", "cancel_order"),
3206
3216
  create_buy_order: bind("spacemolt_market", "create_buy_order"),
3207
3217
  create_sell_order: bind("spacemolt_market", "create_sell_order"),
3208
3218
  estimate_purchase: bind("spacemolt_market", "estimate_purchase"),
3209
3219
  modify_order: bind("spacemolt_market", "modify_order"),
3210
- subscribe_market: bind("spacemolt_market", "subscribe_market"),
3211
- unsubscribe_market: bind("spacemolt_market", "unsubscribe_market"),
3220
+ subscribe_market: bindBare("spacemolt_market", "subscribe_market"),
3221
+ unsubscribe_market: bindBare("spacemolt_market", "unsubscribe_market"),
3212
3222
  view_market: bind("spacemolt_market", "view_market"),
3213
3223
  view_orders: bind("spacemolt_market", "view_orders")
3214
3224
  },
3215
3225
  spacemolt_salvage: {
3216
- insure: bind("spacemolt_salvage", "insure"),
3226
+ insure: bindBare("spacemolt_salvage", "insure"),
3217
3227
  loot: bind("spacemolt_salvage", "loot"),
3218
- policies: bind("spacemolt_salvage", "policies"),
3219
- quote: bind("spacemolt_salvage", "quote"),
3220
- release: bind("spacemolt_salvage", "release"),
3221
- scrap: bind("spacemolt_salvage", "scrap"),
3222
- sell: bind("spacemolt_salvage", "sell"),
3228
+ policies: bindBare("spacemolt_salvage", "policies"),
3229
+ quote: bindBare("spacemolt_salvage", "quote"),
3230
+ release: bindBare("spacemolt_salvage", "release"),
3231
+ scrap: bindBare("spacemolt_salvage", "scrap"),
3232
+ sell: bindBare("spacemolt_salvage", "sell"),
3223
3233
  set_home: bind("spacemolt_salvage", "set_home"),
3224
3234
  tow: bind("spacemolt_salvage", "tow"),
3225
- wrecks: bind("spacemolt_salvage", "wrecks")
3235
+ wrecks: bindBare("spacemolt_salvage", "wrecks")
3226
3236
  },
3227
3237
  spacemolt_ship: {
3228
3238
  browse_ships: bind("spacemolt_ship", "browse_ships"),
@@ -3234,15 +3244,15 @@ function buildCommands(dispatch) {
3234
3244
  commission_ship: bind("spacemolt_ship", "commission_ship"),
3235
3245
  commission_status: bind("spacemolt_ship", "commission_status"),
3236
3246
  list_ship_for_sale: bind("spacemolt_ship", "list_ship_for_sale"),
3237
- list_ships: bind("spacemolt_ship", "list_ships"),
3247
+ list_ships: bindBare("spacemolt_ship", "list_ships"),
3238
3248
  place_ship_buy_order: bind("spacemolt_ship", "place_ship_buy_order"),
3239
- refit_ship: bind("spacemolt_ship", "refit_ship"),
3249
+ refit_ship: bindBare("spacemolt_ship", "refit_ship"),
3240
3250
  rename_ship: bind("spacemolt_ship", "rename_ship"),
3241
3251
  scrap_ship: bind("spacemolt_ship", "scrap_ship"),
3242
3252
  sell_ship_to_order: bind("spacemolt_ship", "sell_ship_to_order"),
3243
3253
  supply_commission: bind("spacemolt_ship", "supply_commission"),
3244
3254
  switch_ship: bind("spacemolt_ship", "switch_ship"),
3245
- view_ship_buy_orders: bind("spacemolt_ship", "view_ship_buy_orders")
3255
+ view_ship_buy_orders: bindBare("spacemolt_ship", "view_ship_buy_orders")
3246
3256
  },
3247
3257
  spacemolt_shipping: {
3248
3258
  accept: bind("spacemolt_shipping", "accept"),
@@ -3275,7 +3285,7 @@ function buildCommands(dispatch) {
3275
3285
  get_action_log: bind("spacemolt_social", "get_action_log"),
3276
3286
  get_chat_history: bind("spacemolt_social", "get_chat_history"),
3277
3287
  get_notes: bind("spacemolt_social", "get_notes"),
3278
- get_notification_settings: bind("spacemolt_social", "get_notification_settings"),
3288
+ get_notification_settings: bindBare("spacemolt_social", "get_notification_settings"),
3279
3289
  mute_notifications: bind("spacemolt_social", "mute_notifications"),
3280
3290
  petition: bind("spacemolt_social", "petition"),
3281
3291
  read_note: bind("spacemolt_social", "read_note"),
@@ -3292,7 +3302,7 @@ function buildCommands(dispatch) {
3292
3302
  withdraw: bind("spacemolt_storage", "withdraw")
3293
3303
  },
3294
3304
  spacemolt_transfer: {
3295
- get_trades: bind("spacemolt_transfer", "get_trades"),
3305
+ get_trades: bindBare("spacemolt_transfer", "get_trades"),
3296
3306
  trade_accept: bind("spacemolt_transfer", "trade_accept"),
3297
3307
  trade_cancel: bind("spacemolt_transfer", "trade_cancel"),
3298
3308
  trade_decline: bind("spacemolt_transfer", "trade_decline"),
@@ -4078,7 +4088,7 @@ class Account {
4078
4088
  }
4079
4089
  get commands() {
4080
4090
  if (!this._commands) {
4081
- this._commands = buildCommands((tool, action, payload) => this.send(tool, action, payload));
4091
+ this._commands = buildCommands((tool, action, payload, requestId) => this.send(tool, action, payload, requestId));
4082
4092
  }
4083
4093
  return this._commands;
4084
4094
  }
@@ -4213,25 +4223,25 @@ class Account {
4213
4223
  await this.query("spacemolt_auth", "logout");
4214
4224
  this._authenticated = false;
4215
4225
  }
4216
- query(tool, action, payload) {
4226
+ query(tool, action, payload, requestId) {
4217
4227
  return this.withRateLimitRetry(async () => {
4218
- const requestId = this.nextRequestId();
4219
- const promise = this.correlator.awaitQuery(requestId);
4220
- this.sendFrame(tool, action, payload, requestId);
4228
+ const id = this.claimRequestId(requestId);
4229
+ const promise = this.correlator.awaitQuery(id);
4230
+ this.sendFrame(tool, action, payload, id);
4221
4231
  try {
4222
4232
  return await withTimeout(promise, this.queryTimeoutMs, `No response to ${tool}/${action} within ${this.queryTimeoutMs}ms`);
4223
4233
  } catch (err) {
4224
- this.correlator.cancel(requestId);
4234
+ this.correlator.cancel(id);
4225
4235
  throw err;
4226
4236
  }
4227
4237
  });
4228
4238
  }
4229
- mutate(tool, action, payload, onAck) {
4239
+ mutate(tool, action, payload, onAck, requestId) {
4230
4240
  const mutationTimeoutMs = TRANSIT_ACTIONS.has(`${tool}/${action}`) ? this.mutationTimeoutMs : this.fastMutationTimeoutMs;
4231
4241
  return this.enqueueMutation(() => this.withRateLimitRetry(() => {
4232
- const requestId = this.nextRequestId();
4233
- const promise = this.awaitMutationWithTimeout(requestId, mutationTimeoutMs, onAck);
4234
- this.sendFrame(tool, action, payload, requestId);
4242
+ const id = this.claimRequestId(requestId);
4243
+ const promise = this.awaitMutationWithTimeout(id, mutationTimeoutMs, onAck);
4244
+ this.sendFrame(tool, action, payload, id);
4235
4245
  return promise;
4236
4246
  }));
4237
4247
  }
@@ -4261,9 +4271,9 @@ class Account {
4261
4271
  });
4262
4272
  });
4263
4273
  }
4264
- send(tool, action, payload) {
4274
+ send(tool, action, payload, requestId) {
4265
4275
  const def = ACTIONS[`${tool}/${action}`];
4266
- return def?.kind === "mutation" ? this.mutate(tool, action, payload) : this.query(tool, action, payload);
4276
+ return def?.kind === "mutation" ? this.mutate(tool, action, payload, undefined, requestId) : this.query(tool, action, payload, requestId);
4267
4277
  }
4268
4278
  on(type, handler) {
4269
4279
  return this.emitter.on(type, handler);
@@ -4399,7 +4409,18 @@ class Account {
4399
4409
  this.socket.send({ tool, action, ...payload ? { payload } : {}, request_id: requestId });
4400
4410
  }
4401
4411
  nextRequestId() {
4402
- return `r${++this.requestSeq}`;
4412
+ let id = `r${++this.requestSeq}`;
4413
+ while (this.correlator.has(id))
4414
+ id = `r${++this.requestSeq}`;
4415
+ return id;
4416
+ }
4417
+ claimRequestId(requestId) {
4418
+ if (!requestId)
4419
+ return this.nextRequestId();
4420
+ if (this.correlator.has(requestId)) {
4421
+ throw new SpacemoltError("duplicate_request_id", `request_id "${requestId}" is already in flight`);
4422
+ }
4423
+ return requestId;
4403
4424
  }
4404
4425
  routeFrame(frame) {
4405
4426
  if (isRecord(frame.payload))
@@ -5106,38 +5127,38 @@ var TYPED_NOTIFICATION_TYPES = [
5106
5127
  "trade_offer_received"
5107
5128
  ];
5108
5129
  export {
5109
- retryAfterMsFromClose,
5110
- mintWsToken,
5111
- isWelcomeFrame,
5112
- isResultFrame,
5113
- isRegisteredFrame,
5114
- isLoggedInFrame,
5115
- isErrorFrame,
5116
- isActionResultFrame,
5117
- isActionErrorFrame,
5118
- httpBaseFromWs,
5119
- fetchStations,
5120
- fetchMap,
5121
- fetchCatalogConditional,
5122
- fetchCatalog,
5123
- buildCommands,
5124
- TypedEmitter,
5125
- TYPED_NOTIFICATION_TYPES,
5126
- StateCache,
5127
- SpacemoltError,
5128
- SpacemoltClient,
5129
- Socket,
5130
- STATE_SECTIONS,
5131
- ObservationCache,
5132
- MemoryCredentialStore,
5133
- MarketCache,
5134
- MapCache,
5135
- GENERATED_SPEC_VERSION,
5136
- EventStream,
5137
- ConnectionClosedError,
5138
- ClerkSource,
5139
- CatalogCache,
5140
- CLOSE_CODE,
5130
+ ACTIONS,
5141
5131
  Account,
5142
- ACTIONS
5132
+ CLOSE_CODE,
5133
+ CatalogCache,
5134
+ ClerkSource,
5135
+ ConnectionClosedError,
5136
+ EventStream,
5137
+ GENERATED_SPEC_VERSION,
5138
+ MapCache,
5139
+ MarketCache,
5140
+ MemoryCredentialStore,
5141
+ ObservationCache,
5142
+ STATE_SECTIONS,
5143
+ Socket,
5144
+ SpacemoltClient,
5145
+ SpacemoltError,
5146
+ StateCache,
5147
+ TYPED_NOTIFICATION_TYPES,
5148
+ TypedEmitter,
5149
+ buildCommands,
5150
+ fetchCatalog,
5151
+ fetchCatalogConditional,
5152
+ fetchMap,
5153
+ fetchStations,
5154
+ httpBaseFromWs,
5155
+ isActionErrorFrame,
5156
+ isActionResultFrame,
5157
+ isErrorFrame,
5158
+ isLoggedInFrame,
5159
+ isRegisteredFrame,
5160
+ isResultFrame,
5161
+ isWelcomeFrame,
5162
+ mintWsToken,
5163
+ retryAfterMsFromClose
5143
5164
  };
package/dist/node.js CHANGED
@@ -29,24 +29,6 @@ function isStoredAccount(value) {
29
29
  }
30
30
  }
31
31
 
32
- class MemoryCredentialStore {
33
- accounts = new Map;
34
- list() {
35
- return Promise.resolve([...this.accounts.values()]);
36
- }
37
- get(id) {
38
- return Promise.resolve(this.accounts.get(id));
39
- }
40
- put(account) {
41
- this.accounts.set(account.id, account);
42
- return Promise.resolve();
43
- }
44
- remove(id) {
45
- this.accounts.delete(id);
46
- return Promise.resolve();
47
- }
48
- }
49
-
50
32
  // src/auth/file-store.ts
51
33
  class FileCredentialStore {
52
34
  path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacemolt/lib",
3
- "version": "12.0.0",
3
+ "version": "12.2.0",
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
  "module": "./dist/index.js",