@reporting-bi/cli 0.0.11 → 0.0.12

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 +13 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3084,14 +3084,16 @@ async function ensureValidToken(conn) {
3084
3084
  console.error("Token refresh failed:", err instanceof Error ? err.message : err);
3085
3085
  }
3086
3086
  }
3087
- async function createService(name, accountingOverride) {
3087
+ async function createService(name, options) {
3088
3088
  const conn = getActiveConnection();
3089
3089
  if (!conn) {
3090
3090
  console.error('Not logged in. Run "rpbi login" first.');
3091
3091
  process.exit(1);
3092
3092
  }
3093
+ const accountingOverride = typeof options === "number" ? options : void 0;
3094
+ const accountingOptional = typeof options === "object" && options.accountingOptional;
3093
3095
  const accounting2 = accountingOverride ?? conn.tokens.accounting;
3094
- if (!accounting2) {
3096
+ if (!accounting2 && !accountingOptional) {
3095
3097
  console.error('No accounting set. Run "rpbi use <domain> --accounting <id>" first.');
3096
3098
  process.exit(1);
3097
3099
  }
@@ -3102,9 +3104,11 @@ async function createService(name, accountingOverride) {
3102
3104
  throwExceptions: true
3103
3105
  });
3104
3106
  service.tokenProvider = () => conn.tokens.access_token;
3105
- const ap = new import_rp_client.AccountingProvider();
3106
- ap.a = accounting2;
3107
- service.accountingProvider = ap;
3107
+ if (accounting2) {
3108
+ const ap = new import_rp_client.AccountingProvider();
3109
+ ap.a = accounting2;
3110
+ service.accountingProvider = ap;
3111
+ }
3108
3112
  return service;
3109
3113
  }
3110
3114
  function getFields(flags, defaults) {
@@ -3221,7 +3225,7 @@ async function accounting(args) {
3221
3225
  }
3222
3226
  }
3223
3227
  async function list(flags) {
3224
- const service = await createService("accounting");
3228
+ const service = await createService("accounting", { accountingOptional: true });
3225
3229
  const accountings = await service.get("accountings", getListParams(flags, ["accounting", "company"]));
3226
3230
  output(accountings || [], flags);
3227
3231
  }
@@ -4472,8 +4476,8 @@ async function checkForUpdate() {
4472
4476
  saveUpdateCheck({ lastCheck: now });
4473
4477
  const latest = await fetchLatestVersion();
4474
4478
  if (!latest) return;
4475
- if (!isNewer(latest, "0.0.11")) return;
4476
- console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.11"} \u2192 ${latest}...\x1B[0m`);
4479
+ if (!isNewer(latest, "0.0.12")) return;
4480
+ console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.12"} \u2192 ${latest}...\x1B[0m`);
4477
4481
  (0, import_node_child_process2.execSync)(`npm install -g ${PACKAGE_NAME}@${latest}`, { stdio: "inherit" });
4478
4482
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
4479
4483
  } catch {
@@ -4601,7 +4605,7 @@ Examples:
4601
4605
  (async () => {
4602
4606
  const [command, ...args] = process.argv.slice(2);
4603
4607
  if (command === "--version" || command === "-v") {
4604
- console.log("0.0.11");
4608
+ console.log("0.0.12");
4605
4609
  return;
4606
4610
  }
4607
4611
  await checkForUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporting-bi/cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
6
6
  "main": "./dist/index.js",