@prisma-lossless/fetch-engine 7.8.0-lossless.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.
- package/LICENSE +201 -0
- package/README.md +8 -0
- package/dist/BinaryType.d.ts +3 -0
- package/dist/BinaryType.js +25 -0
- package/dist/chmodPlusX.d.ts +1 -0
- package/dist/chmodPlusX.js +25 -0
- package/dist/chunk-2ESYSVXG.js +67 -0
- package/dist/chunk-5564WBCW.js +161 -0
- package/dist/chunk-66KG5WKV.js +27 -0
- package/dist/chunk-7AOUSONO.js +190 -0
- package/dist/chunk-7JLQJWOR.js +44 -0
- package/dist/chunk-BSGQRGZQ.js +67 -0
- package/dist/chunk-FKGWOTGU.js +49 -0
- package/dist/chunk-IR7Q5RSO.js +2574 -0
- package/dist/chunk-LXSSCRSH.js +1667 -0
- package/dist/chunk-M4U32QVT.js +151 -0
- package/dist/chunk-VLGS4WJI.js +4230 -0
- package/dist/chunk-XRHAN4W7.js +2340 -0
- package/dist/chunk-Y54H3FH6.js +11922 -0
- package/dist/cleanupCache.d.ts +1 -0
- package/dist/cleanupCache.js +27 -0
- package/dist/download.d.ts +27 -0
- package/dist/download.js +41 -0
- package/dist/downloadZip.d.ts +6 -0
- package/dist/downloadZip.js +29 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +29 -0
- package/dist/getHash.d.ts +1 -0
- package/dist/getHash.js +25 -0
- package/dist/getProxyAgent.d.ts +3 -0
- package/dist/getProxyAgent.js +25 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +49 -0
- package/dist/log.d.ts +2 -0
- package/dist/log.js +25 -0
- package/dist/multipart-parser-3E7JBBYS.js +374 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +28 -0
- package/package.json +53 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_7AOUSONO_exports = {};
|
|
20
|
+
__export(chunk_7AOUSONO_exports, {
|
|
21
|
+
require_p_map: () => require_p_map
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunk_7AOUSONO_exports);
|
|
24
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
25
|
+
var require_indent_string = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
26
|
+
"../../node_modules/.pnpm/indent-string@4.0.0/node_modules/indent-string/index.js"(exports, module2) {
|
|
27
|
+
"use strict";
|
|
28
|
+
module2.exports = (string, count = 1, options) => {
|
|
29
|
+
options = {
|
|
30
|
+
indent: " ",
|
|
31
|
+
includeEmptyLines: false,
|
|
32
|
+
...options
|
|
33
|
+
};
|
|
34
|
+
if (typeof string !== "string") {
|
|
35
|
+
throw new TypeError(
|
|
36
|
+
`Expected \`input\` to be a \`string\`, got \`${typeof string}\``
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (typeof count !== "number") {
|
|
40
|
+
throw new TypeError(
|
|
41
|
+
`Expected \`count\` to be a \`number\`, got \`${typeof count}\``
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (typeof options.indent !== "string") {
|
|
45
|
+
throw new TypeError(
|
|
46
|
+
`Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\``
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (count === 0) {
|
|
50
|
+
return string;
|
|
51
|
+
}
|
|
52
|
+
const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
|
53
|
+
return string.replace(regex, options.indent.repeat(count));
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var require_clean_stack = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
58
|
+
"../../node_modules/.pnpm/clean-stack@2.2.0/node_modules/clean-stack/index.js"(exports, module2) {
|
|
59
|
+
"use strict";
|
|
60
|
+
var os = (0, import_chunk_2ESYSVXG.__require)("os");
|
|
61
|
+
var extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/;
|
|
62
|
+
var pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
|
|
63
|
+
var homeDir = typeof os.homedir === "undefined" ? "" : os.homedir();
|
|
64
|
+
module2.exports = (stack, options) => {
|
|
65
|
+
options = Object.assign({ pretty: false }, options);
|
|
66
|
+
return stack.replace(/\\/g, "/").split("\n").filter((line) => {
|
|
67
|
+
const pathMatches = line.match(extractPathRegex);
|
|
68
|
+
if (pathMatches === null || !pathMatches[1]) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
const match = pathMatches[1];
|
|
72
|
+
if (match.includes(".app/Contents/Resources/electron.asar") || match.includes(".app/Contents/Resources/default_app.asar")) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return !pathRegex.test(match);
|
|
76
|
+
}).filter((line) => line.trim() !== "").map((line) => {
|
|
77
|
+
if (options.pretty) {
|
|
78
|
+
return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")));
|
|
79
|
+
}
|
|
80
|
+
return line;
|
|
81
|
+
}).join("\n");
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var require_aggregate_error = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
86
|
+
"../../node_modules/.pnpm/aggregate-error@3.1.0/node_modules/aggregate-error/index.js"(exports, module2) {
|
|
87
|
+
"use strict";
|
|
88
|
+
var indentString = require_indent_string();
|
|
89
|
+
var cleanStack = require_clean_stack();
|
|
90
|
+
var cleanInternalStack = (stack) => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
|
|
91
|
+
var AggregateError = class extends Error {
|
|
92
|
+
constructor(errors) {
|
|
93
|
+
if (!Array.isArray(errors)) {
|
|
94
|
+
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
|
95
|
+
}
|
|
96
|
+
errors = [...errors].map((error) => {
|
|
97
|
+
if (error instanceof Error) {
|
|
98
|
+
return error;
|
|
99
|
+
}
|
|
100
|
+
if (error !== null && typeof error === "object") {
|
|
101
|
+
return Object.assign(new Error(error.message), error);
|
|
102
|
+
}
|
|
103
|
+
return new Error(error);
|
|
104
|
+
});
|
|
105
|
+
let message = errors.map((error) => {
|
|
106
|
+
return typeof error.stack === "string" ? cleanInternalStack(cleanStack(error.stack)) : String(error);
|
|
107
|
+
}).join("\n");
|
|
108
|
+
message = "\n" + indentString(message, 4);
|
|
109
|
+
super(message);
|
|
110
|
+
this.name = "AggregateError";
|
|
111
|
+
Object.defineProperty(this, "_errors", { value: errors });
|
|
112
|
+
}
|
|
113
|
+
*[Symbol.iterator]() {
|
|
114
|
+
for (const error of this._errors) {
|
|
115
|
+
yield error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
module2.exports = AggregateError;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var require_p_map = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
123
|
+
"../../node_modules/.pnpm/p-map@4.0.0/node_modules/p-map/index.js"(exports, module2) {
|
|
124
|
+
"use strict";
|
|
125
|
+
var AggregateError = require_aggregate_error();
|
|
126
|
+
module2.exports = async (iterable, mapper, {
|
|
127
|
+
concurrency = Infinity,
|
|
128
|
+
stopOnError = true
|
|
129
|
+
} = {}) => {
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
if (typeof mapper !== "function") {
|
|
132
|
+
throw new TypeError("Mapper function is required");
|
|
133
|
+
}
|
|
134
|
+
if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) {
|
|
135
|
+
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
|
136
|
+
}
|
|
137
|
+
const result = [];
|
|
138
|
+
const errors = [];
|
|
139
|
+
const iterator = iterable[Symbol.iterator]();
|
|
140
|
+
let isRejected = false;
|
|
141
|
+
let isIterableDone = false;
|
|
142
|
+
let resolvingCount = 0;
|
|
143
|
+
let currentIndex = 0;
|
|
144
|
+
const next = () => {
|
|
145
|
+
if (isRejected) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const nextItem = iterator.next();
|
|
149
|
+
const index = currentIndex;
|
|
150
|
+
currentIndex++;
|
|
151
|
+
if (nextItem.done) {
|
|
152
|
+
isIterableDone = true;
|
|
153
|
+
if (resolvingCount === 0) {
|
|
154
|
+
if (!stopOnError && errors.length !== 0) {
|
|
155
|
+
reject(new AggregateError(errors));
|
|
156
|
+
} else {
|
|
157
|
+
resolve(result);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
resolvingCount++;
|
|
163
|
+
(async () => {
|
|
164
|
+
try {
|
|
165
|
+
const element = await nextItem.value;
|
|
166
|
+
result[index] = await mapper(element, index);
|
|
167
|
+
resolvingCount--;
|
|
168
|
+
next();
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (stopOnError) {
|
|
171
|
+
isRejected = true;
|
|
172
|
+
reject(error);
|
|
173
|
+
} else {
|
|
174
|
+
errors.push(error);
|
|
175
|
+
resolvingCount--;
|
|
176
|
+
next();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
};
|
|
181
|
+
for (let i = 0; i < concurrency; i++) {
|
|
182
|
+
next();
|
|
183
|
+
if (isIterableDone) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_7JLQJWOR_exports = {};
|
|
30
|
+
__export(chunk_7JLQJWOR_exports, {
|
|
31
|
+
chmodPlusX: () => chmodPlusX
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_7JLQJWOR_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
35
|
+
function chmodPlusX(file) {
|
|
36
|
+
if (process.platform === "win32") return;
|
|
37
|
+
const s = import_node_fs.default.statSync(file);
|
|
38
|
+
const newMode = s.mode | 64 | 8 | 1;
|
|
39
|
+
if (s.mode === newMode) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const base8 = newMode.toString(8).slice(-3);
|
|
43
|
+
import_node_fs.default.chmodSync(file, base8);
|
|
44
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_BSGQRGZQ_exports = {};
|
|
30
|
+
__export(chunk_BSGQRGZQ_exports, {
|
|
31
|
+
cleanupCache: () => cleanupCache
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_BSGQRGZQ_exports);
|
|
34
|
+
var import_chunk_7AOUSONO = require("./chunk-7AOUSONO.js");
|
|
35
|
+
var import_chunk_XRHAN4W7 = require("./chunk-XRHAN4W7.js");
|
|
36
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
37
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
38
|
+
var import_node_path = __toESM(require("node:path"));
|
|
39
|
+
var import_debug = __toESM(require("@prisma-lossless/debug"));
|
|
40
|
+
var import_p_map = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_7AOUSONO.require_p_map)());
|
|
41
|
+
var debug = (0, import_debug.default)("cleanupCache");
|
|
42
|
+
async function cleanupCache(n = 5) {
|
|
43
|
+
try {
|
|
44
|
+
const rootCacheDir = await (0, import_chunk_XRHAN4W7.getRootCacheDir)();
|
|
45
|
+
if (!rootCacheDir) {
|
|
46
|
+
debug("no rootCacheDir found");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const channel = "master";
|
|
50
|
+
const cacheDir = import_node_path.default.join(rootCacheDir, channel);
|
|
51
|
+
const dirs = await import_node_fs.default.promises.readdir(cacheDir);
|
|
52
|
+
const dirsWithMeta = await Promise.all(
|
|
53
|
+
dirs.map(async (dirName) => {
|
|
54
|
+
const dir = import_node_path.default.join(cacheDir, dirName);
|
|
55
|
+
const statResult = await import_node_fs.default.promises.stat(dir);
|
|
56
|
+
return {
|
|
57
|
+
dir,
|
|
58
|
+
created: statResult.birthtime
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
dirsWithMeta.sort((a, b) => a.created < b.created ? 1 : -1);
|
|
63
|
+
const dirsToRemove = dirsWithMeta.slice(n);
|
|
64
|
+
await (0, import_p_map.default)(dirsToRemove, (dir) => import_node_fs.default.promises.rm(dir.dir, { force: true, recursive: true }), { concurrency: 20 });
|
|
65
|
+
} catch (e) {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_FKGWOTGU_exports = {};
|
|
30
|
+
__export(chunk_FKGWOTGU_exports, {
|
|
31
|
+
getHash: () => getHash
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_FKGWOTGU_exports);
|
|
34
|
+
var import_node_crypto = __toESM(require("node:crypto"));
|
|
35
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
36
|
+
function getHash(filePath) {
|
|
37
|
+
const hash = import_node_crypto.default.createHash("sha256");
|
|
38
|
+
const input = import_node_fs.default.createReadStream(filePath);
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
input.on("readable", () => {
|
|
41
|
+
const data = input.read();
|
|
42
|
+
if (data) {
|
|
43
|
+
hash.update(data);
|
|
44
|
+
} else {
|
|
45
|
+
resolve(hash.digest("hex"));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|