@openbkn/bkn-sdk 0.1.1-alpha.6 → 0.1.1-alpha.7

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/cli.js CHANGED
@@ -44,7 +44,7 @@ import { Command as Command16 } from "commander";
44
44
  // package.json
45
45
  var package_default = {
46
46
  name: "@openbkn/bkn-sdk",
47
- version: "0.1.1-alpha.6",
47
+ version: "0.1.1-alpha.7",
48
48
  description: "Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.",
49
49
  type: "module",
50
50
  license: "Apache-2.0",
@@ -522,7 +522,26 @@ User code: ${userCode}
522
522
  } catch {
523
523
  }
524
524
  }
525
- printJson(me, outputOptions(cmd2));
525
+ const out = outputOptions(cmd2);
526
+ if (out.json || out.compact || out.full) {
527
+ printJson(me, out);
528
+ return;
529
+ }
530
+ const expMs = typeof me.exp === "number" ? me.exp * 1e3 : void 0;
531
+ const expired = expMs !== void 0 && expMs < Date.now();
532
+ const rows = [
533
+ ["User", String(me.username ?? me.sub ?? "(unknown)")],
534
+ ...me.name && me.name !== me.username ? [["Name", String(me.name)]] : [],
535
+ ["ID", String(me.userId ?? me.sub ?? "-")],
536
+ ["Platform", String(me.baseUrl ?? "-")],
537
+ ...expMs !== void 0 ? [["Expires", `${new Date(expMs).toISOString()}${expired ? " (expired)" : ""}`]] : []
538
+ ];
539
+ const pad2 = Math.max(...rows.map(([k]) => k.length));
540
+ process.stdout.write(
541
+ `${rows.map(([k, v]) => `${k.padEnd(pad2)} ${v}`).join("\n")}
542
+ \u2026 use --full or --json for all claims
543
+ `
544
+ );
526
545
  });
527
546
  cmd.command("list").alias("ls").description("List saved sessions (platform \u2192 users; * = active)").action((_opts, cmd2) => {
528
547
  const items = listPlatforms();