@pisell/core 1.0.47 → 1.0.49

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.
Files changed (69) hide show
  1. package/es/app/app.d.ts +99 -0
  2. package/es/app/index.d.ts +1 -1
  3. package/es/applicationManager/application.d.ts +197 -0
  4. package/es/applicationManager/index.d.ts +19 -0
  5. package/es/cmd/const.d.ts +5 -5
  6. package/es/hooks/useStore/index.d.ts +1 -1
  7. package/es/index.d.ts +7 -0
  8. package/es/locales/type.d.ts +3 -3
  9. package/es/logger/index.d.ts +135 -0
  10. package/es/logger/index.js +49 -31
  11. package/es/menuManager/index.d.ts +28 -0
  12. package/es/models/index.d.ts +4 -4
  13. package/es/pubsub/index.d.ts +1 -1
  14. package/es/request/cache.d.ts +1 -1
  15. package/es/request/cache.js +12 -8
  16. package/es/request/config.d.ts +3 -0
  17. package/es/request/index.d.ts +24 -0
  18. package/es/request/index.js +4 -3
  19. package/es/request/pisell2Request.d.ts +1 -1
  20. package/es/request/type.d.ts +57 -0
  21. package/es/routes/index.d.ts +2 -2
  22. package/es/socket/types.d.ts +1 -1
  23. package/es/tasks/index.d.ts +127 -0
  24. package/es/tasks/type.d.ts +4 -4
  25. package/es/utils/adaptiveThrottle/index.d.ts +36 -0
  26. package/es/variables/index.d.ts +3 -3
  27. package/lib/app/app.d.ts +99 -0
  28. package/lib/app/index.d.ts +1 -1
  29. package/lib/applicationManager/application.d.ts +197 -0
  30. package/lib/applicationManager/index.d.ts +19 -0
  31. package/lib/aws/index.js +0 -3
  32. package/lib/cmd/const.d.ts +5 -5
  33. package/lib/cmd/const.js +5 -5
  34. package/lib/cmd/index.js +0 -2
  35. package/lib/cookie/index.js +4 -2
  36. package/lib/data/index.js +0 -3
  37. package/lib/hooks/useStore/index.d.ts +1 -1
  38. package/lib/index.d.ts +7 -0
  39. package/lib/locales/index.js +94 -95
  40. package/lib/locales/type.d.ts +3 -3
  41. package/lib/logger/index.d.ts +135 -0
  42. package/lib/logger/index.js +21 -17
  43. package/lib/menuManager/index.d.ts +28 -0
  44. package/lib/models/index.d.ts +4 -4
  45. package/lib/pubsub/index.d.ts +1 -1
  46. package/lib/pubsub/index.js +3 -1
  47. package/lib/request/cache.d.ts +1 -1
  48. package/lib/request/cache.js +2 -1
  49. package/lib/request/config.d.ts +3 -0
  50. package/lib/request/index.d.ts +24 -0
  51. package/lib/request/index.js +4 -3
  52. package/lib/request/pisell2Request.d.ts +1 -1
  53. package/lib/request/type.d.ts +57 -0
  54. package/lib/routes/index.d.ts +2 -2
  55. package/lib/routes/index.js +1 -3
  56. package/lib/socket/components/SocketMonitorPage.js +12 -6
  57. package/lib/socket/heartbeat.js +5 -10
  58. package/lib/socket/index.js +3 -1
  59. package/lib/socket/monitor.js +24 -26
  60. package/lib/socket/reconnect.js +3 -10
  61. package/lib/socket/socket.js +10 -12
  62. package/lib/socket/types.d.ts +1 -1
  63. package/lib/storage/index.js +24 -25
  64. package/lib/tasks/index.d.ts +127 -0
  65. package/lib/tasks/index.js +329 -333
  66. package/lib/tasks/type.d.ts +4 -4
  67. package/lib/utils/adaptiveThrottle/index.d.ts +36 -0
  68. package/lib/variables/index.d.ts +3 -3
  69. package/package.json +1 -1
