dsh-db-tool 1.9.1 → 1.9.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.
@@ -39883,206 +39883,17 @@ var require_transient_error_lookup = __commonJS({
39883
39883
  }
39884
39884
  });
39885
39885
 
39886
- // node_modules/sprintf-js/src/sprintf.js
39887
- var require_sprintf = __commonJS({
39888
- "node_modules/sprintf-js/src/sprintf.js"(exports2) {
39889
- !(function() {
39890
- "use strict";
39891
- var re = {
39892
- not_string: /[^s]/,
39893
- not_bool: /[^t]/,
39894
- not_type: /[^T]/,
39895
- not_primitive: /[^v]/,
39896
- number: /[diefg]/,
39897
- numeric_arg: /[bcdiefguxX]/,
39898
- json: /[j]/,
39899
- not_json: /[^j]/,
39900
- text: /^[^\x25]+/,
39901
- modulo: /^\x25{2}/,
39902
- placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
39903
- key: /^([a-z_][a-z_\d]*)/i,
39904
- key_access: /^\.([a-z_][a-z_\d]*)/i,
39905
- index_access: /^\[(\d+)\]/,
39906
- sign: /^[+-]/
39907
- };
39908
- function sprintf(key) {
39909
- return sprintf_format(sprintf_parse(key), arguments);
39910
- }
39911
- function vsprintf(fmt, argv) {
39912
- return sprintf.apply(null, [fmt].concat(argv || []));
39913
- }
39914
- function sprintf_format(parse_tree, argv) {
39915
- var cursor = 1, tree_length = parse_tree.length, arg, output = "", i, k, ph, pad, pad_character, pad_length, is_positive, sign;
39916
- for (i = 0; i < tree_length; i++) {
39917
- if (typeof parse_tree[i] === "string") {
39918
- output += parse_tree[i];
39919
- } else if (typeof parse_tree[i] === "object") {
39920
- ph = parse_tree[i];
39921
- if (ph.keys) {
39922
- arg = argv[cursor];
39923
- for (k = 0; k < ph.keys.length; k++) {
39924
- if (arg == void 0) {
39925
- throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k - 1]));
39926
- }
39927
- arg = arg[ph.keys[k]];
39928
- }
39929
- } else if (ph.param_no) {
39930
- arg = argv[ph.param_no];
39931
- } else {
39932
- arg = argv[cursor++];
39933
- }
39934
- if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
39935
- arg = arg();
39936
- }
39937
- if (re.numeric_arg.test(ph.type) && (typeof arg !== "number" && isNaN(arg))) {
39938
- throw new TypeError(sprintf("[sprintf] expecting number but found %T", arg));
39939
- }
39940
- if (re.number.test(ph.type)) {
39941
- is_positive = arg >= 0;
39942
- }
39943
- switch (ph.type) {
39944
- case "b":
39945
- arg = parseInt(arg, 10).toString(2);
39946
- break;
39947
- case "c":
39948
- arg = String.fromCharCode(parseInt(arg, 10));
39949
- break;
39950
- case "d":
39951
- case "i":
39952
- arg = parseInt(arg, 10);
39953
- break;
39954
- case "j":
39955
- arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);
39956
- break;
39957
- case "e":
39958
- arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();
39959
- break;
39960
- case "f":
39961
- arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);
39962
- break;
39963
- case "g":
39964
- arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);
39965
- break;
39966
- case "o":
39967
- arg = (parseInt(arg, 10) >>> 0).toString(8);
39968
- break;
39969
- case "s":
39970
- arg = String(arg);
39971
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39972
- break;
39973
- case "t":
39974
- arg = String(!!arg);
39975
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39976
- break;
39977
- case "T":
39978
- arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
39979
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39980
- break;
39981
- case "u":
39982
- arg = parseInt(arg, 10) >>> 0;
39983
- break;
39984
- case "v":
39985
- arg = arg.valueOf();
39986
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39987
- break;
39988
- case "x":
39989
- arg = (parseInt(arg, 10) >>> 0).toString(16);
39990
- break;
39991
- case "X":
39992
- arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();
39993
- break;
39994
- }
39995
- if (re.json.test(ph.type)) {
39996
- output += arg;
39997
- } else {
39998
- if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
39999
- sign = is_positive ? "+" : "-";
40000
- arg = arg.toString().replace(re.sign, "");
40001
- } else {
40002
- sign = "";
40003
- }
40004
- pad_character = ph.pad_char ? ph.pad_char === "0" ? "0" : ph.pad_char.charAt(1) : " ";
40005
- pad_length = ph.width - (sign + arg).length;
40006
- pad = ph.width ? pad_length > 0 ? pad_character.repeat(pad_length) : "" : "";
40007
- output += ph.align ? sign + arg + pad : pad_character === "0" ? sign + pad + arg : pad + sign + arg;
40008
- }
40009
- }
40010
- }
40011
- return output;
40012
- }
40013
- var sprintf_cache = /* @__PURE__ */ Object.create(null);
40014
- function sprintf_parse(fmt) {
40015
- if (sprintf_cache[fmt]) {
40016
- return sprintf_cache[fmt];
40017
- }
40018
- var _fmt = fmt, match, parse_tree = [], arg_names = 0;
40019
- while (_fmt) {
40020
- if ((match = re.text.exec(_fmt)) !== null) {
40021
- parse_tree.push(match[0]);
40022
- } else if ((match = re.modulo.exec(_fmt)) !== null) {
40023
- parse_tree.push("%");
40024
- } else if ((match = re.placeholder.exec(_fmt)) !== null) {
40025
- if (match[2]) {
40026
- arg_names |= 1;
40027
- var field_list = [], replacement_field = match[2], field_match = [];
40028
- if ((field_match = re.key.exec(replacement_field)) !== null) {
40029
- field_list.push(field_match[1]);
40030
- while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
40031
- if ((field_match = re.key_access.exec(replacement_field)) !== null) {
40032
- field_list.push(field_match[1]);
40033
- } else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
40034
- field_list.push(field_match[1]);
40035
- } else {
40036
- throw new SyntaxError("[sprintf] failed to parse named argument key");
40037
- }
40038
- }
40039
- } else {
40040
- throw new SyntaxError("[sprintf] failed to parse named argument key");
40041
- }
40042
- match[2] = field_list;
40043
- } else {
40044
- arg_names |= 2;
40045
- }
40046
- if (arg_names === 3) {
40047
- throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
40048
- }
40049
- parse_tree.push(
40050
- {
40051
- placeholder: match[0],
40052
- param_no: match[1],
40053
- keys: match[2],
40054
- sign: match[3],
40055
- pad_char: match[4],
40056
- align: match[5],
40057
- width: match[6],
40058
- precision: match[7],
40059
- type: match[8]
40060
- }
40061
- );
40062
- } else {
40063
- throw new SyntaxError("[sprintf] unexpected placeholder");
40064
- }
40065
- _fmt = _fmt.substring(match[0].length);
40066
- }
40067
- return sprintf_cache[fmt] = parse_tree;
40068
- }
40069
- if (typeof exports2 !== "undefined") {
40070
- exports2["sprintf"] = sprintf;
40071
- exports2["vsprintf"] = vsprintf;
40072
- }
40073
- if (typeof window !== "undefined") {
40074
- window["sprintf"] = sprintf;
40075
- window["vsprintf"] = vsprintf;
40076
- if (typeof define === "function" && define["amd"]) {
40077
- define(function() {
40078
- return {
40079
- "sprintf": sprintf,
40080
- "vsprintf": vsprintf
40081
- };
40082
- });
40083
- }
40084
- }
40085
- })();
39886
+ // node_modules/tedious/lib/format-hex.js
39887
+ var require_format_hex = __commonJS({
39888
+ "node_modules/tedious/lib/format-hex.js"(exports2) {
39889
+ "use strict";
39890
+ Object.defineProperty(exports2, "__esModule", {
39891
+ value: true
39892
+ });
39893
+ exports2.formatHex = formatHex;
39894
+ function formatHex(value, width) {
39895
+ return (value >>> 0).toString(16).toUpperCase().padStart(width, "0");
39896
+ }
40086
39897
  }
40087
39898
  });
