@ubercode/dcmtk 0.10.0 → 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.
- package/dist/dicom.cjs +8 -7
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +8 -7
- package/dist/dicom.js.map +1 -1
- package/dist/{index-Hp4Ri9y5.d.ts → index--dDQfutR.d.ts} +47 -9
- package/dist/{index-CEqwLKgE.d.cts → index-CVDMaxd8.d.cts} +47 -9
- package/dist/index.cjs +67 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +67 -27
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +67 -27
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +1 -1
- package/dist/servers.d.ts +1 -1
- package/dist/servers.js +67 -27
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +8 -7
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +8 -7
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
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: [
|
|
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
|
|
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
|
|
1680
|
+
* @param listener - Callback receiving instance data
|
|
1647
1681
|
* @returns this for chaining
|
|
1648
1682
|
*/
|
|
1649
|
-
|
|
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
|
|
1758
|
+
/** Moves file to association dir, emits FILE_STORED, then parses instance. */
|
|
1725
1759
|
private handleFileReceived;
|
|
1726
|
-
/** Inner handler: move file, parse DICOM, emit
|
|
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
|
|
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
|
|
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: [
|
|
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
|
|
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
|
|
1680
|
+
* @param listener - Callback receiving instance data
|
|
1647
1681
|
* @returns this for chaining
|
|
1648
1682
|
*/
|
|
1649
|
-
|
|
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
|
|
1758
|
+
/** Moves file to association dir, emits FILE_STORED, then parses instance. */
|
|
1725
1759
|
private handleFileReceived;
|
|
1726
|
-
/** Inner handler: move file, parse DICOM, emit
|
|
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
|
|
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
|
@@ -318,13 +318,14 @@ async function execCommand(binary, args, options) {
|
|
|
318
318
|
windowsHide: true,
|
|
319
319
|
signal: options?.signal
|
|
320
320
|
});
|
|
321
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
321
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
-
function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
324
|
+
function wireSpawnListeners(binary, child, timeoutMs, resolve) {
|
|
325
325
|
let stdout = "";
|
|
326
326
|
let stderr8 = "";
|
|
327
327
|
let settled = false;
|
|
328
|
+
const name = binary.split("/").pop() ?? binary;
|
|
328
329
|
const settle = (result) => {
|
|
329
330
|
if (settled) return;
|
|
330
331
|
settled = true;
|
|
@@ -333,25 +334,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
|
333
334
|
};
|
|
334
335
|
const timer = setTimeout(() => {
|
|
335
336
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
336
|
-
settle(err(new Error(
|
|
337
|
+
settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
|
|
337
338
|
}, timeoutMs);
|
|
338
339
|
child.stdout?.on("data", (chunk) => {
|
|
339
340
|
stdout += String(chunk);
|
|
340
341
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
341
342
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
342
|
-
settle(err(new Error(
|
|
343
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
343
344
|
}
|
|
344
345
|
});
|
|
345
346
|
child.stderr?.on("data", (chunk) => {
|
|
346
347
|
stderr8 += String(chunk);
|
|
347
348
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
348
349
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
349
|
-
settle(err(new Error(
|
|
350
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
350
351
|
}
|
|
351
352
|
});
|
|
352
353
|
child.on("error", (error) => {
|
|
353
354
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
354
|
-
settle(err(new Error(
|
|
355
|
+
settle(err(new Error(`${name} error: ${error.message}`)));
|
|
355
356
|
});
|
|
356
357
|
child.on("close", (code) => {
|
|
357
358
|
settle(ok({ stdout, stderr: stderr8, exitCode: code ?? 1 }));
|
|
@@ -366,7 +367,7 @@ async function spawnCommand(binary, args, options) {
|
|
|
366
367
|
windowsHide: true,
|
|
367
368
|
signal: options?.signal
|
|
368
369
|
});
|
|
369
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
370
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
370
371
|
});
|
|
371
372
|
}
|
|
372
373
|
var ProcessState = {
|
|
@@ -36683,14 +36684,32 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36683
36684
|
return this.on(event, listener);
|
|
36684
36685
|
}
|
|
36685
36686
|
/**
|
|
36686
|
-
* Registers a listener for received
|
|
36687
|
+
* Registers a listener for files received by dcmrecv (before move/parse).
|
|
36687
36688
|
*
|
|
36688
|
-
* @param listener - Callback receiving file data
|
|
36689
|
+
* @param listener - Callback receiving raw file data
|
|
36689
36690
|
* @returns this for chaining
|
|
36690
36691
|
*/
|
|
36691
36692
|
onFileReceived(listener) {
|
|
36692
36693
|
return this.on("FILE_RECEIVED", listener);
|
|
36693
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
|
+
}
|
|
36694
36713
|
/**
|
|
36695
36714
|
* Registers a listener for completed associations.
|
|
36696
36715
|
*
|
|
@@ -36984,11 +37003,18 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36984
37003
|
});
|
|
36985
37004
|
return;
|
|
36986
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
|
+
});
|
|
36987
37013
|
const promise = this.handleFileReceived(worker, data, ctx);
|
|
36988
37014
|
worker.trackFile(promise);
|
|
36989
37015
|
});
|
|
36990
37016
|
}
|
|
36991
|
-
/** Moves
|
|
37017
|
+
/** Moves file to association dir, emits FILE_STORED, then parses instance. */
|
|
36992
37018
|
async handleFileReceived(worker, data, ctx) {
|
|
36993
37019
|
try {
|
|
36994
37020
|
await this.moveAndEmitFile(worker, data, ctx);
|
|
@@ -37005,7 +37031,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
37005
37031
|
});
|
|
37006
37032
|
}
|
|
37007
37033
|
}
|
|
37008
|
-
/** Inner handler: move file, parse DICOM, emit
|
|
37034
|
+
/** Inner handler: move file, emit FILE_STORED, parse DICOM, emit INSTANCE_RECEIVED. */
|
|
37009
37035
|
async moveAndEmitFile(worker, data, ctx) {
|
|
37010
37036
|
const srcPath = data.filePath;
|
|
37011
37037
|
const destPath = path__namespace.join(ctx.associationDir, path__namespace.basename(srcPath));
|
|
@@ -37013,28 +37039,42 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
37013
37039
|
const finalPath = moveResult.ok ? destPath : srcPath;
|
|
37014
37040
|
const fileSize = await statFileSafe(finalPath);
|
|
37015
37041
|
worker.recordFile(finalPath, fileSize);
|
|
37016
|
-
|
|
37017
|
-
if (!openResult.ok) {
|
|
37018
|
-
this.emit("error", {
|
|
37019
|
-
error: openResult.error,
|
|
37020
|
-
filePath: finalPath,
|
|
37021
|
-
associationId: ctx.associationId,
|
|
37022
|
-
associationDir: ctx.associationDir,
|
|
37023
|
-
callingAE: data.callingAE,
|
|
37024
|
-
calledAE: data.calledAE,
|
|
37025
|
-
source: data.source
|
|
37026
|
-
});
|
|
37027
|
-
return;
|
|
37028
|
-
}
|
|
37029
|
-
this.emit("FILE_RECEIVED", {
|
|
37042
|
+
this.emit("FILE_STORED", {
|
|
37030
37043
|
filePath: finalPath,
|
|
37031
37044
|
fileSize,
|
|
37032
37045
|
associationId: ctx.associationId,
|
|
37033
37046
|
associationDir: ctx.associationDir,
|
|
37034
37047
|
callingAE: data.callingAE,
|
|
37035
37048
|
calledAE: data.calledAE,
|
|
37036
|
-
source: data.source
|
|
37037
|
-
|
|
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
|
+
});
|
|
37038
37078
|
});
|
|
37039
37079
|
}
|
|
37040
37080
|
/** Returns worker to idle pool on association complete, emits summary. */
|