postgresai 0.18.0-dev.0 → 0.18.0-dev.1
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/bin/postgres-ai.js +101 -30
- package/package.json +1 -1
package/dist/bin/postgres-ai.js
CHANGED
|
@@ -13533,7 +13533,7 @@ var {
|
|
|
13533
13533
|
// package.json
|
|
13534
13534
|
var package_default = {
|
|
13535
13535
|
name: "postgresai",
|
|
13536
|
-
version: "0.18.0-dev.
|
|
13536
|
+
version: "0.18.0-dev.1",
|
|
13537
13537
|
description: "postgres_ai CLI",
|
|
13538
13538
|
license: "Apache-2.0",
|
|
13539
13539
|
private: false,
|
|
@@ -16893,7 +16893,7 @@ var Result = import_lib.default.Result;
|
|
|
16893
16893
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
16894
16894
|
var defaults = import_lib.default.defaults;
|
|
16895
16895
|
// package.json
|
|
16896
|
-
var version = "0.18.0-dev.
|
|
16896
|
+
var version = "0.18.0-dev.1";
|
|
16897
16897
|
var package_default2 = {
|
|
16898
16898
|
name: "postgresai",
|
|
16899
16899
|
version,
|
|
@@ -28091,8 +28091,8 @@ function nameFromDatabase(url) {
|
|
|
28091
28091
|
const slug = (db || "dblab").toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48).replace(/-+$/, "");
|
|
28092
28092
|
return slug.length >= 2 ? slug : `db-${slug || "x"}`.slice(0, 48);
|
|
28093
28093
|
}
|
|
28094
|
-
function sharedDeployOptions(cmd, waitDefaultMinutes, nameHelp) {
|
|
28095
|
-
return cmd.argument("[database-url]", "the database: postgresql://user:password@host:5432/dbname").option("--db-url <url>", "the database URL (the same as the argument)").option("--name <name>", nameHelp).option("--location <location>",
|
|
28094
|
+
function sharedDeployOptions(cmd, waitDefaultMinutes, nameHelp, locationHelp = "Hetzner location: fsn1, nbg1 or hel1 (default: any with capacity)") {
|
|
28095
|
+
return cmd.argument("[database-url]", "the database: postgresql://user:password@host:5432/dbname").option("--db-url <url>", "the database URL (the same as the argument)").option("--name <name>", nameHelp).option("--location <location>", locationHelp).option("--wait <minutes>", "how long to wait for it to be ready (0 = do not wait)", String(waitDefaultMinutes)).option("--no-wait", "return once the deploy has started (the same as --wait 0)").option("-y, --yes", "never prompt: accept the price and every confirmation").option("--json", "JSON output: one result on stdout, progress on stderr (the default when stdout is not a terminal)").option("--debug", "print HTTP requests (secrets masked)");
|
|
28096
28096
|
}
|
|
28097
28097
|
|
|
28098
28098
|
// lib/joe.ts
|
|
@@ -38927,6 +38927,7 @@ init_util();
|
|
|
38927
38927
|
|
|
38928
38928
|
// lib/deploy-commands.ts
|
|
38929
38929
|
import { createInterface } from "readline";
|
|
38930
|
+
import { lookup } from "dns/promises";
|
|
38930
38931
|
|
|
38931
38932
|
// lib/json-stderr.ts
|
|
38932
38933
|
function writeEvent(event) {
|
|
@@ -39016,6 +39017,9 @@ function withEnvPassword(dbUrl, env = process.env) {
|
|
|
39016
39017
|
return u.toString();
|
|
39017
39018
|
}
|
|
39018
39019
|
var DBLAB_PROVIDERS = ["rds", "supabase", "self-managed"];
|
|
39020
|
+
var DBLAB_CLOUDS = ["hetzner", "aws", "gcp"];
|
|
39021
|
+
var CLOUD_NAMES = { hetzner: "Hetzner", aws: "AWS", gcp: "Google Cloud" };
|
|
39022
|
+
var cloudName = (cloud) => CLOUD_NAMES[cloud ?? "hetzner"] ?? String(cloud);
|
|
39019
39023
|
var SOURCE_NAMES = {
|
|
39020
39024
|
generic: "PostgreSQL",
|
|
39021
39025
|
rds: "Amazon RDS",
|
|
@@ -39041,7 +39045,7 @@ function sourceLine(p) {
|
|
|
39041
39045
|
return `Source: ${name} (self-managed)`;
|
|
39042
39046
|
}
|
|
39043
39047
|
}
|
|
39044
|
-
var getDeployOptions = (p) => callDeployRpc(p, "dblab_cloud_deploy_options", {}, "Read deploy options");
|
|
39048
|
+
var getDeployOptions = (p, cloud) => callDeployRpc(p, "dblab_cloud_deploy_options", cloud && cloud !== "hetzner" ? { cloud } : {}, "Read deploy options");
|
|
39045
39049
|
var listCloudInstances = async (p, instanceId) => await callDeployRpc(p, "dblab_cloud_instances", instanceId === undefined ? {} : { p_instance_id: instanceId }, "List DBLab instances") ?? [];
|
|
39046
39050
|
var deployDblab = (p, args) => callDeployRpc(p, "dblab_instance_deploy", {
|
|
39047
39051
|
name: args.name,
|
|
@@ -39050,7 +39054,8 @@ var deployDblab = (p, args) => callDeployRpc(p, "dblab_instance_deploy", {
|
|
|
39050
39054
|
disk_gib: args.diskGib,
|
|
39051
39055
|
ssh_key_ids: args.sshKeyIds,
|
|
39052
39056
|
...args.location ? { location: args.location } : {},
|
|
39053
|
-
...args.provider ? { provider: args.provider } : {}
|
|
39057
|
+
...args.provider ? { provider: args.provider } : {},
|
|
39058
|
+
...args.cloud && args.cloud !== "hetzner" ? { cloud: args.cloud } : {}
|
|
39054
39059
|
}, "Deploy DBLab");
|
|
39055
39060
|
var probeSource = (p, dbUrl, provider) => callDeployRpc(p, "dblab_cloud_source_probe", { db_url: dbUrl, ...provider ? { provider } : {} }, "Test the source database");
|
|
39056
39061
|
function hasPassword(dbUrl) {
|
|
@@ -39320,6 +39325,20 @@ function emit(deps, result, json) {
|
|
|
39320
39325
|
console.error(result.next);
|
|
39321
39326
|
process.exitCode = DEPLOY_EXIT[result.status];
|
|
39322
39327
|
}
|
|
39328
|
+
async function looksPrivate(dbUrl) {
|
|
39329
|
+
let host = "";
|
|
39330
|
+
try {
|
|
39331
|
+
host = new URL(dbUrl).hostname;
|
|
39332
|
+
} catch {
|
|
39333
|
+
return false;
|
|
39334
|
+
}
|
|
39335
|
+
try {
|
|
39336
|
+
const { address } = await lookup(host, { family: 4 });
|
|
39337
|
+
return /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(address);
|
|
39338
|
+
} catch {
|
|
39339
|
+
return false;
|
|
39340
|
+
}
|
|
39341
|
+
}
|
|
39323
39342
|
var failed = (deps, err, json) => emit(deps, { status: "failed", next: err instanceof Error ? err.message : String(err) }, json);
|
|
39324
39343
|
async function withDetach(view, resumeHint, watch) {
|
|
39325
39344
|
let detached = false;
|
|
@@ -39345,7 +39364,7 @@ function sshHint(inst) {
|
|
|
39345
39364
|
return "";
|
|
39346
39365
|
return [
|
|
39347
39366
|
`Connect to a clone through SSH (clones listen on the server's localhost), e.g. port 6000:`,
|
|
39348
|
-
` ssh -N -L 6000:127.0.0.1:6000 root@${inst.server_ip}`,
|
|
39367
|
+
` ssh -N -L 6000:127.0.0.1:6000 ${inst.ssh_user ?? "root"}@${inst.server_ip}`,
|
|
39349
39368
|
` psql "host=127.0.0.1 port=6000 user=<user> dbname=<db>"`
|
|
39350
39369
|
].join(`
|
|
39351
39370
|
`);
|
|
@@ -39366,7 +39385,12 @@ var viewFor = (title, steps, tty, json) => jsonOutput(json) ? new StepView(title
|
|
|
39366
39385
|
function dblabResult(outcome, id) {
|
|
39367
39386
|
const inst = outcome.instance;
|
|
39368
39387
|
const ipShown = inst?.server_ip && inst.deploy_status !== "destroyed" && inst.deploy_status !== "failed";
|
|
39369
|
-
const base = {
|
|
39388
|
+
const base = {
|
|
39389
|
+
id,
|
|
39390
|
+
name: inst?.project_name,
|
|
39391
|
+
...ipShown ? { server_ip: inst.server_ip } : {},
|
|
39392
|
+
...inst?.cloud ? { cloud: inst.cloud, location: inst.location } : {}
|
|
39393
|
+
};
|
|
39370
39394
|
switch (outcome.kind) {
|
|
39371
39395
|
case "ready":
|
|
39372
39396
|
return { ...base, status: "ready", next: `PGAI_CLONE_DB_PASSWORD=<password> pgai dblab clone create --project ${inst.project_name} --db-user <user>` };
|
|
@@ -39408,8 +39432,9 @@ ${result.next}`);
|
|
|
39408
39432
|
emit(deps, result, json);
|
|
39409
39433
|
process.exitCode = DEPLOY_EXIT[result.status];
|
|
39410
39434
|
}
|
|
39411
|
-
async function followDblab(api, id, name, tty, json, minutes, deps) {
|
|
39412
|
-
const
|
|
39435
|
+
async function followDblab(api, id, name, tty, json, minutes, deps, where) {
|
|
39436
|
+
const on = where?.location ? ` on ${cloudName(where.cloud || "hetzner")}, ${where.location}` : "";
|
|
39437
|
+
const view = viewFor(`Deploying DBLab "${name}" (id ${id})${on}`, DBLAB_STEPS, tty, json);
|
|
39413
39438
|
view.start();
|
|
39414
39439
|
const outcome = await withDetach(view, `pgai dblab instances watch ${id}`, () => watchDblabDeploy(api, id, view, { pollMs: pollMs(), maxMs: minutes * 60000 }));
|
|
39415
39440
|
if (outcome === "detached")
|
|
@@ -39426,7 +39451,7 @@ function failureSummary(error) {
|
|
|
39426
39451
|
}
|
|
39427
39452
|
function registerDblabDeployCommands(dblab, deps) {
|
|
39428
39453
|
const tty = deps.isTty ?? isTtyDefault;
|
|
39429
|
-
sharedDeployOptions(deps.withOrgOptions(dblab.command("deploy")), 120, "instance name: lowercase letters, digits, hyphens (default: from the database's name)").description("deploy DBLab + Joe in PostgresAI cloud, then follow it until it is ready").option("--size <size>", "server size (S, M, L)", "S").option("--disk <gib>", "disk size in GiB", "50").option("--ssh-key <name|id...>", "org SSH key(s) for reaching the server and its clones (required)").option("--provider <provider>", "where the database runs: rds, supabase or self-managed (default: detected)").addHelpText("after", [
|
|
39454
|
+
sharedDeployOptions(deps.withOrgOptions(dblab.command("deploy")), 120, "instance name: lowercase letters, digits, hyphens (default: from the database's name)", "Hetzner location: fsn1, nbg1 or hel1 (default: any with capacity); with --cloud aws or gcp, a region " + "(default: the source's region, else us-east-1 / us-central1)").description("deploy DBLab + Joe in PostgresAI cloud, then follow it until it is ready").option("--size <size>", "server size (S, M, L)", "S").option("--disk <gib>", "disk size in GiB", "50").option("--ssh-key <name|id...>", "org SSH key(s) for reaching the server and its clones (required)").option("--provider <provider>", "where the database runs: rds, supabase or self-managed (default: detected)").option("--cloud <cloud>", "where the DBLab server runs: hetzner, aws or gcp (default: hetzner); --location is then its region").addHelpText("after", [
|
|
39430
39455
|
"",
|
|
39431
39456
|
"The password: in the URL, or set PGPASSWORD.",
|
|
39432
39457
|
"A Supabase project without its password: deploy it from the Console (Connect Supabase).",
|
|
@@ -39441,6 +39466,10 @@ function registerDblabDeployCommands(dblab, deps) {
|
|
|
39441
39466
|
if (provider && !DBLAB_PROVIDERS.includes(provider)) {
|
|
39442
39467
|
throw new Error(`--provider must be one of: ${DBLAB_PROVIDERS.join(", ")}`);
|
|
39443
39468
|
}
|
|
39469
|
+
const cloud = opts.cloud?.trim().toLowerCase();
|
|
39470
|
+
if (cloud !== undefined && !DBLAB_CLOUDS.includes(cloud)) {
|
|
39471
|
+
throw new Error(`--cloud must be one of: ${DBLAB_CLOUDS.join(", ")}`);
|
|
39472
|
+
}
|
|
39444
39473
|
const name = opts.name?.trim() || nameFromDatabase(url);
|
|
39445
39474
|
const minutes = waitMinutes(opts.wait, 120);
|
|
39446
39475
|
const api = deps.resolveApi(!!opts.debug);
|
|
@@ -39448,7 +39477,13 @@ function registerDblabDeployCommands(dblab, deps) {
|
|
|
39448
39477
|
if (!Number.isFinite(diskGib) || String(diskGib) !== opts.disk.trim()) {
|
|
39449
39478
|
throw new Error("--disk must be a whole number of GiB");
|
|
39450
39479
|
}
|
|
39451
|
-
const options = await getDeployOptions(api);
|
|
39480
|
+
const options = await getDeployOptions(api, cloud);
|
|
39481
|
+
const offered = cloud ? options.clouds?.find((c) => c.code === cloud) : undefined;
|
|
39482
|
+
if (cloud && offered && !offered.available)
|
|
39483
|
+
throw new Error(`${cloudName(cloud)} is not available.`);
|
|
39484
|
+
if (cloud && opts.location && options.locations?.length && !options.locations.includes(opts.location)) {
|
|
39485
|
+
throw new Error(`Unknown location "${opts.location}" for ${cloudName(cloud)}. Choose one of: ${options.locations.join(", ")}.`);
|
|
39486
|
+
}
|
|
39452
39487
|
const notAdmin = () => emit(deps, { status: "action_required", name, next: notAdminNext }, opts.json);
|
|
39453
39488
|
if (options.is_admin === false)
|
|
39454
39489
|
return notAdmin();
|
|
@@ -39463,16 +39498,8 @@ function registerDblabDeployCommands(dblab, deps) {
|
|
|
39463
39498
|
}, opts.json);
|
|
39464
39499
|
}
|
|
39465
39500
|
const cents = estimateMonthlyCents(options, opts.size, diskGib);
|
|
39466
|
-
const
|
|
39467
|
-
|
|
39468
|
-
if (jsonOutput(opts.json))
|
|
39469
|
-
writeEvent({ event: "billing", message: estimateLine(price) });
|
|
39470
|
-
else
|
|
39471
|
-
console.error(estimateLine(price));
|
|
39472
|
-
}
|
|
39473
|
-
const noCard = () => emit(deps, { status: "action_required", name, next: noCardNext(billingPage(deps.uiBaseUrl?.(), options.org_alias)) }, opts.json);
|
|
39474
|
-
if (options.has_payment_method === false)
|
|
39475
|
-
return noCard();
|
|
39501
|
+
const on = cloud ? ` on ${cloudName(cloud)}` : "";
|
|
39502
|
+
const price = cents === null ? null : `${formatCents(cents)}/month (size ${opts.size.toUpperCase()}${on}, ${diskGib} GiB), prorated.`;
|
|
39476
39503
|
let probe = null;
|
|
39477
39504
|
try {
|
|
39478
39505
|
probe = await probeSource(api, dbUrl, provider);
|
|
@@ -39480,10 +39507,29 @@ function registerDblabDeployCommands(dblab, deps) {
|
|
|
39480
39507
|
if (err instanceof HttpStatusError && err.status === 403)
|
|
39481
39508
|
return notAdmin();
|
|
39482
39509
|
}
|
|
39510
|
+
if (probe && !probe.reachable && (probe.provider === "rds" || probe.provider === "aurora") && await looksPrivate(dbUrl)) {
|
|
39511
|
+
const console_ = `${(deps.uiBaseUrl?.() ?? "https://console.postgres.ai").replace(/\/+$/, "")}/${options.org_alias ?? "<org>"}`;
|
|
39512
|
+
return emit(deps, {
|
|
39513
|
+
status: "action_required",
|
|
39514
|
+
name,
|
|
39515
|
+
next: "This RDS is not reachable from the internet. If it is private, deploy it over PrivateLink in the Console: " + `${console_}/instances/deploy?source=rds&network=private`
|
|
39516
|
+
}, opts.json);
|
|
39517
|
+
}
|
|
39483
39518
|
if (probe && !probe.reachable) {
|
|
39519
|
+
const viaPrivateLink = (probe.provider === "rds" || probe.provider === "aurora") && /timeout|timed out/i.test(probe.error ?? "") ? `
|
|
39520
|
+
A private RDS deploys over PrivateLink in the Console: ${(deps.uiBaseUrl?.() ?? "https://console.postgres.ai").replace(/\/+$/, "")}/${options.org_alias ?? "<org>"}/instances/deploy?source=rds&network=private` : "";
|
|
39484
39521
|
throw new Error(`Cannot connect to the source database: ${probe.error ?? "unknown error"}${probe.hint ? `
|
|
39485
|
-
Hint: ${probe.hint}` : ""}`);
|
|
39522
|
+
Hint: ${probe.hint}` : ""}${viaPrivateLink}`);
|
|
39486
39523
|
}
|
|
39524
|
+
if (price) {
|
|
39525
|
+
if (jsonOutput(opts.json))
|
|
39526
|
+
writeEvent({ event: "billing", message: estimateLine(price) });
|
|
39527
|
+
else
|
|
39528
|
+
console.error(estimateLine(price));
|
|
39529
|
+
}
|
|
39530
|
+
const noCard = () => emit(deps, { status: "action_required", name, next: noCardNext(billingPage(deps.uiBaseUrl?.(), options.org_alias)) }, opts.json);
|
|
39531
|
+
if (options.has_payment_method === false)
|
|
39532
|
+
return noCard();
|
|
39487
39533
|
if (probe) {
|
|
39488
39534
|
if (jsonOutput(opts.json))
|
|
39489
39535
|
writeEvent({ event: "source", message: sourceLine(probe) });
|
|
@@ -39513,7 +39559,8 @@ Hint: ${probe.hint}` : ""}`);
|
|
|
39513
39559
|
diskGib,
|
|
39514
39560
|
sshKeyIds,
|
|
39515
39561
|
location: opts.location,
|
|
39516
|
-
provider
|
|
39562
|
+
provider,
|
|
39563
|
+
cloud
|
|
39517
39564
|
});
|
|
39518
39565
|
} catch (err) {
|
|
39519
39566
|
if (err instanceof HttpStatusError && err.status === 402)
|
|
@@ -39523,13 +39570,19 @@ Hint: ${probe.hint}` : ""}`);
|
|
|
39523
39570
|
throw err;
|
|
39524
39571
|
}
|
|
39525
39572
|
if (minutes === 0) {
|
|
39526
|
-
const started = {
|
|
39573
|
+
const started = {
|
|
39574
|
+
status: "in_progress",
|
|
39575
|
+
id: reply.id,
|
|
39576
|
+
name: reply.project_name,
|
|
39577
|
+
...reply.cloud ? { cloud: reply.cloud, location: reply.location ?? null } : {},
|
|
39578
|
+
next: `pgai dblab instances watch ${reply.id}`
|
|
39579
|
+
};
|
|
39527
39580
|
if (!jsonOutput(opts.json))
|
|
39528
39581
|
console.error(`Deploy started: id ${reply.id}. Follow it: ${started.next}`);
|
|
39529
39582
|
emit(deps, started, opts.json);
|
|
39530
39583
|
return;
|
|
39531
39584
|
}
|
|
39532
|
-
await followDblab(api, reply.id, reply.project_name, tty(), opts.json, minutes, deps);
|
|
39585
|
+
await followDblab(api, reply.id, reply.project_name, tty(), opts.json, minutes, deps, reply);
|
|
39533
39586
|
} catch (err) {
|
|
39534
39587
|
failed(deps, err, opts.json);
|
|
39535
39588
|
}
|
|
@@ -39552,7 +39605,8 @@ Hint: ${probe.hint}` : ""}`);
|
|
|
39552
39605
|
const status = r.is_cloud ? failedDeploy ? "Deploy failed" : STATE_LABELS[r.deploy_status ?? ""] ?? r.deploy_status : r.is_job_backed ? "Connected" : "Self-managed";
|
|
39553
39606
|
const ip = r.server_ip && r.deploy_status !== "destroyed" && r.deploy_status !== "failed" ? ` ${r.server_ip}` : "";
|
|
39554
39607
|
const source = sourceName(r.source_provider, r.source_name);
|
|
39555
|
-
const
|
|
39608
|
+
const where = r.cloud && r.cloud !== "hetzner" ? ` ${cloudName(r.cloud)} ${r.location ?? ""}` : "";
|
|
39609
|
+
const extra = r.is_cloud ? ` ${r.size ?? ""} ${r.disk_gib ?? ""}GiB${where}${ip}${source ? ` from ${source}` : ""}` : "";
|
|
39556
39610
|
console.log(`${String(r.id).padEnd(6)} ${r.project_name.padEnd(28)} ${String(status).padEnd(14)}${extra}`);
|
|
39557
39611
|
if (r.deploy_error && r.deploy_status !== "ready") {
|
|
39558
39612
|
const summary = failureSummary(r.deploy_error);
|
|
@@ -39579,7 +39633,7 @@ Hint: ${probe.hint}` : ""}`);
|
|
|
39579
39633
|
return reportEnd(deps, ended, inst.id, opts.json);
|
|
39580
39634
|
if (minutes === 0)
|
|
39581
39635
|
return reportEnd(deps, { kind: "timeout", instance: inst }, inst.id, opts.json);
|
|
39582
|
-
await followDblab(api, inst.id, inst.project_name, tty(), opts.json, minutes, deps);
|
|
39636
|
+
await followDblab(api, inst.id, inst.project_name, tty(), opts.json, minutes, deps, inst);
|
|
39583
39637
|
} catch (err) {
|
|
39584
39638
|
failed(deps, err, opts.json);
|
|
39585
39639
|
}
|
|
@@ -39858,8 +39912,8 @@ function assertEncodedUserinfo2(url) {
|
|
|
39858
39912
|
throw new Error("The database URL has an '@' after the host: percent-encode it as %40 (in the password, the database name or the query; also / as %2F, ? as %3F, # as %23 in the password).");
|
|
39859
39913
|
}
|
|
39860
39914
|
}
|
|
39861
|
-
function sharedDeployOptions2(cmd, waitDefaultMinutes, nameHelp) {
|
|
39862
|
-
return cmd.argument("[database-url]", "the database: postgresql://user:password@host:5432/dbname").option("--db-url <url>", "the database URL (the same as the argument)").option("--name <name>", nameHelp).option("--location <location>",
|
|
39915
|
+
function sharedDeployOptions2(cmd, waitDefaultMinutes, nameHelp, locationHelp = "Hetzner location: fsn1, nbg1 or hel1 (default: any with capacity)") {
|
|
39916
|
+
return cmd.argument("[database-url]", "the database: postgresql://user:password@host:5432/dbname").option("--db-url <url>", "the database URL (the same as the argument)").option("--name <name>", nameHelp).option("--location <location>", locationHelp).option("--wait <minutes>", "how long to wait for it to be ready (0 = do not wait)", String(waitDefaultMinutes)).option("--no-wait", "return once the deploy has started (the same as --wait 0)").option("-y, --yes", "never prompt: accept the price and every confirmation").option("--json", "JSON output: one result on stdout, progress on stderr (the default when stdout is not a terminal)").option("--debug", "print HTTP requests (secrets masked)");
|
|
39863
39917
|
}
|
|
39864
39918
|
|
|
39865
39919
|
// lib/promql.ts
|
|
@@ -42241,6 +42295,22 @@ function trimmedEnv(name) {
|
|
|
42241
42295
|
// bin/postgres-ai.ts
|
|
42242
42296
|
init_util();
|
|
42243
42297
|
|
|
42298
|
+
// lib/connect-timeout.ts
|
|
42299
|
+
import * as net from "node:net";
|
|
42300
|
+
var CONNECT_ATTEMPT_TIMEOUT_MS = 2000;
|
|
42301
|
+
var ATTEMPT_TIMEOUT_FLAG = "--network-family-autoselection-attempt-timeout";
|
|
42302
|
+
var nodeNet = net;
|
|
42303
|
+
function raiseConnectAttemptTimeout(execArgv = process.execArgv, nodeOptions = process.env.NODE_OPTIONS) {
|
|
42304
|
+
if (!nodeNet.getDefaultAutoSelectFamilyAttemptTimeout || !nodeNet.setDefaultAutoSelectFamilyAttemptTimeout) {
|
|
42305
|
+
return;
|
|
42306
|
+
}
|
|
42307
|
+
const userSet = [...execArgv, ...(nodeOptions ?? "").split(/\s+/)].some((arg) => arg.replace(/_/g, "-").startsWith(ATTEMPT_TIMEOUT_FLAG));
|
|
42308
|
+
if (!userSet && nodeNet.getDefaultAutoSelectFamilyAttemptTimeout() < CONNECT_ATTEMPT_TIMEOUT_MS) {
|
|
42309
|
+
nodeNet.setDefaultAutoSelectFamilyAttemptTimeout(CONNECT_ATTEMPT_TIMEOUT_MS);
|
|
42310
|
+
}
|
|
42311
|
+
return nodeNet.getDefaultAutoSelectFamilyAttemptTimeout();
|
|
42312
|
+
}
|
|
42313
|
+
|
|
42244
42314
|
// lib/feedback.ts
|
|
42245
42315
|
var FEEDBACK_URL = "https://gitlab.com/postgres-ai/postgresai/-/work_items/300";
|
|
42246
42316
|
var FEEDBACK_SUPPRESS_ENV = "PGAI_NO_FEEDBACK_TIP";
|
|
@@ -51644,6 +51714,7 @@ mcp.command("install [client]").description("install MCP server configuration fo
|
|
|
51644
51714
|
}
|
|
51645
51715
|
});
|
|
51646
51716
|
if (__require.main == __require.module) {
|
|
51717
|
+
raiseConnectAttemptTimeout();
|
|
51647
51718
|
if (process.argv.length <= 2) {
|
|
51648
51719
|
program2.outputHelp();
|
|
51649
51720
|
closeReadline();
|