@prisma/fetch-engine 6.5.0-dev.8 → 6.5.0-dev.81

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 __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_6ACSEAQE_exports = {};
30
- __export(chunk_6ACSEAQE_exports, {
29
+ var chunk_5EMIKDK5_exports = {};
30
+ __export(chunk_5EMIKDK5_exports, {
31
31
  download: () => download,
32
32
  getBinaryName: () => getBinaryName,
33
33
  getVersion: () => getVersion,
@@ -35,12 +35,12 @@ __export(chunk_6ACSEAQE_exports, {
35
35
  plusX: () => plusX,
36
36
  vercelPkgPathRegex: () => vercelPkgPathRegex
37
37
  });
38
- module.exports = __toCommonJS(chunk_6ACSEAQE_exports);
38
+ module.exports = __toCommonJS(chunk_5EMIKDK5_exports);
39
39
  var import_chunk_4LX3XBNY = require("./chunk-4LX3XBNY.js");
40
40
  var import_chunk_MX3HXAU2 = require("./chunk-MX3HXAU2.js");
41
- var import_chunk_FKKOTNO6 = require("./chunk-FKKOTNO6.js");
42
- var import_chunk_7NQURTUG = require("./chunk-7NQURTUG.js");
43
- var import_chunk_G7EM4XDM = require("./chunk-G7EM4XDM.js");
41
+ var import_chunk_I3P4GT6A = require("./chunk-I3P4GT6A.js");
42
+ var import_chunk_ORVVLJ4G = require("./chunk-ORVVLJ4G.js");
43
+ var import_chunk_HACCWU3B = require("./chunk-HACCWU3B.js");
44
44
  var import_chunk_PXQVM7NP = require("./chunk-PXQVM7NP.js");
45
45
  var import_chunk_CWGQAQ3T = require("./chunk-CWGQAQ3T.js");
46
46
  var import_chunk_AH6QHEOA = require("./chunk-AH6QHEOA.js");
@@ -1552,7 +1552,7 @@ var require_merge_stream = (0, import_chunk_AH6QHEOA.__commonJS)({
1552
1552
  var require_stream = (0, import_chunk_AH6QHEOA.__commonJS)({
1553
1553
  "../../node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js"(exports, module2) {
1554
1554
  "use strict";
1555
- var isStream = (0, import_chunk_7NQURTUG.require_is_stream)();
1555
+ var isStream = (0, import_chunk_ORVVLJ4G.require_is_stream)();
1556
1556
  var getStream = require_get_stream();
1557
1557
  var mergeStream = require_merge_stream();
1558
1558
  var handleInput = (spawned, input) => {
@@ -1932,85 +1932,11 @@ var require_execa = (0, import_chunk_AH6QHEOA.__commonJS)({
1932
1932
  };
1933
1933
  }
1934
1934
  });
1935
- var require_p_map = (0, import_chunk_AH6QHEOA.__commonJS)({
1936
- "../../node_modules/.pnpm/p-map@2.1.0/node_modules/p-map/index.js"(exports, module2) {
1937
- "use strict";
1938
- var pMap = (iterable, mapper, options2) => new Promise((resolve, reject) => {
1939
- options2 = Object.assign({
1940
- concurrency: Infinity
1941
- }, options2);
1942
- if (typeof mapper !== "function") {
1943
- throw new TypeError("Mapper function is required");
1944
- }
1945
- const { concurrency } = options2;
1946
- if (!(typeof concurrency === "number" && concurrency >= 1)) {
1947
- throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`);
1948
- }
1949
- const ret = [];
1950
- const iterator = iterable[Symbol.iterator]();
1951
- let isRejected = false;
1952
- let isIterableDone = false;
1953
- let resolvingCount = 0;
1954
- let currentIndex = 0;
1955
- const next = () => {
1956
- if (isRejected) {
1957
- return;
1958
- }
1959
- const nextItem = iterator.next();
1960
- const i = currentIndex;
1961
- currentIndex++;
1962
- if (nextItem.done) {
1963
- isIterableDone = true;
1964
- if (resolvingCount === 0) {
1965
- resolve(ret);
1966
- }
1967
- return;
1968
- }
1969
- resolvingCount++;
1970
- Promise.resolve(nextItem.value).then((element) => mapper(element, i)).then(
1971
- (value) => {
1972
- ret[i] = value;
1973
- resolvingCount--;
1974
- next();
1975
- },
1976
- (error) => {
1977
- isRejected = true;
1978
- reject(error);
1979
- }
1980
- );
1981
- };
1982
- for (let i = 0; i < concurrency; i++) {
1983
- next();
1984
- if (isIterableDone) {
1985
- break;
1986
- }
1987
- }
1988
- });
1989
- module2.exports = pMap;
1990
- module2.exports.default = pMap;
1991
- }
1992
- });
1993
- var require_p_filter = (0, import_chunk_AH6QHEOA.__commonJS)({
1994
- "../../node_modules/.pnpm/p-filter@2.1.0/node_modules/p-filter/index.js"(exports, module2) {
1995
- "use strict";
1996
- var pMap = require_p_map();
1997
- var pFilter2 = async (iterable, filterer, options2) => {
1998
- const values = await pMap(
1999
- iterable,
2000
- (element, index) => Promise.all([filterer(element, index), element]),
2001
- options2
2002
- );
2003
- return values.filter((value) => Boolean(value[0])).map((value) => value[1]);
2004
- };
2005
- module2.exports = pFilter2;
2006
- module2.exports.default = pFilter2;
2007
- }
2008
- });
2009
1935
  var require_package = (0, import_chunk_AH6QHEOA.__commonJS)({
2010
1936
  "package.json"(exports, module2) {
2011
1937
  module2.exports = {
2012
1938
  name: "@prisma/fetch-engine",
2013
- version: "6.5.0-dev.8",
1939
+ version: "6.5.0-dev.81",
2014
1940
  description: "This package is intended for Prisma's internal use",
2015
1941
  main: "dist/index.js",
2016
1942
  types: "dist/index.d.ts",
@@ -2025,22 +1951,22 @@ var require_package = (0, import_chunk_AH6QHEOA.__commonJS)({
2025
1951
  bugs: "https://github.com/prisma/prisma/issues",
2026
1952
  enginesOverride: {},
2027
1953
  devDependencies: {
2028
- "@swc/core": "1.10.11",
1954
+ "@swc/core": "1.11.5",
2029
1955
  "@swc/jest": "0.2.37",
2030
1956
  "@types/jest": "29.5.14",
2031
- "@types/node": "18.19.31",
1957
+ "@types/node": "18.19.76",
2032
1958
  "@types/progress": "2.0.7",
2033
1959
  del: "6.1.1",
2034
1960
  execa: "5.1.1",
2035
1961
  "find-cache-dir": "5.0.0",
2036
- "fs-extra": "11.1.1",
1962
+ "fs-extra": "11.3.0",
2037
1963
  hasha: "5.2.2",
2038
1964
  "http-proxy-agent": "7.0.2",
2039
1965
  "https-proxy-agent": "7.0.6",
2040
1966
  jest: "29.7.0",
2041
1967
  kleur: "4.1.5",
2042
1968
  "node-fetch": "3.3.2",
2043
- "p-filter": "2.1.0",
1969
+ "p-filter": "4.1.0",
2044
1970
  "p-map": "4.0.0",
2045
1971
  "p-retry": "4.6.2",
2046
1972
  progress: "2.0.3",
@@ -2053,7 +1979,7 @@ var require_package = (0, import_chunk_AH6QHEOA.__commonJS)({
2053
1979
  },
2054
1980
  dependencies: {
2055
1981
  "@prisma/debug": "workspace:*",
2056
- "@prisma/engines-version": "6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d",
1982
+ "@prisma/engines-version": "6.5.0-70.d3fd11690486b166608fd9d9091a0e94f299a99d",
2057
1983
  "@prisma/get-platform": "workspace:*"
2058
1984
  },
2059
1985
  scripts: {
@@ -2071,9 +1997,137 @@ var require_package = (0, import_chunk_AH6QHEOA.__commonJS)({
2071
1997
  }
2072
1998
  });
2073
1999
  var import_execa = (0, import_chunk_AH6QHEOA.__toESM)(require_execa());
2074
- var import_fs_extra = (0, import_chunk_AH6QHEOA.__toESM)((0, import_chunk_G7EM4XDM.require_lib)());
2075
- var import_p_filter = (0, import_chunk_AH6QHEOA.__toESM)(require_p_filter());
2076
- var import_temp_dir = (0, import_chunk_AH6QHEOA.__toESM)((0, import_chunk_7NQURTUG.require_temp_dir)());
2000
+ var import_fs_extra = (0, import_chunk_AH6QHEOA.__toESM)((0, import_chunk_HACCWU3B.require_lib)());
2001
+ async function pMap(iterable, mapper, {
2002
+ concurrency = Number.POSITIVE_INFINITY,
2003
+ stopOnError = true,
2004
+ signal
2005
+ } = {}) {
2006
+ return new Promise((resolve_, reject_) => {
2007
+ if (iterable[Symbol.iterator] === void 0 && iterable[Symbol.asyncIterator] === void 0) {
2008
+ throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
2009
+ }
2010
+ if (typeof mapper !== "function") {
2011
+ throw new TypeError("Mapper function is required");
2012
+ }
2013
+ if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || concurrency === Number.POSITIVE_INFINITY)) {
2014
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
2015
+ }
2016
+ const result = [];
2017
+ const errors = [];
2018
+ const skippedIndexesMap = /* @__PURE__ */ new Map();
2019
+ let isRejected = false;
2020
+ let isResolved = false;
2021
+ let isIterableDone = false;
2022
+ let resolvingCount = 0;
2023
+ let currentIndex = 0;
2024
+ const iterator = iterable[Symbol.iterator] === void 0 ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
2025
+ const signalListener = () => {
2026
+ reject(signal.reason);
2027
+ };
2028
+ const cleanup = () => {
2029
+ signal?.removeEventListener("abort", signalListener);
2030
+ };
2031
+ const resolve = (value) => {
2032
+ resolve_(value);
2033
+ cleanup();
2034
+ };
2035
+ const reject = (reason) => {
2036
+ isRejected = true;
2037
+ isResolved = true;
2038
+ reject_(reason);
2039
+ cleanup();
2040
+ };
2041
+ if (signal) {
2042
+ if (signal.aborted) {
2043
+ reject(signal.reason);
2044
+ }
2045
+ signal.addEventListener("abort", signalListener, { once: true });
2046
+ }
2047
+ const next = async () => {
2048
+ if (isResolved) {
2049
+ return;
2050
+ }
2051
+ const nextItem = await iterator.next();
2052
+ const index = currentIndex;
2053
+ currentIndex++;
2054
+ if (nextItem.done) {
2055
+ isIterableDone = true;
2056
+ if (resolvingCount === 0 && !isResolved) {
2057
+ if (!stopOnError && errors.length > 0) {
2058
+ reject(new AggregateError(errors));
2059
+ return;
2060
+ }
2061
+ isResolved = true;
2062
+ if (skippedIndexesMap.size === 0) {
2063
+ resolve(result);
2064
+ return;
2065
+ }
2066
+ const pureResult = [];
2067
+ for (const [index2, value] of result.entries()) {
2068
+ if (skippedIndexesMap.get(index2) === pMapSkip) {
2069
+ continue;
2070
+ }
2071
+ pureResult.push(value);
2072
+ }
2073
+ resolve(pureResult);
2074
+ }
2075
+ return;
2076
+ }
2077
+ resolvingCount++;
2078
+ (async () => {
2079
+ try {
2080
+ const element = await nextItem.value;
2081
+ if (isResolved) {
2082
+ return;
2083
+ }
2084
+ const value = await mapper(element, index);
2085
+ if (value === pMapSkip) {
2086
+ skippedIndexesMap.set(index, value);
2087
+ }
2088
+ result[index] = value;
2089
+ resolvingCount--;
2090
+ await next();
2091
+ } catch (error) {
2092
+ if (stopOnError) {
2093
+ reject(error);
2094
+ } else {
2095
+ errors.push(error);
2096
+ resolvingCount--;
2097
+ try {
2098
+ await next();
2099
+ } catch (error2) {
2100
+ reject(error2);
2101
+ }
2102
+ }
2103
+ }
2104
+ })();
2105
+ };
2106
+ (async () => {
2107
+ for (let index = 0; index < concurrency; index++) {
2108
+ try {
2109
+ await next();
2110
+ } catch (error) {
2111
+ reject(error);
2112
+ break;
2113
+ }
2114
+ if (isIterableDone || isRejected) {
2115
+ break;
2116
+ }
2117
+ }
2118
+ })();
2119
+ });
2120
+ }
2121
+ var pMapSkip = Symbol("skip");
2122
+ async function pFilter(iterable, filterer, options2) {
2123
+ const values = await pMap(
2124
+ iterable,
2125
+ (element, index) => Promise.all([filterer(element, index), element]),
2126
+ options2
2127
+ );
2128
+ return values.filter((value) => Boolean(value[0])).map((value) => value[1]);
2129
+ }
2130
+ var import_temp_dir = (0, import_chunk_AH6QHEOA.__toESM)((0, import_chunk_ORVVLJ4G.require_temp_dir)());
2077
2131
  var { enginesOverride } = require_package();
2078
2132
  var debug = (0, import_debug.default)("prisma:fetch-engine:download");
2079
2133
  var exists = (0, import_util.promisify)(import_fs.default.exists);
@@ -2129,7 +2183,7 @@ async function download(options) {
2129
2183
  if (opts.printVersion) {
2130
2184
  console.log(`version: ${opts.version}`);
2131
2185
  }
2132
- const binariesToDownload = await (0, import_p_filter.default)(binaryJobs, async (job) => {
2186
+ const binariesToDownload = await pFilter(binaryJobs, async (job) => {
2133
2187
  const needsToBeDownloaded = await binaryNeedsToBeDownloaded(job, binaryTarget, opts.version);
2134
2188
  const isSupported = import_get_platform.binaryTargets.includes(job.binaryTarget);
2135
2189
  const shouldDownload = isSupported && !job.envVarPath && // this is for custom binaries
@@ -2140,7 +2194,7 @@ async function download(options) {
2140
2194
  return shouldDownload;
2141
2195
  });
2142
2196
  if (binariesToDownload.length > 0) {
2143
- const cleanupPromise = (0, import_chunk_FKKOTNO6.cleanupCache)();
2197
+ const cleanupPromise = (0, import_chunk_I3P4GT6A.cleanupCache)();
2144
2198
  let finishBar;
2145
2199
  let setProgress;
2146
2200
  if (opts.showProgress) {
@@ -2149,7 +2203,7 @@ async function download(options) {
2149
2203
  setProgress = collectiveBar.setProgress;
2150
2204
  }
2151
2205
  const promises = binariesToDownload.map((job) => {
2152
- const downloadUrl = (0, import_chunk_G7EM4XDM.getDownloadUrl)({
2206
+ const downloadUrl = (0, import_chunk_HACCWU3B.getDownloadUrl)({
2153
2207
  channel: "all_commits",
2154
2208
  version: opts.version,
2155
2209
  binaryTarget: job.binaryTarget,
@@ -2231,7 +2285,7 @@ async function binaryNeedsToBeDownloaded(job, nativePlatform, version) {
2231
2285
  });
2232
2286
  if (cachedFile) {
2233
2287
  if (job.skipCacheIntegrityCheck === true) {
2234
- await (0, import_chunk_G7EM4XDM.overwriteFile)(cachedFile, job.targetFilePath);
2288
+ await (0, import_chunk_HACCWU3B.overwriteFile)(cachedFile, job.targetFilePath);
2235
2289
  return false;
2236
2290
  }
2237
2291
  const sha256FilePath = cachedFile + ".sha256";
@@ -2242,12 +2296,12 @@ async function binaryNeedsToBeDownloaded(job, nativePlatform, version) {
2242
2296
  if (!targetExists) {
2243
2297
  debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2244
2298
  await import_fs.default.promises.utimes(cachedFile, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
2245
- await (0, import_chunk_G7EM4XDM.overwriteFile)(cachedFile, job.targetFilePath);
2299
+ await (0, import_chunk_HACCWU3B.overwriteFile)(cachedFile, job.targetFilePath);
2246
2300
  }
2247
2301
  const targetSha256 = await (0, import_chunk_CWGQAQ3T.getHash)(job.targetFilePath);
2248
2302
  if (sha256File !== targetSha256) {
2249
2303
  debug(`overwriting ${job.targetFilePath} with ${cachedFile} as hashes do not match`);
2250
- await (0, import_chunk_G7EM4XDM.overwriteFile)(cachedFile, job.targetFilePath);
2304
+ await (0, import_chunk_HACCWU3B.overwriteFile)(cachedFile, job.targetFilePath);
2251
2305
  }
2252
2306
  return false;
2253
2307
  } else {
@@ -2262,7 +2316,7 @@ async function binaryNeedsToBeDownloaded(job, nativePlatform, version) {
2262
2316
  }
2263
2317
  if (cachedFile) {
2264
2318
  debug(`copying ${cachedFile} to ${job.targetFilePath}`);
2265
- await (0, import_chunk_G7EM4XDM.overwriteFile)(cachedFile, job.targetFilePath);
2319
+ await (0, import_chunk_HACCWU3B.overwriteFile)(cachedFile, job.targetFilePath);
2266
2320
  return false;
2267
2321
  }
2268
2322
  return true;
@@ -2309,7 +2363,7 @@ async function getCachedBinaryPath({
2309
2363
  binaryTarget: binaryTarget2,
2310
2364
  binaryName
2311
2365
  }) {
2312
- const cacheDir = await (0, import_chunk_G7EM4XDM.getCacheDir)(channel, version, binaryTarget2);
2366
+ const cacheDir = await (0, import_chunk_HACCWU3B.getCacheDir)(channel, version, binaryTarget2);
2313
2367
  if (!cacheDir) {
2314
2368
  return null;
2315
2369
  }
@@ -2342,7 +2396,7 @@ async function downloadBinary(options2) {
2342
2396
  if (progressCb) {
2343
2397
  progressCb(0);
2344
2398
  }
2345
- const { sha256, zippedSha256 } = await (0, import_chunk_7NQURTUG.downloadZip)(downloadUrl, targetFilePath, progressCb);
2399
+ const { sha256, zippedSha256 } = await (0, import_chunk_ORVVLJ4G.downloadZip)(downloadUrl, targetFilePath, progressCb);
2346
2400
  if (progressCb) {
2347
2401
  progressCb(1);
2348
2402
  }
@@ -2350,7 +2404,7 @@ async function downloadBinary(options2) {
2350
2404
  await saveFileToCache(options2, version, sha256, zippedSha256);
2351
2405
  }
2352
2406
  async function saveFileToCache(job, version, sha256, zippedSha256) {
2353
- const cacheDir = await (0, import_chunk_G7EM4XDM.getCacheDir)(channel, version, job.binaryTarget);
2407
+ const cacheDir = await (0, import_chunk_HACCWU3B.getCacheDir)(channel, version, job.binaryTarget);
2354
2408
  if (!cacheDir) {
2355
2409
  return;
2356
2410
  }
@@ -2358,7 +2412,7 @@ async function saveFileToCache(job, version, sha256, zippedSha256) {
2358
2412
  const cachedSha256Path = import_path.default.join(cacheDir, job.binaryName + ".sha256");
2359
2413
  const cachedSha256ZippedPath = import_path.default.join(cacheDir, job.binaryName + ".gz.sha256");
2360
2414
  try {
2361
- await (0, import_chunk_G7EM4XDM.overwriteFile)(job.targetFilePath, cachedTargetPath);
2415
+ await (0, import_chunk_HACCWU3B.overwriteFile)(job.targetFilePath, cachedTargetPath);
2362
2416
  if (sha256 != null) {
2363
2417
  await import_fs.default.promises.writeFile(cachedSha256Path, sha256);
2364
2418
  }