@reporting-bi/cli 0.1.17 → 0.1.18

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.
Files changed (2) hide show
  1. package/dist/index.js +45 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9458,6 +9458,28 @@ var ReportingAuthClient = class {
9458
9458
  throw new ReportingAuthClientException(err);
9459
9459
  }
9460
9460
  }
9461
+ /** SSO links of SA users to other instances (RP_SSO_LINKS of the server) */
9462
+ async ssoLinks(accounting2) {
9463
+ const serviceUrl = accountingServiceUrl(this.options.serviceUrl, accounting2);
9464
+ const response = await this.fetchWithAuth(`${serviceUrl}/ssoLinks`);
9465
+ if (!response.ok) {
9466
+ const err = await response.json();
9467
+ throw new ReportingAuthClientException(err);
9468
+ }
9469
+ return await response.json();
9470
+ }
9471
+ /** URL that signs the current SA user in to the instance of an SSO link; valid for a few minutes */
9472
+ async ssoLinkUrl(id, accounting2) {
9473
+ const serviceUrl = accountingServiceUrl(this.options.serviceUrl, accounting2);
9474
+ const response = await this.fetchWithAuth(`${serviceUrl}/ssoLinks/${id}`, {
9475
+ method: "POST"
9476
+ });
9477
+ if (!response.ok) {
9478
+ const err = await response.json();
9479
+ throw new ReportingAuthClientException(err);
9480
+ }
9481
+ return (await response.json()).url;
9482
+ }
9461
9483
  async log(action, data = {}, accounting2) {
9462
9484
  await this.fetchWithAuth(`${this.options.serviceUrl}/log`, {
9463
9485
  method: "POST",
@@ -12265,6 +12287,16 @@ async function push3(flags, files) {
12265
12287
  return;
12266
12288
  }
12267
12289
  console.log(`Pushing ${filesToPush.length} file(s)...`);
12290
+ const refreshServerDate = async (idThread, accounting2) => {
12291
+ try {
12292
+ const meta3 = await service.get(`threads/${idThread}`, { fields: ["date_created"], accounting: accounting2 });
12293
+ if (!meta3?.date_created) return;
12294
+ for (const e of index) {
12295
+ if (e.id_thread === idThread) e.serverDate = meta3.date_created;
12296
+ }
12297
+ } catch {
12298
+ }
12299
+ };
12268
12300
  for (const relPath of filesToPush) {
12269
12301
  const absPath = path6.join(root, relPath);
12270
12302
  const entry = indexMap.get(relPath);
@@ -12310,11 +12342,7 @@ async function push3(flags, files) {
12310
12342
  }
12311
12343
  await service.patch(endpoint, localContent, { accounting: entryAccounting(entry) });
12312
12344
  entry.hash = computeHash(localContent);
12313
- try {
12314
- const meta3 = await service.get(`threads/${entry.id_thread}`, { fields: ["date_created"] });
12315
- if (meta3?.date_created) entry.serverDate = meta3.date_created;
12316
- } catch {
12317
- }
12345
+ await refreshServerDate(entry.id_thread, entryAccounting(entry));
12318
12346
  console.log(` Updated: ${relPath}`);
12319
12347
  } else if (isDoc) {
12320
12348
  const sqlPath = relPath.replace(/\.md$/i, ".sql");
@@ -12324,7 +12352,7 @@ async function push3(flags, files) {
12324
12352
  continue;
12325
12353
  }
12326
12354
  await service.patch(`threads/${sqlEntry.id_thread}/doc`, localContent, { accounting: entryAccounting(sqlEntry) });
12327
- index.push({
12355
+ const docEntry = {
12328
12356
  path: relPath,
12329
12357
  id_thread: sqlEntry.id_thread,
12330
12358
  kind: "doc",
@@ -12332,7 +12360,10 @@ async function push3(flags, files) {
12332
12360
  type: sqlEntry.type,
12333
12361
  accounting: sqlEntry.accounting,
12334
12362
  serverDate: sqlEntry.serverDate
12335
- });
12363
+ };
12364
+ index.push(docEntry);
12365
+ indexMap.set(relPath, docEntry);
12366
+ await refreshServerDate(sqlEntry.id_thread, entryAccounting(sqlEntry));
12336
12367
  console.log(` Created doc: ${relPath} (thread #${sqlEntry.id_thread})`);
12337
12368
  } else {
12338
12369
  const parts = relPath.split("/");
@@ -36711,7 +36742,7 @@ async function mcp() {
36711
36742
  setMcpMode();
36712
36743
  const server = new McpServer({
36713
36744
  name: "reporting-bi",
36714
- version: "0.1.17"
36745
+ version: "0.1.18"
36715
36746
  });
36716
36747
  server.tool(
36717
36748
  "status",
@@ -37252,8 +37283,8 @@ async function checkForUpdate() {
37252
37283
  saveUpdateCheck({ lastCheck: now });
37253
37284
  const latest = await fetchLatestVersion();
37254
37285
  if (!latest) return;
37255
- if (!isNewer(latest, "0.1.17")) return;
37256
- console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.17"} \u2192 ${latest}...\x1B[0m`);
37286
+ if (!isNewer(latest, "0.1.18")) return;
37287
+ console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.18"} \u2192 ${latest}...\x1B[0m`);
37257
37288
  (0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: ["ignore", 2, 2] });
37258
37289
  console.error(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
37259
37290
  } catch {
@@ -37265,11 +37296,11 @@ async function forceUpdate() {
37265
37296
  console.error("Could not fetch latest version from npm.");
37266
37297
  process.exit(1);
37267
37298
  }
37268
- if (!isNewer(latest, "0.1.17")) {
37269
- console.log(`Already up to date (${"0.1.17"}).`);
37299
+ if (!isNewer(latest, "0.1.18")) {
37300
+ console.log(`Already up to date (${"0.1.18"}).`);
37270
37301
  return;
37271
37302
  }
37272
- console.log(`Updating ${PACKAGE_NAME} ${"0.1.17"} \u2192 ${latest}...`);
37303
+ console.log(`Updating ${PACKAGE_NAME} ${"0.1.18"} \u2192 ${latest}...`);
37273
37304
  (0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
37274
37305
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
37275
37306
  saveUpdateCheck({ lastCheck: Date.now() });
@@ -37464,7 +37495,7 @@ Examples:
37464
37495
  (async () => {
37465
37496
  const [command, ...args] = process.argv.slice(2);
37466
37497
  if (command === "--version" || command === "-v") {
37467
- console.log("0.1.17");
37498
+ console.log("0.1.18");
37468
37499
  return;
37469
37500
  }
37470
37501
  await checkForUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporting-bi/cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
6
6
  "main": "./dist/index.js",