@reporting-bi/cli 0.0.21 → 0.1.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 +121 -62
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9557,12 +9557,12 @@ var require_dist2 = __commonJS({
|
|
|
9557
9557
|
throw new Error(`Unknown format "${name}"`);
|
|
9558
9558
|
return f;
|
|
9559
9559
|
};
|
|
9560
|
-
function addFormats(ajv, list7,
|
|
9560
|
+
function addFormats(ajv, list7, fs8, exportName) {
|
|
9561
9561
|
var _a2;
|
|
9562
9562
|
var _b;
|
|
9563
9563
|
(_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
9564
9564
|
for (const f of list7)
|
|
9565
|
-
ajv.addFormat(f,
|
|
9565
|
+
ajv.addFormat(f, fs8[f]);
|
|
9566
9566
|
}
|
|
9567
9567
|
module2.exports = exports2 = formatsPlugin;
|
|
9568
9568
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -9572,12 +9572,12 @@ var require_dist2 = __commonJS({
|
|
|
9572
9572
|
|
|
9573
9573
|
// src/commands/login.ts
|
|
9574
9574
|
var http = __toESM(require("node:http"));
|
|
9575
|
-
var
|
|
9575
|
+
var import_node_child_process2 = require("node:child_process");
|
|
9576
9576
|
|
|
9577
9577
|
// src/config.ts
|
|
9578
|
-
var
|
|
9578
|
+
var fs2 = __toESM(require("node:fs"));
|
|
9579
9579
|
var path = __toESM(require("node:path"));
|
|
9580
|
-
var
|
|
9580
|
+
var os2 = __toESM(require("node:os"));
|
|
9581
9581
|
|
|
9582
9582
|
// ../rp-auth-client-v2/dist/client.js
|
|
9583
9583
|
var DEFAULT_OPTIONS = {
|
|
@@ -9784,28 +9784,87 @@ var ReportingAuthClient = class {
|
|
|
9784
9784
|
|
|
9785
9785
|
// src/config.ts
|
|
9786
9786
|
var import_rp_client = __toESM(require_dist());
|
|
9787
|
-
|
|
9787
|
+
|
|
9788
|
+
// src/crypto.ts
|
|
9789
|
+
var crypto = __toESM(require("node:crypto"));
|
|
9790
|
+
var fs = __toESM(require("node:fs"));
|
|
9791
|
+
var os = __toESM(require("node:os"));
|
|
9792
|
+
var import_node_child_process = require("node:child_process");
|
|
9793
|
+
var SALT = "reporting-bi-credentials";
|
|
9794
|
+
var ALGORITHM = "aes-256-gcm";
|
|
9795
|
+
function getMachineId() {
|
|
9796
|
+
try {
|
|
9797
|
+
switch (process.platform) {
|
|
9798
|
+
case "linux":
|
|
9799
|
+
return fs.readFileSync("/etc/machine-id", "utf-8").trim();
|
|
9800
|
+
case "darwin":
|
|
9801
|
+
return (0, import_node_child_process.execSync)("ioreg -rd1 -c IOPlatformExpertDevice", { encoding: "utf-8" }).match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/)?.[1] ?? os.hostname();
|
|
9802
|
+
case "win32":
|
|
9803
|
+
return (0, import_node_child_process.execSync)("reg query HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid", { encoding: "utf-8" }).match(/MachineGuid\s+REG_SZ\s+(.+)/)?.[1]?.trim() ?? os.hostname();
|
|
9804
|
+
default:
|
|
9805
|
+
return os.hostname();
|
|
9806
|
+
}
|
|
9807
|
+
} catch {
|
|
9808
|
+
return os.hostname();
|
|
9809
|
+
}
|
|
9810
|
+
}
|
|
9811
|
+
function deriveKey() {
|
|
9812
|
+
return crypto.scryptSync(getMachineId(), SALT, 32);
|
|
9813
|
+
}
|
|
9814
|
+
function encrypt(plaintext) {
|
|
9815
|
+
const key = deriveKey();
|
|
9816
|
+
const iv = crypto.randomBytes(12);
|
|
9817
|
+
const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
|
|
9818
|
+
const encrypted = Buffer.concat([cipher.update(plaintext, "utf-8"), cipher.final()]);
|
|
9819
|
+
const tag = cipher.getAuthTag();
|
|
9820
|
+
return JSON.stringify({
|
|
9821
|
+
encrypted: true,
|
|
9822
|
+
iv: iv.toString("base64"),
|
|
9823
|
+
tag: tag.toString("base64"),
|
|
9824
|
+
data: encrypted.toString("base64")
|
|
9825
|
+
});
|
|
9826
|
+
}
|
|
9827
|
+
function decrypt(ciphertext) {
|
|
9828
|
+
const { iv, tag, data } = JSON.parse(ciphertext);
|
|
9829
|
+
const key = deriveKey();
|
|
9830
|
+
const decipher = crypto.createDecipheriv(ALGORITHM, key, Buffer.from(iv, "base64"));
|
|
9831
|
+
decipher.setAuthTag(Buffer.from(tag, "base64"));
|
|
9832
|
+
return Buffer.concat([decipher.update(Buffer.from(data, "base64")), decipher.final()]).toString("utf-8");
|
|
9833
|
+
}
|
|
9834
|
+
function isEncrypted(content2) {
|
|
9835
|
+
try {
|
|
9836
|
+
const parsed = JSON.parse(content2);
|
|
9837
|
+
return parsed.encrypted === true;
|
|
9838
|
+
} catch {
|
|
9839
|
+
return false;
|
|
9840
|
+
}
|
|
9841
|
+
}
|
|
9842
|
+
|
|
9843
|
+
// src/config.ts
|
|
9844
|
+
var CONFIG_DIR = path.join(os2.homedir(), ".config", "reporting-bi");
|
|
9788
9845
|
var CREDENTIALS_FILE = path.join(CONFIG_DIR, "credentials.json");
|
|
9789
9846
|
var CLIENT_ID = "0D6693D4-4358-4C08-BA80-A94A97B7F47C";
|
|
9790
9847
|
var CLIENT_SECRET = "48481427819bb41798bd74fa109c90b184ca4d64d20e60dfbe8430299f06f73e";
|
|
9791
9848
|
function loadCredentials() {
|
|
9792
9849
|
try {
|
|
9793
|
-
const
|
|
9850
|
+
const raw = fs2.readFileSync(CREDENTIALS_FILE, "utf-8");
|
|
9851
|
+
const data = isEncrypted(raw) ? decrypt(raw) : raw;
|
|
9794
9852
|
return JSON.parse(data);
|
|
9795
9853
|
} catch {
|
|
9796
9854
|
return { active: null, connections: {} };
|
|
9797
9855
|
}
|
|
9798
9856
|
}
|
|
9799
9857
|
function saveCredentials(data) {
|
|
9800
|
-
|
|
9801
|
-
|
|
9858
|
+
fs2.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
9859
|
+
const content2 = encrypt(JSON.stringify(data, null, 2));
|
|
9860
|
+
fs2.writeFileSync(CREDENTIALS_FILE, content2, { mode: 384 });
|
|
9802
9861
|
}
|
|
9803
9862
|
function findLocalConfig(startDir) {
|
|
9804
9863
|
let dir = path.resolve(startDir || process.cwd());
|
|
9805
9864
|
while (true) {
|
|
9806
9865
|
const configPath = path.join(dir, ".rpbi", "config.json");
|
|
9807
9866
|
try {
|
|
9808
|
-
const data = JSON.parse(
|
|
9867
|
+
const data = JSON.parse(fs2.readFileSync(configPath, "utf-8"));
|
|
9809
9868
|
if (data.domain) return { domain: data.domain, accounting: data.accounting };
|
|
9810
9869
|
} catch {
|
|
9811
9870
|
}
|
|
@@ -10093,7 +10152,7 @@ function renderCallback(status3, title, message) {
|
|
|
10093
10152
|
function openBrowser(url2) {
|
|
10094
10153
|
const platform = process.platform;
|
|
10095
10154
|
const cmd = platform === "darwin" ? "open" : platform === "win32" ? 'start ""' : "xdg-open";
|
|
10096
|
-
(0,
|
|
10155
|
+
(0, import_node_child_process2.exec)(`${cmd} ${JSON.stringify(url2)}`);
|
|
10097
10156
|
}
|
|
10098
10157
|
async function login(args) {
|
|
10099
10158
|
const { positional, flags } = parseArgs(args);
|
|
@@ -10272,7 +10331,7 @@ async function use(args) {
|
|
|
10272
10331
|
}
|
|
10273
10332
|
|
|
10274
10333
|
// src/commands/wiki.ts
|
|
10275
|
-
var
|
|
10334
|
+
var fs3 = __toESM(require("node:fs"));
|
|
10276
10335
|
var DEFAULT_LANG = "cs";
|
|
10277
10336
|
async function list2(flags) {
|
|
10278
10337
|
const service = await createService("wiki");
|
|
@@ -10298,7 +10357,7 @@ async function search(query, flags) {
|
|
|
10298
10357
|
}
|
|
10299
10358
|
async function readContent(flags) {
|
|
10300
10359
|
if (flags.file) {
|
|
10301
|
-
return
|
|
10360
|
+
return fs3.readFileSync(flags.file, "utf-8");
|
|
10302
10361
|
}
|
|
10303
10362
|
if (flags.content) {
|
|
10304
10363
|
return flags.content;
|
|
@@ -10372,21 +10431,21 @@ async function wiki(args) {
|
|
|
10372
10431
|
}
|
|
10373
10432
|
|
|
10374
10433
|
// src/commands/etl.ts
|
|
10375
|
-
var
|
|
10434
|
+
var fs6 = __toESM(require("node:fs"));
|
|
10376
10435
|
|
|
10377
10436
|
// src/commands/etl-sync.ts
|
|
10378
|
-
var
|
|
10437
|
+
var fs5 = __toESM(require("node:fs"));
|
|
10379
10438
|
var path3 = __toESM(require("node:path"));
|
|
10380
10439
|
|
|
10381
10440
|
// src/manifest.ts
|
|
10382
|
-
var
|
|
10441
|
+
var fs4 = __toESM(require("node:fs"));
|
|
10383
10442
|
var path2 = __toESM(require("node:path"));
|
|
10384
|
-
var
|
|
10443
|
+
var crypto2 = __toESM(require("node:crypto"));
|
|
10385
10444
|
var RPBI_DIR = ".rpbi";
|
|
10386
10445
|
var CONFIG_FILE = "config.json";
|
|
10387
10446
|
var INDEX_FILE = "index.json";
|
|
10388
10447
|
function computeHash(content2) {
|
|
10389
|
-
return
|
|
10448
|
+
return crypto2.createHash("sha256").update(content2, "utf-8").digest("hex");
|
|
10390
10449
|
}
|
|
10391
10450
|
function getConfigPath(dir) {
|
|
10392
10451
|
return path2.join(dir, RPBI_DIR, CONFIG_FILE);
|
|
@@ -10396,7 +10455,7 @@ function getIndexPath(dir) {
|
|
|
10396
10455
|
}
|
|
10397
10456
|
function readConfig(dir) {
|
|
10398
10457
|
try {
|
|
10399
|
-
const data =
|
|
10458
|
+
const data = fs4.readFileSync(getConfigPath(dir), "utf-8");
|
|
10400
10459
|
return JSON.parse(data);
|
|
10401
10460
|
} catch {
|
|
10402
10461
|
return null;
|
|
@@ -10404,15 +10463,15 @@ function readConfig(dir) {
|
|
|
10404
10463
|
}
|
|
10405
10464
|
function writeConfig(dir, config2) {
|
|
10406
10465
|
const rpbiDir = path2.join(dir, RPBI_DIR);
|
|
10407
|
-
|
|
10408
|
-
|
|
10466
|
+
fs4.mkdirSync(rpbiDir, { recursive: true });
|
|
10467
|
+
fs4.writeFileSync(
|
|
10409
10468
|
path2.join(rpbiDir, CONFIG_FILE),
|
|
10410
10469
|
JSON.stringify(config2, null, 2)
|
|
10411
10470
|
);
|
|
10412
10471
|
}
|
|
10413
10472
|
function readIndex(dir) {
|
|
10414
10473
|
try {
|
|
10415
|
-
const data =
|
|
10474
|
+
const data = fs4.readFileSync(getIndexPath(dir), "utf-8");
|
|
10416
10475
|
return JSON.parse(data);
|
|
10417
10476
|
} catch {
|
|
10418
10477
|
return [];
|
|
@@ -10420,8 +10479,8 @@ function readIndex(dir) {
|
|
|
10420
10479
|
}
|
|
10421
10480
|
function writeIndex(dir, index) {
|
|
10422
10481
|
const rpbiDir = path2.join(dir, RPBI_DIR);
|
|
10423
|
-
|
|
10424
|
-
|
|
10482
|
+
fs4.mkdirSync(rpbiDir, { recursive: true });
|
|
10483
|
+
fs4.writeFileSync(
|
|
10425
10484
|
path2.join(rpbiDir, INDEX_FILE),
|
|
10426
10485
|
JSON.stringify(index, null, 2)
|
|
10427
10486
|
);
|
|
@@ -10429,7 +10488,7 @@ function writeIndex(dir, index) {
|
|
|
10429
10488
|
function findEtlRoot(startDir) {
|
|
10430
10489
|
let dir = path2.resolve(startDir);
|
|
10431
10490
|
while (true) {
|
|
10432
|
-
if (
|
|
10491
|
+
if (fs4.existsSync(getConfigPath(dir))) return dir;
|
|
10433
10492
|
const parent = path2.dirname(dir);
|
|
10434
10493
|
if (parent === dir) return null;
|
|
10435
10494
|
dir = parent;
|
|
@@ -10564,8 +10623,8 @@ function threadToMetaPath(thread) {
|
|
|
10564
10623
|
return [".rpbi", "threads", typeToDirName(thread.type), ...segments].join("/");
|
|
10565
10624
|
}
|
|
10566
10625
|
function writeFileSync4(filePath, content2) {
|
|
10567
|
-
|
|
10568
|
-
|
|
10626
|
+
fs5.mkdirSync(path3.dirname(filePath), { recursive: true });
|
|
10627
|
+
fs5.writeFileSync(filePath, content2, "utf-8");
|
|
10569
10628
|
}
|
|
10570
10629
|
function stripFields(obj, excludeFields) {
|
|
10571
10630
|
const result = {};
|
|
@@ -10670,7 +10729,7 @@ async function push(flags, files) {
|
|
|
10670
10729
|
const force = flags.force === "true";
|
|
10671
10730
|
let filesToPush;
|
|
10672
10731
|
if (files.length > 0) {
|
|
10673
|
-
filesToPush = files.map((f) => path3.relative(root, path3.resolve(f)));
|
|
10732
|
+
filesToPush = files.map((f) => path3.relative(root, path3.resolve(f)).replace(/\\/g, "/"));
|
|
10674
10733
|
} else {
|
|
10675
10734
|
filesToPush = detectModifiedFiles(root, index);
|
|
10676
10735
|
}
|
|
@@ -10681,11 +10740,11 @@ async function push(flags, files) {
|
|
|
10681
10740
|
console.log(`Pushing ${filesToPush.length} file(s)...`);
|
|
10682
10741
|
for (const relPath of filesToPush) {
|
|
10683
10742
|
const absPath = path3.join(root, relPath);
|
|
10684
|
-
if (!
|
|
10743
|
+
if (!fs5.existsSync(absPath)) {
|
|
10685
10744
|
console.log(` Skipping ${relPath} (file not found)`);
|
|
10686
10745
|
continue;
|
|
10687
10746
|
}
|
|
10688
|
-
const localContent =
|
|
10747
|
+
const localContent = fs5.readFileSync(absPath, "utf-8");
|
|
10689
10748
|
const entry = indexMap.get(relPath);
|
|
10690
10749
|
if (entry) {
|
|
10691
10750
|
if (!force) {
|
|
@@ -10779,11 +10838,11 @@ function detectModifiedFiles(root, index) {
|
|
|
10779
10838
|
const modified = [];
|
|
10780
10839
|
for (const entry of index) {
|
|
10781
10840
|
const absPath = path3.join(root, entry.path);
|
|
10782
|
-
if (!
|
|
10841
|
+
if (!fs5.existsSync(absPath)) {
|
|
10783
10842
|
modified.push(entry.path);
|
|
10784
10843
|
continue;
|
|
10785
10844
|
}
|
|
10786
|
-
const content2 =
|
|
10845
|
+
const content2 = fs5.readFileSync(absPath, "utf-8");
|
|
10787
10846
|
if (computeHash(content2) !== entry.hash) {
|
|
10788
10847
|
modified.push(entry.path);
|
|
10789
10848
|
}
|
|
@@ -10793,7 +10852,7 @@ function detectModifiedFiles(root, index) {
|
|
|
10793
10852
|
function detectNewFiles(root, index) {
|
|
10794
10853
|
const newFiles = [];
|
|
10795
10854
|
const knownPaths = new Set(index.map((e) => e.path));
|
|
10796
|
-
const entries =
|
|
10855
|
+
const entries = fs5.readdirSync(root, { withFileTypes: true });
|
|
10797
10856
|
for (const entry of entries) {
|
|
10798
10857
|
if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
|
|
10799
10858
|
walkDir(path3.join(root, entry.name), root, knownPaths, newFiles);
|
|
@@ -10801,13 +10860,13 @@ function detectNewFiles(root, index) {
|
|
|
10801
10860
|
return newFiles;
|
|
10802
10861
|
}
|
|
10803
10862
|
function walkDir(dir, root, knownPaths, result) {
|
|
10804
|
-
const entries =
|
|
10863
|
+
const entries = fs5.readdirSync(dir, { withFileTypes: true });
|
|
10805
10864
|
for (const entry of entries) {
|
|
10806
10865
|
const full = path3.join(dir, entry.name);
|
|
10807
10866
|
if (entry.isDirectory()) {
|
|
10808
10867
|
walkDir(full, root, knownPaths, result);
|
|
10809
10868
|
} else if (entry.name.endsWith(".sql")) {
|
|
10810
|
-
const rel = path3.relative(root, full);
|
|
10869
|
+
const rel = path3.relative(root, full).replace(/\\/g, "/");
|
|
10811
10870
|
if (!knownPaths.has(rel)) {
|
|
10812
10871
|
result.push(rel);
|
|
10813
10872
|
}
|
|
@@ -10829,8 +10888,8 @@ async function status2(flags) {
|
|
|
10829
10888
|
console.log("");
|
|
10830
10889
|
const modified = detectModifiedFiles(root, index);
|
|
10831
10890
|
const newFiles = detectNewFiles(root, index);
|
|
10832
|
-
const deleted = modified.filter((f) => !
|
|
10833
|
-
const changed = modified.filter((f) =>
|
|
10891
|
+
const deleted = modified.filter((f) => !fs5.existsSync(path3.join(root, f)));
|
|
10892
|
+
const changed = modified.filter((f) => fs5.existsSync(path3.join(root, f)));
|
|
10834
10893
|
if (changed.length === 0 && newFiles.length === 0 && deleted.length === 0) {
|
|
10835
10894
|
console.log("No changes.");
|
|
10836
10895
|
return;
|
|
@@ -10867,10 +10926,10 @@ async function content(id, flags) {
|
|
|
10867
10926
|
process.stdout.write(text2 || "");
|
|
10868
10927
|
}
|
|
10869
10928
|
async function exec2(id, flags) {
|
|
10870
|
-
const service = await createService("etl");
|
|
10929
|
+
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
10871
10930
|
let body = void 0;
|
|
10872
10931
|
if (flags.file) {
|
|
10873
|
-
body =
|
|
10932
|
+
body = fs6.readFileSync(flags.file, "utf-8");
|
|
10874
10933
|
} else if (flags.sql) {
|
|
10875
10934
|
body = flags.sql;
|
|
10876
10935
|
}
|
|
@@ -10902,7 +10961,7 @@ async function etl(args) {
|
|
|
10902
10961
|
return content(rest[0], flags);
|
|
10903
10962
|
case "exec":
|
|
10904
10963
|
if (!rest[0]) {
|
|
10905
|
-
console.error('Usage: rpbi etl exec <id> [--
|
|
10964
|
+
console.error('Usage: rpbi etl exec <id> [--file path] [--sql "..."]');
|
|
10906
10965
|
process.exit(1);
|
|
10907
10966
|
}
|
|
10908
10967
|
return exec2(rest[0], flags);
|
|
@@ -16421,7 +16480,7 @@ __export(regexes_exports, {
|
|
|
16421
16480
|
extendedDuration: () => extendedDuration,
|
|
16422
16481
|
guid: () => guid,
|
|
16423
16482
|
hex: () => hex,
|
|
16424
|
-
hostname: () =>
|
|
16483
|
+
hostname: () => hostname2,
|
|
16425
16484
|
html5Email: () => html5Email,
|
|
16426
16485
|
idnEmail: () => idnEmail,
|
|
16427
16486
|
integer: () => integer,
|
|
@@ -16498,7 +16557,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
|
|
|
16498
16557
|
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
16499
16558
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
16500
16559
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
16501
|
-
var
|
|
16560
|
+
var hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
16502
16561
|
var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
16503
16562
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
16504
16563
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
@@ -27085,7 +27144,7 @@ __export(external_exports3, {
|
|
|
27085
27144
|
guid: () => guid2,
|
|
27086
27145
|
hash: () => hash,
|
|
27087
27146
|
hex: () => hex2,
|
|
27088
|
-
hostname: () =>
|
|
27147
|
+
hostname: () => hostname3,
|
|
27089
27148
|
httpUrl: () => httpUrl,
|
|
27090
27149
|
includes: () => _includes,
|
|
27091
27150
|
instanceof: () => _instanceof,
|
|
@@ -27297,7 +27356,7 @@ __export(schemas_exports3, {
|
|
|
27297
27356
|
guid: () => guid2,
|
|
27298
27357
|
hash: () => hash,
|
|
27299
27358
|
hex: () => hex2,
|
|
27300
|
-
hostname: () =>
|
|
27359
|
+
hostname: () => hostname3,
|
|
27301
27360
|
httpUrl: () => httpUrl,
|
|
27302
27361
|
instanceof: () => _instanceof,
|
|
27303
27362
|
int: () => int,
|
|
@@ -27801,7 +27860,7 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
|
|
|
27801
27860
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
27802
27861
|
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
27803
27862
|
}
|
|
27804
|
-
function
|
|
27863
|
+
function hostname3(_params) {
|
|
27805
27864
|
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
27806
27865
|
}
|
|
27807
27866
|
function hex2(_params) {
|
|
@@ -34450,7 +34509,7 @@ function text(data) {
|
|
|
34450
34509
|
async function mcp() {
|
|
34451
34510
|
const server = new McpServer({
|
|
34452
34511
|
name: "reporting-bi",
|
|
34453
|
-
version: "0.
|
|
34512
|
+
version: "0.1.1"
|
|
34454
34513
|
});
|
|
34455
34514
|
server.tool(
|
|
34456
34515
|
"status",
|
|
@@ -34913,19 +34972,19 @@ function init(args) {
|
|
|
34913
34972
|
}
|
|
34914
34973
|
|
|
34915
34974
|
// src/autoupdate.ts
|
|
34916
|
-
var
|
|
34975
|
+
var fs7 = __toESM(require("node:fs"));
|
|
34917
34976
|
var path4 = __toESM(require("node:path"));
|
|
34918
|
-
var
|
|
34977
|
+
var os3 = __toESM(require("node:os"));
|
|
34919
34978
|
var https = __toESM(require("node:https"));
|
|
34920
|
-
var
|
|
34921
|
-
var CONFIG_DIR2 = path4.join(
|
|
34979
|
+
var import_node_child_process3 = require("node:child_process");
|
|
34980
|
+
var CONFIG_DIR2 = path4.join(os3.homedir(), ".config", "reporting-bi");
|
|
34922
34981
|
var UPDATE_CHECK_FILE = path4.join(CONFIG_DIR2, "update-check.json");
|
|
34923
34982
|
var CHECK_INTERVAL = 60 * 60 * 1e3;
|
|
34924
34983
|
var PACKAGE_NAME = "@reporting-bi/cli";
|
|
34925
34984
|
var INSTALL_PREFIX = detectPrefix();
|
|
34926
34985
|
function detectPrefix() {
|
|
34927
34986
|
try {
|
|
34928
|
-
const realPath =
|
|
34987
|
+
const realPath = fs7.realpathSync(process.argv[1]);
|
|
34929
34988
|
const libIndex = realPath.indexOf(path4.join("lib", "node_modules"));
|
|
34930
34989
|
if (libIndex > 0) {
|
|
34931
34990
|
const prefix = realPath.slice(0, libIndex - 1);
|
|
@@ -34941,14 +35000,14 @@ function npmInstallCmd(version2) {
|
|
|
34941
35000
|
}
|
|
34942
35001
|
function loadUpdateCheck() {
|
|
34943
35002
|
try {
|
|
34944
|
-
return JSON.parse(
|
|
35003
|
+
return JSON.parse(fs7.readFileSync(UPDATE_CHECK_FILE, "utf-8"));
|
|
34945
35004
|
} catch {
|
|
34946
35005
|
return { lastCheck: 0 };
|
|
34947
35006
|
}
|
|
34948
35007
|
}
|
|
34949
35008
|
function saveUpdateCheck(data) {
|
|
34950
|
-
|
|
34951
|
-
|
|
35009
|
+
fs7.mkdirSync(CONFIG_DIR2, { recursive: true });
|
|
35010
|
+
fs7.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify(data, null, 2));
|
|
34952
35011
|
}
|
|
34953
35012
|
function fetchLatestVersion() {
|
|
34954
35013
|
return new Promise((resolve4) => {
|
|
@@ -34994,9 +35053,9 @@ async function checkForUpdate() {
|
|
|
34994
35053
|
saveUpdateCheck({ lastCheck: now });
|
|
34995
35054
|
const latest = await fetchLatestVersion();
|
|
34996
35055
|
if (!latest) return;
|
|
34997
|
-
if (!isNewer(latest, "0.
|
|
34998
|
-
console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.
|
|
34999
|
-
(0,
|
|
35056
|
+
if (!isNewer(latest, "0.1.1")) return;
|
|
35057
|
+
console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.1"} \u2192 ${latest}...\x1B[0m`);
|
|
35058
|
+
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
35000
35059
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
35001
35060
|
} catch {
|
|
35002
35061
|
}
|
|
@@ -35007,12 +35066,12 @@ async function forceUpdate() {
|
|
|
35007
35066
|
console.error("Could not fetch latest version from npm.");
|
|
35008
35067
|
process.exit(1);
|
|
35009
35068
|
}
|
|
35010
|
-
if (!isNewer(latest, "0.
|
|
35011
|
-
console.log(`Already up to date (${"0.
|
|
35069
|
+
if (!isNewer(latest, "0.1.1")) {
|
|
35070
|
+
console.log(`Already up to date (${"0.1.1"}).`);
|
|
35012
35071
|
return;
|
|
35013
35072
|
}
|
|
35014
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.
|
|
35015
|
-
(0,
|
|
35073
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.1.1"} \u2192 ${latest}...`);
|
|
35074
|
+
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
35016
35075
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
35017
35076
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
35018
35077
|
}
|
|
@@ -35149,7 +35208,7 @@ Examples:
|
|
|
35149
35208
|
(async () => {
|
|
35150
35209
|
const [command, ...args] = process.argv.slice(2);
|
|
35151
35210
|
if (command === "--version" || command === "-v") {
|
|
35152
|
-
console.log("0.
|
|
35211
|
+
console.log("0.1.1");
|
|
35153
35212
|
return;
|
|
35154
35213
|
}
|
|
35155
35214
|
await checkForUpdate();
|