@spacemolt/lib 12.1.0 → 12.2.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/README.md +13 -0
- package/dist/account.d.ts +33 -3
- package/dist/generated/commands.gen.d.ts +282 -282
- package/dist/index.js +258 -121
- package/dist/node.js +0 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2988,7 +2988,8 @@ var ACTIONS = {
|
|
|
2988
2988
|
|
|
2989
2989
|
// src/generated/commands.gen.ts
|
|
2990
2990
|
function buildCommands(dispatch) {
|
|
2991
|
-
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);
|
|
2992
2993
|
return {
|
|
2993
2994
|
spacemolt: {
|
|
2994
2995
|
abandon_mission: bind("spacemolt", "abandon_mission"),
|
|
@@ -2997,45 +2998,45 @@ function buildCommands(dispatch) {
|
|
|
2997
2998
|
buy: bind("spacemolt", "buy"),
|
|
2998
2999
|
cloak: bind("spacemolt", "cloak"),
|
|
2999
3000
|
complete_mission: bind("spacemolt", "complete_mission"),
|
|
3000
|
-
completed_missions:
|
|
3001
|
+
completed_missions: bindBare("spacemolt", "completed_missions"),
|
|
3001
3002
|
craft: bind("spacemolt", "craft"),
|
|
3002
3003
|
decline_mission: bind("spacemolt", "decline_mission"),
|
|
3003
3004
|
distress_signal: bind("spacemolt", "distress_signal"),
|
|
3004
|
-
dock:
|
|
3005
|
+
dock: bindBare("spacemolt", "dock"),
|
|
3005
3006
|
find_route: bind("spacemolt", "find_route"),
|
|
3006
|
-
get_achievements:
|
|
3007
|
-
get_active_missions:
|
|
3008
|
-
get_base:
|
|
3009
|
-
get_cargo:
|
|
3010
|
-
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"),
|
|
3011
3012
|
get_empire_info: bind("spacemolt", "get_empire_info"),
|
|
3012
|
-
get_faction_achievements:
|
|
3013
|
+
get_faction_achievements: bindBare("spacemolt", "get_faction_achievements"),
|
|
3013
3014
|
get_guide: bind("spacemolt", "get_guide"),
|
|
3014
|
-
get_location:
|
|
3015
|
+
get_location: bindBare("spacemolt", "get_location"),
|
|
3015
3016
|
get_map: bind("spacemolt", "get_map"),
|
|
3016
|
-
get_missions:
|
|
3017
|
-
get_nearby:
|
|
3017
|
+
get_missions: bindBare("spacemolt", "get_missions"),
|
|
3018
|
+
get_nearby: bindBare("spacemolt", "get_nearby"),
|
|
3018
3019
|
get_notifications: bind("spacemolt", "get_notifications"),
|
|
3019
|
-
get_player:
|
|
3020
|
-
get_poi:
|
|
3021
|
-
get_queue:
|
|
3022
|
-
get_ship:
|
|
3023
|
-
get_skills:
|
|
3024
|
-
get_state:
|
|
3025
|
-
get_status:
|
|
3026
|
-
get_system:
|
|
3027
|
-
get_system_agents:
|
|
3028
|
-
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"),
|
|
3029
3030
|
get_version: bind("spacemolt", "get_version"),
|
|
3030
3031
|
hunt: bind("spacemolt", "hunt"),
|
|
3031
3032
|
inspect: bind("spacemolt", "inspect"),
|
|
3032
3033
|
install_mod: bind("spacemolt", "install_mod"),
|
|
3033
3034
|
jettison: bind("spacemolt", "jettison"),
|
|
3034
3035
|
jump: bind("spacemolt", "jump"),
|
|
3035
|
-
list_passengers:
|
|
3036
|
-
list_station_passengers:
|
|
3036
|
+
list_passengers: bindBare("spacemolt", "list_passengers"),
|
|
3037
|
+
list_station_passengers: bindBare("spacemolt", "list_station_passengers"),
|
|
3037
3038
|
load_passenger: bind("spacemolt", "load_passenger"),
|
|
3038
|
-
mine:
|
|
3039
|
+
mine: bindBare("spacemolt", "mine"),
|
|
3039
3040
|
prepay_tax: bind("spacemolt", "prepay_tax"),
|
|
3040
3041
|
recycle: bind("spacemolt", "recycle"),
|
|
3041
3042
|
refuel: bind("spacemolt", "refuel"),
|
|
@@ -3043,48 +3044,48 @@ function buildCommands(dispatch) {
|
|
|
3043
3044
|
repair_module: bind("spacemolt", "repair_module"),
|
|
3044
3045
|
scan: bind("spacemolt", "scan"),
|
|
3045
3046
|
search_systems: bind("spacemolt", "search_systems"),
|
|
3046
|
-
self_destruct:
|
|
3047
|
+
self_destruct: bindBare("spacemolt", "self_destruct"),
|
|
3047
3048
|
sell: bind("spacemolt", "sell"),
|
|
3048
3049
|
subscribe_observation: bind("spacemolt", "subscribe_observation"),
|
|
3049
|
-
survey_system:
|
|
3050
|
+
survey_system: bindBare("spacemolt", "survey_system"),
|
|
3050
3051
|
travel: bind("spacemolt", "travel"),
|
|
3051
|
-
undock:
|
|
3052
|
+
undock: bindBare("spacemolt", "undock"),
|
|
3052
3053
|
uninstall_mod: bind("spacemolt", "uninstall_mod"),
|
|
3053
3054
|
unload_passenger: bind("spacemolt", "unload_passenger"),
|
|
3054
|
-
unsubscribe_observation:
|
|
3055
|
+
unsubscribe_observation: bindBare("spacemolt", "unsubscribe_observation"),
|
|
3055
3056
|
use_item: bind("spacemolt", "use_item"),
|
|
3056
3057
|
view_completed_mission: bind("spacemolt", "view_completed_mission")
|
|
3057
3058
|
},
|
|
3058
3059
|
spacemolt_auth: {
|
|
3059
3060
|
claim: bind("spacemolt_auth", "claim"),
|
|
3060
3061
|
login: bind("spacemolt_auth", "login"),
|
|
3061
|
-
login_link:
|
|
3062
|
+
login_link: bindBare("spacemolt_auth", "login_link"),
|
|
3062
3063
|
login_link_poll: bind("spacemolt_auth", "login_link_poll"),
|
|
3063
3064
|
login_token: bind("spacemolt_auth", "login_token"),
|
|
3064
|
-
logout:
|
|
3065
|
+
logout: bindBare("spacemolt_auth", "logout"),
|
|
3065
3066
|
register: bind("spacemolt_auth", "register")
|
|
3066
3067
|
},
|
|
3067
3068
|
spacemolt_battle: {
|
|
3068
|
-
advance:
|
|
3069
|
+
advance: bindBare("spacemolt_battle", "advance"),
|
|
3069
3070
|
engage: bind("spacemolt_battle", "engage"),
|
|
3070
3071
|
log: bind("spacemolt_battle", "log"),
|
|
3071
3072
|
reload: bind("spacemolt_battle", "reload"),
|
|
3072
|
-
retreat:
|
|
3073
|
+
retreat: bindBare("spacemolt_battle", "retreat"),
|
|
3073
3074
|
stance: bind("spacemolt_battle", "stance"),
|
|
3074
|
-
status:
|
|
3075
|
+
status: bindBare("spacemolt_battle", "status"),
|
|
3075
3076
|
summary: bind("spacemolt_battle", "summary"),
|
|
3076
3077
|
target: bind("spacemolt_battle", "target")
|
|
3077
3078
|
},
|
|
3078
3079
|
spacemolt_citizenship: {
|
|
3079
3080
|
apply: bind("spacemolt_citizenship", "apply"),
|
|
3080
|
-
list:
|
|
3081
|
+
list: bindBare("spacemolt_citizenship", "list"),
|
|
3081
3082
|
renounce: bind("spacemolt_citizenship", "renounce"),
|
|
3082
3083
|
withdraw: bind("spacemolt_citizenship", "withdraw")
|
|
3083
3084
|
},
|
|
3084
3085
|
spacemolt_drone: {
|
|
3085
3086
|
deploy: bind("spacemolt_drone", "deploy"),
|
|
3086
3087
|
get: bind("spacemolt_drone", "get"),
|
|
3087
|
-
list:
|
|
3088
|
+
list: bindBare("spacemolt_drone", "list"),
|
|
3088
3089
|
load: bind("spacemolt_drone", "load"),
|
|
3089
3090
|
name: bind("spacemolt_drone", "name"),
|
|
3090
3091
|
recall: bind("spacemolt_drone", "recall"),
|
|
@@ -3095,7 +3096,7 @@ function buildCommands(dispatch) {
|
|
|
3095
3096
|
allow_faction: bind("spacemolt_facility", "allow_faction"),
|
|
3096
3097
|
allow_player: bind("spacemolt_facility", "allow_player"),
|
|
3097
3098
|
ban: bind("spacemolt_facility", "ban"),
|
|
3098
|
-
base_cost:
|
|
3099
|
+
base_cost: bindBare("spacemolt_facility", "base_cost"),
|
|
3099
3100
|
browse_for_sale: bind("spacemolt_facility", "browse_for_sale"),
|
|
3100
3101
|
build: bind("spacemolt_facility", "build"),
|
|
3101
3102
|
buy_listing: bind("spacemolt_facility", "buy_listing"),
|
|
@@ -3103,21 +3104,21 @@ function buildCommands(dispatch) {
|
|
|
3103
3104
|
cancel_listing: bind("spacemolt_facility", "cancel_listing"),
|
|
3104
3105
|
deploy_outpost: bind("spacemolt_facility", "deploy_outpost"),
|
|
3105
3106
|
dismantle: bind("spacemolt_facility", "dismantle"),
|
|
3106
|
-
dismantle_outpost:
|
|
3107
|
+
dismantle_outpost: bindBare("spacemolt_facility", "dismantle_outpost"),
|
|
3107
3108
|
facility_set_description: bind("spacemolt_facility", "facility_set_description"),
|
|
3108
3109
|
faction_build: bind("spacemolt_facility", "faction_build"),
|
|
3109
3110
|
faction_dismantle: bind("spacemolt_facility", "faction_dismantle"),
|
|
3110
|
-
faction_list:
|
|
3111
|
-
faction_owned:
|
|
3111
|
+
faction_list: bindBare("spacemolt_facility", "faction_list"),
|
|
3112
|
+
faction_owned: bindBare("spacemolt_facility", "faction_owned"),
|
|
3112
3113
|
faction_upgrade: bind("spacemolt_facility", "faction_upgrade"),
|
|
3113
3114
|
found_station: bind("spacemolt_facility", "found_station"),
|
|
3114
3115
|
job_add: bind("spacemolt_facility", "job_add"),
|
|
3115
3116
|
job_cancel: bind("spacemolt_facility", "job_cancel"),
|
|
3116
3117
|
job_list: bind("spacemolt_facility", "job_list"),
|
|
3117
3118
|
job_reorder: bind("spacemolt_facility", "job_reorder"),
|
|
3118
|
-
list:
|
|
3119
|
+
list: bindBare("spacemolt_facility", "list"),
|
|
3119
3120
|
list_for_sale: bind("spacemolt_facility", "list_for_sale"),
|
|
3120
|
-
owned:
|
|
3121
|
+
owned: bindBare("spacemolt_facility", "owned"),
|
|
3121
3122
|
personal_build: bind("spacemolt_facility", "personal_build"),
|
|
3122
3123
|
personal_decorate: bind("spacemolt_facility", "personal_decorate"),
|
|
3123
3124
|
personal_visit: bind("spacemolt_facility", "personal_visit"),
|
|
@@ -3137,13 +3138,13 @@ function buildCommands(dispatch) {
|
|
|
3137
3138
|
set_refuel_price: bind("spacemolt_facility", "set_refuel_price"),
|
|
3138
3139
|
set_repair_price: bind("spacemolt_facility", "set_repair_price"),
|
|
3139
3140
|
set_service_access: bind("spacemolt_facility", "set_service_access"),
|
|
3140
|
-
station_info:
|
|
3141
|
+
station_info: bindBare("spacemolt_facility", "station_info"),
|
|
3141
3142
|
station_set_name: bind("spacemolt_facility", "station_set_name"),
|
|
3142
3143
|
transfer: bind("spacemolt_facility", "transfer"),
|
|
3143
3144
|
types: bind("spacemolt_facility", "types"),
|
|
3144
3145
|
unban: bind("spacemolt_facility", "unban"),
|
|
3145
3146
|
upgrade: bind("spacemolt_facility", "upgrade"),
|
|
3146
|
-
upgrades:
|
|
3147
|
+
upgrades: bindBare("spacemolt_facility", "upgrades")
|
|
3147
3148
|
},
|
|
3148
3149
|
spacemolt_faction: {
|
|
3149
3150
|
accept_ally: bind("spacemolt_faction", "accept_ally"),
|
|
@@ -3155,23 +3156,23 @@ function buildCommands(dispatch) {
|
|
|
3155
3156
|
decline_invite: bind("spacemolt_faction", "decline_invite"),
|
|
3156
3157
|
delete_role: bind("spacemolt_faction", "delete_role"),
|
|
3157
3158
|
delete_room: bind("spacemolt_faction", "delete_room"),
|
|
3158
|
-
garages:
|
|
3159
|
-
get_invites:
|
|
3159
|
+
garages: bindBare("spacemolt_faction", "garages"),
|
|
3160
|
+
get_invites: bindBare("spacemolt_faction", "get_invites"),
|
|
3160
3161
|
info: bind("spacemolt_faction", "info"),
|
|
3161
3162
|
invite: bind("spacemolt_faction", "invite"),
|
|
3162
3163
|
join: bind("spacemolt_faction", "join"),
|
|
3163
3164
|
kick: bind("spacemolt_faction", "kick"),
|
|
3164
|
-
leave:
|
|
3165
|
+
leave: bindBare("spacemolt_faction", "leave"),
|
|
3165
3166
|
list: bind("spacemolt_faction", "list"),
|
|
3166
|
-
list_missions:
|
|
3167
|
+
list_missions: bindBare("spacemolt_faction", "list_missions"),
|
|
3167
3168
|
prepay_tax: bind("spacemolt_faction", "prepay_tax"),
|
|
3168
3169
|
propose_ally: bind("spacemolt_faction", "propose_ally"),
|
|
3169
3170
|
propose_peace: bind("spacemolt_faction", "propose_peace"),
|
|
3170
3171
|
remove_ally: bind("spacemolt_faction", "remove_ally"),
|
|
3171
3172
|
remove_enemy: bind("spacemolt_faction", "remove_enemy"),
|
|
3172
|
-
rooms:
|
|
3173
|
+
rooms: bindBare("spacemolt_faction", "rooms"),
|
|
3173
3174
|
set_enemy: bind("spacemolt_faction", "set_enemy"),
|
|
3174
|
-
tax_estimate:
|
|
3175
|
+
tax_estimate: bindBare("spacemolt_faction", "tax_estimate"),
|
|
3175
3176
|
visit_room: bind("spacemolt_faction", "visit_room"),
|
|
3176
3177
|
withdraw_invite: bind("spacemolt_faction", "withdraw_invite")
|
|
3177
3178
|
},
|
|
@@ -3188,50 +3189,50 @@ function buildCommands(dispatch) {
|
|
|
3188
3189
|
create_sell_order: bind("spacemolt_faction_commerce", "create_sell_order")
|
|
3189
3190
|
},
|
|
3190
3191
|
spacemolt_fleet: {
|
|
3191
|
-
accept:
|
|
3192
|
+
accept: bindBare("spacemolt_fleet", "accept"),
|
|
3192
3193
|
board: bind("spacemolt_fleet", "board"),
|
|
3193
|
-
create:
|
|
3194
|
-
decline:
|
|
3195
|
-
disband:
|
|
3196
|
-
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"),
|
|
3197
3198
|
invite: bind("spacemolt_fleet", "invite"),
|
|
3198
3199
|
kick: bind("spacemolt_fleet", "kick"),
|
|
3199
|
-
leave:
|
|
3200
|
-
status:
|
|
3200
|
+
leave: bindBare("spacemolt_fleet", "leave"),
|
|
3201
|
+
status: bindBare("spacemolt_fleet", "status")
|
|
3201
3202
|
},
|
|
3202
3203
|
spacemolt_intel: {
|
|
3203
|
-
espionage:
|
|
3204
|
-
intel_status:
|
|
3204
|
+
espionage: bindBare("spacemolt_intel", "espionage"),
|
|
3205
|
+
intel_status: bindBare("spacemolt_intel", "intel_status"),
|
|
3205
3206
|
query_intel: bind("spacemolt_intel", "query_intel"),
|
|
3206
3207
|
query_trade_intel: bind("spacemolt_intel", "query_trade_intel"),
|
|
3207
3208
|
scan_poi: bind("spacemolt_intel", "scan_poi"),
|
|
3208
3209
|
submit_intel: bind("spacemolt_intel", "submit_intel"),
|
|
3209
3210
|
submit_trade_intel: bind("spacemolt_intel", "submit_trade_intel"),
|
|
3210
|
-
trade_intel_status:
|
|
3211
|
+
trade_intel_status: bindBare("spacemolt_intel", "trade_intel_status")
|
|
3211
3212
|
},
|
|
3212
3213
|
spacemolt_market: {
|
|
3213
|
-
analyze_market:
|
|
3214
|
+
analyze_market: bindBare("spacemolt_market", "analyze_market"),
|
|
3214
3215
|
cancel_order: bind("spacemolt_market", "cancel_order"),
|
|
3215
3216
|
create_buy_order: bind("spacemolt_market", "create_buy_order"),
|
|
3216
3217
|
create_sell_order: bind("spacemolt_market", "create_sell_order"),
|
|
3217
3218
|
estimate_purchase: bind("spacemolt_market", "estimate_purchase"),
|
|
3218
3219
|
modify_order: bind("spacemolt_market", "modify_order"),
|
|
3219
|
-
subscribe_market:
|
|
3220
|
-
unsubscribe_market:
|
|
3220
|
+
subscribe_market: bindBare("spacemolt_market", "subscribe_market"),
|
|
3221
|
+
unsubscribe_market: bindBare("spacemolt_market", "unsubscribe_market"),
|
|
3221
3222
|
view_market: bind("spacemolt_market", "view_market"),
|
|
3222
3223
|
view_orders: bind("spacemolt_market", "view_orders")
|
|
3223
3224
|
},
|
|
3224
3225
|
spacemolt_salvage: {
|
|
3225
|
-
insure:
|
|
3226
|
+
insure: bindBare("spacemolt_salvage", "insure"),
|
|
3226
3227
|
loot: bind("spacemolt_salvage", "loot"),
|
|
3227
|
-
policies:
|
|
3228
|
-
quote:
|
|
3229
|
-
release:
|
|
3230
|
-
scrap:
|
|
3231
|
-
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"),
|
|
3232
3233
|
set_home: bind("spacemolt_salvage", "set_home"),
|
|
3233
3234
|
tow: bind("spacemolt_salvage", "tow"),
|
|
3234
|
-
wrecks:
|
|
3235
|
+
wrecks: bindBare("spacemolt_salvage", "wrecks")
|
|
3235
3236
|
},
|
|
3236
3237
|
spacemolt_ship: {
|
|
3237
3238
|
browse_ships: bind("spacemolt_ship", "browse_ships"),
|
|
@@ -3243,15 +3244,15 @@ function buildCommands(dispatch) {
|
|
|
3243
3244
|
commission_ship: bind("spacemolt_ship", "commission_ship"),
|
|
3244
3245
|
commission_status: bind("spacemolt_ship", "commission_status"),
|
|
3245
3246
|
list_ship_for_sale: bind("spacemolt_ship", "list_ship_for_sale"),
|
|
3246
|
-
list_ships:
|
|
3247
|
+
list_ships: bindBare("spacemolt_ship", "list_ships"),
|
|
3247
3248
|
place_ship_buy_order: bind("spacemolt_ship", "place_ship_buy_order"),
|
|
3248
|
-
refit_ship:
|
|
3249
|
+
refit_ship: bindBare("spacemolt_ship", "refit_ship"),
|
|
3249
3250
|
rename_ship: bind("spacemolt_ship", "rename_ship"),
|
|
3250
3251
|
scrap_ship: bind("spacemolt_ship", "scrap_ship"),
|
|
3251
3252
|
sell_ship_to_order: bind("spacemolt_ship", "sell_ship_to_order"),
|
|
3252
3253
|
supply_commission: bind("spacemolt_ship", "supply_commission"),
|
|
3253
3254
|
switch_ship: bind("spacemolt_ship", "switch_ship"),
|
|
3254
|
-
view_ship_buy_orders:
|
|
3255
|
+
view_ship_buy_orders: bindBare("spacemolt_ship", "view_ship_buy_orders")
|
|
3255
3256
|
},
|
|
3256
3257
|
spacemolt_shipping: {
|
|
3257
3258
|
accept: bind("spacemolt_shipping", "accept"),
|
|
@@ -3284,7 +3285,7 @@ function buildCommands(dispatch) {
|
|
|
3284
3285
|
get_action_log: bind("spacemolt_social", "get_action_log"),
|
|
3285
3286
|
get_chat_history: bind("spacemolt_social", "get_chat_history"),
|
|
3286
3287
|
get_notes: bind("spacemolt_social", "get_notes"),
|
|
3287
|
-
get_notification_settings:
|
|
3288
|
+
get_notification_settings: bindBare("spacemolt_social", "get_notification_settings"),
|
|
3288
3289
|
mute_notifications: bind("spacemolt_social", "mute_notifications"),
|
|
3289
3290
|
petition: bind("spacemolt_social", "petition"),
|
|
3290
3291
|
read_note: bind("spacemolt_social", "read_note"),
|
|
@@ -3301,7 +3302,7 @@ function buildCommands(dispatch) {
|
|
|
3301
3302
|
withdraw: bind("spacemolt_storage", "withdraw")
|
|
3302
3303
|
},
|
|
3303
3304
|
spacemolt_transfer: {
|
|
3304
|
-
get_trades:
|
|
3305
|
+
get_trades: bindBare("spacemolt_transfer", "get_trades"),
|
|
3305
3306
|
trade_accept: bind("spacemolt_transfer", "trade_accept"),
|
|
3306
3307
|
trade_cancel: bind("spacemolt_transfer", "trade_cancel"),
|
|
3307
3308
|
trade_decline: bind("spacemolt_transfer", "trade_decline"),
|
|
@@ -4026,6 +4027,7 @@ class Account {
|
|
|
4026
4027
|
subscribedMarketBaseId;
|
|
4027
4028
|
observationSubscribedState = false;
|
|
4028
4029
|
observationActiveScanState = false;
|
|
4030
|
+
stateRevision = 0;
|
|
4029
4031
|
subscribedObservationPoiId;
|
|
4030
4032
|
reconnectedListeners = new Set;
|
|
4031
4033
|
reconnectingListeners = new Set;
|
|
@@ -4087,7 +4089,7 @@ class Account {
|
|
|
4087
4089
|
}
|
|
4088
4090
|
get commands() {
|
|
4089
4091
|
if (!this._commands) {
|
|
4090
|
-
this._commands = buildCommands((tool, action, payload) => this.send(tool, action, payload));
|
|
4092
|
+
this._commands = buildCommands((tool, action, payload, requestId) => this.send(tool, action, payload, requestId));
|
|
4091
4093
|
}
|
|
4092
4094
|
return this._commands;
|
|
4093
4095
|
}
|
|
@@ -4194,6 +4196,8 @@ class Account {
|
|
|
4194
4196
|
const result = await this.commands.spacemolt.get_status();
|
|
4195
4197
|
const snapshot = requireStructuredContent(result, "spacemolt/get_status");
|
|
4196
4198
|
const changed = this.cache.seed(snapshot);
|
|
4199
|
+
if (changed.length)
|
|
4200
|
+
this.stateRevision++;
|
|
4197
4201
|
if (changed.includes("location"))
|
|
4198
4202
|
this.checkSubscriptionsAgainstLocation();
|
|
4199
4203
|
if (changed.length)
|
|
@@ -4222,25 +4226,25 @@ class Account {
|
|
|
4222
4226
|
await this.query("spacemolt_auth", "logout");
|
|
4223
4227
|
this._authenticated = false;
|
|
4224
4228
|
}
|
|
4225
|
-
query(tool, action, payload) {
|
|
4229
|
+
query(tool, action, payload, requestId) {
|
|
4226
4230
|
return this.withRateLimitRetry(async () => {
|
|
4227
|
-
const
|
|
4228
|
-
const promise = this.correlator.awaitQuery(
|
|
4229
|
-
this.sendFrame(tool, action, payload,
|
|
4231
|
+
const id = this.claimRequestId(requestId);
|
|
4232
|
+
const promise = this.correlator.awaitQuery(id);
|
|
4233
|
+
this.sendFrame(tool, action, payload, id);
|
|
4230
4234
|
try {
|
|
4231
4235
|
return await withTimeout(promise, this.queryTimeoutMs, `No response to ${tool}/${action} within ${this.queryTimeoutMs}ms`);
|
|
4232
4236
|
} catch (err) {
|
|
4233
|
-
this.correlator.cancel(
|
|
4237
|
+
this.correlator.cancel(id);
|
|
4234
4238
|
throw err;
|
|
4235
4239
|
}
|
|
4236
4240
|
});
|
|
4237
4241
|
}
|
|
4238
|
-
mutate(tool, action, payload, onAck) {
|
|
4242
|
+
mutate(tool, action, payload, onAck, requestId) {
|
|
4239
4243
|
const mutationTimeoutMs = TRANSIT_ACTIONS.has(`${tool}/${action}`) ? this.mutationTimeoutMs : this.fastMutationTimeoutMs;
|
|
4240
4244
|
return this.enqueueMutation(() => this.withRateLimitRetry(() => {
|
|
4241
|
-
const
|
|
4242
|
-
const promise = this.awaitMutationWithTimeout(
|
|
4243
|
-
this.sendFrame(tool, action, payload,
|
|
4245
|
+
const id = this.claimRequestId(requestId);
|
|
4246
|
+
const promise = this.awaitMutationWithTimeout(id, mutationTimeoutMs, onAck);
|
|
4247
|
+
this.sendFrame(tool, action, payload, id);
|
|
4244
4248
|
return promise;
|
|
4245
4249
|
}));
|
|
4246
4250
|
}
|
|
@@ -4270,9 +4274,9 @@ class Account {
|
|
|
4270
4274
|
});
|
|
4271
4275
|
});
|
|
4272
4276
|
}
|
|
4273
|
-
send(tool, action, payload) {
|
|
4277
|
+
send(tool, action, payload, requestId) {
|
|
4274
4278
|
const def = ACTIONS[`${tool}/${action}`];
|
|
4275
|
-
return def?.kind === "mutation" ? this.mutate(tool, action, payload) : this.query(tool, action, payload);
|
|
4279
|
+
return def?.kind === "mutation" ? this.mutate(tool, action, payload, undefined, requestId) : this.query(tool, action, payload, requestId);
|
|
4276
4280
|
}
|
|
4277
4281
|
on(type, handler) {
|
|
4278
4282
|
return this.emitter.on(type, handler);
|
|
@@ -4330,6 +4334,8 @@ class Account {
|
|
|
4330
4334
|
nearby_players: nearbyPlayers,
|
|
4331
4335
|
nearby_player_count: view.nearby.size
|
|
4332
4336
|
});
|
|
4337
|
+
if (changed.length)
|
|
4338
|
+
this.stateRevision++;
|
|
4333
4339
|
if (changed.length)
|
|
4334
4340
|
this.emitStateChange(changed);
|
|
4335
4341
|
}
|
|
@@ -4348,6 +4354,123 @@ class Account {
|
|
|
4348
4354
|
this.subscribedObservationPoiId = undefined;
|
|
4349
4355
|
}
|
|
4350
4356
|
}
|
|
4357
|
+
applyFleetMovementPush(frame) {
|
|
4358
|
+
if (frame.type !== "ok" || !isRecord(frame.payload) || typeof frame.payload.action !== "string")
|
|
4359
|
+
return;
|
|
4360
|
+
const payload = frame.payload;
|
|
4361
|
+
let changed = [];
|
|
4362
|
+
let reconcile = false;
|
|
4363
|
+
const currentLocation = this.cache.location;
|
|
4364
|
+
const currentSystem = {
|
|
4365
|
+
connections: currentLocation?.connections,
|
|
4366
|
+
empire: currentLocation?.empire,
|
|
4367
|
+
security_status: currentLocation?.security_status,
|
|
4368
|
+
system_id: currentLocation?.system_id,
|
|
4369
|
+
system_name: currentLocation?.system_name
|
|
4370
|
+
};
|
|
4371
|
+
switch (payload.action) {
|
|
4372
|
+
case "fleet_jump": {
|
|
4373
|
+
if (typeof payload.destination !== "string" || typeof payload.arrival_tick !== "number") {
|
|
4374
|
+
this.warnMalformedFrame(frame);
|
|
4375
|
+
return;
|
|
4376
|
+
}
|
|
4377
|
+
changed = this.cache.applyDelta({
|
|
4378
|
+
location: {
|
|
4379
|
+
in_transit: true,
|
|
4380
|
+
transit_arrival_tick: payload.arrival_tick,
|
|
4381
|
+
transit_dest_system_id: payload.destination,
|
|
4382
|
+
transit_type: "jump"
|
|
4383
|
+
}
|
|
4384
|
+
});
|
|
4385
|
+
reconcile = true;
|
|
4386
|
+
break;
|
|
4387
|
+
}
|
|
4388
|
+
case "jumped":
|
|
4389
|
+
case "pathfinder_arrival": {
|
|
4390
|
+
if (typeof payload.system_id !== "string" || typeof payload.system !== "string") {
|
|
4391
|
+
this.warnMalformedFrame(frame);
|
|
4392
|
+
return;
|
|
4393
|
+
}
|
|
4394
|
+
changed = this.cache.applyDelta({
|
|
4395
|
+
location: {
|
|
4396
|
+
in_transit: false,
|
|
4397
|
+
poi_id: typeof payload.poi === "string" ? payload.poi : undefined,
|
|
4398
|
+
system_id: payload.system_id,
|
|
4399
|
+
system_name: payload.system
|
|
4400
|
+
}
|
|
4401
|
+
});
|
|
4402
|
+
reconcile = true;
|
|
4403
|
+
break;
|
|
4404
|
+
}
|
|
4405
|
+
case "fleet_travel": {
|
|
4406
|
+
if (typeof payload.destination !== "string" || typeof payload.arrival_tick !== "number") {
|
|
4407
|
+
this.warnMalformedFrame(frame);
|
|
4408
|
+
return;
|
|
4409
|
+
}
|
|
4410
|
+
changed = this.cache.applyDelta({
|
|
4411
|
+
location: {
|
|
4412
|
+
...currentSystem,
|
|
4413
|
+
in_transit: true,
|
|
4414
|
+
transit_arrival_tick: payload.arrival_tick,
|
|
4415
|
+
transit_dest_poi_id: payload.destination,
|
|
4416
|
+
transit_type: "travel"
|
|
4417
|
+
}
|
|
4418
|
+
});
|
|
4419
|
+
reconcile = true;
|
|
4420
|
+
break;
|
|
4421
|
+
}
|
|
4422
|
+
case "arrived": {
|
|
4423
|
+
if (typeof payload.poi_id !== "string" || typeof payload.poi !== "string") {
|
|
4424
|
+
this.warnMalformedFrame(frame);
|
|
4425
|
+
return;
|
|
4426
|
+
}
|
|
4427
|
+
changed = this.cache.applyDelta({
|
|
4428
|
+
location: {
|
|
4429
|
+
...currentSystem,
|
|
4430
|
+
in_transit: false,
|
|
4431
|
+
poi_id: payload.poi_id,
|
|
4432
|
+
poi_name: payload.poi
|
|
4433
|
+
}
|
|
4434
|
+
});
|
|
4435
|
+
reconcile = true;
|
|
4436
|
+
break;
|
|
4437
|
+
}
|
|
4438
|
+
case "fleet_undock":
|
|
4439
|
+
changed = currentLocation ? this.cache.patchSection("location", { docked_at: undefined }) : this.cache.applyDelta({ location: {} });
|
|
4440
|
+
break;
|
|
4441
|
+
case "fleet_dock":
|
|
4442
|
+
reconcile = true;
|
|
4443
|
+
break;
|
|
4444
|
+
default:
|
|
4445
|
+
return;
|
|
4446
|
+
}
|
|
4447
|
+
const revision = ++this.stateRevision;
|
|
4448
|
+
if (changed.includes("location"))
|
|
4449
|
+
this.checkSubscriptionsAgainstLocation();
|
|
4450
|
+
if (changed.length)
|
|
4451
|
+
this.emitStateChange(changed);
|
|
4452
|
+
if (reconcile)
|
|
4453
|
+
this.reconcileFleetState(revision, payload.action);
|
|
4454
|
+
}
|
|
4455
|
+
async reconcileFleetState(revision, action) {
|
|
4456
|
+
try {
|
|
4457
|
+
const result = await this.commands.spacemolt.get_status();
|
|
4458
|
+
const snapshot = requireStructuredContent(result, "spacemolt/get_status");
|
|
4459
|
+
if (revision !== this.stateRevision)
|
|
4460
|
+
return;
|
|
4461
|
+
const changed = this.cache.seed(snapshot);
|
|
4462
|
+
if (changed.length)
|
|
4463
|
+
this.stateRevision++;
|
|
4464
|
+
if (changed.includes("location"))
|
|
4465
|
+
this.checkSubscriptionsAgainstLocation();
|
|
4466
|
+
if (changed.length)
|
|
4467
|
+
this.emitStateChange(changed);
|
|
4468
|
+
} catch (err) {
|
|
4469
|
+
if (revision === this.stateRevision) {
|
|
4470
|
+
console.warn(`[spacemolt] failed to reconcile state after ${action}`, err);
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4351
4474
|
close() {
|
|
4352
4475
|
this.userClosing = true;
|
|
4353
4476
|
this.socket.close();
|
|
@@ -4408,7 +4531,18 @@ class Account {
|
|
|
4408
4531
|
this.socket.send({ tool, action, ...payload ? { payload } : {}, request_id: requestId });
|
|
4409
4532
|
}
|
|
4410
4533
|
nextRequestId() {
|
|
4411
|
-
|
|
4534
|
+
let id = `r${++this.requestSeq}`;
|
|
4535
|
+
while (this.correlator.has(id))
|
|
4536
|
+
id = `r${++this.requestSeq}`;
|
|
4537
|
+
return id;
|
|
4538
|
+
}
|
|
4539
|
+
claimRequestId(requestId) {
|
|
4540
|
+
if (!requestId)
|
|
4541
|
+
return this.nextRequestId();
|
|
4542
|
+
if (this.correlator.has(requestId)) {
|
|
4543
|
+
throw new SpacemoltError("duplicate_request_id", `request_id "${requestId}" is already in flight`);
|
|
4544
|
+
}
|
|
4545
|
+
return requestId;
|
|
4412
4546
|
}
|
|
4413
4547
|
routeFrame(frame) {
|
|
4414
4548
|
if (isRecord(frame.payload))
|
|
@@ -4453,6 +4587,8 @@ class Account {
|
|
|
4453
4587
|
const delta = frame.payload.result;
|
|
4454
4588
|
if (delta) {
|
|
4455
4589
|
const changed = this.cache.applyDelta(delta);
|
|
4590
|
+
if (changed.length)
|
|
4591
|
+
this.stateRevision++;
|
|
4456
4592
|
if (changed.includes("location"))
|
|
4457
4593
|
this.checkSubscriptionsAgainstLocation();
|
|
4458
4594
|
if (changed.length)
|
|
@@ -4487,6 +4623,7 @@ class Account {
|
|
|
4487
4623
|
return;
|
|
4488
4624
|
}
|
|
4489
4625
|
default:
|
|
4626
|
+
this.applyFleetMovementPush(frame);
|
|
4490
4627
|
this.emitter.emit(frame);
|
|
4491
4628
|
}
|
|
4492
4629
|
}
|
|
@@ -5115,38 +5252,38 @@ var TYPED_NOTIFICATION_TYPES = [
|
|
|
5115
5252
|
"trade_offer_received"
|
|
5116
5253
|
];
|
|
5117
5254
|
export {
|
|
5118
|
-
|
|
5119
|
-
mintWsToken,
|
|
5120
|
-
isWelcomeFrame,
|
|
5121
|
-
isResultFrame,
|
|
5122
|
-
isRegisteredFrame,
|
|
5123
|
-
isLoggedInFrame,
|
|
5124
|
-
isErrorFrame,
|
|
5125
|
-
isActionResultFrame,
|
|
5126
|
-
isActionErrorFrame,
|
|
5127
|
-
httpBaseFromWs,
|
|
5128
|
-
fetchStations,
|
|
5129
|
-
fetchMap,
|
|
5130
|
-
fetchCatalogConditional,
|
|
5131
|
-
fetchCatalog,
|
|
5132
|
-
buildCommands,
|
|
5133
|
-
TypedEmitter,
|
|
5134
|
-
TYPED_NOTIFICATION_TYPES,
|
|
5135
|
-
StateCache,
|
|
5136
|
-
SpacemoltError,
|
|
5137
|
-
SpacemoltClient,
|
|
5138
|
-
Socket,
|
|
5139
|
-
STATE_SECTIONS,
|
|
5140
|
-
ObservationCache,
|
|
5141
|
-
MemoryCredentialStore,
|
|
5142
|
-
MarketCache,
|
|
5143
|
-
MapCache,
|
|
5144
|
-
GENERATED_SPEC_VERSION,
|
|
5145
|
-
EventStream,
|
|
5146
|
-
ConnectionClosedError,
|
|
5147
|
-
ClerkSource,
|
|
5148
|
-
CatalogCache,
|
|
5149
|
-
CLOSE_CODE,
|
|
5255
|
+
ACTIONS,
|
|
5150
5256
|
Account,
|
|
5151
|
-
|
|
5257
|
+
CLOSE_CODE,
|
|
5258
|
+
CatalogCache,
|
|
5259
|
+
ClerkSource,
|
|
5260
|
+
ConnectionClosedError,
|
|
5261
|
+
EventStream,
|
|
5262
|
+
GENERATED_SPEC_VERSION,
|
|
5263
|
+
MapCache,
|
|
5264
|
+
MarketCache,
|
|
5265
|
+
MemoryCredentialStore,
|
|
5266
|
+
ObservationCache,
|
|
5267
|
+
STATE_SECTIONS,
|
|
5268
|
+
Socket,
|
|
5269
|
+
SpacemoltClient,
|
|
5270
|
+
SpacemoltError,
|
|
5271
|
+
StateCache,
|
|
5272
|
+
TYPED_NOTIFICATION_TYPES,
|
|
5273
|
+
TypedEmitter,
|
|
5274
|
+
buildCommands,
|
|
5275
|
+
fetchCatalog,
|
|
5276
|
+
fetchCatalogConditional,
|
|
5277
|
+
fetchMap,
|
|
5278
|
+
fetchStations,
|
|
5279
|
+
httpBaseFromWs,
|
|
5280
|
+
isActionErrorFrame,
|
|
5281
|
+
isActionResultFrame,
|
|
5282
|
+
isErrorFrame,
|
|
5283
|
+
isLoggedInFrame,
|
|
5284
|
+
isRegisteredFrame,
|
|
5285
|
+
isResultFrame,
|
|
5286
|
+
isWelcomeFrame,
|
|
5287
|
+
mintWsToken,
|
|
5288
|
+
retryAfterMsFromClose
|
|
5152
5289
|
};
|
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;
|