@ubercode/dcmtk 0.2.0 → 0.3.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/README.md +13 -11
- package/dist/{DicomInstance-CQEIuF_x.d.ts → DicomInstance-D9plqHp5.d.ts} +1 -1
- package/dist/{DicomInstance-By9zd7GM.d.cts → DicomInstance-DNHPkkzl.d.cts} +1 -1
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.d.cts +2 -2
- package/dist/dicom.d.ts +2 -2
- package/dist/dicom.js.map +1 -1
- package/dist/index.cjs +533 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +319 -6
- package/dist/index.d.ts +319 -6
- package/dist/index.js +531 -5
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +1 -1
- 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 +1 -1
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +1 -1
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +1 -1
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { R as Result, E as ExecOptions, D as DcmtkProcessResult, S as SpawnOptions } from './types-Cgumy1N4.cjs';
|
|
2
2
|
export { L as LineSource, P as ProcessLine, a as ResultValue, b as assertUnreachable, e as err, m as mapResult, o as ok } from './types-Cgumy1N4.cjs';
|
|
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-
|
|
4
|
-
export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, e as createAETitle, f as createDicomFilePath, g as createDicomTag, h as createDicomTagPath, i as createPort, j as createSOPClassUID, k as createTransferSyntaxUID, t as tag } from './DicomInstance-
|
|
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-DNHPkkzl.cjs';
|
|
4
|
+
export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, e as createAETitle, f as createDicomFilePath, g as createDicomTag, h as createDicomTagPath, i as createPort, j as createSOPClassUID, k as createTransferSyntaxUID, t as tag } from './DicomInstance-DNHPkkzl.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
export { AssociationAcknowledgedData, AssociationCompleteData, AssociationContext, AssociationReceivedData, AssociationSummary, AssociationTracker, CStoreRequestData, CannotStartListenerData, ConfigErrorData, DCMPRSCP_FATAL_EVENTS, DCMPRSCP_PATTERNS, DCMPSRCV_FATAL_EVENTS, DCMPSRCV_PATTERNS, DCMQRSCP_FATAL_EVENTS, DCMQRSCP_PATTERNS, DCMRECV_FATAL_EVENTS, DCMRECV_PATTERNS, DatabaseReadyData, DcmQRSCP, DcmQRSCPEventMap, DcmQRSCPOptions, DcmprsCP, DcmprsCPEventMap, DcmprsCPOptions, DcmprscpEvent, DcmprscpEventValue, Dcmpsrcv, DcmpsrcvEvent, DcmpsrcvEventMap, DcmpsrcvEventValue, DcmpsrcvOptions, DcmqrscpEvent, DcmqrscpEventValue, Dcmrecv, DcmrecvEvent, DcmrecvEventMap, DcmrecvEventValue, DcmrecvOptions, DcmtkProcess, DcmtkProcessConfig, DcmtkProcessEventMap, DicomReceiver, DicomReceiverEventMap, DicomReceiverOptions, EventPattern, FileDeletedData, FileReceivedData, FilenameMode, FilenameModeValue, LineParser, LineParserEventMap, MultiLineConfig, PoolStatus, PreferredTransferSyntax, PreferredTransferSyntaxValue, PrintAssociationAcknowledgedData, PrintAssociationReceivedData, PrintCannotStartListenerData, ProcessState, ProcessStateValue, QRAssociationAcknowledgedData, QRAssociationReceivedData, QRCFindRequestData, QRCGetRequestData, QRCMoveRequestData, QRCStoreRequestData, QRCannotStartListenerData, QRListeningData, ReceiverAssociationAcknowledgedData, ReceiverAssociationData, ReceiverAssociationReceivedData, ReceiverCStoreRequestData, ReceiverCannotStartListenerData, ReceiverConfigErrorData, ReceiverDatabaseReadyData, ReceiverEchoRequestData, ReceiverErrorData, ReceiverFileData, ReceiverListeningData, RefusingAssociationData, STORESCP_FATAL_EVENTS, STORESCP_PATTERNS, StorageMode, StorageModeValue, StoreSCP, StoreSCPEventMap, StoreSCPOptions, StoreSCPPreset, StoreSCPPresetName, StoredFileData, StorescpEvent, StorescpEventValue, StoringFileData, SubdirectoryCreatedData, SubdirectoryMode, SubdirectoryModeValue, TrackedFile, WLMSCPFS_FATAL_EVENTS, WLMSCPFS_PATTERNS, WlmAssociationAcknowledgedData, WlmAssociationReceivedData, WlmCFindRequestData, WlmCannotStartListenerData, WlmListeningData, Wlmscpfs, WlmscpfsEvent, WlmscpfsEventMap, WlmscpfsEventValue, WlmscpfsOptions } from './servers.cjs';
|
|
7
7
|
export { a as DcmodifyOptions, b as DcmodifyResult, D as DicomJsonElement, c as DicomJsonModel, T as TagModification, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-Gds9u5Vj.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';
|
|
10
|
+
export { Cda2dcmOptions, Cda2dcmResult, ColorConversion, ColorConversionValue, Dcm2cdaOptions, Dcm2cdaResult, Dcm2jsonOptions, Dcm2jsonResult, Dcm2jsonSource, Dcm2pdfOptions, Dcm2pdfResult, Dcm2pnmOptions, Dcm2pnmOutputFormat, Dcm2pnmOutputFormatValue, Dcm2pnmResult, Dcm2xmlCharset, Dcm2xmlCharsetValue, Dcm2xmlOptions, Dcm2xmlResult, DcmcjpegOptions, DcmcjpegResult, DcmcjplsOptions, DcmcjplsResult, DcmconvOptions, DcmconvResult, DcmcrleOptions, DcmcrleResult, DcmdecapOptions, DcmdecapResult, DcmdjpegOptions, DcmdjpegResult, DcmdjplsOptions, DcmdjplsResult, DcmdrleOptions, DcmdrleResult, DcmdspfnOptions, DcmdspfnResult, DcmdumpFormat, DcmdumpFormatValue, DcmdumpOptions, DcmdumpResult, DcmencapOptions, DcmencapResult, DcmftestOptions, DcmftestResult, DcmgpdirOptions, DcmgpdirResult, Dcmj2pnmOptions, Dcmj2pnmOutputFormat, Dcmj2pnmOutputFormatValue, Dcmj2pnmResult, DcmmkcrvOptions, DcmmkcrvResult, DcmmkdirOptions, DcmmkdirResult, DcmmklutOptions, DcmmklutResult, Dcmp2pgmOptions, Dcmp2pgmResult, DcmprscuOptions, DcmprscuResult, DcmpschkOptions, DcmpschkResult, DcmpsmkOptions, DcmpsmkResult, DcmpsprtOptions, DcmpsprtResult, DcmqridxOptions, DcmqridxResult, DcmquantOptions, DcmquantResult, DcmscaleOptions, DcmscaleResult, DcmsendOptions, DcmsendResult, Dcod2lumOptions, Dcod2lumResult, DconvlumOptions, DconvlumResult, DrtdumpOptions, DrtdumpResult, Dsr2xmlOptions, Dsr2xmlResult, DsrdumpOptions, DsrdumpResult, Dump2dcmOptions, Dump2dcmResult, EchoscuOptions, EchoscuResult, FindscuOptions, FindscuResult, GetQueryModel, GetQueryModelValue, GetscuOptions, GetscuResult, Img2dcmInputFormat, Img2dcmInputFormatValue, Img2dcmOptions, Img2dcmResult, JplsColorConversion, JplsColorConversionValue, Json2dcmOptions, Json2dcmResult, LutType, LutTypeValue, MoveQueryModel, MoveQueryModelValue, MovescuOptions, MovescuResult, Pdf2dcmOptions, Pdf2dcmResult, ProposedTransferSyntax, QueryModel, QueryModelValue, Stl2dcmOptions, Stl2dcmResult, StorescuOptions, StorescuResult, TermscuOptions, TermscuResult, TransferSyntax, TransferSyntaxValue, Xml2dcmOptions, Xml2dcmResult, Xml2dsrOptions, Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr } from './tools.cjs';
|
|
11
|
+
import { EventEmitter } from 'node:events';
|
|
10
12
|
export { BatchOptions, BatchResult, RetryOptions, batch, retry } from './utils.cjs';
|
|
11
|
-
import 'node:events';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Runtime validation schemas and parse functions.
|
|
@@ -20,7 +21,7 @@ import 'node:events';
|
|
|
20
21
|
* @module validation
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
|
-
/** Schema for DICOM AE Titles: 1-16 chars,
|
|
24
|
+
/** Schema for DICOM AE Titles: 1-16 printable ASCII chars, no backslash. */
|
|
24
25
|
declare const AETitleSchema: z.ZodString;
|
|
25
26
|
/** Schema for network port numbers: integer 1-65535. */
|
|
26
27
|
declare const PortSchema: z.ZodNumber;
|
|
@@ -218,6 +219,318 @@ declare function execCommand(binary: string, args: readonly string[], options?:
|
|
|
218
219
|
*/
|
|
219
220
|
declare function spawnCommand(binary: string, args: readonly string[], options?: SpawnOptions): Promise<Result<DcmtkProcessResult>>;
|
|
220
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Type definitions for the DicomSender module.
|
|
224
|
+
*
|
|
225
|
+
* Follows the project conventions: `as const` objects with union types
|
|
226
|
+
* (no traditional enums), readonly interfaces, and Result pattern.
|
|
227
|
+
*
|
|
228
|
+
* @module senders/types
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
/** Sending mode for the DicomSender. */
|
|
232
|
+
declare const SenderMode: {
|
|
233
|
+
/** One association at a time, queued FIFO. */
|
|
234
|
+
readonly SINGLE: "single";
|
|
235
|
+
/** Up to N concurrent associations, each send() gets its own. */
|
|
236
|
+
readonly MULTIPLE: "multiple";
|
|
237
|
+
/** Files accumulated into buckets, each bucket = one association. */
|
|
238
|
+
readonly BUCKET: "bucket";
|
|
239
|
+
};
|
|
240
|
+
type SenderModeValue = (typeof SenderMode)[keyof typeof SenderMode];
|
|
241
|
+
/** Health state of the sender's backpressure algorithm. */
|
|
242
|
+
declare const SenderHealth: {
|
|
243
|
+
/** All associations succeeding normally. */
|
|
244
|
+
readonly HEALTHY: "healthy";
|
|
245
|
+
/** Recent failures detected; effective concurrency reduced. */
|
|
246
|
+
readonly DEGRADED: "degraded";
|
|
247
|
+
/** Remote endpoint appears down; minimal concurrency. */
|
|
248
|
+
readonly DOWN: "down";
|
|
249
|
+
};
|
|
250
|
+
type SenderHealthValue = (typeof SenderHealth)[keyof typeof SenderHealth];
|
|
251
|
+
/** Options for creating a DicomSender instance. */
|
|
252
|
+
interface DicomSenderOptions {
|
|
253
|
+
/** Remote host or IP address (required). */
|
|
254
|
+
readonly host: string;
|
|
255
|
+
/** Remote port number, 1-65535 (required). */
|
|
256
|
+
readonly port: number;
|
|
257
|
+
/** Called AE Title of the remote SCP (max 16 chars). */
|
|
258
|
+
readonly calledAETitle?: string | undefined;
|
|
259
|
+
/** Calling AE Title of the local SCU (max 16 chars). */
|
|
260
|
+
readonly callingAETitle?: string | undefined;
|
|
261
|
+
/** Sending mode. Defaults to 'multiple'. */
|
|
262
|
+
readonly mode?: SenderModeValue | undefined;
|
|
263
|
+
/** Maximum concurrent storescu associations. Defaults to 4 (forced to 1 in single mode). */
|
|
264
|
+
readonly maxAssociations?: number | undefined;
|
|
265
|
+
/** Proposed transfer syntax for associations. */
|
|
266
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
|
|
267
|
+
/** Maximum queued send requests before rejecting. Defaults to 1000. */
|
|
268
|
+
readonly maxQueueLength?: number | undefined;
|
|
269
|
+
/** Per-storescu timeout in milliseconds. Defaults to 30000. */
|
|
270
|
+
readonly timeoutMs?: number | undefined;
|
|
271
|
+
/** Maximum retry attempts per send (0 = no retry). Defaults to 3. */
|
|
272
|
+
readonly maxRetries?: number | undefined;
|
|
273
|
+
/** Base retry delay in milliseconds. Defaults to 1000. */
|
|
274
|
+
readonly retryDelayMs?: number | undefined;
|
|
275
|
+
/** Bucket flush timeout in milliseconds (bucket mode only). Defaults to 5000. */
|
|
276
|
+
readonly bucketFlushMs?: number | undefined;
|
|
277
|
+
/** Maximum files per bucket before auto-flush (bucket mode only). Defaults to 50. */
|
|
278
|
+
readonly maxBucketSize?: number | undefined;
|
|
279
|
+
/** AbortSignal for external cancellation. */
|
|
280
|
+
readonly signal?: AbortSignal | undefined;
|
|
281
|
+
}
|
|
282
|
+
/** Per-send options that can override instance defaults. */
|
|
283
|
+
interface SendOptions {
|
|
284
|
+
/** Override per-storescu timeout for this send. */
|
|
285
|
+
readonly timeoutMs?: number | undefined;
|
|
286
|
+
/** Override max retries for this send. */
|
|
287
|
+
readonly maxRetries?: number | undefined;
|
|
288
|
+
}
|
|
289
|
+
/** Result of a successful send operation. */
|
|
290
|
+
interface SendResult {
|
|
291
|
+
/** Files that were sent. */
|
|
292
|
+
readonly files: readonly string[];
|
|
293
|
+
/** Number of files sent. */
|
|
294
|
+
readonly fileCount: number;
|
|
295
|
+
/** Total send duration in milliseconds. */
|
|
296
|
+
readonly durationMs: number;
|
|
297
|
+
}
|
|
298
|
+
/** Snapshot of the sender's current state. */
|
|
299
|
+
interface SenderStatus {
|
|
300
|
+
/** Current health state. */
|
|
301
|
+
readonly health: SenderHealthValue;
|
|
302
|
+
/** Number of active storescu associations. */
|
|
303
|
+
readonly activeAssociations: number;
|
|
304
|
+
/** Current effective max associations (adjusted by backpressure). */
|
|
305
|
+
readonly effectiveMaxAssociations: number;
|
|
306
|
+
/** Number of queued send requests. */
|
|
307
|
+
readonly queueLength: number;
|
|
308
|
+
/** Total consecutive failures. */
|
|
309
|
+
readonly consecutiveFailures: number;
|
|
310
|
+
/** Total consecutive successes. */
|
|
311
|
+
readonly consecutiveSuccesses: number;
|
|
312
|
+
/** Whether the sender is stopped. */
|
|
313
|
+
readonly stopped: boolean;
|
|
314
|
+
}
|
|
315
|
+
/** Data emitted with SEND_COMPLETE events. */
|
|
316
|
+
interface SenderSendCompleteData {
|
|
317
|
+
/** Files that were sent. */
|
|
318
|
+
readonly files: readonly string[];
|
|
319
|
+
/** Number of files sent. */
|
|
320
|
+
readonly fileCount: number;
|
|
321
|
+
/** Total send duration in milliseconds. */
|
|
322
|
+
readonly durationMs: number;
|
|
323
|
+
}
|
|
324
|
+
/** Data emitted with SEND_FAILED events. */
|
|
325
|
+
interface SenderSendFailedData {
|
|
326
|
+
/** Files that failed to send. */
|
|
327
|
+
readonly files: readonly string[];
|
|
328
|
+
/** The error that caused the failure. */
|
|
329
|
+
readonly error: Error;
|
|
330
|
+
/** Number of attempts made. */
|
|
331
|
+
readonly attempts: number;
|
|
332
|
+
}
|
|
333
|
+
/** Data emitted with HEALTH_CHANGED events. */
|
|
334
|
+
interface SenderHealthChangedData {
|
|
335
|
+
/** Previous health state. */
|
|
336
|
+
readonly previousHealth: SenderHealthValue;
|
|
337
|
+
/** New health state. */
|
|
338
|
+
readonly newHealth: SenderHealthValue;
|
|
339
|
+
/** Current effective max associations. */
|
|
340
|
+
readonly effectiveMaxAssociations: number;
|
|
341
|
+
/** Current consecutive failures count. */
|
|
342
|
+
readonly consecutiveFailures: number;
|
|
343
|
+
}
|
|
344
|
+
/** Data emitted with BUCKET_FLUSHED events. */
|
|
345
|
+
interface SenderBucketFlushedData {
|
|
346
|
+
/** Number of files in the flushed bucket. */
|
|
347
|
+
readonly fileCount: number;
|
|
348
|
+
/** Reason for the flush. */
|
|
349
|
+
readonly reason: 'timer' | 'maxSize';
|
|
350
|
+
}
|
|
351
|
+
/** Data emitted with error events. */
|
|
352
|
+
interface SenderErrorData {
|
|
353
|
+
/** The error that occurred. */
|
|
354
|
+
readonly error: Error;
|
|
355
|
+
/** Files involved, if applicable. */
|
|
356
|
+
readonly files?: readonly string[] | undefined;
|
|
357
|
+
}
|
|
358
|
+
/** Typed event map for DicomSender. */
|
|
359
|
+
interface DicomSenderEventMap {
|
|
360
|
+
SEND_COMPLETE: [SenderSendCompleteData];
|
|
361
|
+
SEND_FAILED: [SenderSendFailedData];
|
|
362
|
+
HEALTH_CHANGED: [SenderHealthChangedData];
|
|
363
|
+
BUCKET_FLUSHED: [SenderBucketFlushedData];
|
|
364
|
+
error: [SenderErrorData];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* High-throughput DICOM sender with queuing, bucketing, and backpressure.
|
|
369
|
+
*
|
|
370
|
+
* Manages concurrent `storescu` calls with three sending modes
|
|
371
|
+
* (single, multiple, bucket), automatic retry, and adaptive
|
|
372
|
+
* backpressure to handle struggling remote endpoints.
|
|
373
|
+
*
|
|
374
|
+
* @module senders/DicomSender
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* High-throughput DICOM sender with queuing, bucketing, and backpressure.
|
|
379
|
+
*
|
|
380
|
+
* Manages concurrent `storescu` calls with three sending modes:
|
|
381
|
+
* - **single**: One association at a time (FIFO queue).
|
|
382
|
+
* - **multiple**: Up to N concurrent associations.
|
|
383
|
+
* - **bucket**: Accumulates files into buckets, each flushed as one association.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* const result = DicomSender.create({
|
|
388
|
+
* host: '192.168.1.100',
|
|
389
|
+
* port: 104,
|
|
390
|
+
* calledAETitle: 'PACS',
|
|
391
|
+
* mode: 'multiple',
|
|
392
|
+
* maxAssociations: 8,
|
|
393
|
+
* });
|
|
394
|
+
* if (!result.ok) { console.error(result.error.message); return; }
|
|
395
|
+
* const sender = result.value;
|
|
396
|
+
*
|
|
397
|
+
* sender.onSendComplete(data => console.log('Sent:', data.fileCount, 'files'));
|
|
398
|
+
* sender.onSendFailed(data => console.error('Failed:', data.error.message));
|
|
399
|
+
*
|
|
400
|
+
* await sender.send(['/path/to/file1.dcm', '/path/to/file2.dcm']);
|
|
401
|
+
* await sender.stop();
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
|
|
405
|
+
private readonly options;
|
|
406
|
+
private readonly mode;
|
|
407
|
+
private readonly configuredMaxAssociations;
|
|
408
|
+
private readonly maxQueueLength;
|
|
409
|
+
private readonly defaultTimeoutMs;
|
|
410
|
+
private readonly defaultMaxRetries;
|
|
411
|
+
private readonly retryDelayMs;
|
|
412
|
+
private readonly bucketFlushMs;
|
|
413
|
+
private readonly maxBucketSize;
|
|
414
|
+
private readonly queue;
|
|
415
|
+
private activeAssociations;
|
|
416
|
+
private isStopped;
|
|
417
|
+
private health;
|
|
418
|
+
private effectiveMaxAssociations;
|
|
419
|
+
private consecutiveFailures;
|
|
420
|
+
private consecutiveSuccesses;
|
|
421
|
+
private currentBucket;
|
|
422
|
+
private bucketTimer;
|
|
423
|
+
private abortHandler;
|
|
424
|
+
private constructor();
|
|
425
|
+
/**
|
|
426
|
+
* Creates a new DicomSender instance.
|
|
427
|
+
*
|
|
428
|
+
* @param options - Configuration options
|
|
429
|
+
* @returns A Result containing the instance or a validation error
|
|
430
|
+
*/
|
|
431
|
+
static create(options: DicomSenderOptions): Result<DicomSender>;
|
|
432
|
+
/**
|
|
433
|
+
* Sends one or more DICOM files to the remote endpoint.
|
|
434
|
+
*
|
|
435
|
+
* In single/multiple mode, files are sent as one storescu call.
|
|
436
|
+
* In bucket mode, files are accumulated into a bucket and flushed
|
|
437
|
+
* when the bucket reaches maxBucketSize or the flush timer fires.
|
|
438
|
+
*
|
|
439
|
+
* The returned promise resolves when the files are actually sent
|
|
440
|
+
* (not just queued). Callers can await for confirmation or
|
|
441
|
+
* fire-and-forget with `void sender.send(files)`.
|
|
442
|
+
*
|
|
443
|
+
* @param files - One or more DICOM file paths
|
|
444
|
+
* @param options - Per-send overrides
|
|
445
|
+
* @returns A Result containing the send result or an error
|
|
446
|
+
*/
|
|
447
|
+
send(files: readonly string[], options?: SendOptions): Promise<Result<SendResult>>;
|
|
448
|
+
/**
|
|
449
|
+
* Flushes the current bucket immediately (bucket mode only).
|
|
450
|
+
* In single/multiple mode this is a no-op.
|
|
451
|
+
*/
|
|
452
|
+
flush(): void;
|
|
453
|
+
/**
|
|
454
|
+
* Gracefully stops the sender. Rejects all queued items and
|
|
455
|
+
* waits for active associations to complete.
|
|
456
|
+
*/
|
|
457
|
+
stop(): Promise<void>;
|
|
458
|
+
/** Current sender status. */
|
|
459
|
+
get status(): SenderStatus;
|
|
460
|
+
/**
|
|
461
|
+
* Registers a typed listener for a DicomSender-specific event.
|
|
462
|
+
*
|
|
463
|
+
* @param event - The event name from DicomSenderEventMap
|
|
464
|
+
* @param listener - Callback receiving typed event data
|
|
465
|
+
* @returns this for chaining
|
|
466
|
+
*/
|
|
467
|
+
onEvent<K extends keyof DicomSenderEventMap>(event: K, listener: (...args: DicomSenderEventMap[K]) => void): this;
|
|
468
|
+
/**
|
|
469
|
+
* Registers a listener for successful sends.
|
|
470
|
+
*
|
|
471
|
+
* @param listener - Callback receiving send complete data
|
|
472
|
+
* @returns this for chaining
|
|
473
|
+
*/
|
|
474
|
+
onSendComplete(listener: (data: SenderSendCompleteData) => void): this;
|
|
475
|
+
/**
|
|
476
|
+
* Registers a listener for failed sends.
|
|
477
|
+
*
|
|
478
|
+
* @param listener - Callback receiving send failed data
|
|
479
|
+
* @returns this for chaining
|
|
480
|
+
*/
|
|
481
|
+
onSendFailed(listener: (data: SenderSendFailedData) => void): this;
|
|
482
|
+
/**
|
|
483
|
+
* Registers a listener for health state changes.
|
|
484
|
+
*
|
|
485
|
+
* @param listener - Callback receiving health change data
|
|
486
|
+
* @returns this for chaining
|
|
487
|
+
*/
|
|
488
|
+
onHealthChanged(listener: (data: SenderHealthChangedData) => void): this;
|
|
489
|
+
/**
|
|
490
|
+
* Registers a listener for bucket flushes (bucket mode only).
|
|
491
|
+
*
|
|
492
|
+
* @param listener - Callback receiving bucket flush data
|
|
493
|
+
* @returns this for chaining
|
|
494
|
+
*/
|
|
495
|
+
onBucketFlushed(listener: (data: SenderBucketFlushedData) => void): this;
|
|
496
|
+
/** Enqueues a send and dispatches immediately if capacity allows. */
|
|
497
|
+
private enqueueSend;
|
|
498
|
+
/** Drains queued entries up to available capacity. */
|
|
499
|
+
private drainQueue;
|
|
500
|
+
/** Adds files to the current bucket and triggers flush if full. */
|
|
501
|
+
private enqueueBucket;
|
|
502
|
+
/** Counts total files in the current bucket. */
|
|
503
|
+
private countBucketFiles;
|
|
504
|
+
/** Flushes the current bucket: combines all files, dispatches as one send. */
|
|
505
|
+
private flushBucketInternal;
|
|
506
|
+
/** Resets the bucket flush timer. */
|
|
507
|
+
private resetBucketTimer;
|
|
508
|
+
/** Clears the bucket flush timer. */
|
|
509
|
+
private clearBucketTimer;
|
|
510
|
+
/** Executes a single queue entry: calls storescu with retry. */
|
|
511
|
+
private executeEntry;
|
|
512
|
+
/** Attempts storescu up to maxAttempts times. Returns undefined on success, or the last error. */
|
|
513
|
+
private attemptSend;
|
|
514
|
+
/** Calls storescu with the configured options. */
|
|
515
|
+
private callStorescu;
|
|
516
|
+
/** Handles a successful send: updates state, emits event, resolves promise. */
|
|
517
|
+
private handleSendSuccess;
|
|
518
|
+
/** Records a successful send and adjusts health upward if needed. */
|
|
519
|
+
private recordSuccess;
|
|
520
|
+
/** Records a failed send and adjusts health downward if needed. */
|
|
521
|
+
private recordFailure;
|
|
522
|
+
/** Emits a HEALTH_CHANGED event. */
|
|
523
|
+
private emitHealthChanged;
|
|
524
|
+
/** Rejects all queued entries with the given message. */
|
|
525
|
+
private rejectQueue;
|
|
526
|
+
/** Rejects all bucket entries with the given message. */
|
|
527
|
+
private rejectBucket;
|
|
528
|
+
/** Waits for all active associations to complete. */
|
|
529
|
+
private waitForActive;
|
|
530
|
+
/** Wires an AbortSignal to stop the sender. */
|
|
531
|
+
private wireAbortSignal;
|
|
532
|
+
}
|
|
533
|
+
|
|
221
534
|
/**
|
|
222
535
|
* Type definitions for the high-level PACS client API.
|
|
223
536
|
*
|
|
@@ -513,4 +826,4 @@ declare class PacsClient {
|
|
|
513
826
|
private executeCMove;
|
|
514
827
|
}
|
|
515
828
|
|
|
516
|
-
export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, DcmtkProcessResult, DicomDataset, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SeriesFilter, SpawnOptions, type StudyFilter, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };
|
|
829
|
+
export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, DcmtkProcessResult, DicomDataset, DicomSender, type DicomSenderEventMap, type DicomSenderOptions, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, ProposedTransferSyntaxValue, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SendOptions, type SendResult, type SenderBucketFlushedData, type SenderErrorData, SenderHealth, type SenderHealthChangedData, type SenderHealthValue, SenderMode, type SenderModeValue, type SenderSendCompleteData, type SenderSendFailedData, type SenderStatus, type SeriesFilter, SpawnOptions, type StudyFilter, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };
|