@ubercode/dcmtk 0.13.0 → 0.13.2
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-B1eynCVv.d.cts → index-Bve4fMIh.d.cts} +3 -0
- package/dist/{index-DM0yFtPO.d.ts → index-CZiFWENk.d.ts} +3 -0
- package/dist/index.cjs +24 -13
- 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 +24 -13
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +24 -13
- 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 +24 -13
- package/dist/servers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1624,6 +1624,8 @@ interface DicomReceiverOptions {
|
|
|
1624
1624
|
readonly storageMode?: StorageModeValue | undefined;
|
|
1625
1625
|
/** Options passed to DicomInstance.open() for each received file. Defaults charsetFallback to `'Latin1'`. */
|
|
1626
1626
|
readonly instanceOpenOptions?: DicomOpenOptions | undefined;
|
|
1627
|
+
/** Whether to parse received files into DicomInstance. When false, INSTANCE_RECEIVED and INSTANCE_ERROR events are not emitted. Defaults to true. */
|
|
1628
|
+
readonly parseInstances?: boolean | undefined;
|
|
1627
1629
|
/** AbortSignal for external cancellation. */
|
|
1628
1630
|
readonly signal?: AbortSignal | undefined;
|
|
1629
1631
|
}
|
|
@@ -1657,6 +1659,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
|
|
|
1657
1659
|
private readonly maxPoolSize;
|
|
1658
1660
|
private readonly connectionTimeoutMs;
|
|
1659
1661
|
private readonly resolvedInstanceOpenOptions;
|
|
1662
|
+
private readonly parseInstances;
|
|
1660
1663
|
private readonly workers;
|
|
1661
1664
|
private tcpServer;
|
|
1662
1665
|
private associationCounter;
|
|
@@ -1624,6 +1624,8 @@ interface DicomReceiverOptions {
|
|
|
1624
1624
|
readonly storageMode?: StorageModeValue | undefined;
|
|
1625
1625
|
/** Options passed to DicomInstance.open() for each received file. Defaults charsetFallback to `'Latin1'`. */
|
|
1626
1626
|
readonly instanceOpenOptions?: DicomOpenOptions | undefined;
|
|
1627
|
+
/** Whether to parse received files into DicomInstance. When false, INSTANCE_RECEIVED and INSTANCE_ERROR events are not emitted. Defaults to true. */
|
|
1628
|
+
readonly parseInstances?: boolean | undefined;
|
|
1627
1629
|
/** AbortSignal for external cancellation. */
|
|
1628
1630
|
readonly signal?: AbortSignal | undefined;
|
|
1629
1631
|
}
|
|
@@ -1657,6 +1659,7 @@ declare class DicomReceiver extends EventEmitter<DicomReceiverEventMap> {
|
|
|
1657
1659
|
private readonly maxPoolSize;
|
|
1658
1660
|
private readonly connectionTimeoutMs;
|
|
1659
1661
|
private readonly resolvedInstanceOpenOptions;
|
|
1662
|
+
private readonly parseInstances;
|
|
1660
1663
|
private readonly workers;
|
|
1661
1664
|
private tcpServer;
|
|
1662
1665
|
private associationCounter;
|
package/dist/index.cjs
CHANGED
|
@@ -36492,6 +36492,7 @@ var DicomReceiverOptionsSchema = zod.z.object({
|
|
|
36492
36492
|
charsetAssume: zod.z.string().min(1).optional(),
|
|
36493
36493
|
charsetFallback: zod.z.string().min(1).optional()
|
|
36494
36494
|
}).strict().optional(),
|
|
36495
|
+
parseInstances: zod.z.boolean().optional(),
|
|
36495
36496
|
signal: zod.z.instanceof(AbortSignal).optional()
|
|
36496
36497
|
}).strict().refine((data) => (data.minPoolSize ?? DEFAULT_MIN_POOL_SIZE) <= (data.maxPoolSize ?? DEFAULT_MAX_POOL_SIZE), {
|
|
36497
36498
|
message: "minPoolSize must be <= maxPoolSize"
|
|
@@ -36548,10 +36549,14 @@ var Worker = class {
|
|
|
36548
36549
|
this._instancesReceived = 0;
|
|
36549
36550
|
this._instanceErrors = 0;
|
|
36550
36551
|
}
|
|
36551
|
-
/**
|
|
36552
|
+
/**
|
|
36553
|
+
* Returns the worker to idle. Context is intentionally preserved so that
|
|
36554
|
+
* late FILE_RECEIVED events (arriving in a subsequent pipe chunk after
|
|
36555
|
+
* ASSOCIATION_RELEASE) still have valid association info. Context is
|
|
36556
|
+
* cleared on the next {@link beginAssociation} call.
|
|
36557
|
+
*/
|
|
36552
36558
|
endAssociation() {
|
|
36553
36559
|
this._state = "idle";
|
|
36554
|
-
this._context = void 0;
|
|
36555
36560
|
this._files.length = 0;
|
|
36556
36561
|
this._fileSizes.length = 0;
|
|
36557
36562
|
this._outputLines.length = 0;
|
|
@@ -36662,6 +36667,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36662
36667
|
__publicField(this, "maxPoolSize");
|
|
36663
36668
|
__publicField(this, "connectionTimeoutMs");
|
|
36664
36669
|
__publicField(this, "resolvedInstanceOpenOptions");
|
|
36670
|
+
__publicField(this, "parseInstances");
|
|
36665
36671
|
__publicField(this, "workers", /* @__PURE__ */ new Map());
|
|
36666
36672
|
__publicField(this, "tcpServer");
|
|
36667
36673
|
__publicField(this, "associationCounter", 0);
|
|
@@ -36674,6 +36680,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
36674
36680
|
this.maxPoolSize = options.maxPoolSize ?? DEFAULT_MAX_POOL_SIZE;
|
|
36675
36681
|
this.connectionTimeoutMs = options.connectionTimeoutMs ?? DEFAULT_CONNECTION_TIMEOUT_MS;
|
|
36676
36682
|
this.resolvedInstanceOpenOptions = { charsetFallback: "Latin1", ...options.instanceOpenOptions };
|
|
36683
|
+
this.parseInstances = options.parseInstances ?? true;
|
|
36677
36684
|
}
|
|
36678
36685
|
// -----------------------------------------------------------------------
|
|
36679
36686
|
// Public API
|
|
@@ -37126,16 +37133,18 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
37126
37133
|
calledAE: data.calledAE,
|
|
37127
37134
|
source: data.source
|
|
37128
37135
|
});
|
|
37129
|
-
|
|
37130
|
-
|
|
37131
|
-
|
|
37132
|
-
|
|
37133
|
-
|
|
37134
|
-
|
|
37135
|
-
|
|
37136
|
-
|
|
37137
|
-
|
|
37138
|
-
|
|
37136
|
+
if (this.parseInstances) {
|
|
37137
|
+
const instanceCtx = {
|
|
37138
|
+
filePath: finalPath,
|
|
37139
|
+
fileSize,
|
|
37140
|
+
associationId: ctx.associationId,
|
|
37141
|
+
associationDir: ctx.associationDir,
|
|
37142
|
+
callingAE: data.callingAE,
|
|
37143
|
+
calledAE: data.calledAE,
|
|
37144
|
+
source: data.source
|
|
37145
|
+
};
|
|
37146
|
+
worker.trackInstance(this.parseAndEmitInstance(worker, instanceCtx));
|
|
37147
|
+
}
|
|
37139
37148
|
}
|
|
37140
37149
|
/** Parses a DICOM file and emits INSTANCE_RECEIVED or INSTANCE_ERROR. */
|
|
37141
37150
|
async parseAndEmitInstance(worker, ctx) {
|
|
@@ -37157,7 +37166,9 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
37157
37166
|
/** Returns worker to idle pool on association complete, emits summary. */
|
|
37158
37167
|
wireAssociationComplete(worker) {
|
|
37159
37168
|
worker.dcmrecv.onAssociationComplete((data) => {
|
|
37160
|
-
|
|
37169
|
+
setImmediate(() => {
|
|
37170
|
+
void this.finalizeAssociation(worker, data);
|
|
37171
|
+
});
|
|
37161
37172
|
});
|
|
37162
37173
|
}
|
|
37163
37174
|
/** Awaits file ops, emits ASSOCIATION_COMPLETE, awaits parsing, emits ASSOCIATION_FINALIZED. */
|