@ubercode/dcmtk 0.14.0 → 0.15.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/dicom.cjs +45 -33
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +45 -33
- package/dist/dicom.js.map +1 -1
- package/dist/index.cjs +166 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +166 -61
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +14 -2
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.js +14 -2
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +52 -37
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +18 -1
- package/dist/tools.d.ts +18 -1
- package/dist/tools.js +52 -38
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/dicom.cjs
CHANGED
|
@@ -30370,6 +30370,51 @@ var ChangeSet = class _ChangeSet {
|
|
|
30370
30370
|
return result;
|
|
30371
30371
|
}
|
|
30372
30372
|
};
|
|
30373
|
+
|
|
30374
|
+
// src/tools/_toolError.ts
|
|
30375
|
+
var MAX_ARGS_LENGTH = 200;
|
|
30376
|
+
var MAX_STDERR_LENGTH = 500;
|
|
30377
|
+
function truncate(value, maxLength) {
|
|
30378
|
+
if (value.length <= maxLength) {
|
|
30379
|
+
return value;
|
|
30380
|
+
}
|
|
30381
|
+
return `${value.substring(0, maxLength)}...`;
|
|
30382
|
+
}
|
|
30383
|
+
var ToolExecutionError = class extends Error {
|
|
30384
|
+
constructor(message, details) {
|
|
30385
|
+
super(message);
|
|
30386
|
+
__publicField(this, "stdout");
|
|
30387
|
+
__publicField(this, "stderr");
|
|
30388
|
+
__publicField(this, "exitCode");
|
|
30389
|
+
this.name = "ToolExecutionError";
|
|
30390
|
+
this.stdout = details.stdout;
|
|
30391
|
+
this.stderr = details.stderr;
|
|
30392
|
+
this.exitCode = details.exitCode;
|
|
30393
|
+
}
|
|
30394
|
+
};
|
|
30395
|
+
function createToolError(toolName, args, exitCode, stderr4, stdout = "") {
|
|
30396
|
+
const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
|
|
30397
|
+
const stderrStr = truncate(stderr4.trim(), MAX_STDERR_LENGTH);
|
|
30398
|
+
const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
|
|
30399
|
+
if (argsStr.length > 0) {
|
|
30400
|
+
parts.push(`args: ${argsStr}`);
|
|
30401
|
+
}
|
|
30402
|
+
if (stderrStr.length > 0) {
|
|
30403
|
+
parts.push(`stderr: ${stderrStr}`);
|
|
30404
|
+
}
|
|
30405
|
+
return new ToolExecutionError(parts.join(" | "), { stdout, stderr: stderr4, exitCode });
|
|
30406
|
+
}
|
|
30407
|
+
function createValidationError(toolName, zodError) {
|
|
30408
|
+
const parts = [];
|
|
30409
|
+
for (let i = 0; i < zodError.issues.length; i++) {
|
|
30410
|
+
const issue = zodError.issues[i];
|
|
30411
|
+
if (issue === void 0) continue;
|
|
30412
|
+
const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
|
|
30413
|
+
parts.push(`${path}: ${issue.message}`);
|
|
30414
|
+
}
|
|
30415
|
+
const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
|
|
30416
|
+
return new Error(`${toolName}: invalid options \u2014 ${detail}`);
|
|
30417
|
+
}
|
|
30373
30418
|
function killTree(pid) {
|
|
30374
30419
|
try {
|
|
30375
30420
|
kill__default.default(pid);
|
|
@@ -30531,39 +30576,6 @@ function resolveBinary(toolName) {
|
|
|
30531
30576
|
const binaryName2 = isWindows2 ? `${toolName}.exe` : toolName;
|
|
30532
30577
|
return ok(path.join(pathResult.value, binaryName2));
|
|
30533
30578
|
}
|
|
30534
|
-
|
|
30535
|
-
// src/tools/_toolError.ts
|
|
30536
|
-
var MAX_ARGS_LENGTH = 200;
|
|
30537
|
-
var MAX_STDERR_LENGTH = 500;
|
|
30538
|
-
function truncate(value, maxLength) {
|
|
30539
|
-
if (value.length <= maxLength) {
|
|
30540
|
-
return value;
|
|
30541
|
-
}
|
|
30542
|
-
return `${value.substring(0, maxLength)}...`;
|
|
30543
|
-
}
|
|
30544
|
-
function createToolError(toolName, args, exitCode, stderr4) {
|
|
30545
|
-
const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
|
|
30546
|
-
const stderrStr = truncate(stderr4.trim(), MAX_STDERR_LENGTH);
|
|
30547
|
-
const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
|
|
30548
|
-
if (argsStr.length > 0) {
|
|
30549
|
-
parts.push(`args: ${argsStr}`);
|
|
30550
|
-
}
|
|
30551
|
-
if (stderrStr.length > 0) {
|
|
30552
|
-
parts.push(`stderr: ${stderrStr}`);
|
|
30553
|
-
}
|
|
30554
|
-
return new Error(parts.join(" | "));
|
|
30555
|
-
}
|
|
30556
|
-
function createValidationError(toolName, zodError) {
|
|
30557
|
-
const parts = [];
|
|
30558
|
-
for (let i = 0; i < zodError.issues.length; i++) {
|
|
30559
|
-
const issue = zodError.issues[i];
|
|
30560
|
-
if (issue === void 0) continue;
|
|
30561
|
-
const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
|
|
30562
|
-
parts.push(`${path}: ${issue.message}`);
|
|
30563
|
-
}
|
|
30564
|
-
const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
|
|
30565
|
-
return new Error(`${toolName}: invalid options \u2014 ${detail}`);
|
|
30566
|
-
}
|
|
30567
30579
|
var PN_REPS = ["Alphabetic", "Ideographic", "Phonetic"];
|
|
30568
30580
|
var ARRAY_TAG_NAMES = /* @__PURE__ */ new Set(["DicomAttribute", "Value", "PersonName", "Item"]);
|
|
30569
30581
|
var KNOWN_VR_CODES = /* @__PURE__ */ new Set([
|