iosignal 7.2.0 → 8.0.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.
@@ -334,7 +334,9 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
334
334
  stop(): void;
335
335
  /**
336
336
  * Permanently destroys the instance, cleaning up all resources.
337
- * The instance will not be usable after this.
337
+ * The instance will not be usable after this. Later signal()/publish()/subscribe()
338
+ * calls are silently dropped, the same as sends while disconnected, and call()
339
+ * rejects with code 'CONNECTION_CLOSED'.
338
340
  */
339
341
  destroy(): void;
340
342
  /**
@@ -417,6 +419,7 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
417
419
  getEncryptionMode(): boolean;
418
420
  /**
419
421
  * Sends data with encryption based on the encryption mode.
422
+ * Like an unconnected socket, a destroyed instance silently drops the data.
420
423
  * @param {Buffer} data - The data buffer to send.
421
424
  * @param {boolean} [useEncryption] - Optional. Force encryption or not. If undefined, uses default policy.
422
425
  */
@@ -785,6 +788,8 @@ declare class Manager {
785
788
  subscribe(chArr: any, remote: any): any;
786
789
  unsubscribe(chArr: any, remote: any): void;
787
790
  monitor(): void;
791
+ anonymousCidRandom(size: any): Buffer<ArrayBuffer>;
792
+ issueAnonymousCid(): string | null;
788
793
  closeRemoteByCId(cid: any): 0 | 1;
789
794
  close(): void;
790
795
  }
