@ubercode/dcmtk 0.14.0 → 0.15.1
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 +55 -37
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +55 -37
- package/dist/dicom.js.map +1 -1
- package/dist/index.cjs +176 -64
- 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 +176 -65
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +24 -6
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.js +24 -6
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +62 -41
- 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 +62 -42
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/servers.cjs
CHANGED
|
@@ -527,7 +527,19 @@ function truncate(value, maxLength) {
|
|
|
527
527
|
}
|
|
528
528
|
return `${value.substring(0, maxLength)}...`;
|
|
529
529
|
}
|
|
530
|
-
|
|
530
|
+
var ToolExecutionError = class extends Error {
|
|
531
|
+
constructor(message, details) {
|
|
532
|
+
super(message);
|
|
533
|
+
__publicField(this, "stdout");
|
|
534
|
+
__publicField(this, "stderr");
|
|
535
|
+
__publicField(this, "exitCode");
|
|
536
|
+
this.name = "ToolExecutionError";
|
|
537
|
+
this.stdout = details.stdout;
|
|
538
|
+
this.stderr = details.stderr;
|
|
539
|
+
this.exitCode = details.exitCode;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
function createToolError(toolName, args, exitCode, stderr6, stdout = "") {
|
|
531
543
|
const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
|
|
532
544
|
const stderrStr = truncate(stderr6.trim(), MAX_STDERR_LENGTH);
|
|
533
545
|
const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
|
|
@@ -537,7 +549,7 @@ function createToolError(toolName, args, exitCode, stderr6) {
|
|
|
537
549
|
if (stderrStr.length > 0) {
|
|
538
550
|
parts.push(`stderr: ${stderrStr}`);
|
|
539
551
|
}
|
|
540
|
-
return new
|
|
552
|
+
return new ToolExecutionError(parts.join(" | "), { stdout, stderr: stderr6, exitCode });
|
|
541
553
|
}
|
|
542
554
|
function createValidationError(toolName, zodError) {
|
|
543
555
|
const parts = [];
|
|
@@ -2122,8 +2134,14 @@ var KNOWN_VR_CODES = /* @__PURE__ */ new Set([
|
|
|
2122
2134
|
"UT",
|
|
2123
2135
|
"UV"
|
|
2124
2136
|
]);
|
|
2137
|
+
function decodeXmlEntities(value) {
|
|
2138
|
+
return value.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
2139
|
+
}
|
|
2140
|
+
function decodeIfString(value) {
|
|
2141
|
+
return typeof value === "string" ? decodeXmlEntities(value) : value;
|
|
2142
|
+
}
|
|
2125
2143
|
function buildPnString(comp) {
|
|
2126
|
-
const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""];
|
|
2144
|
+
const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""].map(decodeXmlEntities);
|
|
2127
2145
|
let last = parts.length - 1;
|
|
2128
2146
|
for (; last >= 0; last--) {
|
|
2129
2147
|
if (parts[last] !== "") break;
|
|
@@ -2162,9 +2180,9 @@ function convertBulkDataURI(attr, element) {
|
|
|
2162
2180
|
const bulkArray = toArray(attr.BulkDataURI);
|
|
2163
2181
|
const firstBulk = bulkArray[0];
|
|
2164
2182
|
if (typeof firstBulk === "object" && firstBulk !== null && "@_uri" in firstBulk) {
|
|
2165
|
-
element.BulkDataURI = safeString(firstBulk["@_uri"]);
|
|
2183
|
+
element.BulkDataURI = decodeXmlEntities(safeString(firstBulk["@_uri"]));
|
|
2166
2184
|
} else {
|
|
2167
|
-
element.BulkDataURI = safeString(firstBulk);
|
|
2185
|
+
element.BulkDataURI = decodeXmlEntities(safeString(firstBulk));
|
|
2168
2186
|
}
|
|
2169
2187
|
}
|
|
2170
2188
|
function convertPNValue(attr, element) {
|
|
@@ -2208,7 +2226,7 @@ function convertRegularValue(attr, element, vr) {
|
|
|
2208
2226
|
const values = [];
|
|
2209
2227
|
const isNumeric = NUMERIC_JSON_VRS.has(vr);
|
|
2210
2228
|
for (const v of valArray) {
|
|
2211
|
-
const unwrapped = unwrapValue(v);
|
|
2229
|
+
const unwrapped = decodeIfString(unwrapValue(v));
|
|
2212
2230
|
values.push(isNumeric ? coerceNumeric(unwrapped) : unwrapped);
|
|
2213
2231
|
}
|
|
2214
2232
|
if (values.length > 0) element.Value = values;
|