@reporting-bi/cli 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9814,9 +9814,9 @@ function findLocalConfig(startDir) {
|
|
|
9814
9814
|
dir = parent;
|
|
9815
9815
|
}
|
|
9816
9816
|
}
|
|
9817
|
-
function getActiveConnection() {
|
|
9817
|
+
function getActiveConnection(cwd) {
|
|
9818
9818
|
const creds = loadCredentials();
|
|
9819
|
-
const local = findLocalConfig();
|
|
9819
|
+
const local = findLocalConfig(cwd);
|
|
9820
9820
|
const domain2 = local?.domain ?? creds.active;
|
|
9821
9821
|
if (!domain2 || !creds.connections[domain2]) return null;
|
|
9822
9822
|
const tokens = { ...creds.connections[domain2] };
|
|
@@ -9878,7 +9878,8 @@ async function ensureValidToken(conn) {
|
|
|
9878
9878
|
}
|
|
9879
9879
|
}
|
|
9880
9880
|
async function createService(name, options) {
|
|
9881
|
-
const
|
|
9881
|
+
const cwd = typeof options === "object" ? options.cwd : void 0;
|
|
9882
|
+
const conn = getActiveConnection(cwd);
|
|
9882
9883
|
if (!conn) {
|
|
9883
9884
|
console.error('Not logged in. Run "rpbi login" first.');
|
|
9884
9885
|
process.exit(1);
|
|
@@ -10574,13 +10575,13 @@ function stripFields(obj, excludeFields) {
|
|
|
10574
10575
|
}
|
|
10575
10576
|
async function pull(flags) {
|
|
10576
10577
|
const dir = path3.resolve(flags.dir || ".");
|
|
10577
|
-
const conn = getActiveConnection();
|
|
10578
|
+
const conn = getActiveConnection(dir);
|
|
10578
10579
|
if (!conn) {
|
|
10579
10580
|
console.error('Not logged in. Run "rpbi login" first.');
|
|
10580
10581
|
process.exit(1);
|
|
10581
10582
|
}
|
|
10582
|
-
const etlService = await createService("etl");
|
|
10583
|
-
const defService = await createService("definition");
|
|
10583
|
+
const etlService = await createService("etl", { cwd: dir });
|
|
10584
|
+
const defService = await createService("definition", { cwd: dir });
|
|
10584
10585
|
console.log(`Pulling ETL threads to ${dir}...`);
|
|
10585
10586
|
const threads = await etlService.get("threads", {
|
|
10586
10587
|
fields: ["id_thread", "description", "type", "enabled", "ord_num", "module"],
|
|
@@ -10662,7 +10663,7 @@ async function push(flags, files) {
|
|
|
10662
10663
|
}
|
|
10663
10664
|
const index = readIndex(root);
|
|
10664
10665
|
const indexMap = new Map(index.map((e) => [e.path, e]));
|
|
10665
|
-
const etlService = await createService("etl");
|
|
10666
|
+
const etlService = await createService("etl", { cwd: root });
|
|
10666
10667
|
const force = flags.force === "true";
|
|
10667
10668
|
let filesToPush;
|
|
10668
10669
|
if (files.length > 0) {
|
|
@@ -10766,8 +10767,8 @@ async function pullContext(dir, etlService, defService) {
|
|
|
10766
10767
|
}
|
|
10767
10768
|
async function context(flags) {
|
|
10768
10769
|
const dir = path3.resolve(flags.dir || ".");
|
|
10769
|
-
const etlService = await createService("etl");
|
|
10770
|
-
const defService = await createService("definition");
|
|
10770
|
+
const etlService = await createService("etl", { cwd: dir });
|
|
10771
|
+
const defService = await createService("definition", { cwd: dir });
|
|
10771
10772
|
await pullContext(dir, etlService, defService);
|
|
10772
10773
|
console.log("Context pull complete.");
|
|
10773
10774
|
}
|
|
@@ -34446,7 +34447,7 @@ function text(data) {
|
|
|
34446
34447
|
async function mcp() {
|
|
34447
34448
|
const server = new McpServer({
|
|
34448
34449
|
name: "reporting-bi",
|
|
34449
|
-
version: "0.0.
|
|
34450
|
+
version: "0.0.19"
|
|
34450
34451
|
});
|
|
34451
34452
|
server.tool(
|
|
34452
34453
|
"status",
|
|
@@ -34920,11 +34921,14 @@ var CHECK_INTERVAL = 60 * 60 * 1e3;
|
|
|
34920
34921
|
var PACKAGE_NAME = "@reporting-bi/cli";
|
|
34921
34922
|
var INSTALL_PREFIX = detectPrefix();
|
|
34922
34923
|
function detectPrefix() {
|
|
34923
|
-
|
|
34924
|
-
|
|
34925
|
-
|
|
34926
|
-
|
|
34927
|
-
|
|
34924
|
+
try {
|
|
34925
|
+
const realPath = fs6.realpathSync(process.argv[1]);
|
|
34926
|
+
const libIndex = realPath.indexOf(path4.join("lib", "node_modules"));
|
|
34927
|
+
if (libIndex > 0) {
|
|
34928
|
+
const prefix = realPath.slice(0, libIndex - 1);
|
|
34929
|
+
if (prefix !== "/usr" && prefix !== "/usr/local") return prefix;
|
|
34930
|
+
}
|
|
34931
|
+
} catch {
|
|
34928
34932
|
}
|
|
34929
34933
|
return null;
|
|
34930
34934
|
}
|
|
@@ -34987,8 +34991,8 @@ async function checkForUpdate() {
|
|
|
34987
34991
|
saveUpdateCheck({ lastCheck: now });
|
|
34988
34992
|
const latest = await fetchLatestVersion();
|
|
34989
34993
|
if (!latest) return;
|
|
34990
|
-
if (!isNewer(latest, "0.0.
|
|
34991
|
-
console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.
|
|
34994
|
+
if (!isNewer(latest, "0.0.19")) return;
|
|
34995
|
+
console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.19"} \u2192 ${latest}...\x1B[0m`);
|
|
34992
34996
|
(0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
34993
34997
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
34994
34998
|
} catch {
|
|
@@ -35000,11 +35004,11 @@ async function forceUpdate() {
|
|
|
35000
35004
|
console.error("Could not fetch latest version from npm.");
|
|
35001
35005
|
process.exit(1);
|
|
35002
35006
|
}
|
|
35003
|
-
if (!isNewer(latest, "0.0.
|
|
35004
|
-
console.log(`Already up to date (${"0.0.
|
|
35007
|
+
if (!isNewer(latest, "0.0.19")) {
|
|
35008
|
+
console.log(`Already up to date (${"0.0.19"}).`);
|
|
35005
35009
|
return;
|
|
35006
35010
|
}
|
|
35007
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.0.
|
|
35011
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.0.19"} \u2192 ${latest}...`);
|
|
35008
35012
|
(0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
35009
35013
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
35010
35014
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
@@ -35142,7 +35146,7 @@ Examples:
|
|
|
35142
35146
|
(async () => {
|
|
35143
35147
|
const [command, ...args] = process.argv.slice(2);
|
|
35144
35148
|
if (command === "--version" || command === "-v") {
|
|
35145
|
-
console.log("0.0.
|
|
35149
|
+
console.log("0.0.19");
|
|
35146
35150
|
return;
|
|
35147
35151
|
}
|
|
35148
35152
|
await checkForUpdate();
|