@hangox/mg-cli 1.1.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +124 -30
- package/dist/cli.js.map +1 -1
- package/dist/daemon-runner.js.map +1 -1
- package/dist/{index-DorC5U6y.d.ts → index-AVsoGQ0e.d.ts} +105 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -69,6 +69,7 @@ declare enum MessageType {
|
|
|
69
69
|
EXPORT_IMAGE = "export_image",
|
|
70
70
|
EXECUTE_CODE = "execute_code",
|
|
71
71
|
GET_ALL_PAGES = "get_all_pages",
|
|
72
|
+
GET_COMMENTS = "get_comments",
|
|
72
73
|
LIST_EXTENSIONS = "list_extensions",
|
|
73
74
|
OPEN_PAGE = "open_page",
|
|
74
75
|
NAVIGATE_TO_NODE = "navigate_to_node",
|
|
@@ -473,6 +474,109 @@ interface ExportImageParams {
|
|
|
473
474
|
/** 是否包含特效和外描边 */
|
|
474
475
|
useRenderBounds?: boolean;
|
|
475
476
|
}
|
|
477
|
+
/** 评论位置 */
|
|
478
|
+
interface CommentLocation {
|
|
479
|
+
/** 页面 ID */
|
|
480
|
+
pageId?: string;
|
|
481
|
+
/** 图层 ID */
|
|
482
|
+
layerId?: string;
|
|
483
|
+
/** 绝对坐标 X */
|
|
484
|
+
x?: number;
|
|
485
|
+
/** 绝对坐标 Y */
|
|
486
|
+
y?: number;
|
|
487
|
+
/** 相对坐标 X */
|
|
488
|
+
relativeX?: number;
|
|
489
|
+
/** 相对坐标 Y */
|
|
490
|
+
relativeY?: number;
|
|
491
|
+
}
|
|
492
|
+
/** 评论用户信息 */
|
|
493
|
+
interface CommentUserInfo {
|
|
494
|
+
/** 用户 ID */
|
|
495
|
+
id: number;
|
|
496
|
+
/** 用户名 */
|
|
497
|
+
name: string;
|
|
498
|
+
/** 头像 URL */
|
|
499
|
+
avatar?: string;
|
|
500
|
+
/** 团队内昵称 */
|
|
501
|
+
nicknameInTeam?: string;
|
|
502
|
+
}
|
|
503
|
+
/** 评论附近节点信息 */
|
|
504
|
+
interface CommentNearbyNode {
|
|
505
|
+
/** 节点 ID */
|
|
506
|
+
id: string;
|
|
507
|
+
/** 节点名称 */
|
|
508
|
+
name: string;
|
|
509
|
+
/** 节点类型 */
|
|
510
|
+
type: string;
|
|
511
|
+
/** 距离(像素) */
|
|
512
|
+
distance: number;
|
|
513
|
+
/** 节点边界 */
|
|
514
|
+
bounds: {
|
|
515
|
+
x: number;
|
|
516
|
+
y: number;
|
|
517
|
+
width: number;
|
|
518
|
+
height: number;
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
/** 单条评论信息 */
|
|
522
|
+
interface CommentInfo {
|
|
523
|
+
/** 评论 ID */
|
|
524
|
+
id: string;
|
|
525
|
+
/** 评论序号 */
|
|
526
|
+
serial: number;
|
|
527
|
+
/** 评论类型(原始类型值) */
|
|
528
|
+
type: number;
|
|
529
|
+
/** 用户 ID */
|
|
530
|
+
userId: number;
|
|
531
|
+
/** 用户显示名(优先昵称,其次用户名) */
|
|
532
|
+
userName: string;
|
|
533
|
+
/** 评论内容 */
|
|
534
|
+
content: string;
|
|
535
|
+
/** 评论状态 */
|
|
536
|
+
status: number;
|
|
537
|
+
/** 是否删除 */
|
|
538
|
+
isDelete: number;
|
|
539
|
+
/** 是否已读 */
|
|
540
|
+
isRead: number;
|
|
541
|
+
/** 创建时间(ISO) */
|
|
542
|
+
createdAt: string;
|
|
543
|
+
/** 更新时间(ISO) */
|
|
544
|
+
updatedAt: string;
|
|
545
|
+
/** 评论位置 */
|
|
546
|
+
location?: CommentLocation;
|
|
547
|
+
/** 评论直链(可为空) */
|
|
548
|
+
link?: string;
|
|
549
|
+
/** 附近节点列表(可为空) */
|
|
550
|
+
nearbyNodes?: CommentNearbyNode[];
|
|
551
|
+
/** 附近节点总结(可为空) */
|
|
552
|
+
nearbySummary?: string;
|
|
553
|
+
}
|
|
554
|
+
/** 获取评论参数 */
|
|
555
|
+
interface GetCommentsParams {
|
|
556
|
+
/** 是否包含已删除的评论,默认 false */
|
|
557
|
+
includeDeleted?: boolean;
|
|
558
|
+
/** 是否计算附近节点,默认 true */
|
|
559
|
+
includeNearby?: boolean;
|
|
560
|
+
/** 附近节点数量,默认 5 */
|
|
561
|
+
nearbyLimit?: number;
|
|
562
|
+
/** 附近节点搜索深度,默认 3 */
|
|
563
|
+
nearbyDepth?: number;
|
|
564
|
+
/** 索引签名 */
|
|
565
|
+
[key: string]: unknown;
|
|
566
|
+
}
|
|
567
|
+
/** 获取评论结果 */
|
|
568
|
+
interface GetCommentsResult {
|
|
569
|
+
/** 文档 ID */
|
|
570
|
+
documentId: string;
|
|
571
|
+
/** 页面 ID(可能为空) */
|
|
572
|
+
pageId?: string;
|
|
573
|
+
/** 页面 URL */
|
|
574
|
+
pageUrl: string;
|
|
575
|
+
/** 评论列表 */
|
|
576
|
+
comments: CommentInfo[];
|
|
577
|
+
/** 评论总数 */
|
|
578
|
+
total: number;
|
|
579
|
+
}
|
|
476
580
|
/** CLI 输出格式化函数类型 */
|
|
477
581
|
type OutputFormatter = (data: Record<string, unknown>) => void;
|
|
478
582
|
/** CLI 命令选项 */
|
|
@@ -886,4 +990,4 @@ declare class RequestHandler {
|
|
|
886
990
|
cleanupAll(): void;
|
|
887
991
|
}
|
|
888
992
|
|
|
889
|
-
export { type
|
|
993
|
+
export { type MgPageInfo as $, type PongMessage as A, type BaseMessage as B, CONFIG_DIR as C, DEV_DEFAULT_PORT as D, ErrorCode as E, type ConnectionInfo as F, type GetNodeParams as G, HEARTBEAT_INTERVAL as H, IS_DEV_MODE as I, type GetPageParams as J, type GetAllNodesParams as K, LOG_DIR as L, MessageType as M, type NodeInfo as N, type ExportImageParams as O, PROD_DEFAULT_PORT as P, type CommentLocation as Q, REQUEST_TIMEOUT as R, type ServerInfo as S, type CommentUserInfo as T, type CommentNearbyNode as U, type CommentInfo as V, type GetCommentsParams as W, type GetCommentsResult as X, type OutputFormatter as Y, type CliOptions as Z, type RGBA as _, type SpaceNodeInfo as a, type AllPagesInfo as a0, type ExtensionInfo as a1, type OpenPageParams as a2, type NavigateToNodeParams as a3, type ConnectedPageInfo as a4, type ServerStatusResponse as a5, MGServer as a6, createServer as a7, type ServerOptions as a8, ConnectionManager as a9, type ManagedWebSocket as aa, RequestHandler as ab, Logger as ac, createLogger as ad, LogLevel as ae, type LoggerOptions as af, PROD_PORT_RANGE_START as b, PROD_PORT_RANGE_END as c, DEV_PORT_RANGE_START as d, DEV_PORT_RANGE_END as e, DEFAULT_PORT as f, PORT_RANGE_START as g, PORT_RANGE_END as h, MAX_PORT_ATTEMPTS as i, PORT_SCAN_TIMEOUT as j, SERVER_INFO_FILE as k, SERVER_LOG_FILE as l, HEARTBEAT_TIMEOUT as m, SERVER_START_TIMEOUT as n, RETRY_INTERVALS as o, MAX_RETRY_COUNT as p, ConnectionType as q, ErrorNames as r, ErrorMessages as s, MGError as t, createError as u, type RequestMessage as v, type ResponseMessage as w, type ErrorInfo as x, type RegisterMessage as y, type PingMessage as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ServerInfo, N as NodeInfo, a as SpaceNodeInfo, M as MessageType } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { S as ServerInfo, N as NodeInfo, a as SpaceNodeInfo, M as MessageType } from './index-AVsoGQ0e.js';
|
|
2
|
+
export { a0 as AllPagesInfo, B as BaseMessage, C as CONFIG_DIR, Z as CliOptions, V as CommentInfo, Q as CommentLocation, U as CommentNearbyNode, T as CommentUserInfo, a4 as ConnectedPageInfo, F as ConnectionInfo, a9 as ConnectionManager, q as ConnectionType, f as DEFAULT_PORT, D as DEV_DEFAULT_PORT, e as DEV_PORT_RANGE_END, d as DEV_PORT_RANGE_START, E as ErrorCode, x as ErrorInfo, s as ErrorMessages, r as ErrorNames, O as ExportImageParams, a1 as ExtensionInfo, K as GetAllNodesParams, W as GetCommentsParams, X as GetCommentsResult, G as GetNodeParams, J as GetPageParams, H as HEARTBEAT_INTERVAL, m as HEARTBEAT_TIMEOUT, I as IS_DEV_MODE, L as LOG_DIR, ae as LogLevel, ac as Logger, af as LoggerOptions, i as MAX_PORT_ATTEMPTS, p as MAX_RETRY_COUNT, t as MGError, a6 as MGServer, aa as ManagedWebSocket, $ as MgPageInfo, a3 as NavigateToNodeParams, a2 as OpenPageParams, Y as OutputFormatter, h as PORT_RANGE_END, g as PORT_RANGE_START, j as PORT_SCAN_TIMEOUT, P as PROD_DEFAULT_PORT, c as PROD_PORT_RANGE_END, b as PROD_PORT_RANGE_START, z as PingMessage, A as PongMessage, R as REQUEST_TIMEOUT, o as RETRY_INTERVALS, _ as RGBA, y as RegisterMessage, ab as RequestHandler, v as RequestMessage, w as ResponseMessage, k as SERVER_INFO_FILE, l as SERVER_LOG_FILE, n as SERVER_START_TIMEOUT, a8 as ServerOptions, a5 as ServerStatusResponse, u as createError, ad as createLogger, a7 as createServer } from './index-AVsoGQ0e.js';
|
|
3
3
|
import 'ws';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
|
41
41
|
MessageType2["EXPORT_IMAGE"] = "export_image";
|
|
42
42
|
MessageType2["EXECUTE_CODE"] = "execute_code";
|
|
43
43
|
MessageType2["GET_ALL_PAGES"] = "get_all_pages";
|
|
44
|
+
MessageType2["GET_COMMENTS"] = "get_comments";
|
|
44
45
|
MessageType2["LIST_EXTENSIONS"] = "list_extensions";
|
|
45
46
|
MessageType2["OPEN_PAGE"] = "open_page";
|
|
46
47
|
MessageType2["NAVIGATE_TO_NODE"] = "navigate_to_node";
|
|
@@ -211,6 +212,9 @@ function killProcess(pid) {
|
|
|
211
212
|
}
|
|
212
213
|
function normalizePageUrl(url) {
|
|
213
214
|
try {
|
|
215
|
+
if (!url.includes("://") && !url.startsWith("//")) {
|
|
216
|
+
return url.split("?")[0].split("#")[0];
|
|
217
|
+
}
|
|
214
218
|
const urlObj = new URL(url);
|
|
215
219
|
return urlObj.host + urlObj.pathname;
|
|
216
220
|
} catch {
|