@ubercode/dcmtk 0.7.2 → 0.7.3

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 CHANGED
@@ -33225,7 +33225,18 @@ var ProposedTransferSyntax = {
33225
33225
  J2K_LOSSLESS: "j2kLossless",
33226
33226
  J2K_LOSSY: "j2kLossy",
33227
33227
  JLS_LOSSLESS: "jlsLossless",
33228
- JLS_LOSSY: "jlsLossy"
33228
+ JLS_LOSSY: "jlsLossy",
33229
+ MPEG2: "mpeg2",
33230
+ MPEG2_HIGH: "mpeg2High",
33231
+ MPEG4: "mpeg4",
33232
+ MPEG4_BD: "mpeg4Bd",
33233
+ MPEG4_2_2D: "mpeg4_2_2d",
33234
+ MPEG4_2_3D: "mpeg4_2_3d",
33235
+ MPEG4_2_ST: "mpeg4_2_st",
33236
+ HEVC: "hevc",
33237
+ HEVC10: "hevc10",
33238
+ RLE: "rle",
33239
+ DEFLATED: "deflated"
33229
33240
  };
33230
33241
  var PROPOSED_TS_FLAG_MAP = {
33231
33242
  [ProposedTransferSyntax.UNCOMPRESSED]: "-x=",
@@ -33238,8 +33249,20 @@ var PROPOSED_TS_FLAG_MAP = {
33238
33249
  [ProposedTransferSyntax.J2K_LOSSLESS]: "-xv",
33239
33250
  [ProposedTransferSyntax.J2K_LOSSY]: "-xw",
33240
33251
  [ProposedTransferSyntax.JLS_LOSSLESS]: "-xt",
33241
- [ProposedTransferSyntax.JLS_LOSSY]: "-xu"
33252
+ [ProposedTransferSyntax.JLS_LOSSY]: "-xu",
33253
+ [ProposedTransferSyntax.MPEG2]: "-xm",
33254
+ [ProposedTransferSyntax.MPEG2_HIGH]: "-xh",
33255
+ [ProposedTransferSyntax.MPEG4]: "-xn",
33256
+ [ProposedTransferSyntax.MPEG4_BD]: "-xl",
33257
+ [ProposedTransferSyntax.MPEG4_2_2D]: "-x2",
33258
+ [ProposedTransferSyntax.MPEG4_2_3D]: "-x3",
33259
+ [ProposedTransferSyntax.MPEG4_2_ST]: "-xo",
33260
+ [ProposedTransferSyntax.HEVC]: "-x4",
33261
+ [ProposedTransferSyntax.HEVC10]: "-x5",
33262
+ [ProposedTransferSyntax.RLE]: "-xr",
33263
+ [ProposedTransferSyntax.DEFLATED]: "-xd"
33242
33264
  };
33265
+ var PROPOSED_TS_VALUES = Object.values(ProposedTransferSyntax);
33243
33266
  var StorescuOptionsSchema = zod.z.object({
33244
33267
  timeoutMs: zod.z.number().int().positive().optional(),
33245
33268
  signal: zod.z.instanceof(AbortSignal).optional(),
@@ -33258,20 +33281,18 @@ var StorescuOptionsSchema = zod.z.object({
33258
33281
  dimseTimeout: zod.z.number().int().positive().optional(),
33259
33282
  noHostnameLookup: zod.z.boolean().optional(),
33260
33283
  required: zod.z.boolean().optional(),
33261
- proposedTransferSyntax: zod.z.enum([
33262
- "uncompressed",
33263
- "littleEndian",
33264
- "bigEndian",
33265
- "implicitVR",
33266
- "jpegLossless",
33267
- "jpeg8Bit",
33268
- "jpeg12Bit",
33269
- "j2kLossless",
33270
- "j2kLossy",
33271
- "jlsLossless",
33272
- "jlsLossy"
33273
- ]).optional()
33284
+ proposedTransferSyntax: zod.z.union([zod.z.enum(PROPOSED_TS_VALUES), zod.z.array(zod.z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
33285
+ combineProposedTransferSyntaxes: zod.z.boolean().optional()
33274
33286
  }).strict();
33287
+ function pushProposedTsArgs(args, ts) {
33288
+ if (typeof ts === "string") {
33289
+ args.push(PROPOSED_TS_FLAG_MAP[ts]);
33290
+ } else {
33291
+ for (let i = 0; i < ts.length; i++) {
33292
+ args.push(PROPOSED_TS_FLAG_MAP[ts[i]]);
33293
+ }
33294
+ }
33295
+ }
33275
33296
  var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
33276
33297
  var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
33277
33298
  function pushNetworkArgs3(args, options) {
@@ -33313,7 +33334,10 @@ function buildArgs34(options) {
33313
33334
  args.push("+r");
33314
33335
  }
33315
33336
  if (options.proposedTransferSyntax !== void 0) {
33316
- args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
33337
+ pushProposedTsArgs(args, options.proposedTransferSyntax);
33338
+ }
33339
+ if (options.combineProposedTransferSyntaxes === true) {
33340
+ args.push("+C");
33317
33341
  }
33318
33342
  if (options.required === true) {
33319
33343
  args.push("-R");
@@ -36871,19 +36895,8 @@ var DicomSenderOptionsSchema = zod.z.object({
36871
36895
  callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
36872
36896
  mode: zod.z.enum(["single", "multiple", "bucket"]).optional(),
36873
36897
  maxAssociations: zod.z.number().int().min(1).max(MAX_ASSOCIATIONS_LIMIT).optional(),
36874
- proposedTransferSyntax: zod.z.enum([
36875
- "uncompressed",
36876
- "littleEndian",
36877
- "bigEndian",
36878
- "implicitVR",
36879
- "jpegLossless",
36880
- "jpeg8Bit",
36881
- "jpeg12Bit",
36882
- "j2kLossless",
36883
- "j2kLossy",
36884
- "jlsLossless",
36885
- "jlsLossy"
36886
- ]).optional(),
36898
+ proposedTransferSyntax: zod.z.union([zod.z.enum(PROPOSED_TS_VALUES), zod.z.array(zod.z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
36899
+ combineProposedTransferSyntaxes: zod.z.boolean().optional(),
36887
36900
  maxQueueLength: zod.z.number().int().min(1).optional(),
36888
36901
  timeoutMs: zod.z.number().int().positive().optional(),
36889
36902
  maxRetries: zod.z.number().int().min(0).optional(),
@@ -36996,14 +37009,19 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
36996
37009
  if (files.length === 0) {
36997
37010
  return Promise.resolve(err(new Error("DicomSender: no files provided")));
36998
37011
  }
36999
- const params = {
37012
+ return this.dispatchSend(files, this.buildSendParams(options));
37013
+ }
37014
+ /** Builds SendParams from per-send options, applying instance defaults. */
37015
+ buildSendParams(options) {
37016
+ return {
37000
37017
  timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
37001
37018
  maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
37002
37019
  calledAETitle: options?.calledAETitle,
37003
37020
  callingAETitle: options?.callingAETitle,
37004
- required: options?.required
37021
+ required: options?.required,
37022
+ proposedTransferSyntax: options?.proposedTransferSyntax,
37023
+ combineProposedTransferSyntaxes: options?.combineProposedTransferSyntaxes
37005
37024
  };
37006
- return this.dispatchSend(files, params);
37007
37025
  }
37008
37026
  /** Dispatches a send to the appropriate mode handler. */
37009
37027
  dispatchSend(files, params) {
@@ -37121,6 +37139,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
37121
37139
  calledAETitle: params.calledAETitle,
37122
37140
  callingAETitle: params.callingAETitle,
37123
37141
  required: params.required,
37142
+ proposedTransferSyntax: params.proposedTransferSyntax,
37143
+ combineProposedTransferSyntaxes: params.combineProposedTransferSyntaxes,
37124
37144
  resolve
37125
37145
  };
37126
37146
  if (this.activeAssociations < this.effectiveMaxAssociations) {
@@ -37149,8 +37169,18 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
37149
37169
  resolve(err(new Error("DicomSender: queue full")));
37150
37170
  return;
37151
37171
  }
37152
- const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required } = params;
37153
- this.currentBucket.push({ files, resolve, timeoutMs, maxRetries, calledAETitle, callingAETitle, required });
37172
+ const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required, proposedTransferSyntax, combineProposedTransferSyntaxes } = params;
37173
+ this.currentBucket.push({
37174
+ files,
37175
+ resolve,
37176
+ timeoutMs,
37177
+ maxRetries,
37178
+ calledAETitle,
37179
+ callingAETitle,
37180
+ required,
37181
+ proposedTransferSyntax,
37182
+ combineProposedTransferSyntaxes
37183
+ });
37154
37184
  const totalFiles = this.countBucketFiles();
37155
37185
  if (totalFiles >= this.maxBucketSize) {
37156
37186
  this.clearBucketTimer();
@@ -37187,6 +37217,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
37187
37217
  calledAETitle: entries[0]?.calledAETitle,
37188
37218
  callingAETitle: entries[0]?.callingAETitle,
37189
37219
  required: entries[0]?.required,
37220
+ proposedTransferSyntax: entries[0]?.proposedTransferSyntax,
37221
+ combineProposedTransferSyntaxes: entries[0]?.combineProposedTransferSyntaxes,
37190
37222
  resolve: (result) => {
37191
37223
  for (let i = 0; i < entries.length; i++) {
37192
37224
  entries[i].resolve(result);
@@ -37274,7 +37306,8 @@ var DicomSender = class _DicomSender extends events.EventEmitter {
37274
37306
  files: [...entry.files],
37275
37307
  calledAETitle: entry.calledAETitle ?? this.options.calledAETitle,
37276
37308
  callingAETitle: entry.callingAETitle ?? this.options.callingAETitle,
37277
- proposedTransferSyntax: this.options.proposedTransferSyntax,
37309
+ proposedTransferSyntax: entry.proposedTransferSyntax ?? this.options.proposedTransferSyntax,
37310
+ combineProposedTransferSyntaxes: entry.combineProposedTransferSyntaxes ?? this.options.combineProposedTransferSyntaxes,
37278
37311
  maxPduReceive: this.options.maxPduReceive,
37279
37312
  maxPduSend: this.options.maxPduSend,
37280
37313
  associationTimeout: this.options.associationTimeout,