@ubercode/dcmtk 0.9.2 → 0.9.3
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-CWZOBvrt.d.ts} +1 -1
- package/dist/{index-BJOfTTB-.d.cts → index-vXxeheHY.d.cts} +1 -1
- package/dist/index.cjs +16 -7
- 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 -7
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +16 -7
- 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 -7
- package/dist/servers.js.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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
|
@@ -36716,16 +36716,25 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36716
36716
|
/** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
|
|
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
36733
|
void promise.finally(() => removePending(worker.pendingFiles, promise));
|
|
36722
36734
|
});
|
|
36723
36735
|
}
|
|
36724
36736
|
/** 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;
|
|
36737
|
+
async handleFileReceived(worker, data, assocId, assocDir) {
|
|
36729
36738
|
try {
|
|
36730
36739
|
await this.moveAndEmitFile(worker, data, assocId, assocDir);
|
|
36731
36740
|
} catch (thrown) {
|
|
@@ -36780,9 +36789,9 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36780
36789
|
void this.finalizeAssociation(worker, data);
|
|
36781
36790
|
});
|
|
36782
36791
|
}
|
|
36783
|
-
/** Awaits pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
36792
|
+
/** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
36784
36793
|
async finalizeAssociation(worker, data) {
|
|
36785
|
-
|
|
36794
|
+
while (worker.pendingFiles.length > 0) {
|
|
36786
36795
|
await Promise.all(worker.pendingFiles);
|
|
36787
36796
|
}
|
|
36788
36797
|
this.emitAssociationComplete(worker, data);
|