@nulab/bee 1.1.0 → 1.1.2
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/README.md +6 -3
- package/dist/activities-BPTHt_MD.mjs +69 -0
- package/dist/activities-CRiEq51-.mjs +72 -0
- package/dist/activities-DyOMqdsM.mjs +69 -0
- package/dist/activity-labels-CLFpxp8o.mjs +34 -0
- package/dist/add-Br-_TLRp.mjs +55 -0
- package/dist/add-CTmmy2t9.mjs +26 -0
- package/dist/add-user-BVWFcbH7.mjs +26 -0
- package/dist/api-kJR0fRPw.mjs +143 -0
- package/dist/attachments-CnL8t9tK.mjs +50 -0
- package/dist/attachments-D8IoJjYE.mjs +50 -0
- package/dist/attachments-DfgEkAY2.mjs +46 -0
- package/dist/auth-5TJGBPxi.mjs +13 -0
- package/dist/bee-command-v0qvZeth.mjs +57 -0
- package/dist/browse-vgF6nz7X.mjs +304 -0
- package/dist/category-BZ7XdVgx.mjs +11 -0
- package/dist/clone-DAWVtVbZ.mjs +43 -0
- package/dist/close-cTyZPv77.mjs +37 -0
- package/dist/comment-CkYJYFrF.mjs +115 -0
- package/dist/comment-DzRBQNv8.mjs +102 -0
- package/dist/comments-SnOZ-EUJ.mjs +47 -0
- package/dist/common-options-BuYWxYdO.mjs +45 -0
- package/dist/completion-yfcnEl7k.mjs +113 -0
- package/dist/count-BI7ld4k5.mjs +50 -0
- package/dist/count-Bw0mVlxC.mjs +40 -0
- package/dist/count-CH_LN4k6.mjs +51 -0
- package/dist/count-CHzDiMV3.mjs +25 -0
- package/dist/count-DvmYzPD_.mjs +46 -0
- package/dist/create-BHjwacOk.mjs +47 -0
- package/dist/create-BXWATibN.mjs +41 -0
- package/dist/create-BtLVFmbR.mjs +29 -0
- package/dist/create-CoF2bahH.mjs +29 -0
- package/dist/create-DhAOhro9.mjs +60 -0
- package/dist/create-DtMLv7Wq.mjs +26 -0
- package/dist/create-PtahSFdG.mjs +66 -0
- package/dist/create-Y4vo2zwX.mjs +44 -0
- package/dist/create-vwRKZ3Lm.mjs +31 -0
- package/dist/dashboard-CYYU5Yii.mjs +97 -0
- package/dist/delete-BCAPHs-g.mjs +25 -0
- package/dist/delete-BHNt5SWa.mjs +24 -0
- package/dist/delete-BlmanW0H.mjs +25 -0
- package/dist/delete-Bxk14ntp.mjs +24 -0
- package/dist/delete-C05oMZEW.mjs +24 -0
- package/dist/delete-CMwkcSiA.mjs +25 -0
- package/dist/delete-CTeH7nzL.mjs +29 -0
- package/dist/delete-D2yDBhZc.mjs +24 -0
- package/dist/delete-HMOfvtv3.mjs +25 -0
- package/dist/document-CiIzSyoS.mjs +13 -0
- package/dist/edit-BBvSbt0m.mjs +22 -0
- package/dist/edit-CN1gdpjd.mjs +37 -0
- package/dist/edit-C_KbKopB.mjs +36 -0
- package/dist/edit-D5Z45NVj.mjs +27 -0
- package/dist/edit-DKQw-XXP.mjs +27 -0
- package/dist/edit-DRxr4r-r.mjs +60 -0
- package/dist/edit-DxsP-aPX.mjs +43 -0
- package/dist/edit-Otc7XHU7.mjs +52 -0
- package/dist/format-DHAR0n3J.mjs +9 -0
- package/dist/history-DpjqxFkX.mjs +55 -0
- package/dist/index.mjs +35 -207
- package/dist/issue-BRzJy3k1.mjs +18 -0
- package/dist/issue-type-Byzh4yLx.mjs +11 -0
- package/dist/list-B3A5SDEm.mjs +35 -0
- package/dist/list-BMKaJoe_.mjs +64 -0
- package/dist/list-BOMbpS4m.mjs +46 -0
- package/dist/list-BmZ_JbLB.mjs +104 -0
- package/dist/list-BpUUxxwQ.mjs +46 -0
- package/dist/list-CgIebllW.mjs +94 -0
- package/dist/list-D0Z__0nw.mjs +42 -0
- package/dist/list-D3FkO9gb.mjs +56 -0
- package/dist/list-D7WLdHvX.mjs +42 -0
- package/dist/list-DAr3urtu.mjs +53 -0
- package/dist/list-DqpWd9aR.mjs +59 -0
- package/dist/list-VO_PbRjC.mjs +50 -0
- package/dist/list-b6ByzUFt.mjs +79 -0
- package/dist/list-jpQ28gU2.mjs +56 -0
- package/dist/list-y93EXyDj.mjs +42 -0
- package/dist/login-BnJYzdR3.mjs +228 -0
- package/dist/logout-YMnSRLLF.mjs +56 -0
- package/dist/me-CLPAe7X2.mjs +36 -0
- package/dist/milestone-Dc3alfp9.mjs +11 -0
- package/dist/notification-CsOuC8Uk.mjs +11 -0
- package/dist/output-DBvfyU1J.mjs +39 -0
- package/dist/pr-BBe07JUp.mjs +15 -0
- package/dist/project-Dilo1T5e.mjs +16 -0
- package/dist/read-BS2G4sNq.mjs +17 -0
- package/dist/read-CyCASx6U.mjs +17 -0
- package/dist/read-all-CjgMJ2to.mjs +16 -0
- package/dist/refresh-DDU2ZLnc.mjs +54 -0
- package/dist/registry-B0ZQfBD5.mjs +35 -0
- package/dist/registry-RATsKPUm.mjs +2 -0
- package/dist/remove-BSDJvkVJ.mjs +17 -0
- package/dist/remove-user-CShNCvf8.mjs +26 -0
- package/dist/reopen-BIRhcmsI.mjs +28 -0
- package/dist/repo-B2K8y0mD.mjs +10 -0
- package/dist/role-labels-CLA2wmjO.mjs +11 -0
- package/dist/space-BgZeUqoH.mjs +6 -0
- package/dist/{shared/bee.B3N0WBdU.mjs → src-BWaxjrq_.mjs} +143 -176
- package/dist/src-CP4YLIAh.mjs +1008 -0
- package/dist/src-CTD9-bSB.mjs +22760 -0
- package/dist/star-Sgb-e2CQ.mjs +11 -0
- package/dist/status-BkFMW8Jh.mjs +53 -0
- package/dist/status-CaGqMXh7.mjs +64 -0
- package/dist/status-DDFyQrRZ.mjs +11 -0
- package/dist/status-nI4Dpcoo.mjs +58 -0
- package/dist/stdin-C-vjNi9T.mjs +17 -0
- package/dist/switch-CMLfVGDN.mjs +34 -0
- package/dist/tags-DuMJZyBL.mjs +29 -0
- package/dist/team-DfQn8Tf5.mjs +6 -0
- package/dist/token-BmkUX9vc.mjs +28 -0
- package/dist/tree-CozBqPbN.mjs +46 -0
- package/dist/user-DMyFmoP3.mjs +11 -0
- package/dist/users-BSGqsGSy.mjs +51 -0
- package/dist/view-Bj99sk7O.mjs +48 -0
- package/dist/view-Bs8o0c7i.mjs +36 -0
- package/dist/view-C1ECwTMN.mjs +54 -0
- package/dist/view-COBYBfu7.mjs +38 -0
- package/dist/view-CZHT-HiE.mjs +36 -0
- package/dist/view-D1RuQJV6.mjs +76 -0
- package/dist/view-DBO75WzR.mjs +54 -0
- package/dist/view-DJHrnN8j.mjs +62 -0
- package/dist/view-DLx6qQt9.mjs +51 -0
- package/dist/watching-D22YYxOT.mjs +12 -0
- package/dist/wiki-B-DQUuIX.mjs +16 -0
- package/package.json +12 -7
- package/dist/chunks/activities.mjs +0 -77
- package/dist/chunks/activities2.mjs +0 -77
- package/dist/chunks/activities3.mjs +0 -77
- package/dist/chunks/add-user.mjs +0 -40
- package/dist/chunks/add.mjs +0 -65
- package/dist/chunks/add2.mjs +0 -41
- package/dist/chunks/api.mjs +0 -176
- package/dist/chunks/attachments.mjs +0 -49
- package/dist/chunks/attachments2.mjs +0 -49
- package/dist/chunks/attachments3.mjs +0 -50
- package/dist/chunks/browse.mjs +0 -271
- package/dist/chunks/clone.mjs +0 -62
- package/dist/chunks/close.mjs +0 -52
- package/dist/chunks/comment.mjs +0 -127
- package/dist/chunks/comment2.mjs +0 -113
- package/dist/chunks/comments.mjs +0 -59
- package/dist/chunks/completion.mjs +0 -118
- package/dist/chunks/count.mjs +0 -70
- package/dist/chunks/count2.mjs +0 -71
- package/dist/chunks/count3.mjs +0 -61
- package/dist/chunks/count4.mjs +0 -37
- package/dist/chunks/count5.mjs +0 -54
- package/dist/chunks/create.mjs +0 -62
- package/dist/chunks/create2.mjs +0 -90
- package/dist/chunks/create3.mjs +0 -66
- package/dist/chunks/create4.mjs +0 -76
- package/dist/chunks/create5.mjs +0 -58
- package/dist/chunks/create6.mjs +0 -39
- package/dist/chunks/create7.mjs +0 -47
- package/dist/chunks/create8.mjs +0 -51
- package/dist/chunks/create9.mjs +0 -51
- package/dist/chunks/dashboard.mjs +0 -86
- package/dist/chunks/delete.mjs +0 -50
- package/dist/chunks/delete2.mjs +0 -48
- package/dist/chunks/delete3.mjs +0 -48
- package/dist/chunks/delete4.mjs +0 -51
- package/dist/chunks/delete5.mjs +0 -52
- package/dist/chunks/delete6.mjs +0 -52
- package/dist/chunks/delete7.mjs +0 -64
- package/dist/chunks/delete8.mjs +0 -55
- package/dist/chunks/delete9.mjs +0 -50
- package/dist/chunks/edit.mjs +0 -58
- package/dist/chunks/edit2.mjs +0 -80
- package/dist/chunks/edit3.mjs +0 -67
- package/dist/chunks/edit4.mjs +0 -53
- package/dist/chunks/edit5.mjs +0 -45
- package/dist/chunks/edit6.mjs +0 -56
- package/dist/chunks/edit7.mjs +0 -52
- package/dist/chunks/edit8.mjs +0 -52
- package/dist/chunks/history.mjs +0 -58
- package/dist/chunks/index.mjs +0 -15
- package/dist/chunks/index10.mjs +0 -18
- package/dist/chunks/index11.mjs +0 -13
- package/dist/chunks/index12.mjs +0 -13
- package/dist/chunks/index13.mjs +0 -13
- package/dist/chunks/index14.mjs +0 -8
- package/dist/chunks/index15.mjs +0 -13
- package/dist/chunks/index16.mjs +0 -13
- package/dist/chunks/index17.mjs +0 -14
- package/dist/chunks/index2.mjs +0 -18
- package/dist/chunks/index3.mjs +0 -20
- package/dist/chunks/index4.mjs +0 -15
- package/dist/chunks/index5.mjs +0 -13
- package/dist/chunks/index6.mjs +0 -17
- package/dist/chunks/index7.mjs +0 -8
- package/dist/chunks/index8.mjs +0 -8
- package/dist/chunks/index9.mjs +0 -13
- package/dist/chunks/list.mjs +0 -54
- package/dist/chunks/list10.mjs +0 -46
- package/dist/chunks/list11.mjs +0 -51
- package/dist/chunks/list12.mjs +0 -47
- package/dist/chunks/list13.mjs +0 -47
- package/dist/chunks/list14.mjs +0 -56
- package/dist/chunks/list15.mjs +0 -48
- package/dist/chunks/list2.mjs +0 -105
- package/dist/chunks/list3.mjs +0 -87
- package/dist/chunks/list4.mjs +0 -81
- package/dist/chunks/list5.mjs +0 -79
- package/dist/chunks/list6.mjs +0 -47
- package/dist/chunks/list7.mjs +0 -50
- package/dist/chunks/list8.mjs +0 -48
- package/dist/chunks/list9.mjs +0 -55
- package/dist/chunks/login.mjs +0 -220
- package/dist/chunks/logout.mjs +0 -72
- package/dist/chunks/me.mjs +0 -50
- package/dist/chunks/read-all.mjs +0 -31
- package/dist/chunks/read.mjs +0 -31
- package/dist/chunks/read2.mjs +0 -29
- package/dist/chunks/refresh.mjs +0 -78
- package/dist/chunks/remove-user.mjs +0 -40
- package/dist/chunks/remove.mjs +0 -29
- package/dist/chunks/reopen.mjs +0 -44
- package/dist/chunks/status.mjs +0 -61
- package/dist/chunks/status2.mjs +0 -63
- package/dist/chunks/status3.mjs +0 -68
- package/dist/chunks/switch.mjs +0 -51
- package/dist/chunks/tags.mjs +0 -43
- package/dist/chunks/token.mjs +0 -38
- package/dist/chunks/tree.mjs +0 -63
- package/dist/chunks/users.mjs +0 -50
- package/dist/chunks/view.mjs +0 -60
- package/dist/chunks/view2.mjs +0 -96
- package/dist/chunks/view3.mjs +0 -70
- package/dist/chunks/view4.mjs +0 -72
- package/dist/chunks/view5.mjs +0 -63
- package/dist/chunks/view6.mjs +0 -54
- package/dist/chunks/view7.mjs +0 -50
- package/dist/chunks/view8.mjs +0 -63
- package/dist/chunks/view9.mjs +0 -50
- package/dist/shared/bee.BImw1HZl.mjs +0 -28
- package/dist/shared/bee.BTBGpv4K.mjs +0 -34
- package/dist/shared/bee.BXiuAfjJ.mjs +0 -10
- package/dist/shared/bee.BYqxm3yG.mjs +0 -24
- package/dist/shared/bee.Btmq3TXs.mjs +0 -19
- package/dist/shared/bee.C--ZWPxf.mjs +0 -14
- package/dist/shared/bee.C4p7W8_P.mjs +0 -18
- package/dist/shared/bee.CirccSk2.mjs +0 -51
- package/dist/shared/bee.CktwmH8R.mjs +0 -25
- package/dist/shared/bee.CzKcWSES.mjs +0 -42
- package/dist/shared/bee.DFnSWb6q.mjs +0 -396
- package/dist/shared/bee.DessOtkV.mjs +0 -132
- package/dist/shared/bee.DfqnFet4.mjs +0 -49
- package/dist/shared/bee.DoTvz3uW.mjs +0 -13
- package/dist/shared/bee.G4d7izLe.mjs +0 -14
- package/dist/shared/bee.KteAW2rM.mjs +0 -73
- package/dist/shared/bee.PF8hrVKn.mjs +0 -27
- package/dist/shared/bee.a05kNWpn.mjs +0 -32
- package/dist/shared/bee.n5MYN4a6.mjs +0 -12
- package/dist/shared/bee.x-FvgDW2.mjs +0 -37660
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
3
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
4
|
+
import { S as space } from "./common-options-BuYWxYdO.mjs";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
import { removeStar } from "backlog-js";
|
|
7
|
+
//#region src/commands/star/remove.ts
|
|
8
|
+
const remove = new BeeCommand("remove").summary("Remove a star").description(`Use \`bee star list\` to find star IDs.`).argument("<star>", "Star ID").addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
9
|
+
description: "Remove a star",
|
|
10
|
+
command: "bee star remove 12345"
|
|
11
|
+
}]).action(async (star, opts) => {
|
|
12
|
+
const { client } = await getClient(opts.space);
|
|
13
|
+
await removeStar(client, parseArg(vInteger, star, "star"));
|
|
14
|
+
consola.success(`Removed star ${star}.`);
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { remove as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import { a as parseArg, s as vInteger } from "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { n as ENV_AUTH, r as ENV_PROJECT, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
5
|
+
import { E as resolveOptions, S as space, T as RequiredOption, u as json, y as project } from "./common-options-BuYWxYdO.mjs";
|
|
6
|
+
import consola from "consola";
|
|
7
|
+
import { deleteProjectUsers } from "backlog-js";
|
|
8
|
+
//#region src/commands/project/remove-user.ts
|
|
9
|
+
const removeUser = new BeeCommand("remove-user").summary("Remove a user from a project").description(`Use \`bee project users\` to look up user IDs.`).addOption(project()).addOption(new RequiredOption("--user-id <id>", "User ID")).addOption(json()).addOption(space()).envVars([...ENV_AUTH, ENV_PROJECT]).examples([{
|
|
10
|
+
description: "Remove a user from a project",
|
|
11
|
+
command: "bee project remove-user -p PROJECT_KEY --user-id 12345"
|
|
12
|
+
}]).action(async (opts, cmd) => {
|
|
13
|
+
await resolveOptions(cmd);
|
|
14
|
+
const userId = parseArg(vInteger, opts.userId, "--user-id");
|
|
15
|
+
const { client } = await getClient(opts.space);
|
|
16
|
+
const user = await deleteProjectUsers(client, opts.project, { userId });
|
|
17
|
+
const jsonArg = opts.json === true ? "" : opts.json;
|
|
18
|
+
outputResult(user, {
|
|
19
|
+
...opts,
|
|
20
|
+
json: jsonArg
|
|
21
|
+
}, (data) => {
|
|
22
|
+
consola.success(`Removed user ${data.name} from project ${opts.project}.`);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { removeUser as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { D as IssueStatusId, y as getClient } from "./src-CTD9-bSB.mjs";
|
|
2
|
+
import { t as outputResult } from "./output-DBvfyU1J.mjs";
|
|
3
|
+
import "./src-CP4YLIAh.mjs";
|
|
4
|
+
import { n as ENV_AUTH, t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
5
|
+
import { S as space, g as notify, u as json } from "./common-options-BuYWxYdO.mjs";
|
|
6
|
+
import consola from "consola";
|
|
7
|
+
import { patchIssue } from "backlog-js";
|
|
8
|
+
//#region src/commands/issue/reopen.ts
|
|
9
|
+
const reopen = new BeeCommand("reopen").summary("Reopen an issue").description(`Sets the status back to Open.`).argument("<issue>", "Issue ID or issue key").option("-c, --comment <text>", "Comment to add when reopening").addOption(notify()).addOption(json()).addOption(space()).envVars([...ENV_AUTH]).examples([{
|
|
10
|
+
description: "Reopen an issue",
|
|
11
|
+
command: "bee issue reopen PROJECT-123"
|
|
12
|
+
}, {
|
|
13
|
+
description: "Reopen with a comment",
|
|
14
|
+
command: "bee issue reopen PROJECT-123 -c \"Reopening due to regression\""
|
|
15
|
+
}]).action(async (issue, opts) => {
|
|
16
|
+
const { client } = await getClient(opts.space);
|
|
17
|
+
const notifiedUserId = opts.notify ?? [];
|
|
18
|
+
const issueData = await patchIssue(client, issue, {
|
|
19
|
+
statusId: IssueStatusId.Open,
|
|
20
|
+
comment: opts.comment,
|
|
21
|
+
notifiedUserId
|
|
22
|
+
});
|
|
23
|
+
outputResult(issueData, opts, (data) => {
|
|
24
|
+
consola.success(`Reopened issue ${data.issueKey}: ${data.summary}`);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { reopen as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
2
|
+
//#region src/commands/repo/index.ts
|
|
3
|
+
const repo = new BeeCommand("repo").summary("Manage Backlog Git repositories");
|
|
4
|
+
await repo.addCommands([
|
|
5
|
+
import("./list-D7WLdHvX.mjs"),
|
|
6
|
+
import("./view-Bj99sk7O.mjs"),
|
|
7
|
+
import("./clone-DAWVtVbZ.mjs")
|
|
8
|
+
]);
|
|
9
|
+
//#endregion
|
|
10
|
+
export { repo as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { t as BeeCommand } from "./bee-command-v0qvZeth.mjs";
|
|
2
|
+
//#region src/commands/space/index.ts
|
|
3
|
+
const space = new BeeCommand("space").summary("Manage space information");
|
|
4
|
+
await space.addCommands([import("./activities-DyOMqdsM.mjs")]);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { space as default };
|
|
@@ -1,56 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import * as v from 'valibot';
|
|
8
|
-
import { a as RcSchema } from './bee.BImw1HZl.mjs';
|
|
9
|
-
import { Option } from 'commander';
|
|
10
|
-
|
|
11
|
-
const promptRequired = async (label, existing, options) => {
|
|
12
|
-
if (existing !== void 0) {
|
|
13
|
-
if (existing) {
|
|
14
|
-
return existing;
|
|
15
|
-
}
|
|
16
|
-
throw new UserError(`${label.replace(/:$/, "")} is required.`);
|
|
17
|
-
}
|
|
18
|
-
if (!process.stdin.isTTY) {
|
|
19
|
-
throw new UserError(
|
|
20
|
-
`${label.replace(/:$/, "")} is required. Use arguments to provide it in non-interactive mode.`
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
const displayLabel = options?.valueHint ? label.replace(/:$/, ` ${options.valueHint}:`) : label;
|
|
24
|
-
const { valueHint: _, ...promptOptions } = options ?? {};
|
|
25
|
-
const value = await consola.prompt(displayLabel, { type: "text", ...promptOptions });
|
|
26
|
-
if (typeof value !== "string" || !value) {
|
|
27
|
-
throw new UserError(`${label.replace(/:$/, "")} is required.`);
|
|
28
|
-
}
|
|
29
|
-
return value;
|
|
30
|
-
};
|
|
31
|
-
const confirmOrExit = async (message, skipConfirm) => {
|
|
32
|
-
if (skipConfirm) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
if (!process.stdin.isTTY) {
|
|
36
|
-
throw new UserError("Confirmation required. Use --yes to skip in non-interactive mode.");
|
|
37
|
-
}
|
|
38
|
-
const confirmed = await consola.prompt(message, { type: "confirm" });
|
|
39
|
-
if (!confirmed) {
|
|
40
|
-
consola.info("Cancelled.");
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
|
|
1
|
+
import { u as UserError } from "./src-CP4YLIAh.mjs";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { chmodSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
//#region ../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/_chunks/libs/flat.mjs
|
|
47
7
|
function isBuffer(obj) {
|
|
48
8
|
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
49
9
|
}
|
|
50
10
|
function keyIdentity(key) {
|
|
51
11
|
return key;
|
|
52
12
|
}
|
|
53
|
-
function flatten(target, opts) {
|
|
13
|
+
function flatten$1(target, opts) {
|
|
54
14
|
opts = opts || {};
|
|
55
15
|
const delimiter = opts.delimiter || ".";
|
|
56
16
|
const maxDepth = opts.maxDepth;
|
|
@@ -102,7 +62,7 @@ function unflatten(target, opts) {
|
|
|
102
62
|
if (!(type === "[object Object]" || type === "[object Array]") || isEmpty(target[key])) {
|
|
103
63
|
result[key] = target[key];
|
|
104
64
|
return result;
|
|
105
|
-
} else return addKeys(key, result, flatten(target[key], opts));
|
|
65
|
+
} else return addKeys(key, result, flatten$1(target[key], opts));
|
|
106
66
|
}, {});
|
|
107
67
|
Object.keys(target).forEach(function(key) {
|
|
108
68
|
const split = key.split(delimiter).map(transformKey);
|
|
@@ -125,76 +85,51 @@ function unflatten(target, opts) {
|
|
|
125
85
|
});
|
|
126
86
|
return result;
|
|
127
87
|
}
|
|
128
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
|
|
129
90
|
const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
130
91
|
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
131
92
|
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
132
93
|
function jsonParseTransform(key, value) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
94
|
+
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
95
|
+
warnKeyDropped(key);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
138
99
|
}
|
|
139
100
|
function warnKeyDropped(key) {
|
|
140
|
-
|
|
101
|
+
console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
|
|
141
102
|
}
|
|
142
103
|
function destr(value, options = {}) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
case "-infinity": {
|
|
171
|
-
return Number.NEGATIVE_INFINITY;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (!JsonSigRx.test(value)) {
|
|
176
|
-
if (options.strict) {
|
|
177
|
-
throw new SyntaxError("[destr] Invalid JSON");
|
|
178
|
-
}
|
|
179
|
-
return value;
|
|
180
|
-
}
|
|
181
|
-
try {
|
|
182
|
-
if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
|
|
183
|
-
if (options.strict) {
|
|
184
|
-
throw new Error("[destr] Possible prototype pollution");
|
|
185
|
-
}
|
|
186
|
-
return JSON.parse(value, jsonParseTransform);
|
|
187
|
-
}
|
|
188
|
-
return JSON.parse(value);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
if (options.strict) {
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
return value;
|
|
194
|
-
}
|
|
104
|
+
if (typeof value !== "string") return value;
|
|
105
|
+
if (value[0] === "\"" && value[value.length - 1] === "\"" && value.indexOf("\\") === -1) return value.slice(1, -1);
|
|
106
|
+
const _value = value.trim();
|
|
107
|
+
if (_value.length <= 9) switch (_value.toLowerCase()) {
|
|
108
|
+
case "true": return true;
|
|
109
|
+
case "false": return false;
|
|
110
|
+
case "undefined": return;
|
|
111
|
+
case "null": return null;
|
|
112
|
+
case "nan": return NaN;
|
|
113
|
+
case "infinity": return Number.POSITIVE_INFINITY;
|
|
114
|
+
case "-infinity": return Number.NEGATIVE_INFINITY;
|
|
115
|
+
}
|
|
116
|
+
if (!JsonSigRx.test(value)) {
|
|
117
|
+
if (options.strict) throw new SyntaxError("[destr] Invalid JSON");
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
|
|
122
|
+
if (options.strict) throw new Error("[destr] Possible prototype pollution");
|
|
123
|
+
return JSON.parse(value, jsonParseTransform);
|
|
124
|
+
}
|
|
125
|
+
return JSON.parse(value);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (options.strict) throw error;
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
195
130
|
}
|
|
196
|
-
|
|
197
|
-
//#region
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ../../node_modules/.pnpm/rc9@3.0.1/node_modules/rc9/dist/index.mjs
|
|
198
133
|
const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
|
|
199
134
|
const RE_LINES = /\n|\r|\r\n/;
|
|
200
135
|
/**
|
|
@@ -266,7 +201,7 @@ function readUser(options) {
|
|
|
266
201
|
* @returns {string} - The serialised configuration string.
|
|
267
202
|
*/
|
|
268
203
|
function serialize(config) {
|
|
269
|
-
return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
|
|
204
|
+
return Object.entries(flatten$1(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
|
|
270
205
|
}
|
|
271
206
|
/**
|
|
272
207
|
* Writes a configuration object to a file in a default or specified location.
|
|
@@ -288,79 +223,111 @@ function writeUser(config, options) {
|
|
|
288
223
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
289
224
|
write(config, options);
|
|
290
225
|
}
|
|
291
|
-
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region ../../packages/config/src/schema.ts
|
|
228
|
+
const ApiKeyAuthSchema = v.object({
|
|
229
|
+
method: v.literal("api-key"),
|
|
230
|
+
apiKey: v.string()
|
|
231
|
+
});
|
|
232
|
+
const OAuthAuthSchema = v.object({
|
|
233
|
+
method: v.literal("oauth"),
|
|
234
|
+
accessToken: v.string(),
|
|
235
|
+
refreshToken: v.string(),
|
|
236
|
+
clientId: v.optional(v.string()),
|
|
237
|
+
clientSecret: v.optional(v.string())
|
|
238
|
+
});
|
|
239
|
+
const RcAuthSchema = v.variant("method", [ApiKeyAuthSchema, OAuthAuthSchema]);
|
|
240
|
+
/**
|
|
241
|
+
* A Backlog space hostname.
|
|
242
|
+
*
|
|
243
|
+
* Any domain is accepted so that self-hosted spaces work, but the value must be
|
|
244
|
+
* a bare hostname: it is interpolated into `https://${host}` by both
|
|
245
|
+
* `buildBacklogUrl` and backlog-js, so a value carrying userinfo, a path, or a
|
|
246
|
+
* scheme (e.g. `example.backlog.com@evil.com`) would silently redirect requests
|
|
247
|
+
* — and the credentials in them — to another origin.
|
|
248
|
+
*/
|
|
249
|
+
const RcHostSchema = v.pipe(v.string(), v.toLowerCase(), v.domain());
|
|
250
|
+
const RcSpaceSchema = v.object({
|
|
251
|
+
host: RcHostSchema,
|
|
252
|
+
auth: RcAuthSchema
|
|
253
|
+
});
|
|
254
|
+
const RcSchema = v.object({
|
|
255
|
+
defaultSpace: v.optional(v.pipe(v.string(), v.toLowerCase())),
|
|
256
|
+
spaces: v.optional(v.array(RcSpaceSchema), []),
|
|
257
|
+
aliases: v.optional(v.record(v.string(), v.string()), {})
|
|
258
|
+
});
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region ../../packages/config/src/config.ts
|
|
292
261
|
const CONFIG_FILE_NAME = ".beerc";
|
|
293
262
|
const parseConfig = (raw) => {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return result.output;
|
|
263
|
+
const result = v.safeParse(RcSchema, raw);
|
|
264
|
+
if (!result.success) {
|
|
265
|
+
const details = result.issues.map((issue) => issue.message).join("\n");
|
|
266
|
+
throw new UserError(`Configuration Error:\n${details}`);
|
|
267
|
+
}
|
|
268
|
+
return result.output;
|
|
301
269
|
};
|
|
302
270
|
const loadConfig = () => parseConfig(readUser(CONFIG_FILE_NAME));
|
|
303
271
|
const configFilePath = () => resolve(process.env.XDG_CONFIG_HOME || homedir(), CONFIG_FILE_NAME);
|
|
272
|
+
/**
|
|
273
|
+
* Validates before writing rather than trusting the caller, so an invalid host
|
|
274
|
+
* cannot be persisted by a command that writes the rc file directly (such as
|
|
275
|
+
* `bee auth login`) only to break every later read.
|
|
276
|
+
*/
|
|
304
277
|
const writeConfig = (config) => {
|
|
305
|
-
|
|
306
|
-
|
|
278
|
+
writeUser(parseConfig(config), CONFIG_FILE_NAME);
|
|
279
|
+
chmodSync(configFilePath(), 384);
|
|
307
280
|
};
|
|
308
281
|
const updateConfig = (updater) => {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return updated;
|
|
282
|
+
const updated = updater(loadConfig());
|
|
283
|
+
writeConfig(updated);
|
|
284
|
+
return updated;
|
|
313
285
|
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region ../../packages/config/src/space.ts
|
|
288
|
+
const removeSpace = (host) => {
|
|
289
|
+
updateConfig((config) => {
|
|
290
|
+
if (!config.spaces.some((space) => space.host === host)) throw new Error(`Space with host "${host}" not found in configuration.`);
|
|
291
|
+
const spaces = config.spaces.filter((space) => space.host !== host);
|
|
292
|
+
const defaultSpace = config.defaultSpace === host ? void 0 : config.defaultSpace;
|
|
293
|
+
return {
|
|
294
|
+
...config,
|
|
295
|
+
spaces,
|
|
296
|
+
defaultSpace
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
const removeAllSpaces = () => {
|
|
301
|
+
updateConfig((config) => ({
|
|
302
|
+
...config,
|
|
303
|
+
spaces: [],
|
|
304
|
+
defaultSpace: void 0
|
|
305
|
+
}));
|
|
306
|
+
};
|
|
307
|
+
const updateSpaceAuth = (host, auth) => {
|
|
308
|
+
updateConfig((config) => {
|
|
309
|
+
const index = config.spaces.findIndex((space) => space.host === host);
|
|
310
|
+
if (index === -1) throw new Error(`Space with host "${host}" not found in configuration.`);
|
|
311
|
+
return {
|
|
312
|
+
...config,
|
|
313
|
+
spaces: config.spaces.with(index, {
|
|
314
|
+
...config.spaces[index],
|
|
315
|
+
auth
|
|
316
|
+
})
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
const findSpace = (spaces, host) => {
|
|
321
|
+
const exactMatch = spaces.find((s) => s.host === host);
|
|
322
|
+
if (exactMatch) return exactMatch;
|
|
323
|
+
const prefixMatches = spaces.filter((s) => s.host.startsWith(`${host}.`));
|
|
324
|
+
const [singleMatch] = prefixMatches;
|
|
325
|
+
if (prefixMatches.length === 1) return singleMatch;
|
|
326
|
+
if (prefixMatches.length > 1) {
|
|
327
|
+
const candidates = prefixMatches.map((s) => s.host).join(", ");
|
|
328
|
+
throw new Error(`Ambiguous space name "${host}". Matching spaces: ${candidates}`);
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
330
331
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const collectNum = (val, prev) => [
|
|
334
|
-
...prev,
|
|
335
|
-
parseArg(vInteger, val, "value")
|
|
336
|
-
];
|
|
337
|
-
const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
|
|
338
|
-
const projectOptional = (description = "Project ID or project key") => new Option("-p, --project <id>", description).env("BACKLOG_PROJECT");
|
|
339
|
-
const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
|
|
340
|
-
const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
|
|
341
|
-
const offset = () => new Option("--offset <n>", "Offset for pagination");
|
|
342
|
-
const order = () => new Option("--order <dir>", "Sort order").choices(["asc", "desc"]);
|
|
343
|
-
const minId = () => new Option("--min-id <n>", "Minimum ID for cursor-based pagination");
|
|
344
|
-
const maxId = () => new Option("--max-id <n>", "Maximum ID for cursor-based pagination");
|
|
345
|
-
const keyword = () => new Option("-k, --keyword <text>", "Keyword search");
|
|
346
|
-
const assignee = () => new Option("-a, --assignee <id>", "Assignee user ID. Use @me for yourself.");
|
|
347
|
-
const assigneeList = () => new Option("-a, --assignee <id>", "Assignee user ID (repeatable). Use @me for yourself.").argParser(collect).default([]);
|
|
348
|
-
const issue = () => new Option("--issue <key>", "Issue ID or issue key");
|
|
349
|
-
const notify = () => new Option("--notify <id>", "User IDs to notify (repeatable)").argParser(collectNum).default([]);
|
|
350
|
-
const attachment = () => new Option("--attachment <id>", "Attachment IDs (repeatable)").argParser(collectNum).default([]);
|
|
351
|
-
const category = () => new Option("--category <id>", "Category IDs (repeatable)").argParser(collectNum).default([]);
|
|
352
|
-
const version = () => new Option("--version <id>", "Version IDs (repeatable)").argParser(collectNum).default([]);
|
|
353
|
-
const milestone = () => new Option("--milestone <id>", "Milestone IDs (repeatable)").argParser(collectNum).default([]);
|
|
354
|
-
const comment = () => new Option("-c, --comment <text>", "Comment to add with the update");
|
|
355
|
-
const web = (resource) => new Option("-w, --web", `Open the ${resource} in the browser`);
|
|
356
|
-
const noBrowser = () => new Option("-n, --no-browser", "Print the URL instead of opening the browser");
|
|
357
|
-
const space = () => new Option(
|
|
358
|
-
"-s, --space <hostname>",
|
|
359
|
-
"Space hostname (e.g. xxx.backlog.com, or your own domain)"
|
|
360
|
-
).env("BACKLOG_SPACE");
|
|
361
|
-
const json = () => new Option(
|
|
362
|
-
"--json [fields]",
|
|
363
|
-
"Output as JSON (optionally filter by field names, comma-separated)"
|
|
364
|
-
).preset("");
|
|
365
|
-
|
|
366
|
-
export { minId as A, maxId as B, repo as C, issue as D, RequiredOption as R, promptRequired as a, writeConfig as b, collect as c, project as d, confirmOrExit as e, collectNum as f, count as g, assigneeList as h, offset as i, json as j, keyword as k, loadConfig as l, assignee as m, noBrowser as n, order as o, projectOptional as p, category as q, resolveOptions as r, space as s, milestone as t, updateConfig as u, version as v, web as w, notify as x, attachment as y, comment as z };
|
|
332
|
+
//#endregion
|
|
333
|
+
export { loadConfig as a, RcHostSchema as c, updateSpaceAuth as i, removeAllSpaces as n, updateConfig as o, removeSpace as r, writeConfig as s, findSpace as t };
|