@ubercode/dcmtk 0.13.2 → 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 +50 -36
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +50 -36
- package/dist/dicom.js.map +1 -1
- package/dist/{index-Bve4fMIh.d.cts → index-CtqMUrjP.d.cts} +2 -0
- package/dist/{index-CZiFWENk.d.ts → index-D7nnTY1R.d.ts} +2 -0
- package/dist/index.cjs +193 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +193 -66
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +41 -7
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +1 -1
- package/dist/servers.d.ts +1 -1
- package/dist/servers.js +41 -7
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +57 -40
- 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 +57 -41
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.d.cts
CHANGED
|
@@ -2,6 +2,23 @@ import { R as Result } from './types-Cgumy1N4.cjs';
|
|
|
2
2
|
import { d as ToolBaseOptions, a as DicomJsonModel } from './dcmodify-Cf-RPHF3.cjs';
|
|
3
3
|
export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, T as TagModification, e as dcmodify } from './dcmodify-Cf-RPHF3.cjs';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown by tool wrappers when the underlying binary exits non-zero
|
|
7
|
+
* (or otherwise reports failure). Carries the full captured stdout/stderr
|
|
8
|
+
* and exit code so callers can surface diagnostic output without parsing
|
|
9
|
+
* the message string.
|
|
10
|
+
*/
|
|
11
|
+
declare class ToolExecutionError extends Error {
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
readonly exitCode: number;
|
|
15
|
+
constructor(message: string, details: {
|
|
16
|
+
readonly stdout: string;
|
|
17
|
+
readonly stderr: string;
|
|
18
|
+
readonly exitCode: number;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
/**
|
|
6
23
|
* DICOM to XML conversion using the dcm2xml binary.
|
|
7
24
|
*
|
|
@@ -2269,4 +2286,4 @@ interface DcmmklutResult {
|
|
|
2269
2286
|
*/
|
|
2270
2287
|
declare function dcmmklut(outputPath: string, options?: DcmmklutOptions): Promise<Result<DcmmklutResult>>;
|
|
2271
2288
|
|
|
2272
|
-
export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
|
2289
|
+
export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, ToolExecutionError, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
package/dist/tools.d.ts
CHANGED
|
@@ -2,6 +2,23 @@ import { R as Result } from './types-Cgumy1N4.js';
|
|
|
2
2
|
import { d as ToolBaseOptions, a as DicomJsonModel } from './dcmodify-CHvwChFu.js';
|
|
3
3
|
export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, T as TagModification, e as dcmodify } from './dcmodify-CHvwChFu.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown by tool wrappers when the underlying binary exits non-zero
|
|
7
|
+
* (or otherwise reports failure). Carries the full captured stdout/stderr
|
|
8
|
+
* and exit code so callers can surface diagnostic output without parsing
|
|
9
|
+
* the message string.
|
|
10
|
+
*/
|
|
11
|
+
declare class ToolExecutionError extends Error {
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
readonly exitCode: number;
|
|
15
|
+
constructor(message: string, details: {
|
|
16
|
+
readonly stdout: string;
|
|
17
|
+
readonly stderr: string;
|
|
18
|
+
readonly exitCode: number;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
/**
|
|
6
23
|
* DICOM to XML conversion using the dcm2xml binary.
|
|
7
24
|
*
|
|
@@ -2269,4 +2286,4 @@ interface DcmmklutResult {
|
|
|
2269
2286
|
*/
|
|
2270
2287
|
declare function dcmmklut(outputPath: string, options?: DcmmklutOptions): Promise<Result<DcmmklutResult>>;
|
|
2271
2288
|
|
|
2272
|
-
export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
|
2289
|
+
export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, ToolExecutionError, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
package/dist/tools.js
CHANGED
|
@@ -8,7 +8,54 @@ import { tmpdir } from 'os';
|
|
|
8
8
|
import { stderr } from 'stderr-lib';
|
|
9
9
|
import { XMLParser } from 'fast-xml-parser';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
|
+
|
|
15
|
+
// src/tools/_toolError.ts
|
|
16
|
+
var MAX_ARGS_LENGTH = 200;
|
|
17
|
+
var MAX_STDERR_LENGTH = 500;
|
|
18
|
+
function truncate(value, maxLength) {
|
|
19
|
+
if (value.length <= maxLength) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
return `${value.substring(0, maxLength)}...`;
|
|
23
|
+
}
|
|
24
|
+
var ToolExecutionError = class extends Error {
|
|
25
|
+
constructor(message, details) {
|
|
26
|
+
super(message);
|
|
27
|
+
__publicField(this, "stdout");
|
|
28
|
+
__publicField(this, "stderr");
|
|
29
|
+
__publicField(this, "exitCode");
|
|
30
|
+
this.name = "ToolExecutionError";
|
|
31
|
+
this.stdout = details.stdout;
|
|
32
|
+
this.stderr = details.stderr;
|
|
33
|
+
this.exitCode = details.exitCode;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function createToolError(toolName, args, exitCode, stderr3, stdout = "") {
|
|
37
|
+
const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
|
|
38
|
+
const stderrStr = truncate(stderr3.trim(), MAX_STDERR_LENGTH);
|
|
39
|
+
const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
|
|
40
|
+
if (argsStr.length > 0) {
|
|
41
|
+
parts.push(`args: ${argsStr}`);
|
|
42
|
+
}
|
|
43
|
+
if (stderrStr.length > 0) {
|
|
44
|
+
parts.push(`stderr: ${stderrStr}`);
|
|
45
|
+
}
|
|
46
|
+
return new ToolExecutionError(parts.join(" | "), { stdout, stderr: stderr3, exitCode });
|
|
47
|
+
}
|
|
48
|
+
function createValidationError(toolName, zodError) {
|
|
49
|
+
const parts = [];
|
|
50
|
+
for (let i = 0; i < zodError.issues.length; i++) {
|
|
51
|
+
const issue = zodError.issues[i];
|
|
52
|
+
if (issue === void 0) continue;
|
|
53
|
+
const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
|
|
54
|
+
parts.push(`${path}: ${issue.message}`);
|
|
55
|
+
}
|
|
56
|
+
const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
|
|
57
|
+
return new Error(`${toolName}: invalid options \u2014 ${detail}`);
|
|
58
|
+
}
|
|
12
59
|
|
|
13
60
|
// src/types.ts
|
|
14
61
|
function ok(value) {
|
|
@@ -204,39 +251,6 @@ function resolveBinary(toolName) {
|
|
|
204
251
|
return ok(join(pathResult.value, binaryName2));
|
|
205
252
|
}
|
|
206
253
|
|
|
207
|
-
// src/tools/_toolError.ts
|
|
208
|
-
var MAX_ARGS_LENGTH = 200;
|
|
209
|
-
var MAX_STDERR_LENGTH = 500;
|
|
210
|
-
function truncate(value, maxLength) {
|
|
211
|
-
if (value.length <= maxLength) {
|
|
212
|
-
return value;
|
|
213
|
-
}
|
|
214
|
-
return `${value.substring(0, maxLength)}...`;
|
|
215
|
-
}
|
|
216
|
-
function createToolError(toolName, args, exitCode, stderr3) {
|
|
217
|
-
const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
|
|
218
|
-
const stderrStr = truncate(stderr3.trim(), MAX_STDERR_LENGTH);
|
|
219
|
-
const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
|
|
220
|
-
if (argsStr.length > 0) {
|
|
221
|
-
parts.push(`args: ${argsStr}`);
|
|
222
|
-
}
|
|
223
|
-
if (stderrStr.length > 0) {
|
|
224
|
-
parts.push(`stderr: ${stderrStr}`);
|
|
225
|
-
}
|
|
226
|
-
return new Error(parts.join(" | "));
|
|
227
|
-
}
|
|
228
|
-
function createValidationError(toolName, zodError) {
|
|
229
|
-
const parts = [];
|
|
230
|
-
for (let i = 0; i < zodError.issues.length; i++) {
|
|
231
|
-
const issue = zodError.issues[i];
|
|
232
|
-
if (issue === void 0) continue;
|
|
233
|
-
const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
|
|
234
|
-
parts.push(`${path}: ${issue.message}`);
|
|
235
|
-
}
|
|
236
|
-
const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
|
|
237
|
-
return new Error(`${toolName}: invalid options \u2014 ${detail}`);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
254
|
// src/tools/dcm2xml.ts
|
|
241
255
|
var Dcm2xmlCharset = {
|
|
242
256
|
/** Use UTF-8 encoding (default). */
|
|
@@ -620,15 +634,17 @@ async function dcm2json(inputPath, options) {
|
|
|
620
634
|
}
|
|
621
635
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
622
636
|
const signal = options?.signal;
|
|
637
|
+
const startTime = Date.now();
|
|
638
|
+
const remaining = () => Math.max(1e3, timeoutMs - (Date.now() - startTime));
|
|
623
639
|
const verbosity = options?.verbosity;
|
|
624
640
|
if (options?.directOnly === true) {
|
|
625
|
-
return tryDirectPath(inputPath,
|
|
641
|
+
return tryDirectPath(inputPath, remaining(), signal, verbosity);
|
|
626
642
|
}
|
|
627
|
-
const xmlResult = await tryXmlPath(inputPath,
|
|
643
|
+
const xmlResult = await tryXmlPath(inputPath, remaining(), signal, buildXmlOpts(options));
|
|
628
644
|
if (xmlResult.ok) {
|
|
629
645
|
return xmlResult;
|
|
630
646
|
}
|
|
631
|
-
return tryDirectPath(inputPath,
|
|
647
|
+
return tryDirectPath(inputPath, remaining(), signal, verbosity);
|
|
632
648
|
}
|
|
633
649
|
var DcmdumpFormat = {
|
|
634
650
|
/** Print standard DCMTK format. */
|
|
@@ -2356,7 +2372,7 @@ async function dcmsend(options) {
|
|
|
2356
2372
|
return err(result.error);
|
|
2357
2373
|
}
|
|
2358
2374
|
if (result.value.exitCode !== 0) {
|
|
2359
|
-
return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr));
|
|
2375
|
+
return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr, result.value.stdout));
|
|
2360
2376
|
}
|
|
2361
2377
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
2362
2378
|
}
|
|
@@ -2511,10 +2527,10 @@ async function storescu(options) {
|
|
|
2511
2527
|
return err(result.error);
|
|
2512
2528
|
}
|
|
2513
2529
|
if (result.value.exitCode !== 0) {
|
|
2514
|
-
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
|
|
2530
|
+
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr, result.value.stdout));
|
|
2515
2531
|
}
|
|
2516
2532
|
if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
|
|
2517
|
-
return err(createToolError("storescu", args, 0, result.value.stderr));
|
|
2533
|
+
return err(createToolError("storescu", args, 0, result.value.stderr, result.value.stdout));
|
|
2518
2534
|
}
|
|
2519
2535
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
2520
2536
|
}
|
|
@@ -3406,6 +3422,6 @@ async function dcmmklut(outputPath, options) {
|
|
|
3406
3422
|
return ok({ outputPath });
|
|
3407
3423
|
}
|
|
3408
3424
|
|
|
3409
|
-
export { ColorConversion, Dcm2pnmOutputFormat, Dcm2xmlCharset, DcmdumpFormat, Dcmj2pnmOutputFormat, GetQueryModel, Img2dcmInputFormat, JplsColorConversion, LutType, MoveQueryModel, ProposedTransferSyntax, QueryModel, TransferSyntax, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmodify, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
|
3425
|
+
export { ColorConversion, Dcm2pnmOutputFormat, Dcm2xmlCharset, DcmdumpFormat, Dcmj2pnmOutputFormat, GetQueryModel, Img2dcmInputFormat, JplsColorConversion, LutType, MoveQueryModel, ProposedTransferSyntax, QueryModel, ToolExecutionError, TransferSyntax, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmodify, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
|
|
3410
3426
|
//# sourceMappingURL=tools.js.map
|
|
3411
3427
|
//# sourceMappingURL=tools.js.map
|