40088
39899
 
@@ -40096,7 +39907,7 @@ var require_packet = __commonJS({
40096
39907
  exports2.TYPE = exports2.Packet = exports2.OFFSET = exports2.HEADER_LENGTH = void 0;
40097
39908
  exports2.isPacketComplete = isPacketComplete;
40098
39909
  exports2.packetLength = packetLength;
40099
- var _sprintfJs = require_sprintf();
39910
+ var _formatHex = require_format_hex();
40100
39911
  var HEADER_LENGTH = exports2.HEADER_LENGTH = 8;
40101
39912
  var TYPE = exports2.TYPE = {
40102
39913
  SQL_BATCH: 1,
@@ -40218,7 +40029,8 @@ var require_packet = __commonJS({
40218
40029
  return statuses.join(" ").trim();
40219
40030
  }
40220
40031
  headerToString(indent = "") {
40221
- const text = (0, _sprintfJs.sprintf)("type:0x%02X(%s), status:0x%02X(%s), length:0x%04X, spid:0x%04X, packetId:0x%02X, window:0x%02X", this.buffer.readUInt8(OFFSET.Type), typeByValue[this.buffer.readUInt8(OFFSET.Type)], this.buffer.readUInt8(OFFSET.Status), this.statusAsString(), this.buffer.readUInt16BE(OFFSET.Length), this.buffer.readUInt16BE(OFFSET.SPID), this.buffer.readUInt8(OFFSET.PacketID), this.buffer.readUInt8(OFFSET.Window));
40032
+ const type = this.buffer.readUInt8(OFFSET.Type);
40033
+ const text = `type:0x${(0, _formatHex.formatHex)(type, 2)}(${typeByValue[type]}), status:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.Status), 2)}(${this.statusAsString()}), length:0x${(0, _formatHex.formatHex)(this.buffer.readUInt16BE(OFFSET.Length), 4)}, spid:0x${(0, _formatHex.formatHex)(this.buffer.readUInt16BE(OFFSET.SPID), 4)}, packetId:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.PacketID), 2)}, window:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.Window), 2)}`;
40222
40034
  return indent + text;
40223
40035
  }
40224
40036
  dataToString(indent = "") {
@@ -40231,7 +40043,7 @@ var require_packet = __commonJS({
40231
40043
  for (let offset = 0; offset < data.length; offset++) {
40232
40044
  if (offset % BYTES_PER_LINE === 0) {
40233
40045
  dataDump += indent;
40234
- dataDump += (0, _sprintfJs.sprintf)("%04X ", offset);
40046
+ dataDump += (0, _formatHex.formatHex)(offset, 4) + " ";
40235
40047
  }
40236
40048
  if (data[offset] < 32 || data[offset] > 126) {
40237
40049
  chars += ".";
@@ -40242,7 +40054,7 @@ var require_packet = __commonJS({
40242
40054
  chars += String.fromCharCode(data[offset]);
40243
40055
  }
40244
40056
  if (data[offset] != null) {
40245
- dataDump += (0, _sprintfJs.sprintf)("%02X", data[offset]);
40057
+ dataDump += (0, _formatHex.formatHex)(data[offset], 2);
40246
40058
  }
40247
40059
  if ((offset + 1) % BYTES_PER_GROUP === 0 && !((offset + 1) % BYTES_PER_LINE === 0)) {
40248
40060
  dataDump += " ";
@@ -40289,7 +40101,8 @@ var require_prelogin_payload = __commonJS({
40289
40101
  value: true
40290
40102
  });
40291
40103
  exports2.default = void 0;
40292
- var _sprintfJs = require_sprintf();
40104
+ var _errors = require_errors();
40105
+ var _formatHex = require_format_hex();
40293
40106
  var _writableTrackingBuffer = _interopRequireDefault(require_writable_tracking_buffer());
40294
40107
  var _crypto = require("crypto");
40295
40108
  function _interopRequireDefault(e) {
@@ -40440,6 +40253,7 @@ var require_prelogin_payload = __commonJS({
40440
40253
  }
40441
40254
  extractOptions() {
40442
40255
  let offset = 0;
40256
+ let encryptionOffset;
40443
40257
  while (this.data[offset] !== TOKEN.TERMINATOR) {
40444
40258
  let dataOffset = this.data.readUInt16BE(offset + 1);
40445
40259
  const dataLength = this.data.readUInt16BE(offset + 3);
@@ -40448,6 +40262,13 @@ var require_prelogin_payload = __commonJS({
40448
40262
  this.extractVersion(dataOffset);
40449
40263
  break;
40450
40264
  case TOKEN.ENCRYPTION:
40265
+ if (encryptionOffset !== void 0) {
40266
+ throw new _errors.ConnectionError("Duplicate ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40267
+ }
40268
+ if (dataLength !== 1 || dataOffset >= this.data.length) {
40269
+ throw new _errors.ConnectionError("Malformed ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40270
+ }
40271
+ encryptionOffset = dataOffset;
40451
40272
  this.extractEncryption(dataOffset);
40452
40273
  break;
40453
40274
  case TOKEN.INSTOPT:
@@ -40471,6 +40292,9 @@ var require_prelogin_payload = __commonJS({
40471
40292
  offset += 5;
40472
40293
  dataOffset += dataLength;
40473
40294
  }
40295
+ if (encryptionOffset !== void 0 && encryptionOffset <= offset) {
40296
+ throw new _errors.ConnectionError("Malformed ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40297
+ }
40474
40298
  }
40475
40299
  extractVersion(offset) {
40476
40300
  this.version = {
@@ -40501,7 +40325,13 @@ var require_prelogin_payload = __commonJS({
40501
40325
  this.fedAuthRequired = this.data.readUInt8(offset);
40502
40326
  }
40503
40327
  toString(indent = "") {
40504
- return indent + "PreLogin - " + (0, _sprintfJs.sprintf)("version:%d.%d.%d.%d, encryption:0x%02X(%s), instopt:0x%02X, threadId:0x%08X, mars:0x%02X(%s), traceId:%s", this.version.major, this.version.minor, this.version.build, this.version.subbuild, this.encryption ? this.encryption : 0, this.encryptionString ? this.encryptionString : "", this.instance ? this.instance : 0, this.threadId ? this.threadId : 0, this.mars ? this.mars : 0, this.marsString ? this.marsString : "", this.traceId ? this.traceId.toString("hex") : "");
40328
+ const {
40329
+ major,
40330
+ minor,
40331
+ build,
40332
+ subbuild
40333
+ } = this.version;
40334
+ return indent + `PreLogin - version:${major}.${minor}.${build}.${subbuild}, encryption:0x${(0, _formatHex.formatHex)(this.encryption ? this.encryption : 0, 2)}(${this.encryptionString ? this.encryptionString : ""}), instopt:0x${(0, _formatHex.formatHex)(this.instance ? this.instance : 0, 2)}, threadId:0x${(0, _formatHex.formatHex)(this.threadId ? this.threadId : 0, 8)}, mars:0x${(0, _formatHex.formatHex)(this.mars ? this.mars : 0, 2)}(${this.marsString ? this.marsString : ""}), traceId:${this.traceId ? this.traceId.toString("hex") : ""}`;
40505
40335
  }
40506
40336
  };
40507
40337
  var _default = exports2.default = PreloginPayload;
@@ -40540,7 +40370,7 @@ var require_login7_payload = __commonJS({
40540
40370
  value: true
40541
40371
  });
40542
40372
  exports2.default = void 0;
40543
- var _sprintfJs = require_sprintf();
40373
+ var _formatHex = require_format_hex();
40544
40374
  var _tdsVersions = require_tds_versions();
40545
40375
  var FLAGS_1 = {
40546
40376
  ENDIAN_LITTLE: 0,
@@ -40858,9 +40688,15 @@ var require_login7_payload = __commonJS({
40858
40688
  return password;
40859
40689
  }
40860
40690
  toString(indent = "") {
40861
- return indent + "Login7 - " + (0, _sprintfJs.sprintf)("TDS:0x%08X, PacketSize:0x%08X, ClientProgVer:0x%08X, ClientPID:0x%08X, ConnectionID:0x%08X", this.tdsVersion, this.packetSize, this.clientProgVer, this.clientPid, this.connectionId) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Flags1:0x%02X, Flags2:0x%02X, TypeFlags:0x%02X, Flags3:0x%02X, ClientTimezone:%d, ClientLCID:0x%08X", this.buildOptionFlags1(), this.buildOptionFlags2(), this.buildTypeFlags(), this.buildOptionFlags3(), this.clientTimeZone, this.clientLcid) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Hostname:'%s', Username:'%s', Password:'%s', AppName:'%s', ServerName:'%s', LibraryName:'%s'", this.hostname, this.userName, this.password, this.appName, this.serverName, this.libraryName) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Language:'%s', Database:'%s', SSPI:'%s', AttachDbFile:'%s', ChangePassword:'%s'", this.language, this.database, this.sspi, this.attachDbFile, this.changePassword);
40691
+ return indent + `Login7 - TDS:0x${(0, _formatHex.formatHex)(this.tdsVersion, 8)}, PacketSize:0x${(0, _formatHex.formatHex)(this.packetSize, 8)}, ClientProgVer:0x${(0, _formatHex.formatHex)(this.clientProgVer, 8)}, ClientPID:0x${(0, _formatHex.formatHex)(this.clientPid, 8)}, ConnectionID:0x${(0, _formatHex.formatHex)(this.connectionId, 8)}
40692
+ ` + indent + ` Flags1:0x${(0, _formatHex.formatHex)(this.buildOptionFlags1(), 2)}, Flags2:0x${(0, _formatHex.formatHex)(this.buildOptionFlags2(), 2)}, TypeFlags:0x${(0, _formatHex.formatHex)(this.buildTypeFlags(), 2)}, Flags3:0x${(0, _formatHex.formatHex)(this.buildOptionFlags3(), 2)}, ClientTimezone:${this.clientTimeZone}, ClientLCID:0x${(0, _formatHex.formatHex)(this.clientLcid, 8)}
40693
+ ` + indent + ` Hostname:'${this.hostname}', Username:'${this.userName}', Password:'${redact(this.password)}', AppName:'${this.appName}', ServerName:'${this.serverName}', LibraryName:'${this.libraryName}'
40694
+ ` + indent + ` Language:'${this.language}', Database:'${this.database}', SSPI:'${this.sspi}', AttachDbFile:'${this.attachDbFile}', ChangePassword:'${redact(this.changePassword)}'`;
40862
40695
  }
40863
40696
  };
40697
+ function redact(value) {
40698
+ return value === void 0 ? "undefined" : "********";
40699
+ }
40864
40700
  var _default = exports2.default = Login7Payload;
40865
40701
  module2.exports = Login7Payload;
40866
40702
  }
@@ -56949,19 +56785,24 @@ var require_plp_stream = __commonJS({
56949
56785
  }
56950
56786
  buffer.writeBuffer(PLP_TERMINATOR);
56951
56787
  }
56952
- async function* writePlpStream(buffer, source, encode) {
56788
+ async function* writePlpStream(buffer, source, encode, flush) {
56953
56789
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
56954
- for await (const chunk of source) {
56955
- const bytes = encode(chunk);
56956
- if (bytes.length === 0) {
56957
- continue;
56790
+ const writeChunk = (bytes) => {
56791
+ if (!bytes || bytes.length === 0) {
56792
+ return false;
56958
56793
  }
56959
56794
  buffer.writeUInt32LE(bytes.length);
56960
56795
  buffer.writeBuffer(bytes);
56961
- if (buffer.length >= _writableTrackingBuffer.default.CHUNK_SIZE) {
56796
+ return buffer.length >= _writableTrackingBuffer.default.CHUNK_SIZE;
56797
+ };
56798
+ for await (const chunk of source) {
56799
+ if (writeChunk(encode(chunk))) {
56962
56800
  yield;
56963
56801
  }
56964
56802
  }
56803
+ if (writeChunk(flush?.())) {
56804
+ yield;
56805
+ }
56965
56806
  buffer.writeBuffer(PLP_TERMINATOR);
56966
56807
  }
56967
56808
  }
@@ -57041,7 +56882,8 @@ var require_varbinary = __commonJS({
57041
56882
  }
57042
56883
  const value = Buffer.isBuffer(parameter.value) ? parameter.value : parameter.value.toString();
57043
56884
  const length = typeof value === "string" ? value.length * 2 : value.length;
57044
- if (parameter.length <= this.maximumLength) {
56885
+ const isPlp = !(parameter.length <= this.maximumLength);
56886
+ if (!isPlp) {
57045
56887
  buffer.writeUInt16LE(length);
57046
56888
  } else {
57047
56889
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
@@ -57056,7 +56898,7 @@ var require_varbinary = __commonJS({
57056
56898
  } else {
57057
56899
  buffer.writeBuffer(value);
57058
56900
  }
57059
- if (parameter.length > this.maximumLength) {
56901
+ if (isPlp) {
57060
56902
  buffer.writeBuffer(PLP_TERMINATOR);
57061
56903
  }
57062
56904
  },
@@ -57109,14 +56951,6 @@ var require_varchar = __commonJS({
57109
56951
  var NULL_LENGTH = Buffer.from([255, 255]);
57110
56952
  var MAX_NULL_LENGTH = Buffer.from([255, 255, 255, 255, 255, 255, 255, 255]);
57111
56953
  var NO_COLLATION = Buffer.from([0, 0, 0, 0, 0]);
57112
- function encoderFor(codepage) {
57113
- return (chunk) => {
57114
- if (typeof chunk !== "string") {
57115
- throw new TypeError("Invalid string.");
57116
- }
57117
- return _iconvLite.default.encode(chunk, codepage);
57118
- };
57119
- }
57120
56954
  var VarChar = {
57121
56955
  id: 167,
57122
56956
  type: "BIGVARCHR",
@@ -57214,7 +57048,14 @@ var require_varchar = __commonJS({
57214
57048
  return;
57215
57049
  }
57216
57050
  if ((0, _plpStream.isAsyncIterable)(parameter.value)) {
57217
- return (0, _plpStream.writePlpStream)(buffer, parameter.value, encoderFor(parameter.collation.codepage));
57051
+ const codepage = parameter.collation.codepage;
57052
+ const encoder = _iconvLite.default.getEncoder(codepage);
57053
+ return (0, _plpStream.writePlpStream)(buffer, parameter.value, (chunk) => {
57054
+ if (typeof chunk !== "string") {
57055
+ throw new TypeError("Invalid string.");
57056
+ }
57057
+ return encoder.write(chunk);
57058
+ }, () => encoder.end());
57218
57059
  }
57219
57060
  const value = parameter.value;
57220
57061
  if (parameter.length <= this.maximumLength) {
@@ -57465,7 +57306,8 @@ var require_nvarchar = __commonJS({
57465
57306
  }
57466
57307
  const value = parameter.value instanceof Buffer ? parameter.value : parameter.value.toString();
57467
57308
  const length = typeof value === "string" ? value.length * 2 : value.length;
57468
- if (parameter.length <= this.maximumLength) {
57309
+ const isPlp = !(parameter.length <= this.maximumLength);
57310
+ if (!isPlp) {
57469
57311
  buffer.writeUInt16LE(length);
57470
57312
  } else {
57471
57313
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
@@ -57480,7 +57322,7 @@ var require_nvarchar = __commonJS({
57480
57322
  } else {
57481
57323
  buffer.writeBuffer(value);
57482
57324
  }
57483
- if (parameter.length > this.maximumLength) {
57325
+ if (isPlp) {
57484
57326
  buffer.writeBuffer(PLP_TERMINATOR);
57485
57327
  }
57486
57328
  },
@@ -58636,11 +58478,10 @@ var require_request2 = __commonJS({
58636
58478
  * request is being sent, so it does not have to fit in memory, and a
58637
58479
  * request that carries one can be executed only once.
58638
58480
  *
58639
- * Each chunk of a string source is encoded on its own, as `Writable.write`
58640
- * would encode it, so a chunk must not end halfway through a UTF-16
58641
- * surrogate pair. Text that Node.js decoded from UTF-8 (a `Readable` with
58642
- * `encoding: 'utf8'`, `readline`, `TextDecoder`) never does; a string
58643
- * sliced by index can. A `Buffer` chunk of 8 KB or more is sent by
58481
+ * String chunks may split UTF-16 surrogate pairs; the pairs are preserved
58482
+ * across chunk boundaries, including empty chunks. An unpaired surrogate
58483
+ * is handled by the type's encoding as it is for an in-memory value.
58484
+ * A `Buffer` chunk of 8 KB or more is sent by
58644
58485
  * reference, as `socket.write` would send it, so a source must not reuse
58645
58486
  * or modify a buffer it has yielded until the request has completed.
58646
58487
  *
@@ -66825,7 +66666,7 @@ var require_metadata_parser = __commonJS({
66825
66666
  exports2.readMetadata = readMetadata;
66826
66667
  var _collation = require_collation();
66827
66668
  var _dataType = require_data_type();
66828
- var _sprintfJs = require_sprintf();
66669
+ var _formatHex = require_format_hex();
66829
66670
  var _helpers = require_helpers3();
66830
66671
  function readCollation(buf, offset) {
66831
66672
  offset = +offset;
@@ -66918,7 +66759,7 @@ var require_metadata_parser = __commonJS({
66918
66759
  } = (0, _helpers.readUInt8)(buf, offset));
66919
66760
  const type = _dataType.TYPE[typeNumber];
66920
66761
  if (!type) {
66921
- throw new Error((0, _sprintfJs.sprintf)("Unrecognised data type 0x%02X", typeNumber));
66762
+ throw new Error(`Unrecognised data type 0x${(0, _formatHex.formatHex)(typeNumber, 2)}`);
66922
66763
  }
66923
66764
  switch (type.name) {
66924
66765
  case "Null":
@@ -67159,7 +67000,7 @@ var require_metadata_parser = __commonJS({
67159
67000
  }, offset);
67160
67001
  }
67161
67002
  default:
67162
- throw new Error((0, _sprintfJs.sprintf)("Unrecognised type %s", type.name));
67003
+ throw new Error(`Unrecognised type ${type.name}`);
67163
67004
  }
67164
67005
  }
67165
67006
  module2.exports.readCollation = readCollation;
@@ -67889,7 +67730,6 @@ var require_value_parser = __commonJS({
67889
67730
  var _metadataParser = require_metadata_parser();
67890
67731
  var _dataType = require_data_type();
67891
67732
  var _iconvLite = _interopRequireDefault(require_lib2());
67892
- var _sprintfJs = require_sprintf();
67893
67733
  var _guidParser = require_guid_parser();
67894
67734
  var _helpers = require_helpers3();
67895
67735
  function _interopRequireDefault(e) {
@@ -68249,7 +68089,7 @@ var require_value_parser = __commonJS({
68249
68089
  case 16:
68250
68090
  return readUniqueIdentifier(buf, offset, options);
68251
68091
  default:
68252
- throw new Error((0, _sprintfJs.sprintf)("Unsupported guid size %d", dataLength - 1));
68092
+ throw new Error(`Unsupported guid size ${dataLength - 1}`);
68253
68093
  }
68254
68094
  }
68255
68095
  case "Variant": {
@@ -68320,7 +68160,7 @@ var require_value_parser = __commonJS({
68320
68160
  value
68321
68161
  } = (0, _helpers.readUNumeric128LE)(buf, offset));
68322
68162
  } else {
68323
- throw new Error((0, _sprintfJs.sprintf)("Unsupported numeric dataLength %d", dataLength));
68163
+ throw new Error(`Unsupported numeric dataLength ${dataLength}`);
68324
68164
  }
68325
68165
  return new _helpers.Result(value * sign / Math.pow(10, scale), offset);
68326
68166
  }
@@ -69798,7 +69638,7 @@ var require_package = __commonJS({
69798
69638
  homepage: "https://github.com/tediousjs/tedious",
69799
69639
  bugs: "https://github.com/tediousjs/tedious/issues",
69800
69640
  license: "MIT",
69801
- version: "20.3.3",
69641
+ version: "20.3.8",
69802
69642
  main: "./lib/tedious.js",
69803
69643
  types: "./lib/tedious.d.ts",
69804
69644
  repository: {
@@ -69838,8 +69678,7 @@ var require_package = __commonJS({
69838
69678
  bl: "^6.1.4",
69839
69679
  "iconv-lite": "^0.7.0",
69840
69680
  "js-md4": "^0.3.2",
69841
- "native-duplexpair": "^1.0.0",
69842
- "sprintf-js": "^1.1.3"
69681
+ "native-duplexpair": "^1.0.0"
69843
69682
  },
69844
69683
  devDependencies: {
69845
69684
  "@babel/cli": "^7.28.3",
@@ -69856,7 +69695,6 @@ var require_package = __commonJS({
69856
69695
  "@types/mitm": "^1.3.8",
69857
69696
  "@types/mocha": "^10.0.10",
69858
69697
  "@types/sinon": "^21.0.0",
69859
- "@types/sprintf-js": "^1.1.4",
69860
69698
  "@typescript-eslint/eslint-plugin": "^8.46.3",
69861
69699
  "@typescript-eslint/parser": "^8.46.3",
69862
69700
  async: "^3.2.6",
@@ -72461,9 +72299,12 @@ var require_connection = __commonJS({
72461
72299
  if (preloginPayload.fedAuthRequired === 1) {
72462
72300
  this.fedAuthRequired = true;
72463
72301
  }
72302
+ if (this.config.options.encrypt === true && preloginPayload.encryptionString !== "ON" && preloginPayload.encryptionString !== "REQ") {
72303
+ throw new _errors.ConnectionError("Server did not negotiate encryption, but the 'encrypt' config option is set to `true`. Set 'encrypt' to `false` to allow unencrypted connections.", "EENCRYPT");
72304
+ }
72464
72305
  if ("strict" !== this.config.options.encrypt && (preloginPayload.encryptionString === "ON" || preloginPayload.encryptionString === "REQ")) {
72465
72306
  if (!this.config.options.encrypt) {
72466
- throw new _errors.ConnectionError("Server requires encryption, set 'encrypt' config option to true.", "EENCRYPT");
72307
+ throw new _errors.ConnectionError("Server requires encryption, set 'encrypt' config option to `true`.", "EENCRYPT");
72467
72308
  }
72468
72309
  this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);
72469
72310
  await Promise.race([this.messageIo.startTls(this.secureContextOptions, this.config.options.serverName ? this.config.options.serverName : this.routingData?.server ?? this.config.server, this.config.options.trustServerCertificate).catch((err) => {