@ubercode/dcmtk 0.9.3 → 0.9.4

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.
@@ -1719,7 +1719,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1719
1719
  private scaleDown;
1720
1720
  /** Wires all events on a worker: file handling, association lifecycle, output capture. */
1721
1721
  private wireWorkerEvents;
1722
- /** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
1722
+ /** Wires FILE_RECEIVED from dcmrecv worker files are processed serially per worker. */
1723
1723
  private wireFileReceived;
1724
1724
  /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
1725
1725
  private handleFileReceived;
@@ -1719,7 +1719,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
1719
1719
  private scaleDown;
1720
1720
  /** Wires all events on a worker: file handling, association lifecycle, output capture. */
1721
1721
  private wireWorkerEvents;
1722
- /** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
1722
+ /** Wires FILE_RECEIVED from dcmrecv worker files are processed serially per worker. */
1723
1723
  private wireFileReceived;
1724
1724
  /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
1725
1725
  private handleFileReceived;
package/dist/index.cjs CHANGED
@@ -36713,7 +36713,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36713
36713
  this.wireRefusingAssociation(worker);
36714
36714
  this.wireOutputCapture(worker);
36715
36715
  }
36716
- /** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
36716
+ /** Wires FILE_RECEIVED from dcmrecv worker files are processed serially per worker. */
36717
36717
  wireFileReceived(worker) {
36718
36718
  worker.dcmrecv.onFileReceived((data) => {
36719
36719
  const assocId = worker.associationId;
@@ -36730,7 +36730,6 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36730
36730
  }
36731
36731
  const promise = this.handleFileReceived(worker, data, assocId, assocDir);
36732
36732
  worker.pendingFiles.push(promise);
36733
- void promise.finally(() => removePending(worker.pendingFiles, promise));
36734
36733
  });
36735
36734
  }
36736
36735
  /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
@@ -36791,7 +36790,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36791
36790
  }
36792
36791
  /** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
36793
36792
  async finalizeAssociation(worker, data) {
36794
- while (worker.pendingFiles.length > 0) {
36793
+ if (worker.pendingFiles.length > 0) {
36795
36794
  await Promise.all(worker.pendingFiles);
36796
36795
  }
36797
36796
  this.emitAssociationComplete(worker, data);
@@ -36942,10 +36941,6 @@ async function removeDirSafe(dirPath) {
36942
36941
  } catch {
36943
36942
  }
36944
36943
  }
36945
- function removePending(arr, promise) {
36946
- const idx = arr.indexOf(promise);
36947
- if (idx !== -1) void arr.splice(idx, 1);
36948
- }
36949
36944
  function delay(ms) {
36950
36945
  return new Promise((resolve) => {
36951
36946
  setTimeout(resolve, ms);