@@ -0,0 +1,99 @@
1
+ import { RouterManager } from '../routes';
2
+ import { ApplicationManager } from '../applicationManager';
3
+ import { History, HistoryOptions } from '../history';
4
+ import { Data } from '../data';
5
+ import { Locales, LocalesOptions } from '../locales';
6
+ import { Storage, StorageOptions } from '../storage';
7
+ import { MenuManager } from '../menuManager';
8
+ import LoggerManager, { LoggerOptions } from '../logger';
9
+ import { TasksManager } from '../tasks';
10
+ import IndexDBManager, { DBOptions } from '../indexDB';
11
+ import CMD, { CMDOptions } from "../cmd";
12
+ import AWS, { AWSOptions } from "../aws";
13
+ declare global {
14
+ interface Window {
15
+ app: App;
16
+ }
17
+ }
18
+ export interface Bootstrap {
19
+ hooks: {
20
+ [key: string]: () => Promise<void>;
21
+ };
22
+ }
23
+ export interface AppOptions {
24
+ logger?: LoggerOptions;
25
+ db?: DBOptions;
26
+ constants?: any;
27
+ history?: HistoryOptions;
28
+ storage?: StorageOptions;
29
+ locales?: LocalesOptions;
30
+ cmd?: CMDOptions;
31
+ aws?: AWSOptions;
32
+ getPisellos?: () => any;
33
+ }
34
+ declare class App {
35
+ private static instance;
36
+ private plugins;
37
+ globalData: any;
38
+ router: RouterManager;
39
+ applicationManager: ApplicationManager;
40
+ history: History;
41
+ data: Data;
42
+ hooks: import("../hooks").HooksExport;
43
+ locales: Locales;
44
+ models: {
45
+ getStore: () => import("../models").Store;
46
+ StoreProvider: typeof import("react-redux").Provider;
47
+ setConfig: (models: any[]) => void;
48
+ };
49
+ request: {
50
+ get: (url: string, data: any, config: import("@").RequestSetting | undefined) => Promise<any>;
51
+ post: (url: string, data: any, config: import("@").RequestSetting | undefined) => Promise<any>;
52
+ put: (url: string, data: any, config: import("@").RequestSetting | undefined) => Promise<any>;
53
+ remove: (url: string, data: any, config: import("@").RequestSetting | undefined) => Promise<any>;
54
+ custom: (url: string, config: import("@").RequestSetting | undefined) => any;
55
+ setConfig: (newConfig: Partial<import("@").RequestConfig>) => void;
56
+ getConfig: () => import("@").RequestConfig;
57
+ };
58
+ storage: Storage;
59
+ menuManager: MenuManager;
60
+ cookie: {
61
+ setCookie: (name: string, value: string, domain?: string | undefined) => void;
62
+ getCookie: (name: string) => string | null;
63
+ deleteCookie: (name: string, domain?: string | undefined) => void;
64
+ checkCookie: (name: string) => boolean;
65
+ updateCookie: (name: string, value: string, domain?: string | undefined) => void;
66
+ };
67
+ website: {
68
+ setTitle: (title: string) => void;
69
+ setIcon: (paramsIcon: string) => void;
70
+ setAppleWebAppTitle: (title: string) => void;
71
+ };
72
+ logger: LoggerManager;
73
+ pubsub: import("../pubsub").PubSub;
74
+ cmd: CMD;
75
+ aws: AWS;
76
+ tasksManager: TasksManager;
77
+ getPisellos: any;
78
+ bootstrap?: Bootstrap;
79
+ dbManager: IndexDBManager | null;
80
+ constants: {
81
+ channel: string;
82
+ [key: string]: string;
83
+ };
84
+ private constructor();
85
+ static getInstance(options?: AppOptions): App;
86
+ setGlobalData(globalData: any): void;
87
+ usePlugin(name: string, plugin: any): void;
88
+ usePlugins(plugins: {
89
+ name: string;
90
+ plugin: any;
91
+ }[]): void;
92
+ getPlugin(name: string): any;
93
+ getGlobalData(): any;
94
+ install(): void;
95
+ unInstall(): void;
96
+ setBootstrap(bootstrap: Bootstrap): void;
97
+ getBootstrap(): Bootstrap | undefined;
98
+ }
99
+ export default App;
package/es/app/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import App, { AppOptions } from "./app";
3
- declare type AppContextType = {
3
+ type AppContextType = {
4
4
  globalData: any;
5
5
  setGlobalData: React.Dispatch<React.SetStateAction<any>>;
6
6
  app: App;
@@ -0,0 +1,197 @@
1
+ import App from '../app';
2
+ import { LoadLibraryByUrlParams } from '../locales/type';
3
+ import { MenuItem } from '../menuManager/index';
4
+ /**
5
+ * 应用接口类型定义
6
+ * @description 描述应用中单个页面、组件或功能的接口结构
7
+ */
8
+ export type ApplicationInterface = {
9
+ page_type: 'low_code' | 'code';
10
+ page_id: number | string;
11
+ page_code: string;
12
+ page_version?: string;
13
+ page_name: string;
14
+ router: string;
15
+ category: 'page' | 'component' | 'function';
16
+ Component?: any;
17
+ children?: any;
18
+ layout?: string;
19
+ originalUrl?: string;
20
+ routeConfig?: {
21
+ cache?: boolean;
22
+ preload?: boolean;
23
+ prerender?: boolean;
24
+ priority?: 'high' | 'normal' | 'low';
25
+ };
26
+ autoRender?: boolean;
27
+ };
28
+ /**
29
+ * 应用数据类型定义
30
+ * @description 描述完整应用的数据结构,包含应用的基本信息、接口、功能等
31
+ */
32
+ export type ApplicationData = {
33
+ /** 应用唯一标识 */
34
+ app_id: number;
35
+ /** 应用名称 */
36
+ app_name: string;
37
+ /** 应用类型:系统应用或自定义应用 */
38
+ app_type: 'system' | 'custom';
39
+ /** 应用包含的接口列表 */
40
+ interfaces: ApplicationInterface[];
41
+ /** 应用包含的功能列表,可选 */
42
+ functions?: any[];
43
+ /** 应用的菜单配置 */
44
+ menu?: {
45
+ [key: string]: MenuItem[];
46
+ };
47
+ /** 多语言配置,可选 */
48
+ locales?: LoadLibraryByUrlParams;
49
+ /** 其他扩展属性 */
50
+ [key: string]: any;
51
+ };
52
+ /**
53
+ * 应用管理类
54
+ * @description 负责管理单个应用的生命周期,包括接口、组件、功能的初始化和管理
55
+ * @class Application
56
+ * @author zhiwei.Wang
57
+ */
58
+ export declare class Application {
59
+ /** 应用配置数据 */
60
+ options: ApplicationData;
61
+ /** 应用名称 */
62
+ name: ApplicationData['app_name'];
63
+ /** 应用内的页面接口映射表,以页面名称为键 */
64
+ interfaces: Map<ApplicationInterface['page_name'], ApplicationInterface>;
65
+ /** 应用内的组件映射表,以组件编码为键 */
66
+ components: Map<string, any>;
67
+ /** 应用内的功能函数映射表,比如跳转登录页面的方法等 */
68
+ functions: Map<string, any>;
69
+ /** 应用实例引用 */
70
+ app: App;
71
+ /**
72
+ * 构造函数
73
+ * @description 初始化应用实例,设置基本属性并初始化接口和功能
74
+ * @param {ApplicationData} options - 应用配置数据
75
+ * @param {App} app - 应用实例引用
76
+ */
77
+ constructor(options: ApplicationData, app: App);
78
+ /**
79
+ * 应用添加后的内部处理方法
80
+ * @description 在应用被添加到应用管理器后执行的内部逻辑,包括加载多语言配置和执行用户自定义的afterAdd方法
81
+ * @param {Application} application - 被添加的应用实例
82
+ * @returns {Promise<void>}
83
+ * @private
84
+ */
85
+ _afterAdd(application: Application): Promise<void>;
86
+ /**
87
+ * 应用加载前的内部处理方法
88
+ * @description 在应用开始加载前执行的内部逻辑,调用用户自定义的beforeLoad方法
89
+ * @returns {Promise<void>}
90
+ * @private
91
+ */
92
+ _beforeLoad(): Promise<void>;
93
+ /**
94
+ * 应用加载的内部处理方法
95
+ * @description 执行应用的实际加载逻辑,将应用中的所有接口注册为路由
96
+ * @returns {Promise<void>}
97
+ * @private
98
+ */
99
+ _load(): Promise<void>;
100
+ /**
101
+ * 初始化应用接口
102
+ * @description 遍历应用配置中的接口列表,根据类别将它们分别设置到对应的映射表中
103
+ * @param {ApplicationData['interfaces']} interfaces - 接口配置数组
104
+ * @returns {void}
105
+ */
106
+ initInterfaces(interfaces: ApplicationData['interfaces']): void;
107
+ /**
108
+ * 初始化应用功能函数
109
+ * @description 遍历应用配置中的功能列表,将它们设置到功能映射表中
110
+ * @param {ApplicationData['functions']} functions - 功能配置数组,可选
111
+ * @returns {void}
112
+ */
113
+ initFunctions(functions: ApplicationData['functions']): void;
114
+ /**
115
+ * 加载接口组件
116
+ * @description 根据接口类型加载对应的组件,支持低代码和普通代码两种类型
117
+ * @param {ApplicationInterface} interfaceItem - 接口配置项
118
+ * @returns {Promise<ApplicationInterface>} 加载后的接口配置
119
+ */
120
+ loadInterface(interfaceItem: ApplicationInterface): Promise<ApplicationInterface>;
121
+ /**
122
+ * 设置页面
123
+ * @description 将页面接口添加到接口映射表中
124
+ * @param {string} code - 页面编码
125
+ * @param {ApplicationInterface} interfaceItem - 接口配置项
126
+ * @returns {void}
127
+ */
128
+ setInterface(code: string, interfaceItem: ApplicationInterface): void;
129
+ /**
130
+ * 设置组件
131
+ * @description 将组件添加到组件映射表中
132
+ * @param {string} code - 组件编码
133
+ * @param {ApplicationInterface} component - 组件配置项
134
+ * @returns {void}
135
+ */
136
+ setComponent(code: string, component: ApplicationInterface): void;
137
+ /**
138
+ * 设置功能函数
139
+ * @description 将功能函数添加到功能映射表中
140
+ * @param {string} code - 功能编码
141
+ * @param {ApplicationInterface} functionItem - 功能配置项
142
+ * @returns {void}
143
+ */
144
+ setFunction(code: string, functionItem: ApplicationInterface): void;
145
+ /**
146
+ * 获取页面
147
+ * @description 根据编码从接口映射表中获取页面接口
148
+ * @param {string} code - 页面编码
149
+ * @returns {ApplicationInterface | undefined} 接口配置项或undefined
150
+ */
151
+ getInterface(code: string): ApplicationInterface | undefined;
152
+ /**
153
+ * 获取组件
154
+ * @description 根据编码从组件映射表中获取组件
155
+ * @param {string} code - 组件编码
156
+ * @returns {any | undefined} 组件或undefined
157
+ */
158
+ getComponent(code: string): any;
159
+ /**
160
+ * 获取功能函数
161
+ * @description 根据编码从功能映射表中获取功能函数
162
+ * @param {string} code - 功能编码
163
+ * @returns {any | undefined} 功能函数或undefined
164
+ */
165
+ getFunction(code: string): any;
166
+ /**
167
+ * 执行功能函数
168
+ * @description 根据编码执行对应的功能函数,自动注入应用实例并合并参数
169
+ * @param {string} code - 功能编码
170
+ * @param {any} params - 传递给功能函数的参数对象,可选
171
+ * @param {...any} args - 传递给功能函数的其他参数
172
+ * @returns {any} 功能函数的执行结果
173
+ */
174
+ runFunction(code: string, params?: any, ...args: any): any;
175
+ /**
176
+ * 应用添加后触发的钩子函数
177
+ * @description 在应用被添加到应用管理器后触发,可被子类覆盖以实现自定义逻辑
178
+ * @param {Application} application - 被添加的应用实例
179
+ * @returns {Promise<void>}
180
+ * @author zhiwei.Wang
181
+ */
182
+ afterAdd(application: Application): Promise<void>;
183
+ /**
184
+ * 应用加载前触发的钩子函数
185
+ * @description 在应用开始加载前触发,可被子类覆盖以实现自定义预处理逻辑
186
+ * @returns {Promise<void>}
187
+ * @author zhiwei.Wang
188
+ */
189
+ beforeLoad(application: Application): Promise<void>;
190
+ /**
191
+ * 应用加载完成后触发的钩子函数
192
+ * @description 在应用完成加载后触发,可被子类覆盖以实现自定义后处理逻辑
193
+ * @returns {Promise<void>}
194
+ * @author zhiwei.Wang
195
+ */
196
+ load(application: Application): Promise<void>;
197
+ }
@@ -0,0 +1,19 @@
1
+ import APP from '../app';
2
+ import { Application, ApplicationData } from './application';
3
+ export * from "./application";
4
+ export declare class ApplicationManager {
5
+ applicationList: Application[];
6
+ protected app: APP;
7
+ applications: Map<string, Application>;
8
+ constructor(applicationList: Application[], app: APP);
9
+ init(applicationList: Application[] | ApplicationData[]): Promise<unknown>;
10
+ add(application: Application): Promise<void>;
11
+ get(appName: Application['name']): Application | undefined;
12
+ remove(appName: Application['name']): void;
13
+ load(): Promise<void>;
14
+ /**
15
+ * 循环所有的应用, 找出所有的components进行渲染
16
+ * @returns
17
+ */
18
+ getAllComponents(): any[];
19
+ }
package/es/cmd/const.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export declare enum CMDCoreEnum {
2
- CMD_CONNECT,
3
- CMD_DISCONNECT,
4
- CMD_RECONNECT,
5
- CMD_MESSAGE,
6
- CMD_ERROR
2
+ CMD_CONNECT = "cmd.connect",
3
+ CMD_DISCONNECT = "cmd.disconnect",
4
+ CMD_RECONNECT = "cmd.reconnect",
5
+ CMD_MESSAGE = "cmd.message",
6
+ CMD_ERROR = "cmd.error"
7
7
  }
8
8
  declare const _default: {
9
9
  CMDCoreEnum: typeof CMDCoreEnum;
@@ -1,6 +1,6 @@
1
1
  import { ModelsState } from "../../models";
2
2
  declare const useStore: <T extends "global", D extends keyof ModelsState[T]>(props: {
3
3
  models: T;
4
- key?: D | undefined;
4
+ key?: D;
5
5
  }) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
6
6
  export default useStore;
package/es/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export { default as request } from './request';
2
+ export { default as hooks } from './hooks';
3
+ export { default as models } from './models';
4
+ export { default as pubsub } from './pubsub';
5
+ export { default as socket } from './socket';
6
+ export * from './applicationManager';
7
+ export * from './app';
@@ -1,5 +1,5 @@
1
- export declare type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
2
- export declare type MultiLanguage = {
1
+ export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
2
+ export type MultiLanguage = {
3
3
  [key in Locale]: string;
4
4
  };
5
5
  export interface LibraryItem {
@@ -16,4 +16,4 @@ export interface LocaleConfig {
16
16
  [key in Locale]: LibraryItem;
17
17
  };
18
18
  }
19
- export declare type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
19
+ export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
@@ -0,0 +1,135 @@
1
+ import App from "../app";
2
+ export type LogConsoleType = "info" | "warning" | "error" | "debug";
3
+ /**
4
+ * 日志项接口
5
+ */
6
+ interface LogItem {
7
+ logId?: string | number;
8
+ type: LogConsoleType;
9
+ title: string;
10
+ date?: string;
11
+ metadata?: any;
12
+ feishu?: any;
13
+ }
14
+ interface LogFile {
15
+ fileName: string;
16
+ date: string;
17
+ fileContent: LogFileContent;
18
+ }
19
+ interface LogFileContent {
20
+ metadata: any;
21
+ logs: LogItem[];
22
+ }
23
+ export interface LoggerOptions {
24
+ prefix?: string;
25
+ checkInterval?: number;
26
+ feishuConfig?: any;
27
+ retentionDays?: number;
28
+ }
29
+ /**
30
+ * 日志管理器类
31
+ */
32
+ declare class LoggerManager {
33
+ private logBuffer;
34
+ private timer;
35
+ private checkInterval;
36
+ private prefix;
37
+ private metadata;
38
+ private db;
39
+ private app;
40
+ private feishuConfig;
41
+ private retentionDays;
42
+ private metadataFunction;
43
+ private status;
44
+ /**
45
+ * 构造函数
46
+ * @param prefix 日志前缀
47
+ * @param checkInterval 检查间隔时间,默认5分钟
48
+ */
49
+ constructor(app: App, options?: LoggerOptions);
50
+ init(): Promise<void>;
51
+ /**
52
+ * 初始化 IndexDB
53
+ */
54
+ private initDB;
55
+ /**
56
+ * 设置元数据
57
+ * @param metadata 元数据
58
+ */
59
+ setMetadata(metadata: any): void;
60
+ setMetadataFunction(metadataFunction: () => any): void;
61
+ /**
62
+ * 初始化定时器
63
+ */
64
+ initTimer(): void;
65
+ private setStatus;
66
+ stop(): void;
67
+ /**
68
+ * 添加日志
69
+ * @param log 日志项
70
+ */
71
+ addLog(log: LogItem): void;
72
+ /**
73
+ * 发送飞书通知
74
+ * @param log 日志项
75
+ */
76
+ private sendFeishuNotification;
77
+ /**
78
+ * 创建日志文件名
79
+ * @returns 日志文件名
80
+ */
81
+ private createFileName;
82
+ /**
83
+ * 创建AWS日志文件名
84
+ * @param isManual 紧急上传
85
+ * @returns 日志文件名
86
+ */
87
+ createAWSFileName(urgent?: boolean): Promise<any>;
88
+ /**
89
+ * 创建日志文件
90
+ * @param _fileName 文件名
91
+ * @returns 日志文件对象
92
+ */
93
+ private createFile;
94
+ /**
95
+ * 存储日志到持久化存储
96
+ */
97
+ storeLog(urgent?: boolean): Promise<void>;
98
+ uploadIndexDBLog(): Promise<void>;
99
+ private storeLogToIndexDB;
100
+ /**
101
+ * 清理旧日志,只保留最近指定天数的日志
102
+ */
103
+ private cleanupOldLogs;
104
+ /**
105
+ * 获取日志文件列表
106
+ * @returns 日志文件列表
107
+ */
108
+ getLogFiles(): Promise<LogFile[]>;
109
+ /**
110
+ * 获取指定日志文件的内容
111
+ * @param fileName 日志文件名
112
+ * @returns 日志文件内容
113
+ */
114
+ getLogFile(fileName: string): Promise<LogFile | null>;
115
+ /**
116
+ * 清空指定日志文件
117
+ * @param fileName 日志文件名,不指定则清空所有日志
118
+ * @returns 是否成功
119
+ */
120
+ clearLogs(fileName?: string): Promise<boolean>;
121
+ /**
122
+ * 设置日志保留天数
123
+ * @param days 保留天数
124
+ */
125
+ setRetentionDays(days: number): void;
126
+ /**
127
+ * 手动触发清理旧日志
128
+ */
129
+ manualCleanup(): Promise<void>;
130
+ /**
131
+ * 销毁实例
132
+ */
133
+ destroy(): void;
134
+ }
135
+ export default LoggerManager;
@@ -340,37 +340,54 @@ var LoggerManager = /*#__PURE__*/function () {
340
340
  Body: logs
341
341
  });
342
342
  case 13:
343
+ this.addLog({
344
+ type: "info",
345
+ title: "存储日志到AWS 成功",
346
+ metadata: {
347
+ fileName: fileName,
348
+ '本地上传的ids': bufferIds,
349
+ '实例下的ids': this.logBuffer.map(function (item) {
350
+ return item.logId;
351
+ })
352
+ }
353
+ });
343
354
  console.log("-------- 存储日志到AWS 成功");
344
355
  // 上传成功后需要清空缓冲区,避免重复上传
345
356
  this.logBuffer = this.logBuffer.filter(function (item) {
346
357
  return !bufferIds.includes(item.logId);
347
358
  });
348
- _context4.next = 29;
359
+ _context4.next = 31;
349
360
  break;
350
- case 17:
351
- _context4.prev = 17;
361
+ case 18:
362
+ _context4.prev = 18;
352
363
  _context4.t0 = _context4["catch"](3);
353
364
  console.error("存储日志上传AWS失败:", _context4.t0);
365
+ this.addLog({
366
+ type: "info",
367
+ title: "存储日志到AWS失败",
368
+ metadata: {
369
+ error: {
370
+ name: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.name,
371
+ message: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
372
+ stack: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.stack
373
+ }
374
+ }
375
+ });
354
376
 
355
377
  // 将日志存储到IndexDB
356
- _context4.prev = 20;
357
- _context4.next = 23;
378
+ _context4.prev = 22;
379
+ _context4.next = 25;
358
380
  return this.storeLogToIndexDB();
359
- case 23:
360
- _context4.next = 29;
361
- break;
362
381
  case 25:
363
- _context4.prev = 25;
364
- _context4.t1 = _context4["catch"](20);
382
+ _context4.next = 31;
383
+ break;
384
+ case 27:
385
+ _context4.prev = 27;
386
+ _context4.t1 = _context4["catch"](22);
365
387
  this.sendFeishuNotification({
366
388
  type: "error",
367
- title: "存储日志到AWS失败",
389
+ title: "将日志存储到IndexDB失败",
368
390
  metadata: {
369
- error: {
370
- name: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.name,
371
- message: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
372
- stack: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.stack
373
- },
374
391
  indexDBError: {
375
392
  name: _context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.name,
376
393
  message: _context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.message,
@@ -379,11 +396,11 @@ var LoggerManager = /*#__PURE__*/function () {
379
396
  }
380
397
  });
381
398
  console.error("存储日志到IndexDB也失败:", _context4.t1);
382
- case 29:
399
+ case 31:
383
400
  case "end":
384
401
  return _context4.stop();
385
402
  }
386
- }, _callee4, this, [[3, 17], [20, 25]]);
403
+ }, _callee4, this, [[3, 18], [22, 27]]);
387
404
  }));
