@ubercode/dcmtk 0.6.5 → 0.7.0

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.d.cts CHANGED
@@ -3,7 +3,7 @@ export { L as LineSource, P as ProcessLine, a as ResultValue, b as assertUnreach
3
3
  import { A as AETitle, D as DicomTag, a as DicomTagPath, P as Port, S as SOPClassUID, T as TransferSyntaxUID, b as DicomDataset } from './DicomInstance-zsmyd7fs.cjs';
4
4
  export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, W as WalkTagEntry, e as WalkTagsOptions, f as createAETitle, g as createDicomFilePath, h as createDicomTag, i as createDicomTagPath, j as createPort, k as createSOPClassUID, l as createTransferSyntaxUID, t as tag, w as walkTags } from './DicomInstance-zsmyd7fs.cjs';
5
5
  import { z } from 'zod';
6
- export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-D_ew9kha.cjs';
6
+ export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-AYvUunlI.cjs';
7
7
  export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, T as TagModification, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-Cf-RPHF3.cjs';
8
8
  export { DictionaryEntry, SOPClassName, SOP_CLASSES, TagSegment, VR, VRCategoryName, VRMetadata, VRValue, VR_CATEGORY, VR_CATEGORY_NAME, VR_META, getVRCategory, isBinaryVR, isNumericVR, isStringVR, lookupTag, lookupTagByKeyword, lookupTagByName, segmentsToModifyPath, segmentsToString, sopClassNameFromUID, tagPathToSegments } from './dicom.cjs';
9
9
  import { ProposedTransferSyntaxValue } from './tools.cjs';
@@ -277,6 +277,22 @@ interface DicomSenderOptions {
277
277
  readonly bucketFlushMs?: number | undefined;
278
278
  /** Maximum files per bucket before auto-flush (bucket mode only). Defaults to 50. */
279
279
  readonly maxBucketSize?: number | undefined;
280
+ /** Maximum PDU receive size (passed through to storescu `--max-pdu`). */
281
+ readonly maxPduReceive?: number | undefined;
282
+ /** Maximum PDU send size (passed through to storescu `--max-send-pdu`). */
283
+ readonly maxPduSend?: number | undefined;
284
+ /** Association timeout in seconds (passed through to storescu `-to`). */
285
+ readonly associationTimeout?: number | undefined;
286
+ /** ACSE timeout in seconds (passed through to storescu `-ta`). */
287
+ readonly acseTimeout?: number | undefined;
288
+ /** DIMSE timeout in seconds (passed through to storescu `-td`). */
289
+ readonly dimseTimeout?: number | undefined;
290
+ /** Disable DNS hostname lookup (passed through to storescu `-nh`). Useful in containerized environments. */
291
+ readonly noHostnameLookup?: boolean | undefined;
292
+ /** Disable UID validity checking (passed through to storescu `--no-uid-checks`). */
293
+ readonly noUidChecks?: boolean | undefined;
294
+ /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
295
+ readonly verbosity?: 'verbose' | 'debug' | undefined;
280
296
  /** AbortSignal for external cancellation. */
281
297
  readonly signal?: AbortSignal | undefined;
282
298
  }
@@ -286,6 +302,10 @@ interface SendOptions {
286
302
  readonly timeoutMs?: number | undefined;
287
303
  /** Override max retries for this send. */
288
304
  readonly maxRetries?: number | undefined;
305
+ /** Override called AE Title for this send. */
306
+ readonly calledAETitle?: string | undefined;
307
+ /** Override calling AE Title for this send. */
308
+ readonly callingAETitle?: string | undefined;
289
309
  }
290
310
  /** Result of a successful send operation. */
