@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.cjs
CHANGED
|
@@ -33257,7 +33257,7 @@ var StorescuOptionsSchema = zod.z.object({
|
|
|
33257
33257
|
acseTimeout: zod.z.number().int().positive().optional(),
|
|
33258
33258
|
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
33259
33259
|
noHostnameLookup: zod.z.boolean().optional(),
|
|
33260
|
-
|
|
33260
|
+
required: zod.z.boolean().optional(),
|
|
33261
33261
|
proposedTransferSyntax: zod.z.enum([
|
|
33262
33262
|
"uncompressed",
|
|
33263
33263
|
"littleEndian",
|
|
@@ -33273,6 +33273,7 @@ var StorescuOptionsSchema = zod.z.object({
|
|
|
33273
33273
|
]).optional()
|
|
33274
33274
|
}).strict();
|
|
33275
33275
|
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
33276
|
+
var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
|
|
33276
33277
|
function pushNetworkArgs3(args, options) {
|
|
33277
33278
|
if (options.verbosity !== void 0) {
|
|
33278
33279
|
args.push(VERBOSITY_FLAGS20[options.verbosity]);
|
|
@@ -33299,9 +33300,6 @@ function pushNetworkArgs3(args, options) {
|
|
|
33299
33300
|
function buildArgs34(options) {
|
|
33300
33301
|
const args = [];
|
|
33301
33302
|
pushNetworkArgs3(args, options);
|
|
33302
|
-
if (options.noUidChecks === true) {
|
|
33303
|
-
args.push("--no-uid-checks");
|
|
33304
|
-
}
|
|
33305
33303
|
if (options.callingAETitle !== void 0) {
|
|
33306
33304
|
args.push("-aet", options.callingAETitle);
|
|
33307
33305
|
}
|
|
@@ -33317,6 +33315,9 @@ function buildArgs34(options) {
|
|
|
33317
33315
|
if (options.proposedTransferSyntax !== void 0) {
|
|
33318
33316
|
args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
|
|
33319
33317
|
}
|
|
33318
|
+
if (options.required === true) {
|
|
33319
|
+
args.push("-R");
|
|
33320
|
+
}
|
|
33320
33321
|
args.push(options.host, String(options.port));
|
|
33321
33322
|
args.push(...options.files);
|
|
33322
33323
|
return args;
|
|
@@ -33342,6 +33343,9 @@ async function storescu(options) {
|
|
|
33342
33343
|
if (result.value.exitCode !== 0) {
|
|
33343
33344
|
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
|
|
33344
33345
|
}
|
|
33346
|
+
if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
|
|
33347
|
+
return err(createToolError("storescu", args, 0, result.value.stderr));
|
|
33348
|
+
}
|
|
33345
33349
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
33346
33350
|
}
|
|
33347
33351
|
var QueryModel = {
|
|
@@ -36892,8 +36896,8 @@ var DicomSenderOptionsSchema = zod.z.object({
|
|
|
36892
36896
|
acseTimeout: zod.z.number().int().positive().optional(),
|
|
36893
36897
|
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
36894
36898
|
noHostnameLookup: zod.z.boolean().optional(),
|
|
36895
|
-
noUidChecks: zod.z.boolean().optional(),
|
|
36896
36899
|
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
36900
|
+
required: zod.z.boolean().optional(),
|
|
36897
36901
|
signal: zod.z.instanceof(AbortSignal).optional()
|
|
36898
36902
|
}).strict();
|
|
36899
36903
|
function resolveConfig(options) {
|
|
@@ -36996,7 +37000,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
36996
37000
|
timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
|
|
36997
37001
|
maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
|
|
36998
37002
|
calledAETitle: options?.calledAETitle,
|
|
36999
|
-
callingAETitle: options?.callingAETitle
|
|
37003
|
+
callingAETitle: options?.callingAETitle,
|
|
37004
|
+
required: options?.required
|
|
37000
37005
|
};
|
|
37001
37006
|
return this.dispatchSend(files, params);
|
|
37002
37007
|
}
|
|
@@ -37115,6 +37120,7 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37115
37120
|
maxRetries: params.maxRetries,
|
|
37116
37121
|
calledAETitle: params.calledAETitle,
|
|
37117
37122
|
callingAETitle: params.callingAETitle,
|
|
37123
|
+
required: params.required,
|
|
37118
37124
|
resolve
|
|
37119
37125
|
};
|
|
37120
37126
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
@@ -37143,8 +37149,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37143
37149
|
resolve(err(new Error("DicomSender: queue full")));
|
|
37144
37150
|
return;
|
|
37145
37151
|
}
|
|
37146
|
-
const { timeoutMs, maxRetries, calledAETitle, callingAETitle } = params;
|
|
37147
|
-
this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle });
|
|
37152
|
+
const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required } = params;
|
|
37153
|
+
this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle, required });
|
|
37148
37154
|
const totalFiles = this.countBucketFiles();
|
|
37149
37155
|
if (totalFiles >= this.maxBucketSize) {
|
|
37150
37156
|
this.clearBucketTimer();
|
|
@@ -37162,36 +37168,39 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37162
37168
|
}
|
|
37163
37169
|
return count;
|
|
37164
37170
|
}
|
|
37165
|
-
/**
|
|
37166
|
-
|
|
37167
|
-
if (this.currentBucket.length === 0) return;
|
|
37168
|
-
const entries = [...this.currentBucket];
|
|
37169
|
-
this.currentBucket = [];
|
|
37171
|
+
/** Merges bucket entries into a single QueueEntry. */
|
|
37172
|
+
mergeBucketEntries(entries) {
|
|
37170
37173
|
const allFiles = [];
|
|
37174
|
+
let timeoutMs = 0;
|
|
37175
|
+
let maxRetries = 0;
|
|
37171
37176
|
for (let i = 0; i < entries.length; i++) {
|
|
37172
37177
|
for (let j = 0; j < entries[i].files.length; j++) {
|
|
37173
37178
|
allFiles.push(entries[i].files[j]);
|
|
37174
37179
|
}
|
|
37175
|
-
}
|
|
37176
|
-
let timeoutMs = 0;
|
|
37177
|
-
let maxRetries = 0;
|
|
37178
|
-
for (let i = 0; i < entries.length; i++) {
|
|
37179
37180
|
if (entries[i].timeoutMs > timeoutMs) timeoutMs = entries[i].timeoutMs;
|
|
37180
37181
|
if (entries[i].maxRetries > maxRetries) maxRetries = entries[i].maxRetries;
|
|
37181
37182
|
}
|
|
37182
|
-
|
|
37183
|
-
const bucketEntry = {
|
|
37183
|
+
return {
|
|
37184
37184
|
files: allFiles,
|
|
37185
37185
|
timeoutMs,
|
|
37186
37186
|
maxRetries,
|
|
37187
37187
|
calledAETitle: entries[0]?.calledAETitle,
|
|
37188
37188
|
callingAETitle: entries[0]?.callingAETitle,
|
|
37189
|
+
required: entries[0]?.required,
|
|
37189
37190
|
resolve: (result) => {
|
|
37190
37191
|
for (let i = 0; i < entries.length; i++) {
|
|
37191
37192
|
entries[i].resolve(result);
|
|
37192
37193
|
}
|
|
37193
37194
|
}
|
|
37194
37195
|
};
|
|
37196
|
+
}
|
|
37197
|
+
/** Flushes the current bucket: combines all files, dispatches as one send. */
|
|
37198
|
+
flushBucketInternal(reason) {
|
|
37199
|
+
if (this.currentBucket.length === 0) return;
|
|
37200
|
+
const entries = [...this.currentBucket];
|
|
37201
|
+
this.currentBucket = [];
|
|
37202
|
+
const bucketEntry = this.mergeBucketEntries(entries);
|
|
37203
|
+
this.emit("BUCKET_FLUSHED", { fileCount: bucketEntry.files.length, reason });
|
|
37195
37204
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
37196
37205
|
void this.executeEntry(bucketEntry);
|
|
37197
37206
|
} else {
|
|
@@ -37272,8 +37281,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37272
37281
|
acseTimeout: this.options.acseTimeout,
|
|
37273
37282
|
dimseTimeout: this.options.dimseTimeout,
|
|
37274
37283
|
noHostnameLookup: this.options.noHostnameLookup,
|
|
37275
|
-
noUidChecks: this.options.noUidChecks,
|
|
37276
37284
|
verbosity: this.options.verbosity,
|
|
37285
|
+
required: entry.required ?? this.options.required,
|
|
37277
37286
|
timeoutMs: entry.timeoutMs,
|
|
37278
37287
|
signal: this.options.signal
|
|
37279
37288
|
});
|