@ubercode/dcmtk 0.7.1 → 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 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +29 -14
- package/dist/index.js.map +1 -1
- package/dist/tools.cjs +8 -0
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +2 -0
- package/dist/tools.d.ts +2 -0
- package/dist/tools.js +8 -0
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33257,6 +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
|
+
required: zod.z.boolean().optional(),
|
|
33260
33261
|
proposedTransferSyntax: zod.z.enum([
|
|
33261
33262
|
"uncompressed",
|
|
33262
33263
|
"littleEndian",
|
|
@@ -33272,6 +33273,7 @@ var StorescuOptionsSchema = zod.z.object({
|
|
|
33272
33273
|
]).optional()
|
|
33273
33274
|
}).strict();
|
|
33274
33275
|
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
33276
|
+
var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
|
|
33275
33277
|
function pushNetworkArgs3(args, options) {
|
|
33276
33278
|
if (options.verbosity !== void 0) {
|
|
33277
33279
|
args.push(VERBOSITY_FLAGS20[options.verbosity]);
|
|
@@ -33313,6 +33315,9 @@ function buildArgs34(options) {
|
|
|
33313
33315
|
if (options.proposedTransferSyntax !== void 0) {
|
|
33314
33316
|
args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
|
|
33315
33317
|
}
|
|
33318
|
+
if (options.required === true) {
|
|
33319
|
+
args.push("-R");
|
|
33320
|
+
}
|
|
33316
33321
|
args.push(options.host, String(options.port));
|
|
33317
33322
|
args.push(...options.files);
|
|
33318
33323
|
return args;
|
|
@@ -33338,6 +33343,9 @@ async function storescu(options) {
|
|
|
33338
33343
|
if (result.value.exitCode !== 0) {
|
|
33339
33344
|
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
|
|
33340
33345
|
}
|
|
33346
|
+
if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
|
|
33347
|
+
return err(createToolError("storescu", args, 0, result.value.stderr));
|
|
33348
|
+
}
|
|
33341
33349
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
33342
33350
|
}
|
|
33343
33351
|
var QueryModel = {
|
|
@@ -36889,6 +36897,7 @@ var DicomSenderOptionsSchema = zod.z.object({
|
|
|
36889
36897
|
dimseTimeout: zod.z.number().int().positive().optional(),
|
|
36890
36898
|
noHostnameLookup: zod.z.boolean().optional(),
|
|
36891
36899
|
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
36900
|
+
required: zod.z.boolean().optional(),
|
|
36892
36901
|
signal: zod.z.instanceof(AbortSignal).optional()
|
|
36893
36902
|
}).strict();
|
|
36894
36903
|
function resolveConfig(options) {
|
|
@@ -36991,7 +37000,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
36991
37000
|
timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
|
|
36992
37001
|
maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
|
|
36993
37002
|
calledAETitle: options?.calledAETitle,
|
|
36994
|
-
callingAETitle: options?.callingAETitle
|
|
37003
|
+
callingAETitle: options?.callingAETitle,
|
|
37004
|
+
required: options?.required
|
|
36995
37005
|
};
|
|
36996
37006
|
return this.dispatchSend(files, params);
|
|
36997
37007
|
}
|
|
@@ -37110,6 +37120,7 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37110
37120
|
maxRetries: params.maxRetries,
|
|
37111
37121
|
calledAETitle: params.calledAETitle,
|
|
37112
37122
|
callingAETitle: params.callingAETitle,
|
|
37123
|
+
required: params.required,
|
|
37113
37124
|
resolve
|
|
37114
37125
|
};
|
|
37115
37126
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
@@ -37138,8 +37149,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37138
37149
|
resolve(err(new Error("DicomSender: queue full")));
|
|
37139
37150
|
return;
|
|
37140
37151
|
}
|
|
37141
|
-
const { timeoutMs, maxRetries, calledAETitle, callingAETitle } = params;
|
|
37142
|
-
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 });
|
|
37143
37154
|
const totalFiles = this.countBucketFiles();
|
|
37144
37155
|
if (totalFiles >= this.maxBucketSize) {
|
|
37145
37156
|
this.clearBucketTimer();
|
|
@@ -37157,36 +37168,39 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37157
37168
|
}
|
|
37158
37169
|
return count;
|
|
37159
37170
|
}
|
|
37160
|
-
/**
|
|
37161
|
-
|
|
37162
|
-
if (this.currentBucket.length === 0) return;
|
|
37163
|
-
const entries = [...this.currentBucket];
|
|
37164
|
-
this.currentBucket = [];
|
|
37171
|
+
/** Merges bucket entries into a single QueueEntry. */
|
|
37172
|
+
mergeBucketEntries(entries) {
|
|
37165
37173
|
const allFiles = [];
|
|
37174
|
+
let timeoutMs = 0;
|
|
37175
|
+
let maxRetries = 0;
|
|
37166
37176
|
for (let i = 0; i < entries.length; i++) {
|
|
37167
37177
|
for (let j = 0; j < entries[i].files.length; j++) {
|
|
37168
37178
|
allFiles.push(entries[i].files[j]);
|
|
37169
37179
|
}
|
|
37170
|
-
}
|
|
37171
|
-
let timeoutMs = 0;
|
|
37172
|
-
let maxRetries = 0;
|
|
37173
|
-
for (let i = 0; i < entries.length; i++) {
|
|
37174
37180
|
if (entries[i].timeoutMs > timeoutMs) timeoutMs = entries[i].timeoutMs;
|
|
37175
37181
|
if (entries[i].maxRetries > maxRetries) maxRetries = entries[i].maxRetries;
|
|
37176
37182
|
}
|
|
37177
|
-
|
|
37178
|
-
const bucketEntry = {
|
|
37183
|
+
return {
|
|
37179
37184
|
files: allFiles,
|
|
37180
37185
|
timeoutMs,
|
|
37181
37186
|
maxRetries,
|
|
37182
37187
|
calledAETitle: entries[0]?.calledAETitle,
|
|
37183
37188
|
callingAETitle: entries[0]?.callingAETitle,
|
|
37189
|
+
required: entries[0]?.required,
|
|
37184
37190
|
resolve: (result) => {
|
|
37185
37191
|
for (let i = 0; i < entries.length; i++) {
|
|
37186
37192
|
entries[i].resolve(result);
|
|
37187
37193
|
}
|
|
37188
37194
|
}
|
|
37189
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 });
|
|
37190
37204
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
37191
37205
|
void this.executeEntry(bucketEntry);
|
|
37192
37206
|
} else {
|
|
@@ -37268,6 +37282,7 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
|
|
|
37268
37282
|
dimseTimeout: this.options.dimseTimeout,
|
|
37269
37283
|
noHostnameLookup: this.options.noHostnameLookup,
|
|
37270
37284
|
verbosity: this.options.verbosity,
|
|
37285
|
+
required: entry.required ?? this.options.required,
|
|
37271
37286
|
timeoutMs: entry.timeoutMs,
|
|
37272
37287
|
signal: this.options.signal
|
|
37273
37288
|
});
|