@ubercode/dcmtk 0.13.0 → 0.13.1

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.
@@ -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"
@@ -36662,6 +36663,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36662
36663
  __publicField(this, "maxPoolSize");
36663
36664
  __publicField(this, "connectionTimeoutMs");
36664
36665
  __publicField(this, "resolvedInstanceOpenOptions");
36666
+ __publicField(this, "parseInstances");
36665
36667
  __publicField(this, "workers", /* @__PURE__ */ new Map());
36666
36668
  __publicField(this, "tcpServer");
36667
36669
  __publicField(this, "associationCounter", 0);
@@ -36674,6 +36676,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
36674
36676
  this.maxPoolSize = options.maxPoolSize ?? DEFAULT_MAX_POOL_SIZE;
36675
36677
  this.connectionTimeoutMs = options.connectionTimeoutMs ?? DEFAULT_CONNECTION_TIMEOUT_MS;
36676
36678
  this.resolvedInstanceOpenOptions = { charsetFallback: "Latin1", ...options.instanceOpenOptions };
36679
+ this.parseInstances = options.parseInstances ?? true;
36677
36680
  }
36678
36681
  // -----------------------------------------------------------------------
36679
36682
  // Public API
@@ -37126,16 +37129,18 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
37126
37129
  calledAE: data.calledAE,
37127
37130
  source: data.source
37128
37131
  });
37129
- const instanceCtx = {
37130
- filePath: finalPath,
37131
- fileSize,
37132
- associationId: ctx.associationId,
37133
- associationDir: ctx.associationDir,
37134
- callingAE: data.callingAE,
37135
- calledAE: data.calledAE,
37136
- source: data.source
37137
- };
37138
- worker.trackInstance(this.parseAndEmitInstance(worker, instanceCtx));
37132
+ if (this.parseInstances) {
37133
+ const instanceCtx = {
37134
+ filePath: finalPath,
37135
+ fileSize,
37136
+ associationId: ctx.associationId,
37137
+ associationDir: ctx.associationDir,
37138
+ callingAE: data.callingAE,
37139
+ calledAE: data.calledAE,
37140
+ source: data.source
37141
+ };
37142
+ worker.trackInstance(this.parseAndEmitInstance(worker, instanceCtx));
37143
+ }
37139
37144
  }
37140
37145
  /** Parses a DICOM file and emits INSTANCE_RECEIVED or INSTANCE_ERROR. */
37141
37146
  async parseAndEmitInstance(worker, ctx) {