@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.js CHANGED
@@ -30364,6 +30364,51 @@ var ChangeSet = class _ChangeSet {
30364
30364
  return result;
30365
30365
  }
30366
30366
  };
30367
+
30368
+ // src/tools/_toolError.ts
30369
+ var MAX_ARGS_LENGTH = 200;
30370
+ var MAX_STDERR_LENGTH = 500;
30371
+ function truncate(value, maxLength) {
30372
+ if (value.length <= maxLength) {
30373
+ return value;
30374
+ }
30375
+ return `${value.substring(0, maxLength)}...`;
30376
+ }
30377
+ var ToolExecutionError = class extends Error {
30378
+ constructor(message, details) {
30379
+ super(message);
30380
+ __publicField(this, "stdout");
30381
+ __publicField(this, "stderr");
30382
+ __publicField(this, "exitCode");
30383
+ this.name = "ToolExecutionError";
30384
+ this.stdout = details.stdout;
30385
+ this.stderr = details.stderr;
30386
+ this.exitCode = details.exitCode;
30387
+ }
30388
+ };
30389
+ function createToolError(toolName, args, exitCode, stderr4, stdout = "") {
30390
+ const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
30391
+ const stderrStr = truncate(stderr4.trim(), MAX_STDERR_LENGTH);
30392
+ const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
30393
+ if (argsStr.length > 0) {
30394
+ parts.push(`args: ${argsStr}`);
30395
+ }
30396
+ if (stderrStr.length > 0) {
30397
+ parts.push(`stderr: ${stderrStr}`);
30398
+ }
30399
+ return new ToolExecutionError(parts.join(" | "), { stdout, stderr: stderr4, exitCode });
30400
+ }
30401
+ function createValidationError(toolName, zodError) {
30402
+ const parts = [];
30403
+ for (let i = 0; i < zodError.issues.length; i++) {
30404
+ const issue = zodError.issues[i];
30405
+ if (issue === void 0) continue;
30406
+ const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
30407
+ parts.push(`${path}: ${issue.message}`);
30408
+ }
30409
+ const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
30410
+ return new Error(`${toolName}: invalid options \u2014 ${detail}`);
30411
+ }
30367
30412
  function killTree(pid) {
30368
30413
  try {
30369
30414
  kill(pid);
@@ -30525,39 +30570,6 @@ function resolveBinary(toolName) {
30525
30570
  const binaryName2 = isWindows2 ? `${toolName}.exe` : toolName;
30526
30571
  return ok(join(pathResult.value, binaryName2));
30527
30572
  }
30528
-
30529
- // src/tools/_toolError.ts
30530
- var MAX_ARGS_LENGTH = 200;
30531
- var MAX_STDERR_LENGTH = 500;
30532
- function truncate(value, maxLength) {
30533
- if (value.length <= maxLength) {
30534
- return value;
30535
- }
30536
- return `${value.substring(0, maxLength)}...`;
30537
- }
30538
- function createToolError(toolName, args, exitCode, stderr4) {
30539
- const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
30540
- const stderrStr = truncate(stderr4.trim(), MAX_STDERR_LENGTH);
30541
- const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
30542
- if (argsStr.length > 0) {
30543
- parts.push(`args: ${argsStr}`);
30544
- }
30545
- if (stderrStr.length > 0) {
30546
- parts.push(`stderr: ${stderrStr}`);
30547
- }
30548
- return new Error(parts.join(" | "));
30549
- }
30550
- function createValidationError(toolName, zodError) {
30551
- const parts = [];
30552
- for (let i = 0; i < zodError.issues.length; i++) {
30553
- const issue = zodError.issues[i];
30554
- if (issue === void 0) continue;
30555
- const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
30556
- parts.push(`${path}: ${issue.message}`);
30557
- }
30558
- const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
30559
- return new Error(`${toolName}: invalid options \u2014 ${detail}`);
30560
- }
30561
30573
  var PN_REPS = ["Alphabetic", "Ideographic", "Phonetic"];
30562
30574
  var ARRAY_TAG_NAMES = /* @__PURE__ */ new Set(["DicomAttribute", "Value", "PersonName", "Item"]);
30563
30575
  var KNOWN_VR_CODES = /* @__PURE__ */ new Set([