@@ -7,7 +7,7 @@ import path from 'path';
77import os from 'os' ;
88import { DB } from '@matrixai/db' ;
99import Logger , { LogLevel , StreamHandler } from '@matrixai/logger' ;
10- import { _destroyed } from '@matrixai/async-init/dist/utils ' ;
10+ import { destroyed } from '@matrixai/async-init/' ;
1111import { IdInternal } from '@matrixai/id' ;
1212import PolykeyAgent from '@/PolykeyAgent' ;
1313import KeyManager from '@/keys/KeyManager' ;
@@ -402,7 +402,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
402402 ) ;
403403 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
404404 if ( firstConnection != null ) {
405- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
405+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
406406 }
407407 } finally {
408408 await nodeConnectionManager ?. stop ( ) ;
@@ -452,11 +452,11 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
452452 agentNodeId ,
453453 async ( connection ) => {
454454 const client = connection . getClient ( ) ;
455- expect ( connection [ _destroyed ] ) . toBe ( false ) ;
456- expect ( client [ _destroyed ] ) . toBe ( false ) ;
455+ expect ( connection [ destroyed ] ) . toBe ( false ) ;
456+ expect ( client [ destroyed ] ) . toBe ( false ) ;
457457 await polykeyAgent ?. stop ( ) ;
458- expect ( client [ _destroyed ] ) . toBe ( true ) ;
459- expect ( connection [ _destroyed ] ) . toBe ( true ) ;
458+ expect ( client [ destroyed ] ) . toBe ( true ) ;
459+ expect ( connection [ destroyed ] ) . toBe ( true ) ;
460460 // Breaking call
461461 const attemptP = client . echo ( new utilsPB . EchoMessage ( ) ) ;
462462 await expect ( attemptP ) . rejects . toThrow ( ) ;
@@ -473,7 +473,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
473473 ) ;
474474 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
475475 if ( firstConnection != null ) {
476- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
476+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
477477 }
478478 } finally {
479479 await nodeConnectionManager ?. stop ( ) ;
@@ -547,7 +547,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
547547 ) ;
548548 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
549549 if ( firstConnection != null ) {
550- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
550+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
551551 }
552552 } finally {
553553 await nodeConnectionManager ?. stop ( ) ;
@@ -621,7 +621,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
621621 ) ;
622622 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
623623 if ( firstConnection != null ) {
624- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
624+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
625625 }
626626 } finally {
627627 await nodeConnectionManager ?. stop ( ) ;
@@ -670,19 +670,18 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
670670 // Resolves if the shutdownCallback was called
671671 await nodeConnectionManager . withConnF ( agentNodeId , async ( connection ) => {
672672 const client = connection . getClient ( ) ;
673- expect ( connection [ _destroyed ] ) . toBe ( false ) ;
674- expect ( client [ _destroyed ] ) . toBe ( false ) ;
673+ expect ( connection [ destroyed ] ) . toBe ( false ) ;
674+ expect ( client [ destroyed ] ) . toBe ( false ) ;
675675
676676 // We want to watch for the killSelf event by hijacking the NodeConnectionmanagerInterface
677677 const oldKillSelf =
678- // @ts -ignore: kidnap the interface
679- connection . nodeConnectionManagerInterface . destroyCallback ;
680- // @ts -ignore: update the interface;
681- connection . nodeConnectionManagerInterface . destroyCallback =
682- async ( ) => {
683- await oldKillSelf ( ) ;
684- killSelfP . resolveP ( null ) ;
685- } ;
678+ // @ts -ignore: kidnap the callback
679+ connection . destroyCallback ;
680+ // @ts -ignore: update the callback;
681+ connection . destroyCallback = async ( ) => {
682+ await oldKillSelf ( ) ;
683+ killSelfP . resolveP ( null ) ;
684+ } ;
686685 await connection . destroy ( ) ;
687686 } ) ;
688687
@@ -696,7 +695,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
696695 ) ;
697696 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
698697 if ( firstConnection != null ) {
699- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
698+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
700699 }
701700 } finally {
702701 await nodeConnectionManager ?. stop ( ) ;
@@ -743,16 +742,15 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
743742
744743 // We want to watch for the killSelf event by hijacking the NodeConnectionmanagerInterface
745744 const oldKillSelf =
746- // @ts -ignore: kidnap the interface
747- firstConnection ?. nodeConnectionManagerInterface . destroyCallback ;
745+ // @ts -ignore: kidnap the callback
746+ firstConnection ?. destroyCallback ;
748747 const killSelfP = promise < null > ( ) ;
749748 if ( firstConnection != null ) {
750- // @ts -ignore: update the interface;
751- firstConnection . nodeConnectionManagerInterface . destroyCallback =
752- async ( ) => {
753- if ( oldKillSelf != null ) await oldKillSelf ( ) ;
754- killSelfP . resolveP ( null ) ;
755- } ;
749+ // @ts -ignore: update the callback;
750+ firstConnection . destroyCallback = async ( ) => {
751+ if ( oldKillSelf != null ) await oldKillSelf ( ) ;
752+ killSelfP . resolveP ( null ) ;
753+ } ;
756754 }
757755 await firstConnection ?. destroy ( ) ;
758756 // Wait for `killSelf` to resolve
@@ -765,7 +763,7 @@ describe(`${NodeConnectionManager.name} termination test`, () => {
765763 ) ;
766764 expect ( connAndLock ?. lock . isLocked ( ) ) . toBe ( false ) ;
767765 if ( firstConnection != null ) {
768- expect ( firstConnection [ _destroyed ] ) . toBe ( true ) ;
766+ expect ( firstConnection [ destroyed ] ) . toBe ( true ) ;
769767 }
770768 } finally {
771769 await nodeConnectionManager ?. stop ( ) ;
0 commit comments