sql-preview 0.6.8 → 0.6.11

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.
@@ -519,7 +519,7 @@ var require_has_flag = __commonJS({
519
519
  var require_supports_color = __commonJS({
520
520
  "node_modules/supports-color/index.js"(exports, module2) {
521
521
  "use strict";
522
- var os3 = require("os");
522
+ var os4 = require("os");
523
523
  var tty = require("tty");
524
524
  var hasFlag = require_has_flag();
525
525
  var { env } = process;
@@ -567,7 +567,7 @@ var require_supports_color = __commonJS({
567
567
  return min;
568
568
  }
569
569
  if (process.platform === "win32") {
570
- const osRelease = os3.release().split(".");
570
+ const osRelease = os4.release().split(".");
571
571
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
572
572
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
573
573
  }
@@ -5481,11 +5481,11 @@ var require_raw_body = __commonJS({
5481
5481
  if (done) {
5482
5482
  return readStream2(stream4, encoding, length, limit, wrap(done));
5483
5483
  }
5484
- return new Promise(function executor(resolve2, reject) {
5484
+ return new Promise(function executor(resolve4, reject) {
5485
5485
  readStream2(stream4, encoding, length, limit, function onRead(err, buf) {
5486
5486
  if (err)
5487
5487
  return reject(err);
5488
- resolve2(buf);
5488
+ resolve4(buf);
5489
5489
  });
5490
5490
  });
5491
5491
  }
@@ -19083,11 +19083,11 @@ var require_mime_types = __commonJS({
19083
19083
  }
19084
19084
  return exts[0];
19085
19085
  }
19086
- function lookup(path10) {
19087
- if (!path10 || typeof path10 !== "string") {
19086
+ function lookup(path14) {
19087
+ if (!path14 || typeof path14 !== "string") {
19088
19088
  return false;
19089
19089
  }
19090
- var extension3 = extname("x." + path10).toLowerCase().slice(1);
19090
+ var extension3 = extname("x." + path14).toLowerCase().slice(1);
19091
19091
  if (!extension3) {
19092
19092
  return false;
19093
19093
  }
@@ -19356,7 +19356,7 @@ var require_read = __commonJS({
19356
19356
  var getBody = require_raw_body();
19357
19357
  var iconv = require_lib2();
19358
19358
  var onFinished = require_on_finished();
19359
- var zlib3 = require("node:zlib");
19359
+ var zlib4 = require("node:zlib");
19360
19360
  var hasBody = require_type_is().hasBody;
19361
19361
  var { getCharset } = require_utils();
19362
19362
  module2.exports = read;
@@ -19481,13 +19481,13 @@ var require_read = __commonJS({
19481
19481
  switch (encoding) {
19482
19482
  case "deflate":
19483
19483
  debug("inflate body");
19484
- return zlib3.createInflate();
19484
+ return zlib4.createInflate();
19485
19485
  case "gzip":
19486
19486
  debug("gunzip body");
19487
- return zlib3.createGunzip();
19487
+ return zlib4.createGunzip();
19488
19488
  case "br":
19489
19489
  debug("brotli decompress body");
19490
- return zlib3.createBrotliDecompress();
19490
+ return zlib4.createBrotliDecompress();
19491
19491
  default:
19492
19492
  throw createError(415, 'unsupported content encoding "' + encoding + '"', {
19493
19493
  encoding,
@@ -22579,13 +22579,13 @@ var require_view = __commonJS({
22579
22579
  "node_modules/express/lib/view.js"(exports, module2) {
22580
22580
  "use strict";
22581
22581
  var debug = require_src()("express:view");
22582
- var path10 = require("node:path");
22583
- var fs13 = require("node:fs");
22584
- var dirname3 = path10.dirname;
22585
- var basename = path10.basename;
22586
- var extname = path10.extname;
22587
- var join9 = path10.join;
22588
- var resolve2 = path10.resolve;
22582
+ var path14 = require("node:path");
22583
+ var fs17 = require("node:fs");
22584
+ var dirname7 = path14.dirname;
22585
+ var basename2 = path14.basename;
22586
+ var extname = path14.extname;
22587
+ var join11 = path14.join;
22588
+ var resolve4 = path14.resolve;
22589
22589
  module2.exports = View;
22590
22590
  function View(name, options) {
22591
22591
  var opts = options || {};
@@ -22614,17 +22614,17 @@ var require_view = __commonJS({
22614
22614
  this.path = this.lookup(fileName);
22615
22615
  }
22616
22616
  View.prototype.lookup = function lookup(name) {
22617
- var path11;
22617
+ var path15;
22618
22618
  var roots = [].concat(this.root);
22619
22619
  debug('lookup "%s"', name);
22620
- for (var i = 0; i < roots.length && !path11; i++) {
22620
+ for (var i = 0; i < roots.length && !path15; i++) {
22621
22621
  var root = roots[i];
22622
- var loc = resolve2(root, name);
22623
- var dir = dirname3(loc);
22624
- var file = basename(loc);
22625
- path11 = this.resolve(dir, file);
22622
+ var loc = resolve4(root, name);
22623
+ var dir = dirname7(loc);
22624
+ var file = basename2(loc);
22625
+ path15 = this.resolve(dir, file);
22626
22626
  }
22627
- return path11;
22627
+ return path15;
22628
22628
  };
22629
22629
  View.prototype.render = function render(options, callback) {
22630
22630
  var sync = true;
@@ -22644,23 +22644,23 @@ var require_view = __commonJS({
22644
22644
  });
22645
22645
  sync = false;
22646
22646
  };
22647
- View.prototype.resolve = function resolve3(dir, file) {
22647
+ View.prototype.resolve = function resolve5(dir, file) {
22648
22648
  var ext = this.ext;
22649
- var path11 = join9(dir, file);
22650
- var stat = tryStat(path11);
22649
+ var path15 = join11(dir, file);
22650
+ var stat = tryStat(path15);
22651
22651
  if (stat && stat.isFile()) {
22652
- return path11;
22652
+ return path15;
22653
22653
  }
22654
- path11 = join9(dir, basename(file, ext), "index" + ext);
22655
- stat = tryStat(path11);
22654
+ path15 = join11(dir, basename2(file, ext), "index" + ext);
22655
+ stat = tryStat(path15);
22656
22656
  if (stat && stat.isFile()) {
22657
- return path11;
22657
+ return path15;
22658
22658
  }
22659
22659
  };
22660
- function tryStat(path11) {
22661
- debug('stat "%s"', path11);
22660
+ function tryStat(path15) {
22661
+ debug('stat "%s"', path15);
22662
22662
  try {
22663
- return fs13.statSync(path11);
22663
+ return fs17.statSync(path15);
22664
22664
  } catch (e) {
22665
22665
  return void 0;
22666
22666
  }
@@ -22673,14 +22673,14 @@ var require_etag = __commonJS({
22673
22673
  "node_modules/etag/index.js"(exports, module2) {
22674
22674
  "use strict";
22675
22675
  module2.exports = etag;
22676
- var crypto8 = require("crypto");
22676
+ var crypto9 = require("crypto");
22677
22677
  var Stats = require("fs").Stats;
22678
22678
  var toString3 = Object.prototype.toString;
22679
22679
  function entitytag(entity) {
22680
22680
  if (entity.length === 0) {
22681
22681
  return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
22682
22682
  }
22683
- var hash = crypto8.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
22683
+ var hash = crypto9.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
22684
22684
  var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
22685
22685
  return '"' + len.toString(16) + "-" + hash + '"';
22686
22686
  }
@@ -32167,11 +32167,11 @@ var require_mime_types2 = __commonJS({
32167
32167
  }
32168
32168
  return exts[0];
32169
32169
  }
32170
- function lookup(path10) {
32171
- if (!path10 || typeof path10 !== "string") {
32170
+ function lookup(path14) {
32171
+ if (!path14 || typeof path14 !== "string") {
32172
32172
  return false;
32173
32173
  }
32174
- var extension3 = extname("x." + path10).toLowerCase().slice(1);
32174
+ var extension3 = extname("x." + path14).toLowerCase().slice(1);
32175
32175
  if (!extension3) {
32176
32176
  return false;
32177
32177
  }
@@ -33309,15 +33309,15 @@ var require_dist = __commonJS({
33309
33309
  let index = 0;
33310
33310
  function consumeUntil(end) {
33311
33311
  const output = [];
33312
- let path10 = "";
33312
+ let path14 = "";
33313
33313
  function writePath() {
33314
- if (!path10)
33314
+ if (!path14)
33315
33315
  return;
33316
33316
  output.push({
33317
33317
  type: "text",
33318
- value: encodePath(path10)
33318
+ value: encodePath(path14)
33319
33319
  });
33320
- path10 = "";
33320
+ path14 = "";
33321
33321
  }
33322
33322
  while (index < chars.length) {
33323
33323
  const value = chars[index++];
@@ -33329,7 +33329,7 @@ var require_dist = __commonJS({
33329
33329
  if (index === chars.length) {
33330
33330
  throw new PathError(`Unexpected end after \\ at index ${index}`, str);
33331
33331
  }
33332
- path10 += chars[index++];
33332
+ path14 += chars[index++];
33333
33333
  continue;
33334
33334
  }
33335
33335
  if (value === ":" || value === "*") {
@@ -33373,7 +33373,7 @@ var require_dist = __commonJS({
33373
33373
  if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") {
33374
33374
  throw new PathError(`Unexpected ${value} at index ${index - 1}`, str);
33375
33375
  }
33376
- path10 += value;
33376
+ path14 += value;
33377
33377
  }
33378
33378
  if (end) {
33379
33379
  throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
@@ -33383,17 +33383,17 @@ var require_dist = __commonJS({
33383
33383
  }
33384
33384
  return new TokenData(consumeUntil(""), str);
33385
33385
  }
33386
- function compile(path10, options = {}) {
33386
+ function compile(path14, options = {}) {
33387
33387
  const { encode: encode5 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
33388
- const data = typeof path10 === "object" ? path10 : parse3(path10, options);
33388
+ const data = typeof path14 === "object" ? path14 : parse3(path14, options);
33389
33389
  const fn = tokensToFunction(data.tokens, delimiter, encode5);
33390
- return function path11(params = {}) {
33390
+ return function path15(params = {}) {
33391
33391
  const missing = [];
33392
- const path12 = fn(params, missing);
33392
+ const path16 = fn(params, missing);
33393
33393
  if (missing.length) {
33394
33394
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
33395
33395
  }
33396
- return path12;
33396
+ return path16;
33397
33397
  };
33398
33398
  }
33399
33399
  function tokensToFunction(tokens, delimiter, encode5) {
@@ -33455,9 +33455,9 @@ var require_dist = __commonJS({
33455
33455
  return encodeValue(value);
33456
33456
  };
33457
33457
  }
33458
- function match(path10, options = {}) {
33458
+ function match(path14, options = {}) {
33459
33459
  const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
33460
- const { regexp, keys } = pathToRegexp(path10, options);
33460
+ const { regexp, keys } = pathToRegexp(path14, options);
33461
33461
  const decoders = keys.map((key) => {
33462
33462
  if (decode3 === false)
33463
33463
  return NOOP_VALUE;
@@ -33469,7 +33469,7 @@ var require_dist = __commonJS({
33469
33469
  const m = regexp.exec(input);
33470
33470
  if (!m)
33471
33471
  return false;
33472
- const path11 = m[0];
33472
+ const path15 = m[0];
33473
33473
  const params = /* @__PURE__ */ Object.create(null);
33474
33474
  for (let i = 1; i < m.length; i++) {
33475
33475
  if (m[i] === void 0)
@@ -33478,21 +33478,21 @@ var require_dist = __commonJS({
33478
33478
  const decoder = decoders[i - 1];
33479
33479
  params[key.name] = decoder(m[i]);
33480
33480
  }
33481
- return { path: path11, params };
33481
+ return { path: path15, params };
33482
33482
  };
33483
33483
  }
33484
- function pathToRegexp(path10, options = {}) {
33484
+ function pathToRegexp(path14, options = {}) {
33485
33485
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
33486
33486
  const keys = [];
33487
33487
  let source = "";
33488
33488
  let combinations = 0;
33489
- function process3(path11) {
33490
- if (Array.isArray(path11)) {
33491
- for (const p of path11)
33489
+ function process3(path15) {
33490
+ if (Array.isArray(path15)) {
33491
+ for (const p of path15)
33492
33492
  process3(p);
33493
33493
  return;
33494
33494
  }
33495
- const data = typeof path11 === "object" ? path11 : parse3(path11, options);
33495
+ const data = typeof path15 === "object" ? path15 : parse3(path15, options);
33496
33496
  flatten(data.tokens, 0, [], (tokens) => {
33497
33497
  if (combinations >= 256) {
33498
33498
  throw new PathError("Too many path combinations", data.originalPath);
@@ -33503,7 +33503,7 @@ var require_dist = __commonJS({
33503
33503
  combinations++;
33504
33504
  });
33505
33505
  }
33506
- process3(path10);
33506
+ process3(path14);
33507
33507
  let pattern = `^(?:${source})`;
33508
33508
  if (trailing)
33509
33509
  pattern += "(?:" + escape2(delimiter) + "$)?";
@@ -33643,18 +33643,18 @@ var require_layer = __commonJS({
33643
33643
  var TRAILING_SLASH_REGEXP = /\/+$/;
33644
33644
  var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
33645
33645
  module2.exports = Layer;
33646
- function Layer(path10, options, fn) {
33646
+ function Layer(path14, options, fn) {
33647
33647
  if (!(this instanceof Layer)) {
33648
- return new Layer(path10, options, fn);
33648
+ return new Layer(path14, options, fn);
33649
33649
  }
33650
- debug("new %o", path10);
33650
+ debug("new %o", path14);
33651
33651
  const opts = options || {};
33652
33652
  this.handle = fn;
33653
33653
  this.keys = [];
33654
33654
  this.name = fn.name || "<anonymous>";
33655
33655
  this.params = void 0;
33656
33656
  this.path = void 0;
33657
- this.slash = path10 === "/" && opts.end === false;
33657
+ this.slash = path14 === "/" && opts.end === false;
33658
33658
  function matcher(_path) {
33659
33659
  if (_path instanceof RegExp) {
33660
33660
  const keys = [];
@@ -33693,7 +33693,7 @@ var require_layer = __commonJS({
33693
33693
  decode: decodeParam
33694
33694
  });
33695
33695
  }
33696
- this.matchers = Array.isArray(path10) ? path10.map(matcher) : [matcher(path10)];
33696
+ this.matchers = Array.isArray(path14) ? path14.map(matcher) : [matcher(path14)];
33697
33697
  }
33698
33698
  Layer.prototype.handleError = function handleError(error2, req, res, next) {
33699
33699
  const fn = this.handle;
@@ -33733,9 +33733,9 @@ var require_layer = __commonJS({
33733
33733
  next(err);
33734
33734
  }
33735
33735
  };
33736
- Layer.prototype.match = function match(path10) {
33736
+ Layer.prototype.match = function match(path14) {
33737
33737
  let match2;
33738
- if (path10 != null) {
33738
+ if (path14 != null) {
33739
33739
  if (this.slash) {
33740
33740
  this.params = {};
33741
33741
  this.path = "";
@@ -33743,7 +33743,7 @@ var require_layer = __commonJS({
33743
33743
  }
33744
33744
  let i = 0;
33745
33745
  while (!match2 && i < this.matchers.length) {
33746
- match2 = this.matchers[i](path10);
33746
+ match2 = this.matchers[i](path14);
33747
33747
  i++;
33748
33748
  }
33749
33749
  }
@@ -33771,13 +33771,13 @@ var require_layer = __commonJS({
33771
33771
  throw err;
33772
33772
  }
33773
33773
  }
33774
- function loosen(path10) {
33775
- if (path10 instanceof RegExp || path10 === "/") {
33776
- return path10;
33774
+ function loosen(path14) {
33775
+ if (path14 instanceof RegExp || path14 === "/") {
33776
+ return path14;
33777
33777
  }
33778
- return Array.isArray(path10) ? path10.map(function(p) {
33778
+ return Array.isArray(path14) ? path14.map(function(p) {
33779
33779
  return loosen(p);
33780
- }) : String(path10).replace(TRAILING_SLASH_REGEXP, "");
33780
+ }) : String(path14).replace(TRAILING_SLASH_REGEXP, "");
33781
33781
  }
33782
33782
  }
33783
33783
  });
@@ -33793,9 +33793,9 @@ var require_route = __commonJS({
33793
33793
  var flatten = Array.prototype.flat;
33794
33794
  var methods = METHODS.map((method) => method.toLowerCase());
33795
33795
  module2.exports = Route;
33796
- function Route(path10) {
33797
- debug("new %o", path10);
33798
- this.path = path10;
33796
+ function Route(path14) {
33797
+ debug("new %o", path14);
33798
+ this.path = path14;
33799
33799
  this.stack = [];
33800
33800
  this.methods = /* @__PURE__ */ Object.create(null);
33801
33801
  }
@@ -34003,8 +34003,8 @@ var require_router = __commonJS({
34003
34003
  if (++sync > 100) {
34004
34004
  return setImmediate(next, err);
34005
34005
  }
34006
- const path10 = getPathname(req);
34007
- if (path10 == null) {
34006
+ const path14 = getPathname(req);
34007
+ if (path14 == null) {
34008
34008
  return done(layerError);
34009
34009
  }
34010
34010
  let layer;
@@ -34012,7 +34012,7 @@ var require_router = __commonJS({
34012
34012
  let route;
34013
34013
  while (match !== true && idx < stack.length) {
34014
34014
  layer = stack[idx++];
34015
- match = matchLayer(layer, path10);
34015
+ match = matchLayer(layer, path14);
34016
34016
  route = layer.route;
34017
34017
  if (typeof match !== "boolean") {
34018
34018
  layerError = layerError || match;
@@ -34050,18 +34050,18 @@ var require_router = __commonJS({
34050
34050
  } else if (route) {
34051
34051
  layer.handleRequest(req, res, next);
34052
34052
  } else {
34053
- trimPrefix(layer, layerError, layerPath, path10);
34053
+ trimPrefix(layer, layerError, layerPath, path14);
34054
34054
  }
34055
34055
  sync = 0;
34056
34056
  });
34057
34057
  }
34058
- function trimPrefix(layer, layerError, layerPath, path10) {
34058
+ function trimPrefix(layer, layerError, layerPath, path14) {
34059
34059
  if (layerPath.length !== 0) {
34060
- if (layerPath !== path10.substring(0, layerPath.length)) {
34060
+ if (layerPath !== path14.substring(0, layerPath.length)) {
34061
34061
  next(layerError);
34062
34062
  return;
34063
34063
  }
34064
- const c = path10[layerPath.length];
34064
+ const c = path14[layerPath.length];
34065
34065
  if (c && c !== "/") {
34066
34066
  next(layerError);
34067
34067
  return;
@@ -34085,7 +34085,7 @@ var require_router = __commonJS({
34085
34085
  };
34086
34086
  Router.prototype.use = function use(handler) {
34087
34087
  let offset = 0;
34088
- let path10 = "/";
34088
+ let path14 = "/";
34089
34089
  if (typeof handler !== "function") {
34090
34090
  let arg = handler;
34091
34091
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -34093,7 +34093,7 @@ var require_router = __commonJS({
34093
34093
  }
34094
34094
  if (typeof arg !== "function") {
34095
34095
  offset = 1;
34096
- path10 = handler;
34096
+ path14 = handler;
34097
34097
  }
34098
34098
  }
34099
34099
  const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
@@ -34105,8 +34105,8 @@ var require_router = __commonJS({
34105
34105
  if (typeof fn !== "function") {
34106
34106
  throw new TypeError("argument handler must be a function");
34107
34107
  }
34108
- debug("use %o %s", path10, fn.name || "<anonymous>");
34109
- const layer = new Layer(path10, {
34108
+ debug("use %o %s", path14, fn.name || "<anonymous>");
34109
+ const layer = new Layer(path14, {
34110
34110
  sensitive: this.caseSensitive,
34111
34111
  strict: false,
34112
34112
  end: false
@@ -34116,9 +34116,9 @@ var require_router = __commonJS({
34116
34116
  }
34117
34117
  return this;
34118
34118
  };
34119
- Router.prototype.route = function route(path10) {
34120
- const route2 = new Route(path10);
34121
- const layer = new Layer(path10, {
34119
+ Router.prototype.route = function route(path14) {
34120
+ const route2 = new Route(path14);
34121
+ const layer = new Layer(path14, {
34122
34122
  sensitive: this.caseSensitive,
34123
34123
  strict: this.strict,
34124
34124
  end: true
@@ -34131,8 +34131,8 @@ var require_router = __commonJS({
34131
34131
  return route2;
34132
34132
  };
34133
34133
  methods.concat("all").forEach(function(method) {
34134
- Router.prototype[method] = function(path10) {
34135
- const route = this.route(path10);
34134
+ Router.prototype[method] = function(path14) {
34135
+ const route = this.route(path14);
34136
34136
  route[method].apply(route, slice.call(arguments, 1));
34137
34137
  return this;
34138
34138
  };
@@ -34161,9 +34161,9 @@ var require_router = __commonJS({
34161
34161
  const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
34162
34162
  return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
34163
34163
  }
34164
- function matchLayer(layer, path10) {
34164
+ function matchLayer(layer, path14) {
34165
34165
  try {
34166
- return layer.match(path10);
34166
+ return layer.match(path14);
34167
34167
  } catch (err) {
34168
34168
  return err;
34169
34169
  }
@@ -34308,12 +34308,12 @@ var require_application = __commonJS({
34308
34308
  var finalhandler = require_finalhandler();
34309
34309
  var debug = require_src()("express:application");
34310
34310
  var View = require_view();
34311
- var http5 = require("node:http");
34311
+ var http6 = require("node:http");
34312
34312
  var methods = require_utils3().methods;
34313
34313
  var compileETag = require_utils3().compileETag;
34314
34314
  var compileQueryParser = require_utils3().compileQueryParser;
34315
34315
  var compileTrust = require_utils3().compileTrust;
34316
- var resolve2 = require("node:path").resolve;
34316
+ var resolve4 = require("node:path").resolve;
34317
34317
  var once = require_once();
34318
34318
  var Router = require_router();
34319
34319
  var slice = Array.prototype.slice;
@@ -34367,7 +34367,7 @@ var require_application = __commonJS({
34367
34367
  this.mountpath = "/";
34368
34368
  this.locals.settings = this.settings;
34369
34369
  this.set("view", View);
34370
- this.set("views", resolve2("views"));
34370
+ this.set("views", resolve4("views"));
34371
34371
  this.set("jsonp callback name", "callback");
34372
34372
  if (env === "production") {
34373
34373
  this.enable("view cache");
@@ -34392,7 +34392,7 @@ var require_application = __commonJS({
34392
34392
  };
34393
34393
  app.use = function use(fn) {
34394
34394
  var offset = 0;
34395
- var path10 = "/";
34395
+ var path14 = "/";
34396
34396
  if (typeof fn !== "function") {
34397
34397
  var arg = fn;
34398
34398
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -34400,7 +34400,7 @@ var require_application = __commonJS({
34400
34400
  }
34401
34401
  if (typeof arg !== "function") {
34402
34402
  offset = 1;
34403
- path10 = fn;
34403
+ path14 = fn;
34404
34404
  }
34405
34405
  }
34406
34406
  var fns = flatten.call(slice.call(arguments, offset), Infinity);
@@ -34410,12 +34410,12 @@ var require_application = __commonJS({
34410
34410
  var router = this.router;
34411
34411
  fns.forEach(function(fn2) {
34412
34412
  if (!fn2 || !fn2.handle || !fn2.set) {
34413
- return router.use(path10, fn2);
34413
+ return router.use(path14, fn2);
34414
34414
  }
34415
- debug(".use app under %s", path10);
34416
- fn2.mountpath = path10;
34415
+ debug(".use app under %s", path14);
34416
+ fn2.mountpath = path14;
34417
34417
  fn2.parent = this;
34418
- router.use(path10, function mounted_app(req, res, next) {
34418
+ router.use(path14, function mounted_app(req, res, next) {
34419
34419
  var orig = req.app;
34420
34420
  fn2.handle(req, res, function(err) {
34421
34421
  Object.setPrototypeOf(req, orig.request);
@@ -34427,8 +34427,8 @@ var require_application = __commonJS({
34427
34427
  }, this);
34428
34428
  return this;
34429
34429
  };
34430
- app.route = function route(path10) {
34431
- return this.router.route(path10);
34430
+ app.route = function route(path14) {
34431
+ return this.router.route(path14);
34432
34432
  };
34433
34433
  app.engine = function engine(ext, fn) {
34434
34434
  if (typeof fn !== "function") {
@@ -34471,7 +34471,7 @@ var require_application = __commonJS({
34471
34471
  }
34472
34472
  return this;
34473
34473
  };
34474
- app.path = function path10() {
34474
+ app.path = function path14() {
34475
34475
  return this.parent ? this.parent.path() + this.mountpath : "";
34476
34476
  };
34477
34477
  app.enabled = function enabled(setting) {
@@ -34487,17 +34487,17 @@ var require_application = __commonJS({
34487
34487
  return this.set(setting, false);
34488
34488
  };
34489
34489
  methods.forEach(function(method) {
34490
- app[method] = function(path10) {
34490
+ app[method] = function(path14) {
34491
34491
  if (method === "get" && arguments.length === 1) {
34492
- return this.set(path10);
34492
+ return this.set(path14);
34493
34493
  }
34494
- var route = this.route(path10);
34494
+ var route = this.route(path14);
34495
34495
  route[method].apply(route, slice.call(arguments, 1));
34496
34496
  return this;
34497
34497
  };
34498
34498
  });
34499
- app.all = function all3(path10) {
34500
- var route = this.route(path10);
34499
+ app.all = function all3(path14) {
34500
+ var route = this.route(path14);
34501
34501
  var args = slice.call(arguments, 1);
34502
34502
  for (var i = 0; i < methods.length; i++) {
34503
34503
  route[methods[i]].apply(route, args);
@@ -34541,7 +34541,7 @@ var require_application = __commonJS({
34541
34541
  tryRender(view, renderOptions, done);
34542
34542
  };
34543
34543
  app.listen = function listen() {
34544
- var server = http5.createServer(this);
34544
+ var server = http6.createServer(this);
34545
34545
  var args = slice.call(arguments);
34546
34546
  if (typeof args[args.length - 1] === "function") {
34547
34547
  var done = args[args.length - 1] = once(args[args.length - 1]);
@@ -44540,11 +44540,11 @@ var require_mime_types3 = __commonJS({
44540
44540
  }
44541
44541
  return exts[0];
44542
44542
  }
44543
- function lookup(path10) {
44544
- if (!path10 || typeof path10 !== "string") {
44543
+ function lookup(path14) {
44544
+ if (!path14 || typeof path14 !== "string") {
44545
44545
  return false;
44546
44546
  }
44547
- var extension3 = extname("x." + path10).toLowerCase().slice(1);
44547
+ var extension3 = extname("x." + path14).toLowerCase().slice(1);
44548
44548
  if (!extension3) {
44549
44549
  return false;
44550
44550
  }
@@ -44830,12 +44830,12 @@ var require_request = __commonJS({
44830
44830
  var accepts = require_accepts();
44831
44831
  var isIP = require("node:net").isIP;
44832
44832
  var typeis = require_type_is();
44833
- var http5 = require("node:http");
44833
+ var http6 = require("node:http");
44834
44834
  var fresh = require_fresh();
44835
44835
  var parseRange = require_range_parser();
44836
44836
  var parse3 = require_parseurl();
44837
44837
  var proxyaddr = require_proxy_addr();
44838
- var req = Object.create(http5.IncomingMessage.prototype);
44838
+ var req = Object.create(http6.IncomingMessage.prototype);
44839
44839
  module2.exports = req;
44840
44840
  req.get = req.header = function header(name) {
44841
44841
  if (!name) {
@@ -44923,7 +44923,7 @@ var require_request = __commonJS({
44923
44923
  var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
44924
44924
  return subdomains2.slice(offset);
44925
44925
  });
44926
- defineGetter(req, "path", function path10() {
44926
+ defineGetter(req, "path", function path14() {
44927
44927
  return parse3(this).pathname;
44928
44928
  });
44929
44929
  defineGetter(req, "host", function host() {
@@ -44981,7 +44981,7 @@ var require_content_disposition = __commonJS({
44981
44981
  "use strict";
44982
44982
  module2.exports = contentDisposition;
44983
44983
  module2.exports.parse = parse3;
44984
- var basename = require("path").basename;
44984
+ var basename2 = require("path").basename;
44985
44985
  var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
44986
44986
  var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
44987
44987
  var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g;
@@ -45016,9 +45016,9 @@ var require_content_disposition = __commonJS({
45016
45016
  if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
45017
45017
  throw new TypeError("fallback must be ISO-8859-1 string");
45018
45018
  }
45019
- var name = basename(filename);
45019
+ var name = basename2(filename);
45020
45020
  var isQuotedString = TEXT_REGEXP.test(name);
45021
- var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename(fallback);
45021
+ var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename2(fallback);
45022
45022
  var hasFallback = typeof fallbackName === "string" && fallbackName !== name;
45023
45023
  if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
45024
45024
  params["filename*"] = name;
@@ -45141,13 +45141,13 @@ var require_content_disposition = __commonJS({
45141
45141
  // node_modules/cookie-signature/index.js
45142
45142
  var require_cookie_signature = __commonJS({
45143
45143
  "node_modules/cookie-signature/index.js"(exports) {
45144
- var crypto8 = require("crypto");
45144
+ var crypto9 = require("crypto");
45145
45145
  exports.sign = function(val, secret) {
45146
45146
  if ("string" != typeof val)
45147
45147
  throw new TypeError("Cookie value must be provided as a string.");
45148
45148
  if (null == secret)
45149
45149
  throw new TypeError("Secret key must be provided.");
45150
- return val + "." + crypto8.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
45150
+ return val + "." + crypto9.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
45151
45151
  };
45152
45152
  exports.unsign = function(input, secret) {
45153
45153
  if ("string" != typeof input)
@@ -45155,7 +45155,7 @@ var require_cookie_signature = __commonJS({
45155
45155
  if (null == secret)
45156
45156
  throw new TypeError("Secret key must be provided.");
45157
45157
  var tentativeValue = input.slice(0, input.lastIndexOf(".")), expectedInput = exports.sign(tentativeValue, secret), expectedBuffer = Buffer.from(expectedInput), inputBuffer = Buffer.from(input);
45158
- return expectedBuffer.length === inputBuffer.length && crypto8.timingSafeEqual(expectedBuffer, inputBuffer) ? tentativeValue : false;
45158
+ return expectedBuffer.length === inputBuffer.length && crypto9.timingSafeEqual(expectedBuffer, inputBuffer) ? tentativeValue : false;
45159
45159
  };
45160
45160
  }
45161
45161
  });
@@ -54788,11 +54788,11 @@ var require_mime_types4 = __commonJS({
54788
54788
  }
54789
54789
  return exts[0];
54790
54790
  }
54791
- function lookup(path10) {
54792
- if (!path10 || typeof path10 !== "string") {
54791
+ function lookup(path14) {
54792
+ if (!path14 || typeof path14 !== "string") {
54793
54793
  return false;
54794
54794
  }
54795
- var extension3 = extname("x." + path10).toLowerCase().slice(1);
54795
+ var extension3 = extname("x." + path14).toLowerCase().slice(1);
54796
54796
  if (!extension3) {
54797
54797
  return false;
54798
54798
  }
@@ -54847,32 +54847,32 @@ var require_send = __commonJS({
54847
54847
  var escapeHtml2 = require_escape_html();
54848
54848
  var etag = require_etag();
54849
54849
  var fresh = require_fresh();
54850
- var fs13 = require("fs");
54850
+ var fs17 = require("fs");
54851
54851
  var mime = require_mime_types4();
54852
54852
  var ms = require_ms();
54853
54853
  var onFinished = require_on_finished();
54854
54854
  var parseRange = require_range_parser();
54855
- var path10 = require("path");
54855
+ var path14 = require("path");
54856
54856
  var statuses = require_statuses();
54857
54857
  var Stream = require("stream");
54858
54858
  var util4 = require("util");
54859
- var extname = path10.extname;
54860
- var join9 = path10.join;
54861
- var normalize = path10.normalize;
54862
- var resolve2 = path10.resolve;
54863
- var sep = path10.sep;
54859
+ var extname = path14.extname;
54860
+ var join11 = path14.join;
54861
+ var normalize = path14.normalize;
54862
+ var resolve4 = path14.resolve;
54863
+ var sep2 = path14.sep;
54864
54864
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
54865
54865
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
54866
54866
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
54867
54867
  module2.exports = send;
54868
- function send(req, path11, options) {
54869
- return new SendStream(req, path11, options);
54868
+ function send(req, path15, options) {
54869
+ return new SendStream(req, path15, options);
54870
54870
  }
54871
- function SendStream(req, path11, options) {
54871
+ function SendStream(req, path15, options) {
54872
54872
  Stream.call(this);
54873
54873
  var opts = options || {};
54874
54874
  this.options = opts;
54875
- this.path = path11;
54875
+ this.path = path15;
54876
54876
  this.req = req;
54877
54877
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
54878
54878
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -54888,7 +54888,7 @@ var require_send = __commonJS({
54888
54888
  this._maxage = opts.maxAge || opts.maxage;
54889
54889
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
54890
54890
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
54891
- this._root = opts.root ? resolve2(opts.root) : null;
54891
+ this._root = opts.root ? resolve4(opts.root) : null;
54892
54892
  }
54893
54893
  util4.inherits(SendStream, Stream);
54894
54894
  SendStream.prototype.error = function error2(status, err) {
@@ -54986,10 +54986,10 @@ var require_send = __commonJS({
54986
54986
  var lastModified = this.res.getHeader("Last-Modified");
54987
54987
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
54988
54988
  };
54989
- SendStream.prototype.redirect = function redirect(path11) {
54989
+ SendStream.prototype.redirect = function redirect(path15) {
54990
54990
  var res = this.res;
54991
54991
  if (hasListeners(this, "directory")) {
54992
- this.emit("directory", res, path11);
54992
+ this.emit("directory", res, path15);
54993
54993
  return;
54994
54994
  }
54995
54995
  if (this.hasTrailingSlash()) {
@@ -55009,38 +55009,38 @@ var require_send = __commonJS({
55009
55009
  SendStream.prototype.pipe = function pipe2(res) {
55010
55010
  var root = this._root;
55011
55011
  this.res = res;
55012
- var path11 = decode3(this.path);
55013
- if (path11 === -1) {
55012
+ var path15 = decode3(this.path);
55013
+ if (path15 === -1) {
55014
55014
  this.error(400);
55015
55015
  return res;
55016
55016
  }
55017
- if (~path11.indexOf("\0")) {
55017
+ if (~path15.indexOf("\0")) {
55018
55018
  this.error(400);
55019
55019
  return res;
55020
55020
  }
55021
55021
  var parts;
55022
55022
  if (root !== null) {
55023
- if (path11) {
55024
- path11 = normalize("." + sep + path11);
55023
+ if (path15) {
55024
+ path15 = normalize("." + sep2 + path15);
55025
55025
  }
55026
- if (UP_PATH_REGEXP.test(path11)) {
55027
- debug('malicious path "%s"', path11);
55026
+ if (UP_PATH_REGEXP.test(path15)) {
55027
+ debug('malicious path "%s"', path15);
55028
55028
  this.error(403);
55029
55029
  return res;
55030
55030
  }
55031
- parts = path11.split(sep);
55032
- path11 = normalize(join9(root, path11));
55031
+ parts = path15.split(sep2);
55032
+ path15 = normalize(join11(root, path15));
55033
55033
  } else {
55034
- if (UP_PATH_REGEXP.test(path11)) {
55035
- debug('malicious path "%s"', path11);
55034
+ if (UP_PATH_REGEXP.test(path15)) {
55035
+ debug('malicious path "%s"', path15);
55036
55036
  this.error(403);
55037
55037
  return res;
55038
55038
  }
55039
- parts = normalize(path11).split(sep);
55040
- path11 = resolve2(path11);
55039
+ parts = normalize(path15).split(sep2);
55040
+ path15 = resolve4(path15);
55041
55041
  }
55042
55042
  if (containsDotFile(parts)) {
55043
- debug('%s dotfile "%s"', this._dotfiles, path11);
55043
+ debug('%s dotfile "%s"', this._dotfiles, path15);
55044
55044
  switch (this._dotfiles) {
55045
55045
  case "allow":
55046
55046
  break;
@@ -55054,13 +55054,13 @@ var require_send = __commonJS({
55054
55054
  }
55055
55055
  }
55056
55056
  if (this._index.length && this.hasTrailingSlash()) {
55057
- this.sendIndex(path11);
55057
+ this.sendIndex(path15);
55058
55058
  return res;
55059
55059
  }
55060
- this.sendFile(path11);
55060
+ this.sendFile(path15);
55061
55061
  return res;
55062
55062
  };
55063
- SendStream.prototype.send = function send2(path11, stat) {
55063
+ SendStream.prototype.send = function send2(path15, stat) {
55064
55064
  var len = stat.size;
55065
55065
  var options = this.options;
55066
55066
  var opts = {};
@@ -55072,9 +55072,9 @@ var require_send = __commonJS({
55072
55072
  this.headersAlreadySent();
55073
55073
  return;
55074
55074
  }
55075
- debug('pipe "%s"', path11);
55076
- this.setHeader(path11, stat);
55077
- this.type(path11);
55075
+ debug('pipe "%s"', path15);
55076
+ this.setHeader(path15, stat);
55077
+ this.type(path15);
55078
55078
  if (this.isConditionalGET()) {
55079
55079
  if (this.isPreconditionFailure()) {
55080
55080
  this.error(412);
@@ -55124,33 +55124,33 @@ var require_send = __commonJS({
55124
55124
  res.end();
55125
55125
  return;
55126
55126
  }
55127
- this.stream(path11, opts);
55127
+ this.stream(path15, opts);
55128
55128
  };
55129
- SendStream.prototype.sendFile = function sendFile(path11) {
55129
+ SendStream.prototype.sendFile = function sendFile(path15) {
55130
55130
  var i = 0;
55131
55131
  var self2 = this;
55132
- debug('stat "%s"', path11);
55133
- fs13.stat(path11, function onstat(err, stat) {
55134
- var pathEndsWithSep = path11[path11.length - 1] === sep;
55135
- if (err && err.code === "ENOENT" && !extname(path11) && !pathEndsWithSep) {
55132
+ debug('stat "%s"', path15);
55133
+ fs17.stat(path15, function onstat(err, stat) {
55134
+ var pathEndsWithSep = path15[path15.length - 1] === sep2;
55135
+ if (err && err.code === "ENOENT" && !extname(path15) && !pathEndsWithSep) {
55136
55136
  return next(err);
55137
55137
  }
55138
55138
  if (err)
55139
55139
  return self2.onStatError(err);
55140
55140
  if (stat.isDirectory())
55141
- return self2.redirect(path11);
55141
+ return self2.redirect(path15);
55142
55142
  if (pathEndsWithSep)
55143
55143
  return self2.error(404);
55144
- self2.emit("file", path11, stat);
55145
- self2.send(path11, stat);
55144
+ self2.emit("file", path15, stat);
55145
+ self2.send(path15, stat);
55146
55146
  });
55147
55147
  function next(err) {
55148
55148
  if (self2._extensions.length <= i) {
55149
55149
  return err ? self2.onStatError(err) : self2.error(404);
55150
55150
  }
55151
- var p = path11 + "." + self2._extensions[i++];
55151
+ var p = path15 + "." + self2._extensions[i++];
55152
55152
  debug('stat "%s"', p);
55153
- fs13.stat(p, function(err2, stat) {
55153
+ fs17.stat(p, function(err2, stat) {
55154
55154
  if (err2)
55155
55155
  return next(err2);
55156
55156
  if (stat.isDirectory())
@@ -55160,7 +55160,7 @@ var require_send = __commonJS({
55160
55160
  });
55161
55161
  }
55162
55162
  };
55163
- SendStream.prototype.sendIndex = function sendIndex(path11) {
55163
+ SendStream.prototype.sendIndex = function sendIndex(path15) {
55164
55164
  var i = -1;
55165
55165
  var self2 = this;
55166
55166
  function next(err) {
@@ -55169,9 +55169,9 @@ var require_send = __commonJS({
55169
55169
  return self2.onStatError(err);
55170
55170
  return self2.error(404);
55171
55171
  }
55172
- var p = join9(path11, self2._index[i]);
55172
+ var p = join11(path15, self2._index[i]);
55173
55173
  debug('stat "%s"', p);
55174
- fs13.stat(p, function(err2, stat) {
55174
+ fs17.stat(p, function(err2, stat) {
55175
55175
  if (err2)
55176
55176
  return next(err2);
55177
55177
  if (stat.isDirectory())
@@ -55182,10 +55182,10 @@ var require_send = __commonJS({
55182
55182
  }
55183
55183
  next();
55184
55184
  };
55185
- SendStream.prototype.stream = function stream4(path11, options) {
55185
+ SendStream.prototype.stream = function stream4(path15, options) {
55186
55186
  var self2 = this;
55187
55187
  var res = this.res;
55188
- var stream5 = fs13.createReadStream(path11, options);
55188
+ var stream5 = fs17.createReadStream(path15, options);
55189
55189
  this.emit("stream", stream5);
55190
55190
  stream5.pipe(res);
55191
55191
  function cleanup() {
@@ -55200,18 +55200,18 @@ var require_send = __commonJS({
55200
55200
  self2.emit("end");
55201
55201
  });
55202
55202
  };
55203
- SendStream.prototype.type = function type(path11) {
55203
+ SendStream.prototype.type = function type(path15) {
55204
55204
  var res = this.res;
55205
55205
  if (res.getHeader("Content-Type"))
55206
55206
  return;
55207
- var ext = extname(path11);
55207
+ var ext = extname(path15);
55208
55208
  var type2 = mime.contentType(ext) || "application/octet-stream";
55209
55209
  debug("content-type %s", type2);
55210
55210
  res.setHeader("Content-Type", type2);
55211
55211
  };
55212
- SendStream.prototype.setHeader = function setHeader(path11, stat) {
55212
+ SendStream.prototype.setHeader = function setHeader(path15, stat) {
55213
55213
  var res = this.res;
55214
- this.emit("headers", res, path11, stat);
55214
+ this.emit("headers", res, path15, stat);
55215
55215
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
55216
55216
  debug("accept ranges");
55217
55217
  res.setHeader("Accept-Ranges", "bytes");
@@ -55269,9 +55269,9 @@ var require_send = __commonJS({
55269
55269
  }
55270
55270
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
55271
55271
  }
55272
- function decode3(path11) {
55272
+ function decode3(path15) {
55273
55273
  try {
55274
- return decodeURIComponent(path11);
55274
+ return decodeURIComponent(path15);
55275
55275
  } catch (err) {
55276
55276
  return -1;
55277
55277
  }
@@ -55412,10 +55412,10 @@ var require_response = __commonJS({
55412
55412
  var deprecate = require_depd()("express");
55413
55413
  var encodeUrl = require_encodeurl();
55414
55414
  var escapeHtml2 = require_escape_html();
55415
- var http5 = require("node:http");
55415
+ var http6 = require("node:http");
55416
55416
  var onFinished = require_on_finished();
55417
55417
  var mime = require_mime_types2();
55418
- var path10 = require("node:path");
55418
+ var path14 = require("node:path");
55419
55419
  var pathIsAbsolute = require("node:path").isAbsolute;
55420
55420
  var statuses = require_statuses();
55421
55421
  var sign = require_cookie_signature().sign;
@@ -55424,11 +55424,11 @@ var require_response = __commonJS({
55424
55424
  var setCharset = require_utils3().setCharset;
55425
55425
  var cookie = require_cookie();
55426
55426
  var send = require_send();
55427
- var extname = path10.extname;
55428
- var resolve2 = path10.resolve;
55427
+ var extname = path14.extname;
55428
+ var resolve4 = path14.resolve;
55429
55429
  var vary = require_vary();
55430
55430
  var { Buffer: Buffer2 } = require("node:buffer");
55431
- var res = Object.create(http5.ServerResponse.prototype);
55431
+ var res = Object.create(http6.ServerResponse.prototype);
55432
55432
  module2.exports = res;
55433
55433
  res.status = function status(code) {
55434
55434
  if (!Number.isInteger(code)) {
@@ -55572,26 +55572,26 @@ var require_response = __commonJS({
55572
55572
  this.type("txt");
55573
55573
  return this.send(body);
55574
55574
  };
55575
- res.sendFile = function sendFile(path11, options, callback) {
55575
+ res.sendFile = function sendFile(path15, options, callback) {
55576
55576
  var done = callback;
55577
55577
  var req = this.req;
55578
55578
  var res2 = this;
55579
55579
  var next = req.next;
55580
55580
  var opts = options || {};
55581
- if (!path11) {
55581
+ if (!path15) {
55582
55582
  throw new TypeError("path argument is required to res.sendFile");
55583
55583
  }
55584
- if (typeof path11 !== "string") {
55584
+ if (typeof path15 !== "string") {
55585
55585
  throw new TypeError("path must be a string to res.sendFile");
55586
55586
  }
55587
55587
  if (typeof options === "function") {
55588
55588
  done = options;
55589
55589
  opts = {};
55590
55590
  }
55591
- if (!opts.root && !pathIsAbsolute(path11)) {
55591
+ if (!opts.root && !pathIsAbsolute(path15)) {
55592
55592
  throw new TypeError("path must be absolute or specify root to res.sendFile");
55593
55593
  }
55594
- var pathname = encodeURI(path11);
55594
+ var pathname = encodeURI(path15);
55595
55595
  opts.etag = this.app.enabled("etag");
55596
55596
  var file = send(req, pathname, opts);
55597
55597
  sendfile(res2, file, opts, function(err) {
@@ -55604,7 +55604,7 @@ var require_response = __commonJS({
55604
55604
  }
55605
55605
  });
55606
55606
  };
55607
- res.download = function download(path11, filename, options, callback) {
55607
+ res.download = function download(path15, filename, options, callback) {
55608
55608
  var done = callback;
55609
55609
  var name = filename;
55610
55610
  var opts = options || null;
@@ -55621,7 +55621,7 @@ var require_response = __commonJS({
55621
55621
  opts = filename;
55622
55622
  }
55623
55623
  var headers = {
55624
- "Content-Disposition": contentDisposition(name || path11)
55624
+ "Content-Disposition": contentDisposition(name || path15)
55625
55625
  };
55626
55626
  if (opts && opts.headers) {
55627
55627
  var keys = Object.keys(opts.headers);
@@ -55634,7 +55634,7 @@ var require_response = __commonJS({
55634
55634
  }
55635
55635
  opts = Object.create(opts);
55636
55636
  opts.headers = headers;
55637
- var fullPath = !opts.root ? resolve2(path11) : path11;
55637
+ var fullPath = !opts.root ? resolve4(path15) : path15;
55638
55638
  return this.sendFile(fullPath, opts, done);
55639
55639
  };
55640
55640
  res.contentType = res.type = function contentType(type) {
@@ -55891,7 +55891,7 @@ var require_serve_static = __commonJS({
55891
55891
  var encodeUrl = require_encodeurl();
55892
55892
  var escapeHtml2 = require_escape_html();
55893
55893
  var parseUrl2 = require_parseurl();
55894
- var resolve2 = require("path").resolve;
55894
+ var resolve4 = require("path").resolve;
55895
55895
  var send = require_send();
55896
55896
  var url2 = require("url");
55897
55897
  module2.exports = serveStatic;
@@ -55910,7 +55910,7 @@ var require_serve_static = __commonJS({
55910
55910
  throw new TypeError("option setHeaders must be function");
55911
55911
  }
55912
55912
  opts.maxage = opts.maxage || opts.maxAge || 0;
55913
- opts.root = resolve2(root);
55913
+ opts.root = resolve4(root);
55914
55914
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
55915
55915
  return function serveStatic2(req, res, next) {
55916
55916
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -55925,11 +55925,11 @@ var require_serve_static = __commonJS({
55925
55925
  }
55926
55926
  var forwardError = !fallthrough;
55927
55927
  var originalUrl = parseUrl2.original(req);
55928
- var path10 = parseUrl2(req).pathname;
55929
- if (path10 === "/" && originalUrl.pathname.substr(-1) !== "/") {
55930
- path10 = "";
55928
+ var path14 = parseUrl2(req).pathname;
55929
+ if (path14 === "/" && originalUrl.pathname.substr(-1) !== "/") {
55930
+ path14 = "";
55931
55931
  }
55932
- var stream4 = send(req, path10, opts);
55932
+ var stream4 = send(req, path14, opts);
55933
55933
  stream4.on("directory", onDirectory);
55934
55934
  if (setHeaders) {
55935
55935
  stream4.on("headers", setHeaders);
@@ -56199,6 +56199,40 @@ var init_DriverManager = __esm({
56199
56199
  }
56200
56200
  });
56201
56201
 
56202
+ // src/services/featureFlags/FeatureFlagDefinitions.ts
56203
+ var FEATURE_FLAGS;
56204
+ var init_FeatureFlagDefinitions = __esm({
56205
+ "src/services/featureFlags/FeatureFlagDefinitions.ts"() {
56206
+ "use strict";
56207
+ FEATURE_FLAGS = {
56208
+ managedDuckDbRuntime: {
56209
+ id: "sql_preview_managed_duckdb_runtime",
56210
+ defaultValue: true,
56211
+ description: "Gates background auto-provisioning of the managed DuckDB runtime (RFC-075)."
56212
+ }
56213
+ };
56214
+ }
56215
+ });
56216
+
56217
+ // src/services/featureFlags/isFeatureEnabled.ts
56218
+ function isFeatureEnabled(key, env = process.env) {
56219
+ const definition = FEATURE_FLAGS[key];
56220
+ const override = env[`SQL_PREVIEW_FF_${definition.id.toUpperCase()}`];
56221
+ if (override === "1" || override === "true") {
56222
+ return true;
56223
+ }
56224
+ if (override === "0" || override === "false") {
56225
+ return false;
56226
+ }
56227
+ return definition.defaultValue;
56228
+ }
56229
+ var init_isFeatureEnabled = __esm({
56230
+ "src/services/featureFlags/isFeatureEnabled.ts"() {
56231
+ "use strict";
56232
+ init_FeatureFlagDefinitions();
56233
+ }
56234
+ });
56235
+
56202
56236
  // packages/sql-preview-connector-api/dist/jsonrpc.js
56203
56237
  var require_jsonrpc = __commonJS({
56204
56238
  "packages/sql-preview-connector-api/dist/jsonrpc.js"(exports) {
@@ -56470,12 +56504,13 @@ var init_src = __esm({
56470
56504
  import_connector_api = __toESM(require_dist2());
56471
56505
  init_descriptor();
56472
56506
  DuckDbConnector = class {
56507
+ constructor(_driverManager, duckDbRuntime) {
56508
+ this.duckDbRuntime = duckDbRuntime;
56509
+ }
56473
56510
  id = "duckdb";
56474
56511
  supportsPagination = true;
56475
56512
  configSchema = duckDbConnectorConfigSchema;
56476
56513
  db;
56477
- constructor(_driverManager) {
56478
- }
56479
56514
  validateConfig(config2) {
56480
56515
  if (!config2.databasePath) {
56481
56516
  return "Database path is required";
@@ -56484,7 +56519,7 @@ var init_src = __esm({
56484
56519
  }
56485
56520
  async *runQuery(query, config2, _authHeader, abortSignal) {
56486
56521
  const dbPath = config2.databasePath || ":memory:";
56487
- const duckdbApi = this.loadDuckDbApi();
56522
+ const duckdbApi = await this.loadDuckDbApi();
56488
56523
  if (!this.db) {
56489
56524
  try {
56490
56525
  this.db = await duckdbApi.DuckDBInstance.create(dbPath);
@@ -56626,7 +56661,7 @@ var init_src = __esm({
56626
56661
  }
56627
56662
  async runMetadataQuery(config2, sql, params = []) {
56628
56663
  const dbPath = config2.databasePath || ":memory:";
56629
- const duckdbApi = this.loadDuckDbApi();
56664
+ const duckdbApi = await this.loadDuckDbApi();
56630
56665
  if (!this.db) {
56631
56666
  this.db = await duckdbApi.DuckDBInstance.create(dbPath);
56632
56667
  }
@@ -56638,8 +56673,23 @@ var init_src = __esm({
56638
56673
  } finally {
56639
56674
  }
56640
56675
  }
56641
- loadDuckDbApi() {
56642
- return require("@duckdb/node-api");
56676
+ async loadDuckDbApi() {
56677
+ try {
56678
+ return await this.duckDbRuntime.acquire();
56679
+ } catch (error2) {
56680
+ const runtimeError = this.duckDbRuntime.lastError?.();
56681
+ if (runtimeError?.reason === "offline") {
56682
+ throw new import_connector_api.ConnectionError("DuckDB engine is unavailable offline. Retrying automatically.");
56683
+ }
56684
+ if (runtimeError?.reason === "disabled") {
56685
+ throw new import_connector_api.ConnectionError(
56686
+ "DuckDB engine is unavailable. Download the engine from Local Files."
56687
+ );
56688
+ }
56689
+ throw new import_connector_api.ConnectionError(
56690
+ runtimeError?.message || `DuckDB engine is unavailable: ${error2 instanceof Error ? error2.message : String(error2)}`
56691
+ );
56692
+ }
56643
56693
  }
56644
56694
  async testConnection(config2) {
56645
56695
  try {
@@ -56680,9 +56730,9 @@ var init_descriptor = __esm({
56680
56730
  displayName: "DuckDB",
56681
56731
  supportsPagination: true,
56682
56732
  configSchema: duckDbConnectorConfigSchema,
56683
- create: (driverManager) => {
56733
+ create: (driverManager, duckDbRuntime) => {
56684
56734
  const { default: DuckDbConnector2 } = (init_src(), __toCommonJS(src_exports));
56685
- return new DuckDbConnector2(driverManager);
56735
+ return new DuckDbConnector2(driverManager, duckDbRuntime);
56686
56736
  }
56687
56737
  };
56688
56738
  }
@@ -66479,11 +66529,11 @@ var require_mime_types5 = __commonJS({
66479
66529
  }
66480
66530
  return exts[0];
66481
66531
  }
66482
- function lookup(path10) {
66483
- if (!path10 || typeof path10 !== "string") {
66532
+ function lookup(path14) {
66533
+ if (!path14 || typeof path14 !== "string") {
66484
66534
  return false;
66485
66535
  }
66486
- var extension3 = extname("x." + path10).toLowerCase().substr(1);
66536
+ var extension3 = extname("x." + path14).toLowerCase().substr(1);
66487
66537
  if (!extension3) {
66488
66538
  return false;
66489
66539
  }
@@ -66785,13 +66835,13 @@ var require_form_data = __commonJS({
66785
66835
  "use strict";
66786
66836
  var CombinedStream = require_combined_stream();
66787
66837
  var util4 = require("util");
66788
- var path10 = require("path");
66789
- var http5 = require("http");
66790
- var https4 = require("https");
66838
+ var path14 = require("path");
66839
+ var http6 = require("http");
66840
+ var https5 = require("https");
66791
66841
  var parseUrl2 = require("url").parse;
66792
- var fs13 = require("fs");
66842
+ var fs17 = require("fs");
66793
66843
  var Stream = require("stream").Stream;
66794
- var crypto8 = require("crypto");
66844
+ var crypto9 = require("crypto");
66795
66845
  var mime = require_mime_types5();
66796
66846
  var asynckit = require_asynckit();
66797
66847
  var setToStringTag = require_es_set_tostringtag();
@@ -66856,7 +66906,7 @@ var require_form_data = __commonJS({
66856
66906
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
66857
66907
  callback(null, value.end + 1 - (value.start ? value.start : 0));
66858
66908
  } else {
66859
- fs13.stat(value.path, function(err, stat) {
66909
+ fs17.stat(value.path, function(err, stat) {
66860
66910
  if (err) {
66861
66911
  callback(err);
66862
66912
  return;
@@ -66913,11 +66963,11 @@ var require_form_data = __commonJS({
66913
66963
  FormData3.prototype._getContentDisposition = function(value, options) {
66914
66964
  var filename;
66915
66965
  if (typeof options.filepath === "string") {
66916
- filename = path10.normalize(options.filepath).replace(/\\/g, "/");
66966
+ filename = path14.normalize(options.filepath).replace(/\\/g, "/");
66917
66967
  } else if (options.filename || value && (value.name || value.path)) {
66918
- filename = path10.basename(options.filename || value && (value.name || value.path));
66968
+ filename = path14.basename(options.filename || value && (value.name || value.path));
66919
66969
  } else if (value && value.readable && hasOwn(value, "httpVersion")) {
66920
- filename = path10.basename(value.client._httpMessage.path || "");
66970
+ filename = path14.basename(value.client._httpMessage.path || "");
66921
66971
  }
66922
66972
  if (filename) {
66923
66973
  return 'filename="' + filename + '"';
@@ -66997,7 +67047,7 @@ var require_form_data = __commonJS({
66997
67047
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
66998
67048
  };
66999
67049
  FormData3.prototype._generateBoundary = function() {
67000
- this._boundary = "--------------------------" + crypto8.randomBytes(12).toString("hex");
67050
+ this._boundary = "--------------------------" + crypto9.randomBytes(12).toString("hex");
67001
67051
  };
67002
67052
  FormData3.prototype.getLengthSync = function() {
67003
67053
  var knownLength = this._overheadLength + this._valueLength;
@@ -67056,9 +67106,9 @@ var require_form_data = __commonJS({
67056
67106
  }
67057
67107
  options.headers = this.getHeaders(params.headers);
67058
67108
  if (options.protocol === "https:") {
67059
- request = https4.request(options);
67109
+ request = https5.request(options);
67060
67110
  } else {
67061
- request = http5.request(options);
67111
+ request = http6.request(options);
67062
67112
  }
67063
67113
  this.getLength(function(err, length) {
67064
67114
  if (err && err !== "Unknown stream") {
@@ -67114,10 +67164,10 @@ function isVisitable(thing) {
67114
67164
  function removeBrackets(key) {
67115
67165
  return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
67116
67166
  }
67117
- function renderKey(path10, key, dots) {
67118
- if (!path10)
67167
+ function renderKey(path14, key, dots) {
67168
+ if (!path14)
67119
67169
  return key;
67120
- return path10.concat(key).map(function each(token, i) {
67170
+ return path14.concat(key).map(function each(token, i) {
67121
67171
  token = removeBrackets(token);
67122
67172
  return !dots && i ? "[" + token + "]" : token;
67123
67173
  }).join(dots ? "." : "");
@@ -67169,13 +67219,13 @@ function toFormData(obj, formData, options) {
67169
67219
  }
67170
67220
  return value;
67171
67221
  }
67172
- function defaultVisitor(value, key, path10) {
67222
+ function defaultVisitor(value, key, path14) {
67173
67223
  let arr = value;
67174
67224
  if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
67175
- formData.append(renderKey(path10, key, dots), convertValue(value));
67225
+ formData.append(renderKey(path14, key, dots), convertValue(value));
67176
67226
  return false;
67177
67227
  }
67178
- if (value && !path10 && typeof value === "object") {
67228
+ if (value && !path14 && typeof value === "object") {
67179
67229
  if (utils_default.endsWith(key, "{}")) {
67180
67230
  key = metaTokens ? key : key.slice(0, -2);
67181
67231
  value = JSON.stringify(value);
@@ -67194,7 +67244,7 @@ function toFormData(obj, formData, options) {
67194
67244
  if (isVisitable(value)) {
67195
67245
  return true;
67196
67246
  }
67197
- formData.append(renderKey(path10, key, dots), convertValue(value));
67247
+ formData.append(renderKey(path14, key, dots), convertValue(value));
67198
67248
  return false;
67199
67249
  }
67200
67250
  const stack = [];
@@ -67203,7 +67253,7 @@ function toFormData(obj, formData, options) {
67203
67253
  convertValue,
67204
67254
  isVisitable
67205
67255
  });
67206
- function build(value, path10, depth = 0) {
67256
+ function build(value, path14, depth = 0) {
67207
67257
  if (utils_default.isUndefined(value))
67208
67258
  return;
67209
67259
  if (depth > maxDepth) {
@@ -67213,13 +67263,13 @@ function toFormData(obj, formData, options) {
67213
67263
  );
67214
67264
  }
67215
67265
  if (stack.indexOf(value) !== -1) {
67216
- throw Error("Circular reference detected in " + path10.join("."));
67266
+ throw Error("Circular reference detected in " + path14.join("."));
67217
67267
  }
67218
67268
  stack.push(value);
67219
67269
  utils_default.forEach(value, function each(el, key) {
67220
- const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path10, exposedHelpers);
67270
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path14, exposedHelpers);
67221
67271
  if (result === true) {
67222
- build(el, path10 ? path10.concat(key) : [key], depth + 1);
67272
+ build(el, path14 ? path14.concat(key) : [key], depth + 1);
67223
67273
  }
67224
67274
  });
67225
67275
  stack.pop();
@@ -67492,7 +67542,7 @@ var init_platform = __esm({
67492
67542
  // node_modules/axios/lib/helpers/toURLEncodedForm.js
67493
67543
  function toURLEncodedForm(data, options) {
67494
67544
  return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
67495
- visitor: function(value, key, path10, helpers) {
67545
+ visitor: function(value, key, path14, helpers) {
67496
67546
  if (platform_default.isNode && utils_default.isBuffer(value)) {
67497
67547
  this.append(key, value.toString("base64"));
67498
67548
  return false;
@@ -67530,12 +67580,12 @@ function arrayToObject(arr) {
67530
67580
  return obj;
67531
67581
  }
67532
67582
  function formDataToJSON(formData) {
67533
- function buildPath(path10, value, target, index) {
67534
- let name = path10[index++];
67583
+ function buildPath(path14, value, target, index) {
67584
+ let name = path14[index++];
67535
67585
  if (name === "__proto__")
67536
67586
  return true;
67537
67587
  const isNumericKey = Number.isFinite(+name);
67538
- const isLast = index >= path10.length;
67588
+ const isLast = index >= path14.length;
67539
67589
  name = !name && utils_default.isArray(target) ? target.length : name;
67540
67590
  if (isLast) {
67541
67591
  if (utils_default.hasOwnProp(target, name)) {
@@ -67548,7 +67598,7 @@ function formDataToJSON(formData) {
67548
67598
  if (!target[name] || !utils_default.isObject(target[name])) {
67549
67599
  target[name] = [];
67550
67600
  }
67551
- const result = buildPath(path10, value, target[name], index);
67601
+ const result = buildPath(path14, value, target[name], index);
67552
67602
  if (result && utils_default.isArray(target[name])) {
67553
67603
  target[name] = arrayToObject(target[name]);
67554
67604
  }
@@ -67760,10 +67810,10 @@ var init_CanceledError = __esm({
67760
67810
  });
67761
67811
 
67762
67812
  // node_modules/axios/lib/core/settle.js
67763
- function settle(resolve2, reject, response) {
67813
+ function settle(resolve4, reject, response) {
67764
67814
  const validateStatus2 = response.config.validateStatus;
67765
67815
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
67766
- resolve2(response);
67816
+ resolve4(response);
67767
67817
  } else {
67768
67818
  reject(new AxiosError_default(
67769
67819
  "Request failed with status code " + response.status,
@@ -67918,8 +67968,8 @@ var require_follow_redirects = __commonJS({
67918
67968
  "node_modules/follow-redirects/index.js"(exports, module2) {
67919
67969
  var url2 = require("url");
67920
67970
  var URL3 = url2.URL;
67921
- var http5 = require("http");
67922
- var https4 = require("https");
67971
+ var http6 = require("http");
67972
+ var https5 = require("https");
67923
67973
  var Writable = require("stream").Writable;
67924
67974
  var assert2 = require("assert");
67925
67975
  var debug = require_debug();
@@ -68419,7 +68469,7 @@ var require_follow_redirects = __commonJS({
68419
68469
  function escapeRegex2(regex) {
68420
68470
  return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
68421
68471
  }
68422
- module2.exports = wrap({ http: http5, https: https4 });
68472
+ module2.exports = wrap({ http: http6, https: https5 });
68423
68473
  module2.exports.wrap = wrap;
68424
68474
  }
68425
68475
  });
@@ -69341,7 +69391,7 @@ var init_http = __esm({
69341
69391
  http2Sessions = new Http2Sessions();
69342
69392
  isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
69343
69393
  wrapAsync = (asyncExecutor) => {
69344
- return new Promise((resolve2, reject) => {
69394
+ return new Promise((resolve4, reject) => {
69345
69395
  let onDone;
69346
69396
  let isDone;
69347
69397
  const done = (value, isRejected) => {
@@ -69352,7 +69402,7 @@ var init_http = __esm({
69352
69402
  };
69353
69403
  const _resolve = (value) => {
69354
69404
  done(value);
69355
- resolve2(value);
69405
+ resolve4(value);
69356
69406
  };
69357
69407
  const _reject = (reason) => {
69358
69408
  done(reason, true);
@@ -69399,7 +69449,7 @@ var init_http = __esm({
69399
69449
  }
69400
69450
  };
69401
69451
  http_default = isHttpAdapterSupported && function httpAdapter(config2) {
69402
- return wrapAsync(async function dispatchHttpRequest(resolve2, reject, onDone) {
69452
+ return wrapAsync(async function dispatchHttpRequest(resolve4, reject, onDone) {
69403
69453
  const own2 = (key) => utils_default.hasOwnProp(config2, key) ? config2[key] : void 0;
69404
69454
  let data = own2("data");
69405
69455
  let lookup = own2("lookup");
@@ -69519,7 +69569,7 @@ var init_http = __esm({
69519
69569
  }
69520
69570
  let convertedData;
69521
69571
  if (method !== "GET") {
69522
- return settle(resolve2, reject, {
69572
+ return settle(resolve4, reject, {
69523
69573
  status: 405,
69524
69574
  statusText: "method not allowed",
69525
69575
  headers: {},
@@ -69541,7 +69591,7 @@ var init_http = __esm({
69541
69591
  } else if (responseType === "stream") {
69542
69592
  convertedData = import_stream4.default.Readable.from(convertedData);
69543
69593
  }
69544
- return settle(resolve2, reject, {
69594
+ return settle(resolve4, reject, {
69545
69595
  data: convertedData,
69546
69596
  status: 200,
69547
69597
  statusText: "OK",
@@ -69655,9 +69705,9 @@ var init_http = __esm({
69655
69705
  auth = urlUsername + ":" + urlPassword;
69656
69706
  }
69657
69707
  auth && headers.delete("authorization");
69658
- let path10;
69708
+ let path14;
69659
69709
  try {
69660
- path10 = buildURL(
69710
+ path14 = buildURL(
69661
69711
  parsed.pathname + parsed.search,
69662
69712
  config2.params,
69663
69713
  config2.paramsSerializer
@@ -69675,7 +69725,7 @@ var init_http = __esm({
69675
69725
  false
69676
69726
  );
69677
69727
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
69678
- path: path10,
69728
+ path: path14,
69679
69729
  method,
69680
69730
  headers: headers.toJSON(),
69681
69731
  agents: { http: config2.httpAgent, https: config2.httpsAgent },
@@ -69829,7 +69879,7 @@ var init_http = __esm({
69829
69879
  });
69830
69880
  }
69831
69881
  response.data = responseStream;
69832
- settle(resolve2, reject, response);
69882
+ settle(resolve4, reject, response);
69833
69883
  } else {
69834
69884
  const responseBuffer = [];
69835
69885
  let totalResponseBytes = 0;
@@ -69881,7 +69931,7 @@ var init_http = __esm({
69881
69931
  } catch (err) {
69882
69932
  return reject(AxiosError_default.from(err, null, config2, response.request, response));
69883
69933
  }
69884
- settle(resolve2, reject, response);
69934
+ settle(resolve4, reject, response);
69885
69935
  });
69886
69936
  }
69887
69937
  abortEmitter.once("abort", (err) => {
@@ -70030,15 +70080,15 @@ var init_cookies = __esm({
70030
70080
  cookies_default = platform_default.hasStandardBrowserEnv ? (
70031
70081
  // Standard browser envs support document.cookie
70032
70082
  {
70033
- write(name, value, expires, path10, domain, secure, sameSite) {
70083
+ write(name, value, expires, path14, domain, secure, sameSite) {
70034
70084
  if (typeof document === "undefined")
70035
70085
  return;
70036
70086
  const cookie = [`${name}=${encodeURIComponent(value)}`];
70037
70087
  if (utils_default.isNumber(expires)) {
70038
70088
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
70039
70089
  }
70040
- if (utils_default.isString(path10)) {
70041
- cookie.push(`path=${path10}`);
70090
+ if (utils_default.isString(path14)) {
70091
+ cookie.push(`path=${path14}`);
70042
70092
  }
70043
70093
  if (utils_default.isString(domain)) {
70044
70094
  cookie.push(`domain=${domain}`);
@@ -70277,7 +70327,7 @@ var init_xhr = __esm({
70277
70327
  init_resolveConfig();
70278
70328
  isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
70279
70329
  xhr_default = isXHRAdapterSupported && function(config2) {
70280
- return new Promise(function dispatchXhrRequest(resolve2, reject) {
70330
+ return new Promise(function dispatchXhrRequest(resolve4, reject) {
70281
70331
  const _config = resolveConfig_default(config2);
70282
70332
  let requestData = _config.data;
70283
70333
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
@@ -70312,7 +70362,7 @@ var init_xhr = __esm({
70312
70362
  };
70313
70363
  settle(
70314
70364
  function _resolve(value) {
70315
- resolve2(value);
70365
+ resolve4(value);
70316
70366
  done();
70317
70367
  },
70318
70368
  function _reject(err) {
@@ -70826,8 +70876,8 @@ var init_fetch = __esm({
70826
70876
  }
70827
70877
  }
70828
70878
  !isStreamResponse && unsubscribe && unsubscribe();
70829
- return await new Promise((resolve2, reject) => {
70830
- settle(resolve2, reject, {
70879
+ return await new Promise((resolve4, reject) => {
70880
+ settle(resolve4, reject, {
70831
70881
  data: responseData,
70832
70882
  headers: AxiosHeaders_default.from(response.headers),
70833
70883
  status: response.status,
@@ -71322,8 +71372,8 @@ var init_CancelToken = __esm({
71322
71372
  throw new TypeError("executor must be a function.");
71323
71373
  }
71324
71374
  let resolvePromise;
71325
- this.promise = new Promise(function promiseExecutor(resolve2) {
71326
- resolvePromise = resolve2;
71375
+ this.promise = new Promise(function promiseExecutor(resolve4) {
71376
+ resolvePromise = resolve4;
71327
71377
  });
71328
71378
  const token = this;
71329
71379
  this.promise.then((cancel) => {
@@ -71337,9 +71387,9 @@ var init_CancelToken = __esm({
71337
71387
  });
71338
71388
  this.promise.then = (onfulfilled) => {
71339
71389
  let _resolve;
71340
- const promise = new Promise((resolve2) => {
71341
- token.subscribe(resolve2);
71342
- _resolve = resolve2;
71390
+ const promise = new Promise((resolve4) => {
71391
+ token.subscribe(resolve4);
71392
+ _resolve = resolve4;
71343
71393
  }).then(onfulfilled);
71344
71394
  promise.cancel = function reject() {
71345
71395
  token.unsubscribe(_resolve);
@@ -72001,7 +72051,7 @@ var require_bignumber = __commonJS({
72001
72051
  return arr.reverse();
72002
72052
  }
72003
72053
  return function(str, baseIn, baseOut, sign, callerIsToString) {
72004
- var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
72054
+ var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm2 = ROUNDING_MODE;
72005
72055
  if (i >= 0) {
72006
72056
  k = POW_PRECISION;
72007
72057
  POW_PRECISION = 0;
@@ -72029,7 +72079,7 @@ var require_bignumber = __commonJS({
72029
72079
  x.c = xc;
72030
72080
  x.e = e;
72031
72081
  x.s = sign;
72032
- x = div(x, y, dp, rm, baseOut);
72082
+ x = div(x, y, dp, rm2, baseOut);
72033
72083
  xc = x.c;
72034
72084
  r = x.r;
72035
72085
  e = x.e;
@@ -72038,7 +72088,7 @@ var require_bignumber = __commonJS({
72038
72088
  i = xc[d];
72039
72089
  k = baseOut / 2;
72040
72090
  r = r || d < 0 || xc[d + 1] != null;
72041
- r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
72091
+ r = rm2 < 4 ? (i != null || r) && (rm2 == 0 || rm2 == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm2 == 4 || r || rm2 == 6 && xc[d - 1] & 1 || rm2 == (x.s < 0 ? 8 : 7));
72042
72092
  if (d < 1 || !xc[0]) {
72043
72093
  str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
72044
72094
  } else {
@@ -72100,7 +72150,7 @@ var require_bignumber = __commonJS({
72100
72150
  for (; !a[0] && a.length > 1; a.splice(0, 1))
72101
72151
  ;
72102
72152
  }
72103
- return function(x, y, dp, rm, base) {
72153
+ return function(x, y, dp, rm2, base) {
72104
72154
  var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
72105
72155
  if (!xc || !xc[0] || !yc || !yc[0]) {
72106
72156
  return new BigNumber2(
@@ -72206,7 +72256,7 @@ var require_bignumber = __commonJS({
72206
72256
  if (base == BASE) {
72207
72257
  for (i = 1, s = qc[0]; s >= 10; s /= 10, i++)
72208
72258
  ;
72209
- round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
72259
+ round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm2, more);
72210
72260
  } else {
72211
72261
  q.e = e;
72212
72262
  q.r = +more;
@@ -72214,12 +72264,12 @@ var require_bignumber = __commonJS({
72214
72264
  return q;
72215
72265
  };
72216
72266
  }();
72217
- function format(n, i, rm, id) {
72267
+ function format(n, i, rm2, id) {
72218
72268
  var c0, e, ne, len, str;
72219
- if (rm == null)
72220
- rm = ROUNDING_MODE;
72269
+ if (rm2 == null)
72270
+ rm2 = ROUNDING_MODE;
72221
72271
  else
72222
- intCheck(rm, 0, 8);
72272
+ intCheck(rm2, 0, 8);
72223
72273
  if (!n.c)
72224
72274
  return n.toString();
72225
72275
  c0 = n.c[0];
@@ -72228,7 +72278,7 @@ var require_bignumber = __commonJS({
72228
72278
  str = coeffToString(n.c);
72229
72279
  str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
72230
72280
  } else {
72231
- n = round(new BigNumber2(n), i, rm);
72281
+ n = round(new BigNumber2(n), i, rm2);
72232
72282
  e = n.e;
72233
72283
  str = coeffToString(n.c);
72234
72284
  len = str.length;
@@ -72309,7 +72359,7 @@ var require_bignumber = __commonJS({
72309
72359
  x.c = x.e = null;
72310
72360
  };
72311
72361
  }();
72312
- function round(x, sd, rm, r) {
72362
+ function round(x, sd, rm2, r) {
72313
72363
  var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
72314
72364
  if (xc) {
72315
72365
  out: {
@@ -72347,8 +72397,8 @@ var require_bignumber = __commonJS({
72347
72397
  // The expression n % pows10[d - j - 1] returns all digits of n to the right
72348
72398
  // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
72349
72399
  xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
72350
- r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
72351
- (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
72400
+ r = rm2 < 4 ? (rd || r) && (rm2 == 0 || rm2 == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm2 == 4 || r || rm2 == 6 && // Check whether the digit to the left of the rounding digit is odd.
72401
+ (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm2 == (x.s < 0 ? 8 : 7));
72352
72402
  if (sd < 1 || !xc[0]) {
72353
72403
  xc.length = 0;
72354
72404
  if (r) {
@@ -72420,15 +72470,15 @@ var require_bignumber = __commonJS({
72420
72470
  P.comparedTo = function(y, b) {
72421
72471
  return compare(this, new BigNumber2(y, b));
72422
72472
  };
72423
- P.decimalPlaces = P.dp = function(dp, rm) {
72473
+ P.decimalPlaces = P.dp = function(dp, rm2) {
72424
72474
  var c, n, v, x = this;
72425
72475
  if (dp != null) {
72426
72476
  intCheck(dp, 0, MAX);
72427
- if (rm == null)
72428
- rm = ROUNDING_MODE;
72477
+ if (rm2 == null)
72478
+ rm2 = ROUNDING_MODE;
72429
72479
  else
72430
- intCheck(rm, 0, 8);
72431
- return round(new BigNumber2(x), dp + x.e + 1, rm);
72480
+ intCheck(rm2, 0, 8);
72481
+ return round(new BigNumber2(x), dp + x.e + 1, rm2);
72432
72482
  }
72433
72483
  if (!(c = x.c))
72434
72484
  return null;
@@ -72527,13 +72577,13 @@ var require_bignumber = __commonJS({
72527
72577
  y = ONE.div(y);
72528
72578
  return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
72529
72579
  };
72530
- P.integerValue = function(rm) {
72580
+ P.integerValue = function(rm2) {
72531
72581
  var n = new BigNumber2(this);
72532
- if (rm == null)
72533
- rm = ROUNDING_MODE;
72582
+ if (rm2 == null)
72583
+ rm2 = ROUNDING_MODE;
72534
72584
  else
72535
- intCheck(rm, 0, 8);
72536
- return round(n, n.e + 1, rm);
72585
+ intCheck(rm2, 0, 8);
72586
+ return round(n, n.e + 1, rm2);
72537
72587
  };
72538
72588
  P.isEqualTo = P.eq = function(y, b) {
72539
72589
  return compare(this, new BigNumber2(y, b)) === 0;
@@ -72773,15 +72823,15 @@ var require_bignumber = __commonJS({
72773
72823
  }
72774
72824
  return normalise(y, xc, ye);
72775
72825
  };
72776
- P.precision = P.sd = function(sd, rm) {
72826
+ P.precision = P.sd = function(sd, rm2) {
72777
72827
  var c, n, v, x = this;
72778
72828
  if (sd != null && sd !== !!sd) {
72779
72829
  intCheck(sd, 1, MAX);
72780
- if (rm == null)
72781
- rm = ROUNDING_MODE;
72830
+ if (rm2 == null)
72831
+ rm2 = ROUNDING_MODE;
72782
72832
  else
72783
- intCheck(rm, 0, 8);
72784
- return round(new BigNumber2(x), sd, rm);
72833
+ intCheck(rm2, 0, 8);
72834
+ return round(new BigNumber2(x), sd, rm2);
72785
72835
  }
72786
72836
  if (!(c = x.c))
72787
72837
  return null;
@@ -72858,36 +72908,36 @@ var require_bignumber = __commonJS({
72858
72908
  }
72859
72909
  return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
72860
72910
  };
72861
- P.toExponential = function(dp, rm) {
72911
+ P.toExponential = function(dp, rm2) {
72862
72912
  if (dp != null) {
72863
72913
  intCheck(dp, 0, MAX);
72864
72914
  dp++;
72865
72915
  }
72866
- return format(this, dp, rm, 1);
72916
+ return format(this, dp, rm2, 1);
72867
72917
  };
72868
- P.toFixed = function(dp, rm) {
72918
+ P.toFixed = function(dp, rm2) {
72869
72919
  if (dp != null) {
72870
72920
  intCheck(dp, 0, MAX);
72871
72921
  dp = dp + this.e + 1;
72872
72922
  }
72873
- return format(this, dp, rm);
72923
+ return format(this, dp, rm2);
72874
72924
  };
72875
- P.toFormat = function(dp, rm, format2) {
72925
+ P.toFormat = function(dp, rm2, format2) {
72876
72926
  var str, x = this;
72877
72927
  if (format2 == null) {
72878
- if (dp != null && rm && typeof rm == "object") {
72879
- format2 = rm;
72880
- rm = null;
72928
+ if (dp != null && rm2 && typeof rm2 == "object") {
72929
+ format2 = rm2;
72930
+ rm2 = null;
72881
72931
  } else if (dp && typeof dp == "object") {
72882
72932
  format2 = dp;
72883
- dp = rm = null;
72933
+ dp = rm2 = null;
72884
72934
  } else {
72885
72935
  format2 = FORMAT;
72886
72936
  }
72887
72937
  } else if (typeof format2 != "object") {
72888
72938
  throw Error(bignumberError + "Argument not an object: " + format2);
72889
72939
  }
72890
- str = x.toFixed(dp, rm);
72940
+ str = x.toFixed(dp, rm2);
72891
72941
  if (x.c) {
72892
72942
  var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
72893
72943
  if (g2) {
@@ -72960,10 +73010,10 @@ var require_bignumber = __commonJS({
72960
73010
  P.toNumber = function() {
72961
73011
  return +valueOf(this);
72962
73012
  };
72963
- P.toPrecision = function(sd, rm) {
73013
+ P.toPrecision = function(sd, rm2) {
72964
73014
  if (sd != null)
72965
73015
  intCheck(sd, 1, MAX);
72966
- return format(this, sd, rm, 2);
73016
+ return format(this, sd, rm2, 2);
72967
73017
  };
72968
73018
  P.toString = function(b) {
72969
73019
  var str, n = this, s = n.s, e = n.e;
@@ -73915,13 +73965,31 @@ var init_src3 = __esm({
73915
73965
  }
73916
73966
  // ── testConnection ──────────────────────────────────────────────────────
73917
73967
  async testConnection(config2) {
73968
+ const pgConfig = config2;
73969
+ const driverPath = await this.driverManager.getDriver("pg");
73970
+ const pg = require(driverPath);
73971
+ const clientConfig = {
73972
+ host: pgConfig.host,
73973
+ port: pgConfig.port,
73974
+ user: pgConfig.user,
73975
+ password: pgConfig.password,
73976
+ database: pgConfig.database,
73977
+ ssl: pgConfig.ssl ? {
73978
+ rejectUnauthorized: pgConfig.sslVerify ?? true
73979
+ } : false,
73980
+ connectionTimeoutMillis: 1e4
73981
+ };
73982
+ const client = new pg.Client(clientConfig);
73918
73983
  try {
73919
- const iter = this.runQuery("SELECT 1", config2);
73920
- await iter.next();
73984
+ await client.connect();
73985
+ await client.query("SELECT 1");
73921
73986
  return { success: true };
73922
73987
  } catch (err) {
73923
73988
  const message = err instanceof Error ? err.message : String(err);
73924
73989
  return { success: false, error: message };
73990
+ } finally {
73991
+ await client.end().catch(() => {
73992
+ });
73925
73993
  }
73926
73994
  }
73927
73995
  async *runQuery(query, config2, _authHeader, abortSignal) {
@@ -73987,6 +74055,12 @@ var init_src3 = __esm({
73987
74055
  client.release();
73988
74056
  }
73989
74057
  }
74058
+ async dispose() {
74059
+ if (this.pool) {
74060
+ await this.pool.end();
74061
+ this.pool = void 0;
74062
+ }
74063
+ }
73990
74064
  mapPostgresType(oid) {
73991
74065
  switch (oid) {
73992
74066
  case 20:
@@ -75101,18 +75175,18 @@ function connectAsync(connection) {
75101
75175
  if (typeof connection.connectAsync === "function") {
75102
75176
  return connection.connectAsync();
75103
75177
  }
75104
- return new Promise((resolve2, reject) => {
75178
+ return new Promise((resolve4, reject) => {
75105
75179
  connection.connect((err) => {
75106
75180
  if (err) {
75107
75181
  reject(err);
75108
75182
  } else {
75109
- resolve2();
75183
+ resolve4();
75110
75184
  }
75111
75185
  });
75112
75186
  });
75113
75187
  }
75114
75188
  function executeAsync(connection, sqlText) {
75115
- return new Promise((resolve2, reject) => {
75189
+ return new Promise((resolve4, reject) => {
75116
75190
  connection.execute({
75117
75191
  sqlText,
75118
75192
  fetchAsString: ["Date", "JSON"],
@@ -75121,14 +75195,14 @@ function executeAsync(connection, sqlText) {
75121
75195
  reject(err);
75122
75196
  return;
75123
75197
  }
75124
- resolve2({ rows: rows ?? [], columns: [] });
75198
+ resolve4({ rows: rows ?? [], columns: [] });
75125
75199
  }
75126
75200
  });
75127
75201
  });
75128
75202
  }
75129
75203
  function destroyAsync(connection) {
75130
- return new Promise((resolve2) => {
75131
- connection.destroy((_destroyErr) => resolve2());
75204
+ return new Promise((resolve4) => {
75205
+ connection.destroy((_destroyErr) => resolve4());
75132
75206
  });
75133
75207
  }
75134
75208
  function inferTypeFromValue(value) {
@@ -75757,14 +75831,14 @@ function loadConnectorDescriptor(sourceModulePath, sourceLoader, distModulePath)
75757
75831
  return require(distModulePath).connectorDescriptor;
75758
75832
  }
75759
75833
  }
75760
- function createBuiltInConnectorFactories(driverManager) {
75834
+ function createBuiltInConnectorFactories(driverManager, duckDbRuntime) {
75761
75835
  return BUILT_IN_CONNECTOR_DESCRIPTORS.map((descriptor) => {
75762
75836
  return {
75763
75837
  id: descriptor.id,
75764
75838
  displayName: descriptor.displayName,
75765
75839
  supportsPagination: descriptor.supportsPagination,
75766
75840
  configSchema: descriptor.configSchema,
75767
- load: () => descriptor.create(driverManager)
75841
+ load: () => descriptor.create(driverManager, duckDbRuntime)
75768
75842
  };
75769
75843
  });
75770
75844
  }
@@ -76046,6 +76120,38 @@ var init_EnvProfileStore = __esm({
76046
76120
  }
76047
76121
  });
76048
76122
 
76123
+ // src/server/connection/BuiltInProfileStore.ts
76124
+ var BUILT_IN_DUCKDB_PROFILE_ID, BuiltInProfileStore;
76125
+ var init_BuiltInProfileStore = __esm({
76126
+ "src/server/connection/BuiltInProfileStore.ts"() {
76127
+ "use strict";
76128
+ BUILT_IN_DUCKDB_PROFILE_ID = "built-in-duckdb";
76129
+ BuiltInProfileStore = class {
76130
+ constructor(duckDbRuntime) {
76131
+ this.duckDbRuntime = duckDbRuntime;
76132
+ this.isReadOnly = true;
76133
+ }
76134
+ async loadProfiles() {
76135
+ void this.duckDbRuntime;
76136
+ return [
76137
+ {
76138
+ id: BUILT_IN_DUCKDB_PROFILE_ID,
76139
+ name: "Local Files",
76140
+ type: "duckdb",
76141
+ databasePath: ":memory:"
76142
+ }
76143
+ ];
76144
+ }
76145
+ async saveProfile() {
76146
+ throw new Error("BuiltInProfileStore is read-only.");
76147
+ }
76148
+ async deleteProfile() {
76149
+ throw new Error("BuiltInProfileStore is read-only.");
76150
+ }
76151
+ };
76152
+ }
76153
+ });
76154
+
76049
76155
  // src/server/connection/FileProfileStore.ts
76050
76156
  var fs4, path2, os, FileProfileStore;
76051
76157
  var init_FileProfileStore = __esm({
@@ -76164,6 +76270,10 @@ var init_DaemonConfig = __esm({
76164
76270
  maxRows: 1e4,
76165
76271
  timeoutMs: 5 * 60 * 1e3
76166
76272
  },
76273
+ duckdb: {
76274
+ autoProvision: true,
76275
+ runtimePath: null
76276
+ },
76167
76277
  mcp: {
76168
76278
  safeMode: true
76169
76279
  },
@@ -76190,25 +76300,25 @@ var init_DaemonConfig = __esm({
76190
76300
  });
76191
76301
 
76192
76302
  // src/server/config/ConfigValidator.ts
76193
- function assertInteger(value, path10, options = {}) {
76303
+ function assertInteger(value, path14, options = {}) {
76194
76304
  if (!Number.isInteger(value)) {
76195
- throw new ConfigValidationError(`${path10} must be an integer`);
76305
+ throw new ConfigValidationError(`${path14} must be an integer`);
76196
76306
  }
76197
76307
  if (options.min !== void 0 && value < options.min) {
76198
- throw new ConfigValidationError(`${path10} must be >= ${options.min}`);
76308
+ throw new ConfigValidationError(`${path14} must be >= ${options.min}`);
76199
76309
  }
76200
76310
  if (options.max !== void 0 && value > options.max) {
76201
- throw new ConfigValidationError(`${path10} must be <= ${options.max}`);
76311
+ throw new ConfigValidationError(`${path14} must be <= ${options.max}`);
76202
76312
  }
76203
76313
  }
76204
- function assertBoolean(value, path10) {
76314
+ function assertBoolean(value, path14) {
76205
76315
  if (typeof value !== "boolean") {
76206
- throw new ConfigValidationError(`${path10} must be a boolean`);
76316
+ throw new ConfigValidationError(`${path14} must be a boolean`);
76207
76317
  }
76208
76318
  }
76209
- function assertNonEmptyString(value, path10) {
76319
+ function assertNonEmptyString(value, path14) {
76210
76320
  if (typeof value !== "string" || value.trim().length === 0) {
76211
- throw new ConfigValidationError(`${path10} must be a non-empty string`);
76321
+ throw new ConfigValidationError(`${path14} must be a non-empty string`);
76212
76322
  }
76213
76323
  }
76214
76324
  function validateDaemonConfig(config2) {
@@ -76223,6 +76333,10 @@ function validateDaemonConfig(config2) {
76223
76333
  assertInteger(config2.sessions.cleanupIntervalMs, "sessions.cleanupIntervalMs", { min: 1e3 });
76224
76334
  assertInteger(config2.query.maxRows, "query.maxRows", { min: 1 });
76225
76335
  assertInteger(config2.query.timeoutMs, "query.timeoutMs", { min: 1e3 });
76336
+ assertBoolean(config2.duckdb.autoProvision, "duckdb.autoProvision");
76337
+ if (config2.duckdb.runtimePath !== null && typeof config2.duckdb.runtimePath !== "string") {
76338
+ throw new ConfigValidationError("duckdb.runtimePath must be a string or null");
76339
+ }
76226
76340
  assertBoolean(config2.mcp.safeMode, "mcp.safeMode");
76227
76341
  const logLevels = ["DEBUG", "INFO", "WARN", "ERROR"];
76228
76342
  if (!logLevels.includes(config2.logging.level)) {
@@ -76390,6 +76504,8 @@ var init_ConfigLoader = __esm({
76390
76504
  "sessions.cleanupIntervalMs",
76391
76505
  "query.maxRows",
76392
76506
  "query.timeoutMs",
76507
+ "duckdb.autoProvision",
76508
+ "duckdb.runtimePath",
76393
76509
  "mcp.safeMode",
76394
76510
  "logging.level",
76395
76511
  "logging.format",
@@ -76476,6 +76592,8 @@ var init_ConfigLoader = __esm({
76476
76592
  );
76477
76593
  setNumberEnv(overrides, "query.maxRows", this.env["SQL_PREVIEW_MAX_ROWS"]);
76478
76594
  setNumberEnv(overrides, "query.timeoutMs", this.env["SQL_PREVIEW_QUERY_TIMEOUT_MS"]);
76595
+ setBooleanEnv(overrides, "duckdb.autoProvision", this.env["SQL_PREVIEW_DUCKDB_AUTO_PROVISION"]);
76596
+ setStringEnv(overrides, "duckdb.runtimePath", this.env["SQL_PREVIEW_DUCKDB_RUNTIME_PATH"]);
76479
76597
  setBooleanEnv(overrides, "mcp.safeMode", this.env["SQL_PREVIEW_MCP_SAFE_MODE"]);
76480
76598
  setLogLevelEnv(overrides, this.env["SQL_PREVIEW_LOG_LEVEL"]);
76481
76599
  setNumberEnv(
@@ -76723,7 +76841,9 @@ var init_TelemetrySchema = __esm({
76723
76841
  "query_completed",
76724
76842
  "query_failed",
76725
76843
  "query_cancelled",
76726
- "mcp_tool_invoked"
76844
+ "mcp_tool_invoked",
76845
+ "duckdb_provision_completed",
76846
+ "duckdb_runtime_state"
76727
76847
  ];
76728
76848
  TELEMETRY_CONNECTORS = [
76729
76849
  "trino",
@@ -76924,6 +77044,15 @@ var init_TelemetrySchema = __esm({
76924
77044
  duration_bucket: "durationBucket",
76925
77045
  error_kind: "errorKind",
76926
77046
  connector: "connector"
77047
+ },
77048
+ duckdb_provision_completed: {
77049
+ outcome: "safeString",
77050
+ trigger: "source",
77051
+ duration_bucket: "durationBucket",
77052
+ retry_count_bucket: "safeString"
77053
+ },
77054
+ duckdb_runtime_state: {
77055
+ runtime_state: "safeString"
76927
77056
  }
76928
77057
  };
76929
77058
  EVENT_SET = new Set(TELEMETRY_EVENTS);
@@ -77375,7 +77504,7 @@ function buildBatchUrl(host) {
77375
77504
  }
77376
77505
  }
77377
77506
  function postJson(url2, payload, timeoutMs) {
77378
- return new Promise((resolve2, reject) => {
77507
+ return new Promise((resolve4, reject) => {
77379
77508
  const parsed = new import_url2.URL(url2);
77380
77509
  const body = JSON.stringify(payload);
77381
77510
  const client = parsed.protocol === "http:" ? http3 : https3;
@@ -77397,7 +77526,7 @@ function postJson(url2, payload, timeoutMs) {
77397
77526
  response.on("end", () => {
77398
77527
  const statusCode = response.statusCode ?? 0;
77399
77528
  if (statusCode >= 200 && statusCode < 300) {
77400
- resolve2();
77529
+ resolve4();
77401
77530
  } else {
77402
77531
  reject(new Error(`Telemetry request failed with status ${statusCode}`));
77403
77532
  }
@@ -78478,6 +78607,10 @@ var init_toolDefinitions = __esm({
78478
78607
  authHeader: {
78479
78608
  type: "string",
78480
78609
  description: "Optional auth header."
78610
+ },
78611
+ provisionRuntime: {
78612
+ type: "boolean",
78613
+ description: "Request a one-time managed DuckDB runtime download for Local Files."
78481
78614
  }
78482
78615
  }
78483
78616
  }
@@ -78923,6 +79056,14 @@ var init_DaemonMcpToolManager = __esm({
78923
79056
  const sanitized = { ...c };
78924
79057
  delete sanitized["password"];
78925
79058
  sanitized["builtIn"] = c.id.startsWith("built-in-");
79059
+ if (c.id === "built-in-duckdb") {
79060
+ sanitized["engineState"] = this.options.duckDbRuntime?.state() ?? "unavailable";
79061
+ const runtimeError = this.options.duckDbRuntime?.lastError();
79062
+ if (runtimeError) {
79063
+ sanitized["engineErrorReason"] = runtimeError.reason;
79064
+ sanitized["engineErrorMessage"] = runtimeError.message;
79065
+ }
79066
+ }
78926
79067
  if (c.activeForQueries === true) {
78927
79068
  sanitized["activeForQueries"] = true;
78928
79069
  }
@@ -78982,6 +79123,13 @@ This link expires at ${new Date(
78982
79123
  }
78983
79124
  async handleTestConnection(args) {
78984
79125
  const typedArgs = args;
79126
+ if (typedArgs?.provisionRuntime) {
79127
+ if (typedArgs.connectionId !== "built-in-duckdb" || !this.options.duckDbRuntime) {
79128
+ throw new Error("Managed DuckDB runtime provisioning is only available for Local Files.");
79129
+ }
79130
+ await this.options.duckDbRuntime.provisionNow();
79131
+ return { content: [{ type: "text", text: "DuckDB engine is ready." }] };
79132
+ }
78985
79133
  let typeToTest;
78986
79134
  let configToTest;
78987
79135
  let authHeaderToTest = typedArgs?.authHeader;
@@ -79159,7 +79307,7 @@ var init_SubProcessConnectorClient = __esm({
79159
79307
  let abortKillTimeout;
79160
79308
  let errorOutput = "";
79161
79309
  let stderrTruncated = false;
79162
- const closePromise = new Promise((resolve2, reject) => {
79310
+ const closePromise = new Promise((resolve4, reject) => {
79163
79311
  child.once("close", (code) => {
79164
79312
  childClosed = true;
79165
79313
  if (abortKillTimeout) {
@@ -79173,7 +79321,7 @@ var init_SubProcessConnectorClient = __esm({
79173
79321
  )
79174
79322
  );
79175
79323
  } else {
79176
- resolve2();
79324
+ resolve4();
79177
79325
  }
79178
79326
  });
79179
79327
  child.once("error", (err) => {
@@ -79319,13 +79467,13 @@ var init_LongLivedConnectorClient = __esm({
79319
79467
  }
79320
79468
  });
79321
79469
  const initPromise = this.sendRequest("initialize", { config: config2, auth });
79322
- return new Promise((resolve2, reject) => {
79470
+ return new Promise((resolve4, reject) => {
79323
79471
  const onError = (err) => reject(new import_connector_api10.ConnectionError(`Failed to initialize: ${err.message}`));
79324
79472
  this.child.once("error", onError);
79325
79473
  this.child.once("close", () => reject(new import_connector_api10.ConnectionError("Process closed before init")));
79326
79474
  initPromise.then(() => {
79327
79475
  this.child.removeListener("error", onError);
79328
- resolve2();
79476
+ resolve4();
79329
79477
  }).catch(reject);
79330
79478
  });
79331
79479
  }
@@ -79375,8 +79523,8 @@ var init_LongLivedConnectorClient = __esm({
79375
79523
  method,
79376
79524
  params
79377
79525
  };
79378
- const promise = new Promise((resolve2, reject) => {
79379
- this.pendingRequests.set(id, { resolve: resolve2, reject });
79526
+ const promise = new Promise((resolve4, reject) => {
79527
+ this.pendingRequests.set(id, { resolve: resolve4, reject });
79380
79528
  });
79381
79529
  this.child.stdin.write(JSON.stringify(req) + "\n");
79382
79530
  return promise;
@@ -79432,8 +79580,8 @@ var init_LongLivedConnectorClient = __esm({
79432
79580
  } else if (state.done) {
79433
79581
  break;
79434
79582
  } else {
79435
- await new Promise((resolve2) => {
79436
- state.resolve = resolve2;
79583
+ await new Promise((resolve4) => {
79584
+ state.resolve = resolve4;
79437
79585
  });
79438
79586
  state.resolve = void 0;
79439
79587
  }
@@ -79698,7 +79846,6 @@ var init_DaemonQueryExecutor = __esm({
79698
79846
  async *execute(query, sessionId, connectionId, abortSignal, connectionOverride, authHeaderOverride, maxRowsOverride, hooks) {
79699
79847
  this.logger.info(`Starting query execution for session ${sessionId}`, { query });
79700
79848
  let profile;
79701
- let isAutoRoutedDuckDbFileQuery = false;
79702
79849
  if (connectionOverride) {
79703
79850
  profile = connectionOverride;
79704
79851
  } else {
@@ -79754,17 +79901,9 @@ var init_DaemonQueryExecutor = __esm({
79754
79901
  // Default to memory, CWD set by process
79755
79902
  sslVerify: true
79756
79903
  };
79757
- isAutoRoutedDuckDbFileQuery = true;
79758
79904
  } catch (e) {
79759
79905
  this.logger.error("DuckDB connector failed during auto-routing", e);
79760
- throw new OptionalDependencyError({
79761
- connector: "duckdb",
79762
- dependency: "@duckdb/node-api",
79763
- capability: "local CSV/Parquet/JSON file queries",
79764
- installCommand: "npm install @duckdb/node-api",
79765
- guidance: "Local file queries require optional DuckDB support, but the DuckDB native module is not available in this extension runtime.",
79766
- cause: e instanceof Error ? e.message : String(e)
79767
- });
79906
+ throw e;
79768
79907
  }
79769
79908
  }
79770
79909
  }
@@ -79821,17 +79960,6 @@ var init_DaemonQueryExecutor = __esm({
79821
79960
  } catch (e) {
79822
79961
  const message = e instanceof Error ? e.message : String(e);
79823
79962
  const lowerMessage = message.toLowerCase();
79824
- const looksLikeMissingDuckDb = message.includes("@duckdb/node-api") || message.includes("Cannot find module") || message.includes("native module is not available");
79825
- if (isAutoRoutedDuckDbFileQuery && looksLikeMissingDuckDb) {
79826
- throw new OptionalDependencyError({
79827
- connector: "duckdb",
79828
- dependency: "@duckdb/node-api",
79829
- capability: "local CSV/Parquet/JSON file queries",
79830
- installCommand: "npm install @duckdb/node-api",
79831
- guidance: "Local file queries require optional DuckDB support, but the DuckDB native module is not available in this extension runtime.",
79832
- cause: message
79833
- });
79834
- }
79835
79963
  const looksLikeMissingSnowflakeSdk = message.includes("snowflake-sdk") || lowerMessage.includes("snowflake sdk") || lowerMessage.includes("sdk is not available");
79836
79964
  if (profile.type === "snowflake" && looksLikeMissingSnowflakeSdk) {
79837
79965
  throw new OptionalDependencyError({
@@ -80566,7 +80694,7 @@ data: ${Date.now()}
80566
80694
  const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
80567
80695
  let output = "";
80568
80696
  try {
80569
- const exitCode = await new Promise((resolve2, reject) => {
80697
+ const exitCode = await new Promise((resolve4, reject) => {
80570
80698
  const child = (0, import_child_process3.spawn)(npmCommand, ["install", dependency], {
80571
80699
  cwd: packageRoot,
80572
80700
  shell: false,
@@ -80579,7 +80707,7 @@ data: ${Date.now()}
80579
80707
  output += chunk.toString();
80580
80708
  });
80581
80709
  child.on("error", reject);
80582
- child.on("close", (code) => resolve2(code ?? 1));
80710
+ child.on("close", (code) => resolve4(code ?? 1));
80583
80711
  });
80584
80712
  if (exitCode !== 0) {
80585
80713
  logger.error(`[Daemon] npm install ${dependency} exited with code ${exitCode}: ${output}`);
@@ -80827,7 +80955,7 @@ var init_DaemonHttpRoutes = __esm({
80827
80955
  init_daemonVersion();
80828
80956
  init_protocolVersion();
80829
80957
  webProxiedTools = new Set(WEB_PROXIED_TOOLS);
80830
- SUPPORTED_OPTIONAL_DEPENDENCIES = /* @__PURE__ */ new Set(["@duckdb/node-api", "snowflake-sdk"]);
80958
+ SUPPORTED_OPTIONAL_DEPENDENCIES = /* @__PURE__ */ new Set(["snowflake-sdk"]);
80831
80959
  }
80832
80960
  });
80833
80961
 
@@ -81327,7 +81455,7 @@ var init_dist = __esm({
81327
81455
  });
81328
81456
  if (!chunk) {
81329
81457
  if (i === 1) {
81330
- await new Promise((resolve2) => setTimeout(resolve2));
81458
+ await new Promise((resolve4) => setTimeout(resolve4));
81331
81459
  maxReadCount = 3;
81332
81460
  continue;
81333
81461
  }
@@ -81707,10 +81835,10 @@ function mergeDefs(...defs) {
81707
81835
  function cloneDef(schema) {
81708
81836
  return mergeDefs(schema._zod.def);
81709
81837
  }
81710
- function getElementAtPath(obj, path10) {
81711
- if (!path10)
81838
+ function getElementAtPath(obj, path14) {
81839
+ if (!path14)
81712
81840
  return obj;
81713
- return path10.reduce((acc, key) => acc?.[key], obj);
81841
+ return path14.reduce((acc, key) => acc?.[key], obj);
81714
81842
  }
81715
81843
  function promiseAllObject(promisesObj) {
81716
81844
  const keys = Object.keys(promisesObj);
@@ -82005,11 +82133,11 @@ function aborted(x, startIndex = 0) {
82005
82133
  }
82006
82134
  return false;
82007
82135
  }
82008
- function prefixIssues(path10, issues) {
82136
+ function prefixIssues(path14, issues) {
82009
82137
  return issues.map((iss) => {
82010
82138
  var _a2;
82011
82139
  (_a2 = iss).path ?? (_a2.path = []);
82012
- iss.path.unshift(path10);
82140
+ iss.path.unshift(path14);
82013
82141
  return iss;
82014
82142
  });
82015
82143
  }
@@ -87923,9 +88051,9 @@ data:
87923
88051
  const initRequest = messages.find((m) => isInitializeRequest(m));
87924
88052
  const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
87925
88053
  if (this._enableJsonResponse) {
87926
- return new Promise((resolve2) => {
88054
+ return new Promise((resolve4) => {
87927
88055
  this._streamMapping.set(streamId, {
87928
- resolveJson: resolve2,
88056
+ resolveJson: resolve4,
87929
88057
  cleanup: () => {
87930
88058
  this._streamMapping.delete(streamId);
87931
88059
  }
@@ -88669,8 +88797,8 @@ var init_parseUtil = __esm({
88669
88797
  init_errors4();
88670
88798
  init_en2();
88671
88799
  makeIssue = (params) => {
88672
- const { data, path: path10, errorMaps, issueData } = params;
88673
- const fullPath = [...path10, ...issueData.path || []];
88800
+ const { data, path: path14, errorMaps, issueData } = params;
88801
+ const fullPath = [...path14, ...issueData.path || []];
88674
88802
  const fullIssue = {
88675
88803
  ...issueData,
88676
88804
  path: fullPath
@@ -88950,11 +89078,11 @@ var init_types3 = __esm({
88950
89078
  init_parseUtil();
88951
89079
  init_util2();
88952
89080
  ParseInputLazyPath = class {
88953
- constructor(parent, value, path10, key) {
89081
+ constructor(parent, value, path14, key) {
88954
89082
  this._cachedPath = [];
88955
89083
  this.parent = parent;
88956
89084
  this.data = value;
88957
- this._path = path10;
89085
+ this._path = path14;
88958
89086
  this._key = key;
88959
89087
  }
88960
89088
  get path() {
@@ -93256,7 +93384,7 @@ var init_protocol = __esm({
93256
93384
  return;
93257
93385
  }
93258
93386
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
93259
- await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
93387
+ await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
93260
93388
  options?.signal?.throwIfAborted();
93261
93389
  }
93262
93390
  } catch (error2) {
@@ -93273,7 +93401,7 @@ var init_protocol = __esm({
93273
93401
  */
93274
93402
  request(request, resultSchema, options) {
93275
93403
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
93276
- return new Promise((resolve2, reject) => {
93404
+ return new Promise((resolve4, reject) => {
93277
93405
  const earlyReject = (error2) => {
93278
93406
  reject(error2);
93279
93407
  };
@@ -93351,7 +93479,7 @@ var init_protocol = __esm({
93351
93479
  if (!parseResult.success) {
93352
93480
  reject(parseResult.error);
93353
93481
  } else {
93354
- resolve2(parseResult.data);
93482
+ resolve4(parseResult.data);
93355
93483
  }
93356
93484
  } catch (error2) {
93357
93485
  reject(error2);
@@ -93612,12 +93740,12 @@ var init_protocol = __esm({
93612
93740
  }
93613
93741
  } catch {
93614
93742
  }
93615
- return new Promise((resolve2, reject) => {
93743
+ return new Promise((resolve4, reject) => {
93616
93744
  if (signal.aborted) {
93617
93745
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
93618
93746
  return;
93619
93747
  }
93620
- const timeoutId = setTimeout(resolve2, interval);
93748
+ const timeoutId = setTimeout(resolve4, interval);
93621
93749
  signal.addEventListener("abort", () => {
93622
93750
  clearTimeout(timeoutId);
93623
93751
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -96654,7 +96782,7 @@ var require_compile = __commonJS({
96654
96782
  const schOrFunc = root.refs[ref];
96655
96783
  if (schOrFunc)
96656
96784
  return schOrFunc;
96657
- let _sch = resolve2.call(this, root, ref);
96785
+ let _sch = resolve4.call(this, root, ref);
96658
96786
  if (_sch === void 0) {
96659
96787
  const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
96660
96788
  const { schemaId } = this.opts;
@@ -96681,7 +96809,7 @@ var require_compile = __commonJS({
96681
96809
  function sameSchemaEnv(s1, s2) {
96682
96810
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
96683
96811
  }
96684
- function resolve2(root, ref) {
96812
+ function resolve4(root, ref) {
96685
96813
  let sch;
96686
96814
  while (typeof (sch = this.refs[ref]) == "string")
96687
96815
  ref = sch;
@@ -96900,8 +97028,8 @@ var require_utils4 = __commonJS({
96900
97028
  }
96901
97029
  return ind;
96902
97030
  }
96903
- function removeDotSegments(path10) {
96904
- let input = path10;
97031
+ function removeDotSegments(path14) {
97032
+ let input = path14;
96905
97033
  const output = [];
96906
97034
  let nextSlash = -1;
96907
97035
  let len = 0;
@@ -97153,8 +97281,8 @@ var require_schemes = __commonJS({
97153
97281
  wsComponent.secure = void 0;
97154
97282
  }
97155
97283
  if (wsComponent.resourceName) {
97156
- const [path10, query] = wsComponent.resourceName.split("?");
97157
- wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
97284
+ const [path14, query] = wsComponent.resourceName.split("?");
97285
+ wsComponent.path = path14 && path14 !== "/" ? path14 : void 0;
97158
97286
  wsComponent.query = query;
97159
97287
  wsComponent.resourceName = void 0;
97160
97288
  }
@@ -97213,7 +97341,7 @@ var require_schemes = __commonJS({
97213
97341
  urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
97214
97342
  return urnComponent;
97215
97343
  }
97216
- var http5 = (
97344
+ var http6 = (
97217
97345
  /** @type {SchemeHandler} */
97218
97346
  {
97219
97347
  scheme: "http",
@@ -97222,11 +97350,11 @@ var require_schemes = __commonJS({
97222
97350
  serialize: httpSerialize
97223
97351
  }
97224
97352
  );
97225
- var https4 = (
97353
+ var https5 = (
97226
97354
  /** @type {SchemeHandler} */
97227
97355
  {
97228
97356
  scheme: "https",
97229
- domainHost: http5.domainHost,
97357
+ domainHost: http6.domainHost,
97230
97358
  parse: httpParse,
97231
97359
  serialize: httpSerialize
97232
97360
  }
@@ -97270,8 +97398,8 @@ var require_schemes = __commonJS({
97270
97398
  var SCHEMES = (
97271
97399
  /** @type {Record<SchemeName, SchemeHandler>} */
97272
97400
  {
97273
- http: http5,
97274
- https: https4,
97401
+ http: http6,
97402
+ https: https5,
97275
97403
  ws,
97276
97404
  wss,
97277
97405
  urn,
@@ -97313,7 +97441,7 @@ var require_fast_uri = __commonJS({
97313
97441
  }
97314
97442
  return uri;
97315
97443
  }
97316
- function resolve2(baseURI, relativeURI, options) {
97444
+ function resolve4(baseURI, relativeURI, options) {
97317
97445
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
97318
97446
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
97319
97447
  schemelessOptions.skipEscape = true;
@@ -97572,7 +97700,7 @@ var require_fast_uri = __commonJS({
97572
97700
  var fastUri = {
97573
97701
  SCHEMES,
97574
97702
  normalize,
97575
- resolve: resolve2,
97703
+ resolve: resolve4,
97576
97704
  resolveComponent,
97577
97705
  equal,
97578
97706
  serialize,
@@ -100548,12 +100676,12 @@ var require_dist3 = __commonJS({
100548
100676
  throw new Error(`Unknown format "${name}"`);
100549
100677
  return f;
100550
100678
  };
100551
- function addFormats(ajv, list, fs13, exportName) {
100679
+ function addFormats(ajv, list, fs17, exportName) {
100552
100680
  var _a2;
100553
100681
  var _b;
100554
100682
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
100555
100683
  for (const f of list)
100556
- ajv.addFormat(f, fs13[f]);
100684
+ ajv.addFormat(f, fs17[f]);
100557
100685
  }
100558
100686
  module2.exports = exports = formatsPlugin;
100559
100687
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -106086,8 +106214,8 @@ var require_promise = __commonJS({
106086
106214
  _resolve;
106087
106215
  _reject;
106088
106216
  constructor() {
106089
- this._promise = new Promise((resolve2, reject) => {
106090
- this._resolve = resolve2;
106217
+ this._promise = new Promise((resolve4, reject) => {
106218
+ this._resolve = resolve4;
106091
106219
  this._reject = reject;
106092
106220
  });
106093
106221
  }
@@ -106183,9 +106311,9 @@ var require_exporter = __commonJS({
106183
106311
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
106184
106312
  var suppress_tracing_1 = require_suppress_tracing();
106185
106313
  function _export(exporter, arg) {
106186
- return new Promise((resolve2) => {
106314
+ return new Promise((resolve4) => {
106187
106315
  api_1.context.with((0, suppress_tracing_1.suppressTracing)(api_1.context.active()), () => {
106188
- exporter.export(arg, resolve2);
106316
+ exporter.export(arg, resolve4);
106189
106317
  });
106190
106318
  });
106191
106319
  }
@@ -107020,9 +107148,9 @@ var require_getMachineId_linux = __commonJS({
107020
107148
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
107021
107149
  async function getMachineId() {
107022
107150
  const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
107023
- for (const path10 of paths) {
107151
+ for (const path14 of paths) {
107024
107152
  try {
107025
- const result = await fs_1.promises.readFile(path10, { encoding: "utf8" });
107153
+ const result = await fs_1.promises.readFile(path14, { encoding: "utf8" });
107026
107154
  return result.trim();
107027
107155
  } catch (e) {
107028
107156
  api_1.diag.debug(`error reading machine id: ${e}`);
@@ -107228,7 +107356,7 @@ var require_ProcessDetector = __commonJS({
107228
107356
  exports.processDetector = void 0;
107229
107357
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
107230
107358
  var semconv_1 = require_semconv2();
107231
- var os3 = require("os");
107359
+ var os4 = require("os");
107232
107360
  var ProcessDetector = class {
107233
107361
  detect(_config) {
107234
107362
  const attributes = {
@@ -107248,7 +107376,7 @@ var require_ProcessDetector = __commonJS({
107248
107376
  attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
107249
107377
  }
107250
107378
  try {
107251
- const userInfo = os3.userInfo();
107379
+ const userInfo = os4.userInfo();
107252
107380
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
107253
107381
  } catch (e) {
107254
107382
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -108210,8 +108338,8 @@ var require_BatchLogRecordProcessorBase = __commonJS({
108210
108338
  _exportScheduledPromise;
108211
108339
  _exportScheduledResolve;
108212
108340
  constructor(exporter, logRecords, exportTimeoutMillis) {
108213
- this._exportScheduledPromise = new Promise((resolve2) => {
108214
- this._exportScheduledResolve = resolve2;
108341
+ this._exportScheduledPromise = new Promise((resolve4) => {
108342
+ this._exportScheduledResolve = resolve4;
108215
108343
  });
108216
108344
  this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
108217
108345
  }
@@ -108235,14 +108363,14 @@ var require_BatchLogRecordProcessorBase = __commonJS({
108235
108363
  }
108236
108364
  }
108237
108365
  async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
108238
- return new Promise((resolve2, reject) => {
108366
+ return new Promise((resolve4, reject) => {
108239
108367
  const timer = setTimeout(() => {
108240
108368
  reject(new Error("Timeout"));
108241
108369
  }, exportTimeoutMillis);
108242
108370
  exporter.export(logRecords, (result) => {
108243
108371
  clearTimeout(timer);
108244
108372
  if (result.code === core_1.ExportResultCode.SUCCESS) {
108245
- resolve2();
108373
+ resolve4();
108246
108374
  } else {
108247
108375
  reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
108248
108376
  }
@@ -113221,14 +113349,14 @@ var require_BatchSpanProcessorBase = __commonJS({
113221
113349
  * for all other cases _flush should be used
113222
113350
  * */
113223
113351
  _flushAll() {
113224
- return new Promise((resolve2, reject) => {
113352
+ return new Promise((resolve4, reject) => {
113225
113353
  const promises3 = [];
113226
113354
  const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize);
113227
113355
  for (let i = 0, j = count; i < j; i++) {
113228
113356
  promises3.push(this._flushOneBatch());
113229
113357
  }
113230
113358
  Promise.all(promises3).then(() => {
113231
- resolve2();
113359
+ resolve4();
113232
113360
  }).catch(reject);
113233
113361
  });
113234
113362
  }
@@ -113237,7 +113365,7 @@ var require_BatchSpanProcessorBase = __commonJS({
113237
113365
  if (this._finishedSpans.length === 0) {
113238
113366
  return Promise.resolve();
113239
113367
  }
113240
- return new Promise((resolve2, reject) => {
113368
+ return new Promise((resolve4, reject) => {
113241
113369
  const timer = setTimeout(() => {
113242
113370
  reject(new Error("Timeout"));
113243
113371
  }, this._exportTimeoutMillis);
@@ -113252,7 +113380,7 @@ var require_BatchSpanProcessorBase = __commonJS({
113252
113380
  const doExport = () => this._exporter.export(spans, (result) => {
113253
113381
  clearTimeout(timer);
113254
113382
  if (result.code === core_1.ExportResultCode.SUCCESS) {
113255
- resolve2();
113383
+ resolve4();
113256
113384
  } else {
113257
113385
  reject(result.error ?? new Error("BatchSpanProcessor: span export failed"));
113258
113386
  }
@@ -113637,12 +113765,12 @@ var require_MultiSpanProcessor = __commonJS({
113637
113765
  for (const spanProcessor of this._spanProcessors) {
113638
113766
  promises3.push(spanProcessor.forceFlush());
113639
113767
  }
113640
- return new Promise((resolve2) => {
113768
+ return new Promise((resolve4) => {
113641
113769
  Promise.all(promises3).then(() => {
113642
- resolve2();
113770
+ resolve4();
113643
113771
  }).catch((error2) => {
113644
113772
  (0, core_1.globalErrorHandler)(error2 || new Error("MultiSpanProcessor: forceFlush failed"));
113645
- resolve2();
113773
+ resolve4();
113646
113774
  });
113647
113775
  });
113648
113776
  }
@@ -113668,9 +113796,9 @@ var require_MultiSpanProcessor = __commonJS({
113668
113796
  for (const spanProcessor of this._spanProcessors) {
113669
113797
  promises3.push(spanProcessor.shutdown());
113670
113798
  }
113671
- return new Promise((resolve2, reject) => {
113799
+ return new Promise((resolve4, reject) => {
113672
113800
  Promise.all(promises3).then(() => {
113673
- resolve2();
113801
+ resolve4();
113674
113802
  }, reject);
113675
113803
  });
113676
113804
  }
@@ -113725,32 +113853,32 @@ var require_BasicTracerProvider = __commonJS({
113725
113853
  forceFlush() {
113726
113854
  const timeout = this._config.forceFlushTimeoutMillis;
113727
113855
  const promises3 = this._activeSpanProcessor["_spanProcessors"].map((spanProcessor) => {
113728
- return new Promise((resolve2) => {
113856
+ return new Promise((resolve4) => {
113729
113857
  let state;
113730
113858
  const timeoutInterval = setTimeout(() => {
113731
- resolve2(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));
113859
+ resolve4(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));
113732
113860
  state = ForceFlushState.timeout;
113733
113861
  }, timeout);
113734
113862
  spanProcessor.forceFlush().then(() => {
113735
113863
  clearTimeout(timeoutInterval);
113736
113864
  if (state !== ForceFlushState.timeout) {
113737
113865
  state = ForceFlushState.resolved;
113738
- resolve2(state);
113866
+ resolve4(state);
113739
113867
  }
113740
113868
  }).catch((error2) => {
113741
113869
  clearTimeout(timeoutInterval);
113742
113870
  state = ForceFlushState.error;
113743
- resolve2(error2);
113871
+ resolve4(error2);
113744
113872
  });
113745
113873
  });
113746
113874
  });
113747
- return new Promise((resolve2, reject) => {
113875
+ return new Promise((resolve4, reject) => {
113748
113876
  Promise.all(promises3).then((results) => {
113749
113877
  const errors = results.filter((result) => result !== ForceFlushState.resolved);
113750
113878
  if (errors.length > 0) {
113751
113879
  reject(errors);
113752
113880
  } else {
113753
- resolve2();
113881
+ resolve4();
113754
113882
  }
113755
113883
  }).catch((error2) => reject([error2]));
113756
113884
  });
@@ -114791,9 +114919,9 @@ var require_instrumentation = __commonJS({
114791
114919
  var require_module_details_from_path = __commonJS({
114792
114920
  "node_modules/module-details-from-path/index.js"(exports, module2) {
114793
114921
  "use strict";
114794
- var sep = require("path").sep;
114922
+ var sep2 = require("path").sep;
114795
114923
  module2.exports = function(file) {
114796
- var segments = file.split(sep);
114924
+ var segments = file.split(sep2);
114797
114925
  var index = segments.lastIndexOf("node_modules");
114798
114926
  if (index === -1)
114799
114927
  return;
@@ -114808,22 +114936,22 @@ var require_module_details_from_path = __commonJS({
114808
114936
  if (i === lastBaseDirSegmentIndex) {
114809
114937
  basedir += segments[i];
114810
114938
  } else {
114811
- basedir += segments[i] + sep;
114939
+ basedir += segments[i] + sep2;
114812
114940
  }
114813
114941
  }
114814
- var path10 = "";
114942
+ var path14 = "";
114815
114943
  var lastSegmentIndex = segments.length - 1;
114816
114944
  for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) {
114817
114945
  if (i2 === lastSegmentIndex) {
114818
- path10 += segments[i2];
114946
+ path14 += segments[i2];
114819
114947
  } else {
114820
- path10 += segments[i2] + sep;
114948
+ path14 += segments[i2] + sep2;
114821
114949
  }
114822
114950
  }
114823
114951
  return {
114824
114952
  name,
114825
114953
  basedir,
114826
- path: path10
114954
+ path: path14
114827
114955
  };
114828
114956
  };
114829
114957
  }
@@ -114833,7 +114961,7 @@ var require_module_details_from_path = __commonJS({
114833
114961
  var require_require_in_the_middle = __commonJS({
114834
114962
  "node_modules/require-in-the-middle/index.js"(exports, module2) {
114835
114963
  "use strict";
114836
- var path10 = require("path");
114964
+ var path14 = require("path");
114837
114965
  var Module = require("module");
114838
114966
  var debug = require_src()("require-in-the-middle");
114839
114967
  var moduleDetailsFromPath = require_module_details_from_path();
@@ -114979,7 +115107,7 @@ var require_require_in_the_middle = __commonJS({
114979
115107
  }
114980
115108
  moduleName = filename;
114981
115109
  } else if (hasWhitelist === true && modules.includes(filename)) {
114982
- const parsedPath = path10.parse(filename);
115110
+ const parsedPath = path14.parse(filename);
114983
115111
  moduleName = parsedPath.name;
114984
115112
  basedir = parsedPath.dir;
114985
115113
  } else {
@@ -115017,7 +115145,7 @@ var require_require_in_the_middle = __commonJS({
115017
115145
  }
115018
115146
  if (res !== filename) {
115019
115147
  if (internals === true) {
115020
- moduleName = moduleName + path10.sep + path10.relative(basedir, filename);
115148
+ moduleName = moduleName + path14.sep + path14.relative(basedir, filename);
115021
115149
  debug("preparing to process require of internal file: %s", moduleName);
115022
115150
  } else {
115023
115151
  debug("ignoring require of non-main module file: %s", res);
@@ -115053,8 +115181,8 @@ var require_require_in_the_middle = __commonJS({
115053
115181
  }
115054
115182
  };
115055
115183
  function resolveModuleName(stat) {
115056
- const normalizedPath = path10.sep !== "/" ? stat.path.split(path10.sep).join("/") : stat.path;
115057
- return path10.posix.join(stat.name, normalizedPath).replace(normalize, "");
115184
+ const normalizedPath = path14.sep !== "/" ? stat.path.split(path14.sep).join("/") : stat.path;
115185
+ return path14.posix.join(stat.name, normalizedPath).replace(normalize, "");
115058
115186
  }
115059
115187
  }
115060
115188
  });
@@ -115139,7 +115267,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
115139
115267
  Object.defineProperty(exports, "__esModule", { value: true });
115140
115268
  exports.RequireInTheMiddleSingleton = void 0;
115141
115269
  var require_in_the_middle_1 = require_require_in_the_middle();
115142
- var path10 = require("path");
115270
+ var path14 = require("path");
115143
115271
  var ModuleNameTrie_1 = require_ModuleNameTrie();
115144
115272
  var isMocha = [
115145
115273
  "afterEach",
@@ -115204,7 +115332,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
115204
115332
  __publicField(RequireInTheMiddleSingleton, "_instance");
115205
115333
  exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
115206
115334
  function normalizePathSeparators(moduleNameOrPath) {
115207
- return path10.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path10.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
115335
+ return path14.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path14.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
115208
115336
  }
115209
115337
  }
115210
115338
  });
@@ -115265,7 +115393,7 @@ var require_register = __commonJS({
115265
115393
  // node_modules/import-in-the-middle/index.js
115266
115394
  var require_import_in_the_middle = __commonJS({
115267
115395
  "node_modules/import-in-the-middle/index.js"(exports, module2) {
115268
- var path10 = require("path");
115396
+ var path14 = require("path");
115269
115397
  var moduleDetailsFromPath = require_module_details_from_path();
115270
115398
  var { fileURLToPath } = require("url");
115271
115399
  var { MessageChannel } = require("worker_threads");
@@ -115321,8 +115449,8 @@ var require_import_in_the_middle = __commonJS({
115321
115449
  function waitForAllMessagesAcknowledged() {
115322
115450
  const timer = setInterval(() => {
115323
115451
  }, 1e3);
115324
- const promise = new Promise((resolve2) => {
115325
- resolveFn = resolve2;
115452
+ const promise = new Promise((resolve4) => {
115453
+ resolveFn = resolve4;
115326
115454
  }).then(() => {
115327
115455
  clearInterval(timer);
115328
115456
  });
@@ -115386,7 +115514,7 @@ var require_import_in_the_middle = __commonJS({
115386
115514
  } else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) {
115387
115515
  callHookFn(hookFn, namespace, name, baseDir);
115388
115516
  } else if (internals) {
115389
- const internalPath = name + path10.sep + path10.relative(baseDir, filePath);
115517
+ const internalPath = name + path14.sep + path14.relative(baseDir, filePath);
115390
115518
  callHookFn(hookFn, namespace, internalPath, baseDir);
115391
115519
  }
115392
115520
  } else if (matchArg === specifier) {
@@ -115461,7 +115589,7 @@ var require_instrumentation2 = __commonJS({
115461
115589
  "use strict";
115462
115590
  Object.defineProperty(exports, "__esModule", { value: true });
115463
115591
  exports.InstrumentationBase = void 0;
115464
- var path10 = require("path");
115592
+ var path14 = require("path");
115465
115593
  var util_1 = require("util");
115466
115594
  var semver_1 = require_semver();
115467
115595
  var shimmer_1 = require_shimmer();
@@ -115562,7 +115690,7 @@ var require_instrumentation2 = __commonJS({
115562
115690
  }
115563
115691
  _extractPackageVersion(baseDir) {
115564
115692
  try {
115565
- const json = (0, fs_1.readFileSync)(path10.join(baseDir, "package.json"), {
115693
+ const json = (0, fs_1.readFileSync)(path14.join(baseDir, "package.json"), {
115566
115694
  encoding: "utf8"
115567
115695
  });
115568
115696
  const version2 = JSON.parse(json).version;
@@ -115604,7 +115732,7 @@ var require_instrumentation2 = __commonJS({
115604
115732
  return exports2;
115605
115733
  }
115606
115734
  const files = module3.files ?? [];
115607
- const normalizedName = path10.normalize(name);
115735
+ const normalizedName = path14.normalize(name);
115608
115736
  const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName && isSupported(f.supportedVersions, version2, module3.includePrerelease));
115609
115737
  return supportedFileInstrumentations.reduce((patchedExports, file) => {
115610
115738
  file.moduleExports = patchedExports;
@@ -115650,8 +115778,8 @@ var require_instrumentation2 = __commonJS({
115650
115778
  this._warnOnPreloadedModules();
115651
115779
  for (const module3 of this._modules) {
115652
115780
  const hookFn = (exports2, name, baseDir) => {
115653
- if (!baseDir && path10.isAbsolute(name)) {
115654
- const parsedPath = path10.parse(name);
115781
+ if (!baseDir && path14.isAbsolute(name)) {
115782
+ const parsedPath = path14.parse(name);
115655
115783
  name = parsedPath.name;
115656
115784
  baseDir = parsedPath.dir;
115657
115785
  }
@@ -115660,7 +115788,7 @@ var require_instrumentation2 = __commonJS({
115660
115788
  const onRequire = (exports2, name, baseDir) => {
115661
115789
  return this._onRequire(module3, exports2, name, baseDir);
115662
115790
  };
115663
- const hook = path10.isAbsolute(module3.name) ? new require_in_the_middle_1.Hook([module3.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module3.name, onRequire);
115791
+ const hook = path14.isAbsolute(module3.name) ? new require_in_the_middle_1.Hook([module3.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module3.name, onRequire);
115664
115792
  this._hooks.push(hook);
115665
115793
  const esmHook = new import_in_the_middle_1.Hook([module3.name], { internals: true }, hookFn);
115666
115794
  this._hooks.push(esmHook);
@@ -116914,7 +117042,7 @@ var require_aspromise = __commonJS({
116914
117042
  var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true;
116915
117043
  while (index < arguments.length)
116916
117044
  params[offset++] = arguments[index++];
116917
- return new Promise(function executor(resolve2, reject) {
117045
+ return new Promise(function executor(resolve4, reject) {
116918
117046
  params[offset] = function callback(err) {
116919
117047
  if (pending) {
116920
117048
  pending = false;
@@ -116924,7 +117052,7 @@ var require_aspromise = __commonJS({
116924
117052
  var params2 = new Array(arguments.length - 1), offset2 = 0;
116925
117053
  while (offset2 < params2.length)
116926
117054
  params2[offset2++] = arguments[offset2];
116927
- resolve2.apply(null, params2);
117055
+ resolve4.apply(null, params2);
116928
117056
  }
116929
117057
  }
116930
117058
  };
@@ -125551,7 +125679,7 @@ var init_version2 = __esm({
125551
125679
 
125552
125680
  // node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
125553
125681
  function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
125554
- return new Promise((resolve2) => {
125682
+ return new Promise((resolve4) => {
125555
125683
  const parsedUrl = new URL(url2);
125556
125684
  if (userAgent) {
125557
125685
  headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
@@ -125573,7 +125701,7 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
125573
125701
  responseSize += chunk.length;
125574
125702
  if (responseSize > MAX_RESPONSE_BODY_SIZE) {
125575
125703
  const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
125576
- resolve2({ status: "failure", error: sizeError });
125704
+ resolve4({ status: "failure", error: sizeError });
125577
125705
  res.destroy();
125578
125706
  return;
125579
125707
  }
@@ -125581,18 +125709,18 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
125581
125709
  });
125582
125710
  res.on("end", () => {
125583
125711
  if (res.statusCode && res.statusCode <= 299) {
125584
- resolve2({
125712
+ resolve4({
125585
125713
  status: "success",
125586
125714
  data: Buffer.concat(responseData)
125587
125715
  });
125588
125716
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
125589
- resolve2({
125717
+ resolve4({
125590
125718
  status: "retryable",
125591
125719
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
125592
125720
  });
125593
125721
  } else {
125594
125722
  const error2 = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
125595
- resolve2({
125723
+ resolve4({
125596
125724
  status: "failure",
125597
125725
  error: error2
125598
125726
  });
@@ -125600,17 +125728,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
125600
125728
  });
125601
125729
  res.on("error", (error2) => {
125602
125730
  if (res.statusCode && res.statusCode <= 299) {
125603
- resolve2({
125731
+ resolve4({
125604
125732
  status: "success"
125605
125733
  });
125606
125734
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
125607
- resolve2({
125735
+ resolve4({
125608
125736
  status: "retryable",
125609
125737
  error: error2,
125610
125738
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
125611
125739
  });
125612
125740
  } else {
125613
- resolve2({
125741
+ resolve4({
125614
125742
  status: "failure",
125615
125743
  error: error2
125616
125744
  });
@@ -125619,26 +125747,26 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
125619
125747
  });
125620
125748
  req.setTimeout(timeoutMillis, () => {
125621
125749
  req.destroy();
125622
- resolve2({
125750
+ resolve4({
125623
125751
  status: "retryable",
125624
125752
  error: new Error("Request timed out")
125625
125753
  });
125626
125754
  });
125627
125755
  req.on("error", (error2) => {
125628
125756
  if (isHttpTransportNetworkErrorRetryable(error2)) {
125629
- resolve2({
125757
+ resolve4({
125630
125758
  status: "retryable",
125631
125759
  error: error2
125632
125760
  });
125633
125761
  } else {
125634
- resolve2({
125762
+ resolve4({
125635
125763
  status: "failure",
125636
125764
  error: error2
125637
125765
  });
125638
125766
  }
125639
125767
  });
125640
125768
  compressAndSend(req, compression, data, (error2) => {
125641
- resolve2({
125769
+ resolve4({
125642
125770
  status: "failure",
125643
125771
  error: error2
125644
125772
  });
@@ -125752,9 +125880,9 @@ var init_retrying_transport = __esm({
125752
125880
  this._transport = transport;
125753
125881
  }
125754
125882
  retry(data, timeoutMillis, inMillis) {
125755
- return new Promise((resolve2, reject) => {
125883
+ return new Promise((resolve4, reject) => {
125756
125884
  setTimeout(() => {
125757
- this._transport.send(data, timeoutMillis).then(resolve2, reject);
125885
+ this._transport.send(data, timeoutMillis).then(resolve4, reject);
125758
125886
  }, inMillis);
125759
125887
  });
125760
125888
  }
@@ -125874,7 +126002,7 @@ function appendRootPathToUrlIfNeeded(url2) {
125874
126002
  return void 0;
125875
126003
  }
125876
126004
  }
125877
- function appendResourcePathToUrl(url2, path10) {
126005
+ function appendResourcePathToUrl(url2, path14) {
125878
126006
  try {
125879
126007
  new URL(url2);
125880
126008
  } catch {
@@ -125884,11 +126012,11 @@ function appendResourcePathToUrl(url2, path10) {
125884
126012
  if (!url2.endsWith("/")) {
125885
126013
  url2 = url2 + "/";
125886
126014
  }
125887
- url2 += path10;
126015
+ url2 += path14;
125888
126016
  try {
125889
126017
  new URL(url2);
125890
126018
  } catch {
125891
- diag2.warn(`Configuration: Provided URL appended with '${path10}' is not a valid URL, using 'undefined' instead of '${url2}'`);
126019
+ diag2.warn(`Configuration: Provided URL appended with '${path14}' is not a valid URL, using 'undefined' instead of '${url2}'`);
125892
126020
  return void 0;
125893
126021
  }
125894
126022
  return url2;
@@ -126452,7 +126580,7 @@ var require_PrometheusExporter = __commonJS({
126452
126580
  api_1.diag.debug("Prometheus stopServer() was called but server was never started.");
126453
126581
  return Promise.resolve();
126454
126582
  } else {
126455
- return new Promise((resolve2) => {
126583
+ return new Promise((resolve4) => {
126456
126584
  this._server.close((err) => {
126457
126585
  if (!err) {
126458
126586
  api_1.diag.debug("Prometheus exporter was stopped");
@@ -126461,7 +126589,7 @@ var require_PrometheusExporter = __commonJS({
126461
126589
  (0, core_1.globalErrorHandler)(err);
126462
126590
  }
126463
126591
  }
126464
- resolve2();
126592
+ resolve4();
126465
126593
  });
126466
126594
  });
126467
126595
  }
@@ -126470,14 +126598,14 @@ var require_PrometheusExporter = __commonJS({
126470
126598
  * Starts the Prometheus export server
126471
126599
  */
126472
126600
  startServer() {
126473
- this._startServerPromise ??= new Promise((resolve2, reject) => {
126601
+ this._startServerPromise ??= new Promise((resolve4, reject) => {
126474
126602
  this._server.once("error", reject);
126475
126603
  this._server.listen({
126476
126604
  port: this._port,
126477
126605
  host: this._host
126478
126606
  }, () => {
126479
126607
  api_1.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`);
126480
- resolve2();
126608
+ resolve4();
126481
126609
  });
126482
126610
  });
126483
126611
  return this._startServerPromise;
@@ -126696,8 +126824,8 @@ var require_util3 = __commonJS({
126696
126824
  exports.prepareSend = void 0;
126697
126825
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
126698
126826
  var core_1 = require_src2();
126699
- var http5 = require("http");
126700
- var https4 = require("https");
126827
+ var http6 = require("http");
126828
+ var https5 = require("https");
126701
126829
  function prepareSend(urlStr, headers) {
126702
126830
  const url2 = new URL(urlStr);
126703
126831
  const reqOpts = Object.assign({
@@ -126712,7 +126840,7 @@ var require_util3 = __commonJS({
126712
126840
  api_1.diag.debug("Zipkin send with empty spans");
126713
126841
  return done({ code: core_1.ExportResultCode.SUCCESS });
126714
126842
  }
126715
- const { request } = url2.protocol === "http:" ? http5 : https4;
126843
+ const { request } = url2.protocol === "http:" ? http6 : https5;
126716
126844
  const req = request(url2, reqOpts, (res) => {
126717
126845
  let rawData = "";
126718
126846
  res.on("data", (chunk) => {
@@ -126922,9 +127050,9 @@ var require_zipkin = __commonJS({
126922
127050
  }));
126923
127051
  return;
126924
127052
  }
126925
- const promise = new Promise((resolve2) => {
127053
+ const promise = new Promise((resolve4) => {
126926
127054
  this._sendSpans(spans, serviceName, (result) => {
126927
- resolve2();
127055
+ resolve4();
126928
127056
  resultCallback(result);
126929
127057
  });
126930
127058
  });
@@ -126947,9 +127075,9 @@ var require_zipkin = __commonJS({
126947
127075
  * Exports any pending spans in exporter
126948
127076
  */
126949
127077
  forceFlush() {
126950
- return new Promise((resolve2, reject) => {
127078
+ return new Promise((resolve4, reject) => {
126951
127079
  Promise.all(this._sendingPromises).then(() => {
126952
- resolve2();
127080
+ resolve4();
126953
127081
  }, reject);
126954
127082
  });
126955
127083
  }
@@ -127651,7 +127779,7 @@ var require_utils14 = __commonJS({
127651
127779
  var exporter_metrics_otlp_http_1 = require_src20();
127652
127780
  var exporter_metrics_otlp_proto_1 = require_src21();
127653
127781
  var sdk_logs_1 = require_src5();
127654
- var fs13 = require("fs");
127782
+ var fs17 = require("fs");
127655
127783
  var RESOURCE_DETECTOR_ENVIRONMENT = "env";
127656
127784
  var RESOURCE_DETECTOR_HOST = "host";
127657
127785
  var RESOURCE_DETECTOR_OS = "os";
@@ -128074,21 +128202,21 @@ var require_utils14 = __commonJS({
128074
128202
  const httpsAgentOptions = {};
128075
128203
  if (tls.ca_file) {
128076
128204
  try {
128077
- httpsAgentOptions.ca = fs13.readFileSync(tls.ca_file);
128205
+ httpsAgentOptions.ca = fs17.readFileSync(tls.ca_file);
128078
128206
  } catch (e) {
128079
128207
  api_1.diag.warn(`Failed to read TLS CA file at ${tls.ca_file}: ${e}`);
128080
128208
  }
128081
128209
  }
128082
128210
  if (tls.cert_file) {
128083
128211
  try {
128084
- httpsAgentOptions.cert = fs13.readFileSync(tls.cert_file);
128212
+ httpsAgentOptions.cert = fs17.readFileSync(tls.cert_file);
128085
128213
  } catch (e) {
128086
128214
  api_1.diag.warn(`Failed to read TLS cert file at ${tls.cert_file}: ${e}`);
128087
128215
  }
128088
128216
  }
128089
128217
  if (tls.key_file) {
128090
128218
  try {
128091
- httpsAgentOptions.key = fs13.readFileSync(tls.key_file);
128219
+ httpsAgentOptions.key = fs17.readFileSync(tls.key_file);
128092
128220
  } catch (e) {
128093
128221
  api_1.diag.warn(`Failed to read TLS key file at ${tls.key_file}: ${e}`);
128094
128222
  }
@@ -129423,7 +129551,7 @@ var init_SocketTransport = __esm({
129423
129551
  return Promise.resolve();
129424
129552
  }
129425
129553
  async send(message) {
129426
- return new Promise((resolve2, reject) => {
129554
+ return new Promise((resolve4, reject) => {
129427
129555
  const json = JSON.stringify(
129428
129556
  message,
129429
129557
  (_key, value) => typeof value === "bigint" ? value.toString() : value
@@ -129432,7 +129560,7 @@ var init_SocketTransport = __esm({
129432
129560
  if (err) {
129433
129561
  reject(err);
129434
129562
  } else {
129435
- resolve2();
129563
+ resolve4();
129436
129564
  }
129437
129565
  });
129438
129566
  });
@@ -129512,11 +129640,11 @@ var init_DaemonSocketSurface = __esm({
129512
129640
  logger.error("[Daemon] Failed to connect MCP server to transport", error2);
129513
129641
  }
129514
129642
  });
129515
- await new Promise((resolve2, reject) => {
129643
+ await new Promise((resolve4, reject) => {
129516
129644
  const onListen = () => {
129517
129645
  logger.info(`Daemon IPC listening on ${this.options.socketPath}`);
129518
129646
  cleanup();
129519
- resolve2();
129647
+ resolve4();
129520
129648
  };
129521
129649
  const onError = (err) => {
129522
129650
  cleanup();
@@ -129637,12 +129765,12 @@ var init_stdio2 = __esm({
129637
129765
  this.onclose?.();
129638
129766
  }
129639
129767
  send(message) {
129640
- return new Promise((resolve2) => {
129768
+ return new Promise((resolve4) => {
129641
129769
  const json = serializeMessage(message);
129642
129770
  if (this._stdout.write(json)) {
129643
- resolve2();
129771
+ resolve4();
129644
129772
  } else {
129645
- this._stdout.once("drain", resolve2);
129773
+ this._stdout.once("drain", resolve4);
129646
129774
  }
129647
129775
  });
129648
129776
  }
@@ -129833,7 +129961,7 @@ var require_limiter = __commonJS({
129833
129961
  var require_permessage_deflate = __commonJS({
129834
129962
  "node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
129835
129963
  "use strict";
129836
- var zlib3 = require("zlib");
129964
+ var zlib4 = require("zlib");
129837
129965
  var bufferUtil = require_buffer_util();
129838
129966
  var Limiter = require_limiter();
129839
129967
  var { kStatusCode } = require_constants3();
@@ -130100,8 +130228,8 @@ var require_permessage_deflate = __commonJS({
130100
130228
  const endpoint = this._isServer ? "client" : "server";
130101
130229
  if (!this._inflate) {
130102
130230
  const key = `${endpoint}_max_window_bits`;
130103
- const windowBits = typeof this.params[key] !== "number" ? zlib3.Z_DEFAULT_WINDOWBITS : this.params[key];
130104
- this._inflate = zlib3.createInflateRaw({
130231
+ const windowBits = typeof this.params[key] !== "number" ? zlib4.Z_DEFAULT_WINDOWBITS : this.params[key];
130232
+ this._inflate = zlib4.createInflateRaw({
130105
130233
  ...this._options.zlibInflateOptions,
130106
130234
  windowBits
130107
130235
  });
@@ -130152,8 +130280,8 @@ var require_permessage_deflate = __commonJS({
130152
130280
  const endpoint = this._isServer ? "server" : "client";
130153
130281
  if (!this._deflate) {
130154
130282
  const key = `${endpoint}_max_window_bits`;
130155
- const windowBits = typeof this.params[key] !== "number" ? zlib3.Z_DEFAULT_WINDOWBITS : this.params[key];
130156
- this._deflate = zlib3.createDeflateRaw({
130283
+ const windowBits = typeof this.params[key] !== "number" ? zlib4.Z_DEFAULT_WINDOWBITS : this.params[key];
130284
+ this._deflate = zlib4.createDeflateRaw({
130157
130285
  ...this._options.zlibDeflateOptions,
130158
130286
  windowBits
130159
130287
  });
@@ -130163,7 +130291,7 @@ var require_permessage_deflate = __commonJS({
130163
130291
  }
130164
130292
  this._deflate[kCallback] = callback;
130165
130293
  this._deflate.write(data);
130166
- this._deflate.flush(zlib3.Z_SYNC_FLUSH, () => {
130294
+ this._deflate.flush(zlib4.Z_SYNC_FLUSH, () => {
130167
130295
  if (!this._deflate) {
130168
130296
  return;
130169
130297
  }
@@ -131960,11 +132088,11 @@ var require_websocket = __commonJS({
131960
132088
  "node_modules/ws/lib/websocket.js"(exports, module2) {
131961
132089
  "use strict";
131962
132090
  var EventEmitter3 = require("events");
131963
- var https4 = require("https");
131964
- var http5 = require("http");
132091
+ var https5 = require("https");
132092
+ var http6 = require("http");
131965
132093
  var net2 = require("net");
131966
132094
  var tls = require("tls");
131967
- var { randomBytes, createHash: createHash2 } = require("crypto");
132095
+ var { randomBytes, createHash: createHash3 } = require("crypto");
131968
132096
  var { Duplex, Readable: Readable4 } = require("stream");
131969
132097
  var { URL: URL3 } = require("url");
131970
132098
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -132520,7 +132648,7 @@ var require_websocket = __commonJS({
132520
132648
  }
132521
132649
  const defaultPort = isSecure ? 443 : 80;
132522
132650
  const key = randomBytes(16).toString("base64");
132523
- const request = isSecure ? https4.request : http5.request;
132651
+ const request = isSecure ? https5.request : http6.request;
132524
132652
  const protocolSet = /* @__PURE__ */ new Set();
132525
132653
  let perMessageDeflate;
132526
132654
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -132652,7 +132780,7 @@ var require_websocket = __commonJS({
132652
132780
  abortHandshake(websocket, socket, "Invalid Upgrade header");
132653
132781
  return;
132654
132782
  }
132655
- const digest = createHash2("sha1").update(key + GUID).digest("base64");
132783
+ const digest = createHash3("sha1").update(key + GUID).digest("base64");
132656
132784
  if (res.headers["sec-websocket-accept"] !== digest) {
132657
132785
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
132658
132786
  return;
@@ -133039,9 +133167,9 @@ var require_websocket_server = __commonJS({
133039
133167
  "node_modules/ws/lib/websocket-server.js"(exports, module2) {
133040
133168
  "use strict";
133041
133169
  var EventEmitter3 = require("events");
133042
- var http5 = require("http");
133170
+ var http6 = require("http");
133043
133171
  var { Duplex } = require("stream");
133044
- var { createHash: createHash2 } = require("crypto");
133172
+ var { createHash: createHash3 } = require("crypto");
133045
133173
  var extension2 = require_extension();
133046
133174
  var PerMessageDeflate2 = require_permessage_deflate();
133047
133175
  var subprotocol2 = require_subprotocol();
@@ -133120,8 +133248,8 @@ var require_websocket_server = __commonJS({
133120
133248
  );
133121
133249
  }
133122
133250
  if (options.port != null) {
133123
- this._server = http5.createServer((req, res) => {
133124
- const body = http5.STATUS_CODES[426];
133251
+ this._server = http6.createServer((req, res) => {
133252
+ const body = http6.STATUS_CODES[426];
133125
133253
  res.writeHead(426, {
133126
133254
  "Content-Length": body.length,
133127
133255
  "Content-Type": "text/plain"
@@ -133356,7 +133484,7 @@ var require_websocket_server = __commonJS({
133356
133484
  }
133357
133485
  if (this._state > RUNNING)
133358
133486
  return abortHandshake(socket, 503);
133359
- const digest = createHash2("sha1").update(key + GUID).digest("base64");
133487
+ const digest = createHash3("sha1").update(key + GUID).digest("base64");
133360
133488
  const headers = [
133361
133489
  "HTTP/1.1 101 Switching Protocols",
133362
133490
  "Upgrade: websocket",
@@ -133419,7 +133547,7 @@ var require_websocket_server = __commonJS({
133419
133547
  this.destroy();
133420
133548
  }
133421
133549
  function abortHandshake(socket, code, message, headers) {
133422
- message = message || http5.STATUS_CODES[code];
133550
+ message = message || http6.STATUS_CODES[code];
133423
133551
  headers = {
133424
133552
  Connection: "close",
133425
133553
  "Content-Type": "text/html",
@@ -133428,7 +133556,7 @@ var require_websocket_server = __commonJS({
133428
133556
  };
133429
133557
  socket.once("finish", socket.destroy);
133430
133558
  socket.end(
133431
- `HTTP/1.1 ${code} ${http5.STATUS_CODES[code]}\r
133559
+ `HTTP/1.1 ${code} ${http6.STATUS_CODES[code]}\r
133432
133560
  ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
133433
133561
  );
133434
133562
  }
@@ -133497,7 +133625,7 @@ var init_WebSocketServerTransport = __esm({
133497
133625
  });
133498
133626
  }
133499
133627
  async send(message, options) {
133500
- return new Promise((resolve2, reject) => {
133628
+ return new Promise((resolve4, reject) => {
133501
133629
  if (this.socket.readyState !== import_websocket.default.OPEN) {
133502
133630
  reject(new Error("WebSocket is not open"));
133503
133631
  return;
@@ -133510,7 +133638,7 @@ var init_WebSocketServerTransport = __esm({
133510
133638
  if (error2) {
133511
133639
  reject(error2);
133512
133640
  } else {
133513
- resolve2();
133641
+ resolve4();
133514
133642
  }
133515
133643
  });
133516
133644
  });
@@ -133778,6 +133906,544 @@ var init_DaemonSurfaceManager = __esm({
133778
133906
  }
133779
133907
  });
133780
133908
 
133909
+ // src/server/runtime/DuckDbRuntimeTypes.ts
133910
+ function currentPlatformKey() {
133911
+ const platform = process.platform === "win32" ? "win32" : process.platform;
133912
+ const arch = process.arch === "arm64" ? "arm64" : "x64";
133913
+ const key = `${platform}-${arch}`;
133914
+ if (!SUPPORTED_PLATFORMS.includes(key)) {
133915
+ throw new Error(`Unsupported platform for managed DuckDB runtime: ${key}`);
133916
+ }
133917
+ return key;
133918
+ }
133919
+ function duckDbRuntimeDir(sqlPreviewHome) {
133920
+ return path9.join(sqlPreviewHome, "runtime", "duckdb");
133921
+ }
133922
+ function duckDbVersionDir(sqlPreviewHome, version2) {
133923
+ return path9.join(duckDbRuntimeDir(sqlPreviewHome), version2);
133924
+ }
133925
+ function duckDbManifestPath(versionDir) {
133926
+ return path9.join(versionDir, ".provision-manifest.json");
133927
+ }
133928
+ function readManifest(manifestPath) {
133929
+ try {
133930
+ const raw = fs12.readFileSync(manifestPath, "utf8");
133931
+ return JSON.parse(raw);
133932
+ } catch {
133933
+ return null;
133934
+ }
133935
+ }
133936
+ function writeManifest(manifestPath, manifest) {
133937
+ fs12.mkdirSync(path9.dirname(manifestPath), { recursive: true });
133938
+ fs12.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf8");
133939
+ }
133940
+ var fs12, path9, SUPPORTED_PLATFORMS;
133941
+ var init_DuckDbRuntimeTypes = __esm({
133942
+ "src/server/runtime/DuckDbRuntimeTypes.ts"() {
133943
+ "use strict";
133944
+ fs12 = __toESM(require("fs"));
133945
+ path9 = __toESM(require("path"));
133946
+ SUPPORTED_PLATFORMS = [
133947
+ "darwin-arm64",
133948
+ "darwin-x64",
133949
+ "linux-x64",
133950
+ "linux-arm64",
133951
+ "win32-x64"
133952
+ ];
133953
+ }
133954
+ });
133955
+
133956
+ // src/server/runtime/duckdbPins.generated.ts
133957
+ var DUCKDB_PLATFORM_PINS;
133958
+ var init_duckdbPins_generated = __esm({
133959
+ "src/server/runtime/duckdbPins.generated.ts"() {
133960
+ "use strict";
133961
+ DUCKDB_PLATFORM_PINS = {
133962
+ "darwin-arm64": {
133963
+ platform: "darwin-arm64",
133964
+ duckDbVersion: "1.5.0-r.1",
133965
+ tarballs: [
133966
+ {
133967
+ name: "@duckdb/node-api",
133968
+ version: "1.5.0-r.1",
133969
+ url: "https://registry.npmjs.org/@duckdb/node-api/-/node-api-1.5.0-r.1.tgz",
133970
+ integrity: "sha512-VjvjqlCyqUJ22bydG/+9Jj5l0CEvx9QUn1SATBkKFY0+x6n4uHzt0kp/FKwXK9LNduXX6KCKtdF+6v5BcHScfA=="
133971
+ },
133972
+ {
133973
+ name: "@duckdb/node-bindings",
133974
+ version: "1.5.0-r.1",
133975
+ url: "https://registry.npmjs.org/@duckdb/node-bindings/-/node-bindings-1.5.0-r.1.tgz",
133976
+ integrity: "sha512-ViyoHROp0HhQ0ATT8z6h7SV6vEOxNjN8mJcdkst+3rJIU3Rd/gKs8exJO23LxFsjBuAiDpndpEwFihTAdfwJZg=="
133977
+ },
133978
+ {
133979
+ name: "@duckdb/node-bindings-darwin-arm64",
133980
+ version: "1.5.0-r.1",
133981
+ url: "https://registry.npmjs.org/@duckdb/node-bindings-darwin-arm64/-/node-bindings-darwin-arm64-1.5.0-r.1.tgz",
133982
+ integrity: "sha512-s7CB9Y10f3dg2W4jdp6zipogxamq1pPQVt/r+YigZrHqk7HvytUeRH1VOI/3wuGTTlR8mAnIXj2MJIrmMujX4w=="
133983
+ }
133984
+ ]
133985
+ },
133986
+ "darwin-x64": {
133987
+ platform: "darwin-x64",
133988
+ duckDbVersion: "1.5.0-r.1",
133989
+ tarballs: [
133990
+ {
133991
+ name: "@duckdb/node-api",
133992
+ version: "1.5.0-r.1",
133993
+ url: "https://registry.npmjs.org/@duckdb/node-api/-/node-api-1.5.0-r.1.tgz",
133994
+ integrity: "sha512-VjvjqlCyqUJ22bydG/+9Jj5l0CEvx9QUn1SATBkKFY0+x6n4uHzt0kp/FKwXK9LNduXX6KCKtdF+6v5BcHScfA=="
133995
+ },
133996
+ {
133997
+ name: "@duckdb/node-bindings",
133998
+ version: "1.5.0-r.1",
133999
+ url: "https://registry.npmjs.org/@duckdb/node-bindings/-/node-bindings-1.5.0-r.1.tgz",
134000
+ integrity: "sha512-ViyoHROp0HhQ0ATT8z6h7SV6vEOxNjN8mJcdkst+3rJIU3Rd/gKs8exJO23LxFsjBuAiDpndpEwFihTAdfwJZg=="
134001
+ },
134002
+ {
134003
+ name: "@duckdb/node-bindings-darwin-x64",
134004
+ version: "1.5.0-r.1",
134005
+ url: "https://registry.npmjs.org/@duckdb/node-bindings-darwin-x64/-/node-bindings-darwin-x64-1.5.0-r.1.tgz",
134006
+ integrity: "sha512-2KxnGvg9o/Y915hwr1Mpb6Cbfrvt/w+/Fv0RZ2VXeQuxqNCMOoJd/7yQ8ffWXJRuOFU/vRmsR88koIjW+yJibA=="
134007
+ }
134008
+ ]
134009
+ },
134010
+ "linux-x64": {
134011
+ platform: "linux-x64",
134012
+ duckDbVersion: "1.5.0-r.1",
134013
+ tarballs: [
134014
+ {
134015
+ name: "@duckdb/node-api",
134016
+ version: "1.5.0-r.1",
134017
+ url: "https://registry.npmjs.org/@duckdb/node-api/-/node-api-1.5.0-r.1.tgz",
134018
+ integrity: "sha512-VjvjqlCyqUJ22bydG/+9Jj5l0CEvx9QUn1SATBkKFY0+x6n4uHzt0kp/FKwXK9LNduXX6KCKtdF+6v5BcHScfA=="
134019
+ },
134020
+ {
134021
+ name: "@duckdb/node-bindings",
134022
+ version: "1.5.0-r.1",
134023
+ url: "https://registry.npmjs.org/@duckdb/node-bindings/-/node-bindings-1.5.0-r.1.tgz",
134024
+ integrity: "sha512-ViyoHROp0HhQ0ATT8z6h7SV6vEOxNjN8mJcdkst+3rJIU3Rd/gKs8exJO23LxFsjBuAiDpndpEwFihTAdfwJZg=="
134025
+ },
134026
+ {
134027
+ name: "@duckdb/node-bindings-linux-x64",
134028
+ version: "1.5.0-r.1",
134029
+ url: "https://registry.npmjs.org/@duckdb/node-bindings-linux-x64/-/node-bindings-linux-x64-1.5.0-r.1.tgz",
134030
+ integrity: "sha512-A4Zgsaq6szEKiMyF1eWkoaHw0OMA0a8Zl8Ev0GcZSRjI4iGHgBQ1f/Zi/w3QKyz7OtjIiZ+pQ1XYyG4QoF6OKA=="
134031
+ }
134032
+ ]
134033
+ },
134034
+ "linux-arm64": {
134035
+ platform: "linux-arm64",
134036
+ duckDbVersion: "1.5.0-r.1",
134037
+ tarballs: [
134038
+ {
134039
+ name: "@duckdb/node-api",
134040
+ version: "1.5.0-r.1",
134041
+ url: "https://registry.npmjs.org/@duckdb/node-api/-/node-api-1.5.0-r.1.tgz",
134042
+ integrity: "sha512-VjvjqlCyqUJ22bydG/+9Jj5l0CEvx9QUn1SATBkKFY0+x6n4uHzt0kp/FKwXK9LNduXX6KCKtdF+6v5BcHScfA=="
134043
+ },
134044
+ {
134045
+ name: "@duckdb/node-bindings",
134046
+ version: "1.5.0-r.1",
134047
+ url: "https://registry.npmjs.org/@duckdb/node-bindings/-/node-bindings-1.5.0-r.1.tgz",
134048
+ integrity: "sha512-ViyoHROp0HhQ0ATT8z6h7SV6vEOxNjN8mJcdkst+3rJIU3Rd/gKs8exJO23LxFsjBuAiDpndpEwFihTAdfwJZg=="
134049
+ },
134050
+ {
134051
+ name: "@duckdb/node-bindings-linux-arm64",
134052
+ version: "1.5.0-r.1",
134053
+ url: "https://registry.npmjs.org/@duckdb/node-bindings-linux-arm64/-/node-bindings-linux-arm64-1.5.0-r.1.tgz",
134054
+ integrity: "sha512-FpmcfJqhKoInjEa1o5dsWPQAFWYgu1eZgJP94nz6d+cKfdXEZKT6vGIwokZRzDqKLG1ZAOBZO2IhxzmW8IbbfA=="
134055
+ }
134056
+ ]
134057
+ },
134058
+ "win32-x64": {
134059
+ platform: "win32-x64",
134060
+ duckDbVersion: "1.5.0-r.1",
134061
+ tarballs: [
134062
+ {
134063
+ name: "@duckdb/node-api",
134064
+ version: "1.5.0-r.1",
134065
+ url: "https://registry.npmjs.org/@duckdb/node-api/-/node-api-1.5.0-r.1.tgz",
134066
+ integrity: "sha512-VjvjqlCyqUJ22bydG/+9Jj5l0CEvx9QUn1SATBkKFY0+x6n4uHzt0kp/FKwXK9LNduXX6KCKtdF+6v5BcHScfA=="
134067
+ },
134068
+ {
134069
+ name: "@duckdb/node-bindings",
134070
+ version: "1.5.0-r.1",
134071
+ url: "https://registry.npmjs.org/@duckdb/node-bindings/-/node-bindings-1.5.0-r.1.tgz",
134072
+ integrity: "sha512-ViyoHROp0HhQ0ATT8z6h7SV6vEOxNjN8mJcdkst+3rJIU3Rd/gKs8exJO23LxFsjBuAiDpndpEwFihTAdfwJZg=="
134073
+ },
134074
+ {
134075
+ name: "@duckdb/node-bindings-win32-x64",
134076
+ version: "1.5.0-r.1",
134077
+ url: "https://registry.npmjs.org/@duckdb/node-bindings-win32-x64/-/node-bindings-win32-x64-1.5.0-r.1.tgz",
134078
+ integrity: "sha512-725LoefejBlyG/bUcMfqVJkZ8KnZRLa0xOkszw9Q+V5G26iagJY3dgtGJAvwTeVJvXigSEVc5yD9Cj6kWR67vA=="
134079
+ }
134080
+ ]
134081
+ }
134082
+ };
134083
+ }
134084
+ });
134085
+
134086
+ // src/server/runtime/DuckDbDownloader.ts
134087
+ function clientFor(url2) {
134088
+ return url2.startsWith("https:") ? https4 : http4;
134089
+ }
134090
+ function downloadToFile(url2, destPath) {
134091
+ return new Promise((resolve4, reject) => {
134092
+ fs13.mkdirSync(path10.dirname(destPath), { recursive: true });
134093
+ const client = clientFor(url2);
134094
+ const request = client.get(url2, (response) => {
134095
+ if (response.statusCode !== 200) {
134096
+ response.resume();
134097
+ reject(new Error(`Download failed for ${url2}: HTTP ${response.statusCode}`));
134098
+ return;
134099
+ }
134100
+ const file = fs13.createWriteStream(destPath);
134101
+ let settled = false;
134102
+ const failOnce = (err) => {
134103
+ if (settled) {
134104
+ return;
134105
+ }
134106
+ settled = true;
134107
+ file.destroy();
134108
+ fs13.rm(destPath, { force: true }, () => reject(err));
134109
+ };
134110
+ response.pipe(file);
134111
+ response.on("error", failOnce);
134112
+ file.on("finish", () => {
134113
+ if (settled) {
134114
+ return;
134115
+ }
134116
+ settled = true;
134117
+ file.close(() => resolve4());
134118
+ });
134119
+ file.on("error", failOnce);
134120
+ });
134121
+ request.on("error", reject);
134122
+ });
134123
+ }
134124
+ function sha512File(filePath) {
134125
+ return new Promise((resolve4, reject) => {
134126
+ const hash = crypto8.createHash("sha512");
134127
+ const stream4 = fs13.createReadStream(filePath);
134128
+ stream4.on("data", (chunk) => hash.update(chunk));
134129
+ stream4.on("end", () => resolve4(hash.digest("base64")));
134130
+ stream4.on("error", reject);
134131
+ });
134132
+ }
134133
+ function verifyIntegrity(actualBase64Sha512, expectedIntegrity) {
134134
+ const expectedBase64 = expectedIntegrity.replace(/^sha512-/, "");
134135
+ return actualBase64Sha512 === expectedBase64;
134136
+ }
134137
+ var http4, https4, fs13, path10, crypto8;
134138
+ var init_DuckDbDownloader = __esm({
134139
+ "src/server/runtime/DuckDbDownloader.ts"() {
134140
+ "use strict";
134141
+ http4 = __toESM(require("http"));
134142
+ https4 = __toESM(require("https"));
134143
+ fs13 = __toESM(require("fs"));
134144
+ path10 = __toESM(require("path"));
134145
+ crypto8 = __toESM(require("crypto"));
134146
+ }
134147
+ });
134148
+
134149
+ // src/server/runtime/MinimalTarExtractor.ts
134150
+ function parseOctal(field) {
134151
+ const str = field.toString("utf8").replace(/\0/g, "").trim();
134152
+ return str.length === 0 ? 0 : parseInt(str, 8);
134153
+ }
134154
+ function parseTar(buffer) {
134155
+ const entries = [];
134156
+ let offset = 0;
134157
+ while (offset + 512 <= buffer.length) {
134158
+ const header = buffer.subarray(offset, offset + 512);
134159
+ if (header.every((byte) => byte === 0)) {
134160
+ break;
134161
+ }
134162
+ const nameField = header.subarray(0, 100).toString("utf8").replace(/\0.*$/s, "");
134163
+ const prefixField = header.subarray(345, 500).toString("utf8").replace(/\0.*$/s, "");
134164
+ const name = prefixField ? `${prefixField}/${nameField}` : nameField;
134165
+ const size = parseOctal(header.subarray(124, 136));
134166
+ const typeflag = String.fromCharCode(header.readUInt8(156));
134167
+ offset += 512;
134168
+ const content = buffer.subarray(offset, offset + size);
134169
+ entries.push({ name, size, typeflag, content: Buffer.from(content) });
134170
+ const paddedSize = Math.ceil(size / 512) * 512;
134171
+ offset += paddedSize;
134172
+ }
134173
+ return entries;
134174
+ }
134175
+ async function extractTarGz(tarGzPath, destDir) {
134176
+ const compressed = fs14.readFileSync(tarGzPath);
134177
+ const tarBuffer = zlib3.gunzipSync(compressed);
134178
+ const entries = parseTar(tarBuffer);
134179
+ const resolvedDestDir = path11.resolve(destDir);
134180
+ fs14.mkdirSync(resolvedDestDir, { recursive: true });
134181
+ for (const entry of entries) {
134182
+ if (!entry.name || entry.name === ".") {
134183
+ continue;
134184
+ }
134185
+ const targetPath = path11.resolve(resolvedDestDir, entry.name);
134186
+ if (targetPath !== resolvedDestDir && !targetPath.startsWith(resolvedDestDir + path11.sep)) {
134187
+ throw new Error(
134188
+ `Refusing to extract tar entry that escapes destination directory: ${entry.name}`
134189
+ );
134190
+ }
134191
+ if (entry.typeflag === "5") {
134192
+ fs14.mkdirSync(targetPath, { recursive: true });
134193
+ continue;
134194
+ }
134195
+ if (entry.typeflag === "0" || entry.typeflag === "\0") {
134196
+ fs14.mkdirSync(path11.dirname(targetPath), { recursive: true });
134197
+ fs14.writeFileSync(targetPath, entry.content);
134198
+ }
134199
+ }
134200
+ }
134201
+ var fs14, path11, zlib3;
134202
+ var init_MinimalTarExtractor = __esm({
134203
+ "src/server/runtime/MinimalTarExtractor.ts"() {
134204
+ "use strict";
134205
+ fs14 = __toESM(require("fs"));
134206
+ path11 = __toESM(require("path"));
134207
+ zlib3 = __toESM(require("zlib"));
134208
+ }
134209
+ });
134210
+
134211
+ // src/server/runtime/DuckDbRuntime.ts
134212
+ var fs15, os3, path12, DuckDbRuntime;
134213
+ var init_DuckDbRuntime = __esm({
134214
+ "src/server/runtime/DuckDbRuntime.ts"() {
134215
+ "use strict";
134216
+ fs15 = __toESM(require("fs"));
134217
+ os3 = __toESM(require("os"));
134218
+ path12 = __toESM(require("path"));
134219
+ init_DuckDbRuntimeTypes();
134220
+ init_duckdbPins_generated();
134221
+ init_DuckDbDownloader();
134222
+ init_MinimalTarExtractor();
134223
+ init_TelemetrySchema();
134224
+ DuckDbRuntime = class {
134225
+ constructor(options) {
134226
+ this.options = options;
134227
+ this.currentState = "provisioning";
134228
+ this.error = null;
134229
+ this.inFlight = null;
134230
+ this.loadedModule = null;
134231
+ this.retryDelayMs = 1e3;
134232
+ this.retryCount = 0;
134233
+ this.provisioningStartedAt = 0;
134234
+ this.retryTimer = null;
134235
+ }
134236
+ state() {
134237
+ return this.currentState;
134238
+ }
134239
+ lastError() {
134240
+ return this.error;
134241
+ }
134242
+ acquire(forceProvision = false) {
134243
+ if (this.loadedModule) {
134244
+ return Promise.resolve(this.loadedModule);
134245
+ }
134246
+ if (this.inFlight) {
134247
+ return this.inFlight;
134248
+ }
134249
+ this.provisioningStartedAt = Date.now();
134250
+ this.setState("provisioning");
134251
+ this.inFlight = this.provisionAndLoad(forceProvision).then((module2) => {
134252
+ this.loadedModule = module2;
134253
+ this.setState("ready");
134254
+ this.error = null;
134255
+ this.retryDelayMs = 1e3;
134256
+ this.retryCount = 0;
134257
+ this.inFlight = null;
134258
+ return module2;
134259
+ }).catch((error2) => {
134260
+ this.inFlight = null;
134261
+ this.scheduleRetry();
134262
+ throw error2;
134263
+ });
134264
+ return this.inFlight;
134265
+ }
134266
+ /** Starts a user-requested download even when background provisioning is disabled. */
134267
+ provisionNow() {
134268
+ return this.acquire(true);
134269
+ }
134270
+ dispose() {
134271
+ if (this.retryTimer) {
134272
+ clearTimeout(this.retryTimer);
134273
+ this.retryTimer = null;
134274
+ }
134275
+ }
134276
+ fail(reason, message) {
134277
+ this.setState("unavailable");
134278
+ this.error = { reason, message };
134279
+ this.options.telemetry?.capture("duckdb_provision_completed", {
134280
+ outcome: reason,
134281
+ trigger: "startup",
134282
+ duration_bucket: bucketDurationMs(Date.now() - this.provisioningStartedAt),
134283
+ retry_count_bucket: this.retryCountBucket()
134284
+ });
134285
+ throw new Error(message);
134286
+ }
134287
+ scheduleRetry() {
134288
+ if (this.error?.reason !== "offline" && this.error?.reason !== "disk_failed" && this.error?.reason !== "checksum_failed") {
134289
+ return;
134290
+ }
134291
+ const delay = this.retryDelayMs;
134292
+ const cap = this.options.retryBackoffCapMs ?? 60 * 60 * 1e3;
134293
+ this.retryDelayMs = Math.min(delay * 2, cap);
134294
+ this.retryCount += 1;
134295
+ this.retryTimer = setTimeout(() => {
134296
+ this.retryTimer = null;
134297
+ void this.acquire().catch(() => void 0);
134298
+ }, delay);
134299
+ this.retryTimer.unref();
134300
+ }
134301
+ async provisionAndLoad(forceProvision) {
134302
+ if (this.options.runtimePath) {
134303
+ try {
134304
+ return require(path12.resolve(this.options.runtimePath));
134305
+ } catch (error2) {
134306
+ return this.fail(
134307
+ "disk_failed",
134308
+ `Failed to load DuckDB from runtimePath: ${error2.message}`
134309
+ );
134310
+ }
134311
+ }
134312
+ if (!this.options.autoProvision && !forceProvision) {
134313
+ return this.fail(
134314
+ "disabled",
134315
+ "Managed DuckDB runtime auto-provisioning is disabled (sqlPreview.duckdb.autoProvision=false)."
134316
+ );
134317
+ }
134318
+ const platform = currentPlatformKey();
134319
+ const pins = DUCKDB_PLATFORM_PINS[platform];
134320
+ if (!pins) {
134321
+ return this.fail("disk_failed", `No DuckDB runtime pins available for platform ${platform}.`);
134322
+ }
134323
+ const versionDir = duckDbVersionDir(this.options.sqlPreviewHome, pins.duckDbVersion);
134324
+ const manifestPath = duckDbManifestPath(versionDir);
134325
+ const existing = readManifest(manifestPath);
134326
+ if (existing && existing.layoutVersion === 2 && existing.platform === platform && existing.duckDbVersion === pins.duckDbVersion) {
134327
+ try {
134328
+ return this.loadFromVersionDir(versionDir);
134329
+ } catch {
134330
+ }
134331
+ }
134332
+ const lockDir = `${versionDir}.provision-lock`;
134333
+ fs15.mkdirSync(path12.dirname(lockDir), { recursive: true });
134334
+ while (!this.tryAcquireProvisionLock(lockDir)) {
134335
+ const provisioned = readManifest(manifestPath);
134336
+ if (provisioned && provisioned.layoutVersion === 2 && provisioned.platform === platform && provisioned.duckDbVersion === pins.duckDbVersion) {
134337
+ return this.loadFromVersionDir(versionDir);
134338
+ }
134339
+ await new Promise((resolve4) => setTimeout(resolve4, 50));
134340
+ }
134341
+ const provisionedAfterLock = readManifest(manifestPath);
134342
+ if (provisionedAfterLock && provisionedAfterLock.layoutVersion === 2 && provisionedAfterLock.platform === platform && provisionedAfterLock.duckDbVersion === pins.duckDbVersion) {
134343
+ fs15.rmSync(lockDir, { recursive: true, force: true });
134344
+ return this.loadFromVersionDir(versionDir);
134345
+ }
134346
+ const tempDir = `${versionDir}-tmp-${process.pid}-${Date.now()}`;
134347
+ fs15.rmSync(tempDir, { recursive: true, force: true });
134348
+ fs15.mkdirSync(tempDir, { recursive: true });
134349
+ try {
134350
+ for (const tarball of pins.tarballs) {
134351
+ const downloadPath = path12.join(
134352
+ os3.tmpdir(),
134353
+ `${path12.basename(tarball.name)}-${Date.now()}.tgz`
134354
+ );
134355
+ try {
134356
+ await downloadToFile(tarball.url, downloadPath);
134357
+ } catch (error2) {
134358
+ return this.fail(
134359
+ "offline",
134360
+ `Failed to download ${tarball.name}: ${error2.message}`
134361
+ );
134362
+ }
134363
+ const actualHash = await sha512File(downloadPath);
134364
+ if (!verifyIntegrity(actualHash, tarball.integrity)) {
134365
+ fs15.rmSync(downloadPath, { force: true });
134366
+ return this.fail("checksum_failed", `Integrity check failed for ${tarball.name}.`);
134367
+ }
134368
+ const packageDestDir = path12.join(tempDir, "node_modules", ...tarball.name.split("/"));
134369
+ await extractTarGz(downloadPath, packageDestDir);
134370
+ this.flattenNpmPackage(packageDestDir);
134371
+ fs15.rmSync(downloadPath, { force: true });
134372
+ }
134373
+ fs15.rmSync(versionDir, { recursive: true, force: true });
134374
+ fs15.renameSync(tempDir, versionDir);
134375
+ writeManifest(manifestPath, {
134376
+ layoutVersion: 2,
134377
+ duckDbVersion: pins.duckDbVersion,
134378
+ platform,
134379
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
134380
+ tarballs: pins.tarballs.map((tarball) => ({
134381
+ name: tarball.name,
134382
+ sha512: tarball.integrity.replace(/^sha512-/, "")
134383
+ }))
134384
+ });
134385
+ this.options.telemetry?.capture("duckdb_provision_completed", {
134386
+ outcome: "success",
134387
+ trigger: "startup",
134388
+ duration_bucket: bucketDurationMs(Date.now() - this.provisioningStartedAt),
134389
+ retry_count_bucket: this.retryCountBucket()
134390
+ });
134391
+ return this.loadFromVersionDir(versionDir);
134392
+ } catch (error2) {
134393
+ fs15.rmSync(tempDir, { recursive: true, force: true });
134394
+ if (error2 instanceof Error && this.currentState === "unavailable") {
134395
+ throw error2;
134396
+ }
134397
+ return this.fail(
134398
+ "disk_failed",
134399
+ `DuckDB runtime provisioning failed: ${error2.message}`
134400
+ );
134401
+ } finally {
134402
+ fs15.rmSync(lockDir, { recursive: true, force: true });
134403
+ }
134404
+ }
134405
+ tryAcquireProvisionLock(lockDir) {
134406
+ try {
134407
+ fs15.mkdirSync(lockDir, { recursive: false });
134408
+ return true;
134409
+ } catch (error2) {
134410
+ if (error2.code === "EEXIST") {
134411
+ return false;
134412
+ }
134413
+ throw error2;
134414
+ }
134415
+ }
134416
+ setState(state) {
134417
+ if (this.currentState === state) {
134418
+ return;
134419
+ }
134420
+ this.currentState = state;
134421
+ this.options.telemetry?.capture("duckdb_runtime_state", { runtime_state: state });
134422
+ }
134423
+ retryCountBucket() {
134424
+ if (this.retryCount === 0) {
134425
+ return "0";
134426
+ }
134427
+ return this.retryCount === 1 ? "1" : "2+";
134428
+ }
134429
+ loadFromVersionDir(versionDir) {
134430
+ const entryPath = path12.join(versionDir, "node_modules", "@duckdb", "node-api");
134431
+ return require(entryPath);
134432
+ }
134433
+ flattenNpmPackage(packageDestDir) {
134434
+ const archiveRoot = path12.join(packageDestDir, "package");
134435
+ if (!fs15.statSync(archiveRoot, { throwIfNoEntry: false })?.isDirectory()) {
134436
+ throw new Error(`DuckDB package archive is missing its package directory: ${packageDestDir}`);
134437
+ }
134438
+ for (const entry of fs15.readdirSync(archiveRoot)) {
134439
+ fs15.renameSync(path12.join(archiveRoot, entry), path12.join(packageDestDir, entry));
134440
+ }
134441
+ fs15.rmdirSync(archiveRoot);
134442
+ }
134443
+ };
134444
+ }
134445
+ });
134446
+
133781
134447
  // package.json
133782
134448
  var require_package = __commonJS({
133783
134449
  "package.json"(exports, module2) {
@@ -133785,7 +134451,7 @@ var require_package = __commonJS({
133785
134451
  name: "sql-preview",
133786
134452
  displayName: "SQL Preview",
133787
134453
  description: "Run SQL in VS Code and expose governed MCP database tools for Claude, Cursor, and other AI agents.",
133788
- version: "0.6.8",
134454
+ version: "0.6.11",
133789
134455
  mcpName: "io.github.fadnavismehul/sql-preview",
133790
134456
  publisher: "mehul",
133791
134457
  icon: "media/icon.png",
@@ -134105,6 +134771,19 @@ var require_package = __commonJS({
134105
134771
  description: "(Experimental) Enable DuckDB connector. Requires a compatible Node.js environment.",
134106
134772
  order: 23
134107
134773
  },
134774
+ "sqlPreview.duckdb.autoProvision": {
134775
+ type: "boolean",
134776
+ default: true,
134777
+ description: "Automatically download and verify the managed DuckDB engine in the background so local file queries work with zero setup.",
134778
+ order: 24
134779
+ },
134780
+ "sqlPreview.duckdb.runtimePath": {
134781
+ type: "string",
134782
+ default: "",
134783
+ scope: "machine",
134784
+ description: "Advanced: absolute path to a manually-provisioned DuckDB runtime directory. Skips background downloads entirely (for air-gapped machines).",
134785
+ order: 25
134786
+ },
134108
134787
  "sqlPreview.defaultConnector": {
134109
134788
  type: "string",
134110
134789
  enum: [
@@ -134191,7 +134870,10 @@ var require_package = __commonJS({
134191
134870
  format: 'prettier --write "src/**/*.{ts,js,json}"',
134192
134871
  "format:check": 'prettier --check "src/**/*.{ts,js,json}" --cache',
134193
134872
  "check:ui-contract": "node scripts/check-ui-token-contract.js",
134873
+ "generate:duckdb-pins": "node scripts/generate-duckdb-pins.js",
134874
+ "check:duckdb-pins": "node scripts/check-duckdb-pins.js",
134194
134875
  "rfc:check": "node scripts/validate-rfcs.js",
134876
+ "rfc:new": "node scripts/new-rfc.js",
134195
134877
  "type-check": "tsc --noEmit --incremental --tsBuildInfoFile .tsbuildinfo",
134196
134878
  "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --external:ws --format=cjs --platform=node",
134197
134879
  "esbuild-daemon": "esbuild ./src/server/Daemon.ts --bundle --outfile=out/server/Daemon.js --platform=node --format=cjs --external:vscode --external:@duckdb/node-api --external:@google-cloud/bigquery --external:mysql2 --external:mysql2/* --external:mssql --external:snowflake-sdk --external:sql.js --alias:@opentelemetry/configuration=./src/stubs/otel-configuration-stub.js --alias:@opentelemetry/exporter-trace-otlp-grpc=./src/stubs/otel-grpc-exporters-stub.js --alias:@opentelemetry/exporter-logs-otlp-grpc=./src/stubs/otel-grpc-exporters-stub.js --alias:@opentelemetry/exporter-metrics-otlp-grpc=./src/stubs/otel-grpc-exporters-stub.js",
@@ -134342,20 +135024,22 @@ var Daemon_exports = {};
134342
135024
  __export(Daemon_exports, {
134343
135025
  Daemon: () => Daemon
134344
135026
  });
134345
- var import_express2, fs12, http4, path9, Daemon;
135027
+ var import_express2, fs16, http5, path13, Daemon;
134346
135028
  var init_Daemon = __esm({
134347
135029
  "src/server/Daemon.ts"() {
134348
135030
  "use strict";
134349
135031
  import_express2 = __toESM(require_express2());
134350
- fs12 = __toESM(require("fs"));
134351
- http4 = __toESM(require("http"));
134352
- path9 = __toESM(require("path"));
135032
+ fs16 = __toESM(require("fs"));
135033
+ http5 = __toESM(require("http"));
135034
+ path13 = __toESM(require("path"));
134353
135035
  init_protocolVersion();
134354
135036
  init_ConnectorRegistry();
134355
135037
  init_DriverManager();
135038
+ init_isFeatureEnabled();
134356
135039
  init_ConnectorFactories();
134357
135040
  init_ConnectionManager();
134358
135041
  init_EnvProfileStore();
135042
+ init_BuiltInProfileStore();
134359
135043
  init_FileProfileStore();
134360
135044
  init_MemoryCredentialStore();
134361
135045
  init_ConfigLoader();
@@ -134367,6 +135051,7 @@ var init_Daemon = __esm({
134367
135051
  init_CredentialRequestService();
134368
135052
  init_SessionManager();
134369
135053
  init_DaemonSurfaceManager();
135054
+ init_DuckDbRuntime();
134370
135055
  Daemon = class {
134371
135056
  constructor(configOptions = {}) {
134372
135057
  this.httpServer = null;
@@ -134384,15 +135069,26 @@ var init_Daemon = __esm({
134384
135069
  ConsoleLogger.getInstance().setLogLevel(this.config.logging.level);
134385
135070
  this.HTTP_PORT = this.config.server.port;
134386
135071
  this.CONFIG_DIR = this.resolvedConfig.configDir;
134387
- this.SOCKET_PATH = path9.join(this.CONFIG_DIR, `srv-${this.HTTP_PORT}.sock`);
135072
+ this.SOCKET_PATH = path13.join(this.CONFIG_DIR, `srv-${this.HTTP_PORT}.sock`);
134388
135073
  this.sessionManager = new SessionManager(ConsoleLogger.getInstance(), this.config.sessions);
134389
135074
  const fileStore = new FileProfileStore(this.CONFIG_DIR);
134390
135075
  const envStore = new EnvProfileStore();
134391
135076
  const credStore = new MemoryCredentialStore();
134392
- this.connectionManager = new ConnectionManager([envStore, fileStore], credStore);
135077
+ this.telemetryService = new DaemonTelemetryService({ configDir: this.CONFIG_DIR });
135078
+ const runtimePath = this.config.duckdb.runtimePath;
135079
+ this.duckDbRuntime = new DuckDbRuntime({
135080
+ sqlPreviewHome: this.CONFIG_DIR,
135081
+ autoProvision: isFeatureEnabled("managedDuckDbRuntime") && this.config.duckdb.autoProvision,
135082
+ telemetry: this.telemetryService,
135083
+ ...runtimePath ? { runtimePath } : {}
135084
+ });
135085
+ this.connectionManager = new ConnectionManager(
135086
+ [envStore, fileStore, new BuiltInProfileStore(this.duckDbRuntime)],
135087
+ credStore
135088
+ );
134393
135089
  this.connectorRegistry = new ConnectorRegistry();
134394
135090
  const driverManager = new DriverManager();
134395
- for (const factory2 of createBuiltInConnectorFactories(driverManager)) {
135091
+ for (const factory2 of createBuiltInConnectorFactories(driverManager, this.duckDbRuntime)) {
134396
135092
  this.connectorRegistry.registerFactory(factory2);
134397
135093
  }
134398
135094
  this.queryExecutor = new DaemonQueryExecutor(
@@ -134402,7 +135098,6 @@ var init_Daemon = __esm({
134402
135098
  driverManager,
134403
135099
  this.config.query
134404
135100
  );
134405
- this.telemetryService = new DaemonTelemetryService({ configDir: this.CONFIG_DIR });
134406
135101
  this.queryOperationRunner = new QueryOperationRunner(
134407
135102
  this.sessionManager,
134408
135103
  this.queryExecutor,
@@ -134421,7 +135116,8 @@ var init_Daemon = __esm({
134421
135116
  {
134422
135117
  safeMode: this.config.mcp.safeMode,
134423
135118
  credentialRequestService: this.credentialRequestService,
134424
- telemetry: this.telemetryService
135119
+ telemetry: this.telemetryService,
135120
+ duckDbRuntime: this.duckDbRuntime
134425
135121
  }
134426
135122
  );
134427
135123
  this.surfaceManager = new DaemonSurfaceManager({
@@ -134451,9 +135147,6 @@ var init_Daemon = __esm({
134451
135147
  this.surfaceManager.registerHttpRoutes();
134452
135148
  this.setupLifecycle();
134453
135149
  this.setupEventBroadcasting();
134454
- this.ensureBuiltInConnections().catch(
134455
- (e) => logger.warn("[Daemon] Failed to create built-in connections:", e)
134456
- );
134457
135150
  }
134458
135151
  getHttpBaseUrl() {
134459
135152
  const host = ["0.0.0.0", "::", ""].includes(this.config.server.host) ? "127.0.0.1" : this.config.server.host;
@@ -134466,23 +135159,6 @@ var init_Daemon = __esm({
134466
135159
  }
134467
135160
  return `http://${host}:${port}`;
134468
135161
  }
134469
- /**
134470
- * Auto-provisions built-in connections that should always be available.
134471
- * DuckDB :memory: allows CSV/Parquet queries without any manual setup.
134472
- */
134473
- async ensureBuiltInConnections() {
134474
- const profiles = await this.connectionManager.getProfiles();
134475
- const hasBuiltInDuckDb = profiles.some((p) => p.id === "built-in-duckdb");
134476
- if (!hasBuiltInDuckDb) {
134477
- await this.connectionManager.saveProfile({
134478
- id: "built-in-duckdb",
134479
- name: "Local Files (DuckDB)",
134480
- type: "duckdb",
134481
- databasePath: ":memory:"
134482
- });
134483
- logger.info("[Daemon] Auto-created built-in DuckDB connection for local file queries");
134484
- }
134485
- }
134486
135162
  setupEventBroadcasting() {
134487
135163
  this.sessionManager.on("tab-added", () => this.surfaceManager.broadcastResourceChange());
134488
135164
  this.sessionManager.on("tab-updated", () => this.surfaceManager.broadcastResourceChange());
@@ -134570,16 +135246,16 @@ var init_Daemon = __esm({
134570
135246
  return status?.service === "sql-preview-daemon" && status.pid === pid;
134571
135247
  }
134572
135248
  async readExistingDaemonStatus() {
134573
- return new Promise((resolve2) => {
135249
+ return new Promise((resolve4) => {
134574
135250
  let settled = false;
134575
135251
  const settle2 = (status) => {
134576
135252
  if (settled) {
134577
135253
  return;
134578
135254
  }
134579
135255
  settled = true;
134580
- resolve2(status);
135256
+ resolve4(status);
134581
135257
  };
134582
- const req = http4.get(
135258
+ const req = http5.get(
134583
135259
  {
134584
135260
  host: this.config.server.host,
134585
135261
  port: this.HTTP_PORT,
@@ -134611,10 +135287,10 @@ var init_Daemon = __esm({
134611
135287
  });
134612
135288
  }
134613
135289
  async start() {
134614
- const pidPath = path9.join(this.CONFIG_DIR, `server-${this.HTTP_PORT}.pid`);
135290
+ const pidPath = path13.join(this.CONFIG_DIR, `server-${this.HTTP_PORT}.pid`);
134615
135291
  try {
134616
- if (fs12.existsSync(pidPath)) {
134617
- const pidContent = fs12.readFileSync(pidPath, "utf8");
135292
+ if (fs16.existsSync(pidPath)) {
135293
+ const pidContent = fs16.readFileSync(pidPath, "utf8");
134618
135294
  const existingPid = parseInt(pidContent, 10);
134619
135295
  if (!isNaN(existingPid) && existingPid !== process.pid) {
134620
135296
  try {
@@ -134640,17 +135316,17 @@ var init_Daemon = __esm({
134640
135316
  }
134641
135317
  }
134642
135318
  }
134643
- if (fs12.existsSync(pidPath)) {
134644
- fs12.unlinkSync(pidPath);
135319
+ if (fs16.existsSync(pidPath)) {
135320
+ fs16.unlinkSync(pidPath);
134645
135321
  }
134646
135322
  }
134647
- fs12.writeFileSync(pidPath, process.pid.toString());
135323
+ fs16.writeFileSync(pidPath, process.pid.toString());
134648
135324
  this.ownsPidAndSocket = true;
134649
135325
  } catch (e) {
134650
135326
  logger.error("[Daemon] Startup error checking PID:", e);
134651
135327
  process.exit(1);
134652
135328
  }
134653
- await new Promise((resolve2, reject) => {
135329
+ await new Promise((resolve4, reject) => {
134654
135330
  this.httpServer = this.app.listen(this.HTTP_PORT, this.config.server.host, () => {
134655
135331
  const addr = this.httpServer?.address();
134656
135332
  const bind2 = typeof addr === "string" ? `pipe ${addr}` : `port ${addr?.port}`;
@@ -134662,7 +135338,7 @@ var init_Daemon = __esm({
134662
135338
  logger.error("[Daemon] HTTP server error after bind:", err);
134663
135339
  process.exit(1);
134664
135340
  });
134665
- resolve2();
135341
+ resolve4();
134666
135342
  });
134667
135343
  this.httpServer.on("error", reject);
134668
135344
  });
@@ -134670,11 +135346,12 @@ var init_Daemon = __esm({
134670
135346
  this.surfaceManager.attachWebSocket(this.httpServer);
134671
135347
  }
134672
135348
  await this.surfaceManager.startSocketServer();
135349
+ void this.duckDbRuntime.acquire().catch(() => void 0);
134673
135350
  }
134674
135351
  async startStdio() {
134675
135352
  this.isStdioMode = true;
134676
135353
  ConsoleLogger.getInstance().setUseStdErr(true);
134677
- await new Promise((resolve2, reject) => {
135354
+ await new Promise((resolve4, reject) => {
134678
135355
  this.httpServer = this.app.listen(0, "127.0.0.1", () => {
134679
135356
  const addr = this.httpServer?.address();
134680
135357
  const bind2 = addr ? `port ${addr.port}` : "unknown port";
@@ -134683,7 +135360,7 @@ var init_Daemon = __esm({
134683
135360
  this.httpServer?.on("error", (err) => {
134684
135361
  logger.error("[Daemon] Background HTTP server error:", err);
134685
135362
  });
134686
- resolve2();
135363
+ resolve4();
134687
135364
  });
134688
135365
  this.httpServer.on("error", reject);
134689
135366
  });
@@ -134691,6 +135368,7 @@ var init_Daemon = __esm({
134691
135368
  }
134692
135369
  stop() {
134693
135370
  logger.info("[Daemon] Stopping servers...");
135371
+ this.duckDbRuntime?.dispose();
134694
135372
  void this.telemetryService?.dispose().catch(() => {
134695
135373
  });
134696
135374
  if (this.uncaughtExceptionHandler) {
@@ -134725,16 +135403,16 @@ var init_Daemon = __esm({
134725
135403
  this.idleCheckInterval = void 0;
134726
135404
  }
134727
135405
  if (this.ownsPidAndSocket) {
134728
- const pidPath = path9.join(this.CONFIG_DIR, `server-${this.HTTP_PORT}.pid`);
134729
- if (fs12.existsSync(pidPath)) {
135406
+ const pidPath = path13.join(this.CONFIG_DIR, `server-${this.HTTP_PORT}.pid`);
135407
+ if (fs16.existsSync(pidPath)) {
134730
135408
  try {
134731
- fs12.unlinkSync(pidPath);
135409
+ fs16.unlinkSync(pidPath);
134732
135410
  } catch {
134733
135411
  }
134734
135412
  }
134735
- if (fs12.existsSync(this.SOCKET_PATH)) {
135413
+ if (fs16.existsSync(this.SOCKET_PATH)) {
134736
135414
  try {
134737
- fs12.unlinkSync(this.SOCKET_PATH);
135415
+ fs16.unlinkSync(this.SOCKET_PATH);
134738
135416
  } catch {
134739
135417
  }
134740
135418
  }