@prisma/fetch-engine 6.16.2 → 6.17.0-dev.10

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.
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_PXQVM7NP_exports = {};
30
- __export(chunk_PXQVM7NP_exports, {
29
+ var chunk_QFA3XBMW_exports = {};
30
+ __export(chunk_QFA3XBMW_exports, {
31
31
  allEngineEnvVarsSet: () => allEngineEnvVarsSet,
32
32
  bold: () => bold,
33
33
  deprecatedEnvVarMap: () => deprecatedEnvVarMap,
@@ -35,10 +35,10 @@ __export(chunk_PXQVM7NP_exports, {
35
35
  getBinaryEnvVarPath: () => getBinaryEnvVarPath,
36
36
  yellow: () => yellow
37
37
  });
38
- module.exports = __toCommonJS(chunk_PXQVM7NP_exports);
38
+ module.exports = __toCommonJS(chunk_QFA3XBMW_exports);
39
+ var import_node_fs = __toESM(require("node:fs"));
40
+ var import_node_path = __toESM(require("node:path"));
39
41
  var import_debug = __toESM(require("@prisma/debug"));
40
- var import_fs = __toESM(require("fs"));
41
- var import_path = __toESM(require("path"));
42
42
  var FORCE_COLOR;
43
43
  var NODE_DISABLE_COLORS;
44
44
  var NO_COLOR;
@@ -109,8 +109,8 @@ var deprecatedEnvVarMap = {
109
109
  function getBinaryEnvVarPath(binaryName) {
110
110
  const envVar = getEnvVarToUse(binaryName);
111
111
  if (process.env[envVar]) {
112
- const envVarPath = import_path.default.resolve(process.cwd(), process.env[envVar]);
113
- if (!import_fs.default.existsSync(envVarPath)) {
112
+ const envVarPath = import_node_path.default.resolve(process.cwd(), process.env[envVar]);
113
+ if (!import_node_fs.default.existsSync(envVarPath)) {
114
114
  throw new Error(
115
115
  `Env var ${bold(envVar)} is provided but provided path ${underline(process.env[envVar])} can't be resolved.`
116
116
  );
@@ -26,23 +26,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_NA32AGOU_exports = {};
30
- __export(chunk_NA32AGOU_exports, {
29
+ var chunk_TT7KVFVK_exports = {};
30
+ __export(chunk_TT7KVFVK_exports, {
31
31
  downloadZip: () => downloadZip,
32
- require_is_stream: () => require_is_stream,
33
32
  require_temp_dir: () => require_temp_dir
34
33
  });
35
- module.exports = __toCommonJS(chunk_NA32AGOU_exports);
34
+ module.exports = __toCommonJS(chunk_TT7KVFVK_exports);
36
35
  var import_chunk_RXM4EBGR = require("./chunk-RXM4EBGR.js");
37
- var import_chunk_SVP4SRAT = require("./chunk-SVP4SRAT.js");
38
- var import_chunk_YJOPKU47 = require("./chunk-YJOPKU47.js");
36
+ var import_chunk_FSAAZH62 = require("./chunk-FSAAZH62.js");
37
+ var import_chunk_7KB2WQ67 = require("./chunk-7KB2WQ67.js");
39
38
  var import_chunk_VAPNG6TS = require("./chunk-VAPNG6TS.js");
40
39
  var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
40
+ var import_node_fs = __toESM(require("node:fs"));
41
+ var import_node_path = __toESM(require("node:path"));
42
+ var import_node_zlib = __toESM(require("node:zlib"));
41
43
  var import_debug = __toESM(require("@prisma/debug"));
42
- var import_fs = __toESM(require("fs"));
43
44
  var import_node_http = __toESM(require("node:http"));
44
45
  var import_node_https = __toESM(require("node:https"));
45
- var import_node_zlib = __toESM(require("node:zlib"));
46
+ var import_node_zlib2 = __toESM(require("node:zlib"));
46
47
  var import_node_stream = __toESM(require("node:stream"));
47
48
  var import_node_buffer = require("node:buffer");
48
49
  var import_node_stream2 = __toESM(require("node:stream"));
@@ -53,8 +54,6 @@ var import_node_http2 = __toESM(require("node:http"));
53
54
  var import_node_url = require("node:url");
54
55
  var import_node_util3 = require("node:util");
55
56
  var import_node_net = require("node:net");
56
- var import_path = __toESM(require("path"));
57
- var import_zlib = __toESM(require("zlib"));
58
57
  var require_is_stream = (0, import_chunk_QGM4M3NI.__commonJS)({
59
58
  "../../node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js"(exports, module2) {
60
59
  "use strict";
@@ -7680,11 +7679,67 @@ var require_concat_map = (0, import_chunk_QGM4M3NI.__commonJS)({
7680
7679
  };
7681
7680
  }
7682
7681
  });
7682
+ var require_balanced_match = (0, import_chunk_QGM4M3NI.__commonJS)({
7683
+ "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module2) {
7684
+ "use strict";
7685
+ module2.exports = balanced;
7686
+ function balanced(a, b, str) {
7687
+ if (a instanceof RegExp) a = maybeMatch(a, str);
7688
+ if (b instanceof RegExp) b = maybeMatch(b, str);
7689
+ var r = range(a, b, str);
7690
+ return r && {
7691
+ start: r[0],
7692
+ end: r[1],
7693
+ pre: str.slice(0, r[0]),
7694
+ body: str.slice(r[0] + a.length, r[1]),
7695
+ post: str.slice(r[1] + b.length)
7696
+ };
7697
+ }
7698
+ function maybeMatch(reg, str) {
7699
+ var m = str.match(reg);
7700
+ return m ? m[0] : null;
7701
+ }
7702
+ balanced.range = range;
7703
+ function range(a, b, str) {
7704
+ var begs, beg, left, right, result;
7705
+ var ai = str.indexOf(a);
7706
+ var bi = str.indexOf(b, ai + 1);
7707
+ var i = ai;
7708
+ if (ai >= 0 && bi > 0) {
7709
+ if (a === b) {
7710
+ return [ai, bi];
7711
+ }
7712
+ begs = [];
7713
+ left = str.length;
7714
+ while (i >= 0 && !result) {
7715
+ if (i == ai) {
7716
+ begs.push(i);
7717
+ ai = str.indexOf(a, i + 1);
7718
+ } else if (begs.length == 1) {
7719
+ result = [begs.pop(), bi];
7720
+ } else {
7721
+ beg = begs.pop();
7722
+ if (beg < left) {
7723
+ left = beg;
7724
+ right = bi;
7725
+ }
7726
+ bi = str.indexOf(b, i + 1);
7727
+ }
7728
+ i = ai < bi && ai >= 0 ? ai : bi;
7729
+ }
7730
+ if (begs.length) {
7731
+ result = [left, right];
7732
+ }
7733
+ }
7734
+ return result;
7735
+ }
7736
+ }
7737
+ });
7683
7738
  var require_brace_expansion = (0, import_chunk_QGM4M3NI.__commonJS)({
7684
7739
  "../../node_modules/.pnpm/brace-expansion@1.1.11/node_modules/brace-expansion/index.js"(exports, module2) {
7685
7740
  "use strict";
7686
7741
  var concatMap = require_concat_map();
7687
- var balanced = (0, import_chunk_SVP4SRAT.require_balanced_match)();
7742
+ var balanced = require_balanced_match();
7688
7743
  module2.exports = expandTop;
7689
7744
  var escSlash = "\0SLASH" + Math.random() + "\0";
7690
7745
  var escOpen = "\0OPEN" + Math.random() + "\0";
@@ -9967,7 +10022,7 @@ var require_del = (0, import_chunk_QGM4M3NI.__commonJS)({
9967
10022
  var isPathCwd = require_is_path_cwd();
9968
10023
  var isPathInside = require_is_path_inside();
9969
10024
  var rimraf2 = require_rimraf();
9970
- var pMap = (0, import_chunk_SVP4SRAT.require_p_map)();
10025
+ var pMap = (0, import_chunk_FSAAZH62.require_p_map)();
9971
10026
  var rimrafP = promisify2(rimraf2);
9972
10027
  var rimrafOptions = {
9973
10028
  glob: false,
@@ -11269,11 +11324,11 @@ async function fetch(url, options_) {
11269
11324
  return;
11270
11325
  }
11271
11326
  const zlibOptions = {
11272
- flush: import_node_zlib.default.Z_SYNC_FLUSH,
11273
- finishFlush: import_node_zlib.default.Z_SYNC_FLUSH
11327
+ flush: import_node_zlib2.default.Z_SYNC_FLUSH,
11328
+ finishFlush: import_node_zlib2.default.Z_SYNC_FLUSH
11274
11329
  };
11275
11330
  if (codings === "gzip" || codings === "x-gzip") {
11276
- body = (0, import_node_stream.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error) => {
11331
+ body = (0, import_node_stream.pipeline)(body, import_node_zlib2.default.createGunzip(zlibOptions), (error) => {
11277
11332
  if (error) {
11278
11333
  reject(error);
11279
11334
  }
@@ -11290,13 +11345,13 @@ async function fetch(url, options_) {
11290
11345
  });
11291
11346
  raw.once("data", (chunk) => {
11292
11347
  if ((chunk[0] & 15) === 8) {
11293
- body = (0, import_node_stream.pipeline)(body, import_node_zlib.default.createInflate(), (error) => {
11348
+ body = (0, import_node_stream.pipeline)(body, import_node_zlib2.default.createInflate(), (error) => {
11294
11349
  if (error) {
11295
11350
  reject(error);
11296
11351
  }
11297
11352
  });
11298
11353
  } else {
11299
- body = (0, import_node_stream.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error) => {
11354
+ body = (0, import_node_stream.pipeline)(body, import_node_zlib2.default.createInflateRaw(), (error) => {
11300
11355
  if (error) {
11301
11356
  reject(error);
11302
11357
  }
@@ -11314,7 +11369,7 @@ async function fetch(url, options_) {
11314
11369
  return;
11315
11370
  }
11316
11371
  if (codings === "br") {
11317
- body = (0, import_node_stream.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error) => {
11372
+ body = (0, import_node_stream.pipeline)(body, import_node_zlib2.default.createBrotliDecompress(), (error) => {
11318
11373
  if (error) {
11319
11374
  reject(error);
11320
11375
  }
@@ -11364,6 +11419,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
11364
11419
  var import_p_retry = (0, import_chunk_QGM4M3NI.__toESM)(require_p_retry());
11365
11420
  var import_tempy = (0, import_chunk_QGM4M3NI.__toESM)(require_tempy());
11366
11421
  var debug = (0, import_debug.default)("prisma:fetch-engine:downloadZip");
11422
+ var rimraf = (path2) => import_node_fs.default.promises.rm(path2, { force: true, recursive: true });
11367
11423
  async function fetchChecksum(url) {
11368
11424
  try {
11369
11425
  const checksumUrl = `${url}.sha256`;
@@ -11399,7 +11455,7 @@ Error: ${error}`
11399
11455
  }
11400
11456
  async function downloadZip(url, target, progressCb) {
11401
11457
  const tmpDir = import_tempy.default.directory();
11402
- const partial = import_path.default.join(tmpDir, "partial");
11458
+ const partial = import_node_path.default.join(tmpDir, "partial");
11403
11459
  const RETRIES_COUNT = 2;
11404
11460
  const [zippedSha256, sha256] = await (0, import_p_retry.default)(
11405
11461
  async () => {
@@ -11421,7 +11477,7 @@ async function downloadZip(url, target, progressCb) {
11421
11477
  }
11422
11478
  const lastModified = response.headers.get("last-modified");
11423
11479
  const size = parseFloat(response.headers.get("content-length"));
11424
- const ws = import_fs.default.createWriteStream(partial);
11480
+ const ws = import_node_fs.default.createWriteStream(partial);
11425
11481
  return await new Promise(async (resolve, reject) => {
11426
11482
  let bytesRead = 0;
11427
11483
  if (response.body === null) {
@@ -11433,7 +11489,7 @@ async function downloadZip(url, target, progressCb) {
11433
11489
  progressCb(bytesRead / size);
11434
11490
  }
11435
11491
  });
11436
- const gunzip = import_zlib.default.createGunzip();
11492
+ const gunzip = import_node_zlib.default.createGunzip();
11437
11493
  gunzip.on("error", reject);
11438
11494
  const zipStream = response.body.pipe(gunzip);
11439
11495
  const zippedHashPromise = import_hasha.default.fromStream(response.body, {
@@ -11461,10 +11517,10 @@ async function downloadZip(url, target, progressCb) {
11461
11517
  onFailedAttempt: (err) => debug("An error occurred while downloading the engine file", err)
11462
11518
  }
11463
11519
  );
11464
- await (0, import_chunk_YJOPKU47.overwriteFile)(partial, target);
11520
+ await (0, import_chunk_7KB2WQ67.overwriteFile)(partial, target);
11465
11521
  try {
11466
- await (0, import_chunk_SVP4SRAT.rimraf)(partial);
11467
- await (0, import_chunk_SVP4SRAT.rimraf)(tmpDir);
11522
+ await rimraf(partial);
11523
+ await rimraf(tmpDir);
11468
11524
  } catch (e) {
11469
11525
  debug(e);
11470
11526
  }