@ubercode/dcmtk 0.7.0 → 0.7.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.cjs +29 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +29 -20
- package/dist/index.js.map +1 -1
- package/dist/tools.cjs +8 -4
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +2 -2
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +8 -4
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -289,10 +289,10 @@ interface DicomSenderOptions {
|
|
|
289
289
|
readonly dimseTimeout?: number | undefined;
|
|
290
290
|
/** Disable DNS hostname lookup (passed through to storescu `-nh`). Useful in containerized environments. */
|
|
291
291
|
readonly noHostnameLookup?: boolean | undefined;
|
|
292
|
-
/** Disable UID validity checking (passed through to storescu `--no-uid-checks`). */
|
|
293
|
-
readonly noUidChecks?: boolean | undefined;
|
|
294
292
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
295
293
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
294
|
+
/** Propose only each file's native transfer syntax (passed through to storescu `-R`). */
|
|
295
|
+
readonly required?: boolean | undefined;
|
|
296
296
|
/** AbortSignal for external cancellation. */
|
|
297
297
|
readonly signal?: AbortSignal | undefined;
|
|
298
298
|
}
|
|
@@ -306,6 +306,8 @@ interface SendOptions {
|
|
|
306
306
|
readonly calledAETitle?: string | undefined;
|
|
307
307
|
/** Override calling AE Title for this send. */
|
|
308
308
|
readonly callingAETitle?: string | undefined;
|
|
309
|
+
/** Override required flag for this send. */
|
|
310
|
+
readonly required?: boolean | undefined;
|
|
309
311
|
}
|
|
310
312
|
/** Result of a successful send operation. */
|
|
311
313
|
interface SendResult {
|
|
@@ -536,6 +538,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
|
|
|
536
538
|
private enqueueBucket;
|
|
537
539
|
/** Counts total files in the current bucket. */
|
|
538
540
|
private countBucketFiles;
|
|
541
|
+
/** Merges bucket entries into a single QueueEntry. */
|
|
542
|
+
private mergeBucketEntries;
|
|
539
543
|
/** Flushes the current bucket: combines all files, dispatches as one send. */
|
|
540
544
|
private flushBucketInternal;
|
|
541
545
|
/** Resets the bucket flush timer. */
|
package/dist/index.d.ts
CHANGED
|
@@ -289,10 +289,10 @@ interface DicomSenderOptions {
|
|
|
289
289
|
readonly dimseTimeout?: number | undefined;
|
|
290
290
|
/** Disable DNS hostname lookup (passed through to storescu `-nh`). Useful in containerized environments. */
|
|
291
291
|
readonly noHostnameLookup?: boolean | undefined;
|
|
292
|
-
/** Disable UID validity checking (passed through to storescu `--no-uid-checks`). */
|
|
293
|
-
readonly noUidChecks?: boolean | undefined;
|
|
294
292
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
295
293
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
294
|
+
/** Propose only each file's native transfer syntax (passed through to storescu `-R`). */
|
|
295
|
+
readonly required?: boolean | undefined;
|
|
296
296
|
/** AbortSignal for external cancellation. */
|
|
297
297
|
readonly signal?: AbortSignal | undefined;
|
|
298
298
|
}
|
|
@@ -306,6 +306,8 @@ interface SendOptions {
|
|
|
306
306
|
readonly calledAETitle?: string | undefined;
|
|
307
307
|
/** Override calling AE Title for this send. */
|
|
308
308
|
readonly callingAETitle?: string | undefined;
|
|
309
|
+
/** Override required flag for this send. */
|
|
310
|
+
readonly required?: boolean | undefined;
|
|
309
311
|
}
|
|
310
312
|
/** Result of a successful send operation. */
|
|
311
313
|
interface SendResult {
|
|
@@ -536,6 +538,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
|
|
|
536
538
|
private enqueueBucket;
|
|
537
539
|
/** Counts total files in the current bucket. */
|
|
538
540
|
private countBucketFiles;
|
|
541
|
+
/** Merges bucket entries into a single QueueEntry. */
|
|
542
|
+
private mergeBucketEntries;
|
|
539
543
|
/** Flushes the current bucket: combines all files, dispatches as one send. */
|
|
540
544
|
private flushBucketInternal;
|
|
541
545
|
/** Resets the bucket flush timer. */
|
package/dist/index.js
CHANGED
|
@@ -33232,7 +33232,7 @@ var StorescuOptionsSchema = z.object({
|
|
|
33232
33232
|
acseTimeout: z.number().int().positive().optional(),
|
|
33233
33233
|
dimseTimeout: z.number().int().positive().optional(),
|
|
33234
33234
|
noHostnameLookup: z.boolean().optional(),
|
|
33235
|
-
|
|
33235
|
+
required: z.boolean().optional(),
|
|
33236
33236
|
proposedTransferSyntax: z.enum([
|
|
33237
33237
|
"uncompressed",
|
|
33238
33238
|
"littleEndian",
|
|
@@ -33248,6 +33248,7 @@ var StorescuOptionsSchema = z.object({
|
|
|
33248
33248
|
]).optional()
|
|
33249
33249
|
}).strict();
|
|
33250
33250
|
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
33251
|
+
var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
|
|
33251
33252
|
function pushNetworkArgs3(args, options) {
|
|
33252
33253
|
if (options.verbosity !== void 0) {
|
|
33253
33254
|
args.push(VERBOSITY_FLAGS20[options.verbosity]);
|
|
@@ -33274,9 +33275,6 @@ function pushNetworkArgs3(args, options) {
|
|
|
33274
33275
|
function buildArgs34(options) {
|
|
33275
33276
|
const args = [];
|
|
33276
33277
|
pushNetworkArgs3(args, options);
|
|
33277
|
-
if (options.noUidChecks === true) {
|
|
33278
|
-
args.push("--no-uid-checks");
|
|
33279
|
-
}
|
|
33280
33278
|
if (options.callingAETitle !== void 0) {
|
|
33281
33279
|
args.push("-aet", options.callingAETitle);
|
|
33282
33280
|
}
|
|
@@ -33292,6 +33290,9 @@ function buildArgs34(options) {
|
|
|
33292
33290
|
if (options.proposedTransferSyntax !== void 0) {
|
|
33293
33291
|
args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
|
|
33294
33292
|
}
|
|
33293
|
+
if (options.required === true) {
|
|
33294
|
+
args.push("-R");
|
|
33295
|
+
}
|
|
33295
33296
|
args.push(options.host, String(options.port));
|
|
33296
33297
|
args.push(...options.files);
|
|
33297
33298
|
return args;
|
|
@@ -33317,6 +33318,9 @@ async function storescu(options) {
|
|
|
33317
33318
|
if (result.value.exitCode !== 0) {
|
|
33318
33319
|
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
|
|
33319
33320
|
}
|
|
33321
|
+
if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
|
|
33322
|
+
return err(createToolError("storescu", args, 0, result.value.stderr));
|
|
33323
|
+
}
|
|
33320
33324
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
33321
33325
|
}
|
|
33322
33326
|
var QueryModel = {
|
|
@@ -36867,8 +36871,8 @@ var DicomSenderOptionsSchema = z.object({
|
|
|
36867
36871
|
acseTimeout: z.number().int().positive().optional(),
|
|
36868
36872
|
dimseTimeout: z.number().int().positive().optional(),
|
|
36869
36873
|
noHostnameLookup: z.boolean().optional(),
|
|
36870
|
-
noUidChecks: z.boolean().optional(),
|
|
36871
36874
|
verbosity: z.enum(["verbose", "debug"]).optional(),
|
|
36875
|
+
required: z.boolean().optional(),
|
|
36872
36876
|
signal: z.instanceof(AbortSignal).optional()
|
|
36873
36877
|
}).strict();
|
|
36874
36878
|
function resolveConfig(options) {
|
|
@@ -36971,7 +36975,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
36971
36975
|
timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
|
|
36972
36976
|
maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
|
|
36973
36977
|
calledAETitle: options?.calledAETitle,
|
|
36974
|
-
callingAETitle: options?.callingAETitle
|
|
36978
|
+
callingAETitle: options?.callingAETitle,
|
|
36979
|
+
required: options?.required
|
|
36975
36980
|
};
|
|
36976
36981
|
return this.dispatchSend(files, params);
|
|
36977
36982
|
}
|
|
@@ -37090,6 +37095,7 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37090
37095
|
maxRetries: params.maxRetries,
|
|
37091
37096
|
calledAETitle: params.calledAETitle,
|
|
37092
37097
|
callingAETitle: params.callingAETitle,
|
|
37098
|
+
required: params.required,
|
|
37093
37099
|
resolve
|
|
37094
37100
|
};
|
|
37095
37101
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
@@ -37118,8 +37124,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37118
37124
|
resolve(err(new Error("DicomSender: queue full")));
|
|
37119
37125
|
return;
|
|
37120
37126
|
}
|
|
37121
|
-
const { timeoutMs, maxRetries, calledAETitle, callingAETitle } = params;
|
|
37122
|
-
this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle });
|
|
37127
|
+
const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required } = params;
|
|
37128
|
+
this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle, required });
|
|
37123
37129
|
const totalFiles = this.countBucketFiles();
|
|
37124
37130
|
if (totalFiles >= this.maxBucketSize) {
|
|
37125
37131
|
this.clearBucketTimer();
|
|
@@ -37137,36 +37143,39 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37137
37143
|
}
|
|
37138
37144
|
return count;
|
|
37139
37145
|
}
|
|
37140
|
-
/**
|
|
37141
|
-
|
|
37142
|
-
if (this.currentBucket.length === 0) return;
|
|
37143
|
-
const entries = [...this.currentBucket];
|
|
37144
|
-
this.currentBucket = [];
|
|
37146
|
+
/** Merges bucket entries into a single QueueEntry. */
|
|
37147
|
+
mergeBucketEntries(entries) {
|
|
37145
37148
|
const allFiles = [];
|
|
37149
|
+
let timeoutMs = 0;
|
|
37150
|
+
let maxRetries = 0;
|
|
37146
37151
|
for (let i = 0; i < entries.length; i++) {
|
|
37147
37152
|
for (let j = 0; j < entries[i].files.length; j++) {
|
|
37148
37153
|
allFiles.push(entries[i].files[j]);
|
|
37149
37154
|
}
|
|
37150
|
-
}
|
|
37151
|
-
let timeoutMs = 0;
|
|
37152
|
-
let maxRetries = 0;
|
|
37153
|
-
for (let i = 0; i < entries.length; i++) {
|
|
37154
37155
|
if (entries[i].timeoutMs > timeoutMs) timeoutMs = entries[i].timeoutMs;
|
|
37155
37156
|
if (entries[i].maxRetries > maxRetries) maxRetries = entries[i].maxRetries;
|
|
37156
37157
|
}
|
|
37157
|
-
|
|
37158
|
-
const bucketEntry = {
|
|
37158
|
+
return {
|
|
37159
37159
|
files: allFiles,
|
|
37160
37160
|
timeoutMs,
|
|
37161
37161
|
maxRetries,
|
|
37162
37162
|
calledAETitle: entries[0]?.calledAETitle,
|
|
37163
37163
|
callingAETitle: entries[0]?.callingAETitle,
|
|
37164
|
+
required: entries[0]?.required,
|
|
37164
37165
|
resolve: (result) => {
|
|
37165
37166
|
for (let i = 0; i < entries.length; i++) {
|
|
37166
37167
|
entries[i].resolve(result);
|
|
37167
37168
|
}
|
|
37168
37169
|
}
|
|
37169
37170
|
};
|
|
37171
|
+
}
|
|
37172
|
+
/** Flushes the current bucket: combines all files, dispatches as one send. */
|
|
37173
|
+
flushBucketInternal(reason) {
|
|
37174
|
+
if (this.currentBucket.length === 0) return;
|
|
37175
|
+
const entries = [...this.currentBucket];
|
|
37176
|
+
this.currentBucket = [];
|
|
37177
|
+
const bucketEntry = this.mergeBucketEntries(entries);
|
|
37178
|
+
this.emit("BUCKET_FLUSHED", { fileCount: bucketEntry.files.length, reason });
|
|
37170
37179
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
37171
37180
|
void this.executeEntry(bucketEntry);
|
|
37172
37181
|
} else {
|
|
@@ -37247,8 +37256,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37247
37256
|
acseTimeout: this.options.acseTimeout,
|
|
37248
37257
|
dimseTimeout: this.options.dimseTimeout,
|
|
37249
37258
|
noHostnameLookup: this.options.noHostnameLookup,
|
|
37250
|
-
noUidChecks: this.options.noUidChecks,
|
|
37251
37259
|
verbosity: this.options.verbosity,
|
|
37260
|
+
required: entry.required ?? this.options.required,
|
|
37252
37261
|
timeoutMs: entry.timeoutMs,
|
|
37253
37262
|
signal: this.options.signal
|
|
37254
37263
|
});
|