@spacemolt/lib 12.2.1 → 12.2.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.
- package/dist/index.js +11 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4230,8 +4230,8 @@ class Account {
|
|
|
4230
4230
|
return this.withRateLimitRetry(async () => {
|
|
4231
4231
|
const id = this.claimRequestId(requestId);
|
|
4232
4232
|
const promise = this.correlator.awaitQuery(id);
|
|
4233
|
-
this.sendFrame(tool, action, payload, id);
|
|
4234
4233
|
try {
|
|
4234
|
+
this.sendFrame(tool, action, payload, id);
|
|
4235
4235
|
return await withTimeout(promise, this.queryTimeoutMs, `No response to ${tool}/${action} within ${this.queryTimeoutMs}ms`);
|
|
4236
4236
|
} catch (err) {
|
|
4237
4237
|
this.correlator.cancel(id);
|
|
@@ -4243,12 +4243,10 @@ class Account {
|
|
|
4243
4243
|
const mutationTimeoutMs = TRANSIT_ACTIONS.has(`${tool}/${action}`) ? this.mutationTimeoutMs : this.fastMutationTimeoutMs;
|
|
4244
4244
|
return this.enqueueMutation(() => this.withRateLimitRetry(() => {
|
|
4245
4245
|
const id = this.claimRequestId(requestId);
|
|
4246
|
-
|
|
4247
|
-
this.sendFrame(tool, action, payload, id);
|
|
4248
|
-
return promise;
|
|
4246
|
+
return this.awaitMutationWithTimeout(id, mutationTimeoutMs, () => this.sendFrame(tool, action, payload, id), onAck);
|
|
4249
4247
|
}));
|
|
4250
4248
|
}
|
|
4251
|
-
awaitMutationWithTimeout(requestId, mutationTimeoutMs, onAck) {
|
|
4249
|
+
awaitMutationWithTimeout(requestId, mutationTimeoutMs, send, onAck) {
|
|
4252
4250
|
return new Promise((resolve, reject) => {
|
|
4253
4251
|
let timer;
|
|
4254
4252
|
const arm = (ms, message) => {
|
|
@@ -4272,6 +4270,14 @@ class Account {
|
|
|
4272
4270
|
clearTimeout(timer);
|
|
4273
4271
|
reject(err instanceof Error ? err : new Error(String(err)));
|
|
4274
4272
|
});
|
|
4273
|
+
try {
|
|
4274
|
+
send();
|
|
4275
|
+
} catch (err) {
|
|
4276
|
+
if (timer)
|
|
4277
|
+
clearTimeout(timer);
|
|
4278
|
+
this.correlator.cancel(requestId);
|
|
4279
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
4280
|
+
}
|
|
4275
4281
|
});
|
|
4276
4282
|
}
|
|
4277
4283
|
send(tool, action, payload, requestId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spacemolt/lib",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.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
|
"module": "./dist/index.js",
|