@openbkn/bkn-sdk 0.1.1-alpha.3 → 0.1.1-alpha.4
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 +16 -5
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -43,7 +43,7 @@ import { Command as Command16 } from "commander";
|
|
|
43
43
|
// package.json
|
|
44
44
|
var package_default = {
|
|
45
45
|
name: "@openbkn/bkn-sdk",
|
|
46
|
-
version: "0.1.1-alpha.
|
|
46
|
+
version: "0.1.1-alpha.4",
|
|
47
47
|
description: "Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.",
|
|
48
48
|
type: "module",
|
|
49
49
|
license: "Apache-2.0",
|
|
@@ -83,6 +83,7 @@ var package_default = {
|
|
|
83
83
|
},
|
|
84
84
|
dependencies: {
|
|
85
85
|
"@clack/prompts": "^0.9.1",
|
|
86
|
+
"@openbkn/bkn-sdk": "^0.1.1-alpha.3",
|
|
86
87
|
chalk: "^5.4.1",
|
|
87
88
|
commander: "^13.1.0",
|
|
88
89
|
"csv-parse": "^6.2.1",
|
|
@@ -575,6 +576,7 @@ function authCommand() {
|
|
|
575
576
|
|
|
576
577
|
// src/commands/admin.ts
|
|
577
578
|
var int = (v) => Number.parseInt(v, 10);
|
|
579
|
+
var DEFAULT_RESET_PASSWORD = "openbkn";
|
|
578
580
|
function adminCommand() {
|
|
579
581
|
const admin = new Command2("admin").description(
|
|
580
582
|
"Operator CLI (kweaver-admin): org, user, role, models, audit"
|
|
@@ -707,12 +709,21 @@ function adminCommand() {
|
|
|
707
709
|
user.command("delete <id>").description("Delete a user").action(async (id, _opts, cmd) => {
|
|
708
710
|
printJson(await clientFrom(cmd).admin.userDelete(id), outputOptions(cmd));
|
|
709
711
|
});
|
|
710
|
-
user.command("reset-password [id]").description("Reset a user's password (
|
|
712
|
+
user.command("reset-password [id]").description("Reset a user's password (defaults to the platform initial password)").option("--id <userId>", "explicit user UUID (alt to the positional id)").option("--user <account>", "resolve the user by account / login name").option("--password <s>", "the new password (default: platform initial 'openbkn')").option("--new-password <s>", "the new password (alias of --password)").option("-y, --yes", "skip confirmation").action(async (id, opts, cmd) => {
|
|
711
713
|
const userId = id ?? opts.id ?? opts.user;
|
|
712
|
-
const pwd = opts.password ?? opts.newPassword;
|
|
713
714
|
if (!userId) throw new Error("Provide a user id (positional or --id).");
|
|
714
|
-
|
|
715
|
-
|
|
715
|
+
const pwd = opts.password ?? opts.newPassword ?? DEFAULT_RESET_PASSWORD;
|
|
716
|
+
const r = await clientFrom(cmd).admin.userResetPassword(userId, pwd);
|
|
717
|
+
const out = outputOptions(cmd);
|
|
718
|
+
if (out.json || out.compact) printJson(r, out);
|
|
719
|
+
else if (opts.password || opts.newPassword)
|
|
720
|
+
process.stdout.write(`Password reset for ${userId}.
|
|
721
|
+
`);
|
|
722
|
+
else
|
|
723
|
+
process.stdout.write(
|
|
724
|
+
`Password reset for ${userId} to the initial password '${DEFAULT_RESET_PASSWORD}' (must change on next login).
|
|
725
|
+
`
|
|
726
|
+
);
|
|
716
727
|
});
|
|
717
728
|
const role = admin.command("role").description("Role management");
|
|
718
729
|
role.command("list").description("List roles").option("--keyword <s>", "filter by keyword").option("--limit <n>", "page size", int, 100).option("--offset <n>", "page offset", int, 0).option("--source <s>", "role source filter (business | user)").action(async (opts, cmd) => {
|