@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
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
function ansiRegex({onlyFirst = false} = {}) {
|
|
2
|
-
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
3
|
-
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
4
|
-
|
|
5
|
-
// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
|
|
6
|
-
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
7
|
-
|
|
8
|
-
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
|
9
|
-
const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
|
|
10
|
-
|
|
11
|
-
const pattern = `${osc}|${csi}`;
|
|
12
|
-
|
|
13
|
-
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const regex = ansiRegex();
|
|
17
|
-
|
|
18
|
-
function stripAnsi(string) {
|
|
19
|
-
if (typeof string !== 'string') {
|
|
20
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer
|
|
24
|
-
if (!string.includes('\u001B') && !string.includes('\u009B')) {
|
|
25
|
-
return string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
29
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
30
|
-
// and doing it manually has a performance penalty.
|
|
31
|
-
return string.replace(regex, '');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Generated by scripts/build.js
|
|
35
|
-
|
|
36
|
-
// prettier-ignore
|
|
37
|
-
const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
38
|
-
|
|
39
|
-
// prettier-ignore
|
|
40
|
-
const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
41
|
-
|
|
42
|
-
// prettier-ignore
|
|
43
|
-
const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
Binary search on a sorted flat array of [start, end] pairs.
|
|
47
|
-
|
|
48
|
-
@param {number[]} ranges - Flat array of inclusive [start, end] range pairs, e.g. [0, 5, 10, 20].
|
|
49
|
-
@param {number} codePoint - The value to search for.
|
|
50
|
-
@returns {boolean} Whether the value falls within any of the ranges.
|
|
51
|
-
*/
|
|
52
|
-
const isInRange = (ranges, codePoint) => {
|
|
53
|
-
let low = 0;
|
|
54
|
-
let high = Math.floor(ranges.length / 2) - 1;
|
|
55
|
-
while (low <= high) {
|
|
56
|
-
const mid = Math.floor((low + high) / 2);
|
|
57
|
-
const i = mid * 2;
|
|
58
|
-
if (codePoint < ranges[i]) {
|
|
59
|
-
high = mid - 1;
|
|
60
|
-
} else if (codePoint > ranges[i + 1]) {
|
|
61
|
-
low = mid + 1;
|
|
62
|
-
} else {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return false;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
71
|
-
const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
72
|
-
const minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
73
|
-
const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
|
|
74
|
-
const minimumWideCodePoint = wideRanges[0];
|
|
75
|
-
const maximumWideCodePoint = wideRanges.at(-1);
|
|
76
|
-
|
|
77
|
-
const commonCjkCodePoint = 0x4E_00;
|
|
78
|
-
const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
79
|
-
|
|
80
|
-
// Use a hot-path range so common `isWide` calls can skip binary search.
|
|
81
|
-
// The range containing U+4E00 covers common CJK ideographs;
|
|
82
|
-
// fallback to the largest range for resilience to Unicode table changes.
|
|
83
|
-
function findWideFastPathRange(ranges) {
|
|
84
|
-
let fastPathStart = ranges[0];
|
|
85
|
-
let fastPathEnd = ranges[1];
|
|
86
|
-
|
|
87
|
-
for (let index = 0; index < ranges.length; index += 2) {
|
|
88
|
-
const start = ranges[index];
|
|
89
|
-
const end = ranges[index + 1];
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
commonCjkCodePoint >= start
|
|
93
|
-
&& commonCjkCodePoint <= end
|
|
94
|
-
) {
|
|
95
|
-
return [start, end];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if ((end - start) > (fastPathEnd - fastPathStart)) {
|
|
99
|
-
fastPathStart = start;
|
|
100
|
-
fastPathEnd = end;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return [fastPathStart, fastPathEnd];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const isAmbiguous = codePoint => {
|
|
108
|
-
if (
|
|
109
|
-
codePoint < minimumAmbiguousCodePoint
|
|
110
|
-
|| codePoint > maximumAmbiguousCodePoint
|
|
111
|
-
) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return isInRange(ambiguousRanges, codePoint);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const isFullWidth = codePoint => {
|
|
119
|
-
if (
|
|
120
|
-
codePoint < minimumFullWidthCodePoint
|
|
121
|
-
|| codePoint > maximumFullWidthCodePoint
|
|
122
|
-
) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return isInRange(fullwidthRanges, codePoint);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const isWide = codePoint => {
|
|
130
|
-
if (
|
|
131
|
-
codePoint >= wideFastPathStart
|
|
132
|
-
&& codePoint <= wideFastPathEnd
|
|
133
|
-
) {
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
codePoint < minimumWideCodePoint
|
|
139
|
-
|| codePoint > maximumWideCodePoint
|
|
140
|
-
) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return isInRange(wideRanges, codePoint);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
function validate(codePoint) {
|
|
148
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
149
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
154
|
-
validate(codePoint);
|
|
155
|
-
|
|
156
|
-
if (
|
|
157
|
-
isFullWidth(codePoint)
|
|
158
|
-
|| isWide(codePoint)
|
|
159
|
-
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
160
|
-
) {
|
|
161
|
-
return 2;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return 1;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
Logic:
|
|
169
|
-
- Segment graphemes to match how terminals render clusters.
|
|
170
|
-
- Width rules:
|
|
171
|
-
1. Skip non-printing clusters (Default_Ignorable, Control, pure nonspacing/enclosing Mark, lone Surrogates). Tabs are ignored by design.
|
|
172
|
-
2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
|
|
173
|
-
3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
|
|
174
|
-
4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
|
|
175
|
-
Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
|
|
176
|
-
5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing spacing marks and Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
|
|
177
|
-
*/
|
|
178
|
-
|
|
179
|
-
const segmenter = new Intl.Segmenter();
|
|
180
|
-
|
|
181
|
-
// Whole-cluster zero-width
|
|
182
|
-
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
|
|
183
|
-
|
|
184
|
-
// Pick the base scalar if the cluster starts with Prepend/Format/Marks
|
|
185
|
-
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
|
|
186
|
-
const spacingMarkRegex = /\p{Spacing_Mark}/v;
|
|
187
|
-
|
|
188
|
-
// RGI emoji sequences
|
|
189
|
-
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
190
|
-
|
|
191
|
-
// Detect minimally-qualified/unqualified emoji sequences (missing VS16 but still render as double-width)
|
|
192
|
-
const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
193
|
-
const extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
|
|
194
|
-
|
|
195
|
-
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
196
|
-
// Real emoji clusters are < 30 chars; guard against pathological input
|
|
197
|
-
if (segment.length > 50) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (unqualifiedKeycapRegex.test(segment)) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ZWJ sequences with 2+ Extended_Pictographic
|
|
206
|
-
if (segment.includes('\u200D')) {
|
|
207
|
-
const pictographics = segment.match(extendedPictographicRegex);
|
|
208
|
-
return pictographics !== null && pictographics.length >= 2;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function baseVisible(segment) {
|
|
215
|
-
return segment.replace(leadingNonPrintingRegex, '');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function isZeroWidthCluster(segment) {
|
|
219
|
-
return zeroWidthClusterRegex.test(segment);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function isHangulLeadingJamo(codePoint) {
|
|
223
|
-
return (codePoint >= 0x11_00 && codePoint <= 0x11_5F)
|
|
224
|
-
|| (codePoint >= 0xA9_60 && codePoint <= 0xA9_7C);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function isHangulVowelJamo(codePoint) {
|
|
228
|
-
return (codePoint >= 0x11_60 && codePoint <= 0x11_A7)
|
|
229
|
-
|| (codePoint >= 0xD7_B0 && codePoint <= 0xD7_C6);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function isHangulTrailingJamo(codePoint) {
|
|
233
|
-
return (codePoint >= 0x11_A8 && codePoint <= 0x11_FF)
|
|
234
|
-
|| (codePoint >= 0xD7_CB && codePoint <= 0xD7_FB);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function isHangulJamo(codePoint) {
|
|
238
|
-
return isHangulLeadingJamo(codePoint)
|
|
239
|
-
|| isHangulVowelJamo(codePoint)
|
|
240
|
-
|| isHangulTrailingJamo(codePoint);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
244
|
-
const codePoints = [];
|
|
245
|
-
|
|
246
|
-
for (const character of visibleSegment) {
|
|
247
|
-
if (zeroWidthClusterRegex.test(character)) {
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
codePoints.push(character.codePointAt(0));
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (codePoints.length === 0) {
|
|
255
|
-
return undefined;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
let width = 0;
|
|
259
|
-
|
|
260
|
-
for (let index = 0; index < codePoints.length; index++) {
|
|
261
|
-
const codePoint = codePoints[index];
|
|
262
|
-
if (!isHangulJamo(codePoint)) {
|
|
263
|
-
if (width === 0) {
|
|
264
|
-
return undefined;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// Mixed cluster (e.g., L + precomposed syllable): use EAW for non-jamo remainder
|
|
268
|
-
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
269
|
-
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return width;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Modern Hangul L+V(+T) shapes as one syllable block. Unmatched jamo stay additive:
|
|
276
|
-
// U+1100 U+1100 U+1161 => U+1100 + (U+1100 U+1161) => 2 + 2.
|
|
277
|
-
if (
|
|
278
|
-
isHangulLeadingJamo(codePoint)
|
|
279
|
-
&& isHangulVowelJamo(codePoints[index + 1])
|
|
280
|
-
) {
|
|
281
|
-
width += 2;
|
|
282
|
-
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return width;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
293
|
-
let extra = 0;
|
|
294
|
-
let first = true;
|
|
295
|
-
|
|
296
|
-
for (const character of visibleSegment) {
|
|
297
|
-
if (first) {
|
|
298
|
-
first = false;
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
spacingMarkRegex.test(character)
|
|
304
|
-
|| (character >= '\uFF00' && character <= '\uFFEF')
|
|
305
|
-
) {
|
|
306
|
-
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return extra;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function stringWidth(input, options = {}) {
|
|
314
|
-
if (typeof input !== 'string' || input.length === 0) {
|
|
315
|
-
return 0;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const {
|
|
319
|
-
ambiguousIsNarrow = true,
|
|
320
|
-
countAnsiEscapeCodes = false,
|
|
321
|
-
} = options;
|
|
322
|
-
|
|
323
|
-
let string = input;
|
|
324
|
-
|
|
325
|
-
// Avoid calling stripAnsi when there are no ANSI escape sequences (ESC = 0x1B, CSI = 0x9B)
|
|
326
|
-
if (!countAnsiEscapeCodes && (string.includes('\u001B') || string.includes('\u009B'))) {
|
|
327
|
-
string = stripAnsi(string);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (string.length === 0) {
|
|
331
|
-
return 0;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Fast path: printable ASCII (0x20–0x7E) needs no segmenter, regex, or EAW lookup — width equals length.
|
|
335
|
-
if (/^[\u0020-\u007E]*$/.test(string)) {
|
|
336
|
-
return string.length;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
let width = 0;
|
|
340
|
-
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
|
341
|
-
|
|
342
|
-
for (const {segment} of segmenter.segment(string)) {
|
|
343
|
-
// Zero-width / non-printing clusters
|
|
344
|
-
if (isZeroWidthCluster(segment)) {
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Emoji width logic
|
|
349
|
-
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
350
|
-
width += 2;
|
|
351
|
-
continue;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const visibleSegment = baseVisible(segment);
|
|
355
|
-
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
356
|
-
if (hangulWidth !== undefined) {
|
|
357
|
-
width += hangulWidth;
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// Everything else: EAW of the cluster’s first visible scalar
|
|
362
|
-
const codePoint = visibleSegment.codePointAt(0);
|
|
363
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
364
|
-
|
|
365
|
-
// Add width for trailing spacing marks and Halfwidth/Fullwidth Forms (e.g., ゙, ゚, ー)
|
|
366
|
-
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return width;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const widthPadEnd = (str, targetWidth) => {
|
|
373
|
-
const w = stringWidth(str);
|
|
374
|
-
if (w >= targetWidth) {
|
|
375
|
-
return str;
|
|
376
|
-
}
|
|
377
|
-
return str + " ".repeat(targetWidth - w);
|
|
378
|
-
};
|
|
379
|
-
const widthTruncate = (str, maxWidth) => {
|
|
380
|
-
if (stringWidth(str) <= maxWidth) {
|
|
381
|
-
return str;
|
|
382
|
-
}
|
|
383
|
-
let width = 0;
|
|
384
|
-
let result = "";
|
|
385
|
-
for (const char of str) {
|
|
386
|
-
const charWidth = stringWidth(char);
|
|
387
|
-
if (width + charWidth > maxWidth - 1) {
|
|
388
|
-
break;
|
|
389
|
-
}
|
|
390
|
-
result += char;
|
|
391
|
-
width += charWidth;
|
|
392
|
-
}
|
|
393
|
-
return `${result}\u2026`;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
export { widthTruncate as a, stringWidth as s, widthPadEnd as w };
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import consola from 'consola';
|
|
2
|
-
import { U as UserError, a as vFiniteNumber } from './bee.BYqxm3yG.mjs';
|
|
3
|
-
import 'node:stream/consumers';
|
|
4
|
-
import * as v from 'valibot';
|
|
5
|
-
import { Backlog } from 'backlog-js';
|
|
6
|
-
import { r as refreshAccessToken } from './bee.CktwmH8R.mjs';
|
|
7
|
-
import { l as loadConfig } from './bee.B3N0WBdU.mjs';
|
|
8
|
-
import { f as findSpace, u as updateSpaceAuth } from './bee.DfqnFet4.mjs';
|
|
9
|
-
import './bee.BImw1HZl.mjs';
|
|
10
|
-
|
|
11
|
-
const formatResetTime = (epochSeconds) => {
|
|
12
|
-
const date = new Date(epochSeconds * 1e3);
|
|
13
|
-
return date.toString();
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getClient = async (host) => {
|
|
17
|
-
const config = loadConfig();
|
|
18
|
-
const envApiKey = process.env.BACKLOG_API_KEY;
|
|
19
|
-
const envSpace = process.env.BACKLOG_SPACE;
|
|
20
|
-
const resolvedHost = host ?? envSpace ?? config.defaultSpace;
|
|
21
|
-
if (!resolvedHost) {
|
|
22
|
-
throw new UserError("No space configured. Run `bee auth login` to authenticate.");
|
|
23
|
-
}
|
|
24
|
-
const resolved = findSpace(config.spaces, resolvedHost);
|
|
25
|
-
if (!resolved) {
|
|
26
|
-
if (envApiKey) {
|
|
27
|
-
const client = new Backlog({ host: resolvedHost, apiKey: envApiKey });
|
|
28
|
-
return { client, host: resolvedHost };
|
|
29
|
-
}
|
|
30
|
-
throw new UserError(
|
|
31
|
-
`Space "${resolvedHost}" not found. Run \`bee auth login\` to authenticate.`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
if (resolved.auth.method === "api-key") {
|
|
35
|
-
const client = new Backlog({
|
|
36
|
-
host: resolved.host,
|
|
37
|
-
apiKey: resolved.auth.apiKey
|
|
38
|
-
});
|
|
39
|
-
return { client, host: resolved.host };
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
client: createOAuthClient(resolved.host, resolved.auth),
|
|
43
|
-
host: resolved.host
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
const createOAuthClient = (host, oauthAuth) => {
|
|
47
|
-
let currentClient = new Backlog({ host, accessToken: oauthAuth.accessToken });
|
|
48
|
-
let refreshPromise = null;
|
|
49
|
-
const refreshTokenIfNeeded = async () => {
|
|
50
|
-
if (refreshPromise) {
|
|
51
|
-
const result2 = await refreshPromise;
|
|
52
|
-
if (!result2) {
|
|
53
|
-
throw new UserError(
|
|
54
|
-
"OAuth session has expired. Run `bee auth login -m oauth` to re-authenticate."
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const { clientId, clientSecret, refreshToken } = oauthAuth;
|
|
60
|
-
if (!clientId || !clientSecret || !refreshToken) {
|
|
61
|
-
throw new UserError(
|
|
62
|
-
"OAuth credentials are incomplete. Run `bee auth login -m oauth` to re-authenticate."
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
refreshPromise = (async () => {
|
|
66
|
-
try {
|
|
67
|
-
consola.start("Access token expired. Refreshing...");
|
|
68
|
-
const tokenResponse = await refreshAccessToken(host, {
|
|
69
|
-
clientId,
|
|
70
|
-
clientSecret,
|
|
71
|
-
refreshToken
|
|
72
|
-
});
|
|
73
|
-
currentClient = new Backlog({
|
|
74
|
-
host,
|
|
75
|
-
accessToken: tokenResponse.access_token
|
|
76
|
-
});
|
|
77
|
-
updateSpaceAuth(host, {
|
|
78
|
-
method: "oauth",
|
|
79
|
-
accessToken: tokenResponse.access_token,
|
|
80
|
-
refreshToken: tokenResponse.refresh_token,
|
|
81
|
-
clientId,
|
|
82
|
-
clientSecret
|
|
83
|
-
});
|
|
84
|
-
consola.success("Token refreshed successfully.");
|
|
85
|
-
return true;
|
|
86
|
-
} catch {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
})();
|
|
90
|
-
const result = await refreshPromise;
|
|
91
|
-
refreshPromise = null;
|
|
92
|
-
if (!result) {
|
|
93
|
-
throw new UserError(
|
|
94
|
-
"OAuth session has expired. Run `bee auth login -m oauth` to re-authenticate."
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const proxy = new Proxy(currentClient, {
|
|
99
|
-
get(_target, prop, receiver) {
|
|
100
|
-
const value = Reflect.get(currentClient, prop, receiver);
|
|
101
|
-
if (typeof value !== "function") {
|
|
102
|
-
return value;
|
|
103
|
-
}
|
|
104
|
-
return async (...args) => {
|
|
105
|
-
try {
|
|
106
|
-
return await value.apply(currentClient, args);
|
|
107
|
-
} catch (error) {
|
|
108
|
-
handleRateLimitError(error);
|
|
109
|
-
if (isBacklogAuthError(error)) {
|
|
110
|
-
await refreshTokenIfNeeded();
|
|
111
|
-
const retryValue = Reflect.get(currentClient, prop, receiver);
|
|
112
|
-
return await retryValue.apply(currentClient, args);
|
|
113
|
-
}
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return proxy;
|
|
120
|
-
};
|
|
121
|
-
const isBacklogAuthError = (error) => error instanceof Error && error._name === "BacklogAuthError" && error._status === 401;
|
|
122
|
-
const isBacklogRateLimitError = (error) => error instanceof Error && error._name === "BacklogApiError" && error._status === 429;
|
|
123
|
-
const handleRateLimitError = (error) => {
|
|
124
|
-
if (isBacklogRateLimitError(error)) {
|
|
125
|
-
const resetEpoch = error._response.headers.get("X-RateLimit-Reset");
|
|
126
|
-
const resetTime = resetEpoch ? v.safeParse(vFiniteNumber, resetEpoch) : void 0;
|
|
127
|
-
const resetMessage = resetTime?.success ? `Rate limit resets at ${formatResetTime(resetTime.output)}.` : "Please wait and try again later.";
|
|
128
|
-
throw new UserError(`API rate limit exceeded. ${resetMessage}`);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export { getClient as g };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { u as updateConfig } from './bee.B3N0WBdU.mjs';
|
|
2
|
-
|
|
3
|
-
const removeSpace = (host) => {
|
|
4
|
-
updateConfig((config) => {
|
|
5
|
-
if (!config.spaces.some((space) => space.host === host)) {
|
|
6
|
-
throw new Error(`Space with host "${host}" not found in configuration.`);
|
|
7
|
-
}
|
|
8
|
-
const spaces = config.spaces.filter((space) => space.host !== host);
|
|
9
|
-
const defaultSpace = config.defaultSpace === host ? void 0 : config.defaultSpace;
|
|
10
|
-
return { ...config, spaces, defaultSpace };
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
const removeAllSpaces = () => {
|
|
14
|
-
updateConfig((config) => ({
|
|
15
|
-
...config,
|
|
16
|
-
spaces: [],
|
|
17
|
-
defaultSpace: void 0
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
const updateSpaceAuth = (host, auth) => {
|
|
21
|
-
updateConfig((config) => {
|
|
22
|
-
const index = config.spaces.findIndex((space) => space.host === host);
|
|
23
|
-
if (index === -1) {
|
|
24
|
-
throw new Error(`Space with host "${host}" not found in configuration.`);
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
...config,
|
|
28
|
-
spaces: config.spaces.with(index, { ...config.spaces[index], auth })
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
const findSpace = (spaces, host) => {
|
|
33
|
-
const exactMatch = spaces.find((s) => s.host === host);
|
|
34
|
-
if (exactMatch) {
|
|
35
|
-
return exactMatch;
|
|
36
|
-
}
|
|
37
|
-
const prefixMatches = spaces.filter((s) => s.host.startsWith(`${host}.`));
|
|
38
|
-
const [singleMatch] = prefixMatches;
|
|
39
|
-
if (prefixMatches.length === 1) {
|
|
40
|
-
return singleMatch;
|
|
41
|
-
}
|
|
42
|
-
if (prefixMatches.length > 1) {
|
|
43
|
-
const candidates = prefixMatches.map((s) => s.host).join(", ");
|
|
44
|
-
throw new Error(`Ambiguous space name "${host}". Matching spaces: ${candidates}`);
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { removeSpace as a, findSpace as f, removeAllSpaces as r, updateSpaceAuth as u };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const PrStatusId = {
|
|
2
|
-
Open: 1,
|
|
3
|
-
Closed: 2,
|
|
4
|
-
Merged: 3
|
|
5
|
-
};
|
|
6
|
-
const PrStatusName = {
|
|
7
|
-
open: PrStatusId.Open,
|
|
8
|
-
closed: PrStatusId.Closed,
|
|
9
|
-
merged: PrStatusId.Merged
|
|
10
|
-
};
|
|
11
|
-
const PR_STATUS_NAMES = Object.keys(PrStatusName);
|
|
12
|
-
|
|
13
|
-
export { PrStatusName as P, PR_STATUS_NAMES as a, PrStatusId as b };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import 'consola';
|
|
2
|
-
import 'node:stream/consumers';
|
|
3
|
-
import 'valibot';
|
|
4
|
-
import { p as parseArg, v as vInteger } from './bee.BYqxm3yG.mjs';
|
|
5
|
-
|
|
6
|
-
const resolveUserId = async (client, value) => {
|
|
7
|
-
if (value === "@me") {
|
|
8
|
-
const me = await client.getMyself();
|
|
9
|
-
return me.id;
|
|
10
|
-
}
|
|
11
|
-
return parseArg(vInteger, value, "user");
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { resolveUserId as r };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { colorize } from 'consola/utils';
|
|
3
|
-
|
|
4
|
-
class BeeCommand extends Command {
|
|
5
|
-
beeExamples = [];
|
|
6
|
-
beeEnvVars = [];
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
action(fn) {
|
|
9
|
-
this.option("-y, --yes", "Skip confirmation prompt");
|
|
10
|
-
return super.action(fn);
|
|
11
|
-
}
|
|
12
|
-
helpInformation() {
|
|
13
|
-
return super.helpInformation() + this._renderExamples() + this._renderEnvVars();
|
|
14
|
-
}
|
|
15
|
-
createCommand(name) {
|
|
16
|
-
return new BeeCommand(name);
|
|
17
|
-
}
|
|
18
|
-
examples(examples) {
|
|
19
|
-
this.beeExamples.push(...examples);
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
envVars(vars) {
|
|
23
|
-
this.beeEnvVars.push(...vars);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
async addCommands(mods) {
|
|
27
|
-
const resolved = await Promise.all(mods);
|
|
28
|
-
for (const mod of resolved) {
|
|
29
|
-
this.addCommand(mod.default);
|
|
30
|
-
}
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
_renderExamples() {
|
|
34
|
-
if (this.beeExamples.length === 0) {
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
const lines = this.beeExamples.flatMap((ex) => [
|
|
38
|
-
` # ${ex.description}`,
|
|
39
|
-
` $ ${ex.command}`,
|
|
40
|
-
""
|
|
41
|
-
]);
|
|
42
|
-
return `
|
|
43
|
-
${colorize("bold", "EXAMPLES")}
|
|
44
|
-
${lines.join("\n")}`;
|
|
45
|
-
}
|
|
46
|
-
_renderEnvVars() {
|
|
47
|
-
const fromOptions = this.options.filter((opt) => opt.envVar).map((opt) => [opt.envVar, opt.description ?? ""]);
|
|
48
|
-
const seen = /* @__PURE__ */ new Set();
|
|
49
|
-
const vars = [...fromOptions, ...this.beeEnvVars].filter(([name]) => {
|
|
50
|
-
if (seen.has(name)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
seen.add(name);
|
|
54
|
-
return true;
|
|
55
|
-
});
|
|
56
|
-
if (vars.length === 0) {
|
|
57
|
-
return "";
|
|
58
|
-
}
|
|
59
|
-
const maxLen = Math.max(...vars.map(([k]) => k.length));
|
|
60
|
-
const lines = vars.map(([k, d]) => ` ${k.padEnd(maxLen + 3)}${d}`);
|
|
61
|
-
return `
|
|
62
|
-
${colorize("bold", "ENVIRONMENT VARIABLES")}
|
|
63
|
-
${lines.join("\n")}`;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const ENV_AUTH = [
|
|
67
|
-
["BACKLOG_API_KEY", "Authenticate with an API key"],
|
|
68
|
-
["BACKLOG_SPACE", "Space hostname"]
|
|
69
|
-
];
|
|
70
|
-
const ENV_PROJECT = ["BACKLOG_PROJECT", "Default project ID or project key"];
|
|
71
|
-
const ENV_REPO = ["BACKLOG_REPO", "Default repository name"];
|
|
72
|
-
|
|
73
|
-
export { BeeCommand as B, ENV_AUTH as E, ENV_PROJECT as a, ENV_REPO as b };
|