@rudderhq/cli 0.6.0 → 0.6.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/index.js +308 -283
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2040,7 +2040,8 @@ var init_messenger = __esm({
|
|
|
2040
2040
|
clientMutationId: uuid,
|
|
2041
2041
|
placement: z4.discriminatedUnion("kind", [
|
|
2042
2042
|
z4.object({ kind: z4.literal("anchor"), anchor: messengerSavedViewAnchorSchema }).strict(),
|
|
2043
|
-
z4.object({ kind: z4.literal("group"), groupId: uuid }).strict()
|
|
2043
|
+
z4.object({ kind: z4.literal("group"), groupId: uuid }).strict(),
|
|
2044
|
+
z4.object({ kind: z4.literal("loose") }).strict()
|
|
2044
2045
|
])
|
|
2045
2046
|
}).strict();
|
|
2046
2047
|
updateMessengerSavedViewSchema = z4.object({
|
|
@@ -2048,6 +2049,7 @@ var init_messenger = __esm({
|
|
|
2048
2049
|
title: savedViewMetadataShape.title.optional(),
|
|
2049
2050
|
subtitle: savedViewMetadataShape.subtitle,
|
|
2050
2051
|
favicon: savedViewMetadataShape.favicon,
|
|
2052
|
+
primaryRailPinned: z4.boolean().optional(),
|
|
2051
2053
|
// Compatibility-only escape hatch for legacy hidden rows. The current
|
|
2052
2054
|
// group-only Saved View model has no operation that creates hidden rows.
|
|
2053
2055
|
hidden: z4.literal(false).optional()
|
|
@@ -2066,7 +2068,8 @@ var init_messenger = __esm({
|
|
|
2066
2068
|
listMessengerSavedViewsQuerySchema = z4.object({
|
|
2067
2069
|
visibility: z4.enum(["visible", "hidden", "all"]).default("visible"),
|
|
2068
2070
|
limit: z4.coerce.number().int().min(1).max(100).default(50),
|
|
2069
|
-
offset: z4.coerce.number().int().min(0).default(0)
|
|
2071
|
+
offset: z4.coerce.number().int().min(0).default(0),
|
|
2072
|
+
primaryRailPinned: z4.union([z4.literal("true"), z4.literal(true)]).transform(() => true).optional()
|
|
2070
2073
|
}).strict();
|
|
2071
2074
|
}
|
|
2072
2075
|
});
|
|
@@ -4968,11 +4971,32 @@ var init_env = __esm({
|
|
|
4968
4971
|
}
|
|
4969
4972
|
});
|
|
4970
4973
|
|
|
4974
|
+
// src/runtime/postgres-payload.ts
|
|
4975
|
+
import { cp, mkdir, stat } from "node:fs/promises";
|
|
4976
|
+
import path6 from "node:path";
|
|
4977
|
+
async function copyRuntimePostgresPayloadLibraries(sourceRuntimeDir, targetRuntimeDir) {
|
|
4978
|
+
await mkdir(targetRuntimeDir, { recursive: true });
|
|
4979
|
+
for (const directoryName of ["bin", "lib"]) {
|
|
4980
|
+
const sourceDirectory = path6.join(sourceRuntimeDir, directoryName);
|
|
4981
|
+
if (!await stat(sourceDirectory).catch(() => null)) continue;
|
|
4982
|
+
await cp(
|
|
4983
|
+
sourceDirectory,
|
|
4984
|
+
path6.join(targetRuntimeDir, directoryName),
|
|
4985
|
+
{ recursive: true, dereference: true }
|
|
4986
|
+
);
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
var init_postgres_payload = __esm({
|
|
4990
|
+
"src/runtime/postgres-payload.ts"() {
|
|
4991
|
+
"use strict";
|
|
4992
|
+
}
|
|
4993
|
+
});
|
|
4994
|
+
|
|
4971
4995
|
// src/runtime/install.ts
|
|
4972
4996
|
import { execFileSync, spawnSync as spawnSync2 } from "node:child_process";
|
|
4973
|
-
import { copyFile, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
4997
|
+
import { copyFile, cp as cp2, mkdir as mkdir2, mkdtemp, readFile, readdir, realpath, rename, rm, stat as stat2, symlink, writeFile } from "node:fs/promises";
|
|
4974
4998
|
import { createRequire } from "node:module";
|
|
4975
|
-
import
|
|
4999
|
+
import path7 from "node:path";
|
|
4976
5000
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
4977
5001
|
function sanitizeRuntimeCacheSegment(value) {
|
|
4978
5002
|
return encodeURIComponent(value.trim() || "latest").replaceAll("%", "_");
|
|
@@ -4982,7 +5006,7 @@ function resolveRuntimePackageVersion(version) {
|
|
|
4982
5006
|
return normalized.length > 0 ? normalized : "latest";
|
|
4983
5007
|
}
|
|
4984
5008
|
function resolveRuntimeCacheDir(version, homeDir = resolveRudderHomeDir()) {
|
|
4985
|
-
return
|
|
5009
|
+
return path7.join(homeDir, "runtimes", sanitizeRuntimeCacheSegment(resolveRuntimePackageVersion(version)));
|
|
4986
5010
|
}
|
|
4987
5011
|
function resolveRuntimePackageSpec(version, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
4988
5012
|
const packageVersion = resolveRuntimePackageVersion(version);
|
|
@@ -4990,7 +5014,7 @@ function resolveRuntimePackageSpec(version, packageName = RUNTIME_NPM_PACKAGE_NA
|
|
|
4990
5014
|
}
|
|
4991
5015
|
async function readRuntimeInstallMetadata(cacheDir) {
|
|
4992
5016
|
try {
|
|
4993
|
-
const raw = await readFile(
|
|
5017
|
+
const raw = await readFile(path7.join(cacheDir, RUNTIME_METADATA_FILE), "utf8");
|
|
4994
5018
|
const parsed = JSON.parse(raw);
|
|
4995
5019
|
if (parsed.version !== 1) return null;
|
|
4996
5020
|
if (typeof parsed.packageName !== "string" || typeof parsed.packageVersion !== "string") return null;
|
|
@@ -5005,7 +5029,7 @@ async function readRuntimeInstallMetadata(cacheDir) {
|
|
|
5005
5029
|
}
|
|
5006
5030
|
}
|
|
5007
5031
|
async function writeRuntimeInstallMetadata(cacheDir, metadata) {
|
|
5008
|
-
await writeFile(
|
|
5032
|
+
await writeFile(path7.join(cacheDir, RUNTIME_METADATA_FILE), `${JSON.stringify(metadata, null, 2)}
|
|
5009
5033
|
`, "utf8");
|
|
5010
5034
|
}
|
|
5011
5035
|
async function touchRuntimeInstallMetadata(cacheDir, postgresRuntime) {
|
|
@@ -5033,7 +5057,7 @@ function resolveEmbeddedPostgresPlatformPackage(platform = process.platform, arc
|
|
|
5033
5057
|
}
|
|
5034
5058
|
async function canResolveRuntimePackage(cacheDir, packageName) {
|
|
5035
5059
|
try {
|
|
5036
|
-
await readFile(
|
|
5060
|
+
await readFile(path7.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json"), "utf8");
|
|
5037
5061
|
return true;
|
|
5038
5062
|
} catch {
|
|
5039
5063
|
return false;
|
|
@@ -5045,9 +5069,9 @@ async function hasRequiredRuntimePlatformDependencies(cacheDir, metadata, postgr
|
|
|
5045
5069
|
if (!platformPackage) return true;
|
|
5046
5070
|
if (await canResolveRuntimePackage(cacheDir, platformPackage)) return true;
|
|
5047
5071
|
const expectedSharedBinDir = resolveSharedRuntimePostgresPayloadBinDir(
|
|
5048
|
-
|
|
5072
|
+
path7.dirname(path7.dirname(cacheDir))
|
|
5049
5073
|
);
|
|
5050
|
-
return metadata.postgresRuntime?.scope === "shared" && metadata.postgresRuntime.platform === process.platform && metadata.postgresRuntime.arch === process.arch &&
|
|
5074
|
+
return metadata.postgresRuntime?.scope === "shared" && metadata.postgresRuntime.platform === process.platform && metadata.postgresRuntime.arch === process.arch && path7.resolve(metadata.postgresRuntime.binDir) === path7.resolve(expectedSharedBinDir) && await isRuntimePostgresPayloadUsable(
|
|
5051
5075
|
cacheDir,
|
|
5052
5076
|
metadata.postgresRuntime.binDir,
|
|
5053
5077
|
postgresVersionProbe
|
|
@@ -5061,7 +5085,7 @@ async function isRuntimeCacheHit(options) {
|
|
|
5061
5085
|
return false;
|
|
5062
5086
|
}
|
|
5063
5087
|
try {
|
|
5064
|
-
const packageJsonPath =
|
|
5088
|
+
const packageJsonPath = path7.join(options.cacheDir, "node_modules", ...packageName.split("/"), "package.json");
|
|
5065
5089
|
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
5066
5090
|
const packageVersionMatches = packageVersion === "latest" || packageJson.version === packageVersion;
|
|
5067
5091
|
return packageVersionMatches && await hasRequiredRuntimePlatformDependencies(
|
|
@@ -5078,7 +5102,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
5078
5102
|
const homeDir = options.homeDir ?? resolveRudderHomeDir();
|
|
5079
5103
|
const cacheDir = resolveRuntimeCacheDir(packageVersion, homeDir);
|
|
5080
5104
|
return withRuntimeFilesystemLock(
|
|
5081
|
-
|
|
5105
|
+
path7.join(homeDir, "runtime-payloads", ".postgres-runtime.lifecycle.lock"),
|
|
5082
5106
|
async () => withRuntimeFilesystemLock(
|
|
5083
5107
|
`${cacheDir}.install.lock`,
|
|
5084
5108
|
async () => ensureRuntimeInstalledUnlocked(options)
|
|
@@ -5150,8 +5174,8 @@ async function ensureRuntimeInstalledUnlocked(options) {
|
|
|
5150
5174
|
);
|
|
5151
5175
|
}
|
|
5152
5176
|
await rm(cacheDir, { recursive: true, force: true });
|
|
5153
|
-
await
|
|
5154
|
-
await writeFile(
|
|
5177
|
+
await mkdir2(cacheDir, { recursive: true });
|
|
5178
|
+
await writeFile(path7.join(cacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
|
|
5155
5179
|
`, "utf8");
|
|
5156
5180
|
const result = runNpmRuntimeInstall(spawnSyncImpl, cacheDir, packageSpec);
|
|
5157
5181
|
let output = collectSpawnOutput(result);
|
|
@@ -5188,8 +5212,8 @@ async function ensureRuntimeInstalledUnlocked(options) {
|
|
|
5188
5212
|
);
|
|
5189
5213
|
}
|
|
5190
5214
|
await rm(fallbackCacheDir, { recursive: true, force: true });
|
|
5191
|
-
await
|
|
5192
|
-
await writeFile(
|
|
5215
|
+
await mkdir2(fallbackCacheDir, { recursive: true });
|
|
5216
|
+
await writeFile(path7.join(fallbackCacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
|
|
5193
5217
|
`, "utf8");
|
|
5194
5218
|
const fallbackResult = runNpmRuntimeInstall(spawnSyncImpl, fallbackCacheDir, fallbackSpec);
|
|
5195
5219
|
let fallbackOutput = collectSpawnOutput(fallbackResult);
|
|
@@ -5266,10 +5290,10 @@ async function ensureRuntimeInstalledUnlocked(options) {
|
|
|
5266
5290
|
);
|
|
5267
5291
|
}
|
|
5268
5292
|
function resolveRuntimePostgresPayloadBinDir(cacheDir, platform = process.platform, arch = process.arch) {
|
|
5269
|
-
return
|
|
5293
|
+
return path7.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR, runtimePostgresPlatformSegment(platform, arch), "bin");
|
|
5270
5294
|
}
|
|
5271
5295
|
function resolveSharedRuntimePostgresPayloadBinDir(homeDir = resolveRudderHomeDir(), platform = process.platform, arch = process.arch) {
|
|
5272
|
-
return
|
|
5296
|
+
return path7.join(
|
|
5273
5297
|
homeDir,
|
|
5274
5298
|
"runtime-payloads",
|
|
5275
5299
|
RUNTIME_POSTGRES_PAYLOAD_DIR,
|
|
@@ -5278,7 +5302,7 @@ function resolveSharedRuntimePostgresPayloadBinDir(homeDir = resolveRudderHomeDi
|
|
|
5278
5302
|
);
|
|
5279
5303
|
}
|
|
5280
5304
|
function resolveRuntimeServerEntrypoint(cacheDir, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
5281
|
-
return createRequire(
|
|
5305
|
+
return createRequire(path7.join(cacheDir, "package.json")).resolve(packageName);
|
|
5282
5306
|
}
|
|
5283
5307
|
async function importRuntimeServerModule(cacheDir, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
5284
5308
|
const entrypoint = resolveRuntimeServerEntrypoint(cacheDir, packageName);
|
|
@@ -5299,7 +5323,7 @@ function formatRuntimeInstallCommand(cacheDir, packageSpec) {
|
|
|
5299
5323
|
return `npm install --prefix ${cacheDir} ${RUNTIME_NPM_INSTALL_FLAGS.join(" ")} ${packageSpec}`;
|
|
5300
5324
|
}
|
|
5301
5325
|
function formatRuntimePlatformRepairCommand(cacheDir, packageSpec) {
|
|
5302
|
-
return `npm pack ${packageSpec} --registry=${NPM_PUBLIC_REGISTRY_URL} --silent, then extract it into ${
|
|
5326
|
+
return `npm pack ${packageSpec} --registry=${NPM_PUBLIC_REGISTRY_URL} --silent, then extract it into ${path7.join(cacheDir, "node_modules")}`;
|
|
5303
5327
|
}
|
|
5304
5328
|
function collectSpawnOutput(result) {
|
|
5305
5329
|
return [result.stdout, result.stderr, result.error instanceof Error ? result.error.message : null].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
|
|
@@ -5316,7 +5340,7 @@ function withPostgresPayload(result, postgresPayload) {
|
|
|
5316
5340
|
};
|
|
5317
5341
|
}
|
|
5318
5342
|
function runtimePackageJsonPath(cacheDir, packageName) {
|
|
5319
|
-
return
|
|
5343
|
+
return path7.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json");
|
|
5320
5344
|
}
|
|
5321
5345
|
async function readRuntimePackageJson(cacheDir, packageName) {
|
|
5322
5346
|
try {
|
|
@@ -5361,8 +5385,8 @@ async function ensureRequiredEmbeddedPostgresPlatformPackage(spawnSyncImpl, cach
|
|
|
5361
5385
|
);
|
|
5362
5386
|
}
|
|
5363
5387
|
async function installRuntimePackageInStaging(spawnSyncImpl, cacheDir, packageSpec, packageName) {
|
|
5364
|
-
const stagingDir =
|
|
5365
|
-
await
|
|
5388
|
+
const stagingDir = path7.join(cacheDir, `.platform-repair-${process.pid}-${Date.now()}`);
|
|
5389
|
+
await mkdir2(stagingDir, { recursive: true });
|
|
5366
5390
|
try {
|
|
5367
5391
|
const packResult = runNpmPack(spawnSyncImpl, packageSpec, stagingDir);
|
|
5368
5392
|
if (packResult.status !== 0) return packResult;
|
|
@@ -5370,11 +5394,11 @@ async function installRuntimePackageInStaging(spawnSyncImpl, cacheDir, packageSp
|
|
|
5370
5394
|
if (!packFilename) {
|
|
5371
5395
|
return createSyntheticSpawnResult(1, "", `Unable to parse npm pack output for ${packageSpec}.`);
|
|
5372
5396
|
}
|
|
5373
|
-
const archivePath =
|
|
5374
|
-
const targetDir =
|
|
5375
|
-
await
|
|
5397
|
+
const archivePath = path7.join(stagingDir, packFilename);
|
|
5398
|
+
const targetDir = path7.dirname(runtimePackageJsonPath(cacheDir, packageName));
|
|
5399
|
+
await mkdir2(path7.dirname(targetDir), { recursive: true });
|
|
5376
5400
|
await rm(targetDir, { recursive: true, force: true });
|
|
5377
|
-
await
|
|
5401
|
+
await mkdir2(targetDir, { recursive: true });
|
|
5378
5402
|
const extractResult = runTarExtract(spawnSyncImpl, archivePath, targetDir);
|
|
5379
5403
|
return combineSpawnResults(packResult, extractResult);
|
|
5380
5404
|
} finally {
|
|
@@ -5423,8 +5447,8 @@ function combineSpawnResults(...results) {
|
|
|
5423
5447
|
}
|
|
5424
5448
|
async function removeRuntimeInstallLocks(cacheDir) {
|
|
5425
5449
|
await Promise.all([
|
|
5426
|
-
rm(
|
|
5427
|
-
rm(
|
|
5450
|
+
rm(path7.join(cacheDir, "package-lock.json"), { force: true }),
|
|
5451
|
+
rm(path7.join(cacheDir, "node_modules", ".package-lock.json"), { force: true })
|
|
5428
5452
|
]);
|
|
5429
5453
|
}
|
|
5430
5454
|
function packageNameFromSpec(packageSpec) {
|
|
@@ -5448,42 +5472,42 @@ function runtimePostgresExecutableName(baseName) {
|
|
|
5448
5472
|
return process.platform === "win32" ? `${baseName}.exe` : baseName;
|
|
5449
5473
|
}
|
|
5450
5474
|
function debianSharedirCandidate(binDir) {
|
|
5451
|
-
const normalized =
|
|
5452
|
-
const parts = normalized.split(
|
|
5475
|
+
const normalized = path7.resolve(binDir);
|
|
5476
|
+
const parts = normalized.split(path7.sep);
|
|
5453
5477
|
const libIndex = parts.lastIndexOf("lib");
|
|
5454
5478
|
if (libIndex < 0) return null;
|
|
5455
5479
|
if (parts[libIndex + 1] !== "postgresql") return null;
|
|
5456
5480
|
const version = parts[libIndex + 2];
|
|
5457
5481
|
if (!version || parts[libIndex + 3] !== "bin") return null;
|
|
5458
|
-
const prefix = parts.slice(0, libIndex).join(
|
|
5459
|
-
return
|
|
5482
|
+
const prefix = parts.slice(0, libIndex).join(path7.sep) || path7.sep;
|
|
5483
|
+
return path7.join(prefix, "share", "postgresql", version);
|
|
5460
5484
|
}
|
|
5461
5485
|
async function resolveRuntimePostgresTemplateDir(binDir) {
|
|
5462
5486
|
for (const candidatePath of [
|
|
5463
|
-
|
|
5464
|
-
|
|
5487
|
+
path7.join(binDir, "..", "share", "postgresql", "postgres.bki"),
|
|
5488
|
+
path7.join(binDir, "..", "share", "postgres.bki")
|
|
5465
5489
|
]) {
|
|
5466
5490
|
try {
|
|
5467
|
-
await
|
|
5468
|
-
return
|
|
5491
|
+
await stat2(candidatePath);
|
|
5492
|
+
return path7.dirname(candidatePath);
|
|
5469
5493
|
} catch {
|
|
5470
5494
|
}
|
|
5471
5495
|
}
|
|
5472
5496
|
const debianSharedir = debianSharedirCandidate(binDir);
|
|
5473
5497
|
if (debianSharedir) {
|
|
5474
5498
|
try {
|
|
5475
|
-
await
|
|
5499
|
+
await stat2(path7.join(debianSharedir, "postgres.bki"));
|
|
5476
5500
|
return debianSharedir;
|
|
5477
5501
|
} catch {
|
|
5478
5502
|
}
|
|
5479
5503
|
}
|
|
5480
|
-
const pgConfigPath =
|
|
5504
|
+
const pgConfigPath = path7.join(binDir, process.platform === "win32" ? "pg_config.exe" : "pg_config");
|
|
5481
5505
|
try {
|
|
5482
|
-
await
|
|
5506
|
+
await stat2(pgConfigPath);
|
|
5483
5507
|
const sharedir = execFileSync(pgConfigPath, ["--sharedir"], { encoding: "utf8" }).trim();
|
|
5484
5508
|
if (!sharedir) return null;
|
|
5485
|
-
const candidatePath =
|
|
5486
|
-
await
|
|
5509
|
+
const candidatePath = path7.join(sharedir, "postgres.bki");
|
|
5510
|
+
await stat2(candidatePath);
|
|
5487
5511
|
return sharedir;
|
|
5488
5512
|
} catch {
|
|
5489
5513
|
return null;
|
|
@@ -5493,21 +5517,21 @@ async function assertRuntimePostgresBinDirComplete(cacheDir, binDir) {
|
|
|
5493
5517
|
const requiredBinaries = ["initdb", "pg_ctl", "postgres"];
|
|
5494
5518
|
const missing = [];
|
|
5495
5519
|
for (const binary of requiredBinaries) {
|
|
5496
|
-
const binaryPath =
|
|
5520
|
+
const binaryPath = path7.join(binDir, runtimePostgresExecutableName(binary));
|
|
5497
5521
|
try {
|
|
5498
|
-
await
|
|
5522
|
+
await stat2(binaryPath);
|
|
5499
5523
|
} catch {
|
|
5500
5524
|
missing.push(binaryPath);
|
|
5501
5525
|
}
|
|
5502
5526
|
}
|
|
5503
5527
|
const templateDir = await resolveRuntimePostgresTemplateDir(binDir);
|
|
5504
5528
|
if (!templateDir) {
|
|
5505
|
-
missing.push(
|
|
5529
|
+
missing.push(path7.join(binDir, "..", "share", "postgresql", "postgres.bki"));
|
|
5506
5530
|
} else {
|
|
5507
5531
|
try {
|
|
5508
|
-
await
|
|
5532
|
+
await stat2(path7.join(templateDir, "postgresql.conf.sample"));
|
|
5509
5533
|
} catch {
|
|
5510
|
-
missing.push(
|
|
5534
|
+
missing.push(path7.join(templateDir, "postgresql.conf.sample"));
|
|
5511
5535
|
}
|
|
5512
5536
|
}
|
|
5513
5537
|
if (missing.length > 0) {
|
|
@@ -5529,19 +5553,19 @@ async function isRuntimePostgresPayloadUsable(cacheDir, binDir, postgresVersionP
|
|
|
5529
5553
|
}
|
|
5530
5554
|
}
|
|
5531
5555
|
function pathIsInside(candidatePath, rootPath) {
|
|
5532
|
-
const relative =
|
|
5533
|
-
return relative === "" || relative !== ".." && !relative.startsWith(`..${
|
|
5556
|
+
const relative = path7.relative(path7.resolve(rootPath), path7.resolve(candidatePath));
|
|
5557
|
+
return relative === "" || relative !== ".." && !relative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(relative);
|
|
5534
5558
|
}
|
|
5535
5559
|
async function withRuntimeFilesystemLock(lockPath, task, options = {}) {
|
|
5536
5560
|
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
5537
5561
|
const pollMs = options.pollMs ?? 50;
|
|
5538
5562
|
const startedAt = Date.now();
|
|
5539
5563
|
const lockId = `${process.pid}-${startedAt}-${Math.random().toString(16).slice(2)}`;
|
|
5540
|
-
const ownerPath =
|
|
5541
|
-
await
|
|
5564
|
+
const ownerPath = path7.join(lockPath, "owner.json");
|
|
5565
|
+
await mkdir2(path7.dirname(lockPath), { recursive: true });
|
|
5542
5566
|
while (true) {
|
|
5543
5567
|
try {
|
|
5544
|
-
await
|
|
5568
|
+
await mkdir2(lockPath);
|
|
5545
5569
|
await writeFile(
|
|
5546
5570
|
ownerPath,
|
|
5547
5571
|
`${JSON.stringify({ pid: process.pid, lockId, createdAt: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
@@ -5558,7 +5582,7 @@ async function withRuntimeFilesystemLock(lockPath, task, options = {}) {
|
|
|
5558
5582
|
continue;
|
|
5559
5583
|
}
|
|
5560
5584
|
} catch {
|
|
5561
|
-
const lockStats = await
|
|
5585
|
+
const lockStats = await stat2(lockPath).catch(() => null);
|
|
5562
5586
|
if (lockStats && Date.now() - lockStats.mtimeMs > 5e3) {
|
|
5563
5587
|
await rm(lockPath, { recursive: true, force: true });
|
|
5564
5588
|
continue;
|
|
@@ -5567,7 +5591,7 @@ async function withRuntimeFilesystemLock(lockPath, task, options = {}) {
|
|
|
5567
5591
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
5568
5592
|
throw new RuntimeInstallError(
|
|
5569
5593
|
`Timed out waiting for PostgreSQL runtime install lock ${lockPath}`,
|
|
5570
|
-
{ cacheDir:
|
|
5594
|
+
{ cacheDir: path7.dirname(lockPath), command: "prepare shared PostgreSQL runtime", output: "" }
|
|
5571
5595
|
);
|
|
5572
5596
|
}
|
|
5573
5597
|
await new Promise((resolve) => setTimeout(resolve, pollMs));
|
|
@@ -5587,29 +5611,29 @@ async function withRuntimeFilesystemLock(lockPath, task, options = {}) {
|
|
|
5587
5611
|
}
|
|
5588
5612
|
function isManagedRuntimePostgresBinDir(binDir, homeDir) {
|
|
5589
5613
|
const managedBinDir = process.env[RUDDER_DESKTOP_MANAGED_POSTGRES_BIN_DIR_ENV]?.trim();
|
|
5590
|
-
if (managedBinDir &&
|
|
5591
|
-
const runtimesRelative =
|
|
5592
|
-
|
|
5593
|
-
|
|
5614
|
+
if (managedBinDir && path7.resolve(managedBinDir) === path7.resolve(binDir)) return true;
|
|
5615
|
+
const runtimesRelative = path7.relative(
|
|
5616
|
+
path7.join(homeDir, "runtimes"),
|
|
5617
|
+
path7.resolve(binDir)
|
|
5594
5618
|
);
|
|
5595
|
-
const runtimeSegments = runtimesRelative.split(
|
|
5596
|
-
if (runtimesRelative !== "" && runtimesRelative !== ".." && !runtimesRelative.startsWith(`..${
|
|
5619
|
+
const runtimeSegments = runtimesRelative.split(path7.sep);
|
|
5620
|
+
if (runtimesRelative !== "" && runtimesRelative !== ".." && !runtimesRelative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(runtimesRelative) && runtimeSegments.length === 4 && runtimeSegments[0]?.length > 0 && runtimeSegments[1] === RUNTIME_POSTGRES_PAYLOAD_DIR && runtimeSegments[2] === `${process.platform}-${process.arch}` && runtimeSegments[3] === "bin") {
|
|
5597
5621
|
return true;
|
|
5598
5622
|
}
|
|
5599
|
-
const payloadsRelative =
|
|
5600
|
-
|
|
5601
|
-
|
|
5623
|
+
const payloadsRelative = path7.relative(
|
|
5624
|
+
path7.join(homeDir, "runtime-payloads"),
|
|
5625
|
+
path7.resolve(binDir)
|
|
5602
5626
|
);
|
|
5603
|
-
const payloadSegments = payloadsRelative.split(
|
|
5604
|
-
return payloadsRelative !== "" && payloadsRelative !== ".." && !payloadsRelative.startsWith(`..${
|
|
5627
|
+
const payloadSegments = payloadsRelative.split(path7.sep);
|
|
5628
|
+
return payloadsRelative !== "" && payloadsRelative !== ".." && !payloadsRelative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(payloadsRelative) && payloadSegments.length === 3 && payloadSegments[0] === RUNTIME_POSTGRES_PAYLOAD_DIR && payloadSegments[1] === `${process.platform}-${process.arch}` && payloadSegments[2] === "bin";
|
|
5605
5629
|
}
|
|
5606
5630
|
async function findLegacyRuntimePostgresBinDir(cacheDir, homeDir, postgresVersionProbe) {
|
|
5607
|
-
const runtimesRoot =
|
|
5631
|
+
const runtimesRoot = path7.join(homeDir, "runtimes");
|
|
5608
5632
|
const entries = await readdir(runtimesRoot, { withFileTypes: true }).catch(() => []);
|
|
5609
5633
|
for (const entry of entries) {
|
|
5610
5634
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
5611
|
-
const candidateCacheDir =
|
|
5612
|
-
if (
|
|
5635
|
+
const candidateCacheDir = path7.join(runtimesRoot, entry.name);
|
|
5636
|
+
if (path7.resolve(candidateCacheDir) === path7.resolve(cacheDir)) continue;
|
|
5613
5637
|
const candidateBinDir = resolveRuntimePostgresPayloadBinDir(candidateCacheDir);
|
|
5614
5638
|
if (await isRuntimePostgresPayloadUsable(cacheDir, candidateBinDir, postgresVersionProbe)) {
|
|
5615
5639
|
return candidateBinDir;
|
|
@@ -5618,13 +5642,13 @@ async function findLegacyRuntimePostgresBinDir(cacheDir, homeDir, postgresVersio
|
|
|
5618
5642
|
return null;
|
|
5619
5643
|
}
|
|
5620
5644
|
async function readLiveRuntimeDescriptors(homeDir) {
|
|
5621
|
-
const instancesRoot =
|
|
5645
|
+
const instancesRoot = path7.join(homeDir, "instances");
|
|
5622
5646
|
const entries = await readdir(instancesRoot, { withFileTypes: true }).catch(() => []);
|
|
5623
5647
|
const descriptors = [];
|
|
5624
5648
|
for (const entry of entries) {
|
|
5625
5649
|
if (!entry.isDirectory()) continue;
|
|
5626
5650
|
try {
|
|
5627
|
-
const raw = JSON.parse(await readFile(
|
|
5651
|
+
const raw = JSON.parse(await readFile(path7.join(instancesRoot, entry.name, "runtime", "server.json"), "utf8"));
|
|
5628
5652
|
if (typeof raw.pid !== "number" || !Number.isInteger(raw.pid) || !isPidRunning(raw.pid) || typeof raw.version !== "string") {
|
|
5629
5653
|
continue;
|
|
5630
5654
|
}
|
|
@@ -5642,13 +5666,13 @@ async function assertSharedPostgresPayloadNotLive(cacheDir, homeDir, sharedBinDi
|
|
|
5642
5666
|
const sharedPhysicalBinDir = await realpath(sharedBinDir).catch(() => null);
|
|
5643
5667
|
const mayReferenceSharedPayload = await Promise.all(liveDescriptors.map(async (descriptor) => {
|
|
5644
5668
|
if (descriptor.postgresBinDir === void 0) return true;
|
|
5645
|
-
if (
|
|
5669
|
+
if (path7.resolve(descriptor.postgresBinDir) === path7.resolve(sharedBinDir)) return true;
|
|
5646
5670
|
const descriptorPhysicalBinDir = await realpath(descriptor.postgresBinDir).catch(() => null);
|
|
5647
|
-
if (descriptorPhysicalBinDir && sharedPhysicalBinDir &&
|
|
5671
|
+
if (descriptorPhysicalBinDir && sharedPhysicalBinDir && path7.resolve(descriptorPhysicalBinDir) === path7.resolve(sharedPhysicalBinDir)) {
|
|
5648
5672
|
return true;
|
|
5649
5673
|
}
|
|
5650
5674
|
if (!descriptorPhysicalBinDir) {
|
|
5651
|
-
return pathIsInside(descriptor.postgresBinDir,
|
|
5675
|
+
return pathIsInside(descriptor.postgresBinDir, path7.join(homeDir, "runtimes")) || pathIsInside(descriptor.postgresBinDir, path7.join(homeDir, "runtime-payloads"));
|
|
5652
5676
|
}
|
|
5653
5677
|
return false;
|
|
5654
5678
|
}));
|
|
@@ -5662,7 +5686,7 @@ async function assertSharedPostgresPayloadNotLive(cacheDir, homeDir, sharedBinDi
|
|
|
5662
5686
|
async function validateRuntimePostgresVersion(cacheDir, binDir, postgresVersionProbe) {
|
|
5663
5687
|
await assertRuntimePostgresBinDirComplete(cacheDir, binDir);
|
|
5664
5688
|
for (const binary of ["initdb", "pg_ctl", "postgres"]) {
|
|
5665
|
-
const binaryPath =
|
|
5689
|
+
const binaryPath = path7.join(binDir, runtimePostgresExecutableName(binary));
|
|
5666
5690
|
const result = postgresVersionProbe(binaryPath);
|
|
5667
5691
|
if (!/\bPostgreSQL\)?\s+18\.4\b/i.test(result)) {
|
|
5668
5692
|
throw new RuntimeInstallError(
|
|
@@ -5728,23 +5752,23 @@ async function findRuntimePostgresBinDir(rootDir, cacheDir, postgresVersionProbe
|
|
|
5728
5752
|
if (await isRuntimePostgresPayloadUsable(cacheDir, current, postgresVersionProbe)) return current;
|
|
5729
5753
|
const entries = await readdir(current, { withFileTypes: true }).catch(() => []);
|
|
5730
5754
|
for (const entry of entries) {
|
|
5731
|
-
if (entry.isDirectory()) queue.push(
|
|
5755
|
+
if (entry.isDirectory()) queue.push(path7.join(current, entry.name));
|
|
5732
5756
|
}
|
|
5733
5757
|
}
|
|
5734
5758
|
return null;
|
|
5735
5759
|
}
|
|
5736
5760
|
async function reconcileSharedPostgresPayloadGenerations(cacheDir, sharedPlatformRoot, postgresVersionProbe, cleanupDownloads = false) {
|
|
5737
|
-
const parentDir =
|
|
5738
|
-
const baseName =
|
|
5761
|
+
const parentDir = path7.dirname(sharedPlatformRoot);
|
|
5762
|
+
const baseName = path7.basename(sharedPlatformRoot);
|
|
5739
5763
|
const entries = await readdir(parentDir, { withFileTypes: true }).catch(() => []);
|
|
5740
|
-
const temporaryRoots = entries.filter((entry) => entry.name.startsWith(`${baseName}.tmp-`)).map((entry) =>
|
|
5741
|
-
const previousRoots = entries.filter((entry) => entry.name.startsWith(`${baseName}.previous-`)).map((entry) =>
|
|
5742
|
-
const downloadsRoot =
|
|
5743
|
-
|
|
5764
|
+
const temporaryRoots = entries.filter((entry) => entry.name.startsWith(`${baseName}.tmp-`)).map((entry) => path7.join(parentDir, entry.name));
|
|
5765
|
+
const previousRoots = entries.filter((entry) => entry.name.startsWith(`${baseName}.previous-`)).map((entry) => path7.join(parentDir, entry.name)).sort().reverse();
|
|
5766
|
+
const downloadsRoot = path7.join(
|
|
5767
|
+
path7.dirname(path7.dirname(sharedPlatformRoot)),
|
|
5744
5768
|
".downloads"
|
|
5745
5769
|
);
|
|
5746
|
-
const staleDownloadRoots = cleanupDownloads ? (await readdir(downloadsRoot, { withFileTypes: true }).catch(() => [])).filter((entry) => entry.name.startsWith("postgres-18.4-")).map((entry) =>
|
|
5747
|
-
const canonicalBinDir =
|
|
5770
|
+
const staleDownloadRoots = cleanupDownloads ? (await readdir(downloadsRoot, { withFileTypes: true }).catch(() => [])).filter((entry) => entry.name.startsWith("postgres-18.4-")).map((entry) => path7.join(downloadsRoot, entry.name)) : [];
|
|
5771
|
+
const canonicalBinDir = path7.join(sharedPlatformRoot, "bin");
|
|
5748
5772
|
if (!await isRuntimePostgresPayloadUsable(
|
|
5749
5773
|
cacheDir,
|
|
5750
5774
|
canonicalBinDir,
|
|
@@ -5753,7 +5777,7 @@ async function reconcileSharedPostgresPayloadGenerations(cacheDir, sharedPlatfor
|
|
|
5753
5777
|
for (const previousRoot of previousRoots) {
|
|
5754
5778
|
if (!await isRuntimePostgresPayloadUsable(
|
|
5755
5779
|
cacheDir,
|
|
5756
|
-
|
|
5780
|
+
path7.join(previousRoot, "bin"),
|
|
5757
5781
|
postgresVersionProbe
|
|
5758
5782
|
)) {
|
|
5759
5783
|
continue;
|
|
@@ -5771,9 +5795,9 @@ async function reconcileSharedPostgresPayloadGenerations(cacheDir, sharedPlatfor
|
|
|
5771
5795
|
}
|
|
5772
5796
|
async function installSharedRuntimePostgresPayload(cacheDir, homeDir, sourceBinDir, postgresVersionProbe) {
|
|
5773
5797
|
const sharedBinDir = resolveSharedRuntimePostgresPayloadBinDir(homeDir);
|
|
5774
|
-
const sharedRuntimeDir =
|
|
5798
|
+
const sharedRuntimeDir = path7.dirname(sharedBinDir);
|
|
5775
5799
|
const sharedPlatformRoot = sharedRuntimeDir;
|
|
5776
|
-
const sourceRuntimeDir =
|
|
5800
|
+
const sourceRuntimeDir = path7.dirname(sourceBinDir);
|
|
5777
5801
|
const sourceTemplateDir = await resolveRuntimePostgresTemplateDir(sourceBinDir);
|
|
5778
5802
|
if (!sourceTemplateDir) {
|
|
5779
5803
|
throw new RuntimeInstallError(
|
|
@@ -5792,7 +5816,7 @@ async function installSharedRuntimePostgresPayload(cacheDir, homeDir, sourceBinD
|
|
|
5792
5816
|
return sharedBinDir;
|
|
5793
5817
|
}
|
|
5794
5818
|
await assertSharedPostgresPayloadNotLive(cacheDir, homeDir, sharedBinDir);
|
|
5795
|
-
await
|
|
5819
|
+
await mkdir2(path7.dirname(sharedPlatformRoot), { recursive: true });
|
|
5796
5820
|
const temporaryPlatformRoot = `${sharedPlatformRoot}.tmp-${process.pid}-${Date.now()}`;
|
|
5797
5821
|
const previousPlatformRoot = `${sharedPlatformRoot}.previous-${process.pid}-${Date.now()}`;
|
|
5798
5822
|
let previousMoved = false;
|
|
@@ -5801,13 +5825,13 @@ async function installSharedRuntimePostgresPayload(cacheDir, homeDir, sourceBinD
|
|
|
5801
5825
|
await rm(previousPlatformRoot, { recursive: true, force: true });
|
|
5802
5826
|
try {
|
|
5803
5827
|
const temporaryRuntimeDir = temporaryPlatformRoot;
|
|
5804
|
-
await
|
|
5805
|
-
const temporaryShareDir =
|
|
5806
|
-
const temporaryTemplateDir =
|
|
5828
|
+
await copyRuntimePostgresPayloadLibraries(sourceRuntimeDir, temporaryRuntimeDir);
|
|
5829
|
+
const temporaryShareDir = path7.join(temporaryRuntimeDir, "share");
|
|
5830
|
+
const temporaryTemplateDir = path7.join(temporaryShareDir, "postgresql");
|
|
5807
5831
|
await rm(temporaryShareDir, { recursive: true, force: true });
|
|
5808
|
-
await
|
|
5809
|
-
await
|
|
5810
|
-
const temporaryBinDir =
|
|
5832
|
+
await mkdir2(path7.dirname(temporaryTemplateDir), { recursive: true });
|
|
5833
|
+
await cp2(sourceTemplateDir, temporaryTemplateDir, { recursive: true });
|
|
5834
|
+
const temporaryBinDir = path7.join(temporaryRuntimeDir, "bin");
|
|
5811
5835
|
await validateRuntimePostgresVersion(cacheDir, temporaryBinDir, postgresVersionProbe);
|
|
5812
5836
|
try {
|
|
5813
5837
|
await rename(sharedPlatformRoot, previousPlatformRoot);
|
|
@@ -5842,19 +5866,19 @@ async function downloadSharedRuntimePostgresPayload(cacheDir, homeDir, postgresV
|
|
|
5842
5866
|
const archiveUrl = runtimePostgresArchiveUrl();
|
|
5843
5867
|
if (!archiveUrl) return null;
|
|
5844
5868
|
const sharedBinDir = resolveSharedRuntimePostgresPayloadBinDir(homeDir);
|
|
5845
|
-
const sharedPlatformRoot =
|
|
5869
|
+
const sharedPlatformRoot = path7.dirname(sharedBinDir);
|
|
5846
5870
|
const downloadLockPath = `${sharedPlatformRoot}.download.lock`;
|
|
5847
5871
|
return withRuntimeFilesystemLock(downloadLockPath, async () => {
|
|
5848
5872
|
if (await isRuntimePostgresPayloadUsable(cacheDir, sharedBinDir, postgresVersionProbe)) {
|
|
5849
5873
|
return sharedBinDir;
|
|
5850
5874
|
}
|
|
5851
|
-
const workRoot =
|
|
5852
|
-
await
|
|
5853
|
-
const workDir = await mkdtemp(
|
|
5854
|
-
const archivePath =
|
|
5855
|
-
const extractDir =
|
|
5875
|
+
const workRoot = path7.join(homeDir, "runtime-payloads", ".downloads");
|
|
5876
|
+
await mkdir2(workRoot, { recursive: true });
|
|
5877
|
+
const workDir = await mkdtemp(path7.join(workRoot, "postgres-18.4-"));
|
|
5878
|
+
const archivePath = path7.join(workDir, "postgresql-18.4.zip");
|
|
5879
|
+
const extractDir = path7.join(workDir, "extract");
|
|
5856
5880
|
try {
|
|
5857
|
-
await
|
|
5881
|
+
await mkdir2(extractDir, { recursive: true });
|
|
5858
5882
|
await downloadRuntimePostgresArchive(archiveUrl, archivePath);
|
|
5859
5883
|
extractRuntimePostgresArchive(archivePath, extractDir);
|
|
5860
5884
|
const extractedBinDir = await findRuntimePostgresBinDir(
|
|
@@ -5880,20 +5904,20 @@ async function downloadSharedRuntimePostgresPayload(cacheDir, homeDir, postgresV
|
|
|
5880
5904
|
});
|
|
5881
5905
|
}
|
|
5882
5906
|
async function ensureRuntimePostgresCompatibilityLink(cacheDir, homeDir, packageVersion) {
|
|
5883
|
-
const compatibilityRoot =
|
|
5884
|
-
const sharedPayloadRoot =
|
|
5907
|
+
const compatibilityRoot = path7.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR);
|
|
5908
|
+
const sharedPayloadRoot = path7.join(homeDir, "runtime-payloads", RUNTIME_POSTGRES_PAYLOAD_DIR);
|
|
5885
5909
|
const runtimeMetadata = await readRuntimeInstallMetadata(cacheDir);
|
|
5886
5910
|
const liveDescriptors = await readLiveRuntimeDescriptors(homeDir);
|
|
5887
5911
|
const compatibilityBinDir = resolveRuntimePostgresPayloadBinDir(cacheDir);
|
|
5888
5912
|
const isProtected = liveDescriptors.some((descriptor) => descriptor.postgresBinDir && pathIsInside(descriptor.postgresBinDir, compatibilityRoot) || !descriptor.postgresBinDir && descriptor.version === (runtimeMetadata?.packageVersion ?? packageVersion));
|
|
5889
5913
|
if (isProtected) return;
|
|
5890
|
-
await
|
|
5914
|
+
await mkdir2(path7.dirname(compatibilityRoot), { recursive: true });
|
|
5891
5915
|
const temporaryRoot = `${compatibilityRoot}.next-${process.pid}-${Date.now()}`;
|
|
5892
5916
|
const previousRoot = `${compatibilityRoot}.previous-${process.pid}-${Date.now()}`;
|
|
5893
5917
|
await rm(temporaryRoot, { recursive: true, force: true });
|
|
5894
5918
|
await rm(previousRoot, { recursive: true, force: true });
|
|
5895
5919
|
await symlink(
|
|
5896
|
-
process.platform === "win32" ? sharedPayloadRoot :
|
|
5920
|
+
process.platform === "win32" ? sharedPayloadRoot : path7.relative(path7.dirname(compatibilityRoot), sharedPayloadRoot),
|
|
5897
5921
|
temporaryRoot,
|
|
5898
5922
|
process.platform === "win32" ? "junction" : "dir"
|
|
5899
5923
|
);
|
|
@@ -5926,7 +5950,7 @@ async function ensureRuntimePostgresCompatibilityLink(cacheDir, homeDir, package
|
|
|
5926
5950
|
async function stageRuntimePostgresPayload(cacheDir, homeDir, packageVersion, enabled, postgresVersionProbe) {
|
|
5927
5951
|
if (!enabled) return { output: "" };
|
|
5928
5952
|
const explicitSourceBinDir = process.env[RUDDER_POSTGRES_BIN_DIR_ENV]?.trim();
|
|
5929
|
-
const resolvedExplicitSourceBinDir = explicitSourceBinDir ?
|
|
5953
|
+
const resolvedExplicitSourceBinDir = explicitSourceBinDir ? path7.resolve(explicitSourceBinDir) : null;
|
|
5930
5954
|
if (resolvedExplicitSourceBinDir && !isManagedRuntimePostgresBinDir(resolvedExplicitSourceBinDir, homeDir)) {
|
|
5931
5955
|
await validateRuntimePostgresVersion(
|
|
5932
5956
|
cacheDir,
|
|
@@ -5946,7 +5970,7 @@ async function stageRuntimePostgresPayload(cacheDir, homeDir, packageVersion, en
|
|
|
5946
5970
|
};
|
|
5947
5971
|
}
|
|
5948
5972
|
const sharedBinDir = resolveSharedRuntimePostgresPayloadBinDir(homeDir);
|
|
5949
|
-
const sharedPlatformRoot =
|
|
5973
|
+
const sharedPlatformRoot = path7.dirname(sharedBinDir);
|
|
5950
5974
|
await withRuntimeFilesystemLock(
|
|
5951
5975
|
`${sharedPlatformRoot}.install.lock`,
|
|
5952
5976
|
async () => reconcileSharedPostgresPayloadGenerations(
|
|
@@ -6052,13 +6076,13 @@ async function pruneRuntimeCache(options = {}) {
|
|
|
6052
6076
|
};
|
|
6053
6077
|
}
|
|
6054
6078
|
async function scanRuntimeCacheEntries(homeDir) {
|
|
6055
|
-
const runtimesDir =
|
|
6079
|
+
const runtimesDir = path7.join(homeDir, "runtimes");
|
|
6056
6080
|
const dirents = await readdir(runtimesDir, { withFileTypes: true }).catch(() => null);
|
|
6057
6081
|
if (!dirents) return [];
|
|
6058
6082
|
const entries = [];
|
|
6059
6083
|
for (const dirent of dirents) {
|
|
6060
6084
|
if (!dirent.isDirectory()) continue;
|
|
6061
|
-
const cacheDir =
|
|
6085
|
+
const cacheDir = path7.join(runtimesDir, dirent.name);
|
|
6062
6086
|
const metadata = await readRuntimeInstallMetadata(cacheDir);
|
|
6063
6087
|
if (!metadata) continue;
|
|
6064
6088
|
const fallbackStat = await safeStat(cacheDir);
|
|
@@ -6081,7 +6105,7 @@ function parseTimestampMs(value) {
|
|
|
6081
6105
|
}
|
|
6082
6106
|
async function safeStat(targetPath) {
|
|
6083
6107
|
try {
|
|
6084
|
-
return await
|
|
6108
|
+
return await stat2(targetPath);
|
|
6085
6109
|
} catch {
|
|
6086
6110
|
return null;
|
|
6087
6111
|
}
|
|
@@ -6091,7 +6115,7 @@ async function directorySizeBytes(targetPath) {
|
|
|
6091
6115
|
if (!dirents) return 0;
|
|
6092
6116
|
let total = 0;
|
|
6093
6117
|
for (const dirent of dirents) {
|
|
6094
|
-
const entryPath =
|
|
6118
|
+
const entryPath = path7.join(targetPath, dirent.name);
|
|
6095
6119
|
if (dirent.isSymbolicLink()) continue;
|
|
6096
6120
|
if (dirent.isDirectory()) {
|
|
6097
6121
|
total += await directorySizeBytes(entryPath);
|
|
@@ -6103,14 +6127,14 @@ async function directorySizeBytes(targetPath) {
|
|
|
6103
6127
|
return total;
|
|
6104
6128
|
}
|
|
6105
6129
|
async function readActiveRuntimeVersions(homeDir) {
|
|
6106
|
-
const instancesDir =
|
|
6130
|
+
const instancesDir = path7.join(homeDir, "instances");
|
|
6107
6131
|
const dirents = await readdir(instancesDir, { withFileTypes: true }).catch(() => null);
|
|
6108
6132
|
if (!dirents) return [];
|
|
6109
6133
|
const versions = /* @__PURE__ */ new Set();
|
|
6110
6134
|
for (const dirent of dirents) {
|
|
6111
6135
|
if (!dirent.isDirectory()) continue;
|
|
6112
6136
|
try {
|
|
6113
|
-
const descriptorPath =
|
|
6137
|
+
const descriptorPath = path7.join(instancesDir, dirent.name, "runtime", "server.json");
|
|
6114
6138
|
const parsed = JSON.parse(await readFile(descriptorPath, "utf8"));
|
|
6115
6139
|
if (typeof parsed.version !== "string") continue;
|
|
6116
6140
|
if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0 && isPidRunning(parsed.pid)) {
|
|
@@ -6224,6 +6248,7 @@ var init_install = __esm({
|
|
|
6224
6248
|
"src/runtime/install.ts"() {
|
|
6225
6249
|
"use strict";
|
|
6226
6250
|
init_home();
|
|
6251
|
+
init_postgres_payload();
|
|
6227
6252
|
RUNTIME_NPM_PACKAGE_NAME = "@rudderhq/server";
|
|
6228
6253
|
NPM_PUBLIC_REGISTRY_URL = "https://registry.npmjs.org";
|
|
6229
6254
|
RUNTIME_METADATA_FILE = "runtime.json";
|
|
@@ -6267,7 +6292,7 @@ var init_install = __esm({
|
|
|
6267
6292
|
|
|
6268
6293
|
// src/runtime/server-entry.ts
|
|
6269
6294
|
import fs4 from "node:fs";
|
|
6270
|
-
import
|
|
6295
|
+
import path8 from "node:path";
|
|
6271
6296
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
6272
6297
|
function formatError(err) {
|
|
6273
6298
|
if (err instanceof Error) {
|
|
@@ -6289,8 +6314,8 @@ function maybeEnableUiDevMiddleware(entrypoint) {
|
|
|
6289
6314
|
}
|
|
6290
6315
|
}
|
|
6291
6316
|
function resolveDevServerEntry() {
|
|
6292
|
-
const projectRoot =
|
|
6293
|
-
return
|
|
6317
|
+
const projectRoot = path8.resolve(path8.dirname(fileURLToPath4(import.meta.url)), "../../..");
|
|
6318
|
+
return path8.resolve(projectRoot, "server/src/index.ts");
|
|
6294
6319
|
}
|
|
6295
6320
|
async function loadServerRuntimeModule(options) {
|
|
6296
6321
|
const devEntry = resolveDevServerEntry();
|
|
@@ -6430,21 +6455,21 @@ var init_auth_bootstrap_ceo = __esm({
|
|
|
6430
6455
|
|
|
6431
6456
|
// src/utils/path-resolver.ts
|
|
6432
6457
|
import fs9 from "node:fs";
|
|
6433
|
-
import
|
|
6458
|
+
import path19 from "node:path";
|
|
6434
6459
|
function unique(items) {
|
|
6435
6460
|
return Array.from(new Set(items));
|
|
6436
6461
|
}
|
|
6437
6462
|
function resolveRuntimeLikePath(value, configPath) {
|
|
6438
6463
|
const expanded = expandHomePrefix(value);
|
|
6439
|
-
if (
|
|
6464
|
+
if (path19.isAbsolute(expanded)) return path19.resolve(expanded);
|
|
6440
6465
|
const cwd = process.cwd();
|
|
6441
|
-
const configDir = configPath ?
|
|
6442
|
-
const workspaceRoot = configDir ?
|
|
6466
|
+
const configDir = configPath ? path19.dirname(configPath) : null;
|
|
6467
|
+
const workspaceRoot = configDir ? path19.resolve(configDir, "..") : cwd;
|
|
6443
6468
|
const candidates = unique([
|
|
6444
|
-
...configDir ? [
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6469
|
+
...configDir ? [path19.resolve(configDir, expanded)] : [],
|
|
6470
|
+
path19.resolve(workspaceRoot, "server", expanded),
|
|
6471
|
+
path19.resolve(workspaceRoot, expanded),
|
|
6472
|
+
path19.resolve(cwd, expanded)
|
|
6448
6473
|
]);
|
|
6449
6474
|
return candidates.find((candidate) => fs9.existsSync(candidate)) ?? candidates[0];
|
|
6450
6475
|
}
|
|
@@ -6458,7 +6483,7 @@ var init_path_resolver = __esm({
|
|
|
6458
6483
|
// src/config/secrets-key.ts
|
|
6459
6484
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
6460
6485
|
import fs10 from "node:fs";
|
|
6461
|
-
import
|
|
6486
|
+
import path20 from "node:path";
|
|
6462
6487
|
function ensureLocalSecretsKeyFile(config, configPath) {
|
|
6463
6488
|
if (config.secrets.provider !== "local_encrypted") {
|
|
6464
6489
|
return { status: "skipped_provider", path: null };
|
|
@@ -6473,7 +6498,7 @@ function ensureLocalSecretsKeyFile(config, configPath) {
|
|
|
6473
6498
|
if (fs10.existsSync(keyFilePath)) {
|
|
6474
6499
|
return { status: "existing", path: keyFilePath };
|
|
6475
6500
|
}
|
|
6476
|
-
fs10.mkdirSync(
|
|
6501
|
+
fs10.mkdirSync(path20.dirname(keyFilePath), { recursive: true });
|
|
6477
6502
|
fs10.writeFileSync(keyFilePath, randomBytes2(32).toString("base64"), {
|
|
6478
6503
|
encoding: "utf8",
|
|
6479
6504
|
mode: 384
|
|
@@ -7559,7 +7584,7 @@ var init_port_check = __esm({
|
|
|
7559
7584
|
// src/checks/secrets-check.ts
|
|
7560
7585
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
7561
7586
|
import fs13 from "node:fs";
|
|
7562
|
-
import
|
|
7587
|
+
import path21 from "node:path";
|
|
7563
7588
|
function decodeMasterKey(raw) {
|
|
7564
7589
|
const trimmed = raw.trim();
|
|
7565
7590
|
if (!trimmed) return null;
|
|
@@ -7629,7 +7654,7 @@ function secretsCheck(config, configPath) {
|
|
|
7629
7654
|
message: `Secrets key file does not exist yet: ${keyFilePath}`,
|
|
7630
7655
|
canRepair: true,
|
|
7631
7656
|
repair: () => {
|
|
7632
|
-
fs13.mkdirSync(
|
|
7657
|
+
fs13.mkdirSync(path21.dirname(keyFilePath), { recursive: true });
|
|
7633
7658
|
fs13.writeFileSync(keyFilePath, randomBytes3(32).toString("base64"), {
|
|
7634
7659
|
encoding: "utf8",
|
|
7635
7660
|
mode: 384
|
|
@@ -8202,7 +8227,7 @@ var init_run = __esm({
|
|
|
8202
8227
|
|
|
8203
8228
|
// src/commands/onboard.ts
|
|
8204
8229
|
import * as p14 from "@clack/prompts";
|
|
8205
|
-
import
|
|
8230
|
+
import path22 from "node:path";
|
|
8206
8231
|
import pc14 from "picocolors";
|
|
8207
8232
|
function parseBooleanFromEnv(rawValue) {
|
|
8208
8233
|
if (rawValue === void 0) return null;
|
|
@@ -8235,7 +8260,7 @@ function parseEnumFromEnv(rawValue, allowedValues) {
|
|
|
8235
8260
|
}
|
|
8236
8261
|
function resolvePathFromEnv(rawValue) {
|
|
8237
8262
|
if (!rawValue || rawValue.trim().length === 0) return null;
|
|
8238
|
-
return
|
|
8263
|
+
return path22.resolve(expandHomePrefix(rawValue.trim()));
|
|
8239
8264
|
}
|
|
8240
8265
|
function quickstartDefaultsFromEnv() {
|
|
8241
8266
|
const instanceId = resolveRudderInstanceId();
|
|
@@ -11397,41 +11422,41 @@ var RudderApiClient = class {
|
|
|
11397
11422
|
this.signal = opts.signal;
|
|
11398
11423
|
this.recoverAuth = opts.recoverAuth;
|
|
11399
11424
|
}
|
|
11400
|
-
get(
|
|
11401
|
-
return this.request(
|
|
11425
|
+
get(path25, opts) {
|
|
11426
|
+
return this.request(path25, { method: "GET" }, opts);
|
|
11402
11427
|
}
|
|
11403
|
-
post(
|
|
11404
|
-
return this.request(
|
|
11428
|
+
post(path25, body, opts) {
|
|
11429
|
+
return this.request(path25, {
|
|
11405
11430
|
method: "POST",
|
|
11406
11431
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11407
11432
|
}, opts);
|
|
11408
11433
|
}
|
|
11409
|
-
postForm(
|
|
11410
|
-
return this.request(
|
|
11434
|
+
postForm(path25, form, opts) {
|
|
11435
|
+
return this.request(path25, {
|
|
11411
11436
|
method: "POST",
|
|
11412
11437
|
body: form
|
|
11413
11438
|
}, opts);
|
|
11414
11439
|
}
|
|
11415
|
-
patch(
|
|
11416
|
-
return this.request(
|
|
11440
|
+
patch(path25, body, opts) {
|
|
11441
|
+
return this.request(path25, {
|
|
11417
11442
|
method: "PATCH",
|
|
11418
11443
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11419
11444
|
}, opts);
|
|
11420
11445
|
}
|
|
11421
|
-
put(
|
|
11422
|
-
return this.request(
|
|
11446
|
+
put(path25, body, opts) {
|
|
11447
|
+
return this.request(path25, {
|
|
11423
11448
|
method: "PUT",
|
|
11424
11449
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11425
11450
|
}, opts);
|
|
11426
11451
|
}
|
|
11427
|
-
delete(
|
|
11428
|
-
return this.request(
|
|
11452
|
+
delete(path25, opts) {
|
|
11453
|
+
return this.request(path25, { method: "DELETE" }, opts);
|
|
11429
11454
|
}
|
|
11430
11455
|
setApiKey(apiKey) {
|
|
11431
11456
|
this.apiKey = apiKey?.trim() || void 0;
|
|
11432
11457
|
}
|
|
11433
|
-
async request(
|
|
11434
|
-
const url = buildUrl(this.apiBase,
|
|
11458
|
+
async request(path25, init, opts, hasRetriedAuth = false) {
|
|
11459
|
+
const url = buildUrl(this.apiBase, path25);
|
|
11435
11460
|
const headers = {
|
|
11436
11461
|
accept: "application/json",
|
|
11437
11462
|
...toStringRecord(init.headers)
|
|
@@ -11462,13 +11487,13 @@ var RudderApiClient = class {
|
|
|
11462
11487
|
const apiError = await toApiError(response);
|
|
11463
11488
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
11464
11489
|
const recoveredToken = await this.recoverAuth({
|
|
11465
|
-
path:
|
|
11490
|
+
path: path25,
|
|
11466
11491
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
11467
11492
|
error: apiError
|
|
11468
11493
|
});
|
|
11469
11494
|
if (recoveredToken) {
|
|
11470
11495
|
this.setApiKey(recoveredToken);
|
|
11471
|
-
return this.request(
|
|
11496
|
+
return this.request(path25, init, opts, true);
|
|
11472
11497
|
}
|
|
11473
11498
|
}
|
|
11474
11499
|
throw apiError;
|
|
@@ -11487,8 +11512,8 @@ function shouldAttachAgentContext(method) {
|
|
|
11487
11512
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
11488
11513
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
11489
11514
|
}
|
|
11490
|
-
function buildUrl(apiBase,
|
|
11491
|
-
const normalizedPath =
|
|
11515
|
+
function buildUrl(apiBase, path25) {
|
|
11516
|
+
const normalizedPath = path25.startsWith("/") ? path25 : `/${path25}`;
|
|
11492
11517
|
const [pathname, query] = normalizedPath.split("?");
|
|
11493
11518
|
const url = new URL2(apiBase);
|
|
11494
11519
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -12782,7 +12807,7 @@ import pc4 from "picocolors";
|
|
|
12782
12807
|
init_home();
|
|
12783
12808
|
import { spawn as spawn2 } from "node:child_process";
|
|
12784
12809
|
import fs5 from "node:fs";
|
|
12785
|
-
import
|
|
12810
|
+
import path9 from "node:path";
|
|
12786
12811
|
import pc3 from "picocolors";
|
|
12787
12812
|
|
|
12788
12813
|
// src/client/command-label.ts
|
|
@@ -12805,8 +12830,8 @@ function normalizeApiBase(apiBase) {
|
|
|
12805
12830
|
return apiBase.trim().replace(/\/+$/, "");
|
|
12806
12831
|
}
|
|
12807
12832
|
function resolveBoardAuthStorePath(overridePath) {
|
|
12808
|
-
if (overridePath?.trim()) return
|
|
12809
|
-
if (process.env.RUDDER_AUTH_STORE?.trim()) return
|
|
12833
|
+
if (overridePath?.trim()) return path9.resolve(overridePath.trim());
|
|
12834
|
+
if (process.env.RUDDER_AUTH_STORE?.trim()) return path9.resolve(process.env.RUDDER_AUTH_STORE.trim());
|
|
12810
12835
|
return resolveDefaultCliAuthPath();
|
|
12811
12836
|
}
|
|
12812
12837
|
function readBoardAuthStore(storePath) {
|
|
@@ -12838,7 +12863,7 @@ function readBoardAuthStore(storePath) {
|
|
|
12838
12863
|
}
|
|
12839
12864
|
function writeBoardAuthStore(store, storePath) {
|
|
12840
12865
|
const filePath = resolveBoardAuthStorePath(storePath);
|
|
12841
|
-
fs5.mkdirSync(
|
|
12866
|
+
fs5.mkdirSync(path9.dirname(filePath), { recursive: true });
|
|
12842
12867
|
fs5.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}
|
|
12843
12868
|
`, { mode: 384 });
|
|
12844
12869
|
}
|
|
@@ -12986,26 +13011,26 @@ async function revokeStoredBoardCredential(params) {
|
|
|
12986
13011
|
// src/client/context.ts
|
|
12987
13012
|
init_home();
|
|
12988
13013
|
import fs6 from "node:fs";
|
|
12989
|
-
import
|
|
13014
|
+
import path10 from "node:path";
|
|
12990
13015
|
var DEFAULT_CONTEXT_BASENAME = "context.json";
|
|
12991
13016
|
var DEFAULT_PROFILE = "default";
|
|
12992
13017
|
function findContextFileFromAncestors(startDir) {
|
|
12993
|
-
const absoluteStartDir =
|
|
13018
|
+
const absoluteStartDir = path10.resolve(startDir);
|
|
12994
13019
|
let currentDir = absoluteStartDir;
|
|
12995
13020
|
while (true) {
|
|
12996
|
-
const candidate =
|
|
13021
|
+
const candidate = path10.resolve(currentDir, ".rudder", DEFAULT_CONTEXT_BASENAME);
|
|
12997
13022
|
if (fs6.existsSync(candidate)) {
|
|
12998
13023
|
return candidate;
|
|
12999
13024
|
}
|
|
13000
|
-
const nextDir =
|
|
13025
|
+
const nextDir = path10.resolve(currentDir, "..");
|
|
13001
13026
|
if (nextDir === currentDir) break;
|
|
13002
13027
|
currentDir = nextDir;
|
|
13003
13028
|
}
|
|
13004
13029
|
return null;
|
|
13005
13030
|
}
|
|
13006
13031
|
function resolveContextPath(overridePath) {
|
|
13007
|
-
if (overridePath) return
|
|
13008
|
-
if (process.env.RUDDER_CONTEXT) return
|
|
13032
|
+
if (overridePath) return path10.resolve(overridePath);
|
|
13033
|
+
if (process.env.RUDDER_CONTEXT) return path10.resolve(process.env.RUDDER_CONTEXT);
|
|
13009
13034
|
return findContextFileFromAncestors(process.cwd()) ?? resolveDefaultContextPath();
|
|
13010
13035
|
}
|
|
13011
13036
|
function defaultClientContext() {
|
|
@@ -13073,7 +13098,7 @@ function readContext(contextPath) {
|
|
|
13073
13098
|
}
|
|
13074
13099
|
function writeContext(context, contextPath) {
|
|
13075
13100
|
const filePath = resolveContextPath(contextPath);
|
|
13076
|
-
const dir =
|
|
13101
|
+
const dir = path10.dirname(filePath);
|
|
13077
13102
|
fs6.mkdirSync(dir, { recursive: true });
|
|
13078
13103
|
const normalized = normalizeContext(context);
|
|
13079
13104
|
fs6.writeFileSync(filePath, `${JSON.stringify(normalized, null, 2)}
|
|
@@ -13402,8 +13427,8 @@ function registerActivityCommands(program) {
|
|
|
13402
13427
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
13403
13428
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
13404
13429
|
const query = params.toString();
|
|
13405
|
-
const
|
|
13406
|
-
const rows = await ctx.api.get(
|
|
13430
|
+
const path25 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
13431
|
+
const rows = await ctx.api.get(path25) ?? [];
|
|
13407
13432
|
if (ctx.json) {
|
|
13408
13433
|
printOutput(rows, { json: true });
|
|
13409
13434
|
return;
|
|
@@ -13435,7 +13460,7 @@ function registerActivityCommands(program) {
|
|
|
13435
13460
|
|
|
13436
13461
|
// ../packages/agent-runtime-utils/dist/server-utils.cli.js
|
|
13437
13462
|
import { promises as fs7 } from "node:fs";
|
|
13438
|
-
import
|
|
13463
|
+
import path11 from "node:path";
|
|
13439
13464
|
|
|
13440
13465
|
// ../packages/agent-runtime-utils/dist/server-utils.process.js
|
|
13441
13466
|
var MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
|
|
@@ -13685,8 +13710,8 @@ var RUDDER_AGENT_HEARTBEAT_INSTRUCTION = [
|
|
|
13685
13710
|
// ../packages/agent-runtime-utils/dist/server-utils.cli.js
|
|
13686
13711
|
async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
|
|
13687
13712
|
const candidates = [
|
|
13688
|
-
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) =>
|
|
13689
|
-
...additionalCandidates.map((candidate) =>
|
|
13713
|
+
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path11.resolve(moduleDir, relativePath)),
|
|
13714
|
+
...additionalCandidates.map((candidate) => path11.resolve(candidate))
|
|
13690
13715
|
];
|
|
13691
13716
|
const seenRoots = /* @__PURE__ */ new Set();
|
|
13692
13717
|
for (const root of candidates) {
|
|
@@ -13703,26 +13728,26 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
13703
13728
|
return removeUnselectedRudderSkillSymlinks(skillsHome, allowedSkillNames);
|
|
13704
13729
|
}
|
|
13705
13730
|
async function readRudderMaterializedSkillSource(target) {
|
|
13706
|
-
const manifestPath =
|
|
13731
|
+
const manifestPath = path11.join(target, ".rudder", "materialized-skill.json");
|
|
13707
13732
|
const raw = await fs7.readFile(manifestPath, "utf8").catch(() => null);
|
|
13708
13733
|
if (!raw)
|
|
13709
13734
|
return null;
|
|
13710
13735
|
try {
|
|
13711
13736
|
const parsed = parseObject(JSON.parse(raw));
|
|
13712
13737
|
const sourcePath = asString(parsed.sourcePath, "").trim();
|
|
13713
|
-
return sourcePath.length > 0 ?
|
|
13738
|
+
return sourcePath.length > 0 ? path11.resolve(sourcePath) : null;
|
|
13714
13739
|
} catch {
|
|
13715
13740
|
return null;
|
|
13716
13741
|
}
|
|
13717
13742
|
}
|
|
13718
13743
|
async function removeUnselectedRudderSkillSymlinks(skillsHome, allowedSkillNames, knownSkillSources = []) {
|
|
13719
13744
|
const allowed = new Set(Array.from(allowedSkillNames));
|
|
13720
|
-
const knownSources = new Set(Array.from(knownSkillSources).map((value) => value.trim()).filter(Boolean).map((value) =>
|
|
13745
|
+
const knownSources = new Set(Array.from(knownSkillSources).map((value) => value.trim()).filter(Boolean).map((value) => path11.resolve(value)));
|
|
13721
13746
|
try {
|
|
13722
13747
|
const entries = await fs7.readdir(skillsHome, { withFileTypes: true });
|
|
13723
13748
|
const removed = [];
|
|
13724
13749
|
for (const entry of entries) {
|
|
13725
|
-
const target =
|
|
13750
|
+
const target = path11.join(skillsHome, entry.name);
|
|
13726
13751
|
const existing = await fs7.lstat(target).catch(() => null);
|
|
13727
13752
|
if (!existing)
|
|
13728
13753
|
continue;
|
|
@@ -13731,8 +13756,8 @@ async function removeUnselectedRudderSkillSymlinks(skillsHome, allowedSkillNames
|
|
|
13731
13756
|
const linkedPath = await fs7.readlink(target).catch(() => null);
|
|
13732
13757
|
if (!linkedPath)
|
|
13733
13758
|
continue;
|
|
13734
|
-
const resolvedLinkedPath =
|
|
13735
|
-
isRudderManagedSkill = knownSources.has(
|
|
13759
|
+
const resolvedLinkedPath = path11.isAbsolute(linkedPath) ? linkedPath : path11.resolve(path11.dirname(target), linkedPath);
|
|
13760
|
+
isRudderManagedSkill = knownSources.has(path11.resolve(resolvedLinkedPath)) || isMaintainerOnlySkillTarget(linkedPath) || isMaintainerOnlySkillTarget(resolvedLinkedPath);
|
|
13736
13761
|
} else if (existing.isDirectory()) {
|
|
13737
13762
|
const materializedSource = await readRudderMaterializedSkillSource(target);
|
|
13738
13763
|
isRudderManagedSkill = materializedSource !== null && knownSources.has(materializedSource);
|
|
@@ -13754,7 +13779,7 @@ async function removeUnselectedRudderSkillSymlinks(skillsHome, allowedSkillNames
|
|
|
13754
13779
|
init_dist();
|
|
13755
13780
|
import fs8 from "node:fs/promises";
|
|
13756
13781
|
import os3 from "node:os";
|
|
13757
|
-
import
|
|
13782
|
+
import path12 from "node:path";
|
|
13758
13783
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
13759
13784
|
|
|
13760
13785
|
// src/commands/client/help.ts
|
|
@@ -13778,16 +13803,16 @@ function formatHelpExample(example) {
|
|
|
13778
13803
|
}
|
|
13779
13804
|
|
|
13780
13805
|
// src/commands/client/agent.ts
|
|
13781
|
-
var __moduleDir =
|
|
13806
|
+
var __moduleDir = path12.dirname(fileURLToPath5(import.meta.url));
|
|
13782
13807
|
function codexSkillsHome() {
|
|
13783
13808
|
const fromEnv = process.env.CODEX_HOME?.trim();
|
|
13784
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
13785
|
-
return
|
|
13809
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path12.join(os3.homedir(), ".codex");
|
|
13810
|
+
return path12.join(base, "skills");
|
|
13786
13811
|
}
|
|
13787
13812
|
function claudeSkillsHome() {
|
|
13788
13813
|
const fromEnv = process.env.CLAUDE_HOME?.trim();
|
|
13789
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
13790
|
-
return
|
|
13814
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path12.join(os3.homedir(), ".claude");
|
|
13815
|
+
return path12.join(base, "skills");
|
|
13791
13816
|
}
|
|
13792
13817
|
async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
13793
13818
|
const summary = {
|
|
@@ -13806,8 +13831,8 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
13806
13831
|
);
|
|
13807
13832
|
for (const entry of entries) {
|
|
13808
13833
|
if (!entry.isDirectory()) continue;
|
|
13809
|
-
const source =
|
|
13810
|
-
const target =
|
|
13834
|
+
const source = path12.join(sourceSkillsDir, entry.name);
|
|
13835
|
+
const target = path12.join(targetSkillsDir, entry.name);
|
|
13811
13836
|
const existing = await fs8.lstat(target).catch(() => null);
|
|
13812
13837
|
if (existing) {
|
|
13813
13838
|
if (existing.isSymbolicLink()) {
|
|
@@ -13828,7 +13853,7 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
13828
13853
|
continue;
|
|
13829
13854
|
}
|
|
13830
13855
|
}
|
|
13831
|
-
const resolvedLinkedPath =
|
|
13856
|
+
const resolvedLinkedPath = path12.isAbsolute(linkedPath) ? linkedPath : path12.resolve(path12.dirname(target), linkedPath);
|
|
13832
13857
|
const linkedTargetExists = await fs8.stat(resolvedLinkedPath).then(() => true).catch(() => false);
|
|
13833
13858
|
if (!linkedTargetExists) {
|
|
13834
13859
|
await fs8.unlink(target);
|
|
@@ -14055,7 +14080,7 @@ function registerAgentCommands(program) {
|
|
|
14055
14080
|
if (opts.markdown && opts.markdownFile) {
|
|
14056
14081
|
throw new Error("Pass only one of --markdown or --markdown-file.");
|
|
14057
14082
|
}
|
|
14058
|
-
const markdown = opts.markdownFile ? await fs8.readFile(
|
|
14083
|
+
const markdown = opts.markdownFile ? await fs8.readFile(path12.resolve(opts.markdownFile), "utf8") : opts.markdown;
|
|
14059
14084
|
const payload = organizationSkillCreateSchema.parse({
|
|
14060
14085
|
name: opts.name,
|
|
14061
14086
|
slug: opts.slug?.trim() || null,
|
|
@@ -14234,7 +14259,7 @@ function registerAgentCommands(program) {
|
|
|
14234
14259
|
}
|
|
14235
14260
|
const installSummaries = [];
|
|
14236
14261
|
if (opts.installSkills !== false) {
|
|
14237
|
-
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [
|
|
14262
|
+
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path12.resolve(process.cwd(), "skills")]);
|
|
14238
14263
|
if (!skillsDir) {
|
|
14239
14264
|
throw new Error(
|
|
14240
14265
|
"Could not locate local Rudder skills directory. Expected ./skills in the repo checkout."
|
|
@@ -14327,10 +14352,10 @@ async function buildAgentUpdatePatch(opts) {
|
|
|
14327
14352
|
if (opts.capabilities !== void 0) rawPatch.capabilities = opts.capabilities;
|
|
14328
14353
|
if (opts.description !== void 0) rawPatch.capabilities = opts.description;
|
|
14329
14354
|
if (opts.capabilitiesFile !== void 0) {
|
|
14330
|
-
rawPatch.capabilities = await fs8.readFile(
|
|
14355
|
+
rawPatch.capabilities = await fs8.readFile(path12.resolve(opts.capabilitiesFile), "utf8");
|
|
14331
14356
|
}
|
|
14332
14357
|
if (opts.descriptionFile !== void 0) {
|
|
14333
|
-
rawPatch.capabilities = await fs8.readFile(
|
|
14358
|
+
rawPatch.capabilities = await fs8.readFile(path12.resolve(opts.descriptionFile), "utf8");
|
|
14334
14359
|
}
|
|
14335
14360
|
if (clearCapabilities) rawPatch.capabilities = null;
|
|
14336
14361
|
return updateAgentSchema.parse(rawPatch);
|
|
@@ -14354,7 +14379,7 @@ function parseJsonObject(value, name) {
|
|
|
14354
14379
|
// src/commands/client/approval.ts
|
|
14355
14380
|
init_dist();
|
|
14356
14381
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
14357
|
-
import
|
|
14382
|
+
import path13 from "node:path";
|
|
14358
14383
|
function registerApprovalCommands(program) {
|
|
14359
14384
|
const approval = program.command("approval").description("Approval operations");
|
|
14360
14385
|
addCommonClientOptions(
|
|
@@ -14545,7 +14570,7 @@ async function readTextInputFile(inputPath, optionName) {
|
|
|
14545
14570
|
if (inputPath === "-") {
|
|
14546
14571
|
return readStdinText();
|
|
14547
14572
|
}
|
|
14548
|
-
const resolvedPath =
|
|
14573
|
+
const resolvedPath = path13.resolve(process.cwd(), inputPath);
|
|
14549
14574
|
return readFile2(resolvedPath, "utf8").catch((err) => {
|
|
14550
14575
|
throw new Error(`Unable to read ${optionName} ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
14551
14576
|
});
|
|
@@ -15382,12 +15407,12 @@ async function readStdin() {
|
|
|
15382
15407
|
|
|
15383
15408
|
// src/commands/client/company.ts
|
|
15384
15409
|
import * as p3 from "@clack/prompts";
|
|
15385
|
-
import { mkdir as
|
|
15386
|
-
import
|
|
15410
|
+
import { mkdir as mkdir3, readdir as readdir2, readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
|
|
15411
|
+
import path15 from "node:path";
|
|
15387
15412
|
import pc5 from "picocolors";
|
|
15388
15413
|
|
|
15389
15414
|
// src/commands/client/zip.ts
|
|
15390
|
-
import
|
|
15415
|
+
import path14 from "node:path";
|
|
15391
15416
|
import { inflateRawSync } from "node:zlib";
|
|
15392
15417
|
var textDecoder = new TextDecoder();
|
|
15393
15418
|
var binaryContentTypeByExtension = {
|
|
@@ -15415,7 +15440,7 @@ function sharedArchiveRoot(paths) {
|
|
|
15415
15440
|
return firstSegments.every((parts) => parts.length > 1 && parts[0] === candidate) ? candidate : null;
|
|
15416
15441
|
}
|
|
15417
15442
|
function bytesToPortableFileEntry(pathValue, bytes) {
|
|
15418
|
-
const contentType = binaryContentTypeByExtension[
|
|
15443
|
+
const contentType = binaryContentTypeByExtension[path14.extname(pathValue).toLowerCase()];
|
|
15419
15444
|
if (!contentType) return textDecoder.decode(bytes);
|
|
15420
15445
|
return {
|
|
15421
15446
|
encoding: "base64",
|
|
@@ -15503,7 +15528,7 @@ var IMPORT_INCLUDE_OPTIONS = [
|
|
|
15503
15528
|
];
|
|
15504
15529
|
var IMPORT_PREVIEW_SAMPLE_LIMIT = 6;
|
|
15505
15530
|
function readPortableFileEntry(filePath, contents) {
|
|
15506
|
-
const contentType = binaryContentTypeByExtension[
|
|
15531
|
+
const contentType = binaryContentTypeByExtension[path15.extname(filePath).toLowerCase()];
|
|
15507
15532
|
if (!contentType) return contents.toString("utf8");
|
|
15508
15533
|
return {
|
|
15509
15534
|
encoding: "base64",
|
|
@@ -15558,10 +15583,10 @@ function normalizePortablePath(filePath) {
|
|
|
15558
15583
|
return filePath.replace(/\\/g, "/");
|
|
15559
15584
|
}
|
|
15560
15585
|
function shouldIncludePortableFile(filePath) {
|
|
15561
|
-
const baseName =
|
|
15586
|
+
const baseName = path15.basename(filePath);
|
|
15562
15587
|
const isMarkdown = baseName.endsWith(".md");
|
|
15563
15588
|
const isPaperclipYaml = baseName === ".rudder.yaml" || baseName === ".rudder.yml";
|
|
15564
|
-
const contentType = binaryContentTypeByExtension[
|
|
15589
|
+
const contentType = binaryContentTypeByExtension[path15.extname(baseName).toLowerCase()];
|
|
15565
15590
|
return isMarkdown || isPaperclipYaml || Boolean(contentType);
|
|
15566
15591
|
}
|
|
15567
15592
|
function findPortableExtensionPath(files) {
|
|
@@ -16116,7 +16141,7 @@ function normalizeGithubImportSource(input, refOverride) {
|
|
|
16116
16141
|
}
|
|
16117
16142
|
async function pathExists(inputPath) {
|
|
16118
16143
|
try {
|
|
16119
|
-
await
|
|
16144
|
+
await stat3(path15.resolve(inputPath));
|
|
16120
16145
|
return true;
|
|
16121
16146
|
} catch {
|
|
16122
16147
|
return false;
|
|
@@ -16126,45 +16151,45 @@ async function collectPackageFiles(root, current, files) {
|
|
|
16126
16151
|
const entries = await readdir2(current, { withFileTypes: true });
|
|
16127
16152
|
for (const entry of entries) {
|
|
16128
16153
|
if (entry.name.startsWith(".git")) continue;
|
|
16129
|
-
const absolutePath =
|
|
16154
|
+
const absolutePath = path15.join(current, entry.name);
|
|
16130
16155
|
if (entry.isDirectory()) {
|
|
16131
16156
|
await collectPackageFiles(root, absolutePath, files);
|
|
16132
16157
|
continue;
|
|
16133
16158
|
}
|
|
16134
16159
|
if (!entry.isFile()) continue;
|
|
16135
|
-
const relativePath =
|
|
16160
|
+
const relativePath = path15.relative(root, absolutePath).replace(/\\/g, "/");
|
|
16136
16161
|
if (!shouldIncludePortableFile(relativePath)) continue;
|
|
16137
16162
|
files[relativePath] = readPortableFileEntry(relativePath, await readFile3(absolutePath));
|
|
16138
16163
|
}
|
|
16139
16164
|
}
|
|
16140
16165
|
async function resolveInlineSourceFromPath(inputPath) {
|
|
16141
|
-
const resolved =
|
|
16142
|
-
const resolvedStat = await
|
|
16143
|
-
if (resolvedStat.isFile() &&
|
|
16166
|
+
const resolved = path15.resolve(inputPath);
|
|
16167
|
+
const resolvedStat = await stat3(resolved);
|
|
16168
|
+
if (resolvedStat.isFile() && path15.extname(resolved).toLowerCase() === ".zip") {
|
|
16144
16169
|
const archive = await readZipArchive(await readFile3(resolved));
|
|
16145
16170
|
const filteredFiles = Object.fromEntries(
|
|
16146
16171
|
Object.entries(archive.files).filter(([relativePath]) => shouldIncludePortableFile(relativePath))
|
|
16147
16172
|
);
|
|
16148
16173
|
return {
|
|
16149
|
-
rootPath: archive.rootPath ??
|
|
16174
|
+
rootPath: archive.rootPath ?? path15.basename(resolved, ".zip"),
|
|
16150
16175
|
files: filteredFiles
|
|
16151
16176
|
};
|
|
16152
16177
|
}
|
|
16153
|
-
const rootDir = resolvedStat.isDirectory() ? resolved :
|
|
16178
|
+
const rootDir = resolvedStat.isDirectory() ? resolved : path15.dirname(resolved);
|
|
16154
16179
|
const files = {};
|
|
16155
16180
|
await collectPackageFiles(rootDir, rootDir, files);
|
|
16156
16181
|
return {
|
|
16157
|
-
rootPath:
|
|
16182
|
+
rootPath: path15.basename(rootDir),
|
|
16158
16183
|
files
|
|
16159
16184
|
};
|
|
16160
16185
|
}
|
|
16161
16186
|
async function writeExportToFolder(outDir, exported) {
|
|
16162
|
-
const root =
|
|
16163
|
-
await
|
|
16187
|
+
const root = path15.resolve(outDir);
|
|
16188
|
+
await mkdir3(root, { recursive: true });
|
|
16164
16189
|
for (const [relativePath, content] of Object.entries(exported.files)) {
|
|
16165
16190
|
const normalized = relativePath.replace(/\\/g, "/");
|
|
16166
|
-
const filePath =
|
|
16167
|
-
await
|
|
16191
|
+
const filePath = path15.join(root, normalized);
|
|
16192
|
+
await mkdir3(path15.dirname(filePath), { recursive: true });
|
|
16168
16193
|
const writeValue = portableFileEntryToWriteValue(content);
|
|
16169
16194
|
if (typeof writeValue === "string") {
|
|
16170
16195
|
await writeFile2(filePath, writeValue, "utf8");
|
|
@@ -16174,8 +16199,8 @@ async function writeExportToFolder(outDir, exported) {
|
|
|
16174
16199
|
}
|
|
16175
16200
|
}
|
|
16176
16201
|
async function confirmOverwriteExportDirectory(outDir) {
|
|
16177
|
-
const root =
|
|
16178
|
-
const stats = await
|
|
16202
|
+
const root = path15.resolve(outDir);
|
|
16203
|
+
const stats = await stat3(root).catch(() => null);
|
|
16179
16204
|
if (!stats) return;
|
|
16180
16205
|
if (!stats.isDirectory()) {
|
|
16181
16206
|
throw new Error(`Export output path ${root} exists and is not a directory.`);
|
|
@@ -16324,7 +16349,7 @@ function registerCompanyCommands(program) {
|
|
|
16324
16349
|
printOutput(
|
|
16325
16350
|
{
|
|
16326
16351
|
ok: true,
|
|
16327
|
-
out:
|
|
16352
|
+
out: path15.resolve(opts.out),
|
|
16328
16353
|
rootPath: exported.rootPath,
|
|
16329
16354
|
filesWritten: Object.keys(exported.files).length,
|
|
16330
16355
|
rudderExtensionPath: exported.rudderExtensionPath,
|
|
@@ -16685,8 +16710,8 @@ function registerDashboardCommands(program) {
|
|
|
16685
16710
|
|
|
16686
16711
|
// src/commands/client/issue.ts
|
|
16687
16712
|
init_dist();
|
|
16688
|
-
import { readFile as readFile4, stat as
|
|
16689
|
-
import
|
|
16713
|
+
import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
|
|
16714
|
+
import path16 from "node:path";
|
|
16690
16715
|
function registerIssueCommands(program) {
|
|
16691
16716
|
const issue = program.command("issue").description("Issue operations");
|
|
16692
16717
|
addCommonClientOptions(
|
|
@@ -17050,7 +17075,7 @@ async function readTextInputFile2(inputPath, optionName) {
|
|
|
17050
17075
|
if (inputPath === "-") {
|
|
17051
17076
|
return readStdinText2();
|
|
17052
17077
|
}
|
|
17053
|
-
const resolvedPath =
|
|
17078
|
+
const resolvedPath = path16.resolve(process.cwd(), inputPath);
|
|
17054
17079
|
return readFile4(resolvedPath, "utf8").catch((err) => {
|
|
17055
17080
|
throw new Error(`Unable to read ${optionName} ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
17056
17081
|
});
|
|
@@ -17107,14 +17132,14 @@ async function appendUploadedIssueImages(ctx, issueId, body, imagePaths) {
|
|
|
17107
17132
|
${imageBlock}` : imageBlock;
|
|
17108
17133
|
}
|
|
17109
17134
|
async function uploadIssueCommentImage(ctx, issue, imagePath) {
|
|
17110
|
-
const resolvedPath =
|
|
17111
|
-
const stats = await
|
|
17135
|
+
const resolvedPath = path16.resolve(process.cwd(), imagePath);
|
|
17136
|
+
const stats = await stat4(resolvedPath).catch((err) => {
|
|
17112
17137
|
throw new Error(`Unable to read image ${imagePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
17113
17138
|
});
|
|
17114
17139
|
if (!stats.isFile()) {
|
|
17115
17140
|
throw new Error(`Image path must be a file: ${imagePath}`);
|
|
17116
17141
|
}
|
|
17117
|
-
const filename =
|
|
17142
|
+
const filename = path16.basename(resolvedPath);
|
|
17118
17143
|
const contentType = inferCommentImageContentType(filename);
|
|
17119
17144
|
const buffer = await readFile4(resolvedPath);
|
|
17120
17145
|
if (buffer.length <= 0) {
|
|
@@ -17133,7 +17158,7 @@ async function uploadIssueCommentImage(ctx, issue, imagePath) {
|
|
|
17133
17158
|
return attachment;
|
|
17134
17159
|
}
|
|
17135
17160
|
function inferCommentImageContentType(filename) {
|
|
17136
|
-
const ext =
|
|
17161
|
+
const ext = path16.extname(filename).toLowerCase();
|
|
17137
17162
|
switch (ext) {
|
|
17138
17163
|
case ".png":
|
|
17139
17164
|
return "image/png";
|
|
@@ -17237,7 +17262,7 @@ function formatIssueSearchMatch(match) {
|
|
|
17237
17262
|
|
|
17238
17263
|
// src/commands/client/library.ts
|
|
17239
17264
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
17240
|
-
import
|
|
17265
|
+
import path17 from "node:path";
|
|
17241
17266
|
function toLibraryFileLinkResult(detail) {
|
|
17242
17267
|
return {
|
|
17243
17268
|
filePath: detail.filePath,
|
|
@@ -17382,7 +17407,7 @@ async function resolveBodyFileInput(inputPath) {
|
|
|
17382
17407
|
if (inputPath === "-") {
|
|
17383
17408
|
return readStdinText3();
|
|
17384
17409
|
}
|
|
17385
|
-
const resolvedPath =
|
|
17410
|
+
const resolvedPath = path17.resolve(process.cwd(), inputPath);
|
|
17386
17411
|
return readFile5(resolvedPath, "utf8").catch((err) => {
|
|
17387
17412
|
throw new Error(`Unable to read --body-file ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
17388
17413
|
});
|
|
@@ -17396,16 +17421,16 @@ async function readStdinText3() {
|
|
|
17396
17421
|
}
|
|
17397
17422
|
|
|
17398
17423
|
// src/commands/client/plugin.ts
|
|
17399
|
-
import
|
|
17424
|
+
import path18 from "node:path";
|
|
17400
17425
|
import pc7 from "picocolors";
|
|
17401
17426
|
function resolvePackageArg(packageArg, isLocal) {
|
|
17402
17427
|
if (!isLocal) return packageArg;
|
|
17403
|
-
if (
|
|
17428
|
+
if (path18.isAbsolute(packageArg)) return packageArg;
|
|
17404
17429
|
if (packageArg.startsWith("~")) {
|
|
17405
17430
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
17406
|
-
return
|
|
17431
|
+
return path18.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
17407
17432
|
}
|
|
17408
|
-
return
|
|
17433
|
+
return path18.resolve(process.cwd(), packageArg);
|
|
17409
17434
|
}
|
|
17410
17435
|
function formatPlugin(p16) {
|
|
17411
17436
|
const statusColor = p16.status === "ready" ? pc7.green(p16.status) : p16.status === "error" ? pc7.red(p16.status) : p16.status === "disabled" ? pc7.dim(p16.status) : pc7.yellow(p16.status);
|
|
@@ -18348,8 +18373,8 @@ function registerUserCommands(program) {
|
|
|
18348
18373
|
appendParam(params, "limit", opts.limit);
|
|
18349
18374
|
appendParam(params, "cursor", opts.cursor);
|
|
18350
18375
|
const query = params.toString();
|
|
18351
|
-
const
|
|
18352
|
-
const result = await ctx.api.get(
|
|
18376
|
+
const path25 = `/api/orgs/${ctx.orgId}/users/${encodeURIComponent(userId)}/activity-ledger${query ? `?${query}` : ""}`;
|
|
18377
|
+
const result = await ctx.api.get(path25);
|
|
18353
18378
|
if (ctx.json) {
|
|
18354
18379
|
printOutput(result, { json: true });
|
|
18355
18380
|
return;
|
|
@@ -19168,9 +19193,9 @@ import * as p15 from "@clack/prompts";
|
|
|
19168
19193
|
import { spawn as spawn3, spawnSync as spawnSync4 } from "node:child_process";
|
|
19169
19194
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
19170
19195
|
import { createWriteStream, constants as fsConstants, mkdirSync, readFileSync as readFileSync2 } from "node:fs";
|
|
19171
|
-
import { access, chmod, copyFile as copyFile2, cp as
|
|
19196
|
+
import { access, chmod, copyFile as copyFile2, cp as cp3, mkdir as mkdir4, mkdtemp as mkdtemp2, readdir as readdir3, readFile as readFile6, rm as rm2, stat as stat5, utimes, writeFile as writeFile3 } from "node:fs/promises";
|
|
19172
19197
|
import { homedir, tmpdir } from "node:os";
|
|
19173
|
-
import
|
|
19198
|
+
import path23 from "node:path";
|
|
19174
19199
|
import { Readable, Transform } from "node:stream";
|
|
19175
19200
|
import { pipeline } from "node:stream/promises";
|
|
19176
19201
|
import { clearTimeout as clearTimeout2, setTimeout as setTimeout2 } from "node:timers";
|
|
@@ -19528,38 +19553,38 @@ function resolveDesktopAssetTarget(platform = process.platform, arch = process.a
|
|
|
19528
19553
|
throw new Error(`Rudder Desktop does not publish portable assets for ${platform}.`);
|
|
19529
19554
|
}
|
|
19530
19555
|
function resolveDefaultDesktopInstallRoot(target, env = process.env, homeDir = homedir()) {
|
|
19531
|
-
if (target.platform === "macos") return
|
|
19556
|
+
if (target.platform === "macos") return path23.join(homeDir, "Applications");
|
|
19532
19557
|
if (target.platform === "windows") {
|
|
19533
|
-
const localAppData = env.LOCALAPPDATA?.trim() ||
|
|
19534
|
-
return
|
|
19558
|
+
const localAppData = env.LOCALAPPDATA?.trim() || path23.join(homeDir, "AppData", "Local");
|
|
19559
|
+
return path23.join(localAppData, "Programs", DESKTOP_APP_NAME);
|
|
19535
19560
|
}
|
|
19536
|
-
return
|
|
19561
|
+
return path23.join(homeDir, ".local", "share", "rudder");
|
|
19537
19562
|
}
|
|
19538
19563
|
function resolveDesktopInstallPaths(target, installRoot) {
|
|
19539
|
-
const root =
|
|
19564
|
+
const root = path23.resolve(installRoot);
|
|
19540
19565
|
if (target.platform === "macos") {
|
|
19541
|
-
const appPath2 =
|
|
19566
|
+
const appPath2 = path23.join(root, `${DESKTOP_APP_NAME}.app`);
|
|
19542
19567
|
return {
|
|
19543
19568
|
installRoot: root,
|
|
19544
19569
|
appPath: appPath2,
|
|
19545
|
-
executablePath:
|
|
19546
|
-
metadataPath:
|
|
19570
|
+
executablePath: path23.join(appPath2, "Contents", "MacOS", DESKTOP_APP_NAME),
|
|
19571
|
+
metadataPath: path23.join(root, DESKTOP_METADATA_FILE)
|
|
19547
19572
|
};
|
|
19548
19573
|
}
|
|
19549
19574
|
if (target.platform === "windows") {
|
|
19550
19575
|
return {
|
|
19551
19576
|
installRoot: root,
|
|
19552
19577
|
appPath: root,
|
|
19553
|
-
executablePath:
|
|
19554
|
-
metadataPath:
|
|
19578
|
+
executablePath: path23.join(root, `${DESKTOP_APP_NAME}.exe`),
|
|
19579
|
+
metadataPath: path23.join(root, DESKTOP_METADATA_FILE)
|
|
19555
19580
|
};
|
|
19556
19581
|
}
|
|
19557
|
-
const appPath =
|
|
19582
|
+
const appPath = path23.join(root, `${DESKTOP_APP_NAME}.AppImage`);
|
|
19558
19583
|
return {
|
|
19559
19584
|
installRoot: root,
|
|
19560
19585
|
appPath,
|
|
19561
19586
|
executablePath: appPath,
|
|
19562
|
-
metadataPath:
|
|
19587
|
+
metadataPath: path23.join(root, DESKTOP_METADATA_FILE)
|
|
19563
19588
|
};
|
|
19564
19589
|
}
|
|
19565
19590
|
function normalizeAssetName(name) {
|
|
@@ -19732,7 +19757,7 @@ function contentLengthFromHeaders(headers) {
|
|
|
19732
19757
|
}
|
|
19733
19758
|
async function downloadAsset(asset, outputDir, progressFactory = createByteProgress) {
|
|
19734
19759
|
mkdirSync(outputDir, { recursive: true });
|
|
19735
|
-
const outputPath =
|
|
19760
|
+
const outputPath = path23.join(outputDir, path23.basename(asset.name));
|
|
19736
19761
|
const ASSET_DOWNLOAD_TIMEOUT_MS = 6e5;
|
|
19737
19762
|
let response = null;
|
|
19738
19763
|
const failures = [];
|
|
@@ -19790,16 +19815,16 @@ function parseChecksumFile(contents) {
|
|
|
19790
19815
|
return checksums;
|
|
19791
19816
|
}
|
|
19792
19817
|
function resolveAssetChecksum(checksums, assetName) {
|
|
19793
|
-
const expected = checksums.get(
|
|
19818
|
+
const expected = checksums.get(path23.basename(assetName));
|
|
19794
19819
|
if (!expected) {
|
|
19795
|
-
throw new Error(`Desktop release checksums do not include ${
|
|
19820
|
+
throw new Error(`Desktop release checksums do not include ${path23.basename(assetName)}.`);
|
|
19796
19821
|
}
|
|
19797
19822
|
return expected;
|
|
19798
19823
|
}
|
|
19799
19824
|
function assertChecksumMatch(filePath, expected) {
|
|
19800
19825
|
const actual = checksumForFile(filePath);
|
|
19801
19826
|
if (actual !== expected.toLowerCase()) {
|
|
19802
|
-
throw new Error(`Checksum mismatch for ${
|
|
19827
|
+
throw new Error(`Checksum mismatch for ${path23.basename(filePath)}.`);
|
|
19803
19828
|
}
|
|
19804
19829
|
return actual;
|
|
19805
19830
|
}
|
|
@@ -19818,10 +19843,10 @@ function normalizeDesktopAssetChecksum(checksum) {
|
|
|
19818
19843
|
return normalized;
|
|
19819
19844
|
}
|
|
19820
19845
|
function resolveDesktopAssetCacheDir(assetChecksum, homeDir = resolveRudderHomeDir()) {
|
|
19821
|
-
return
|
|
19846
|
+
return path23.join(homeDir, DESKTOP_ASSET_CACHE_DIR, normalizeDesktopAssetChecksum(assetChecksum));
|
|
19822
19847
|
}
|
|
19823
19848
|
function resolveDesktopCachedAssetPath(assetName, assetChecksum, homeDir = resolveRudderHomeDir()) {
|
|
19824
|
-
return
|
|
19849
|
+
return path23.join(resolveDesktopAssetCacheDir(assetChecksum, homeDir), path23.basename(assetName));
|
|
19825
19850
|
}
|
|
19826
19851
|
async function pruneDesktopAssetCache(options = {}) {
|
|
19827
19852
|
const homeDir = options.homeDir ?? resolveRudderHomeDir();
|
|
@@ -19867,7 +19892,7 @@ async function maybePruneDesktopAssetCache(options) {
|
|
|
19867
19892
|
return result.deleted.length > 0 || result.warnings.length > 0 ? result : null;
|
|
19868
19893
|
}
|
|
19869
19894
|
async function scanDesktopAssetCacheEntries(homeDir) {
|
|
19870
|
-
const cacheRoot =
|
|
19895
|
+
const cacheRoot = path23.join(homeDir, DESKTOP_ASSET_CACHE_DIR);
|
|
19871
19896
|
const dirents = await readdir3(cacheRoot, { withFileTypes: true }).catch(() => null);
|
|
19872
19897
|
if (!dirents) return [];
|
|
19873
19898
|
const entries = [];
|
|
@@ -19879,7 +19904,7 @@ async function scanDesktopAssetCacheEntries(homeDir) {
|
|
|
19879
19904
|
} catch {
|
|
19880
19905
|
continue;
|
|
19881
19906
|
}
|
|
19882
|
-
const cacheDir =
|
|
19907
|
+
const cacheDir = path23.join(cacheRoot, dirent.name);
|
|
19883
19908
|
const stats = await desktopCacheDirectoryStats(cacheDir);
|
|
19884
19909
|
entries.push({
|
|
19885
19910
|
cacheDir,
|
|
@@ -19891,7 +19916,7 @@ async function scanDesktopAssetCacheEntries(homeDir) {
|
|
|
19891
19916
|
return entries;
|
|
19892
19917
|
}
|
|
19893
19918
|
async function desktopCacheDirectoryStats(targetPath) {
|
|
19894
|
-
const fallbackStat = await
|
|
19919
|
+
const fallbackStat = await stat5(targetPath).catch(() => null);
|
|
19895
19920
|
const dirents = await readdir3(targetPath, { withFileTypes: true }).catch(() => null);
|
|
19896
19921
|
if (!dirents) {
|
|
19897
19922
|
return {
|
|
@@ -19903,8 +19928,8 @@ async function desktopCacheDirectoryStats(targetPath) {
|
|
|
19903
19928
|
let lastUsedAtMs = Number(fallbackStat?.mtimeMs ?? 0);
|
|
19904
19929
|
for (const dirent of dirents) {
|
|
19905
19930
|
if (dirent.isSymbolicLink()) continue;
|
|
19906
|
-
const entryPath =
|
|
19907
|
-
const entryStat = await
|
|
19931
|
+
const entryPath = path23.join(targetPath, dirent.name);
|
|
19932
|
+
const entryStat = await stat5(entryPath).catch(() => null);
|
|
19908
19933
|
if (!entryStat) continue;
|
|
19909
19934
|
lastUsedAtMs = Math.max(lastUsedAtMs, Number(entryStat.mtimeMs ?? 0));
|
|
19910
19935
|
if (dirent.isDirectory()) {
|
|
@@ -19980,13 +20005,13 @@ async function downloadDesktopAssetWithCache(asset, expectedChecksum, options =
|
|
|
19980
20005
|
await rm2(cachePath, { force: true });
|
|
19981
20006
|
}
|
|
19982
20007
|
}
|
|
19983
|
-
const outputDir = options.outputDir ?? await mkdtemp2(
|
|
20008
|
+
const outputDir = options.outputDir ?? await mkdtemp2(path23.join(tmpdir(), "rudder-desktop-installer."));
|
|
19984
20009
|
const removeOutputDir = options.outputDir ? false : true;
|
|
19985
20010
|
try {
|
|
19986
20011
|
const downloadedPath = await downloadAsset(asset, outputDir, options.progressFactory);
|
|
19987
20012
|
const checksum = assertChecksumMatch(downloadedPath, normalizedChecksum);
|
|
19988
|
-
await
|
|
19989
|
-
if (
|
|
20013
|
+
await mkdir4(path23.dirname(cachePath), { recursive: true });
|
|
20014
|
+
if (path23.resolve(downloadedPath) !== path23.resolve(cachePath)) {
|
|
19990
20015
|
await copyFile2(downloadedPath, cachePath);
|
|
19991
20016
|
}
|
|
19992
20017
|
return { path: cachePath, checksum, cacheStatus: "miss" };
|
|
@@ -20003,8 +20028,8 @@ async function pathExists2(targetPath) {
|
|
|
20003
20028
|
}
|
|
20004
20029
|
}
|
|
20005
20030
|
function resolveDesktopInstallLockPath(paths) {
|
|
20006
|
-
const installRootHash = createHash2("sha256").update(
|
|
20007
|
-
return
|
|
20031
|
+
const installRootHash = createHash2("sha256").update(path23.resolve(paths.installRoot)).digest("hex").slice(0, 16);
|
|
20032
|
+
return path23.join(path23.dirname(paths.appPath), `.rudder-desktop-install-${installRootHash}.lock`);
|
|
20008
20033
|
}
|
|
20009
20034
|
async function readDesktopInstallLock(lockPath) {
|
|
20010
20035
|
try {
|
|
@@ -20024,17 +20049,17 @@ async function readDesktopInstallLock(lockPath) {
|
|
|
20024
20049
|
}
|
|
20025
20050
|
async function withDesktopInstallLock(paths, fn, options = {}) {
|
|
20026
20051
|
const lockPath = resolveDesktopInstallLockPath(paths);
|
|
20027
|
-
const lockDir =
|
|
20052
|
+
const lockDir = path23.dirname(lockPath);
|
|
20028
20053
|
const timeoutMs = options.timeoutMs ?? DESKTOP_INSTALL_LOCK_TIMEOUT_MS;
|
|
20029
20054
|
const pollMs = options.pollMs ?? DESKTOP_INSTALL_LOCK_POLL_MS;
|
|
20030
20055
|
const startedAt = Date.now();
|
|
20031
20056
|
const payload = {
|
|
20032
20057
|
lockId: randomUUID(),
|
|
20033
20058
|
pid: process.pid,
|
|
20034
|
-
installRoot:
|
|
20059
|
+
installRoot: path23.resolve(paths.installRoot),
|
|
20035
20060
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
20036
20061
|
};
|
|
20037
|
-
await
|
|
20062
|
+
await mkdir4(lockDir, { recursive: true });
|
|
20038
20063
|
while (true) {
|
|
20039
20064
|
try {
|
|
20040
20065
|
await writeFile3(lockPath, `${JSON.stringify(payload, null, 2)}
|
|
@@ -20097,7 +20122,7 @@ function isSuccessfulRobocopyExitCode(status) {
|
|
|
20097
20122
|
}
|
|
20098
20123
|
async function extractZip(zipPath, outputDir, target) {
|
|
20099
20124
|
await rm2(outputDir, { recursive: true, force: true });
|
|
20100
|
-
await
|
|
20125
|
+
await mkdir4(outputDir, { recursive: true });
|
|
20101
20126
|
if (target.platform === "macos") {
|
|
20102
20127
|
runChecked("ditto", ["-x", "-k", zipPath, outputDir]);
|
|
20103
20128
|
return;
|
|
@@ -20113,7 +20138,7 @@ async function findPath(root, predicate, maxDepth = 5) {
|
|
|
20113
20138
|
async function visit(dir, depth) {
|
|
20114
20139
|
const entries = await readdir3(dir, { withFileTypes: true });
|
|
20115
20140
|
for (const entry of entries) {
|
|
20116
|
-
const fullPath =
|
|
20141
|
+
const fullPath = path23.join(dir, entry.name);
|
|
20117
20142
|
if (predicate(fullPath, entry.isDirectory())) return fullPath;
|
|
20118
20143
|
if (entry.isDirectory() && depth < maxDepth) {
|
|
20119
20144
|
const nested = await visit(fullPath, depth + 1);
|
|
@@ -20125,18 +20150,18 @@ async function findPath(root, predicate, maxDepth = 5) {
|
|
|
20125
20150
|
return await visit(root, 0);
|
|
20126
20151
|
}
|
|
20127
20152
|
async function findMacApp(extractDir) {
|
|
20128
|
-
const direct =
|
|
20153
|
+
const direct = path23.join(extractDir, `${DESKTOP_APP_NAME}.app`);
|
|
20129
20154
|
if (await pathExists2(direct)) return direct;
|
|
20130
|
-
const found = await findPath(extractDir, (filePath, isDirectory) => isDirectory &&
|
|
20155
|
+
const found = await findPath(extractDir, (filePath, isDirectory) => isDirectory && path23.basename(filePath) === `${DESKTOP_APP_NAME}.app`);
|
|
20131
20156
|
if (!found) throw new Error(`Portable macOS archive did not contain ${DESKTOP_APP_NAME}.app.`);
|
|
20132
20157
|
return found;
|
|
20133
20158
|
}
|
|
20134
20159
|
async function findWindowsAppDir(extractDir) {
|
|
20135
|
-
const direct =
|
|
20160
|
+
const direct = path23.join(extractDir, `${DESKTOP_APP_NAME}.exe`);
|
|
20136
20161
|
if (await pathExists2(direct)) return extractDir;
|
|
20137
|
-
const executable = await findPath(extractDir, (filePath, isDirectory) => !isDirectory &&
|
|
20162
|
+
const executable = await findPath(extractDir, (filePath, isDirectory) => !isDirectory && path23.basename(filePath).toLowerCase() === `${DESKTOP_APP_NAME.toLowerCase()}.exe`);
|
|
20138
20163
|
if (!executable) throw new Error(`Portable Windows archive did not contain ${DESKTOP_APP_NAME}.exe.`);
|
|
20139
|
-
return
|
|
20164
|
+
return path23.dirname(executable);
|
|
20140
20165
|
}
|
|
20141
20166
|
async function readInstallMetadata(metadataPath) {
|
|
20142
20167
|
try {
|
|
@@ -20204,7 +20229,7 @@ async function waitForUpdateQuitResponse(responsePath, timeoutMs = 8e3) {
|
|
|
20204
20229
|
}
|
|
20205
20230
|
async function requestDesktopQuit(executablePath, target, options = {}) {
|
|
20206
20231
|
if (!await pathExists2(executablePath)) return { ok: true, status: "not_running" };
|
|
20207
|
-
const responsePath =
|
|
20232
|
+
const responsePath = path23.join(tmpdir(), `rudder-update-quit-${process.pid}-${Date.now()}.json`);
|
|
20208
20233
|
const result = spawnSync4(executablePath, [
|
|
20209
20234
|
`${DESKTOP_UPDATE_QUIT_ARG}=${responsePath}`,
|
|
20210
20235
|
...options.forceUpdate ? [DESKTOP_UPDATE_FORCE_ARG] : []
|
|
@@ -20362,13 +20387,13 @@ async function prepareForDesktopReplace(paths, target, options = {}) {
|
|
|
20362
20387
|
throw new Error(`Failed to replace existing Rudder Desktop at ${replacePath}. Close Rudder and rerun start.`);
|
|
20363
20388
|
}
|
|
20364
20389
|
async function installPortableDesktop(installerPath, paths, target) {
|
|
20365
|
-
await
|
|
20390
|
+
await mkdir4(paths.installRoot, { recursive: true });
|
|
20366
20391
|
if (target.platform === "linux") {
|
|
20367
20392
|
await copyFile2(installerPath, paths.appPath);
|
|
20368
20393
|
await chmod(paths.appPath, 493);
|
|
20369
20394
|
return;
|
|
20370
20395
|
}
|
|
20371
|
-
const extractDir = await mkdtemp2(
|
|
20396
|
+
const extractDir = await mkdtemp2(path23.join(tmpdir(), "rudder-desktop-extract."));
|
|
20372
20397
|
try {
|
|
20373
20398
|
await extractZip(installerPath, extractDir, target);
|
|
20374
20399
|
if (target.platform === "macos") {
|
|
@@ -20377,7 +20402,7 @@ async function installPortableDesktop(installerPath, paths, target) {
|
|
|
20377
20402
|
return;
|
|
20378
20403
|
}
|
|
20379
20404
|
const appSource = await findWindowsAppDir(extractDir);
|
|
20380
|
-
await
|
|
20405
|
+
await mkdir4(path23.dirname(paths.installRoot), { recursive: true });
|
|
20381
20406
|
await copyPortableAppBundle(appSource, paths.installRoot);
|
|
20382
20407
|
} finally {
|
|
20383
20408
|
await rm2(extractDir, { recursive: true, force: true });
|
|
@@ -20385,7 +20410,7 @@ async function installPortableDesktop(installerPath, paths, target) {
|
|
|
20385
20410
|
}
|
|
20386
20411
|
async function copyPortableAppBundle(sourcePath, destinationPath) {
|
|
20387
20412
|
if (process.platform === "win32") {
|
|
20388
|
-
await
|
|
20413
|
+
await mkdir4(destinationPath, { recursive: true });
|
|
20389
20414
|
const command = buildWindowsRobocopyMirrorCommand(sourcePath, destinationPath);
|
|
20390
20415
|
const result = spawnSync4(command.command, command.args, {
|
|
20391
20416
|
encoding: "utf8",
|
|
@@ -20394,7 +20419,7 @@ async function copyPortableAppBundle(sourcePath, destinationPath) {
|
|
|
20394
20419
|
if (isSuccessfulRobocopyExitCode(result.status)) return;
|
|
20395
20420
|
throw new Error(formatCommandFailure(command.command, command.args, result.stdout, result.stderr));
|
|
20396
20421
|
}
|
|
20397
|
-
await
|
|
20422
|
+
await cp3(sourcePath, destinationPath, { recursive: true, verbatimSymlinks: true });
|
|
20398
20423
|
}
|
|
20399
20424
|
async function removeMacQuarantine(paths, target) {
|
|
20400
20425
|
if (target.platform !== "macos") return;
|
|
@@ -20418,12 +20443,12 @@ function buildLinuxDesktopEntry(executablePath) {
|
|
|
20418
20443
|
].join("\n");
|
|
20419
20444
|
}
|
|
20420
20445
|
async function writeLinuxLaunchers(paths) {
|
|
20421
|
-
const desktopDir =
|
|
20422
|
-
await
|
|
20423
|
-
await writeFile3(
|
|
20424
|
-
const binDir =
|
|
20425
|
-
await
|
|
20426
|
-
const wrapperPath =
|
|
20446
|
+
const desktopDir = path23.join(homedir(), ".local", "share", "applications");
|
|
20447
|
+
await mkdir4(desktopDir, { recursive: true });
|
|
20448
|
+
await writeFile3(path23.join(desktopDir, "rudder.desktop"), buildLinuxDesktopEntry(paths.executablePath), "utf8");
|
|
20449
|
+
const binDir = path23.join(homedir(), ".local", "bin");
|
|
20450
|
+
await mkdir4(binDir, { recursive: true });
|
|
20451
|
+
const wrapperPath = path23.join(binDir, "rudder-desktop");
|
|
20427
20452
|
const escaped = paths.executablePath.replaceAll("'", `'"'"'`);
|
|
20428
20453
|
await writeFile3(wrapperPath, `#!/bin/sh
|
|
20429
20454
|
exec '${escaped}' "$@"
|
|
@@ -20431,13 +20456,13 @@ exec '${escaped}' "$@"
|
|
|
20431
20456
|
await chmod(wrapperPath, 493);
|
|
20432
20457
|
}
|
|
20433
20458
|
function buildWindowsShortcutScript(executablePath) {
|
|
20434
|
-
const appData = process.env.APPDATA?.trim() ||
|
|
20435
|
-
const shortcutPath =
|
|
20459
|
+
const appData = process.env.APPDATA?.trim() || path23.join(homedir(), "AppData", "Roaming");
|
|
20460
|
+
const shortcutPath = path23.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Rudder.lnk");
|
|
20436
20461
|
return [
|
|
20437
20462
|
"$shell = New-Object -ComObject WScript.Shell",
|
|
20438
20463
|
`$shortcut = $shell.CreateShortcut(${powershellQuote(shortcutPath)})`,
|
|
20439
20464
|
`$shortcut.TargetPath = ${powershellQuote(executablePath)}`,
|
|
20440
|
-
`$shortcut.WorkingDirectory = ${powershellQuote(
|
|
20465
|
+
`$shortcut.WorkingDirectory = ${powershellQuote(path23.dirname(executablePath))}`,
|
|
20441
20466
|
"$shortcut.Save()"
|
|
20442
20467
|
].join("; ");
|
|
20443
20468
|
}
|
|
@@ -20469,7 +20494,7 @@ function launchDesktop(paths, target) {
|
|
|
20469
20494
|
spawn3(paths.executablePath, [], { detached: true, stdio: "ignore" }).unref();
|
|
20470
20495
|
}
|
|
20471
20496
|
async function writeInstallMetadata(paths, releaseTag, assetName, assetChecksum, assetKind = "full") {
|
|
20472
|
-
mkdirSync(
|
|
20497
|
+
mkdirSync(path23.dirname(paths.metadataPath), { recursive: true });
|
|
20473
20498
|
const metadata = {
|
|
20474
20499
|
version: 1,
|
|
20475
20500
|
releaseTag,
|
|
@@ -20589,9 +20614,9 @@ async function startCommand(opts) {
|
|
|
20589
20614
|
if (installDesktop) {
|
|
20590
20615
|
const target = resolveDesktopAssetTarget();
|
|
20591
20616
|
const tag = resolveDesktopReleaseTag(version);
|
|
20592
|
-
const installRoot = opts.desktopInstallDir ?
|
|
20617
|
+
const installRoot = opts.desktopInstallDir ? path23.resolve(opts.desktopInstallDir) : resolveDefaultDesktopInstallRoot(target);
|
|
20593
20618
|
const installPaths = resolveDesktopInstallPaths(target, installRoot);
|
|
20594
|
-
const outputDir = opts.outputDir ?
|
|
20619
|
+
const outputDir = opts.outputDir ? path23.resolve(opts.outputDir) : await mkdtemp2(path23.join(tmpdir(), "rudder-desktop-installer."));
|
|
20595
20620
|
p15.log.step("Installing desktop app");
|
|
20596
20621
|
p15.log.message(`Release: ${pc15.cyan(`${repo}@${tag}`)}`);
|
|
20597
20622
|
p15.log.message(`Target: ${pc15.cyan(`${target.platform}/${target.arch}`)}`);
|
|
@@ -20690,7 +20715,7 @@ async function startCommand(opts) {
|
|
|
20690
20715
|
}
|
|
20691
20716
|
const checksum = await runStartPhase(
|
|
20692
20717
|
"Verifying Desktop checksum...",
|
|
20693
|
-
`Verified ${pc15.cyan(
|
|
20718
|
+
`Verified ${pc15.cyan(path23.basename(cachedAsset.path))}.`,
|
|
20694
20719
|
() => assertChecksumMatch(cachedAsset.path, expectedChecksum),
|
|
20695
20720
|
desktopProgressJson ? "verifying_checksum" : null
|
|
20696
20721
|
);
|
|
@@ -20774,11 +20799,11 @@ async function startCommand(opts) {
|
|
|
20774
20799
|
|
|
20775
20800
|
// src/config/data-dir.ts
|
|
20776
20801
|
init_home();
|
|
20777
|
-
import
|
|
20802
|
+
import path24 from "node:path";
|
|
20778
20803
|
function applyDataDirOverride(options, support = {}) {
|
|
20779
20804
|
const rawDataDir = options.dataDir?.trim();
|
|
20780
20805
|
if (!rawDataDir) return null;
|
|
20781
|
-
const resolvedDataDir =
|
|
20806
|
+
const resolvedDataDir = path24.resolve(expandHomePrefix(rawDataDir));
|
|
20782
20807
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
20783
20808
|
if (support.hasConfigOption) {
|
|
20784
20809
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|