@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
package/dist/servers.cjs
CHANGED
|
@@ -3227,16 +3227,25 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
3227
3227
|
/** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
|
|
3228
3228
|
wireFileReceived(worker) {
|
|
3229
3229
|
worker.dcmrecv.onFileReceived((data) => {
|
|
3230
|
-
const
|
|
3230
|
+
const assocId = worker.associationId;
|
|
3231
|
+
const assocDir = worker.associationDir;
|
|
3232
|
+
if (assocDir === void 0 || assocId === void 0) {
|
|
3233
|
+
this.emit("error", {
|
|
3234
|
+
error: new Error(`DicomReceiver: FILE_RECEIVED with no active association (worker state: ${worker.state})`),
|
|
3235
|
+
filePath: data.filePath,
|
|
3236
|
+
callingAE: data.callingAE,
|
|
3237
|
+
calledAE: data.calledAE,
|
|
3238
|
+
source: data.source
|
|
3239
|
+
});
|
|
3240
|
+
return;
|
|
3241
|
+
}
|
|
3242
|
+
const promise = this.handleFileReceived(worker, data, assocId, assocDir);
|
|
3231
3243
|
worker.pendingFiles.push(promise);
|
|
3232
3244
|
void promise.finally(() => removePending(worker.pendingFiles, promise));
|
|
3233
3245
|
});
|
|
3234
3246
|
}
|
|
3235
3247
|
/** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
|
|
3236
|
-
async handleFileReceived(worker, data) {
|
|
3237
|
-
if (worker.associationDir === void 0 || worker.associationId === void 0) return;
|
|
3238
|
-
const assocId = worker.associationId;
|
|
3239
|
-
const assocDir = worker.associationDir;
|
|
3248
|
+
async handleFileReceived(worker, data, assocId, assocDir) {
|
|
3240
3249
|
try {
|
|
3241
3250
|
await this.moveAndEmitFile(worker, data, assocId, assocDir);
|
|
3242
3251
|
} catch (thrown) {
|
|
@@ -3291,9 +3300,9 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
3291
3300
|
void this.finalizeAssociation(worker, data);
|
|
3292
3301
|
});
|
|
3293
3302
|
}
|
|
3294
|
-
/** Awaits pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
3303
|
+
/** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
|
|
3295
3304
|
async finalizeAssociation(worker, data) {
|
|
3296
|
-
|
|
3305
|
+
while (worker.pendingFiles.length > 0) {
|
|
3297
3306
|
await Promise.all(worker.pendingFiles);
|
|
3298
3307
|
}
|
|
3299
3308
|
this.emitAssociationComplete(worker, data);
|