badmfck-api-server 4.1.48 → 4.1.52
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/apiServer/deployment/Deploy.d.ts +1 -1
- package/dist/apiServer/deployment/Deploy.js +89 -9
- package/dist/apiServer/deployment/DeployerService.d.ts +1 -0
- package/dist/apiServer/deployment/DeployerService.js +15 -3
- package/dist/apiServer/documentation/index.html +3 -3
- package/package.json +1 -1
|
@@ -10,21 +10,101 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const __1 = require("../..");
|
|
11
11
|
const crypto_1 = __importDefault(require("crypto"));
|
|
12
12
|
const undici_1 = require("undici");
|
|
13
|
+
const promises_1 = require("readline/promises");
|
|
14
|
+
const process_1 = require("process");
|
|
15
|
+
function validateConfig(cfg) {
|
|
16
|
+
if (!cfg || typeof cfg !== "object")
|
|
17
|
+
return "not an object";
|
|
18
|
+
if (!cfg.name || !cfg.token || !cfg.host || !cfg.username || !cfg.password)
|
|
19
|
+
return "missing one of: name, token, host, username, password";
|
|
20
|
+
if (cfg.includes && !Array.isArray(cfg.includes))
|
|
21
|
+
return "includes must be an array";
|
|
22
|
+
if (cfg.excludes && !Array.isArray(cfg.excludes))
|
|
23
|
+
return "excludes must be an array";
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
async function selectConfig(configs) {
|
|
27
|
+
if (configs.length === 0) {
|
|
28
|
+
throw new Error("No valid deploy configs found");
|
|
29
|
+
}
|
|
30
|
+
if (configs.length === 1) {
|
|
31
|
+
console.log(`Using deploy config: ${configs[0].name}`);
|
|
32
|
+
return configs[0];
|
|
33
|
+
}
|
|
34
|
+
if (!process_1.stdin.isTTY) {
|
|
35
|
+
throw new Error(`Found ${configs.length} deploy configs (${configs.map(c => c.name).join(", ")}) but stdin is not a TTY — ` +
|
|
36
|
+
`cannot prompt for a choice. Pass a specific config explicitly, e.g. Deploy("deploy/<name>.json").`);
|
|
37
|
+
}
|
|
38
|
+
console.log("\nAvailable deploy configs:\n");
|
|
39
|
+
configs.forEach((config, index) => {
|
|
40
|
+
console.log(`[${index + 1}] ${config.name ?? "bad-config-file"}`);
|
|
41
|
+
});
|
|
42
|
+
const rl = (0, promises_1.createInterface)({
|
|
43
|
+
input: process_1.stdin,
|
|
44
|
+
output: process_1.stdout,
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
while (true) {
|
|
48
|
+
const answer = await rl.question(`\nChoose config [1-${configs.length}]: `);
|
|
49
|
+
const selectedIndex = Number.parseInt(answer.trim(), 10) - 1;
|
|
50
|
+
if (Number.isInteger(selectedIndex) &&
|
|
51
|
+
selectedIndex >= 0 &&
|
|
52
|
+
selectedIndex < configs.length) {
|
|
53
|
+
return configs[selectedIndex];
|
|
54
|
+
}
|
|
55
|
+
console.error(`Invalid selection. Enter a number from 1 to ${configs.length}.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
rl.close();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
13
62
|
async function Deploy(opt) {
|
|
63
|
+
if (!opt) {
|
|
64
|
+
const dir = path_1.default.resolve("deploy");
|
|
65
|
+
const single = path_1.default.resolve("deploy.json");
|
|
66
|
+
if (fs_1.default.existsSync(dir) && fs_1.default.statSync(dir).isDirectory()) {
|
|
67
|
+
const files = fs_1.default.readdirSync(dir).filter(f => f.endsWith(".json"));
|
|
68
|
+
if (files.length === 0)
|
|
69
|
+
throw new Error(`No .json configs found in ${dir}`);
|
|
70
|
+
const configs = [];
|
|
71
|
+
for (const f of files) {
|
|
72
|
+
const filePath = path_1.default.resolve(dir, f);
|
|
73
|
+
let parsed;
|
|
74
|
+
try {
|
|
75
|
+
parsed = JSON.parse(fs_1.default.readFileSync(filePath).toString("utf-8"));
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.error(`Skipping ${f}: failed to parse JSON:`, e.message);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const reason = validateConfig(parsed);
|
|
82
|
+
if (reason) {
|
|
83
|
+
console.error(`Skipping ${f}: ${reason}`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
configs.push(parsed);
|
|
87
|
+
}
|
|
88
|
+
if (configs.length === 0)
|
|
89
|
+
throw new Error(`No valid deploy configs in ${dir} (all ${files.length} were skipped)`);
|
|
90
|
+
opt = await selectConfig(configs);
|
|
91
|
+
}
|
|
92
|
+
else if (fs_1.default.existsSync(single)) {
|
|
93
|
+
opt = single;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
throw new Error(`No deploy config found: neither ${dir}/ nor ${single} exists`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
14
99
|
if (typeof opt === "string") {
|
|
15
100
|
if (!fs_1.default.existsSync(opt)) {
|
|
16
101
|
throw new Error(`File not found: ${opt}`);
|
|
17
102
|
}
|
|
18
103
|
opt = JSON.parse(fs_1.default.readFileSync(opt).toString("utf-8"));
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
throw new Error(`Invalid deploy config file: includes must be an array`);
|
|
24
|
-
}
|
|
25
|
-
if (opt.excludes && !Array.isArray(opt.excludes)) {
|
|
26
|
-
throw new Error(`Invalid deploy config file: excludes must be an array`);
|
|
27
|
-
}
|
|
104
|
+
}
|
|
105
|
+
const invalidReason = validateConfig(opt);
|
|
106
|
+
if (invalidReason) {
|
|
107
|
+
throw new Error(`Invalid deploy config: ${invalidReason}`);
|
|
28
108
|
}
|
|
29
109
|
const archiveName = __1.UID.sha256(opt.name.replaceAll(".", "_")) + ".tar.gz";
|
|
30
110
|
console.log("Changing Config to live");
|
|
@@ -119,6 +119,7 @@ export declare class DeployerService extends BaseService {
|
|
|
119
119
|
}>;
|
|
120
120
|
tokensMatch(a: string | undefined, b: string | undefined): boolean;
|
|
121
121
|
private _checkUserAuth;
|
|
122
|
+
private static _extractPort;
|
|
122
123
|
private _renderNginx;
|
|
123
124
|
runPM2(found: IConfig, projectState?: IProjectState | null): Promise<IError | null>;
|
|
124
125
|
private static readonly SKIP_DIRS;
|
|
@@ -246,7 +246,7 @@ class DeployerService extends BaseService_1.BaseService {
|
|
|
246
246
|
}
|
|
247
247
|
if (found.nginx?.config_dir && (!projectState || projectStateWasCreated)) {
|
|
248
248
|
const activeCfg = (found.config ?? {});
|
|
249
|
-
const nginxErr = await this._renderNginx(found, data.name, activeCfg
|
|
249
|
+
const nginxErr = await this._renderNginx(found, data.name, DeployerService._extractPort(activeCfg));
|
|
250
250
|
if (nginxErr) {
|
|
251
251
|
if (found.email && found.email.length > 0) {
|
|
252
252
|
for (let email of found.email) {
|
|
@@ -366,7 +366,7 @@ class DeployerService extends BaseService_1.BaseService {
|
|
|
366
366
|
if (found.nginx?.config_dir) {
|
|
367
367
|
const slotCfg = target === "blue" ? found.bluegreen.blue_config : found.bluegreen.green_config;
|
|
368
368
|
const merged = { ...(found.config ?? {}), ...(slotCfg ?? {}) };
|
|
369
|
-
const nginxErr = await this._renderNginx(found, data.name, merged
|
|
369
|
+
const nginxErr = await this._renderNginx(found, data.name, DeployerService._extractPort(merged));
|
|
370
370
|
if (nginxErr) {
|
|
371
371
|
(0, LogService_1.logError)("nginx render during switch failed (state already flipped): " + nginxErr.message);
|
|
372
372
|
hookError = nginxErr.message;
|
|
@@ -441,11 +441,23 @@ class DeployerService extends BaseService_1.BaseService {
|
|
|
441
441
|
}
|
|
442
442
|
return matched;
|
|
443
443
|
}
|
|
444
|
+
static _extractPort(config) {
|
|
445
|
+
if (!config || typeof config !== "object")
|
|
446
|
+
return "";
|
|
447
|
+
for (const key of Object.keys(config)) {
|
|
448
|
+
if (key.toLowerCase() === "port") {
|
|
449
|
+
const v = config[key];
|
|
450
|
+
if (v !== null && v !== undefined && String(v).length > 0)
|
|
451
|
+
return String(v);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return "";
|
|
455
|
+
}
|
|
444
456
|
async _renderNginx(found, projectName, activePort) {
|
|
445
457
|
if (!found.nginx?.config_dir)
|
|
446
458
|
return null;
|
|
447
459
|
if (!activePort) {
|
|
448
|
-
return { code: 52, message: "Cannot render nginx: no
|
|
460
|
+
return { code: 52, message: "Cannot render nginx: no port found in config for project " + projectName + " (expected a 'port' key in config or blue_config/green_config)", httpStatus: 500 };
|
|
449
461
|
}
|
|
450
462
|
const dir = found.nginx.config_dir;
|
|
451
463
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<!-- Build: 2026-
|
|
5
|
-
<script>var __ver = "1.0.
|
|
4
|
+
<!-- Build: 2026-08-06T09:37:16.454Z | Version: 1.0.14 -->
|
|
5
|
+
<script>var __ver = "1.0.14";</script>
|
|
6
6
|
<meta charset="UTF-8" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -321,7 +321,7 @@ const a4={background:"#a7a7a7",backgroundSelected:"#66bb6a",toggle:"#FFFFFF"},l4
|
|
|
321
321
|
`),php:w.join(`
|
|
322
322
|
`)}},G4=(e,t)=>e.split(`
|
|
323
323
|
`).map((r,n)=>n===0?r:t+r).join(`
|
|
324
|
-
`),xr=({code:e,wrap:t})=>{const[r,n]=ee.useState(!1),o=()=>{var i;try{(i=navigator.clipboard)==null||i.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return C.jsxs(M,{sx:{position:"relative"},children:[C.jsxs(M,{onClick:o,title:"Copy",sx:{position:"absolute",top:"8px",right:"8px",display:"flex",alignItems:"center",gap:"5px",padding:"5px 8px",borderRadius:"4px",cursor:"pointer",backgroundColor:"rgba(255,255,255,0.08)",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"rgba(255,255,255,0.16)"}},children:[C.jsx(M,{sx:{display:"flex",filter:"invert(1) brightness(2)"},children:C.jsx(E4,{size:"13"})}),C.jsx(K,{variant:"small",color:r?"#6aa76a":"rgba(255,255,255,0.6)",sx:{fontSize:"11px"},children:r?"Copied":"Copy"})]}),C.jsx(M,{sx:{fontFamily:"monospace",color:"#0ffa52",backgroundColor:"rgba(0,0,0,0.7)",padding:"14px 76px 14px 16px",borderRadius:"4px",fontSize:"12px",lineHeight:"1.5",whiteSpace:t?"pre-wrap":"pre",wordBreak:t?"break-all":void 0,overflowX:t?void 0:"auto"},children:e})]})},X4={string:"#6aa76a",number:"#4c9ec7",boolean:"orange",object:"#FFAACC",array:"#00EEAA",any:"#ffeb3b",file:"#ff5722",date:"#9c27b0",null:"#9e9e9e",undefined:"#9e9e9e"},V1=({children:e})=>C.jsx(K,{variant:"medium",color:"rgba(255,255,255,0.82)",sx:{display:"block",fontSize:"1.05rem",lineHeight:"1.7",maxWidth:"74ch",letterSpacing:"0.1px"},children:e}),Oo=e=>(e==null?void 0:e.head)??(e==null?void 0:e.title)??"",K1=e=>{var t;return Array.isArray(e==null?void 0:e.lines)?e.lines:Array.isArray((t=e==null?void 0:e.content)==null?void 0:t.lines)?e.content.lines:Array.isArray(e==null?void 0:e.content)?e.content:[]},Q1=({node:e})=>{var n;const t=e.headers??[],r=e.gridTemplateColumns??e.gridTempalateColumns??t.map(()=>"max-content").join(" ");return C.jsxs(ie,{gap:"6px",children:[Oo(e)&&C.jsx(po,{children:Oo(e)}),C.jsx(M,{sx:{display:"grid",gap:"1px",padding:"1px",boxSizing:"border-box",backgroundColor:"rgba(255,255,255,0.05)",borderRadius:"6px",overflow:"hidden",gridTemplateColumns:r},children:C.jsxs(M,{sx:{display:"contents","&>div":{padding:"10px",fontSize:"12px",boxSizing:"border-box"}},children:[t.map((o,i)=>C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.7)",sx:{backgroundColor:"rgba(7, 11, 22, 0.685)"},children:o},i)),(n=e.rows)==null?void 0:n.map((o,i)=>o.map((s,a)=>C.jsx(K,{variant:"medium",sx:{backgroundColor:"panelBackgroundPrimary"},children:s},`${i}-${a}`)))]})})]})},Y4=({node:e})=>{const t=Oo(e),r=typeof e.content=="string"?e.content:e.code??"";return C.jsxs(ie,{gap:"6px",children:[t&&C.jsx(po,{children:t}),C.jsx(xr,{code:r,wrap:!0})]})},Z4=({node:e})=>{const[t,r]=ee.useState(e.opened===!0);return C.jsxs(M,{sx:{backgroundColor:"rgba(0,0,0,0.18)",border:"1px solid rgba(255,255,255,0.07)",borderRadius:"8px",overflow:"hidden"},children:[C.jsxs(pe,{onClick:()=>r(!t),sx:{alignItems:"center",gap:"12px",padding:"18px 22px",cursor:"pointer",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"rgba(0,0,0,0.25)"}},children:[C.jsx(On,{open:t,color:"rgba(255,255,255,0.6)"}),C.jsx(K,{color:"rgba(255,255,255,0.96)",sx:{fontSize:"19px",fontWeight:600,lineHeight:"1.3",letterSpacing:"0.2px"},children:Oo(e)})]}),t&&C.jsx(M,{sx:{padding:"4px 22px 22px 22px"},children:C.jsx(zo,{lines:K1(e),depth:1})})]})},J4=({node:e,depth:t})=>{const r=Oo(e),n=K1(e);return t===0?r?C.jsx(Z4,{node:e}):C.jsx(zo,{lines:n,depth:1}):C.jsxs(ie,{gap:"10px",sx:{borderLeft:"2px solid rgba(255,255,255,0.12)",paddingLeft:"16px"},children:[r&&C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.92)",sx:{fontSize:"15.5px"},children:r}),C.jsx(zo,{lines:n,depth:t+1})]})},e5=({node:e})=>C.jsxs(C.Fragment,{children:[e.title&&C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.9)",sx:{fontSize:"13px",marginTop:"4px"},children:e.title}),e.code&&C.jsx(xr,{code:e.code,wrap:!0}),e.table&&C.jsx(Q1,{node:e.table}),e.spacer&&C.jsx(Ae,{size:e.spacer})]}),t5=({node:e,depth:t})=>{if(e==null)return null;if(typeof e=="string")return C.jsx(V1,{children:e});if(Array.isArray(e))return C.jsx(zo,{lines:e,depth:t});switch(e.type){case"block":return C.jsx(J4,{node:e,depth:t});case"code":return C.jsx(Y4,{node:e});case"table":return C.jsx(Q1,{node:e});default:return C.jsx(e5,{node:e})}},zo=({lines:e,depth:t=0})=>Array.isArray(e)?C.jsx(ie,{gap:t===0?"18px":"13px",children:e.map((r,n)=>C.jsx(t5,{node:r,depth:t},n))}):null,G1=({description:e})=>{if(e&&typeof e=="string"&&e.trim().startsWith("{"))try{const t=JSON.parse(e);return t&&Array.isArray(t.lines)?C.jsx(zo,{lines:t.lines}):null}catch{return C.jsx(K,{variant:"medium",children:e})}return C.jsx(K,{variant:"medium",children:e})},yl="rgba(255,255,255,0.15)",X1=22,vd=17,r5=({name:e})=>C.jsx(M,{sx:{flex:"0 1 auto",minWidth:0,backgroundColor:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:"5px",padding:"2px 7px"},children:C.jsx(K,{sx:{fontFamily:"monospace",fontSize:"12.5px",color:"rgba(255,255,255,0.92)",overflowWrap:"anywhere"},children:e})}),n5=({line:e})=>C.jsx(M,{sx:{flex:"0 0 auto",width:`${X1}px`,alignSelf:"stretch",position:"relative","&::before":e?{content:'""',position:"absolute",left:"10px",top:0,bottom:0,width:"1px",backgroundColor:yl}:{}}}),o5=({isLast:e})=>C.jsx(M,{sx:{flex:"0 0 auto",width:`${X1}px`,alignSelf:"stretch",position:"relative","&::before":{content:'""',position:"absolute",left:"10px",top:0,height:e?`${vd}px`:"100%",width:"1px",backgroundColor:yl},"&::after":{content:'""',position:"absolute",left:"10px",top:`${vd}px`,width:"9px",height:"1px",backgroundColor:yl}}}),i5=e=>{if(!e||!e.childs)return[];if(e.type==="array"){const t=e.childs[0];return t&&t.childs?Object.entries(t.childs):[]}return Object.entries(e.childs).filter(([t])=>t!=="0")},s5=({name:e,node:t,depth:r,isLast:n,ancestorsLast:o,parentPath:i})=>{const s=i5(t),a=s.length>0,[u,l]=ee.useState(!0);return C.jsxs(C.Fragment,{children:[C.jsxs(pe,{sx:{alignItems:"stretch",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[r>0&&o.map((f,v)=>C.jsx(n5,{line:!f},v)),r>0&&C.jsx(o5,{isLast:n}),C.jsxs(ie,{sx:{flex:"1 1 auto",minWidth:0,padding:"6px 0",gap:"3px"},children:[C.jsxs(pe,{sx:{alignItems:"center",gap:"8px",minWidth:0},children:[a?C.jsx(M,{onClick:()=>l(!u),sx:{flex:"0 0 auto",display:"flex",cursor:"pointer"},children:C.jsx(On,{open:u,size:"10",color:"rgba(255,255,255,0.55)"})}):C.jsx(M,{sx:{flex:"0 0 auto",width:"10px"}}),i&&C.jsxs(K,{color:"rgba(255,255,255,0.4)",sx:{fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:"0 3 auto",minWidth:"14px"},children:[i,"."]}),C.jsx(r5,{name:e}),C.jsx(K,{sx:{fontSize:"11px",fontFamily:"monospace"},bold:!0,color:X4[t.type],children:t.type}),t.optional&&C.jsx(K,{sx:{fontSize:"10px"},bold:!0,color:"rgba(106,134,255,0.85)",children:"optional"})]}),(t.details||t.regex)&&C.jsxs(ie,{sx:{gap:"5px",marginTop:"4px",padding:"8px 12px 8px 18px",backgroundColor:"rgba(0,0,0,0.2)",borderRadius:"5px"},children:[t.details&&C.jsx(K,{variant:"medium",color:"rgba(255,255,255,0.8)",sx:{fontSize:"13px",lineHeight:"1.55"},children:t.details}),t.regex&&C.jsxs(K,{variant:"small",color:"rgba(255,255,255,0.45)",sx:{fontFamily:"monospace",fontSize:"10px",wordBreak:"break-all"},children:["regex: ",t.regex]})]})]})]}),u&&a&&C.jsx(Y1,{entries:s,depth:r+1,ancestorsLast:r===0?[]:[...o,n],path:i?i+"."+e:e})]})},Y1=({entries:e,depth:t,ancestorsLast:r,path:n})=>C.jsx(C.Fragment,{children:e.map(([o,i],s)=>C.jsx(s5,{name:o,node:i,depth:t,isLast:s===e.length-1,ancestorsLast:r,parentPath:n},o))}),Z1=({schema:e})=>{const t=Object.entries(e??{}).filter(([r])=>r!=="0");return t.length===0?null:C.jsx(M,{sx:{border:"1px solid rgba(255,255,255,0.06)",borderRadius:"6px",padding:"0 14px"},children:C.jsx(Y1,{entries:t,depth:0,ancestorsLast:[],path:""})})},J1="#1a5bff",Cl=window.__host,la=!!Cl&&!/\{\{\w+\}\}/.test(Cl),md=window.__ver,El="documentation.auth",a5=()=>{try{const e=localStorage.getItem(El);if(!e)return null;const t=JSON.parse(e);return{host:t.host??"",login:t.login??"",password:""}}catch{return null}},l5=Ot.form`
|
|
324
|
+
`),xr=({code:e,wrap:t})=>{const[r,n]=ee.useState(!1),o=()=>{var i;try{(i=navigator.clipboard)==null||i.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return C.jsxs(M,{sx:{position:"relative"},children:[C.jsxs(M,{onClick:o,title:"Copy",sx:{position:"absolute",top:"8px",right:"8px",display:"flex",alignItems:"center",gap:"5px",padding:"5px 8px",borderRadius:"4px",cursor:"pointer",backgroundColor:"rgba(255,255,255,0.08)",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"rgba(255,255,255,0.16)"}},children:[C.jsx(M,{sx:{display:"flex",filter:"invert(1) brightness(2)"},children:C.jsx(E4,{size:"13"})}),C.jsx(K,{variant:"small",color:r?"#6aa76a":"rgba(255,255,255,0.6)",sx:{fontSize:"11px"},children:r?"Copied":"Copy"})]}),C.jsx(M,{sx:{fontFamily:"monospace",color:"#0ffa52",backgroundColor:"rgba(0,0,0,0.7)",padding:"14px 76px 14px 16px",borderRadius:"4px",fontSize:"12px",lineHeight:"1.5",whiteSpace:t?"pre-wrap":"pre",wordBreak:t?"break-all":void 0,overflowX:t?void 0:"auto"},children:e})]})},X4={string:"#6aa76a",number:"#4c9ec7",boolean:"orange",object:"#FFAACC",array:"#00EEAA",any:"#ffeb3b",file:"#ff5722",date:"#9c27b0",null:"#9e9e9e",undefined:"#9e9e9e"},V1=({children:e})=>C.jsx(K,{variant:"medium",color:"rgba(255,255,255,0.82)",sx:{display:"block",fontSize:"1.05rem",lineHeight:"1.7",maxWidth:"74ch",letterSpacing:"0.1px"},children:e}),Oo=e=>(e==null?void 0:e.head)??(e==null?void 0:e.title)??"",K1=e=>{var t;return Array.isArray(e==null?void 0:e.lines)?e.lines:Array.isArray((t=e==null?void 0:e.content)==null?void 0:t.lines)?e.content.lines:Array.isArray(e==null?void 0:e.content)?e.content:[]},Q1=({node:e})=>{var n;const t=e.headers??[],r=e.gridTemplateColumns??e.gridTempalateColumns??t.map(()=>"max-content").join(" ");return C.jsxs(ie,{gap:"6px",children:[Oo(e)&&C.jsx(po,{children:Oo(e)}),C.jsx(M,{sx:{display:"grid",gap:"1px",padding:"1px",boxSizing:"border-box",backgroundColor:"rgba(255,255,255,0.05)",borderRadius:"6px",overflow:"hidden",gridTemplateColumns:r},children:C.jsxs(M,{sx:{display:"contents","&>div":{padding:"10px",fontSize:"12px",boxSizing:"border-box"}},children:[t.map((o,i)=>C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.7)",sx:{backgroundColor:"rgba(7, 11, 22, 0.685)"},children:o},i)),(n=e.rows)==null?void 0:n.map((o,i)=>o.map((s,a)=>C.jsx(K,{variant:"medium",sx:{backgroundColor:"panelBackgroundPrimary"},children:s},`${i}-${a}`)))]})})]})},Y4=({node:e})=>{const t=Oo(e),r=typeof e.content=="string"?e.content:e.code??"";return C.jsxs(ie,{gap:"6px",children:[t&&C.jsx(po,{children:t}),C.jsx(xr,{code:r,wrap:!0})]})},Z4=({node:e})=>{const[t,r]=ee.useState(e.opened===!0);return C.jsxs(M,{sx:{backgroundColor:"rgba(0,0,0,0.18)",border:"1px solid rgba(255,255,255,0.07)",borderRadius:"8px",overflow:"hidden"},children:[C.jsxs(pe,{onClick:()=>r(!t),sx:{alignItems:"center",gap:"12px",padding:"18px 22px",cursor:"pointer",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"rgba(0,0,0,0.25)"}},children:[C.jsx(On,{open:t,color:"rgba(255,255,255,0.6)"}),C.jsx(K,{color:"rgba(255,255,255,0.96)",sx:{fontSize:"19px",fontWeight:600,lineHeight:"1.3",letterSpacing:"0.2px"},children:Oo(e)})]}),t&&C.jsx(M,{sx:{padding:"4px 22px 22px 22px"},children:C.jsx(zo,{lines:K1(e),depth:1})})]})},J4=({node:e,depth:t})=>{const r=Oo(e),n=K1(e);return t===0?r?C.jsx(Z4,{node:e}):C.jsx(zo,{lines:n,depth:1}):C.jsxs(ie,{gap:"10px",sx:{borderLeft:"2px solid rgba(255,255,255,0.12)",paddingLeft:"16px"},children:[r&&C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.92)",sx:{fontSize:"15.5px"},children:r}),C.jsx(zo,{lines:n,depth:t+1})]})},e5=({node:e})=>C.jsxs(C.Fragment,{children:[e.title&&C.jsx(K,{variant:"medium",bold:!0,color:"rgba(255,255,255,0.9)",sx:{fontSize:"13px",marginTop:"4px"},children:e.title}),e.code&&C.jsx(xr,{code:e.code,wrap:!0}),e.table&&C.jsx(Q1,{node:e.table}),e.spacer&&C.jsx(Ae,{size:e.spacer})]}),t5=({node:e,depth:t})=>{if(e==null)return null;if(typeof e=="string")return C.jsx(V1,{children:e});if(Array.isArray(e))return C.jsx(zo,{lines:e,depth:t});switch(e.type){case"block":return C.jsx(J4,{node:e,depth:t});case"code":return C.jsx(Y4,{node:e});case"table":return C.jsx(Q1,{node:e});default:return C.jsx(e5,{node:e})}},zo=({lines:e,depth:t=0})=>Array.isArray(e)?C.jsx(ie,{gap:t===0?"18px":"13px",children:e.map((r,n)=>C.jsx(t5,{node:r,depth:t},n))}):null,G1=({description:e})=>{if(e&&typeof e=="string"&&e.trim().startsWith("{"))try{const t=JSON.parse(e);return t&&Array.isArray(t.lines)?C.jsx(zo,{lines:t.lines}):null}catch{return C.jsx(K,{variant:"medium",children:e})}return C.jsx(K,{variant:"medium",children:e})},yl="rgba(255,255,255,0.15)",X1=22,vd=17,r5=({name:e})=>C.jsx(M,{sx:{flex:"0 1 auto",minWidth:0,backgroundColor:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:"5px",padding:"2px 7px"},children:C.jsx(K,{sx:{fontFamily:"monospace",fontSize:"12.5px",color:"rgba(255,255,255,0.92)",overflowWrap:"anywhere"},children:e})}),n5=({line:e})=>C.jsx(M,{sx:{flex:"0 0 auto",width:`${X1}px`,alignSelf:"stretch",position:"relative","&::before":e?{content:'""',position:"absolute",left:"10px",top:0,bottom:0,width:"1px",backgroundColor:yl}:{}}}),o5=({isLast:e})=>C.jsx(M,{sx:{flex:"0 0 auto",width:`${X1}px`,alignSelf:"stretch",position:"relative","&::before":{content:'""',position:"absolute",left:"10px",top:0,height:e?`${vd}px`:"100%",width:"1px",backgroundColor:yl},"&::after":{content:'""',position:"absolute",left:"10px",top:`${vd}px`,width:"9px",height:"1px",backgroundColor:yl}}}),i5=e=>{if(!e||!e.childs)return[];if(e.type==="array"){const t=e.childs[0];return t&&t.childs?Object.entries(t.childs):[]}return Object.entries(e.childs).filter(([t])=>t!=="0")},s5=({name:e,node:t,depth:r,isLast:n,ancestorsLast:o,parentPath:i})=>{const s=i5(t),a=s.length>0,[u,l]=ee.useState(!0);return C.jsxs(C.Fragment,{children:[C.jsxs(pe,{sx:{alignItems:"stretch",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[r>0&&o.map((f,v)=>C.jsx(n5,{line:!f},v)),r>0&&C.jsx(o5,{isLast:n}),C.jsxs(ie,{sx:{flex:"1 1 auto",minWidth:0,padding:"6px 0",gap:"3px"},children:[C.jsxs(pe,{sx:{alignItems:"center",gap:"8px",minWidth:0},children:[a?C.jsx(M,{onClick:()=>l(!u),sx:{flex:"0 0 auto",display:"flex",cursor:"pointer"},children:C.jsx(On,{open:u,size:"10",color:"rgba(255,255,255,0.55)"})}):C.jsx(M,{sx:{flex:"0 0 auto",width:"10px"}}),i&&C.jsxs(K,{color:"rgba(255,255,255,0.4)",sx:{fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:"0 3 auto",minWidth:"14px"},children:[i,"."]}),C.jsx(r5,{name:e}),C.jsx(K,{sx:{fontSize:"11px",fontFamily:"monospace"},bold:!0,color:X4[t.type],children:t.type}),t.optional&&C.jsx(K,{sx:{fontSize:"10px"},bold:!0,color:"rgba(106,134,255,0.85)",children:"optional"})]}),(typeof t.details=="string"&&t.details||typeof t.regex=="string"&&t.regex)&&C.jsxs(ie,{sx:{gap:"5px",marginTop:"4px",padding:"8px 12px 8px 18px",backgroundColor:"rgba(0,0,0,0.2)",borderRadius:"5px"},children:[typeof t.details=="string"&&t.details&&C.jsx(K,{variant:"medium",color:"rgba(255,255,255,0.8)",sx:{fontSize:"13px",lineHeight:"1.55"},children:t.details}),typeof t.regex=="string"&&t.regex&&C.jsxs(K,{variant:"small",color:"rgba(255,255,255,0.45)",sx:{fontFamily:"monospace",fontSize:"10px",wordBreak:"break-all"},children:["regex: ",t.regex]})]})]})]}),u&&a&&C.jsx(Y1,{entries:s,depth:r+1,ancestorsLast:r===0?[]:[...o,n],path:i?i+"."+e:e})]})},Y1=({entries:e,depth:t,ancestorsLast:r,path:n})=>C.jsx(C.Fragment,{children:e.map(([o,i],s)=>C.jsx(s5,{name:o,node:i,depth:t,isLast:s===e.length-1,ancestorsLast:r,parentPath:n},o))}),Z1=({schema:e})=>{const t=Object.entries(e??{}).filter(([r])=>r!=="0");return t.length===0?null:C.jsx(M,{sx:{border:"1px solid rgba(255,255,255,0.06)",borderRadius:"6px",padding:"0 14px"},children:C.jsx(Y1,{entries:t,depth:0,ancestorsLast:[],path:""})})},J1="#1a5bff",Cl=window.__host,la=!!Cl&&!/\{\{\w+\}\}/.test(Cl),md=window.__ver,El="documentation.auth",a5=()=>{try{const e=localStorage.getItem(El);if(!e)return null;const t=JSON.parse(e);return{host:t.host??"",login:t.login??"",password:""}}catch{return null}},l5=Ot.form`
|
|
325
325
|
display: flex;
|
|
326
326
|
flex-direction: column;
|
|
327
327
|
gap: 16px;
|