hunter-mate 0.1.18 → 0.1.19
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/dist/assets/extension/background/{service-worker.20261002143654.js → service-worker.20261008011501.js} +868 -142
- package/dist/assets/extension/background/service-worker.js +868 -142
- package/dist/assets/extension/build-info.json +1 -1
- package/dist/assets/extension/content/control-runtime.js +1028 -0
- package/dist/assets/extension/content/index.js +35 -0
- package/dist/assets/extension/manifest.json +4 -3
- package/dist/assets/extension/offscreen/offscreen.html +1 -1
- package/dist/assets/extension/offscreen/offscreen.js +2 -2
- package/dist/assets/extension/package.json +1 -1
- package/dist/assets/extension/sidepanel/index.css +1 -1
- package/dist/assets/extension/sidepanel/index.html +1 -1
- package/dist/assets/extension/sidepanel/index.js +23 -14
- package/dist/assets/server/main.mjs +10015 -4786
- package/dist/index.js +849 -318
- package/dist/web/dist/404.html +1 -1
- package/dist/web/dist/_next/static/{N_4Eb07x7RNgd3O5ubXrJ → 9Wm8FfXwBJyMk-wYf4l81}/_ssgManifest.js +1 -1
- package/dist/web/dist/_next/static/chunks/542-4a43545450151f1d.js +1 -0
- package/dist/web/dist/_next/static/chunks/670-750aa43678fb0d30.js +1 -0
- package/dist/web/dist/_next/static/chunks/852-5150a7ae95a599fb.js +1 -0
- package/dist/web/dist/_next/static/chunks/{935-bb4adb3868af4cd4.js → 935-4058f12c3d405b32.js} +4 -4
- package/dist/web/dist/_next/static/chunks/app/admin/data/page-a566c6b13c61f9d4.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/companies/page-058047767bc162f4.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/company/admin/page-a2088b59c3820800.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/jobs/page-4fb6a67d044b238d.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/layout-1feb99bf08beb3c8.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/matching/jobs/[id]/talents/page-c6714cec1ffd7c5e.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/matching/portraits/[id]/jobs/page-658eca1ae5ca29dc.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/page-291cd145a56bd020.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/parselog/page-b1b7ae9483273ce0.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/recordings/page-c12948f01885099e.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/resource-usage/{page-3b8bd27536a7889a.js → page-8394e96892688180.js} +1 -1
- package/dist/web/dist/_next/static/chunks/app/shared/[token]/page-e859e87f2301b120.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/snapshots/[id]/agent-prompt/page-f519552be54e3bdf.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/talents/page-75af05473ea322d9.js +1 -0
- package/dist/web/dist/_next/static/chunks/app/team/insights/page-7b8769e35cd9987b.js +1 -0
- package/dist/web/dist/_next/static/chunks/{main-ead3ac50aa4bc931.js → main-8d45182e1c21cb95.js} +1 -1
- package/dist/web/dist/_next/static/chunks/{main-app-7e48cd6f6a954fec.js → main-app-70da092dee991648.js} +1 -1
- package/dist/web/dist/_next/static/chunks/pages/{_app-97da3522926feed4.js → _app-8438560f1c1a7980.js} +3 -3
- package/dist/web/dist/_next/static/css/9eaf0c9cc1c24641.css +3 -0
- package/dist/web/dist/admin/data.html +1 -1
- package/dist/web/dist/admin/data.txt +3 -3
- package/dist/web/dist/auth/verify.html +1 -1
- package/dist/web/dist/auth/verify.txt +2 -2
- package/dist/web/dist/companies.html +1 -1
- package/dist/web/dist/companies.txt +7 -6
- package/dist/web/dist/company/admin.html +1 -1
- package/dist/web/dist/company/admin.txt +3 -3
- package/dist/web/dist/entity.html +1 -1
- package/dist/web/dist/entity.txt +2 -2
- package/dist/web/dist/index.html +1 -1
- package/dist/web/dist/index.txt +3 -3
- package/dist/web/dist/jobs.html +1 -1
- package/dist/web/dist/jobs.txt +3 -3
- package/dist/web/dist/logs.html +1 -1
- package/dist/web/dist/logs.txt +2 -2
- package/dist/web/dist/matching/jobs/placeholder/talents.html +1 -1
- package/dist/web/dist/matching/jobs/placeholder/talents.txt +3 -3
- package/dist/web/dist/matching/portraits/placeholder/jobs.html +1 -1
- package/dist/web/dist/matching/portraits/placeholder/jobs.txt +3 -3
- package/dist/web/dist/parselog.html +1 -1
- package/dist/web/dist/parselog.txt +3 -3
- package/dist/web/dist/recordings.html +1 -1
- package/dist/web/dist/recordings.txt +3 -3
- package/dist/web/dist/resource-usage.html +1 -1
- package/dist/web/dist/resource-usage.txt +3 -3
- package/dist/web/dist/shared/placeholder.html +1 -0
- package/dist/web/dist/shared/placeholder.txt +8 -0
- package/dist/web/dist/snapshots/placeholder/agent-prompt.html +1 -1
- package/dist/web/dist/snapshots/placeholder/agent-prompt.txt +3 -3
- package/dist/web/dist/talents.html +1 -1
- package/dist/web/dist/talents.txt +3 -3
- package/dist/web/dist/team/insights.html +1 -0
- package/dist/web/dist/team/insights.txt +7 -0
- package/package.json +1 -1
- package/dist/web/dist/_next/static/chunks/170-b66b6f731381943e.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/admin/data/page-37e01dad70306bf3.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/companies/page-985002eea5b295d0.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/company/admin/page-8c7ecc92bef09e92.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/jobs/page-e39b3e25f0a81254.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/layout-d094dc654772bf32.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/matching/jobs/[id]/talents/page-936f6190c968d20b.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/matching/portraits/[id]/jobs/page-ea44a2236bd53cae.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/page-41d8e008a9411221.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/parselog/page-3f756bbd580f337e.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/recordings/page-ffd507b12e67f2db.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/snapshots/[id]/agent-prompt/page-c89b32aa2ef509f5.js +0 -1
- package/dist/web/dist/_next/static/chunks/app/talents/page-8e0b4072df138fa3.js +0 -1
- package/dist/web/dist/_next/static/css/1dd88e02ef1af7b9.css +0 -3
- /package/dist/web/dist/_next/static/{N_4Eb07x7RNgd3O5ubXrJ → 9Wm8FfXwBJyMk-wYf4l81}/_buildManifest.js +0 -0
package/dist/index.js
CHANGED
|
@@ -48,8 +48,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
48
48
|
// ../../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js
|
|
49
49
|
var require_main = __commonJS({
|
|
50
50
|
"../../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js"(exports, module2) {
|
|
51
|
-
var
|
|
52
|
-
var
|
|
51
|
+
var fs29 = __require("fs");
|
|
52
|
+
var path31 = __require("path");
|
|
53
53
|
var os6 = __require("os");
|
|
54
54
|
var crypto4 = __require("crypto");
|
|
55
55
|
var TIPS = [
|
|
@@ -180,7 +180,7 @@ var require_main = __commonJS({
|
|
|
180
180
|
if (options && options.path && options.path.length > 0) {
|
|
181
181
|
if (Array.isArray(options.path)) {
|
|
182
182
|
for (const filepath of options.path) {
|
|
183
|
-
if (
|
|
183
|
+
if (fs29.existsSync(filepath)) {
|
|
184
184
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -188,15 +188,15 @@ var require_main = __commonJS({
|
|
|
188
188
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
189
189
|
}
|
|
190
190
|
} else {
|
|
191
|
-
possibleVaultPath =
|
|
191
|
+
possibleVaultPath = path31.resolve(process.cwd(), ".env.vault");
|
|
192
192
|
}
|
|
193
|
-
if (
|
|
193
|
+
if (fs29.existsSync(possibleVaultPath)) {
|
|
194
194
|
return possibleVaultPath;
|
|
195
195
|
}
|
|
196
196
|
return null;
|
|
197
197
|
}
|
|
198
198
|
function _resolveHome(envPath) {
|
|
199
|
-
return envPath[0] === "~" ?
|
|
199
|
+
return envPath[0] === "~" ? path31.join(os6.homedir(), envPath.slice(1)) : envPath;
|
|
200
200
|
}
|
|
201
201
|
function _configVault(options) {
|
|
202
202
|
const debug2 = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -213,7 +213,7 @@ var require_main = __commonJS({
|
|
|
213
213
|
return { parsed };
|
|
214
214
|
}
|
|
215
215
|
function configDotenv(options) {
|
|
216
|
-
const dotenvPath =
|
|
216
|
+
const dotenvPath = path31.resolve(process.cwd(), ".env");
|
|
217
217
|
let encoding = "utf8";
|
|
218
218
|
let processEnv = process.env;
|
|
219
219
|
if (options && options.processEnv != null) {
|
|
@@ -241,13 +241,13 @@ var require_main = __commonJS({
|
|
|
241
241
|
}
|
|
242
242
|
let lastError;
|
|
243
243
|
const parsedAll = {};
|
|
244
|
-
for (const
|
|
244
|
+
for (const path32 of optionPaths) {
|
|
245
245
|
try {
|
|
246
|
-
const parsed = DotenvModule.parse(
|
|
246
|
+
const parsed = DotenvModule.parse(fs29.readFileSync(path32, { encoding }));
|
|
247
247
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
248
248
|
} catch (e) {
|
|
249
249
|
if (debug2) {
|
|
250
|
-
_debug(`failed to load ${
|
|
250
|
+
_debug(`failed to load ${path32} ${e.message}`);
|
|
251
251
|
}
|
|
252
252
|
lastError = e;
|
|
253
253
|
}
|
|
@@ -260,7 +260,7 @@ var require_main = __commonJS({
|
|
|
260
260
|
const shortPaths = [];
|
|
261
261
|
for (const filePath of optionPaths) {
|
|
262
262
|
try {
|
|
263
|
-
const relative2 =
|
|
263
|
+
const relative2 = path31.relative(process.cwd(), filePath);
|
|
264
264
|
shortPaths.push(relative2);
|
|
265
265
|
} catch (e) {
|
|
266
266
|
if (debug2) {
|
|
@@ -1343,8 +1343,8 @@ var require_command = __commonJS({
|
|
|
1343
1343
|
"../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
|
|
1344
1344
|
var EventEmitter4 = __require("node:events").EventEmitter;
|
|
1345
1345
|
var childProcess = __require("node:child_process");
|
|
1346
|
-
var
|
|
1347
|
-
var
|
|
1346
|
+
var path31 = __require("node:path");
|
|
1347
|
+
var fs29 = __require("node:fs");
|
|
1348
1348
|
var process2 = __require("node:process");
|
|
1349
1349
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1350
1350
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2276,11 +2276,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2276
2276
|
let launchWithNode = false;
|
|
2277
2277
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2278
2278
|
function findFile(baseDir, baseName) {
|
|
2279
|
-
const localBin =
|
|
2280
|
-
if (
|
|
2281
|
-
if (sourceExt.includes(
|
|
2279
|
+
const localBin = path31.resolve(baseDir, baseName);
|
|
2280
|
+
if (fs29.existsSync(localBin)) return localBin;
|
|
2281
|
+
if (sourceExt.includes(path31.extname(baseName))) return void 0;
|
|
2282
2282
|
const foundExt = sourceExt.find(
|
|
2283
|
-
(ext) =>
|
|
2283
|
+
(ext) => fs29.existsSync(`${localBin}${ext}`)
|
|
2284
2284
|
);
|
|
2285
2285
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2286
2286
|
return void 0;
|
|
@@ -2292,21 +2292,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2292
2292
|
if (this._scriptPath) {
|
|
2293
2293
|
let resolvedScriptPath;
|
|
2294
2294
|
try {
|
|
2295
|
-
resolvedScriptPath =
|
|
2295
|
+
resolvedScriptPath = fs29.realpathSync(this._scriptPath);
|
|
2296
2296
|
} catch (err) {
|
|
2297
2297
|
resolvedScriptPath = this._scriptPath;
|
|
2298
2298
|
}
|
|
2299
|
-
executableDir =
|
|
2300
|
-
|
|
2299
|
+
executableDir = path31.resolve(
|
|
2300
|
+
path31.dirname(resolvedScriptPath),
|
|
2301
2301
|
executableDir
|
|
2302
2302
|
);
|
|
2303
2303
|
}
|
|
2304
2304
|
if (executableDir) {
|
|
2305
2305
|
let localFile = findFile(executableDir, executableFile);
|
|
2306
2306
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2307
|
-
const legacyName =
|
|
2307
|
+
const legacyName = path31.basename(
|
|
2308
2308
|
this._scriptPath,
|
|
2309
|
-
|
|
2309
|
+
path31.extname(this._scriptPath)
|
|
2310
2310
|
);
|
|
2311
2311
|
if (legacyName !== this._name) {
|
|
2312
2312
|
localFile = findFile(
|
|
@@ -2317,7 +2317,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2317
2317
|
}
|
|
2318
2318
|
executableFile = localFile || executableFile;
|
|
2319
2319
|
}
|
|
2320
|
-
launchWithNode = sourceExt.includes(
|
|
2320
|
+
launchWithNode = sourceExt.includes(path31.extname(executableFile));
|
|
2321
2321
|
let proc;
|
|
2322
2322
|
if (process2.platform !== "win32") {
|
|
2323
2323
|
if (launchWithNode) {
|
|
@@ -3157,7 +3157,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3157
3157
|
* @return {Command}
|
|
3158
3158
|
*/
|
|
3159
3159
|
nameFromFilename(filename) {
|
|
3160
|
-
this._name =
|
|
3160
|
+
this._name = path31.basename(filename, path31.extname(filename));
|
|
3161
3161
|
return this;
|
|
3162
3162
|
}
|
|
3163
3163
|
/**
|
|
@@ -3171,9 +3171,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3171
3171
|
* @param {string} [path]
|
|
3172
3172
|
* @return {(string|null|Command)}
|
|
3173
3173
|
*/
|
|
3174
|
-
executableDir(
|
|
3175
|
-
if (
|
|
3176
|
-
this._executableDir =
|
|
3174
|
+
executableDir(path32) {
|
|
3175
|
+
if (path32 === void 0) return this._executableDir;
|
|
3176
|
+
this._executableDir = path32;
|
|
3177
3177
|
return this;
|
|
3178
3178
|
}
|
|
3179
3179
|
/**
|
|
@@ -4297,15 +4297,15 @@ var require_route = __commonJS({
|
|
|
4297
4297
|
};
|
|
4298
4298
|
}
|
|
4299
4299
|
function wrapConversion(toModel, graph) {
|
|
4300
|
-
const
|
|
4300
|
+
const path31 = [graph[toModel].parent, toModel];
|
|
4301
4301
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
4302
4302
|
let cur = graph[toModel].parent;
|
|
4303
4303
|
while (graph[cur].parent) {
|
|
4304
|
-
|
|
4304
|
+
path31.unshift(graph[cur].parent);
|
|
4305
4305
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
4306
4306
|
cur = graph[cur].parent;
|
|
4307
4307
|
}
|
|
4308
|
-
fn.conversion =
|
|
4308
|
+
fn.conversion = path31;
|
|
4309
4309
|
return fn;
|
|
4310
4310
|
}
|
|
4311
4311
|
module2.exports = function(fromModel) {
|
|
@@ -5039,18 +5039,18 @@ function createCliUpdater(opts) {
|
|
|
5039
5039
|
const v = Number(process.env[envName("UPDATE_CHECK_INTERVAL_MS")]);
|
|
5040
5040
|
return Number.isFinite(v) && v > 0 ? v : DEFAULT_INTERVAL_MS;
|
|
5041
5041
|
}
|
|
5042
|
-
function shouldCheckUpdate2(
|
|
5042
|
+
function shouldCheckUpdate2(stateFile2 = lastUpdateCheckPath(), now = Date.now(), intervalMs2 = updateCheckIntervalMs2()) {
|
|
5043
5043
|
try {
|
|
5044
|
-
const stat = fs.statSync(
|
|
5045
|
-
return now - stat.mtimeMs >
|
|
5044
|
+
const stat = fs.statSync(stateFile2);
|
|
5045
|
+
return now - stat.mtimeMs > intervalMs2;
|
|
5046
5046
|
} catch {
|
|
5047
5047
|
return true;
|
|
5048
5048
|
}
|
|
5049
5049
|
}
|
|
5050
|
-
function markUpdateChecked2(
|
|
5050
|
+
function markUpdateChecked2(stateFile2 = lastUpdateCheckPath()) {
|
|
5051
5051
|
try {
|
|
5052
|
-
fs.mkdirSync(path.dirname(
|
|
5053
|
-
fs.writeFileSync(
|
|
5052
|
+
fs.mkdirSync(path.dirname(stateFile2), { recursive: true });
|
|
5053
|
+
fs.writeFileSync(stateFile2, String(Date.now()));
|
|
5054
5054
|
} catch {
|
|
5055
5055
|
}
|
|
5056
5056
|
}
|
|
@@ -5395,8 +5395,8 @@ function getFunctionName(fn) {
|
|
|
5395
5395
|
return defaultFunctionName;
|
|
5396
5396
|
}
|
|
5397
5397
|
}
|
|
5398
|
-
function normalizeStackTracePath(
|
|
5399
|
-
let filename =
|
|
5398
|
+
function normalizeStackTracePath(path31) {
|
|
5399
|
+
let filename = path31?.startsWith("file://") ? path31.slice(7) : path31;
|
|
5400
5400
|
if (filename?.match(/\/[A-Z]:/)) {
|
|
5401
5401
|
filename = filename.slice(1);
|
|
5402
5402
|
}
|
|
@@ -7375,8 +7375,8 @@ function isValidProtocol(protocol) {
|
|
|
7375
7375
|
return protocol === "http" || protocol === "https";
|
|
7376
7376
|
}
|
|
7377
7377
|
function dsnToString(dsn, withPassword = false) {
|
|
7378
|
-
const { host, path:
|
|
7379
|
-
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${
|
|
7378
|
+
const { host, path: path31, pass, port, projectId, protocol, publicKey } = dsn;
|
|
7379
|
+
return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path31 ? `${path31}/` : path31}${projectId}`;
|
|
7380
7380
|
}
|
|
7381
7381
|
function dsnFromString(str) {
|
|
7382
7382
|
const match = DSN_REGEX.exec(str);
|
|
@@ -7387,11 +7387,11 @@ function dsnFromString(str) {
|
|
|
7387
7387
|
return void 0;
|
|
7388
7388
|
}
|
|
7389
7389
|
const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match.slice(1);
|
|
7390
|
-
let
|
|
7390
|
+
let path31 = "";
|
|
7391
7391
|
let projectId = lastPath;
|
|
7392
7392
|
const split = projectId.split("/");
|
|
7393
7393
|
if (split.length > 1) {
|
|
7394
|
-
|
|
7394
|
+
path31 = split.slice(0, -1).join("/");
|
|
7395
7395
|
projectId = split.pop();
|
|
7396
7396
|
}
|
|
7397
7397
|
if (projectId) {
|
|
@@ -7400,7 +7400,7 @@ function dsnFromString(str) {
|
|
|
7400
7400
|
projectId = projectMatch[0];
|
|
7401
7401
|
}
|
|
7402
7402
|
}
|
|
7403
|
-
return dsnFromComponents({ host, pass, path:
|
|
7403
|
+
return dsnFromComponents({ host, pass, path: path31, projectId, port, protocol, publicKey });
|
|
7404
7404
|
}
|
|
7405
7405
|
function dsnFromComponents(components) {
|
|
7406
7406
|
return {
|
|
@@ -12401,9 +12401,9 @@ function stripUrlQueryAndFragment(urlPath) {
|
|
|
12401
12401
|
return urlPath.split(/[?#]/, 1)[0];
|
|
12402
12402
|
}
|
|
12403
12403
|
function getSanitizedUrlString(url2) {
|
|
12404
|
-
const { protocol, host, path:
|
|
12404
|
+
const { protocol, host, path: path31 } = url2;
|
|
12405
12405
|
const filteredHost = host?.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || "";
|
|
12406
|
-
return `${protocol ? `${protocol}://` : ""}${filteredHost}${
|
|
12406
|
+
return `${protocol ? `${protocol}://` : ""}${filteredHost}${path31}`;
|
|
12407
12407
|
}
|
|
12408
12408
|
function stripDataUrlContent(url2, includeDataPrefix = true) {
|
|
12409
12409
|
if (url2.startsWith("data:")) {
|
|
@@ -13475,8 +13475,8 @@ function splitPath(filename) {
|
|
|
13475
13475
|
const parts = splitPathRe.exec(truncated);
|
|
13476
13476
|
return parts ? parts.slice(1) : [];
|
|
13477
13477
|
}
|
|
13478
|
-
function dirname(
|
|
13479
|
-
const result = splitPath(
|
|
13478
|
+
function dirname(path31) {
|
|
13479
|
+
const result = splitPath(path31);
|
|
13480
13480
|
const root = result[0] || "";
|
|
13481
13481
|
let dir = result[1];
|
|
13482
13482
|
if (!root && !dir) {
|
|
@@ -17730,7 +17730,7 @@ function getActualMatchedRoute(req, constructedRoute) {
|
|
|
17730
17730
|
if (layersStore.length === 0) {
|
|
17731
17731
|
return void 0;
|
|
17732
17732
|
}
|
|
17733
|
-
if (layersStore.every((
|
|
17733
|
+
if (layersStore.every((path31) => path31 === "/")) {
|
|
17734
17734
|
return req.originalUrl === "/" ? "/" : void 0;
|
|
17735
17735
|
}
|
|
17736
17736
|
if (constructedRoute === "*") {
|
|
@@ -17746,11 +17746,11 @@ function getActualMatchedRoute(req, constructedRoute) {
|
|
|
17746
17746
|
function getConstructedRoute(req) {
|
|
17747
17747
|
const layersStore = getStoredLayers(req);
|
|
17748
17748
|
let constructedRoute = "";
|
|
17749
|
-
for (const
|
|
17750
|
-
if (
|
|
17749
|
+
for (const path31 of layersStore) {
|
|
17750
|
+
if (path31 === "/" || path31 === "/*") {
|
|
17751
17751
|
continue;
|
|
17752
17752
|
}
|
|
17753
|
-
constructedRoute += !constructedRoute || constructedRoute.endsWith("/") ?
|
|
17753
|
+
constructedRoute += !constructedRoute || constructedRoute.endsWith("/") ? path31 : `/${path31}`;
|
|
17754
17754
|
}
|
|
17755
17755
|
return constructedRoute.replace(/\/{2,}/g, "/");
|
|
17756
17756
|
}
|
|
@@ -17790,15 +17790,15 @@ var init_utils9 = __esm({
|
|
|
17790
17790
|
};
|
|
17791
17791
|
}
|
|
17792
17792
|
};
|
|
17793
|
-
getRouterPath = (
|
|
17793
|
+
getRouterPath = (path31, layer) => {
|
|
17794
17794
|
const stackLayer = Array.isArray(layer.handle?.stack) ? layer.handle?.stack?.[0] : void 0;
|
|
17795
17795
|
if (stackLayer?.route?.path) {
|
|
17796
|
-
return `${
|
|
17796
|
+
return `${path31}${stackLayer.route.path}`;
|
|
17797
17797
|
}
|
|
17798
17798
|
if (stackLayer && Array.isArray(stackLayer?.handle?.stack)) {
|
|
17799
|
-
return getRouterPath(
|
|
17799
|
+
return getRouterPath(path31, stackLayer);
|
|
17800
17800
|
}
|
|
17801
|
-
return
|
|
17801
|
+
return path31;
|
|
17802
17802
|
};
|
|
17803
17803
|
isLayerIgnored = (name, type, config) => {
|
|
17804
17804
|
if (Array.isArray(config?.ignoreLayersType) && config?.ignoreLayersType?.includes(type)) {
|
|
@@ -18370,9 +18370,9 @@ function getRequestUrlObject(requestOptions) {
|
|
|
18370
18370
|
const hostHeader = requestOptions.headers?.host && String(requestOptions.headers?.host);
|
|
18371
18371
|
const hostname2 = hostHeader || requestOptions.hostname || requestOptions.host || "";
|
|
18372
18372
|
const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname2) ? "" : `:${requestOptions.port}`;
|
|
18373
|
-
const
|
|
18373
|
+
const path31 = requestOptions.path ? requestOptions.path : "/";
|
|
18374
18374
|
const base = `${protocol}//${hostname2}${port}`;
|
|
18375
|
-
return new URL(
|
|
18375
|
+
return new URL(path31.startsWith("//") ? `${base}${path31}` : path31, base);
|
|
18376
18376
|
}
|
|
18377
18377
|
function getRequestUrlFromClientRequest(request2) {
|
|
18378
18378
|
return String(getRequestUrl(getRequestOptions(request2)));
|
|
@@ -19122,11 +19122,11 @@ function shouldIgnoreSpansForIncomingRequest(request2, {
|
|
|
19122
19122
|
return false;
|
|
19123
19123
|
}
|
|
19124
19124
|
function isStaticAssetRequest(urlPath) {
|
|
19125
|
-
const
|
|
19126
|
-
if (
|
|
19125
|
+
const path31 = stripUrlQueryAndFragment(urlPath);
|
|
19126
|
+
if (path31.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
19127
19127
|
return true;
|
|
19128
19128
|
}
|
|
19129
|
-
if (
|
|
19129
|
+
if (path31.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
19130
19130
|
return true;
|
|
19131
19131
|
}
|
|
19132
19132
|
return false;
|
|
@@ -24581,11 +24581,11 @@ function isKnownPrefetchRequest2(req) {
|
|
|
24581
24581
|
return req.headers["next-router-prefetch"] === "1";
|
|
24582
24582
|
}
|
|
24583
24583
|
function isStaticAssetRequest2(urlPath) {
|
|
24584
|
-
const
|
|
24585
|
-
if (
|
|
24584
|
+
const path31 = stripUrlQueryAndFragment(urlPath);
|
|
24585
|
+
if (path31.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
24586
24586
|
return true;
|
|
24587
24587
|
}
|
|
24588
|
-
if (
|
|
24588
|
+
if (path31.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
24589
24589
|
return true;
|
|
24590
24590
|
}
|
|
24591
24591
|
return false;
|
|
@@ -26418,19 +26418,19 @@ var require_module_details_from_path = __commonJS({
|
|
|
26418
26418
|
basedir += segments[i] + sep4;
|
|
26419
26419
|
}
|
|
26420
26420
|
}
|
|
26421
|
-
var
|
|
26421
|
+
var path31 = "";
|
|
26422
26422
|
var lastSegmentIndex = segments.length - 1;
|
|
26423
26423
|
for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) {
|
|
26424
26424
|
if (i2 === lastSegmentIndex) {
|
|
26425
|
-
|
|
26425
|
+
path31 += segments[i2];
|
|
26426
26426
|
} else {
|
|
26427
|
-
|
|
26427
|
+
path31 += segments[i2] + sep4;
|
|
26428
26428
|
}
|
|
26429
26429
|
}
|
|
26430
26430
|
return {
|
|
26431
26431
|
name,
|
|
26432
26432
|
basedir,
|
|
26433
|
-
path:
|
|
26433
|
+
path: path31
|
|
26434
26434
|
};
|
|
26435
26435
|
};
|
|
26436
26436
|
}
|
|
@@ -26440,7 +26440,7 @@ var require_module_details_from_path = __commonJS({
|
|
|
26440
26440
|
var require_require_in_the_middle = __commonJS({
|
|
26441
26441
|
"../../node_modules/.pnpm/require-in-the-middle@8.0.1/node_modules/require-in-the-middle/index.js"(exports, module2) {
|
|
26442
26442
|
"use strict";
|
|
26443
|
-
var
|
|
26443
|
+
var path31 = __require("path");
|
|
26444
26444
|
var Module = __require("module");
|
|
26445
26445
|
var debug2 = require_src3()("require-in-the-middle");
|
|
26446
26446
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
@@ -26585,7 +26585,7 @@ var require_require_in_the_middle = __commonJS({
|
|
|
26585
26585
|
}
|
|
26586
26586
|
moduleName = filename;
|
|
26587
26587
|
} else if (hasWhitelist === true && modules.includes(filename)) {
|
|
26588
|
-
const parsedPath =
|
|
26588
|
+
const parsedPath = path31.parse(filename);
|
|
26589
26589
|
moduleName = parsedPath.name;
|
|
26590
26590
|
basedir = parsedPath.dir;
|
|
26591
26591
|
} else {
|
|
@@ -26623,7 +26623,7 @@ var require_require_in_the_middle = __commonJS({
|
|
|
26623
26623
|
}
|
|
26624
26624
|
if (res !== filename) {
|
|
26625
26625
|
if (internals === true) {
|
|
26626
|
-
moduleName = moduleName +
|
|
26626
|
+
moduleName = moduleName + path31.sep + path31.relative(basedir, filename);
|
|
26627
26627
|
debug2("preparing to process require of internal file: %s", moduleName);
|
|
26628
26628
|
} else {
|
|
26629
26629
|
debug2("ignoring require of non-main module file: %s", res);
|
|
@@ -26659,8 +26659,8 @@ var require_require_in_the_middle = __commonJS({
|
|
|
26659
26659
|
}
|
|
26660
26660
|
};
|
|
26661
26661
|
function resolveModuleName(stat) {
|
|
26662
|
-
const normalizedPath =
|
|
26663
|
-
return
|
|
26662
|
+
const normalizedPath = path31.sep !== "/" ? stat.path.split(path31.sep).join("/") : stat.path;
|
|
26663
|
+
return path31.posix.join(stat.name, normalizedPath).replace(normalize4, "");
|
|
26664
26664
|
}
|
|
26665
26665
|
}
|
|
26666
26666
|
});
|
|
@@ -26745,7 +26745,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
|
|
|
26745
26745
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26746
26746
|
exports.RequireInTheMiddleSingleton = void 0;
|
|
26747
26747
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
26748
|
-
var
|
|
26748
|
+
var path31 = __require("path");
|
|
26749
26749
|
var ModuleNameTrie_1 = require_ModuleNameTrie();
|
|
26750
26750
|
var isMocha = [
|
|
26751
26751
|
"afterEach",
|
|
@@ -26809,7 +26809,7 @@ var require_RequireInTheMiddleSingleton = __commonJS({
|
|
|
26809
26809
|
};
|
|
26810
26810
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
26811
26811
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
26812
|
-
return
|
|
26812
|
+
return path31.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path31.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
26813
26813
|
}
|
|
26814
26814
|
}
|
|
26815
26815
|
});
|
|
@@ -26975,7 +26975,7 @@ var require_register = __commonJS({
|
|
|
26975
26975
|
// ../../node_modules/.pnpm/import-in-the-middle@3.3.3/node_modules/import-in-the-middle/index.js
|
|
26976
26976
|
var require_import_in_the_middle = __commonJS({
|
|
26977
26977
|
"../../node_modules/.pnpm/import-in-the-middle@3.3.3/node_modules/import-in-the-middle/index.js"(exports, module2) {
|
|
26978
|
-
var
|
|
26978
|
+
var path31 = __require("path");
|
|
26979
26979
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
26980
26980
|
var { fileURLToPath: fileURLToPath8 } = __require("url");
|
|
26981
26981
|
var { MessageChannel } = __require("worker_threads");
|
|
@@ -27094,7 +27094,7 @@ var require_import_in_the_middle = __commonJS({
|
|
|
27094
27094
|
} else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) {
|
|
27095
27095
|
callHookFn(hookFn, namespace, name, baseDir);
|
|
27096
27096
|
} else if (internals) {
|
|
27097
|
-
const internalPath = name +
|
|
27097
|
+
const internalPath = name + path31.sep + path31.relative(baseDir, filePath);
|
|
27098
27098
|
callHookFn(hookFn, namespace, internalPath, baseDir);
|
|
27099
27099
|
}
|
|
27100
27100
|
} else if (matchArg === specifier) {
|
|
@@ -27169,7 +27169,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
27169
27169
|
"use strict";
|
|
27170
27170
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27171
27171
|
exports.InstrumentationBase = void 0;
|
|
27172
|
-
var
|
|
27172
|
+
var path31 = __require("path");
|
|
27173
27173
|
var util_1 = __require("util");
|
|
27174
27174
|
var semver_1 = require_semver();
|
|
27175
27175
|
var shimmer_1 = require_shimmer();
|
|
@@ -27270,7 +27270,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
27270
27270
|
}
|
|
27271
27271
|
_extractPackageVersion(baseDir) {
|
|
27272
27272
|
try {
|
|
27273
|
-
const json = (0, fs_1.readFileSync)(
|
|
27273
|
+
const json = (0, fs_1.readFileSync)(path31.join(baseDir, "package.json"), {
|
|
27274
27274
|
encoding: "utf8"
|
|
27275
27275
|
});
|
|
27276
27276
|
const version = JSON.parse(json).version;
|
|
@@ -27312,7 +27312,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
27312
27312
|
return exports2;
|
|
27313
27313
|
}
|
|
27314
27314
|
const files = module3.files ?? [];
|
|
27315
|
-
const normalizedName =
|
|
27315
|
+
const normalizedName = path31.normalize(name);
|
|
27316
27316
|
const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName && isSupported(f.supportedVersions, version, module3.includePrerelease));
|
|
27317
27317
|
return supportedFileInstrumentations.reduce((patchedExports, file) => {
|
|
27318
27318
|
file.moduleExports = patchedExports;
|
|
@@ -27358,8 +27358,8 @@ var require_instrumentation2 = __commonJS({
|
|
|
27358
27358
|
this._warnOnPreloadedModules();
|
|
27359
27359
|
for (const module3 of this._modules) {
|
|
27360
27360
|
const hookFn = (exports2, name, baseDir) => {
|
|
27361
|
-
if (!baseDir &&
|
|
27362
|
-
const parsedPath =
|
|
27361
|
+
if (!baseDir && path31.isAbsolute(name)) {
|
|
27362
|
+
const parsedPath = path31.parse(name);
|
|
27363
27363
|
name = parsedPath.name;
|
|
27364
27364
|
baseDir = parsedPath.dir;
|
|
27365
27365
|
}
|
|
@@ -27368,7 +27368,7 @@ var require_instrumentation2 = __commonJS({
|
|
|
27368
27368
|
const onRequire = (exports2, name, baseDir) => {
|
|
27369
27369
|
return this._onRequire(module3, exports2, name, baseDir);
|
|
27370
27370
|
};
|
|
27371
|
-
const hook =
|
|
27371
|
+
const hook = path31.isAbsolute(module3.name) ? new require_in_the_middle_1.Hook([module3.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module3.name, onRequire);
|
|
27372
27372
|
this._hooks.push(hook);
|
|
27373
27373
|
const esmHook = new import_in_the_middle_1.Hook([module3.name], { internals: true }, hookFn);
|
|
27374
27374
|
this._hooks.push(esmHook);
|
|
@@ -27866,19 +27866,19 @@ function getBreadcrumbData(request2) {
|
|
|
27866
27866
|
return {};
|
|
27867
27867
|
}
|
|
27868
27868
|
}
|
|
27869
|
-
function getAbsoluteUrl2(origin2,
|
|
27869
|
+
function getAbsoluteUrl2(origin2, path31 = "/") {
|
|
27870
27870
|
try {
|
|
27871
|
-
const url2 = new URL(
|
|
27871
|
+
const url2 = new URL(path31, origin2);
|
|
27872
27872
|
return url2.toString();
|
|
27873
27873
|
} catch {
|
|
27874
27874
|
const url2 = `${origin2}`;
|
|
27875
|
-
if (url2.endsWith("/") &&
|
|
27876
|
-
return `${url2}${
|
|
27875
|
+
if (url2.endsWith("/") && path31.startsWith("/")) {
|
|
27876
|
+
return `${url2}${path31.slice(1)}`;
|
|
27877
27877
|
}
|
|
27878
|
-
if (!url2.endsWith("/") && !
|
|
27879
|
-
return `${url2}/${
|
|
27878
|
+
if (!url2.endsWith("/") && !path31.startsWith("/")) {
|
|
27879
|
+
return `${url2}/${path31}`;
|
|
27880
27880
|
}
|
|
27881
|
-
return `${url2}${
|
|
27881
|
+
return `${url2}${path31}`;
|
|
27882
27882
|
}
|
|
27883
27883
|
}
|
|
27884
27884
|
var SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER, W3C_TRACEPARENT_HEADER;
|
|
@@ -28129,15 +28129,15 @@ function getRequestMethod(original) {
|
|
|
28129
28129
|
}
|
|
28130
28130
|
return "_OTHER";
|
|
28131
28131
|
}
|
|
28132
|
-
function getAbsoluteUrl3(origin2,
|
|
28132
|
+
function getAbsoluteUrl3(origin2, path31 = "/") {
|
|
28133
28133
|
const url2 = `${origin2}`;
|
|
28134
|
-
if (url2.endsWith("/") &&
|
|
28135
|
-
return `${url2}${
|
|
28134
|
+
if (url2.endsWith("/") && path31.startsWith("/")) {
|
|
28135
|
+
return `${url2}${path31.slice(1)}`;
|
|
28136
28136
|
}
|
|
28137
|
-
if (!url2.endsWith("/") && !
|
|
28138
|
-
return `${url2}/${
|
|
28137
|
+
if (!url2.endsWith("/") && !path31.startsWith("/")) {
|
|
28138
|
+
return `${url2}/${path31}`;
|
|
28139
28139
|
}
|
|
28140
|
-
return `${url2}${
|
|
28140
|
+
return `${url2}${path31}`;
|
|
28141
28141
|
}
|
|
28142
28142
|
var ATTR_HTTP_REQUEST_METHOD_ORIGINAL2, _channelSubs, spanFromReq, ignoreRequestMap, propagationDecisionMap;
|
|
28143
28143
|
var init_undici_instrumentation = __esm({
|
|
@@ -28569,9 +28569,9 @@ var require_getMachineId_linux = __commonJS({
|
|
|
28569
28569
|
var api_1 = (init_esm3(), __toCommonJS(esm_exports));
|
|
28570
28570
|
async function getMachineId() {
|
|
28571
28571
|
const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
|
|
28572
|
-
for (const
|
|
28572
|
+
for (const path31 of paths) {
|
|
28573
28573
|
try {
|
|
28574
|
-
const result = await fs_1.promises.readFile(
|
|
28574
|
+
const result = await fs_1.promises.readFile(path31, { encoding: "utf8" });
|
|
28575
28575
|
return result.trim();
|
|
28576
28576
|
} catch (e) {
|
|
28577
28577
|
api_1.diag.debug(`error reading machine id: ${e}`);
|
|
@@ -33327,12 +33327,12 @@ function emplace(map, key, contents) {
|
|
|
33327
33327
|
}
|
|
33328
33328
|
return value;
|
|
33329
33329
|
}
|
|
33330
|
-
function shouldSkipContextLinesForFile(
|
|
33331
|
-
if (
|
|
33332
|
-
if (
|
|
33333
|
-
if (
|
|
33334
|
-
if (
|
|
33335
|
-
if (
|
|
33330
|
+
function shouldSkipContextLinesForFile(path31) {
|
|
33331
|
+
if (path31.startsWith("node:")) return true;
|
|
33332
|
+
if (path31.endsWith(".min.js")) return true;
|
|
33333
|
+
if (path31.endsWith(".min.cjs")) return true;
|
|
33334
|
+
if (path31.endsWith(".min.mjs")) return true;
|
|
33335
|
+
if (path31.startsWith("data:")) return true;
|
|
33336
33336
|
return false;
|
|
33337
33337
|
}
|
|
33338
33338
|
function shouldSkipContextLinesForFrame(frame) {
|
|
@@ -33380,9 +33380,9 @@ function makeLineReaderRanges(lines, linecontext) {
|
|
|
33380
33380
|
}
|
|
33381
33381
|
return out;
|
|
33382
33382
|
}
|
|
33383
|
-
function getContextLinesFromFile(
|
|
33383
|
+
function getContextLinesFromFile(path31, ranges, output) {
|
|
33384
33384
|
return new Promise((resolve8, _reject) => {
|
|
33385
|
-
const stream4 = createReadStream(
|
|
33385
|
+
const stream4 = createReadStream(path31);
|
|
33386
33386
|
const lineReaded = createInterface({
|
|
33387
33387
|
input: stream4
|
|
33388
33388
|
});
|
|
@@ -33400,8 +33400,8 @@ function getContextLinesFromFile(path30, ranges, output) {
|
|
|
33400
33400
|
let rangeStart = range[0];
|
|
33401
33401
|
let rangeEnd = range[1];
|
|
33402
33402
|
function onStreamError(e) {
|
|
33403
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
33404
|
-
DEBUG_BUILD2 && debug.error(`Failed to read file: ${
|
|
33403
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path31, 1);
|
|
33404
|
+
DEBUG_BUILD2 && debug.error(`Failed to read file: ${path31}. Error: ${e}`);
|
|
33405
33405
|
lineReaded.close();
|
|
33406
33406
|
lineReaded.removeAllListeners();
|
|
33407
33407
|
destroyStreamAndResolve();
|
|
@@ -34960,8 +34960,8 @@ var init_spotlight2 = __esm({
|
|
|
34960
34960
|
|
|
34961
34961
|
// ../../node_modules/.pnpm/@sentry+node-core@10.70.0_@opentelemetry+api@1.9.1_@opentelemetry+core@2.10.0_@opentelemetry+_xy53gxni6xwrihkx6w72xmc6na/node_modules/@sentry/node-core/build/esm/utils/module.js
|
|
34962
34962
|
import { posix, sep } from "node:path";
|
|
34963
|
-
function normalizeWindowsPath(
|
|
34964
|
-
return
|
|
34963
|
+
function normalizeWindowsPath(path31) {
|
|
34964
|
+
return path31.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
34965
34965
|
}
|
|
34966
34966
|
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
34967
34967
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
@@ -38174,22 +38174,22 @@ function addSpanSource(span, loc, start, end) {
|
|
|
38174
38174
|
span.setAttribute(AttributeNames2.SOURCE, source);
|
|
38175
38175
|
}
|
|
38176
38176
|
}
|
|
38177
|
-
function createFieldIfNotExists(contextValue, info,
|
|
38178
|
-
let field = getField(contextValue,
|
|
38177
|
+
function createFieldIfNotExists(contextValue, info, path31) {
|
|
38178
|
+
let field = getField(contextValue, path31);
|
|
38179
38179
|
if (field) {
|
|
38180
38180
|
return { field, spanAdded: false };
|
|
38181
38181
|
}
|
|
38182
|
-
const parentSpan = getParentFieldSpan(contextValue,
|
|
38182
|
+
const parentSpan = getParentFieldSpan(contextValue, path31);
|
|
38183
38183
|
field = {
|
|
38184
|
-
span: createResolverSpan(contextValue, info,
|
|
38184
|
+
span: createResolverSpan(contextValue, info, path31, parentSpan)
|
|
38185
38185
|
};
|
|
38186
|
-
addField(contextValue,
|
|
38186
|
+
addField(contextValue, path31, field);
|
|
38187
38187
|
return { field, spanAdded: true };
|
|
38188
38188
|
}
|
|
38189
|
-
function createResolverSpan(contextValue, info,
|
|
38189
|
+
function createResolverSpan(contextValue, info, path31, parentSpan) {
|
|
38190
38190
|
const attributes = {
|
|
38191
38191
|
[AttributeNames2.FIELD_NAME]: info.fieldName,
|
|
38192
|
-
[AttributeNames2.FIELD_PATH]:
|
|
38192
|
+
[AttributeNames2.FIELD_PATH]: path31.join("."),
|
|
38193
38193
|
[AttributeNames2.FIELD_TYPE]: info.returnType.toString(),
|
|
38194
38194
|
[AttributeNames2.PARENT_NAME]: info.parentType.name
|
|
38195
38195
|
};
|
|
@@ -38221,15 +38221,15 @@ function getOperation(document2, operationName) {
|
|
|
38221
38221
|
return document2.definitions.find((definition) => OPERATION_VALUES.indexOf(definition?.operation) !== -1);
|
|
38222
38222
|
}
|
|
38223
38223
|
}
|
|
38224
|
-
function addField(contextValue,
|
|
38225
|
-
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
38224
|
+
function addField(contextValue, path31, field) {
|
|
38225
|
+
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path31.join(".")] = field;
|
|
38226
38226
|
}
|
|
38227
|
-
function getField(contextValue,
|
|
38228
|
-
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[
|
|
38227
|
+
function getField(contextValue, path31) {
|
|
38228
|
+
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].fields[path31.join(".")];
|
|
38229
38229
|
}
|
|
38230
|
-
function getParentFieldSpan(contextValue,
|
|
38231
|
-
for (let i =
|
|
38232
|
-
const field = getField(contextValue,
|
|
38230
|
+
function getParentFieldSpan(contextValue, path31) {
|
|
38231
|
+
for (let i = path31.length - 1; i > 0; i--) {
|
|
38232
|
+
const field = getField(contextValue, path31.slice(0, i));
|
|
38233
38233
|
if (field) {
|
|
38234
38234
|
return field.span;
|
|
38235
38235
|
}
|
|
@@ -38239,9 +38239,9 @@ function getParentFieldSpan(contextValue, path30) {
|
|
|
38239
38239
|
function getRootSpan2(contextValue) {
|
|
38240
38240
|
return contextValue[OTEL_GRAPHQL_DATA_SYMBOL].span;
|
|
38241
38241
|
}
|
|
38242
|
-
function pathToArray(
|
|
38242
|
+
function pathToArray(path31) {
|
|
38243
38243
|
const flattened = [];
|
|
38244
|
-
let curr =
|
|
38244
|
+
let curr = path31;
|
|
38245
38245
|
while (curr) {
|
|
38246
38246
|
flattened.push(String(curr.key));
|
|
38247
38247
|
curr = curr.prev;
|
|
@@ -38365,8 +38365,8 @@ function wrapFieldResolver(getConfig3, fieldResolver, isDefaultResolver = false)
|
|
|
38365
38365
|
if (!contextValue[OTEL_GRAPHQL_DATA_SYMBOL]) {
|
|
38366
38366
|
return fieldResolver.call(this, source, args, contextValue, info);
|
|
38367
38367
|
}
|
|
38368
|
-
const
|
|
38369
|
-
const { field, spanAdded } = createFieldIfNotExists(contextValue, info,
|
|
38368
|
+
const path31 = pathToArray(info?.path);
|
|
38369
|
+
const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path31);
|
|
38370
38370
|
const span = field.span;
|
|
38371
38371
|
const shouldEndSpan = spanAdded;
|
|
38372
38372
|
return withActiveSpan(span, () => {
|
|
@@ -41641,10 +41641,10 @@ var init_postgresjs2 = __esm({
|
|
|
41641
41641
|
},
|
|
41642
41642
|
(exports) => exports
|
|
41643
41643
|
);
|
|
41644
|
-
["src", "cf/src", "cjs/src"].forEach((
|
|
41644
|
+
["src", "cf/src", "cjs/src"].forEach((path31) => {
|
|
41645
41645
|
module2.files.push(
|
|
41646
41646
|
new InstrumentationNodeModuleFile(
|
|
41647
|
-
`postgres/${
|
|
41647
|
+
`postgres/${path31}/query.js`,
|
|
41648
41648
|
SUPPORTED_VERSIONS4,
|
|
41649
41649
|
this._patchQueryPrototype.bind(this),
|
|
41650
41650
|
this._unpatchQueryPrototype.bind(this)
|
|
@@ -42321,13 +42321,13 @@ var init_instrumentation11 = __esm({
|
|
|
42321
42321
|
return function(original) {
|
|
42322
42322
|
return function wrappedHandler(...args) {
|
|
42323
42323
|
if (typeof args[0] === "string") {
|
|
42324
|
-
const
|
|
42324
|
+
const path31 = args[0];
|
|
42325
42325
|
if (args.length === 1) {
|
|
42326
|
-
return original.apply(this, [
|
|
42326
|
+
return original.apply(this, [path31]);
|
|
42327
42327
|
}
|
|
42328
42328
|
const handlers2 = args.slice(1);
|
|
42329
42329
|
return original.apply(this, [
|
|
42330
|
-
|
|
42330
|
+
path31,
|
|
42331
42331
|
...handlers2.map((handler) => instrumentation._wrapHandler(handler))
|
|
42332
42332
|
]);
|
|
42333
42333
|
}
|
|
@@ -42361,13 +42361,13 @@ var init_instrumentation11 = __esm({
|
|
|
42361
42361
|
return function(original) {
|
|
42362
42362
|
return function wrappedHandler(...args) {
|
|
42363
42363
|
if (typeof args[0] === "string") {
|
|
42364
|
-
const
|
|
42364
|
+
const path31 = args[0];
|
|
42365
42365
|
if (args.length === 1) {
|
|
42366
|
-
return original.apply(this, [
|
|
42366
|
+
return original.apply(this, [path31]);
|
|
42367
42367
|
}
|
|
42368
42368
|
const handlers2 = args.slice(1);
|
|
42369
42369
|
return original.apply(this, [
|
|
42370
|
-
|
|
42370
|
+
path31,
|
|
42371
42371
|
...handlers2.map((handler) => instrumentation._wrapHandler(handler))
|
|
42372
42372
|
]);
|
|
42373
42373
|
}
|
|
@@ -42387,8 +42387,8 @@ var init_instrumentation11 = __esm({
|
|
|
42387
42387
|
if (!instrumentation.isEnabled()) {
|
|
42388
42388
|
return handler.apply(this, [c, next]);
|
|
42389
42389
|
}
|
|
42390
|
-
const
|
|
42391
|
-
const span = instrumentation.tracer.startSpan(
|
|
42390
|
+
const path31 = c.req.path;
|
|
42391
|
+
const span = instrumentation.tracer.startSpan(path31);
|
|
42392
42392
|
return context.with(trace.setSpan(context.active(), span), () => {
|
|
42393
42393
|
return instrumentation._safeExecute(
|
|
42394
42394
|
() => {
|
|
@@ -42398,7 +42398,7 @@ var init_instrumentation11 = __esm({
|
|
|
42398
42398
|
const type = instrumentation._determineHandlerType(result2);
|
|
42399
42399
|
span.setAttributes({
|
|
42400
42400
|
[AttributeNames5.HONO_TYPE]: type,
|
|
42401
|
-
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ?
|
|
42401
|
+
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path31 : handler.name || "anonymous"
|
|
42402
42402
|
});
|
|
42403
42403
|
instrumentation.getConfig().responseHook?.(span);
|
|
42404
42404
|
return result2;
|
|
@@ -42407,7 +42407,7 @@ var init_instrumentation11 = __esm({
|
|
|
42407
42407
|
const type = instrumentation._determineHandlerType(result);
|
|
42408
42408
|
span.setAttributes({
|
|
42409
42409
|
[AttributeNames5.HONO_TYPE]: type,
|
|
42410
|
-
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ?
|
|
42410
|
+
[AttributeNames5.HONO_NAME]: type === HonoTypes.REQUEST_HANDLER ? path31 : handler.name || "anonymous"
|
|
42411
42411
|
});
|
|
42412
42412
|
instrumentation.getConfig().responseHook?.(span);
|
|
42413
42413
|
return result;
|
|
@@ -42656,11 +42656,11 @@ var init_instrumentation12 = __esm({
|
|
|
42656
42656
|
const router = dispatchLayer.router;
|
|
42657
42657
|
const routesStack = router?.stack ?? [];
|
|
42658
42658
|
for (const pathLayer of routesStack) {
|
|
42659
|
-
const
|
|
42659
|
+
const path31 = pathLayer.path;
|
|
42660
42660
|
const pathStack = pathLayer.stack;
|
|
42661
42661
|
for (let j = 0; j < pathStack.length; j++) {
|
|
42662
42662
|
const routedMiddleware = pathStack[j];
|
|
42663
|
-
pathStack[j] = this._patchLayer(routedMiddleware, true,
|
|
42663
|
+
pathStack[j] = this._patchLayer(routedMiddleware, true, path31);
|
|
42664
42664
|
}
|
|
42665
42665
|
}
|
|
42666
42666
|
return dispatchLayer;
|
|
@@ -55321,11 +55321,11 @@ var require_mime_types = __commonJS({
|
|
|
55321
55321
|
}
|
|
55322
55322
|
return exts[0];
|
|
55323
55323
|
}
|
|
55324
|
-
function lookup(
|
|
55325
|
-
if (!
|
|
55324
|
+
function lookup(path31) {
|
|
55325
|
+
if (!path31 || typeof path31 !== "string") {
|
|
55326
55326
|
return false;
|
|
55327
55327
|
}
|
|
55328
|
-
var extension3 = extname("x." +
|
|
55328
|
+
var extension3 = extname("x." + path31).toLowerCase().substr(1);
|
|
55329
55329
|
if (!extension3) {
|
|
55330
55330
|
return false;
|
|
55331
55331
|
}
|
|
@@ -56430,11 +56430,11 @@ var require_form_data = __commonJS({
|
|
|
56430
56430
|
"use strict";
|
|
56431
56431
|
var CombinedStream = require_combined_stream();
|
|
56432
56432
|
var util5 = __require("util");
|
|
56433
|
-
var
|
|
56433
|
+
var path31 = __require("path");
|
|
56434
56434
|
var http8 = __require("http");
|
|
56435
56435
|
var https3 = __require("https");
|
|
56436
56436
|
var parseUrl3 = __require("url").parse;
|
|
56437
|
-
var
|
|
56437
|
+
var fs29 = __require("fs");
|
|
56438
56438
|
var Stream = __require("stream").Stream;
|
|
56439
56439
|
var crypto4 = __require("crypto");
|
|
56440
56440
|
var mime = require_mime_types();
|
|
@@ -56504,7 +56504,7 @@ var require_form_data = __commonJS({
|
|
|
56504
56504
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
56505
56505
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
56506
56506
|
} else {
|
|
56507
|
-
|
|
56507
|
+
fs29.stat(value.path, function(err, stat) {
|
|
56508
56508
|
if (err) {
|
|
56509
56509
|
callback(err);
|
|
56510
56510
|
return;
|
|
@@ -56561,11 +56561,11 @@ var require_form_data = __commonJS({
|
|
|
56561
56561
|
FormData3.prototype._getContentDisposition = function(value, options) {
|
|
56562
56562
|
var filename;
|
|
56563
56563
|
if (typeof options.filepath === "string") {
|
|
56564
|
-
filename =
|
|
56564
|
+
filename = path31.normalize(options.filepath).replace(/\\/g, "/");
|
|
56565
56565
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
56566
|
-
filename =
|
|
56566
|
+
filename = path31.basename(options.filename || value && (value.name || value.path));
|
|
56567
56567
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
56568
|
-
filename =
|
|
56568
|
+
filename = path31.basename(value.client._httpMessage.path || "");
|
|
56569
56569
|
}
|
|
56570
56570
|
if (filename) {
|
|
56571
56571
|
return 'filename="' + escapeHeaderParam(filename) + '"';
|
|
@@ -56778,9 +56778,9 @@ function isVisitable(thing) {
|
|
|
56778
56778
|
function removeBrackets(key) {
|
|
56779
56779
|
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
56780
56780
|
}
|
|
56781
|
-
function renderKey(
|
|
56782
|
-
if (!
|
|
56783
|
-
return
|
|
56781
|
+
function renderKey(path31, key, dots) {
|
|
56782
|
+
if (!path31) return key;
|
|
56783
|
+
return path31.concat(key).map(function each(token, i) {
|
|
56784
56784
|
token = removeBrackets(token);
|
|
56785
56785
|
return !dots && i ? "[" + token + "]" : token;
|
|
56786
56786
|
}).join(dots ? "." : "");
|
|
@@ -56863,13 +56863,13 @@ function toFormData(obj, formData, options) {
|
|
|
56863
56863
|
return currentValue;
|
|
56864
56864
|
});
|
|
56865
56865
|
}
|
|
56866
|
-
function defaultVisitor(value, key,
|
|
56866
|
+
function defaultVisitor(value, key, path31) {
|
|
56867
56867
|
let arr = value;
|
|
56868
56868
|
if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
|
|
56869
|
-
formData.append(renderKey(
|
|
56869
|
+
formData.append(renderKey(path31, key, dots), convertValue(value));
|
|
56870
56870
|
return false;
|
|
56871
56871
|
}
|
|
56872
|
-
if (value && !
|
|
56872
|
+
if (value && !path31 && typeof value === "object") {
|
|
56873
56873
|
if (utils_default.endsWith(key, "{}")) {
|
|
56874
56874
|
key = metaTokens ? key : key.slice(0, -2);
|
|
56875
56875
|
value = stringifyWithDepthLimit(value, 1);
|
|
@@ -56888,7 +56888,7 @@ function toFormData(obj, formData, options) {
|
|
|
56888
56888
|
if (isVisitable(value)) {
|
|
56889
56889
|
return true;
|
|
56890
56890
|
}
|
|
56891
|
-
formData.append(renderKey(
|
|
56891
|
+
formData.append(renderKey(path31, key, dots), convertValue(value));
|
|
56892
56892
|
return false;
|
|
56893
56893
|
}
|
|
56894
56894
|
const exposedHelpers = Object.assign(predicates, {
|
|
@@ -56896,17 +56896,17 @@ function toFormData(obj, formData, options) {
|
|
|
56896
56896
|
convertValue,
|
|
56897
56897
|
isVisitable
|
|
56898
56898
|
});
|
|
56899
|
-
function build(value,
|
|
56899
|
+
function build(value, path31, depth = 0) {
|
|
56900
56900
|
if (utils_default.isUndefined(value)) return;
|
|
56901
56901
|
throwIfMaxDepthExceeded(depth);
|
|
56902
56902
|
if (stack.indexOf(value) !== -1) {
|
|
56903
|
-
throw new Error("Circular reference detected in " +
|
|
56903
|
+
throw new Error("Circular reference detected in " + path31.join("."));
|
|
56904
56904
|
}
|
|
56905
56905
|
stack.push(value);
|
|
56906
56906
|
utils_default.forEach(value, function each(el, key) {
|
|
56907
|
-
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key,
|
|
56907
|
+
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path31, exposedHelpers);
|
|
56908
56908
|
if (result === true) {
|
|
56909
|
-
build(el,
|
|
56909
|
+
build(el, path31 ? path31.concat(key) : [key], depth + 1);
|
|
56910
56910
|
}
|
|
56911
56911
|
});
|
|
56912
56912
|
stack.pop();
|
|
@@ -57182,7 +57182,7 @@ var init_platform = __esm({
|
|
|
57182
57182
|
// ../../node_modules/.pnpm/axios@1.19.0/node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
57183
57183
|
function toURLEncodedForm(data, options) {
|
|
57184
57184
|
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
|
|
57185
|
-
visitor: function(value, key,
|
|
57185
|
+
visitor: function(value, key, path31, helpers) {
|
|
57186
57186
|
if (platform_default.isNode && utils_default.isBuffer(value)) {
|
|
57187
57187
|
this.append(key, value.toString("base64"));
|
|
57188
57188
|
return false;
|
|
@@ -57211,14 +57211,14 @@ function throwIfDepthExceeded(index) {
|
|
|
57211
57211
|
}
|
|
57212
57212
|
}
|
|
57213
57213
|
function parsePropPath(name) {
|
|
57214
|
-
const
|
|
57214
|
+
const path31 = [];
|
|
57215
57215
|
const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
57216
57216
|
let match;
|
|
57217
57217
|
while ((match = pattern.exec(name)) !== null) {
|
|
57218
|
-
throwIfDepthExceeded(
|
|
57219
|
-
|
|
57218
|
+
throwIfDepthExceeded(path31.length);
|
|
57219
|
+
path31.push(match[0] === "[]" ? "" : match[1] || match[0]);
|
|
57220
57220
|
}
|
|
57221
|
-
return
|
|
57221
|
+
return path31;
|
|
57222
57222
|
}
|
|
57223
57223
|
function arrayToObject(arr) {
|
|
57224
57224
|
const obj = {};
|
|
@@ -57233,12 +57233,12 @@ function arrayToObject(arr) {
|
|
|
57233
57233
|
return obj;
|
|
57234
57234
|
}
|
|
57235
57235
|
function formDataToJSON(formData) {
|
|
57236
|
-
function buildPath(
|
|
57236
|
+
function buildPath(path31, value, target, index) {
|
|
57237
57237
|
throwIfDepthExceeded(index);
|
|
57238
|
-
let name =
|
|
57238
|
+
let name = path31[index++];
|
|
57239
57239
|
if (name === "__proto__") return true;
|
|
57240
57240
|
const isNumericKey = Number.isFinite(+name);
|
|
57241
|
-
const isLast = index >=
|
|
57241
|
+
const isLast = index >= path31.length;
|
|
57242
57242
|
name = !name && utils_default.isArray(target) ? target.length : name;
|
|
57243
57243
|
if (isLast) {
|
|
57244
57244
|
if (utils_default.hasOwnProp(target, name)) {
|
|
@@ -57251,7 +57251,7 @@ function formDataToJSON(formData) {
|
|
|
57251
57251
|
if (!utils_default.hasOwnProp(target, name) || !utils_default.isObject(target[name])) {
|
|
57252
57252
|
target[name] = [];
|
|
57253
57253
|
}
|
|
57254
|
-
const result = buildPath(
|
|
57254
|
+
const result = buildPath(path31, value, target[name], index);
|
|
57255
57255
|
if (result && utils_default.isArray(target[name])) {
|
|
57256
57256
|
target[name] = arrayToObject(target[name]);
|
|
57257
57257
|
}
|
|
@@ -60134,9 +60134,9 @@ var init_http4 = __esm({
|
|
|
60134
60134
|
auth = urlUsername + ":" + urlPassword;
|
|
60135
60135
|
}
|
|
60136
60136
|
auth && headers.delete("authorization");
|
|
60137
|
-
let
|
|
60137
|
+
let path31;
|
|
60138
60138
|
try {
|
|
60139
|
-
|
|
60139
|
+
path31 = buildURL(
|
|
60140
60140
|
parsed.pathname + parsed.search,
|
|
60141
60141
|
own2("params"),
|
|
60142
60142
|
own2("paramsSerializer")
|
|
@@ -60155,7 +60155,7 @@ var init_http4 = __esm({
|
|
|
60155
60155
|
false
|
|
60156
60156
|
);
|
|
60157
60157
|
const options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
60158
|
-
path:
|
|
60158
|
+
path: path31,
|
|
60159
60159
|
method,
|
|
60160
60160
|
headers: toByteStringHeaderObject(headers),
|
|
60161
60161
|
agents: { http: httpAgent, https: httpsAgent },
|
|
@@ -60570,14 +60570,14 @@ var init_cookies = __esm({
|
|
|
60570
60570
|
cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
60571
60571
|
// Standard browser envs support document.cookie
|
|
60572
60572
|
{
|
|
60573
|
-
write(name, value, expires,
|
|
60573
|
+
write(name, value, expires, path31, domain, secure, sameSite) {
|
|
60574
60574
|
if (typeof document === "undefined") return;
|
|
60575
60575
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
60576
60576
|
if (utils_default.isNumber(expires)) {
|
|
60577
60577
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
60578
60578
|
}
|
|
60579
|
-
if (utils_default.isString(
|
|
60580
|
-
cookie.push(`path=${
|
|
60579
|
+
if (utils_default.isString(path31)) {
|
|
60580
|
+
cookie.push(`path=${path31}`);
|
|
60581
60581
|
}
|
|
60582
60582
|
if (utils_default.isString(domain)) {
|
|
60583
60583
|
cookie.push(`domain=${domain}`);
|
|
@@ -62317,11 +62317,11 @@ var init_axios2 = __esm({
|
|
|
62317
62317
|
var require_is_docker = __commonJS({
|
|
62318
62318
|
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports, module2) {
|
|
62319
62319
|
"use strict";
|
|
62320
|
-
var
|
|
62320
|
+
var fs29 = __require("fs");
|
|
62321
62321
|
var isDocker;
|
|
62322
62322
|
function hasDockerEnv() {
|
|
62323
62323
|
try {
|
|
62324
|
-
|
|
62324
|
+
fs29.statSync("/.dockerenv");
|
|
62325
62325
|
return true;
|
|
62326
62326
|
} catch (_) {
|
|
62327
62327
|
return false;
|
|
@@ -62329,7 +62329,7 @@ var require_is_docker = __commonJS({
|
|
|
62329
62329
|
}
|
|
62330
62330
|
function hasDockerCGroup() {
|
|
62331
62331
|
try {
|
|
62332
|
-
return
|
|
62332
|
+
return fs29.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
62333
62333
|
} catch (_) {
|
|
62334
62334
|
return false;
|
|
62335
62335
|
}
|
|
@@ -62348,7 +62348,7 @@ var require_is_wsl = __commonJS({
|
|
|
62348
62348
|
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports, module2) {
|
|
62349
62349
|
"use strict";
|
|
62350
62350
|
var os6 = __require("os");
|
|
62351
|
-
var
|
|
62351
|
+
var fs29 = __require("fs");
|
|
62352
62352
|
var isDocker = require_is_docker();
|
|
62353
62353
|
var isWsl = () => {
|
|
62354
62354
|
if (process.platform !== "linux") {
|
|
@@ -62361,7 +62361,7 @@ var require_is_wsl = __commonJS({
|
|
|
62361
62361
|
return true;
|
|
62362
62362
|
}
|
|
62363
62363
|
try {
|
|
62364
|
-
return
|
|
62364
|
+
return fs29.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
62365
62365
|
} catch (_) {
|
|
62366
62366
|
return false;
|
|
62367
62367
|
}
|
|
@@ -62400,17 +62400,17 @@ var require_define_lazy_prop = __commonJS({
|
|
|
62400
62400
|
// ../../node_modules/.pnpm/open@8.4.2/node_modules/open/index.js
|
|
62401
62401
|
var require_open = __commonJS({
|
|
62402
62402
|
"../../node_modules/.pnpm/open@8.4.2/node_modules/open/index.js"(exports, module2) {
|
|
62403
|
-
var
|
|
62403
|
+
var path31 = __require("path");
|
|
62404
62404
|
var childProcess = __require("child_process");
|
|
62405
|
-
var { promises:
|
|
62405
|
+
var { promises: fs29, constants: fsConstants } = __require("fs");
|
|
62406
62406
|
var isWsl = require_is_wsl();
|
|
62407
62407
|
var isDocker = require_is_docker();
|
|
62408
62408
|
var defineLazyProperty = require_define_lazy_prop();
|
|
62409
|
-
var localXdgOpenPath =
|
|
62409
|
+
var localXdgOpenPath = path31.join(__dirname, "xdg-open");
|
|
62410
62410
|
var { platform: platform3, arch: arch3 } = process;
|
|
62411
62411
|
var hasContainerEnv = () => {
|
|
62412
62412
|
try {
|
|
62413
|
-
|
|
62413
|
+
fs29.statSync("/run/.containerenv");
|
|
62414
62414
|
return true;
|
|
62415
62415
|
} catch {
|
|
62416
62416
|
return false;
|
|
@@ -62433,14 +62433,14 @@ var require_open = __commonJS({
|
|
|
62433
62433
|
const configFilePath = "/etc/wsl.conf";
|
|
62434
62434
|
let isConfigFileExists = false;
|
|
62435
62435
|
try {
|
|
62436
|
-
await
|
|
62436
|
+
await fs29.access(configFilePath, fsConstants.F_OK);
|
|
62437
62437
|
isConfigFileExists = true;
|
|
62438
62438
|
} catch {
|
|
62439
62439
|
}
|
|
62440
62440
|
if (!isConfigFileExists) {
|
|
62441
62441
|
return defaultMountPoint;
|
|
62442
62442
|
}
|
|
62443
|
-
const configContent = await
|
|
62443
|
+
const configContent = await fs29.readFile(configFilePath, { encoding: "utf8" });
|
|
62444
62444
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
62445
62445
|
if (!configMountPoint) {
|
|
62446
62446
|
return defaultMountPoint;
|
|
@@ -62540,7 +62540,7 @@ var require_open = __commonJS({
|
|
|
62540
62540
|
const isBundled = !__dirname || __dirname === "/";
|
|
62541
62541
|
let exeLocalXdgOpen = false;
|
|
62542
62542
|
try {
|
|
62543
|
-
await
|
|
62543
|
+
await fs29.access(localXdgOpenPath, fsConstants.X_OK);
|
|
62544
62544
|
exeLocalXdgOpen = true;
|
|
62545
62545
|
} catch {
|
|
62546
62546
|
}
|
|
@@ -62767,8 +62767,10 @@ var init_config2 = __esm({
|
|
|
62767
62767
|
var keychain_exports = {};
|
|
62768
62768
|
__export(keychain_exports, {
|
|
62769
62769
|
deleteToken: () => deleteToken,
|
|
62770
|
+
getSessionStatus: () => getSessionStatus,
|
|
62770
62771
|
getToken: () => getToken,
|
|
62771
62772
|
getTokenInfo: () => getTokenInfo,
|
|
62773
|
+
getTokenInfoLocal: () => getTokenInfoLocal,
|
|
62772
62774
|
saveToken: () => saveToken
|
|
62773
62775
|
});
|
|
62774
62776
|
import * as fs4 from "fs";
|
|
@@ -62817,6 +62819,7 @@ async function getKeytar() {
|
|
|
62817
62819
|
}
|
|
62818
62820
|
}
|
|
62819
62821
|
async function saveToken(token, issuer = "local") {
|
|
62822
|
+
invalidateSessionCache();
|
|
62820
62823
|
const payload = JSON.stringify({ token, issuer });
|
|
62821
62824
|
const keytar = await getKeytar();
|
|
62822
62825
|
if (keytar) {
|
|
@@ -62832,7 +62835,64 @@ async function getToken() {
|
|
|
62832
62835
|
const info = await getTokenInfo();
|
|
62833
62836
|
return info?.token ?? null;
|
|
62834
62837
|
}
|
|
62838
|
+
async function probeServerSession(serverUrl) {
|
|
62839
|
+
try {
|
|
62840
|
+
const { data } = await axios_default.get(`${serverUrl}/auth/session`, { proxy: false, timeout: 1500 });
|
|
62841
|
+
if (data?.loggedIn === true && typeof data.token === "string" && data.token) {
|
|
62842
|
+
return { kind: "loggedIn", email: String(data.email ?? ""), token: data.token };
|
|
62843
|
+
}
|
|
62844
|
+
return { kind: "loggedOut" };
|
|
62845
|
+
} catch (err) {
|
|
62846
|
+
if (!err?.response) return { kind: "unreachable" };
|
|
62847
|
+
return { kind: "error", status: err.response.status };
|
|
62848
|
+
}
|
|
62849
|
+
}
|
|
62850
|
+
function invalidateSessionCache() {
|
|
62851
|
+
sessionCache = null;
|
|
62852
|
+
}
|
|
62853
|
+
async function resolveSessionUncached() {
|
|
62854
|
+
let serverUrl;
|
|
62855
|
+
try {
|
|
62856
|
+
serverUrl = loadConfig().serverUrl;
|
|
62857
|
+
} catch {
|
|
62858
|
+
return { info: await getTokenInfoLocal(), email: null, via: "keychain" };
|
|
62859
|
+
}
|
|
62860
|
+
let s = await probeServerSession(serverUrl);
|
|
62861
|
+
if (s.kind === "loggedOut") {
|
|
62862
|
+
try {
|
|
62863
|
+
const { reportPendingSaasTokenIfReachable: reportPendingSaasTokenIfReachable2 } = await Promise.resolve().then(() => (init_saas_token_reporter(), saas_token_reporter_exports));
|
|
62864
|
+
if (await reportPendingSaasTokenIfReachable2(serverUrl) === "reported") {
|
|
62865
|
+
s = await probeServerSession(serverUrl);
|
|
62866
|
+
}
|
|
62867
|
+
} catch {
|
|
62868
|
+
}
|
|
62869
|
+
}
|
|
62870
|
+
if (s.kind === "loggedIn") {
|
|
62871
|
+
await saveToken(s.token, "local").catch(() => {
|
|
62872
|
+
});
|
|
62873
|
+
return { info: { token: s.token, issuer: "local" }, email: s.email || null, via: "server" };
|
|
62874
|
+
}
|
|
62875
|
+
if (s.kind === "loggedOut") {
|
|
62876
|
+
return { info: null, email: null, via: "server" };
|
|
62877
|
+
}
|
|
62878
|
+
return { info: await getTokenInfoLocal(), email: null, via: "keychain" };
|
|
62879
|
+
}
|
|
62880
|
+
async function getSessionStatus() {
|
|
62881
|
+
if (process.env.HUNTER_MATE_NO_SESSION_PROBE === "1") {
|
|
62882
|
+
return { info: await getTokenInfoLocal(), email: null, via: "keychain" };
|
|
62883
|
+
}
|
|
62884
|
+
const now = Date.now();
|
|
62885
|
+
if (sessionCache && now - sessionCache.at < SESSION_CACHE_TTL_MS) {
|
|
62886
|
+
return sessionCache.result;
|
|
62887
|
+
}
|
|
62888
|
+
const result = await resolveSessionUncached();
|
|
62889
|
+
sessionCache = { at: now, result };
|
|
62890
|
+
return result;
|
|
62891
|
+
}
|
|
62835
62892
|
async function getTokenInfo() {
|
|
62893
|
+
return (await getSessionStatus()).info;
|
|
62894
|
+
}
|
|
62895
|
+
async function getTokenInfoLocal() {
|
|
62836
62896
|
const keytar = await getKeytar();
|
|
62837
62897
|
if (keytar) {
|
|
62838
62898
|
try {
|
|
@@ -62844,6 +62904,7 @@ async function getTokenInfo() {
|
|
|
62844
62904
|
return fallbackGet();
|
|
62845
62905
|
}
|
|
62846
62906
|
async function deleteToken() {
|
|
62907
|
+
invalidateSessionCache();
|
|
62847
62908
|
const keytar = await getKeytar();
|
|
62848
62909
|
if (keytar) {
|
|
62849
62910
|
try {
|
|
@@ -62853,13 +62914,100 @@ async function deleteToken() {
|
|
|
62853
62914
|
}
|
|
62854
62915
|
fallbackDelete();
|
|
62855
62916
|
}
|
|
62856
|
-
var SERVICE, ACCOUNT;
|
|
62917
|
+
var SERVICE, ACCOUNT, sessionCache, SESSION_CACHE_TTL_MS;
|
|
62857
62918
|
var init_keychain = __esm({
|
|
62858
62919
|
"src/keychain.ts"() {
|
|
62859
62920
|
"use strict";
|
|
62921
|
+
init_axios2();
|
|
62860
62922
|
init_config2();
|
|
62861
62923
|
SERVICE = "hunter-mate";
|
|
62862
62924
|
ACCOUNT = "user";
|
|
62925
|
+
sessionCache = null;
|
|
62926
|
+
SESSION_CACHE_TTL_MS = 6e4;
|
|
62927
|
+
}
|
|
62928
|
+
});
|
|
62929
|
+
|
|
62930
|
+
// src/saas-token-reporter.ts
|
|
62931
|
+
var saas_token_reporter_exports = {};
|
|
62932
|
+
__export(saas_token_reporter_exports, {
|
|
62933
|
+
clearSaasTokenPendingReport: () => clearSaasTokenPendingReport,
|
|
62934
|
+
ensureServerUsableToken: () => ensureServerUsableToken,
|
|
62935
|
+
markSaasTokenPendingReport: () => markSaasTokenPendingReport,
|
|
62936
|
+
reportPendingSaasTokenIfReachable: () => reportPendingSaasTokenIfReachable
|
|
62937
|
+
});
|
|
62938
|
+
import * as fs5 from "fs";
|
|
62939
|
+
import * as path6 from "path";
|
|
62940
|
+
function pendingFile() {
|
|
62941
|
+
return path6.join(resolveDataDir(), "saas-token-pending.json");
|
|
62942
|
+
}
|
|
62943
|
+
function markSaasTokenPendingReport(token) {
|
|
62944
|
+
try {
|
|
62945
|
+
fs5.mkdirSync(path6.dirname(pendingFile()), { recursive: true });
|
|
62946
|
+
fs5.writeFileSync(
|
|
62947
|
+
pendingFile(),
|
|
62948
|
+
JSON.stringify({ token, markedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
62949
|
+
{ mode: 384 }
|
|
62950
|
+
);
|
|
62951
|
+
} catch {
|
|
62952
|
+
}
|
|
62953
|
+
}
|
|
62954
|
+
function clearSaasTokenPendingReport() {
|
|
62955
|
+
try {
|
|
62956
|
+
if (fs5.existsSync(pendingFile())) {
|
|
62957
|
+
fs5.unlinkSync(pendingFile());
|
|
62958
|
+
}
|
|
62959
|
+
} catch {
|
|
62960
|
+
}
|
|
62961
|
+
}
|
|
62962
|
+
function readPendingToken() {
|
|
62963
|
+
try {
|
|
62964
|
+
if (!fs5.existsSync(pendingFile())) return null;
|
|
62965
|
+
const raw = JSON.parse(fs5.readFileSync(pendingFile(), "utf-8"));
|
|
62966
|
+
return typeof raw?.token === "string" && raw.token ? raw.token : null;
|
|
62967
|
+
} catch {
|
|
62968
|
+
return null;
|
|
62969
|
+
}
|
|
62970
|
+
}
|
|
62971
|
+
async function reportPendingSaasTokenIfReachable(serverUrl) {
|
|
62972
|
+
const token = readPendingToken();
|
|
62973
|
+
if (!token) return "none";
|
|
62974
|
+
try {
|
|
62975
|
+
await axios_default.post(`${serverUrl}/auth/saas-token`, { token }, { proxy: false, timeout: 5e3 });
|
|
62976
|
+
clearSaasTokenPendingReport();
|
|
62977
|
+
return "reported";
|
|
62978
|
+
} catch (err) {
|
|
62979
|
+
if (!err?.response) return "offline";
|
|
62980
|
+
clearSaasTokenPendingReport();
|
|
62981
|
+
return "failed";
|
|
62982
|
+
}
|
|
62983
|
+
}
|
|
62984
|
+
async function ensureServerUsableToken(serverUrl) {
|
|
62985
|
+
const info = await getTokenInfo();
|
|
62986
|
+
if (!info || info.issuer !== "saas") return info;
|
|
62987
|
+
const reported = await reportPendingSaasTokenIfReachable(serverUrl);
|
|
62988
|
+
if (reported === "offline") return info;
|
|
62989
|
+
try {
|
|
62990
|
+
const { data } = await axios_default.get(
|
|
62991
|
+
`${serverUrl}/auth/session`,
|
|
62992
|
+
{ proxy: false, timeout: 5e3 }
|
|
62993
|
+
);
|
|
62994
|
+
if (data?.loggedIn && data.token) {
|
|
62995
|
+
await saveToken(data.token, "local");
|
|
62996
|
+
console.warn(
|
|
62997
|
+
"\u672C\u5730 server \u5DF2\u6062\u590D:SaaS token \u5DF2\u8865\u5F55,\u5E76\u5DF2\u81EA\u52A8\u6362\u53D1\u672C\u5730\u767B\u5F55\u6001,\u672C\u6B21\u547D\u4EE4\u7EE7\u7EED\u4F7F\u7528\u3002"
|
|
62998
|
+
);
|
|
62999
|
+
return { token: data.token, issuer: "local" };
|
|
63000
|
+
}
|
|
63001
|
+
} catch {
|
|
63002
|
+
}
|
|
63003
|
+
return info;
|
|
63004
|
+
}
|
|
63005
|
+
var init_saas_token_reporter = __esm({
|
|
63006
|
+
"src/saas-token-reporter.ts"() {
|
|
63007
|
+
"use strict";
|
|
63008
|
+
init_axios2();
|
|
63009
|
+
init_config2();
|
|
63010
|
+
init_keychain();
|
|
62863
63011
|
}
|
|
62864
63012
|
});
|
|
62865
63013
|
|
|
@@ -68010,6 +68158,31 @@ async function runOpenExt(target) {
|
|
|
68010
68158
|
}
|
|
68011
68159
|
return dir;
|
|
68012
68160
|
}
|
|
68161
|
+
async function runHardReload(target) {
|
|
68162
|
+
const config = loadConfig();
|
|
68163
|
+
try {
|
|
68164
|
+
const res = await axios_default.post(
|
|
68165
|
+
`${config.serverUrl}/extensions/hard-reload`,
|
|
68166
|
+
{ target },
|
|
68167
|
+
{ timeout: 15e3, proxy: false }
|
|
68168
|
+
);
|
|
68169
|
+
const body = res.data ?? {};
|
|
68170
|
+
if (target === "cp") {
|
|
68171
|
+
return { ok: true, msg: `\u2705 \u5DF2\u901A\u8FC7\u4E92\u5907\u8DEF\u5F84\u91CD\u8F7D ChromePilot (${body?.name ?? "peer"})` };
|
|
68172
|
+
}
|
|
68173
|
+
return { ok: true, msg: "\u2705 \u81EA\u68C0\u901A\u8FC7,\u6269\u5C55\u6B63\u5728\u786C\u91CD\u8F7D(SW \u6362\u7801),\u6570\u79D2\u5185\u81EA\u52A8\u56DE\u8FDE" };
|
|
68174
|
+
} catch (e) {
|
|
68175
|
+
const status = e?.response?.status;
|
|
68176
|
+
const message = e?.response?.data?.message ?? e?.message ?? String(e);
|
|
68177
|
+
if (status === 503) {
|
|
68178
|
+
throw new Error(`\u786C\u91CD\u8F7D\u672A\u6267\u884C: \u6269\u5C55\u672A\u8FDE\u63A5(${message});\u786C\u91CD\u8F7D\u4E0D\u6392\u961F\u7A7A\u7B49,\u8BF7 chrome://extensions \u624B\u52A8\u91CD\u8F7D HunterMate \u5361\u7247`, { cause: e });
|
|
68179
|
+
}
|
|
68180
|
+
if (status === 502) {
|
|
68181
|
+
throw new Error(`\u6269\u5C55\u62D2\u7EDD\u786C\u91CD\u8F7D: ${message}`, { cause: e });
|
|
68182
|
+
}
|
|
68183
|
+
throw new Error(`\u786C\u91CD\u8F7D\u8BF7\u6C42\u5931\u8D25: ${message}`, { cause: e });
|
|
68184
|
+
}
|
|
68185
|
+
}
|
|
68013
68186
|
function confirmPrompt(question) {
|
|
68014
68187
|
return new Promise((resolve8) => {
|
|
68015
68188
|
if (!process.stdin.isTTY) return resolve8(false);
|
|
@@ -68152,8 +68325,17 @@ var init_extras = __esm({
|
|
|
68152
68325
|
}
|
|
68153
68326
|
return latest;
|
|
68154
68327
|
};
|
|
68155
|
-
reloadCommand = new Command("reload").description("\u901A\u77E5\u6240\u6709\u5DF2\u8FDE\u63A5\u7684 Chrome \u6269\u5C55\u91CD\u65B0\u52A0\u8F7D\
|
|
68328
|
+
reloadCommand = new Command("reload").description("\u901A\u77E5\u6240\u6709\u5DF2\u8FDE\u63A5\u7684 Chrome \u6269\u5C55\u91CD\u65B0\u52A0\u8F7D(\u9ED8\u8BA4\u8F6F\u91CD\u8F7D\u5E7F\u64AD;--hard \u8D70\u53D7\u63A7\u786C\u91CD\u8F7D,SW \u6362\u7801)").option("--hard [target]", "\u786C\u91CD\u8F7D target=self \u53D7\u63A7 runtime.reload / target=cp \u91CD\u8F7D ChromePilot;\u7F3A\u7701 self").action(async (opts) => {
|
|
68156
68329
|
try {
|
|
68330
|
+
if (opts.hard !== void 0) {
|
|
68331
|
+
const t = opts.hard === true || opts.hard === "" ? "self" : String(opts.hard);
|
|
68332
|
+
if (t !== "self" && t !== "cp") {
|
|
68333
|
+
throw new Error(`\u672A\u77E5 --hard target: ${t}(\u5408\u6CD5\u503C: self | cp)`);
|
|
68334
|
+
}
|
|
68335
|
+
const r2 = await runHardReload(t);
|
|
68336
|
+
console.log(r2.msg);
|
|
68337
|
+
return;
|
|
68338
|
+
}
|
|
68157
68339
|
const r = await runReload();
|
|
68158
68340
|
console.log(r.msg);
|
|
68159
68341
|
} catch (e) {
|
|
@@ -68679,7 +68861,7 @@ async function printCommandError(scope, err) {
|
|
|
68679
68861
|
"\u5F53\u524D token \u7531 SaaS \u7B7E\u53D1(\u767B\u5F55\u65F6\u672C\u5730 server \u672A\u8FD0\u884C),\u672C\u5730 server \u62D2\u7EDD\u4F7F\u7528\u3002\n\u8BF7\u5148\u542F\u52A8\u672C\u5730 server(hunter-mate start),\u518D\u91CD\u65B0\u6267\u884C hunter-mate login\u3002"
|
|
68680
68862
|
);
|
|
68681
68863
|
} else {
|
|
68682
|
-
console.error("\u767B\u5F55\u5DF2\u8FC7\u671F\
|
|
68864
|
+
console.error("\u767B\u5F55\u5DF2\u8FC7\u671F\u3001\u65E0\u6743\u8BBF\u95EE\u6216\u5DF2\u5728 Web \u7AEF\u9000\u51FA,\u8BF7\u8FD0\u884C hunter-mate login \u540E\u91CD\u8BD5");
|
|
68683
68865
|
}
|
|
68684
68866
|
return;
|
|
68685
68867
|
}
|
|
@@ -68696,6 +68878,83 @@ var init_command_error = __esm({
|
|
|
68696
68878
|
}
|
|
68697
68879
|
});
|
|
68698
68880
|
|
|
68881
|
+
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js
|
|
68882
|
+
import crypto2 from "crypto";
|
|
68883
|
+
function rng() {
|
|
68884
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
68885
|
+
crypto2.randomFillSync(rnds8Pool);
|
|
68886
|
+
poolPtr = 0;
|
|
68887
|
+
}
|
|
68888
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
68889
|
+
}
|
|
68890
|
+
var rnds8Pool, poolPtr;
|
|
68891
|
+
var init_rng = __esm({
|
|
68892
|
+
"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js"() {
|
|
68893
|
+
rnds8Pool = new Uint8Array(256);
|
|
68894
|
+
poolPtr = rnds8Pool.length;
|
|
68895
|
+
}
|
|
68896
|
+
});
|
|
68897
|
+
|
|
68898
|
+
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/stringify.js
|
|
68899
|
+
function unsafeStringify(arr, offset = 0) {
|
|
68900
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
68901
|
+
}
|
|
68902
|
+
var byteToHex;
|
|
68903
|
+
var init_stringify = __esm({
|
|
68904
|
+
"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/stringify.js"() {
|
|
68905
|
+
byteToHex = [];
|
|
68906
|
+
for (let i = 0; i < 256; ++i) {
|
|
68907
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
68908
|
+
}
|
|
68909
|
+
}
|
|
68910
|
+
});
|
|
68911
|
+
|
|
68912
|
+
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js
|
|
68913
|
+
import crypto3 from "crypto";
|
|
68914
|
+
var native_default;
|
|
68915
|
+
var init_native = __esm({
|
|
68916
|
+
"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js"() {
|
|
68917
|
+
native_default = {
|
|
68918
|
+
randomUUID: crypto3.randomUUID
|
|
68919
|
+
};
|
|
68920
|
+
}
|
|
68921
|
+
});
|
|
68922
|
+
|
|
68923
|
+
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v4.js
|
|
68924
|
+
function v4(options, buf, offset) {
|
|
68925
|
+
if (native_default.randomUUID && !buf && !options) {
|
|
68926
|
+
return native_default.randomUUID();
|
|
68927
|
+
}
|
|
68928
|
+
options = options || {};
|
|
68929
|
+
const rnds = options.random || (options.rng || rng)();
|
|
68930
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
68931
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
68932
|
+
if (buf) {
|
|
68933
|
+
offset = offset || 0;
|
|
68934
|
+
for (let i = 0; i < 16; ++i) {
|
|
68935
|
+
buf[offset + i] = rnds[i];
|
|
68936
|
+
}
|
|
68937
|
+
return buf;
|
|
68938
|
+
}
|
|
68939
|
+
return unsafeStringify(rnds);
|
|
68940
|
+
}
|
|
68941
|
+
var v4_default;
|
|
68942
|
+
var init_v4 = __esm({
|
|
68943
|
+
"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v4.js"() {
|
|
68944
|
+
init_native();
|
|
68945
|
+
init_rng();
|
|
68946
|
+
init_stringify();
|
|
68947
|
+
v4_default = v4;
|
|
68948
|
+
}
|
|
68949
|
+
});
|
|
68950
|
+
|
|
68951
|
+
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/index.js
|
|
68952
|
+
var init_esm_node = __esm({
|
|
68953
|
+
"../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/index.js"() {
|
|
68954
|
+
init_v4();
|
|
68955
|
+
}
|
|
68956
|
+
});
|
|
68957
|
+
|
|
68699
68958
|
// src/utils/proxy-detect.ts
|
|
68700
68959
|
var proxy_detect_exports = {};
|
|
68701
68960
|
__export(proxy_detect_exports, {
|
|
@@ -69948,6 +70207,287 @@ var init_auto_doctor = __esm({
|
|
|
69948
70207
|
}
|
|
69949
70208
|
});
|
|
69950
70209
|
|
|
70210
|
+
// src/hmh-sync.ts
|
|
70211
|
+
var hmh_sync_exports = {};
|
|
70212
|
+
__export(hmh_sync_exports, {
|
|
70213
|
+
maybeSyncHmhLocal: () => maybeSyncHmhLocal,
|
|
70214
|
+
parseFrontmatter: () => parseFrontmatter,
|
|
70215
|
+
resolveHmhLocalDir: () => resolveHmhLocalDir
|
|
70216
|
+
});
|
|
70217
|
+
import * as fs28 from "fs";
|
|
70218
|
+
import * as path30 from "path";
|
|
70219
|
+
function intervalMs() {
|
|
70220
|
+
const raw = Number(process.env.HUNTER_MATE_HMH_SYNC_INTERVAL_MS);
|
|
70221
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_INTERVAL_MS2;
|
|
70222
|
+
}
|
|
70223
|
+
function stateFile() {
|
|
70224
|
+
return path30.join(resolveDataDir(), "hmh-sync-state.json");
|
|
70225
|
+
}
|
|
70226
|
+
function readState() {
|
|
70227
|
+
try {
|
|
70228
|
+
return JSON.parse(fs28.readFileSync(stateFile(), "utf8"));
|
|
70229
|
+
} catch {
|
|
70230
|
+
return {};
|
|
70231
|
+
}
|
|
70232
|
+
}
|
|
70233
|
+
function writeState(state) {
|
|
70234
|
+
try {
|
|
70235
|
+
fs28.mkdirSync(path30.dirname(stateFile()), { recursive: true });
|
|
70236
|
+
fs28.writeFileSync(stateFile(), JSON.stringify(state));
|
|
70237
|
+
} catch {
|
|
70238
|
+
}
|
|
70239
|
+
}
|
|
70240
|
+
function resolveHmhLocalDir() {
|
|
70241
|
+
const candidates = [];
|
|
70242
|
+
const envPath = process.env.HUNTER_MATE_HARNESS_PATH?.trim();
|
|
70243
|
+
if (envPath) candidates.push(envPath);
|
|
70244
|
+
try {
|
|
70245
|
+
const cfg = loadConfig();
|
|
70246
|
+
if (cfg?.harnessPath?.trim()) candidates.push(cfg.harnessPath.trim());
|
|
70247
|
+
} catch {
|
|
70248
|
+
}
|
|
70249
|
+
const home = process.env.HUNTER_MATE_HOME || process.env.HOME || process.env.USERPROFILE;
|
|
70250
|
+
if (home) candidates.push(path30.join(home, "Projects", "hunter-mate-harness"));
|
|
70251
|
+
for (const root of candidates) {
|
|
70252
|
+
const local = path30.join(root, "local");
|
|
70253
|
+
if (fs28.existsSync(path30.join(local, "clients"))) return local;
|
|
70254
|
+
}
|
|
70255
|
+
return null;
|
|
70256
|
+
}
|
|
70257
|
+
function parseFrontmatter(text) {
|
|
70258
|
+
const m = text.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
70259
|
+
if (!m) return {};
|
|
70260
|
+
const meta = {};
|
|
70261
|
+
for (const line of m[1].split(/\r?\n/)) {
|
|
70262
|
+
const idx = line.indexOf(":");
|
|
70263
|
+
if (idx <= 0) continue;
|
|
70264
|
+
const key = line.slice(0, idx).trim();
|
|
70265
|
+
let value = line.slice(idx + 1).trim();
|
|
70266
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1);
|
|
70267
|
+
meta[key] = value;
|
|
70268
|
+
}
|
|
70269
|
+
return meta;
|
|
70270
|
+
}
|
|
70271
|
+
function updateIndexField(indexFile, key, value) {
|
|
70272
|
+
let text = fs28.readFileSync(indexFile, "utf8");
|
|
70273
|
+
const re2 = new RegExp(`^(${key}:\\s*).*$`, "m");
|
|
70274
|
+
if (re2.test(text)) {
|
|
70275
|
+
text = text.replace(re2, `$1${value}`);
|
|
70276
|
+
} else {
|
|
70277
|
+
text = text.replace(/^---\r?\n/m, `---
|
|
70278
|
+
${key}: ${value}
|
|
70279
|
+
`);
|
|
70280
|
+
}
|
|
70281
|
+
fs28.writeFileSync(indexFile, text, "utf8");
|
|
70282
|
+
}
|
|
70283
|
+
function cleanValue(v) {
|
|
70284
|
+
if (!v) return "";
|
|
70285
|
+
const t = v.trim();
|
|
70286
|
+
if (!t || t.includes("|") || t.startsWith("{")) return "";
|
|
70287
|
+
return t;
|
|
70288
|
+
}
|
|
70289
|
+
function looseName(s) {
|
|
70290
|
+
return s.trim().toLowerCase().replace(/\s+/g, " ");
|
|
70291
|
+
}
|
|
70292
|
+
async function authedHeaders5() {
|
|
70293
|
+
const token = await getToken().catch(() => void 0);
|
|
70294
|
+
return token ? { Authorization: `UTOKEN ${token}` } : {};
|
|
70295
|
+
}
|
|
70296
|
+
function collectJobFiles2(dir, relPrefix = "", out = {}) {
|
|
70297
|
+
const entries = fs28.readdirSync(dir, { withFileTypes: true }).sort((a, b2) => a.name.localeCompare(b2.name));
|
|
70298
|
+
for (const entry of entries) {
|
|
70299
|
+
if (entry.isFile() && /\.(md|txt|pdf)$/.test(entry.name)) {
|
|
70300
|
+
out[relPrefix + entry.name] = fs28.readFileSync(path30.join(dir, entry.name), "utf-8");
|
|
70301
|
+
}
|
|
70302
|
+
}
|
|
70303
|
+
for (const entry of entries) {
|
|
70304
|
+
if (entry.isDirectory()) {
|
|
70305
|
+
collectJobFiles2(path30.join(dir, entry.name), relPrefix + entry.name + "/", out);
|
|
70306
|
+
}
|
|
70307
|
+
}
|
|
70308
|
+
return out;
|
|
70309
|
+
}
|
|
70310
|
+
function listIndexDirs(parent) {
|
|
70311
|
+
if (!fs28.existsSync(parent)) return [];
|
|
70312
|
+
return fs28.readdirSync(parent, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith("_")).map((e) => path30.join(parent, e.name)).filter((dir) => fs28.existsSync(path30.join(dir, "INDEX.md")));
|
|
70313
|
+
}
|
|
70314
|
+
async function maybeSyncHmhLocal() {
|
|
70315
|
+
const report = { changes: [], errors: [] };
|
|
70316
|
+
if (process.env.HUNTER_MATE_NO_HMH_SYNC === "1") {
|
|
70317
|
+
report.skipped = "disabled";
|
|
70318
|
+
return report;
|
|
70319
|
+
}
|
|
70320
|
+
const localDir = resolveHmhLocalDir();
|
|
70321
|
+
if (!localDir) {
|
|
70322
|
+
report.skipped = "no-local-dir";
|
|
70323
|
+
return report;
|
|
70324
|
+
}
|
|
70325
|
+
const now = Date.now();
|
|
70326
|
+
const state = readState();
|
|
70327
|
+
if (state.lastRunAt && now - state.lastRunAt < intervalMs()) {
|
|
70328
|
+
report.skipped = "throttled";
|
|
70329
|
+
return report;
|
|
70330
|
+
}
|
|
70331
|
+
state.lastRunAt = now;
|
|
70332
|
+
state.recreated = state.recreated ?? {};
|
|
70333
|
+
state.suppressed = state.suppressed ?? {};
|
|
70334
|
+
const persistState = () => writeState(state);
|
|
70335
|
+
const config = loadConfig();
|
|
70336
|
+
const serverUrl = config.serverUrl.replace(/\/$/, "");
|
|
70337
|
+
const headers = await authedHeaders5();
|
|
70338
|
+
const log3 = getCliLogger();
|
|
70339
|
+
try {
|
|
70340
|
+
const customersRes = await axios_default.get(`${serverUrl}/customers`, { headers, proxy: false, timeout: HTTP_TIMEOUT_MS });
|
|
70341
|
+
const customers = Array.isArray(customersRes.data) ? customersRes.data : [];
|
|
70342
|
+
const customerById = new Map(customers.map((c) => [c.id, c]));
|
|
70343
|
+
const jobCases = /* @__PURE__ */ new Map();
|
|
70344
|
+
let offset = 0;
|
|
70345
|
+
for (; ; ) {
|
|
70346
|
+
const res = await axios_default.get(`${serverUrl}/job-cases`, {
|
|
70347
|
+
params: { limit: 200, offset },
|
|
70348
|
+
headers,
|
|
70349
|
+
proxy: false,
|
|
70350
|
+
timeout: HTTP_TIMEOUT_MS
|
|
70351
|
+
});
|
|
70352
|
+
const items = Array.isArray(res.data) ? res.data : res.data?.items ?? [];
|
|
70353
|
+
for (const j of items) {
|
|
70354
|
+
if (j.externalId) jobCases.set(j.externalId, j);
|
|
70355
|
+
}
|
|
70356
|
+
const total = Array.isArray(res.data) ? items.length : res.data?.total ?? items.length;
|
|
70357
|
+
offset += items.length;
|
|
70358
|
+
if (!items.length || offset >= total) break;
|
|
70359
|
+
}
|
|
70360
|
+
const clientsDir = path30.join(localDir, "clients");
|
|
70361
|
+
for (const clientDir of listIndexDirs(clientsDir)) {
|
|
70362
|
+
const indexFile = path30.join(clientDir, "INDEX.md");
|
|
70363
|
+
const meta = parseFrontmatter(fs28.readFileSync(indexFile, "utf8"));
|
|
70364
|
+
const clientName = cleanValue(meta.client) || path30.basename(clientDir);
|
|
70365
|
+
report.checkedClients = (report.checkedClients ?? 0) + 1;
|
|
70366
|
+
const wantName = looseName(clientName);
|
|
70367
|
+
let customerId;
|
|
70368
|
+
const stamped = Number(meta.customer_id);
|
|
70369
|
+
const custGuardKey = `cust:${path30.basename(clientDir)}:${stamped}`;
|
|
70370
|
+
const stampedCustomer = Number.isInteger(stamped) && stamped > 0 ? customerById.get(stamped) : void 0;
|
|
70371
|
+
const nameMatches = (c) => !!c && (looseName(c.canonicalName) === wantName || (c.aliases ?? []).some((a) => looseName(a) === wantName));
|
|
70372
|
+
if (stampedCustomer && nameMatches(stampedCustomer)) {
|
|
70373
|
+
customerId = stampedCustomer.id;
|
|
70374
|
+
} else if (!stampedCustomer && state.recreated[custGuardKey] && !state.suppressed[custGuardKey]) {
|
|
70375
|
+
state.suppressed[custGuardKey] = now;
|
|
70376
|
+
delete state.recreated[custGuardKey];
|
|
70377
|
+
report.changes.push({
|
|
70378
|
+
kind: "customer",
|
|
70379
|
+
name: clientName,
|
|
70380
|
+
detail: `\u68C0\u6D4B\u5230\u4F60\u5728 server \u5220\u9664\u4E86\u8BE5\u5BA2\u6237([${stamped}]),\u5DF2\u505C\u6B62\u81EA\u52A8\u91CD\u5EFA(\u5982\u9700\u6062\u590D\u8BF7\u91CD\u8DD1 hmx client-create)`
|
|
70381
|
+
});
|
|
70382
|
+
} else if (!stampedCustomer && state.suppressed[custGuardKey]) {
|
|
70383
|
+
continue;
|
|
70384
|
+
} else {
|
|
70385
|
+
if (stampedCustomer) {
|
|
70386
|
+
report.errors.push(`customer \u5F20\u51A0\u674E\u6234: ${clientName} stamp=${stamped} \u5B9E\u4E3A ${stampedCustomer.canonicalName}`);
|
|
70387
|
+
}
|
|
70388
|
+
const status = cleanValue(meta.status);
|
|
70389
|
+
const upsertRes = await axios_default.post(
|
|
70390
|
+
`${serverUrl}/customers`,
|
|
70391
|
+
{
|
|
70392
|
+
name: clientName,
|
|
70393
|
+
typeStatus: status ? { status } : void 0,
|
|
70394
|
+
notes: cleanValue(meta.industry) ? `\u884C\u4E1A: ${cleanValue(meta.industry)}` : void 0
|
|
70395
|
+
},
|
|
70396
|
+
{ headers, proxy: false, timeout: HTTP_TIMEOUT_MS }
|
|
70397
|
+
);
|
|
70398
|
+
const created = upsertRes.data?.customer;
|
|
70399
|
+
if (!created?.id) throw new Error(`customer upsert \u65E0\u8FD4\u56DE id: ${clientName}`);
|
|
70400
|
+
customerId = created.id;
|
|
70401
|
+
customerById.set(created.id, { id: created.id, canonicalName: created.canonicalName ?? clientName, aliases: created.aliases ?? [] });
|
|
70402
|
+
updateIndexField(indexFile, "customer_id", String(created.id));
|
|
70403
|
+
state.recreated[`cust:${path30.basename(clientDir)}:${created.id}`] = now;
|
|
70404
|
+
report.changes.push({
|
|
70405
|
+
kind: "customer",
|
|
70406
|
+
name: clientName,
|
|
70407
|
+
detail: stampedCustomer ? `stamp ${stamped} \u5F20\u51A0\u674E\u6234,\u5DF2 upsert \u4E3A [${created.id}] \u5E76\u56DE\u5199 INDEX.md` : `\u5DF2 upsert \u4E3A [${created.id}] \u5E76\u56DE\u5199 INDEX.md`
|
|
70408
|
+
});
|
|
70409
|
+
}
|
|
70410
|
+
const positionsDir = path30.join(clientDir, "positions");
|
|
70411
|
+
for (const posDir of listIndexDirs(positionsDir)) {
|
|
70412
|
+
const posIndexFile = path30.join(posDir, "INDEX.md");
|
|
70413
|
+
const posMeta = parseFrontmatter(fs28.readFileSync(posIndexFile, "utf8"));
|
|
70414
|
+
const posName = cleanValue(posMeta.position) || path30.basename(posDir);
|
|
70415
|
+
report.checkedPositions = (report.checkedPositions ?? 0) + 1;
|
|
70416
|
+
const posCustomerStamped = Number(posMeta.customer_id);
|
|
70417
|
+
if (Number.isInteger(posCustomerStamped) && posCustomerStamped > 0 && customerId && posCustomerStamped !== customerId) {
|
|
70418
|
+
updateIndexField(posIndexFile, "customer_id", String(customerId));
|
|
70419
|
+
report.changes.push({
|
|
70420
|
+
kind: "jobcase",
|
|
70421
|
+
name: `${clientName}/${posName}`,
|
|
70422
|
+
detail: `customer_id ${posCustomerStamped} \u2192 ${customerId}(\u968F\u5BA2\u6237\u6F02\u79FB\u7EA0\u6B63)`
|
|
70423
|
+
});
|
|
70424
|
+
}
|
|
70425
|
+
const stampedJobcase = cleanValue(posMeta.jobcase_id);
|
|
70426
|
+
if (stampedJobcase && jobCases.has(stampedJobcase)) {
|
|
70427
|
+
if (state.recreated[`jc:${stampedJobcase}`]) state.recreated[`jc:${stampedJobcase}`] = now;
|
|
70428
|
+
continue;
|
|
70429
|
+
}
|
|
70430
|
+
if (stampedJobcase && state.suppressed[`jc:${stampedJobcase}`]) continue;
|
|
70431
|
+
if (stampedJobcase && state.recreated[`jc:${stampedJobcase}`]) {
|
|
70432
|
+
state.suppressed[`jc:${stampedJobcase}`] = now;
|
|
70433
|
+
delete state.recreated[`jc:${stampedJobcase}`];
|
|
70434
|
+
report.changes.push({
|
|
70435
|
+
kind: "jobcase",
|
|
70436
|
+
name: `${clientName}/${posName}`,
|
|
70437
|
+
detail: "\u68C0\u6D4B\u5230\u4F60\u5728 server \u5220\u9664\u4E86\u8BE5 case,\u5DF2\u505C\u6B62\u81EA\u52A8\u91CD\u5EFA(\u5982\u9700\u6062\u590D\u8BF7\u91CD\u8DD1 hmx job-create)"
|
|
70438
|
+
});
|
|
70439
|
+
continue;
|
|
70440
|
+
}
|
|
70441
|
+
const rawFiles = collectJobFiles2(posDir);
|
|
70442
|
+
if (!Object.keys(rawFiles).length) continue;
|
|
70443
|
+
const externalId = /^[a-f0-9-]{36}$/i.test(stampedJobcase) ? stampedJobcase : v4_default();
|
|
70444
|
+
const createRes = await axios_default.post(
|
|
70445
|
+
`${serverUrl}/job-cases`,
|
|
70446
|
+
{ externalId, title: posName, folderPath: posDir, rawFiles, customerId },
|
|
70447
|
+
{ headers, proxy: false, timeout: HTTP_TIMEOUT_MS }
|
|
70448
|
+
);
|
|
70449
|
+
const createdCase = createRes.data;
|
|
70450
|
+
jobCases.set(externalId, { id: createdCase?.id, externalId, customerId });
|
|
70451
|
+
state.recreated[`jc:${externalId}`] = now;
|
|
70452
|
+
if (stampedJobcase !== externalId) {
|
|
70453
|
+
updateIndexField(posIndexFile, "jobcase_id", externalId);
|
|
70454
|
+
}
|
|
70455
|
+
report.changes.push({
|
|
70456
|
+
kind: "jobcase",
|
|
70457
|
+
name: `${clientName}/${posName}`,
|
|
70458
|
+
detail: `jobcase \u7F3A\u5931,\u5DF2\u91CD\u5EFA [#${createdCase?.id}] (customer=${customerId})`
|
|
70459
|
+
});
|
|
70460
|
+
}
|
|
70461
|
+
}
|
|
70462
|
+
} catch (err) {
|
|
70463
|
+
const msg = err?.response?.data?.message || err?.message || String(err);
|
|
70464
|
+
report.errors.push(msg);
|
|
70465
|
+
}
|
|
70466
|
+
if (report.changes.length || report.errors.length) {
|
|
70467
|
+
log3.info("hmh-sync:done", {
|
|
70468
|
+
checkedClients: report.checkedClients ?? 0,
|
|
70469
|
+
checkedPositions: report.checkedPositions ?? 0,
|
|
70470
|
+
changes: report.changes,
|
|
70471
|
+
errors: report.errors
|
|
70472
|
+
});
|
|
70473
|
+
}
|
|
70474
|
+
persistState();
|
|
70475
|
+
return report;
|
|
70476
|
+
}
|
|
70477
|
+
var DEFAULT_INTERVAL_MS2, HTTP_TIMEOUT_MS;
|
|
70478
|
+
var init_hmh_sync = __esm({
|
|
70479
|
+
"src/hmh-sync.ts"() {
|
|
70480
|
+
"use strict";
|
|
70481
|
+
init_axios2();
|
|
70482
|
+
init_esm_node();
|
|
70483
|
+
init_config2();
|
|
70484
|
+
init_keychain();
|
|
70485
|
+
init_logger3();
|
|
70486
|
+
DEFAULT_INTERVAL_MS2 = 10 * 60 * 1e3;
|
|
70487
|
+
HTTP_TIMEOUT_MS = 8e3;
|
|
70488
|
+
}
|
|
70489
|
+
});
|
|
70490
|
+
|
|
69951
70491
|
// ../../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/config.js
|
|
69952
70492
|
(function() {
|
|
69953
70493
|
require_main().config(
|
|
@@ -69974,80 +70514,7 @@ init_esm();
|
|
|
69974
70514
|
init_axios2();
|
|
69975
70515
|
var import_open = __toESM(require_open(), 1);
|
|
69976
70516
|
init_config2();
|
|
69977
|
-
|
|
69978
|
-
// src/saas-token-reporter.ts
|
|
69979
|
-
init_axios2();
|
|
69980
|
-
init_config2();
|
|
69981
|
-
init_keychain();
|
|
69982
|
-
import * as fs5 from "fs";
|
|
69983
|
-
import * as path6 from "path";
|
|
69984
|
-
function pendingFile() {
|
|
69985
|
-
return path6.join(resolveDataDir(), "saas-token-pending.json");
|
|
69986
|
-
}
|
|
69987
|
-
function markSaasTokenPendingReport(token) {
|
|
69988
|
-
try {
|
|
69989
|
-
fs5.mkdirSync(path6.dirname(pendingFile()), { recursive: true });
|
|
69990
|
-
fs5.writeFileSync(
|
|
69991
|
-
pendingFile(),
|
|
69992
|
-
JSON.stringify({ token, markedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
69993
|
-
{ mode: 384 }
|
|
69994
|
-
);
|
|
69995
|
-
} catch {
|
|
69996
|
-
}
|
|
69997
|
-
}
|
|
69998
|
-
function clearSaasTokenPendingReport() {
|
|
69999
|
-
try {
|
|
70000
|
-
if (fs5.existsSync(pendingFile())) {
|
|
70001
|
-
fs5.unlinkSync(pendingFile());
|
|
70002
|
-
}
|
|
70003
|
-
} catch {
|
|
70004
|
-
}
|
|
70005
|
-
}
|
|
70006
|
-
function readPendingToken() {
|
|
70007
|
-
try {
|
|
70008
|
-
if (!fs5.existsSync(pendingFile())) return null;
|
|
70009
|
-
const raw = JSON.parse(fs5.readFileSync(pendingFile(), "utf-8"));
|
|
70010
|
-
return typeof raw?.token === "string" && raw.token ? raw.token : null;
|
|
70011
|
-
} catch {
|
|
70012
|
-
return null;
|
|
70013
|
-
}
|
|
70014
|
-
}
|
|
70015
|
-
async function reportPendingSaasTokenIfReachable(serverUrl) {
|
|
70016
|
-
const token = readPendingToken();
|
|
70017
|
-
if (!token) return "none";
|
|
70018
|
-
try {
|
|
70019
|
-
await axios_default.post(`${serverUrl}/auth/saas-token`, { token }, { proxy: false, timeout: 5e3 });
|
|
70020
|
-
clearSaasTokenPendingReport();
|
|
70021
|
-
return "reported";
|
|
70022
|
-
} catch (err) {
|
|
70023
|
-
if (!err?.response) return "offline";
|
|
70024
|
-
clearSaasTokenPendingReport();
|
|
70025
|
-
return "failed";
|
|
70026
|
-
}
|
|
70027
|
-
}
|
|
70028
|
-
async function ensureServerUsableToken(serverUrl) {
|
|
70029
|
-
const info = await getTokenInfo();
|
|
70030
|
-
if (!info || info.issuer !== "saas") return info;
|
|
70031
|
-
const reported = await reportPendingSaasTokenIfReachable(serverUrl);
|
|
70032
|
-
if (reported === "offline") return info;
|
|
70033
|
-
try {
|
|
70034
|
-
const { data } = await axios_default.get(
|
|
70035
|
-
`${serverUrl}/auth/session`,
|
|
70036
|
-
{ proxy: false, timeout: 5e3 }
|
|
70037
|
-
);
|
|
70038
|
-
if (data?.loggedIn && data.token) {
|
|
70039
|
-
await saveToken(data.token, "local");
|
|
70040
|
-
console.warn(
|
|
70041
|
-
"\u672C\u5730 server \u5DF2\u6062\u590D:SaaS token \u5DF2\u8865\u5F55,\u5E76\u5DF2\u81EA\u52A8\u6362\u53D1\u672C\u5730\u767B\u5F55\u6001,\u672C\u6B21\u547D\u4EE4\u7EE7\u7EED\u4F7F\u7528\u3002"
|
|
70042
|
-
);
|
|
70043
|
-
return { token: data.token, issuer: "local" };
|
|
70044
|
-
}
|
|
70045
|
-
} catch {
|
|
70046
|
-
}
|
|
70047
|
-
return info;
|
|
70048
|
-
}
|
|
70049
|
-
|
|
70050
|
-
// src/commands/login.ts
|
|
70517
|
+
init_saas_token_reporter();
|
|
70051
70518
|
init_keychain();
|
|
70052
70519
|
init_i18n();
|
|
70053
70520
|
init_logger3();
|
|
@@ -70225,9 +70692,22 @@ var loginCommand = new Command("login").description(i18n.t("login.description"))
|
|
|
70225
70692
|
|
|
70226
70693
|
// src/commands/logout.ts
|
|
70227
70694
|
init_esm();
|
|
70695
|
+
init_axios2();
|
|
70228
70696
|
init_keychain();
|
|
70697
|
+
init_config2();
|
|
70698
|
+
init_saas_token_reporter();
|
|
70229
70699
|
init_i18n();
|
|
70230
70700
|
async function runLogout() {
|
|
70701
|
+
const token = await getToken().catch(() => null);
|
|
70702
|
+
if (token) {
|
|
70703
|
+
const config = loadConfig();
|
|
70704
|
+
await axios_default.post(
|
|
70705
|
+
`${config.serverUrl}/auth/logout`,
|
|
70706
|
+
{},
|
|
70707
|
+
{ headers: { Authorization: `UTOKEN ${token}` }, proxy: false, timeout: 5e3 }
|
|
70708
|
+
).catch(() => {
|
|
70709
|
+
});
|
|
70710
|
+
}
|
|
70231
70711
|
await deleteToken();
|
|
70232
70712
|
clearSaasTokenPendingReport();
|
|
70233
70713
|
}
|
|
@@ -70246,7 +70726,8 @@ init_version3();
|
|
|
70246
70726
|
init_logger3();
|
|
70247
70727
|
async function runStatus() {
|
|
70248
70728
|
const config = loadConfig();
|
|
70249
|
-
const
|
|
70729
|
+
const session = await getSessionStatus();
|
|
70730
|
+
const tokenInfo = session.info;
|
|
70250
70731
|
const token = tokenInfo?.token ?? null;
|
|
70251
70732
|
let serverStatus = "unknown";
|
|
70252
70733
|
let extensions = [];
|
|
@@ -70268,6 +70749,8 @@ async function runStatus() {
|
|
|
70268
70749
|
return {
|
|
70269
70750
|
version: installed.cli ?? "0.0.0",
|
|
70270
70751
|
loggedIn: !!token,
|
|
70752
|
+
loginEmail: session.email ?? void 0,
|
|
70753
|
+
loginVia: session.via,
|
|
70271
70754
|
tokenIssuer: tokenInfo?.issuer,
|
|
70272
70755
|
server: serverStatus,
|
|
70273
70756
|
serverUrl: config.serverUrl,
|
|
@@ -70285,7 +70768,7 @@ var statusCommand = new Command("status").description(i18n.t("status.description
|
|
|
70285
70768
|
return;
|
|
70286
70769
|
}
|
|
70287
70770
|
console.log(`${i18n.t("status.cli")}: ${status.version}`);
|
|
70288
|
-
const loggedInText = status.loggedIn ? status.tokenIssuer === "saas" ? "yes (SaaS \u7B7E\u53D1 \u2014 \u672C\u5730 server \u4F1A\u62D2\u7EDD,\u542F\u52A8 server \u540E\u8BF7\u91CD\u65B0\u767B\u5F55)" : "yes" : "no";
|
|
70771
|
+
const loggedInText = status.loggedIn ? status.tokenIssuer === "saas" ? "yes (SaaS \u7B7E\u53D1 \u2014 \u672C\u5730 server \u4F1A\u62D2\u7EDD,\u542F\u52A8 server \u540E\u8BF7\u91CD\u65B0\u767B\u5F55)" : status.loginEmail ? `yes (${status.loginEmail})` : "yes" : "no";
|
|
70289
70772
|
console.log(`${i18n.t("status.loggedIn")}: ${loggedInText}`);
|
|
70290
70773
|
console.log(`${i18n.t("status.server")}: ${status.server} (${status.serverUrl})`);
|
|
70291
70774
|
console.log(`dataDir: ${status.dataDir}`);
|
|
@@ -70342,6 +70825,7 @@ var configCommand = new Command("config").description(i18n.t("config.description
|
|
|
70342
70825
|
init_esm();
|
|
70343
70826
|
init_axios2();
|
|
70344
70827
|
init_config2();
|
|
70828
|
+
init_saas_token_reporter();
|
|
70345
70829
|
init_i18n();
|
|
70346
70830
|
init_command_error();
|
|
70347
70831
|
async function runSearch(options) {
|
|
@@ -70382,56 +70866,10 @@ var searchCommand = new Command("search").description(i18n.t("search.description
|
|
|
70382
70866
|
// src/commands/job.ts
|
|
70383
70867
|
init_esm();
|
|
70384
70868
|
init_axios2();
|
|
70869
|
+
init_esm_node();
|
|
70385
70870
|
import * as fs15 from "fs";
|
|
70386
70871
|
import * as path17 from "path";
|
|
70387
70872
|
|
|
70388
|
-
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js
|
|
70389
|
-
import crypto2 from "crypto";
|
|
70390
|
-
var rnds8Pool = new Uint8Array(256);
|
|
70391
|
-
var poolPtr = rnds8Pool.length;
|
|
70392
|
-
function rng() {
|
|
70393
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
70394
|
-
crypto2.randomFillSync(rnds8Pool);
|
|
70395
|
-
poolPtr = 0;
|
|
70396
|
-
}
|
|
70397
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
70398
|
-
}
|
|
70399
|
-
|
|
70400
|
-
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/stringify.js
|
|
70401
|
-
var byteToHex = [];
|
|
70402
|
-
for (let i = 0; i < 256; ++i) {
|
|
70403
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
70404
|
-
}
|
|
70405
|
-
function unsafeStringify(arr, offset = 0) {
|
|
70406
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
70407
|
-
}
|
|
70408
|
-
|
|
70409
|
-
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js
|
|
70410
|
-
import crypto3 from "crypto";
|
|
70411
|
-
var native_default = {
|
|
70412
|
-
randomUUID: crypto3.randomUUID
|
|
70413
|
-
};
|
|
70414
|
-
|
|
70415
|
-
// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v4.js
|
|
70416
|
-
function v4(options, buf, offset) {
|
|
70417
|
-
if (native_default.randomUUID && !buf && !options) {
|
|
70418
|
-
return native_default.randomUUID();
|
|
70419
|
-
}
|
|
70420
|
-
options = options || {};
|
|
70421
|
-
const rnds = options.random || (options.rng || rng)();
|
|
70422
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
70423
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
70424
|
-
if (buf) {
|
|
70425
|
-
offset = offset || 0;
|
|
70426
|
-
for (let i = 0; i < 16; ++i) {
|
|
70427
|
-
buf[offset + i] = rnds[i];
|
|
70428
|
-
}
|
|
70429
|
-
return buf;
|
|
70430
|
-
}
|
|
70431
|
-
return unsafeStringify(rnds);
|
|
70432
|
-
}
|
|
70433
|
-
var v4_default = v4;
|
|
70434
|
-
|
|
70435
70873
|
// src/cache/db.ts
|
|
70436
70874
|
init_config2();
|
|
70437
70875
|
import * as fs14 from "fs";
|
|
@@ -70700,7 +71138,8 @@ async function runJobList() {
|
|
|
70700
71138
|
proxy: false,
|
|
70701
71139
|
timeout: 8e3
|
|
70702
71140
|
});
|
|
70703
|
-
const
|
|
71141
|
+
const payload = res.data;
|
|
71142
|
+
const list = Array.isArray(payload) ? payload : Array.isArray(payload?.items) ? payload.items : [];
|
|
70704
71143
|
return list.length ? list : listJobCases();
|
|
70705
71144
|
} catch (err) {
|
|
70706
71145
|
if (err?.response?.status === 401 || err?.response?.status === 403) {
|
|
@@ -70943,9 +71382,10 @@ reportCommand.command("sales <customerId>").description("\u751F\u6210 BD \u9500\
|
|
|
70943
71382
|
// src/commands/record.ts
|
|
70944
71383
|
init_esm();
|
|
70945
71384
|
init_axios2();
|
|
70946
|
-
|
|
71385
|
+
init_esm_node();
|
|
70947
71386
|
init_config2();
|
|
70948
71387
|
init_keychain();
|
|
71388
|
+
import * as fs20 from "fs";
|
|
70949
71389
|
init_command_error();
|
|
70950
71390
|
async function runRecordTranscript(filePath, options) {
|
|
70951
71391
|
const config = loadConfig();
|
|
@@ -71806,6 +72246,19 @@ withFormat(recordingsCommand.command("list").description("\u5217\u51FA\u5F55\u52
|
|
|
71806
72246
|
process.exit(1);
|
|
71807
72247
|
}
|
|
71808
72248
|
});
|
|
72249
|
+
recordingsCommand.command("run <url>").description("\u811A\u672C\u9A71\u52A8\u5F55\u5236:\u6309 adapter.recording.operations \u6267\u884C\u5E76\u81EA\u52A8\u89E3\u6790(\u767D\u540D\u5355\u5916 URL \u62D2\u7EDD)").option("--adapter <file>", "\u6307\u5B9A adapter \u76F8\u5BF9\u8DEF\u5F84(\u9ED8\u8BA4\u53D6\u767D\u540D\u5355\u547D\u4E2D\u7684\u89C4\u5219 externalId)").option("--title <text>", "\u5F55\u5236\u6807\u9898").action(async (url2, opts) => {
|
|
72250
|
+
try {
|
|
72251
|
+
const r = await http7().post("/api/recordings/run", {
|
|
72252
|
+
url: url2,
|
|
72253
|
+
adapter: opts.adapter,
|
|
72254
|
+
title: opts.title
|
|
72255
|
+
});
|
|
72256
|
+
console.log(JSON.stringify(r.data, null, 2));
|
|
72257
|
+
} catch (e) {
|
|
72258
|
+
await printCommandError("ops:recordings-run-failed", e);
|
|
72259
|
+
process.exit(1);
|
|
72260
|
+
}
|
|
72261
|
+
});
|
|
71809
72262
|
recordingsCommand.command("delete <sessionId>").description("\u5220\u9664\u6307\u5B9A\u5F55\u5236\u4F1A\u8BDD\u7684\u4E8B\u4EF6\u4E0E\u5FEB\u7167 (DELETE /api/recordings/:id)").action(async (sessionId) => {
|
|
71810
72263
|
try {
|
|
71811
72264
|
const r = await http7().delete(`/api/recordings/${sessionId}`);
|
|
@@ -72524,6 +72977,74 @@ noteCommand.command("list").requiredOption("--target <type>", `\u76EE\u6807\u7C7
|
|
|
72524
72977
|
}
|
|
72525
72978
|
});
|
|
72526
72979
|
|
|
72980
|
+
// src/commands/logs.ts
|
|
72981
|
+
init_esm();
|
|
72982
|
+
init_axios2();
|
|
72983
|
+
init_config2();
|
|
72984
|
+
init_keychain();
|
|
72985
|
+
init_command_error();
|
|
72986
|
+
function parseSince(input) {
|
|
72987
|
+
const m = /^(\d+)([mhd])$/.exec(input.trim());
|
|
72988
|
+
if (m) {
|
|
72989
|
+
const n = parseInt(m[1], 10);
|
|
72990
|
+
const unit = { m: 6e4, h: 36e5, d: 864e5 }[m[2]];
|
|
72991
|
+
return String(Date.now() - n * unit);
|
|
72992
|
+
}
|
|
72993
|
+
if (/^\d+$/.test(input.trim())) return input.trim();
|
|
72994
|
+
const d = new Date(input);
|
|
72995
|
+
if (Number.isNaN(d.getTime())) throw new Error(`--since \u65E0\u6CD5\u89E3\u6790: "${input}"(\u652F\u6301 30m/2h/1d/\u6BEB\u79D2/ISO)`);
|
|
72996
|
+
return String(d.getTime());
|
|
72997
|
+
}
|
|
72998
|
+
function formatRow(r) {
|
|
72999
|
+
const d = new Date(r.ts);
|
|
73000
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
73001
|
+
const ts = Number.isNaN(d.getTime()) ? String(r.ts ?? "") : `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
|
73002
|
+
const ms = r.durationMs != null ? ` ${r.durationMs}ms` : "";
|
|
73003
|
+
const err = r.status === "error" && r.error ? ` \u26A0 ${String(r.error).slice(0, 120)}` : "";
|
|
73004
|
+
const target = r.targetIds ? ` [${r.targetIds}]` : "";
|
|
73005
|
+
const user = r.userId != null ? ` u${r.userId}` : "";
|
|
73006
|
+
return `${ts} ${String(r.method ?? "EVT").padEnd(6)} ${r.status === "error" ? "\u2717" : "\u2713"} ${r.path ?? ""}${target}${user}${ms}${err}`;
|
|
73007
|
+
}
|
|
73008
|
+
var logsCommand = new Command("logs").description(
|
|
73009
|
+
"\u8FD0\u884C\u64CD\u4F5C\u65E5\u5FD7:\u5199\u64CD\u4F5C\u5BA1\u8BA1+\u5173\u952E\u4E8B\u4EF6(\u5220\u9664/\u521B\u5EFA/\u540C\u6B65/\u767B\u5F55),\u6392\u67E5\u4E0E\u63D0 issue \u53D6\u8BC1"
|
|
73010
|
+
);
|
|
73011
|
+
logsCommand.option("--since <spec>", "\u8D77\u59CB\u65F6\u95F4:30m/2h/1d/\u6BEB\u79D2\u65F6\u95F4\u6233/ISO(\u9ED8\u8BA4 1h)", "1h").option("--limit <n>", "\u6700\u591A\u8FD4\u56DE\u6761\u6570(\u2264500,\u9ED8\u8BA4 100)", "100").option("--status <s>", "\u6309\u72B6\u6001\u8FC7\u6EE4: ok | error").option("--json", "JSON \u8F93\u51FA").action(async (opts) => {
|
|
73012
|
+
try {
|
|
73013
|
+
const config = loadConfig();
|
|
73014
|
+
const token = await getToken().catch(() => void 0);
|
|
73015
|
+
const headers = token ? { Authorization: `UTOKEN ${token}` } : {};
|
|
73016
|
+
const since = parseSince(opts.since);
|
|
73017
|
+
const res = await axios_default.get(`${config.serverUrl}/op-logs`, {
|
|
73018
|
+
params: { since, limit: opts.limit, status: opts.status },
|
|
73019
|
+
headers,
|
|
73020
|
+
proxy: false,
|
|
73021
|
+
timeout: 1e4
|
|
73022
|
+
});
|
|
73023
|
+
const rows = Array.isArray(res.data) ? res.data : [];
|
|
73024
|
+
if (opts.json) {
|
|
73025
|
+
console.log(JSON.stringify(rows, null, 2));
|
|
73026
|
+
return;
|
|
73027
|
+
}
|
|
73028
|
+
if (!rows.length) {
|
|
73029
|
+
console.log(`(\u65E0\u8BB0\u5F55) op_logs \u4E2D ${opts.since} \u4EE5\u6765\u6CA1\u6709\u5339\u914D\u7684\u8FD0\u884C\u65E5\u5FD7`);
|
|
73030
|
+
return;
|
|
73031
|
+
}
|
|
73032
|
+
const errors = rows.filter((r) => r.status === "error").length;
|
|
73033
|
+
console.log(`# \u8FD0\u884C\u64CD\u4F5C\u65E5\u5FD7 ${rows.length} \u6761(${errors} \u6761 error)\xB7 \u672C\u5730\u4FDD\u7559 7 \u5929,dev-ops \u4FDD\u7559 72h
|
|
73034
|
+
`);
|
|
73035
|
+
for (const r of rows) console.log(formatRow(r));
|
|
73036
|
+
if (errors > 0) console.log(`
|
|
73037
|
+
\u26A0 \u5176\u4E2D ${errors} \u6761\u5931\u8D25\u8BB0\u5F55,\u5EFA\u8BAE: hunter-mate logs --since ${opts.since} --status error --json`);
|
|
73038
|
+
} catch (err) {
|
|
73039
|
+
if (err?.code === "ECONNREFUSED") {
|
|
73040
|
+
console.error("\u2717 \u8FDE\u63A5\u4E0D\u4E0A hunter-mate server,\u8BF7\u5148\u8FD0\u884C: hunter-mate start");
|
|
73041
|
+
process.exit(1);
|
|
73042
|
+
}
|
|
73043
|
+
printCommandError("logs:query-failed", err);
|
|
73044
|
+
process.exit(1);
|
|
73045
|
+
}
|
|
73046
|
+
});
|
|
73047
|
+
|
|
72527
73048
|
// src/commands/preference.ts
|
|
72528
73049
|
init_esm();
|
|
72529
73050
|
init_axios2();
|
|
@@ -72797,7 +73318,7 @@ function installLocalProxyBypass() {
|
|
|
72797
73318
|
// package.json
|
|
72798
73319
|
var package_default = {
|
|
72799
73320
|
name: "hunter-mate",
|
|
72800
|
-
version: "0.1.
|
|
73321
|
+
version: "0.1.19",
|
|
72801
73322
|
type: "module",
|
|
72802
73323
|
description: "HiredChina \u730E\u5934 Agent \u6570\u636E\u52A9\u624B CLI:\u4EBA\u624D\u5E93/\u5BA2\u6237/\u804C\u4F4D\u6570\u636E\u8BBF\u95EE,\u6D4F\u89C8\u5668\u5F55\u5236\u89E3\u6790\u7B80\u5386,server/\u6269\u5C55\u4E00\u81F4\u6027\u81EA\u6108",
|
|
72803
73324
|
license: "MIT",
|
|
@@ -72881,7 +73402,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
72881
73402
|
const status = reason?.response?.status;
|
|
72882
73403
|
const message = reason?.response?.data?.message || reason?.response?.data?.error || reason?.message || String(reason);
|
|
72883
73404
|
if (status === 401 || status === 403) {
|
|
72884
|
-
console.error("\u767B\u5F55\u5DF2\u8FC7\u671F\
|
|
73405
|
+
console.error("\u767B\u5F55\u5DF2\u8FC7\u671F\u3001\u65E0\u6743\u8BBF\u95EE\u6216\u5DF2\u5728 Web \u7AEF\u9000\u51FA,\u8BF7\u8FD0\u884C hunter-mate login \u540E\u91CD\u8BD5");
|
|
72885
73406
|
} else {
|
|
72886
73407
|
console.error(`\u547D\u4EE4\u6267\u884C\u51FA\u9519: ${message}`);
|
|
72887
73408
|
}
|
|
@@ -72933,6 +73454,15 @@ program2.name("hunter-mate").description(i18n.t("cli.description") + "\uFF08\u5D
|
|
|
72933
73454
|
await runAutoDoctor2(report);
|
|
72934
73455
|
} catch {
|
|
72935
73456
|
}
|
|
73457
|
+
try {
|
|
73458
|
+
const { maybeSyncHmhLocal: maybeSyncHmhLocal2 } = await Promise.resolve().then(() => (init_hmh_sync(), hmh_sync_exports));
|
|
73459
|
+
const hmhReport = await maybeSyncHmhLocal2();
|
|
73460
|
+
if (hmhReport.changes.length) {
|
|
73461
|
+
const summary = hmhReport.changes.map((c) => `${c.name}(${c.detail})`).join("; ");
|
|
73462
|
+
notify(`hmh local \u540C\u6B65\u4FEE\u590D ${hmhReport.changes.length} \u9879: ${summary}`);
|
|
73463
|
+
}
|
|
73464
|
+
} catch {
|
|
73465
|
+
}
|
|
72936
73466
|
} catch {
|
|
72937
73467
|
}
|
|
72938
73468
|
}).hook("postAction", async (thisCommand) => {
|
|
@@ -72972,6 +73502,7 @@ program2.addCommand(cacheCommand);
|
|
|
72972
73502
|
program2.addCommand(migrateDataDirCommand);
|
|
72973
73503
|
program2.addCommand(customerCommand);
|
|
72974
73504
|
program2.addCommand(noteCommand);
|
|
73505
|
+
program2.addCommand(logsCommand);
|
|
72975
73506
|
program2.addCommand(preferenceCommand);
|
|
72976
73507
|
program2.addCommand(caseCommand);
|
|
72977
73508
|
program2.addCommand(issueEnvCommand);
|