@ubercode/dcmtk 0.9.2 → 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.
- package/dist/{index-DW1uwonV.d.ts → index-x98H349Q.d.ts} +2 -2
- package/dist/{index-BJOfTTB-.d.cts → index-zdzuZTms.d.cts} +2 -2
- package/dist/index.cjs +16 -12
- 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 +16 -12
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +16 -12
- 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 +16 -12
- package/dist/servers.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
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;
|
|
@@ -1727,7 +1727,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
|
|
|
1727
1727
|
private moveAndEmitFile;
|
|
1728
1728
|
/** Returns worker to idle pool on association complete, emits summary. */
|
|
1729
1729
|
private wireAssociationComplete;
|
|
1730
|
-
/** Awaits pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
1730
|
+
/** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
1731
1731
|
private finalizeAssociation;
|
|
1732
1732
|
/** Emits the ASSOCIATION_COMPLETE event with transfer stats. */
|
|
1733
1733
|
private emitAssociationComplete;
|
|
@@ -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
|
|
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;
|
|
@@ -1727,7 +1727,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
|
|
|
1727
1727
|
private moveAndEmitFile;
|
|
1728
1728
|
/** Returns worker to idle pool on association complete, emits summary. */
|
|
1729
1729
|
private wireAssociationComplete;
|
|
1730
|
-
/** Awaits pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
1730
|
+
/** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
1731
1731
|
private finalizeAssociation;
|
|
1732
1732
|
/** Emits the ASSOCIATION_COMPLETE event with transfer stats. */
|
|
1733
1733
|
private emitAssociationComplete;
|
package/dist/index.cjs
CHANGED
|
@@ -36713,19 +36713,27 @@ 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
|
|
36716
|
+
/** Wires FILE_RECEIVED from dcmrecv worker — files are processed serially per worker. */
|
|
36717
36717
|
wireFileReceived(worker) {
|
|
36718
36718
|
worker.dcmrecv.onFileReceived((data) => {
|
|
36719
|
-
const
|
|
36719
|
+
const assocId = worker.associationId;
|
|
36720
|
+
const assocDir = worker.associationDir;
|
|
36721
|
+
if (assocDir === void 0 || assocId === void 0) {
|
|
36722
|
+
this.emit("error", {
|
|
36723
|
+
error: new Error(`DicomReceiver: FILE_RECEIVED with no active association (worker state: ${worker.state})`),
|
|
36724
|
+
filePath: data.filePath,
|
|
36725
|
+
callingAE: data.callingAE,
|
|
36726
|
+
calledAE: data.calledAE,
|
|
36727
|
+
source: data.source
|
|
36728
|
+
});
|
|
36729
|
+
return;
|
|
36730
|
+
}
|
|
36731
|
+
const promise = this.handleFileReceived(worker, data, assocId, assocDir);
|
|
36720
36732
|
worker.pendingFiles.push(promise);
|
|
36721
|
-
void promise.finally(() => removePending(worker.pendingFiles, promise));
|
|
36722
36733
|
});
|
|
36723
36734
|
}
|
|
36724
36735
|
/** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
|
|
36725
|
-
async handleFileReceived(worker, data) {
|
|
36726
|
-
if (worker.associationDir === void 0 || worker.associationId === void 0) return;
|
|
36727
|
-
const assocId = worker.associationId;
|
|
36728
|
-
const assocDir = worker.associationDir;
|
|
36736
|
+
async handleFileReceived(worker, data, assocId, assocDir) {
|
|
36729
36737
|
try {
|
|
36730
36738
|
await this.moveAndEmitFile(worker, data, assocId, assocDir);
|
|
36731
36739
|
} catch (thrown) {
|
|
@@ -36780,7 +36788,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36780
36788
|
void this.finalizeAssociation(worker, data);
|
|
36781
36789
|
});
|
|
36782
36790
|
}
|
|
36783
|
-
/** Awaits pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
36791
|
+
/** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
36784
36792
|
async finalizeAssociation(worker, data) {
|
|
36785
36793
|
if (worker.pendingFiles.length > 0) {
|
|
36786
36794
|
await Promise.all(worker.pendingFiles);
|
|
@@ -36933,10 +36941,6 @@ async function removeDirSafe(dirPath) {
|
|
|
36933
36941
|
} catch {
|
|
36934
36942
|
}
|
|
36935
36943
|
}
|
|
36936
|
-
function removePending(arr, promise) {
|
|
36937
|
-
const idx = arr.indexOf(promise);
|
|
36938
|
-
if (idx !== -1) void arr.splice(idx, 1);
|
|
36939
|
-
}
|
|
36940
36944
|
function delay(ms) {
|
|
36941
36945
|
return new Promise((resolve) => {
|
|
36942
36946
|
setTimeout(resolve, ms);
|