388
405
  function storeLog(_x2) {
389
406
  return _storeLog.apply(this, arguments);
@@ -432,26 +449,27 @@ var LoggerManager = /*#__PURE__*/function () {
432
449
  return (_this$db2 = this.db) === null || _this$db2 === void 0 ? void 0 : _this$db2.clear("logs");
433
450
  case 17:
434
451
  console.log("-------- 清空IndexDB日志成功");
435
- _context5.next = 25;
452
+ _context5.next = 24;
436
453
  break;
437
454
  case 20:
438
455
  _context5.prev = 20;
439
456
  _context5.t0 = _context5["catch"](0);
440
457
  console.log("-------- 存储日志到IndexDB 失败", _context5.t0);
441
- this.sendFeishuNotification({
442
- type: "error",
443
- title: "存储IndexDB日志到AWS失败",
444
- metadata: {
445
- error: {
446
- name: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.name,
447
- message: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.message,
448
- stack: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.stack
449
- }
450
- }
451
- });
458
+
459
+ // this.sendFeishuNotification({
460
+ // type: "error",
461
+ // title: "存储IndexDB日志到AWS失败",
462
+ // metadata: {
463
+ // error: {
464
+ // name: error?.name,
465
+ // message: error?.message,
466
+ // stack: error?.stack,
467
+ // }
468
+ // },
469
+ // });
452
470
  // 重新抛出错误,让外层 catch 能够捕获
453
471
  throw _context5.t0;
454
- case 25:
472
+ case 24:
455
473
  case "end":
456
474
  return _context5.stop();
457
475
  }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import App from '../app';
3
+ export interface MenuItem {
4
+ key: string;
5
+ label: string;
6
+ path: string;
7
+ children?: MenuItem[];
8
+ icon?: string | React.ReactNode;
9
+ hide?: boolean;
10
+ }
11
+ export declare class MenuManager {
12
+ private menuItems;
13
+ private menuMaps;
14
+ private app;
15
+ useMenu: () => import("./hooks").MenuContextType;
16
+ MenuProvider: React.FC<{
17
+ children: React.ReactNode;
18
+ menus: MenuItem[];
19
+ }>;
20
+ constructor(items: MenuItem[], app: App);
21
+ set(items: MenuItem[]): void;
22
+ getMenus(): MenuItem[];
23
+ getMenuMaps(): void;
24
+ findMenuItemByPath(items: MenuItem[], path: string): MenuItem | null;
25
+ findParent(items: MenuItem[], key: string, parent?: MenuItem | null): MenuItem | null;
26
+ getShowChildren(items: MenuItem[]): MenuItem[];
27
+ findMenuItemByKey(items: MenuItem[], key: string): MenuItem | null;
28
+ }