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

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
@@ -11,6 +11,7 @@ import {
11
11
  createClient,
12
12
  credentialDeviceLogin,
13
13
  currentToken,
14
+ currentTokenFresh,
14
15
  decodeJwt,
15
16
  deletePlatform,
16
17
  deviceLogin,
@@ -36,7 +37,7 @@ import {
36
37
  use,
37
38
  whoami,
38
39
  writePlatformConfig
39
- } from "./chunk-GAYXY7LP.js";
40
+ } from "./chunk-DTU5DGJW.js";
40
41
 
41
42
  // src/cli.ts
42
43
  import { Command as Command16 } from "commander";
@@ -44,7 +45,7 @@ import { Command as Command16 } from "commander";
44
45
  // package.json
45
46
  var package_default = {
46
47
  name: "@openbkn/bkn-sdk",
47
- version: "0.1.1-alpha.7",
48
+ version: "0.1.1-alpha.8",
48
49
  description: "Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.",
49
50
  type: "module",
50
51
  license: "Apache-2.0",
@@ -498,8 +499,11 @@ User code: ${userCode}
498
499
  );
499
500
  });
500
501
  cmd.command("status").description("Show base URL and whether a token is configured").action((_opts, cmd2) => printJson(status(), outputOptions(cmd2)));
501
- cmd.command("token").description("Print the current access token (keep secret)").action(() => {
502
- process.stdout.write(`${currentToken()}
502
+ cmd.command("token").description("Print the current access token, refreshing it if expired (keep secret)").option("--no-refresh", "print the stored token as-is, without refreshing").action(async (opts, cmd2) => {
503
+ const g = cmd2.optsWithGlobals();
504
+ if (g.insecure) process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
505
+ const token = opts.refresh === false ? currentToken() : await currentTokenFresh();
506
+ process.stdout.write(`${token}
503
507
  `);
504
508
  });
505
509
  cmd.command("whoami [url]").description("Show current user identity (from the token)").option("--no-lookup", "skip the backend identity fallback (eacp/user/get)").action(async (_url, opts, cmd2) => {