291
311
  interface SendResult {
@@ -295,6 +315,10 @@ interface SendResult {
295
315
  readonly fileCount: number;
296
316
  /** Total send duration in milliseconds. */
297
317
  readonly durationMs: number;
318
+ /** Raw stdout from storescu (available when verbosity is set). */
319
+ readonly stdout: string;
320
+ /** Raw stderr from storescu. */
321
+ readonly stderr: string;
298
322
  }
299
323
  /** Snapshot of the sender's current state. */
300
324
  interface SenderStatus {
@@ -321,6 +345,10 @@ interface SenderSendCompleteData {
321
345
  readonly fileCount: number;
322
346
  /** Total send duration in milliseconds. */
323
347
  readonly durationMs: number;
348
+ /** Raw stdout from storescu. */
349
+ readonly stdout: string;
350
+ /** Raw stderr from storescu. */
351
+ readonly stderr: string;
324
352
  }
325
353
  /** Data emitted with SEND_FAILED events. */
326
354
  interface SenderSendFailedData {
@@ -330,6 +358,10 @@ interface SenderSendFailedData {
330
358
  readonly error: Error;
331
359
  /** Number of attempts made. */
332
360
  readonly attempts: number;
361
+ /** Raw stdout from the last storescu attempt. */
362
+ readonly stdout: string;
363
+ /** Raw stderr from the last storescu attempt. */
364
+ readonly stderr: string;
333
365
  }
334
366
  /** Data emitted with HEALTH_CHANGED events. */
335
367
  interface SenderHealthChangedData {
@@ -446,6 +478,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
446
478
  * @returns A Result containing the send result or an error
447
479
  */
448
480
  send(files: readonly string[], options?: SendOptions): Promise<Result<SendResult>>;
481
+ /** Dispatches a send to the appropriate mode handler. */
482
+ private dispatchSend;
449
483
  /**
450
484
  * Flushes the current bucket immediately (bucket mode only).
451
485
  * In single/multiple mode this is a no-op.
@@ -510,7 +544,7 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
510
544
  private clearBucketTimer;
511
545
  /** Executes a single queue entry: calls storescu with retry. */
512
546
  private executeEntry;
513
- /** Attempts storescu up to maxAttempts times. Returns undefined on success, or the last error. */
547
+ /** Attempts storescu up to maxAttempts times. Returns undefined on success, or failure info. */
514
548
  private attemptSend;
515
549
  /** Calls storescu with the configured options. */
516
550
  private callStorescu;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { L as LineSource, P as ProcessLine, a as ResultValue, b as assertUnreach
3
3
  import { A as AETitle, D as DicomTag, a as DicomTagPath, P as Port, S as SOPClassUID, T as TransferSyntaxUID, b as DicomDataset } from './DicomInstance-BjrSIEGN.js';
4
4
  export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, W as WalkTagEntry, e as WalkTagsOptions, f as createAETitle, g as createDicomFilePath, h as createDicomTag, i as createDicomTagPath, j as createPort, k as createSOPClassUID, l as createTransferSyntaxUID, t as tag, w as walkTags } from './DicomInstance-BjrSIEGN.js';
5
5
  import { z } from 'zod';
6
- export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-DHsEm87K.js';
6
+ export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-C20fLU5U.js';
7
7
  export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, T as TagModification, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-CHvwChFu.js';
8
8
  export { DictionaryEntry, SOPClassName, SOP_CLASSES, TagSegment, VR, VRCategoryName, VRMetadata, VRValue, VR_CATEGORY, VR_CATEGORY_NAME, VR_META, getVRCategory, isBinaryVR, isNumericVR, isStringVR, lookupTag, lookupTagByKeyword, lookupTagByName, segmentsToModifyPath, segmentsToString, sopClassNameFromUID, tagPathToSegments } from './dicom.js';
9
9
  import { ProposedTransferSyntaxValue } from './tools.js';
@@ -277,6 +277,22 @@ interface DicomSenderOptions {
277
277
  readonly bucketFlushMs?: number | undefined;
278
278
  /** Maximum files per bucket before auto-flush (bucket mode only). Defaults to 50. */
279
279
  readonly maxBucketSize?: number | undefined;
280
+ /** Maximum PDU receive size (passed through to storescu `--max-pdu`). */
281
+ readonly maxPduReceive?: number | undefined;
282
+ /** Maximum PDU send size (passed through to storescu `--max-send-pdu`). */
283
+ readonly maxPduSend?: number | undefined;
284
+ /** Association timeout in seconds (passed through to storescu `-to`). */
285
+ readonly associationTimeout?: number | undefined;
286
+ /** ACSE timeout in seconds (passed through to storescu `-ta`). */
287
+ readonly acseTimeout?: number | undefined;
288
+ /** DIMSE timeout in seconds (passed through to storescu `-td`). */
289
+ readonly dimseTimeout?: number | undefined;
290
+ /** Disable DNS hostname lookup (passed through to storescu `-nh`). Useful in containerized environments. */
291
+ readonly noHostnameLookup?: boolean | undefined;
292
+ /** Disable UID validity checking (passed through to storescu `--no-uid-checks`). */
293
+ readonly noUidChecks?: boolean | undefined;
294
+ /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
295
+ readonly verbosity?: 'verbose' | 'debug' | undefined;
280
296
  /** AbortSignal for external cancellation. */
281
297
  readonly signal?: AbortSignal | undefined;
282
298
  }
@@ -286,6 +302,10 @@ interface SendOptions {
286
302
  readonly timeoutMs?: number | undefined;
287
303
  /** Override max retries for this send. */
288
304
  readonly maxRetries?: number | undefined;
305
+ /** Override called AE Title for this send. */
306
+ readonly calledAETitle?: string | undefined;
307
+ /** Override calling AE Title for this send. */
308
+ readonly callingAETitle?: string | undefined;
289
309
  }
290
310
  /** Result of a successful send operation. */
291
311
  interface SendResult {
@@ -295,6 +315,10 @@ interface SendResult {
295
315
  readonly fileCount: number;
296
316
  /** Total send duration in milliseconds. */
297
317
  readonly durationMs: number;
318
+ /** Raw stdout from storescu (available when verbosity is set). */
319
+ readonly stdout: string;
320
+ /** Raw stderr from storescu. */
321
+ readonly stderr: string;
298
322
  }
299
323
  /** Snapshot of the sender's current state. */
300
324
  interface SenderStatus {
@@ -321,6 +345,10 @@ interface SenderSendCompleteData {
321
345
  readonly fileCount: number;
322
346
  /** Total send duration in milliseconds. */
323
347
  readonly durationMs: number;
348
+ /** Raw stdout from storescu. */
349
+ readonly stdout: string;
350
+ /** Raw stderr from storescu. */
351
+ readonly stderr: string;
324
352
  }
325
353
  /** Data emitted with SEND_FAILED events. */
326
354
  interface SenderSendFailedData {
@@ -330,6 +358,10 @@ interface SenderSendFailedData {
330
358
  readonly error: Error;
331
359
  /** Number of attempts made. */
332
360
  readonly attempts: number;
361
+ /** Raw stdout from the last storescu attempt. */
362
+ readonly stdout: string;
363
+ /** Raw stderr from the last storescu attempt. */
364
+ readonly stderr: string;
333
365
  }
334
366
  /** Data emitted with HEALTH_CHANGED events. */
335
367
  interface SenderHealthChangedData {
@@ -446,6 +478,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
446
478
  * @returns A Result containing the send result or an error
447
479
  */
448
480
  send(files: readonly string[], options?: SendOptions): Promise<Result<SendResult>>;
481
+ /** Dispatches a send to the appropriate mode handler. */
482
+ private dispatchSend;
449
483
  /**
450
484
  * Flushes the current bucket immediately (bucket mode only).
451
485
  * In single/multiple mode this is a no-op.
@@ -510,7 +544,7 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
510
544
  private clearBucketTimer;
511
545
  /** Executes a single queue entry: calls storescu with retry. */
512
546
  private executeEntry;
513
- /** Attempts storescu up to maxAttempts times. Returns undefined on success, or the last error. */
547
+ /** Attempts storescu up to maxAttempts times. Returns undefined on success, or failure info. */
514
548
  private attemptSend;
515
549
  /** Calls storescu with the configured options. */
516
550
  private callStorescu;
package/dist/index.js CHANGED
@@ -33317,7 +33317,7 @@ async function storescu(options) {
33317
33317
  if (result.value.exitCode !== 0) {
33318
33318
  return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
33319
33319
  }
33320
- return ok({ success: true, stderr: result.value.stderr });
33320
+ return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
33321
33321
  }
33322
33322
  var QueryModel = {
33323
33323
  WORKLIST: "worklist",
@@ -36172,6 +36172,9 @@ var DicomReceiverOptionsSchema = z.object({
36172
36172
  acseTimeout: z.number().int().positive().optional(),
36173
36173
  dimseTimeout: z.number().int().positive().optional(),
36174
36174
  maxPdu: z.number().int().min(4096).max(131072).optional(),
36175
+ filenameMode: z.enum(["default", "unique", "short-unique", "system-time"]).optional(),
36176
+ filenameExtension: z.string().min(1).optional(),
36177
+ storageMode: z.enum(["normal", "bit-preserving", "ignore"]).optional(),
36175
36178
  signal: z.instanceof(AbortSignal).optional()
36176
36179
  }).strict().refine((data) => (data.minPoolSize ?? DEFAULT_MIN_POOL_SIZE) <= (data.maxPoolSize ?? DEFAULT_MAX_POOL_SIZE), {
36177
36180
  message: "minPoolSize must be <= maxPoolSize"
@@ -36493,7 +36496,10 @@ var DicomReceiver = class _DicomReceiver extends EventEmitter {
36493
36496
  configProfile: this.options.configProfile,
36494
36497
  acseTimeout: this.options.acseTimeout,
36495
36498
  dimseTimeout: this.options.dimseTimeout,
36496
- maxPdu: this.options.maxPdu
36499
+ maxPdu: this.options.maxPdu,
36500
+ filenameMode: this.options.filenameMode,
36501
+ filenameExtension: this.options.filenameExtension,
36502
+ storageMode: this.options.storageMode
36497
36503
  });
36498
36504
  }
36499
36505
  /** Spawns a single Dcmrecv worker with an ephemeral port. */
@@ -36855,6 +36861,14 @@ var DicomSenderOptionsSchema = z.object({
36855
36861
  retryDelayMs: z.number().int().min(0).optional(),
36856
36862
  bucketFlushMs: z.number().int().positive().optional(),
36857
36863
  maxBucketSize: z.number().int().min(1).optional(),
36864
+ maxPduReceive: z.number().int().min(4096).max(131072).optional(),
36865
+ maxPduSend: z.number().int().min(4096).max(131072).optional(),
36866
+ associationTimeout: z.number().int().positive().optional(),
36867
+ acseTimeout: z.number().int().positive().optional(),
36868
+ dimseTimeout: z.number().int().positive().optional(),
36869
+ noHostnameLookup: z.boolean().optional(),
36870
+ noUidChecks: z.boolean().optional(),
36871
+ verbosity: z.enum(["verbose", "debug"]).optional(),
36858
36872
  signal: z.instanceof(AbortSignal).optional()
36859
36873
  }).strict();
36860
36874
  function resolveConfig(options) {
@@ -36953,14 +36967,22 @@ var DicomSender = class _DicomSender extends EventEmitter {
36953
36967
  if (files.length === 0) {
36954
36968
  return Promise.resolve(err(new Error("DicomSender: no files provided")));
36955
36969
  }
36956
- const timeoutMs = options?.timeoutMs ?? this.defaultTimeoutMs;
36957
- const maxRetries = options?.maxRetries ?? this.defaultMaxRetries;
36970
+ const params = {
36971
+ timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
36972
+ maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
36973
+ calledAETitle: options?.calledAETitle,
36974
+ callingAETitle: options?.callingAETitle
36975
+ };
36976
+ return this.dispatchSend(files, params);
36977
+ }
36978
+ /** Dispatches a send to the appropriate mode handler. */
36979
+ dispatchSend(files, params) {
36958
36980
  switch (this.mode) {
36959
36981
  case "single":
36960
36982
  case "multiple":
36961
- return this.enqueueSend(files, timeoutMs, maxRetries);
36983
+ return this.enqueueSend(files, params);
36962
36984
  case "bucket":
36963
- return this.enqueueBucket(files, timeoutMs, maxRetries);
36985
+ return this.enqueueBucket(files, params);
36964
36986
  default:
36965
36987
  assertUnreachable(this.mode);
36966
36988
  }
@@ -37055,14 +37077,21 @@ var DicomSender = class _DicomSender extends EventEmitter {
37055
37077
  // Single/Multiple mode: queue-based dispatch
37056
37078
  // -----------------------------------------------------------------------
37057
37079
  /** Enqueues a send and dispatches immediately if capacity allows. */
37058
- enqueueSend(files, timeoutMs, maxRetries) {
37080
+ enqueueSend(files, params) {
37059
37081
  return new Promise((resolve) => {
37060
37082
  const totalQueued = this.queue.length + this.currentBucket.length;
37061
37083
  if (totalQueued >= this.maxQueueLength) {
37062
37084
  resolve(err(new Error("DicomSender: queue full")));
37063
37085
  return;
37064
37086
  }
37065
- const entry = { files, timeoutMs, maxRetries, resolve };
37087
+ const entry = {
37088
+ files,
37089
+ timeoutMs: params.timeoutMs,
37090
+ maxRetries: params.maxRetries,
37091
+ calledAETitle: params.calledAETitle,
37092
+ callingAETitle: params.callingAETitle,
37093
+ resolve
37094
+ };
37066
37095
  if (this.activeAssociations < this.effectiveMaxAssociations) {
37067
37096
  void this.executeEntry(entry);
37068
37097
  } else {
@@ -37082,14 +37111,15 @@ var DicomSender = class _DicomSender extends EventEmitter {
37082
37111
  // Bucket mode: accumulate-then-flush
37083
37112
  // -----------------------------------------------------------------------
37084
37113
  /** Adds files to the current bucket and triggers flush if full. */
37085
- enqueueBucket(files, timeoutMs, maxRetries) {
37114
+ enqueueBucket(files, params) {
37086
37115
  return new Promise((resolve) => {
37087
37116
  const totalQueued = this.queue.length + this.currentBucket.length;
37088
37117
  if (totalQueued >= this.maxQueueLength) {
37089
37118
  resolve(err(new Error("DicomSender: queue full")));
37090
37119
  return;
37091
37120
  }
37092
- this.currentBucket.push({ files, resolve, timeoutMs, maxRetries });
37121
+ const { timeoutMs, maxRetries, calledAETitle, callingAETitle } = params;
37122
+ this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle });
37093
37123
  const totalFiles = this.countBucketFiles();
37094
37124
  if (totalFiles >= this.maxBucketSize) {
37095
37125
  this.clearBucketTimer();
@@ -37129,6 +37159,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
37129
37159
  files: allFiles,
37130
37160
  timeoutMs,
37131
37161
  maxRetries,
37162
+ calledAETitle: entries[0]?.calledAETitle,
37163
+ callingAETitle: entries[0]?.callingAETitle,
37132
37164
  resolve: (result) => {
37133
37165
  for (let i = 0; i < entries.length; i++) {
37134
37166
  entries[i].resolve(result);
@@ -37164,17 +37196,24 @@ var DicomSender = class _DicomSender extends EventEmitter {
37164
37196
  this.activeAssociations++;
37165
37197
  const startMs = Date.now();
37166
37198
  const maxAttempts = entry.maxRetries + 1;
37167
- const lastError = await this.attemptSend(entry, maxAttempts, startMs);
37168
- if (lastError === void 0) return;
37199
+ const failure = await this.attemptSend(entry, maxAttempts, startMs);
37200
+ if (failure === void 0) return;
37169
37201
  this.activeAssociations--;
37170
37202
  this.recordFailure();
37171
- this.emit("SEND_FAILED", { files: entry.files, error: lastError, attempts: maxAttempts });
37172
- entry.resolve(err(lastError));
37203
+ this.emit("SEND_FAILED", {
37204
+ files: entry.files,
37205
+ error: failure.error,
37206
+ attempts: maxAttempts,
37207
+ stdout: failure.output.stdout,
37208
+ stderr: failure.output.stderr
37209
+ });
37210
+ entry.resolve(err(failure.error));
37173
37211
  this.drainQueue();
37174
37212
  }
37175
- /** Attempts storescu up to maxAttempts times. Returns undefined on success, or the last error. */
37213
+ /** Attempts storescu up to maxAttempts times. Returns undefined on success, or failure info. */
37176
37214
  async attemptSend(entry, maxAttempts, startMs) {
37177
37215
  let lastError;
37216
+ const lastOutput = { stdout: "", stderr: "" };
37178
37217
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
37179
37218
  if (this.isStopped) {
37180
37219
  this.activeAssociations--;
@@ -37183,7 +37222,7 @@ var DicomSender = class _DicomSender extends EventEmitter {
37183
37222
  }
37184
37223
  const result = await this.callStorescu(entry);
37185
37224
  if (result.ok) {
37186
- this.handleSendSuccess(entry, startMs);
37225
+ this.handleSendSuccess(entry, startMs, result.value);
37187
37226
  return void 0;
37188
37227
  }
37189
37228
  lastError = result.error;
@@ -37191,7 +37230,7 @@ var DicomSender = class _DicomSender extends EventEmitter {
37191
37230
  await delay2(this.retryDelayMs * (attempt + 1));
37192
37231
  }
37193
37232
  }
37194
- return lastError ?? new Error("DicomSender: send failed");
37233
+ return { error: lastError ?? new Error("DicomSender: send failed"), output: lastOutput };
37195
37234
  }
37196
37235
  /** Calls storescu with the configured options. */
37197
37236
  callStorescu(entry) {
@@ -37199,20 +37238,29 @@ var DicomSender = class _DicomSender extends EventEmitter {
37199
37238
  host: this.options.host,
37200
37239
  port: this.options.port,
37201
37240
  files: [...entry.files],
37202
- calledAETitle: this.options.calledAETitle,
37203
- callingAETitle: this.options.callingAETitle,
37241
+ calledAETitle: entry.calledAETitle ?? this.options.calledAETitle,
37242
+ callingAETitle: entry.callingAETitle ?? this.options.callingAETitle,
37204
37243
  proposedTransferSyntax: this.options.proposedTransferSyntax,
37244
+ maxPduReceive: this.options.maxPduReceive,
37245
+ maxPduSend: this.options.maxPduSend,
37246
+ associationTimeout: this.options.associationTimeout,
37247
+ acseTimeout: this.options.acseTimeout,
37248
+ dimseTimeout: this.options.dimseTimeout,
37249
+ noHostnameLookup: this.options.noHostnameLookup,
37250
+ noUidChecks: this.options.noUidChecks,
37251
+ verbosity: this.options.verbosity,
37205
37252
  timeoutMs: entry.timeoutMs,
37206
37253
  signal: this.options.signal
37207
37254
  });
37208
37255
  }
37209
37256
  /** Handles a successful send: updates state, emits event, resolves promise. */
37210
- handleSendSuccess(entry, startMs) {
37257
+ handleSendSuccess(entry, startMs, output) {
37211
37258
  this.activeAssociations--;
37212
37259
  const durationMs = Date.now() - startMs;
37213
37260
  this.recordSuccess();
37214
- this.emit("SEND_COMPLETE", { files: entry.files, fileCount: entry.files.length, durationMs });
37215
- entry.resolve(ok({ files: entry.files, fileCount: entry.files.length, durationMs }));
37261
+ const data = { files: entry.files, fileCount: entry.files.length, durationMs, stdout: output.stdout, stderr: output.stderr };
37262
+ this.emit("SEND_COMPLETE", data);
37263
+ entry.resolve(ok(data));
37216
37264
  this.drainQueue();
37217
37265
  }
37218
37266
  // -----------------------------------------------------------------------