hypha-rpc 0.21.38 → 0.21.40

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.
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2026-03-19T04:33:41.281Z
89
+ at 2026-04-18T12:07:11.181Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -4333,10 +4333,21 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
4333
4333
 
4334
4334
  _create_message(key, heartbeat, overwrite, context) {
4335
4335
  if (heartbeat) {
4336
- if (!this._object_store[key]) {
4336
+ const session = this._object_store[key];
4337
+ if (!session) {
4337
4338
  throw new Error(`session does not exist anymore: ${key}`);
4338
4339
  }
4339
- this._object_store[key]["timer"].reset();
4340
+ // Sessions created without a promise/timeout (e.g. _get_session_store
4341
+ // calls where timer && reject && _method_timeout was false) have no
4342
+ // timer. A chunked message still arrives with heartbeat=true because
4343
+ // the sender sets it based on whether session_id is truthy (rpc.js
4344
+ // ~L2358), not on whether the receiver's session owns a timer. Without
4345
+ // this guard, every chunk of such a session throws "Cannot read
4346
+ // properties of undefined (reading 'reset')", which cascades and
4347
+ // silently breaks the RPC message pipeline for the client.
4348
+ if (session.timer && typeof session.timer.reset === "function") {
4349
+ session.timer.reset();
4350
+ }
4340
4351
  }
4341
4352
 
4342
4353
  if (!this._object_store["message_cache"]) {
@@ -4385,10 +4396,21 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
4385
4396
 
4386
4397
  _append_message(key, data, heartbeat, context) {
4387
4398
  if (heartbeat) {
4388
- if (!this._object_store[key]) {
4399
+ const session = this._object_store[key];
4400
+ if (!session) {
4389
4401
  throw new Error(`session does not exist anymore: ${key}`);
4390
4402
  }
4391
- this._object_store[key]["timer"].reset();
4403
+ // Sessions created without a promise/timeout (e.g. _get_session_store
4404
+ // calls where timer && reject && _method_timeout was false) have no
4405
+ // timer. A chunked message still arrives with heartbeat=true because
4406
+ // the sender sets it based on whether session_id is truthy (rpc.js
4407
+ // ~L2358), not on whether the receiver's session owns a timer. Without
4408
+ // this guard, every chunk of such a session throws "Cannot read
4409
+ // properties of undefined (reading 'reset')", which cascades and
4410
+ // silently breaks the RPC message pipeline for the client.
4411
+ if (session.timer && typeof session.timer.reset === "function") {
4412
+ session.timer.reset();
4413
+ }
4392
4414
  }
4393
4415
  const cache = this._object_store["message_cache"];
4394
4416
  if (!cache[key]) {
@@ -4400,10 +4422,21 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
4400
4422
 
4401
4423
  _set_message(key, index, data, heartbeat, context) {
4402
4424
  if (heartbeat) {
4403
- if (!this._object_store[key]) {
4425
+ const session = this._object_store[key];
4426
+ if (!session) {
4404
4427
  throw new Error(`session does not exist anymore: ${key}`);
4405
4428
  }
4406
- this._object_store[key]["timer"].reset();
4429
+ // Sessions created without a promise/timeout (e.g. _get_session_store
4430
+ // calls where timer && reject && _method_timeout was false) have no
4431
+ // timer. A chunked message still arrives with heartbeat=true because
4432
+ // the sender sets it based on whether session_id is truthy (rpc.js
4433
+ // ~L2358), not on whether the receiver's session owns a timer. Without
4434
+ // this guard, every chunk of such a session throws "Cannot read
4435
+ // properties of undefined (reading 'reset')", which cascades and
4436
+ // silently breaks the RPC message pipeline for the client.
4437
+ if (session.timer && typeof session.timer.reset === "function") {
4438
+ session.timer.reset();
4439
+ }
4407
4440
  }
4408
4441
  const cache = this._object_store["message_cache"];
4409
4442
  if (!cache[key]) {
@@ -4423,10 +4456,21 @@ class RPC extends _utils_index_js__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
4423
4456
 
4424
4457
  _process_message(key, heartbeat, context) {
4425
4458
  if (heartbeat) {
4426
- if (!this._object_store[key]) {
4459
+ const session = this._object_store[key];
4460
+ if (!session) {
4427
4461
  throw new Error(`session does not exist anymore: ${key}`);
4428
4462
  }
4429
- this._object_store[key]["timer"].reset();
4463
+ // Sessions created without a promise/timeout (e.g. _get_session_store
4464
+ // calls where timer && reject && _method_timeout was false) have no
4465
+ // timer. A chunked message still arrives with heartbeat=true because
4466
+ // the sender sets it based on whether session_id is truthy (rpc.js
4467
+ // ~L2358), not on whether the receiver's session owns a timer. Without
4468
+ // this guard, every chunk of such a session throws "Cannot read
4469
+ // properties of undefined (reading 'reset')", which cascades and
4470
+ // silently breaks the RPC message pipeline for the client.
4471
+ if (session.timer && typeof session.timer.reset === "function") {
4472
+ session.timer.reset();
4473
+ }
4430
4474
  }
4431
4475
  const cache = this._object_store["message_cache"];
4432
4476
  (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__.assert)(!!context, "Context is required");