@@ -797,6 +802,7 @@ declare class Server extends EventEmitter$1<[never]> {
797
802
  constructor(options: object, authManager?: any);
798
803
  security: any;
799
804
  serviceNames: Set<any>;
805
+ services: Map<any, any>;
800
806
  wss: {};
801
807
  port: number | null;
802
808
  congPort: number | null;
@@ -876,6 +882,7 @@ declare namespace serverOption {
876
882
  }
877
883
  export namespace auth_1 {
878
884
  let delay_auth_fail: number;
885
+ let duplicateLogin: string;
879
886
  }
880
887
  export { auth_1 as auth };
881
888
  export let membersOnly: boolean;
@@ -888,10 +895,30 @@ declare function getLocalAddress(): string;
888
895
  declare function delay(ms: any): Promise<any>;
889
896
 
890
897
  declare class BohoAuth {
891
- constructor(keyProvider: any);
892
- keyProvider: any;
893
- keepOldConnection: boolean;
898
+ /**
899
+ * @param {object} keyProvider
900
+ * @param {{ duplicateLogin?: 'keepOld' | 'keepNew', onAuthEvent?: (event: object) => any }} [options]
901
+ * duplicateLogin: unset follows serverOption.auth.duplicateLogin (default 'keepNew').
902
+ * onAuthEvent: called with { type, did, cid, uid, ip, oldIp, socketType, oldSocketType, reason, at }
903
+ * for 'replaced' (keepNew evicted the old connection) and 'duplicate_rejected' (keepOld).
904
+ * socketType/oldSocketType are 'websocket' or 'congsocket'.
905
+ * Errors and rejected promises are logged and never affect authentication.
906
+ */
907
+ constructor(keyProvider: object, options?: {
908
+ duplicateLogin?: "keepOld" | "keepNew";
909
+ onAuthEvent?: (event: object) => any;
910
+ });
911
+ keyProvider: object;
912
+ _duplicateLogin: any;
913
+ /** @param {'keepOld' | 'keepNew' | null} policy null returns to the serverOption default. */
914
+ set duplicateLogin(policy: "keepOld" | "keepNew" | null);
915
+ /** Effective duplicate login policy: this instance's setting, else serverOption.auth.duplicateLogin. */
916
+ get duplicateLogin(): "keepOld" | "keepNew" | null;
917
+ onAuthEvent: ((event: object) => any) | null;
894
918
  authLogger: FileLogger | undefined;
919
+ set keepOldConnection(keepOld: boolean);
920
+ get keepOldConnection(): boolean;
921
+ emitAuthEvent(event: any): void;
895
922
  send_auth_fail(peer: any, reason: any): void;
896
923
  verify_auth_req(auth_req: any, peer: any): Promise<any>;
897
924
  getAuth(id: any): Promise<any>;
@@ -974,9 +1001,17 @@ declare namespace sudoService {
974
1001
  }
975
1002
 
976
1003
  declare class RedisService {
977
- constructor(redisClient: any, _minLevel: any);
978
- redisClient: any;
979
- minLevel: any;
1004
+ /**
1005
+ * @param {object} redisClient
1006
+ * @param {number} [_minLevel=200]
1007
+ * @param {{ requireAuth?: boolean }} [options] requireAuth (default true): allow Boho-authenticated remotes only.
1008
+ */
1009
+ constructor(redisClient: object, _minLevel?: number, options?: {
1010
+ requireAuth?: boolean;
1011
+ });
1012
+ redisClient: object;
1013
+ minLevel: number;
1014
+ requireAuth: boolean;
980
1015
  commands: string[];
981
1016
  checkPermission(remote: any, req: any): boolean;
982
1017
  call(remote: any, req: any): Promise<void>;
@@ -334,7 +334,9 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
334
334
  stop(): void;
335
335
  /**
336
336
  * Permanently destroys the instance, cleaning up all resources.
337
- * The instance will not be usable after this.
337
+ * The instance will not be usable after this. Later signal()/publish()/subscribe()
338
+ * calls are silently dropped, the same as sends while disconnected, and call()
339
+ * rejects with code 'CONNECTION_CLOSED'.
338
340
  */
339
341
  destroy(): void;
340
342
  /**
@@ -417,6 +419,7 @@ declare class IOCore extends EventEmitter<string | symbol, any> {
417
419
  getEncryptionMode(): boolean;
418
420
  /**
419
421
  * Sends data with encryption based on the encryption mode.
422
+ * Like an unconnected socket, a destroyed instance silently drops the data.
420
423
  * @param {Buffer} data - The data buffer to send.
421
424
  * @param {boolean} [useEncryption] - Optional. Force encryption or not. If undefined, uses default policy.
422
425
  */
@@ -785,6 +788,8 @@ declare class Manager {
785
788
  subscribe(chArr: any, remote: any): any;
786
789
  unsubscribe(chArr: any, remote: any): void;
787
790
  monitor(): void;
791
+ anonymousCidRandom(size: any): Buffer<ArrayBuffer>;
792
+ issueAnonymousCid(): string | null;
788
793
  closeRemoteByCId(cid: any): 0 | 1;
789
794
  close(): void;
790
795
  }
@@ -797,6 +802,7 @@ declare class Server extends EventEmitter$1<[never]> {
797
802
  constructor(options: object, authManager?: any);
798
803
  security: any;
799
804
  serviceNames: Set<any>;
805
+ services: Map<any, any>;
800
806
  wss: {};
801
807
  port: number | null;
802
808
  congPort: number | null;
@@ -876,6 +882,7 @@ declare namespace serverOption {
876
882
  }
877
883
  export namespace auth_1 {
878
884
  let delay_auth_fail: number;
885
+ let duplicateLogin: string;
879
886
  }
880
887
  export { auth_1 as auth };
881
888
  export let membersOnly: boolean;
@@ -888,10 +895,30 @@ declare function getLocalAddress(): string;
888
895
  declare function delay(ms: any): Promise<any>;
889
896
 
890
897
  declare class BohoAuth {
891
- constructor(keyProvider: any);
892
- keyProvider: any;
893
- keepOldConnection: boolean;
898
+ /**
899
+ * @param {object} keyProvider
900
+ * @param {{ duplicateLogin?: 'keepOld' | 'keepNew', onAuthEvent?: (event: object) => any }} [options]
901
+ * duplicateLogin: unset follows serverOption.auth.duplicateLogin (default 'keepNew').
902
+ * onAuthEvent: called with { type, did, cid, uid, ip, oldIp, socketType, oldSocketType, reason, at }
903
+ * for 'replaced' (keepNew evicted the old connection) and 'duplicate_rejected' (keepOld).
904
+ * socketType/oldSocketType are 'websocket' or 'congsocket'.
905
+ * Errors and rejected promises are logged and never affect authentication.
906
+ */
907
+ constructor(keyProvider: object, options?: {
908
+ duplicateLogin?: "keepOld" | "keepNew";
909
+ onAuthEvent?: (event: object) => any;
910
+ });
911
+ keyProvider: object;
912
+ _duplicateLogin: any;
913
+ /** @param {'keepOld' | 'keepNew' | null} policy null returns to the serverOption default. */
914
+ set duplicateLogin(policy: "keepOld" | "keepNew" | null);
915
+ /** Effective duplicate login policy: this instance's setting, else serverOption.auth.duplicateLogin. */
916
+ get duplicateLogin(): "keepOld" | "keepNew" | null;
917
+ onAuthEvent: ((event: object) => any) | null;
894
918
  authLogger: FileLogger | undefined;
919
+ set keepOldConnection(keepOld: boolean);
920
+ get keepOldConnection(): boolean;
921
+ emitAuthEvent(event: any): void;
895
922
  send_auth_fail(peer: any, reason: any): void;
896
923
  verify_auth_req(auth_req: any, peer: any): Promise<any>;
897
924
  getAuth(id: any): Promise<any>;
@@ -974,9 +1001,17 @@ declare namespace sudoService {
974
1001
  }
975
1002
 
976
1003
  declare class RedisService {
977
- constructor(redisClient: any, _minLevel: any);
978
- redisClient: any;
979
- minLevel: any;
1004
+ /**
1005
+ * @param {object} redisClient
1006
+ * @param {number} [_minLevel=200]
1007
+ * @param {{ requireAuth?: boolean }} [options] requireAuth (default true): allow Boho-authenticated remotes only.
1008
+ */
1009
+ constructor(redisClient: object, _minLevel?: number, options?: {
1010
+ requireAuth?: boolean;
1011
+ });
1012
+ redisClient: object;
1013
+ minLevel: number;
1014
+ requireAuth: boolean;
980
1015
  commands: string[];
981
1016
  checkPermission(remote: any, req: any): boolean;
982
1017
  call(remote: any, req: any): Promise<void>;