@pryv/monitor 3.15.0 → 3.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pryv/monitor",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "description": "Extends `pryv` with event-driven notifications for changes on a Pryv.io account",
5
5
  "keywords": [
6
6
  "Pryv",
@@ -37,6 +37,7 @@ class Socket extends UpdateMethod {
37
37
  if (keys.includes('monStreams')) onStreams();
38
38
  });
39
39
  const scope = this.monitor.eventsGetScope || {};
40
+ /** @type {Record<string, unknown>} */
40
41
  const eventsQuery = {};
41
42
  for (const f of ['streams', 'types', 'content', 'clientData']) {
42
43
  if (scope[f] != null) eventsQuery[f] = scope[f];
@@ -68,7 +69,8 @@ class Socket extends UpdateMethod {
68
69
  // (i.e. SocketIO emitted 'error' after reconnect_failed), drop our
69
70
  // reference so a future Changes.READY can rebuild instead of
70
71
  // short-circuiting on the cached, dead handle.
71
- if (this.socket && !this.socket._io) {
72
+ // `_io` is the SocketIO instance's internal transport handle (not typed)
73
+ if (this.socket && !(/** @type {any} */ (this.socket))._io) {
72
74
  this.socket = null;
73
75
  }
74
76
  });
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import pryv, { Service, Connection, Auth, Browser, utils } from 'pryv';
1
+ import pryv, { Service, Connection, Auth, Browser, utils, Monitor } from 'pryv';
2
2
  import { EventEmitter } from 'events';
3
3
 
4
4
  /**
@@ -34,7 +34,7 @@ export type PryvLibrary = {
34
34
  * await mon.start();
35
35
  * ```
36
36
  */
37
- export default function extendPryvMonitor(pryvLib: PryvLibrary): typeof pryv.Monitor;
37
+ export default function extendPryvMonitor(pryvLib: PryvLibrary): typeof Monitor;
38
38
 
39
39
  declare module 'pryv' {
40
40
 
@@ -70,7 +70,7 @@ declare module 'pryv' {
70
70
  * Monitor changes on a Pryv.io account.
71
71
  */
72
72
  export class Monitor extends EventEmitter {
73
- constructor(apiEndpointOrConnection: APIEndpoint | Connection, eventsGetScope?: MonitorScope);
73
+ constructor(apiEndpointOrConnection: string | Connection, eventsGetScope?: MonitorScope);
74
74
 
75
75
  /** The connection used by this monitor */
76
76
  readonly connection: Connection;