@ubercode/dcmtk 0.10.1 → 0.11.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.
@@ -1478,8 +1478,26 @@ interface PoolStatus {
1478
1478
  /** Total number of workers (idle + busy). */
1479
1479
  readonly total: number;
1480
1480
  }
1481
- /** Data emitted with FILE_RECEIVED events. */
1482
- interface ReceiverFileData {
1481
+ /** Data emitted with FILE_RECEIVED events (raw from dcmrecv, before processing). */
1482
+ interface ReceiverFileReceivedData {
1483
+ readonly filePath: string;
1484
+ readonly associationId: string;
1485
+ readonly callingAE: string;
1486
+ readonly calledAE: string;
1487
+ readonly source: string;
1488
+ }
1489
+ /** Data emitted with FILE_STORED events (file moved to association dir). */
1490
+ interface ReceiverFileStoredData {
1491
+ readonly filePath: string;
1492
+ readonly fileSize: number;
1493
+ readonly associationId: string;
1494
+ readonly associationDir: string;
1495
+ readonly callingAE: string;
1496
+ readonly calledAE: string;
1497
+ readonly source: string;
1498
+ }
1499
+ /** Data emitted with INSTANCE_RECEIVED events (parsed DicomInstance available). */
1500
+ interface ReceiverInstanceData {
1483
1501
  readonly filePath: string;
1484
1502
  readonly fileSize: number;
1485
1503
  readonly associationId: string;
@@ -1538,7 +1556,9 @@ interface ReceiverErrorData {
1538
1556
  }
1539
1557
  /** Typed event map for DicomReceiver. */
1540
1558
  interface DicomReceiverEventMap {
1541
- FILE_RECEIVED: [ReceiverFileData];
1559
+ FILE_RECEIVED: [ReceiverFileReceivedData];
1560
+ FILE_STORED: [ReceiverFileStoredData];
1561
+ INSTANCE_RECEIVED: [ReceiverInstanceData];
1542
1562
  ASSOCIATION_COMPLETE: [ReceiverAssociationData];
1543
1563
  ASSOCIATION_RECEIVED: [PoolAssociationReceivedData];
1544
1564
  C_STORE_REQUEST: [PoolCStoreRequestData];
@@ -1641,12 +1661,26 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1641
1661
  */
1642
1662
  onEvent<K extends keyof DicomReceiverEventMap>(event: K, listener: (...args: DicomReceiverEventMap[K]) => void): this;
1643
1663
  /**
1644
- * Registers a listener for received files.
1664
+ * Registers a listener for files received by dcmrecv (before move/parse).
1665
+ *
1666
+ * @param listener - Callback receiving raw file data
1667
+ * @returns this for chaining
1668
+ */
1669
+ onFileReceived(listener: (data: ReceiverFileReceivedData) => void): this;
1670
+ /**
1671
+ * Registers a listener for files stored in the association directory.
1672
+ *
1673
+ * @param listener - Callback receiving stored file data with size
1674
+ * @returns this for chaining
1675
+ */
1676
+ onFileStored(listener: (data: ReceiverFileStoredData) => void): this;
1677
+ /**
1678
+ * Registers a listener for parsed DicomInstance availability.
1645
1679
  *
1646
- * @param listener - Callback receiving file data
1680
+ * @param listener - Callback receiving instance data
1647
1681
  * @returns this for chaining
1648
1682
  */
1649
- onFileReceived(listener: (data: ReceiverFileData) => void): this;
1683
+ onInstanceReceived(listener: (data: ReceiverInstanceData) => void): this;
1650
1684
  /**
1651
1685
  * Registers a listener for completed associations.
1652
1686
  *
@@ -1721,10 +1755,12 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1721
1755
  private wireWorkerEvents;
1722
1756
  /** Wires FILE_RECEIVED from dcmrecv worker — captures context synchronously. */
1723
1757
  private wireFileReceived;
1724
- /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
1758
+ /** Moves file to association dir, emits FILE_STORED, then parses instance. */
1725
1759
  private handleFileReceived;
1726
- /** Inner handler: move file, parse DICOM, emit FILE_RECEIVED or error. */
1760
+ /** Inner handler: move file, emit FILE_STORED, parse DICOM, emit INSTANCE_RECEIVED. */
1727
1761
  private moveAndEmitFile;
1762
+ /** Parses a DICOM file and emits INSTANCE_RECEIVED or error. */
1763
+ private emitInstanceReceived;
1728
1764
  /** Returns worker to idle pool on association complete, emits summary. */
1729
1765
  private wireAssociationComplete;
1730
1766
  /** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
@@ -1744,5 +1780,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1744
1780
  /** Wires an AbortSignal to stop the receiver. */
1745
1781
  private wireAbortSignal;
1746
1782
  }
1783
+ /** @deprecated Use ReceiverFileStoredData instead. */
1784
+ type ReceiverFileData = ReceiverFileStoredData;
1747
1785
 
1748
- export { type PoolCStoreRequestData as $, type AssociationAcknowledgedData as A, type DcmpsrcvEventValue as B, type CStoreRequestData as C, DCMPRSCP_FATAL_EVENTS as D, type DcmpsrcvOptions as E, DcmqrscpEvent as F, type DcmqrscpEventValue as G, Dcmrecv as H, DcmrecvEvent as I, type DcmrecvEventMap as J, type DcmrecvEventValue as K, type DcmrecvOptions as L, DcmtkProcess as M, type DcmtkProcessConfig as N, type DcmtkProcessEventMap as O, DicomReceiver as P, type DicomReceiverEventMap as Q, type DicomReceiverOptions as R, type EventPattern as S, type FileDeletedData as T, type FileReceivedData as U, FilenameMode as V, type FilenameModeValue as W, LineParser as X, type LineParserEventMap as Y, type MultiLineConfig as Z, type PoolAssociationReceivedData as _, type AssociationCompleteData as a, type PoolEchoRequestData as a0, type PoolRefusingAssociationData as a1, type PoolStatus as a2, PreferredTransferSyntax as a3, type PreferredTransferSyntaxValue as a4, type PrintAssociationAcknowledgedData as a5, type PrintAssociationReceivedData as a6, type PrintCannotStartListenerData as a7, ProcessState as a8, type ProcessStateValue as a9, type StoreSCPOptions as aA, StoreSCPPreset as aB, type StoreSCPPresetName as aC, type StoredFileData as aD, StorescpEvent as aE, type StorescpEventValue as aF, type StoringFileData as aG, type SubdirectoryCreatedData as aH, SubdirectoryMode as aI, type SubdirectoryModeValue as aJ, type TrackedFile as aK, WLMSCPFS_FATAL_EVENTS as aL, WLMSCPFS_PATTERNS as aM, type WlmAssociationAcknowledgedData as aN, type WlmAssociationReceivedData as aO, type WlmCFindRequestData as aP, type WlmCannotStartListenerData as aQ, type WlmListeningData as aR, Wlmscpfs as aS, WlmscpfsEvent as aT, type WlmscpfsEventMap as aU, type WlmscpfsEventValue as aV, type WlmscpfsOptions as aW, type QRAssociationAcknowledgedData as aa, type QRAssociationReceivedData as ab, type QRCFindRequestData as ac, type QRCGetRequestData as ad, type QRCMoveRequestData as ae, type QRCStoreRequestData as af, type QRCannotStartListenerData as ag, type QRListeningData as ah, type ReceiverAssociationAcknowledgedData as ai, type ReceiverAssociationData as aj, type ReceiverAssociationReceivedData as ak, type ReceiverCStoreRequestData as al, type ReceiverCannotStartListenerData as am, type ReceiverConfigErrorData as an, type ReceiverDatabaseReadyData as ao, type ReceiverEchoRequestData as ap, type ReceiverErrorData as aq, type ReceiverFileData as ar, type ReceiverListeningData as as, type RefusingAssociationData as at, STORESCP_FATAL_EVENTS as au, STORESCP_PATTERNS as av, StorageMode as aw, type StorageModeValue as ax, StoreSCP as ay, type StoreSCPEventMap as az, type AssociationContext as b, type AssociationReceivedData as c, type AssociationSummary as d, AssociationTracker as e, type CannotStartListenerData as f, type ConfigErrorData as g, DCMPRSCP_PATTERNS as h, DCMPSRCV_FATAL_EVENTS as i, DCMPSRCV_PATTERNS as j, DCMQRSCP_FATAL_EVENTS as k, DCMQRSCP_PATTERNS as l, DCMRECV_FATAL_EVENTS as m, DCMRECV_PATTERNS as n, type DatabaseReadyData as o, DcmQRSCP as p, type DcmQRSCPEventMap as q, type DcmQRSCPOptions as r, DcmprsCP as s, type DcmprsCPEventMap as t, type DcmprsCPOptions as u, DcmprscpEvent as v, type DcmprscpEventValue as w, Dcmpsrcv as x, DcmpsrcvEvent as y, type DcmpsrcvEventMap as z };
1786
+ export { type PoolCStoreRequestData as $, type AssociationAcknowledgedData as A, type DcmpsrcvEventValue as B, type CStoreRequestData as C, DCMPRSCP_FATAL_EVENTS as D, type DcmpsrcvOptions as E, DcmqrscpEvent as F, type DcmqrscpEventValue as G, Dcmrecv as H, DcmrecvEvent as I, type DcmrecvEventMap as J, type DcmrecvEventValue as K, type DcmrecvOptions as L, DcmtkProcess as M, type DcmtkProcessConfig as N, type DcmtkProcessEventMap as O, DicomReceiver as P, type DicomReceiverEventMap as Q, type DicomReceiverOptions as R, type EventPattern as S, type FileDeletedData as T, type FileReceivedData as U, FilenameMode as V, type FilenameModeValue as W, LineParser as X, type LineParserEventMap as Y, type MultiLineConfig as Z, type PoolAssociationReceivedData as _, type AssociationCompleteData as a, type PoolEchoRequestData as a0, type PoolRefusingAssociationData as a1, type PoolStatus as a2, PreferredTransferSyntax as a3, type PreferredTransferSyntaxValue as a4, type PrintAssociationAcknowledgedData as a5, type PrintAssociationReceivedData as a6, type PrintCannotStartListenerData as a7, ProcessState as a8, type ProcessStateValue as a9, type StorageModeValue as aA, StoreSCP as aB, type StoreSCPEventMap as aC, type StoreSCPOptions as aD, StoreSCPPreset as aE, type StoreSCPPresetName as aF, type StoredFileData as aG, StorescpEvent as aH, type StorescpEventValue as aI, type StoringFileData as aJ, type SubdirectoryCreatedData as aK, SubdirectoryMode as aL, type SubdirectoryModeValue as aM, type TrackedFile as aN, WLMSCPFS_FATAL_EVENTS as aO, WLMSCPFS_PATTERNS as aP, type WlmAssociationAcknowledgedData as aQ, type WlmAssociationReceivedData as aR, type WlmCFindRequestData as aS, type WlmCannotStartListenerData as aT, type WlmListeningData as aU, Wlmscpfs as aV, WlmscpfsEvent as aW, type WlmscpfsEventMap as aX, type WlmscpfsEventValue as aY, type WlmscpfsOptions as aZ, type QRAssociationAcknowledgedData as aa, type QRAssociationReceivedData as ab, type QRCFindRequestData as ac, type QRCGetRequestData as ad, type QRCMoveRequestData as ae, type QRCStoreRequestData as af, type QRCannotStartListenerData as ag, type QRListeningData as ah, type ReceiverAssociationAcknowledgedData as ai, type ReceiverAssociationData as aj, type ReceiverAssociationReceivedData as ak, type ReceiverCStoreRequestData as al, type ReceiverCannotStartListenerData as am, type ReceiverConfigErrorData as an, type ReceiverDatabaseReadyData as ao, type ReceiverEchoRequestData as ap, type ReceiverErrorData as aq, type ReceiverFileData as ar, type ReceiverFileReceivedData as as, type ReceiverFileStoredData as at, type ReceiverInstanceData as au, type ReceiverListeningData as av, type RefusingAssociationData as aw, STORESCP_FATAL_EVENTS as ax, STORESCP_PATTERNS as ay, StorageMode as az, type AssociationContext as b, type AssociationReceivedData as c, type AssociationSummary as d, AssociationTracker as e, type CannotStartListenerData as f, type ConfigErrorData as g, DCMPRSCP_PATTERNS as h, DCMPSRCV_FATAL_EVENTS as i, DCMPSRCV_PATTERNS as j, DCMQRSCP_FATAL_EVENTS as k, DCMQRSCP_PATTERNS as l, DCMRECV_FATAL_EVENTS as m, DCMRECV_PATTERNS as n, type DatabaseReadyData as o, DcmQRSCP as p, type DcmQRSCPEventMap as q, type DcmQRSCPOptions as r, DcmprsCP as s, type DcmprsCPEventMap as t, type DcmprsCPOptions as u, DcmprscpEvent as v, type DcmprscpEventValue as w, Dcmpsrcv as x, DcmpsrcvEvent as y, type DcmpsrcvEventMap as z };
@@ -1478,8 +1478,26 @@ interface PoolStatus {
1478
1478
  /** Total number of workers (idle + busy). */
1479
1479
  readonly total: number;
1480
1480
  }
1481
- /** Data emitted with FILE_RECEIVED events. */
1482
- interface ReceiverFileData {
1481
+ /** Data emitted with FILE_RECEIVED events (raw from dcmrecv, before processing). */
1482
+ interface ReceiverFileReceivedData {
1483
+ readonly filePath: string;
1484
+ readonly associationId: string;
1485
+ readonly callingAE: string;
1486
+ readonly calledAE: string;
1487
+ readonly source: string;
1488
+ }
1489
+ /** Data emitted with FILE_STORED events (file moved to association dir). */
1490
+ interface ReceiverFileStoredData {
1491
+ readonly filePath: string;
1492
+ readonly fileSize: number;
1493
+ readonly associationId: string;
1494
+ readonly associationDir: string;
1495
+ readonly callingAE: string;
1496
+ readonly calledAE: string;
1497
+ readonly source: string;
1498
+ }
1499
+ /** Data emitted with INSTANCE_RECEIVED events (parsed DicomInstance available). */
1500
+ interface ReceiverInstanceData {
1483
1501
  readonly filePath: string;
1484
1502
  readonly fileSize: number;
1485
1503
  readonly associationId: string;
@@ -1538,7 +1556,9 @@ interface ReceiverErrorData {
1538
1556
  }
1539
1557
  /** Typed event map for DicomReceiver. */
1540
1558
  interface DicomReceiverEventMap {
1541
- FILE_RECEIVED: [ReceiverFileData];
1559
+ FILE_RECEIVED: [ReceiverFileReceivedData];
1560
+ FILE_STORED: [ReceiverFileStoredData];
1561
+ INSTANCE_RECEIVED: [ReceiverInstanceData];
1542
1562
  ASSOCIATION_COMPLETE: [ReceiverAssociationData];
1543
1563
  ASSOCIATION_RECEIVED: [PoolAssociationReceivedData];
1544
1564
  C_STORE_REQUEST: [PoolCStoreRequestData];
@@ -1641,12 +1661,26 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1641
1661
  */
1642
1662
  onEvent<K extends keyof DicomReceiverEventMap>(event: K, listener: (...args: DicomReceiverEventMap[K]) => void): this;
1643
1663
  /**
1644
- * Registers a listener for received files.
1664
+ * Registers a listener for files received by dcmrecv (before move/parse).
1665
+ *
1666
+ * @param listener - Callback receiving raw file data
1667
+ * @returns this for chaining
1668
+ */
1669
+ onFileReceived(listener: (data: ReceiverFileReceivedData) => void): this;
1670
+ /**
1671
+ * Registers a listener for files stored in the association directory.
1672
+ *
1673
+ * @param listener - Callback receiving stored file data with size
1674
+ * @returns this for chaining
1675
+ */
1676
+ onFileStored(listener: (data: ReceiverFileStoredData) => void): this;
1677
+ /**
1678
+ * Registers a listener for parsed DicomInstance availability.
1645
1679
  *
1646
- * @param listener - Callback receiving file data
1680
+ * @param listener - Callback receiving instance data
1647
1681
  * @returns this for chaining
1648
1682
  */
1649
- onFileReceived(listener: (data: ReceiverFileData) => void): this;
1683
+ onInstanceReceived(listener: (data: ReceiverInstanceData) => void): this;
1650
1684
  /**
1651
1685
  * Registers a listener for completed associations.
1652
1686
  *
@@ -1721,10 +1755,12 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1721
1755
  private wireWorkerEvents;
1722
1756
  /** Wires FILE_RECEIVED from dcmrecv worker — captures context synchronously. */
1723
1757
  private wireFileReceived;
1724
- /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
1758
+ /** Moves file to association dir, emits FILE_STORED, then parses instance. */
1725
1759
  private handleFileReceived;
1726
- /** Inner handler: move file, parse DICOM, emit FILE_RECEIVED or error. */
1760
+ /** Inner handler: move file, emit FILE_STORED, parse DICOM, emit INSTANCE_RECEIVED. */
1727
1761
  private moveAndEmitFile;
1762
+ /** Parses a DICOM file and emits INSTANCE_RECEIVED or error. */
1763
+ private emitInstanceReceived;
1728
1764
  /** Returns worker to idle pool on association complete, emits summary. */
1729
1765
  private wireAssociationComplete;
1730
1766
  /** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
@@ -1744,5 +1780,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1744
1780
  /** Wires an AbortSignal to stop the receiver. */
1745
1781
  private wireAbortSignal;
1746
1782
  }
1783
+ /** @deprecated Use ReceiverFileStoredData instead. */
1784
+ type ReceiverFileData = ReceiverFileStoredData;
1747
1785
 
1748
- export { type PoolCStoreRequestData as $, type AssociationAcknowledgedData as A, type DcmpsrcvEventValue as B, type CStoreRequestData as C, DCMPRSCP_FATAL_EVENTS as D, type DcmpsrcvOptions as E, DcmqrscpEvent as F, type DcmqrscpEventValue as G, Dcmrecv as H, DcmrecvEvent as I, type DcmrecvEventMap as J, type DcmrecvEventValue as K, type DcmrecvOptions as L, DcmtkProcess as M, type DcmtkProcessConfig as N, type DcmtkProcessEventMap as O, DicomReceiver as P, type DicomReceiverEventMap as Q, type DicomReceiverOptions as R, type EventPattern as S, type FileDeletedData as T, type FileReceivedData as U, FilenameMode as V, type FilenameModeValue as W, LineParser as X, type LineParserEventMap as Y, type MultiLineConfig as Z, type PoolAssociationReceivedData as _, type AssociationCompleteData as a, type PoolEchoRequestData as a0, type PoolRefusingAssociationData as a1, type PoolStatus as a2, PreferredTransferSyntax as a3, type PreferredTransferSyntaxValue as a4, type PrintAssociationAcknowledgedData as a5, type PrintAssociationReceivedData as a6, type PrintCannotStartListenerData as a7, ProcessState as a8, type ProcessStateValue as a9, type StoreSCPOptions as aA, StoreSCPPreset as aB, type StoreSCPPresetName as aC, type StoredFileData as aD, StorescpEvent as aE, type StorescpEventValue as aF, type StoringFileData as aG, type SubdirectoryCreatedData as aH, SubdirectoryMode as aI, type SubdirectoryModeValue as aJ, type TrackedFile as aK, WLMSCPFS_FATAL_EVENTS as aL, WLMSCPFS_PATTERNS as aM, type WlmAssociationAcknowledgedData as aN, type WlmAssociationReceivedData as aO, type WlmCFindRequestData as aP, type WlmCannotStartListenerData as aQ, type WlmListeningData as aR, Wlmscpfs as aS, WlmscpfsEvent as aT, type WlmscpfsEventMap as aU, type WlmscpfsEventValue as aV, type WlmscpfsOptions as aW, type QRAssociationAcknowledgedData as aa, type QRAssociationReceivedData as ab, type QRCFindRequestData as ac, type QRCGetRequestData as ad, type QRCMoveRequestData as ae, type QRCStoreRequestData as af, type QRCannotStartListenerData as ag, type QRListeningData as ah, type ReceiverAssociationAcknowledgedData as ai, type ReceiverAssociationData as aj, type ReceiverAssociationReceivedData as ak, type ReceiverCStoreRequestData as al, type ReceiverCannotStartListenerData as am, type ReceiverConfigErrorData as an, type ReceiverDatabaseReadyData as ao, type ReceiverEchoRequestData as ap, type ReceiverErrorData as aq, type ReceiverFileData as ar, type ReceiverListeningData as as, type RefusingAssociationData as at, STORESCP_FATAL_EVENTS as au, STORESCP_PATTERNS as av, StorageMode as aw, type StorageModeValue as ax, StoreSCP as ay, type StoreSCPEventMap as az, type AssociationContext as b, type AssociationReceivedData as c, type AssociationSummary as d, AssociationTracker as e, type CannotStartListenerData as f, type ConfigErrorData as g, DCMPRSCP_PATTERNS as h, DCMPSRCV_FATAL_EVENTS as i, DCMPSRCV_PATTERNS as j, DCMQRSCP_FATAL_EVENTS as k, DCMQRSCP_PATTERNS as l, DCMRECV_FATAL_EVENTS as m, DCMRECV_PATTERNS as n, type DatabaseReadyData as o, DcmQRSCP as p, type DcmQRSCPEventMap as q, type DcmQRSCPOptions as r, DcmprsCP as s, type DcmprsCPEventMap as t, type DcmprsCPOptions as u, DcmprscpEvent as v, type DcmprscpEventValue as w, Dcmpsrcv as x, DcmpsrcvEvent as y, type DcmpsrcvEventMap as z };
1786
+ export { type PoolCStoreRequestData as $, type AssociationAcknowledgedData as A, type DcmpsrcvEventValue as B, type CStoreRequestData as C, DCMPRSCP_FATAL_EVENTS as D, type DcmpsrcvOptions as E, DcmqrscpEvent as F, type DcmqrscpEventValue as G, Dcmrecv as H, DcmrecvEvent as I, type DcmrecvEventMap as J, type DcmrecvEventValue as K, type DcmrecvOptions as L, DcmtkProcess as M, type DcmtkProcessConfig as N, type DcmtkProcessEventMap as O, DicomReceiver as P, type DicomReceiverEventMap as Q, type DicomReceiverOptions as R, type EventPattern as S, type FileDeletedData as T, type FileReceivedData as U, FilenameMode as V, type FilenameModeValue as W, LineParser as X, type LineParserEventMap as Y, type MultiLineConfig as Z, type PoolAssociationReceivedData as _, type AssociationCompleteData as a, type PoolEchoRequestData as a0, type PoolRefusingAssociationData as a1, type PoolStatus as a2, PreferredTransferSyntax as a3, type PreferredTransferSyntaxValue as a4, type PrintAssociationAcknowledgedData as a5, type PrintAssociationReceivedData as a6, type PrintCannotStartListenerData as a7, ProcessState as a8, type ProcessStateValue as a9, type StorageModeValue as aA, StoreSCP as aB, type StoreSCPEventMap as aC, type StoreSCPOptions as aD, StoreSCPPreset as aE, type StoreSCPPresetName as aF, type StoredFileData as aG, StorescpEvent as aH, type StorescpEventValue as aI, type StoringFileData as aJ, type SubdirectoryCreatedData as aK, SubdirectoryMode as aL, type SubdirectoryModeValue as aM, type TrackedFile as aN, WLMSCPFS_FATAL_EVENTS as aO, WLMSCPFS_PATTERNS as aP, type WlmAssociationAcknowledgedData as aQ, type WlmAssociationReceivedData as aR, type WlmCFindRequestData as aS, type WlmCannotStartListenerData as aT, type WlmListeningData as aU, Wlmscpfs as aV, WlmscpfsEvent as aW, type WlmscpfsEventMap as aX, type WlmscpfsEventValue as aY, type WlmscpfsOptions as aZ, type QRAssociationAcknowledgedData as aa, type QRAssociationReceivedData as ab, type QRCFindRequestData as ac, type QRCGetRequestData as ad, type QRCMoveRequestData as ae, type QRCStoreRequestData as af, type QRCannotStartListenerData as ag, type QRListeningData as ah, type ReceiverAssociationAcknowledgedData as ai, type ReceiverAssociationData as aj, type ReceiverAssociationReceivedData as ak, type ReceiverCStoreRequestData as al, type ReceiverCannotStartListenerData as am, type ReceiverConfigErrorData as an, type ReceiverDatabaseReadyData as ao, type ReceiverEchoRequestData as ap, type ReceiverErrorData as aq, type ReceiverFileData as ar, type ReceiverFileReceivedData as as, type ReceiverFileStoredData as at, type ReceiverInstanceData as au, type ReceiverListeningData as av, type RefusingAssociationData as aw, STORESCP_FATAL_EVENTS as ax, STORESCP_PATTERNS as ay, StorageMode as az, type AssociationContext as b, type AssociationReceivedData as c, type AssociationSummary as d, AssociationTracker as e, type CannotStartListenerData as f, type ConfigErrorData as g, DCMPRSCP_PATTERNS as h, DCMPSRCV_FATAL_EVENTS as i, DCMPSRCV_PATTERNS as j, DCMQRSCP_FATAL_EVENTS as k, DCMQRSCP_PATTERNS as l, DCMRECV_FATAL_EVENTS as m, DCMRECV_PATTERNS as n, type DatabaseReadyData as o, DcmQRSCP as p, type DcmQRSCPEventMap as q, type DcmQRSCPOptions as r, DcmprsCP as s, type DcmprsCPEventMap as t, type DcmprsCPOptions as u, DcmprscpEvent as v, type DcmprscpEventValue as w, Dcmpsrcv as x, DcmpsrcvEvent as y, type DcmpsrcvEventMap as z };
package/dist/index.cjs CHANGED
@@ -36684,14 +36684,32 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36684
36684
  return this.on(event, listener);
36685
36685
  }
36686
36686
  /**
36687
- * Registers a listener for received files.
36687
+ * Registers a listener for files received by dcmrecv (before move/parse).
36688
36688
  *
36689
- * @param listener - Callback receiving file data
36689
+ * @param listener - Callback receiving raw file data
36690
36690
  * @returns this for chaining
36691
36691
  */
36692
36692
  onFileReceived(listener) {
36693
36693
  return this.on("FILE_RECEIVED", listener);
36694
36694
  }
36695
+ /**
36696
+ * Registers a listener for files stored in the association directory.
36697
+ *
36698
+ * @param listener - Callback receiving stored file data with size
36699
+ * @returns this for chaining
36700
+ */
36701
+ onFileStored(listener) {
36702
+ return this.on("FILE_STORED", listener);
36703
+ }
36704
+ /**
36705
+ * Registers a listener for parsed DicomInstance availability.
36706
+ *
36707
+ * @param listener - Callback receiving instance data
36708
+ * @returns this for chaining
36709
+ */
36710
+ onInstanceReceived(listener) {
36711
+ return this.on("INSTANCE_RECEIVED", listener);
36712
+ }
36695
36713
  /**
36696
36714
  * Registers a listener for completed associations.
36697
36715
  *
@@ -36985,11 +37003,18 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36985
37003
  });
36986
37004
  return;
36987
37005
  }
37006
+ this.emit("FILE_RECEIVED", {
37007
+ filePath: data.filePath,
37008
+ associationId: ctx.associationId,
37009
+ callingAE: data.callingAE,
37010
+ calledAE: data.calledAE,
37011
+ source: data.source
37012
+ });
36988
37013
  const promise = this.handleFileReceived(worker, data, ctx);
36989
37014
  worker.trackFile(promise);
36990
37015
  });
36991
37016
  }
36992
- /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
37017
+ /** Moves file to association dir, emits FILE_STORED, then parses instance. */
36993
37018
  async handleFileReceived(worker, data, ctx) {
36994
37019
  try {
36995
37020
  await this.moveAndEmitFile(worker, data, ctx);
@@ -37006,7 +37031,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
37006
37031
  });
37007
37032
  }
37008
37033
  }
37009
- /** Inner handler: move file, parse DICOM, emit FILE_RECEIVED or error. */
37034
+ /** Inner handler: move file, emit FILE_STORED, parse DICOM, emit INSTANCE_RECEIVED. */
37010
37035
  async moveAndEmitFile(worker, data, ctx) {
37011
37036
  const srcPath = data.filePath;
37012
37037
  const destPath = path__namespace.join(ctx.associationDir, path__namespace.basename(srcPath));
@@ -37014,28 +37039,42 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
37014
37039
  const finalPath = moveResult.ok ? destPath : srcPath;
37015
37040
  const fileSize = await statFileSafe(finalPath);
37016
37041
  worker.recordFile(finalPath, fileSize);
37017
- const openResult = await DicomInstance.open(finalPath);
37018
- if (!openResult.ok) {
37019
- this.emit("error", {
37020
- error: openResult.error,
37021
- filePath: finalPath,
37022
- associationId: ctx.associationId,
37023
- associationDir: ctx.associationDir,
37024
- callingAE: data.callingAE,
37025
- calledAE: data.calledAE,
37026
- source: data.source
37027
- });
37028
- return;
37029
- }
37030
- this.emit("FILE_RECEIVED", {
37042
+ this.emit("FILE_STORED", {
37031
37043
  filePath: finalPath,
37032
37044
  fileSize,
37033
37045
  associationId: ctx.associationId,
37034
37046
  associationDir: ctx.associationDir,
37035
37047
  callingAE: data.callingAE,
37036
37048
  calledAE: data.calledAE,
37037
- source: data.source,
37038
- instance: openResult.value
37049
+ source: data.source
37050
+ });
37051
+ this.emitInstanceReceived(finalPath, fileSize, data, ctx);
37052
+ }
37053
+ /** Parses a DICOM file and emits INSTANCE_RECEIVED or error. */
37054
+ emitInstanceReceived(filePath, fileSize, data, ctx) {
37055
+ void DicomInstance.open(filePath).then((openResult) => {
37056
+ if (!openResult.ok) {
37057
+ this.emit("error", {
37058
+ error: openResult.error,
37059
+ filePath,
37060
+ associationId: ctx.associationId,
37061
+ associationDir: ctx.associationDir,
37062
+ callingAE: data.callingAE,
37063
+ calledAE: data.calledAE,
37064
+ source: data.source
37065
+ });
37066
+ return;
37067
+ }
37068
+ this.emit("INSTANCE_RECEIVED", {
37069
+ filePath,
37070
+ fileSize,
37071
+ associationId: ctx.associationId,
37072
+ associationDir: ctx.associationDir,
37073
+ callingAE: data.callingAE,
37074
+ calledAE: data.calledAE,
37075
+ source: data.source,
37076
+ instance: openResult.value
37077
+ });
37039
37078
  });
37040
37079
  }
37041
37080
  /** Returns worker to idle pool on association complete, emits summary. */