@pisell/core 1.0.40 → 1.0.41
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/es/logger/index.js +47 -33
- package/lib/logger/index.js +7 -0
- package/package.json +1 -1
- package/es/app/app.d.ts +0 -99
- package/es/applicationManager/application.d.ts +0 -197
- package/es/applicationManager/index.d.ts +0 -19
- package/es/history/index.d.ts +0 -23
- package/es/index.d.ts +0 -7
- package/es/menuManager/index.d.ts +0 -28
- package/es/request/cache.d.ts +0 -46
- package/es/request/index.d.ts +0 -24
- package/es/request/type.d.ts +0 -52
- package/es/request/utils.d.ts +0 -46
- package/es/tasks/index.d.ts +0 -127
- package/es/tasks/scheduledTasksExample.d.ts +0 -61
- package/es/tasks/type.d.ts +0 -100
- package/lib/app/app.d.ts +0 -99
- package/lib/applicationManager/application.d.ts +0 -197
- package/lib/applicationManager/index.d.ts +0 -19
- package/lib/history/index.d.ts +0 -23
- package/lib/index.d.ts +0 -7
- package/lib/menuManager/index.d.ts +0 -28
- package/lib/request/cache.d.ts +0 -46
- package/lib/request/index.d.ts +0 -24
- package/lib/request/type.d.ts +0 -52
- package/lib/request/utils.d.ts +0 -46
- package/lib/tasks/index.d.ts +0 -127
- package/lib/tasks/scheduledTasksExample.d.ts +0 -61
- package/lib/tasks/type.d.ts +0 -100
package/es/logger/index.js
CHANGED
|
@@ -295,16 +295,18 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
295
295
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
296
296
|
while (1) switch (_context3.prev = _context3.next) {
|
|
297
297
|
case 0:
|
|
298
|
+
// 每次上传日志时,检查下IndexDB是否有日志,如果有则上传到AWS
|
|
299
|
+
this.uploadIndexDBLog();
|
|
298
300
|
if (!(this.logBuffer.length === 0 || !this.db)) {
|
|
299
|
-
_context3.next =
|
|
301
|
+
_context3.next = 3;
|
|
300
302
|
break;
|
|
301
303
|
}
|
|
302
304
|
return _context3.abrupt("return");
|
|
303
|
-
case
|
|
304
|
-
_context3.prev =
|
|
305
|
-
_context3.next =
|
|
305
|
+
case 3:
|
|
306
|
+
_context3.prev = 3;
|
|
307
|
+
_context3.next = 6;
|
|
306
308
|
return this.createAWSFileName(urgent);
|
|
307
|
-
case
|
|
309
|
+
case 6:
|
|
308
310
|
fileName = _context3.sent;
|
|
309
311
|
console.log("-------- 存储日志到AWS 开始", fileName);
|
|
310
312
|
|
|
@@ -317,35 +319,35 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
317
319
|
return item.logId;
|
|
318
320
|
});
|
|
319
321
|
logs = JSON.stringify(buffer, null, 2);
|
|
320
|
-
_context3.next =
|
|
322
|
+
_context3.next = 13;
|
|
321
323
|
return this.app.aws.upload({
|
|
322
324
|
Bucket: "",
|
|
323
325
|
Key: fileName,
|
|
324
326
|
Body: logs
|
|
325
327
|
});
|
|
326
|
-
case
|
|
328
|
+
case 13:
|
|
327
329
|
console.log("-------- 存储日志到AWS 成功");
|
|
328
330
|
// 上传成功后需要清空缓冲区,避免重复上传
|
|
329
331
|
this.logBuffer = this.logBuffer.filter(function (item) {
|
|
330
332
|
return !bufferIds.includes(item.logId);
|
|
331
333
|
});
|
|
332
|
-
_context3.next =
|
|
334
|
+
_context3.next = 29;
|
|
333
335
|
break;
|
|
334
|
-
case
|
|
335
|
-
_context3.prev =
|
|
336
|
-
_context3.t0 = _context3["catch"](
|
|
336
|
+
case 17:
|
|
337
|
+
_context3.prev = 17;
|
|
338
|
+
_context3.t0 = _context3["catch"](3);
|
|
337
339
|
console.error("存储日志上传AWS失败:", _context3.t0);
|
|
338
340
|
|
|
339
341
|
// 将日志存储到IndexDB
|
|
340
|
-
_context3.prev =
|
|
341
|
-
_context3.next =
|
|
342
|
+
_context3.prev = 20;
|
|
343
|
+
_context3.next = 23;
|
|
342
344
|
return this.storeLogToIndexDB();
|
|
343
|
-
case
|
|
344
|
-
_context3.next =
|
|
345
|
+
case 23:
|
|
346
|
+
_context3.next = 29;
|
|
345
347
|
break;
|
|
346
|
-
case
|
|
347
|
-
_context3.prev =
|
|
348
|
-
_context3.t1 = _context3["catch"](
|
|
348
|
+
case 25:
|
|
349
|
+
_context3.prev = 25;
|
|
350
|
+
_context3.t1 = _context3["catch"](20);
|
|
349
351
|
this.sendFeishuNotification({
|
|
350
352
|
type: "error",
|
|
351
353
|
title: "存储日志到AWS失败",
|
|
@@ -355,11 +357,11 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
355
357
|
}
|
|
356
358
|
});
|
|
357
359
|
console.error("存储日志到IndexDB也失败:", _context3.t1);
|
|
358
|
-
case
|
|
360
|
+
case 29:
|
|
359
361
|
case "end":
|
|
360
362
|
return _context3.stop();
|
|
361
363
|
}
|
|
362
|
-
}, _callee3, this, [[
|
|
364
|
+
}, _callee3, this, [[3, 17], [20, 25]]);
|
|
363
365
|
}));
|
|
364
366
|
function storeLog(_x2) {
|
|
365
367
|
return _storeLog.apply(this, arguments);
|
|
@@ -375,31 +377,43 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
375
377
|
while (1) switch (_context4.prev = _context4.next) {
|
|
376
378
|
case 0:
|
|
377
379
|
_context4.prev = 0;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
+
if (this.db) {
|
|
381
|
+
_context4.next = 3;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
return _context4.abrupt("return");
|
|
380
385
|
case 3:
|
|
386
|
+
_context4.next = 5;
|
|
387
|
+
return (_this$db = this.db) === null || _this$db === void 0 ? void 0 : _this$db.getAll("logs");
|
|
388
|
+
case 5:
|
|
381
389
|
logFile = _context4.sent;
|
|
382
|
-
|
|
390
|
+
if (!(!logFile || (logFile === null || logFile === void 0 ? void 0 : logFile.length) === 0)) {
|
|
391
|
+
_context4.next = 8;
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
return _context4.abrupt("return");
|
|
395
|
+
case 8:
|
|
396
|
+
_context4.next = 10;
|
|
383
397
|
return this.createAWSFileName(true);
|
|
384
|
-
case
|
|
398
|
+
case 10:
|
|
385
399
|
awsFileName = _context4.sent;
|
|
386
400
|
logs = JSON.stringify(logFile, null, 2);
|
|
387
|
-
_context4.next =
|
|
401
|
+
_context4.next = 14;
|
|
388
402
|
return this.app.aws.upload({
|
|
389
403
|
Bucket: "",
|
|
390
404
|
Key: awsFileName,
|
|
391
405
|
Body: logs
|
|
392
406
|
});
|
|
393
|
-
case
|
|
407
|
+
case 14:
|
|
394
408
|
console.log("-------- 存储日志到AWS 成功");
|
|
395
|
-
_context4.next =
|
|
409
|
+
_context4.next = 17;
|
|
396
410
|
return (_this$db2 = this.db) === null || _this$db2 === void 0 ? void 0 : _this$db2.clear("logs");
|
|
397
|
-
case
|
|
411
|
+
case 17:
|
|
398
412
|
console.log("-------- 清空IndexDB日志成功");
|
|
399
|
-
_context4.next =
|
|
413
|
+
_context4.next = 25;
|
|
400
414
|
break;
|
|
401
|
-
case
|
|
402
|
-
_context4.prev =
|
|
415
|
+
case 20:
|
|
416
|
+
_context4.prev = 20;
|
|
403
417
|
_context4.t0 = _context4["catch"](0);
|
|
404
418
|
console.log("-------- 存储日志到IndexDB 失败", _context4.t0);
|
|
405
419
|
this.sendFeishuNotification({
|
|
@@ -411,11 +425,11 @@ var LoggerManager = /*#__PURE__*/function () {
|
|
|
411
425
|
});
|
|
412
426
|
// 重新抛出错误,让外层 catch 能够捕获
|
|
413
427
|
throw _context4.t0;
|
|
414
|
-
case
|
|
428
|
+
case 25:
|
|
415
429
|
case "end":
|
|
416
430
|
return _context4.stop();
|
|
417
431
|
}
|
|
418
|
-
}, _callee4, this, [[0,
|
|
432
|
+
}, _callee4, this, [[0, 20]]);
|
|
419
433
|
}));
|
|
420
434
|
function uploadIndexDBLog() {
|
|
421
435
|
return _uploadIndexDBLog.apply(this, arguments);
|
package/lib/logger/index.js
CHANGED
|
@@ -211,6 +211,7 @@ var LoggerManager = class {
|
|
|
211
211
|
*/
|
|
212
212
|
async storeLog(urgent) {
|
|
213
213
|
var _a;
|
|
214
|
+
this.uploadIndexDBLog();
|
|
214
215
|
if (this.logBuffer.length === 0 || !this.db) {
|
|
215
216
|
return;
|
|
216
217
|
}
|
|
@@ -246,7 +247,13 @@ var LoggerManager = class {
|
|
|
246
247
|
async uploadIndexDBLog() {
|
|
247
248
|
var _a, _b;
|
|
248
249
|
try {
|
|
250
|
+
if (!this.db) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
249
253
|
let logFile = await ((_a = this.db) == null ? void 0 : _a.getAll("logs"));
|
|
254
|
+
if (!logFile || (logFile == null ? void 0 : logFile.length) === 0) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
250
257
|
const awsFileName = await this.createAWSFileName(true);
|
|
251
258
|
const logs = JSON.stringify(logFile, null, 2);
|
|
252
259
|
await this.app.aws.upload({ Bucket: "", Key: awsFileName, Body: logs });
|
package/package.json
CHANGED
package/es/app/app.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
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("../request").RequestSetting | undefined) => Promise<any>;
|
|
51
|
-
post: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
52
|
-
put: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
53
|
-
remove: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
54
|
-
custom: (url: string, config: import("../request").RequestSetting | undefined) => any;
|
|
55
|
-
setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
|
|
56
|
-
getConfig: () => import("../request").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;
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import App from '../app';
|
|
2
|
-
import { LoadLibraryByUrlParams } from '../locales/type';
|
|
3
|
-
import { MenuItem } from '../menuManager/index';
|
|
4
|
-
/**
|
|
5
|
-
* 应用接口类型定义
|
|
6
|
-
* @description 描述应用中单个页面、组件或功能的接口结构
|
|
7
|
-
*/
|
|
8
|
-
export declare 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 declare 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
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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/history/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { LocationDescriptor } from "history";
|
|
2
|
-
import type { History as HistoryType } from "history";
|
|
3
|
-
import { useHistory, useLocation, useParams } from "react-router-dom";
|
|
4
|
-
import App from "../app";
|
|
5
|
-
export interface HistoryOptions {
|
|
6
|
-
basename?: string;
|
|
7
|
-
interceptor?: (path: LocationDescriptor<unknown>, state: any, next: () => void) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare class History {
|
|
10
|
-
instance: HistoryType<unknown>;
|
|
11
|
-
useHistory: typeof useHistory;
|
|
12
|
-
useLocation: typeof useLocation;
|
|
13
|
-
useParams: typeof useParams;
|
|
14
|
-
app: App;
|
|
15
|
-
interceptor?: (path: LocationDescriptor<unknown>, state: unknown, next: () => void) => void;
|
|
16
|
-
constructor(app: App, options?: HistoryOptions);
|
|
17
|
-
push: HistoryType["push"];
|
|
18
|
-
replace: HistoryType["replace"];
|
|
19
|
-
reload: () => void;
|
|
20
|
-
reloadTo: (path: string) => void;
|
|
21
|
-
externalPage: (path: string) => void;
|
|
22
|
-
goLogin: () => any;
|
|
23
|
-
}
|
package/es/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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,28 +0,0 @@
|
|
|
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
|
-
}
|
package/es/request/cache.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CacheProps } from './type';
|
|
2
|
-
export declare type CacheType = 'memory' | 'storage' | 'indexDB';
|
|
3
|
-
/**
|
|
4
|
-
* @title: 设置缓存
|
|
5
|
-
* @description:
|
|
6
|
-
* @return {*}
|
|
7
|
-
* @Author: zhiwei.Wang
|
|
8
|
-
*/
|
|
9
|
-
export declare const setCache: (key: string, data: any, cache: CacheProps) => Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* @title: 删除缓存数据
|
|
12
|
-
* @description:
|
|
13
|
-
* @return {*}
|
|
14
|
-
* @Author: zhiwei.Wang
|
|
15
|
-
*/
|
|
16
|
-
export declare const removeCache: (key: string, cache: CacheProps) => void;
|
|
17
|
-
/**
|
|
18
|
-
* @title: 获取数据
|
|
19
|
-
* @description:
|
|
20
|
-
* @param {any} url
|
|
21
|
-
* @param {any} data
|
|
22
|
-
* @return {*}
|
|
23
|
-
* @Author: zhiwei.Wang
|
|
24
|
-
*/
|
|
25
|
-
export declare const getCacheData: (url: string, data: any, cache: CacheProps) => Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* @title: 设置缓存
|
|
28
|
-
* @description:
|
|
29
|
-
* @param {any} url 路径
|
|
30
|
-
* @param {any} data 参数
|
|
31
|
-
* @param {any} res 数据
|
|
32
|
-
* @return {*}
|
|
33
|
-
* @Author: zhiwei.Wang
|
|
34
|
-
*/
|
|
35
|
-
export declare const setCacheData: (url: string, data: any, res: any, cache?: CacheProps) => any | null;
|
|
36
|
-
/**
|
|
37
|
-
* @title: 缓存函数包装器
|
|
38
|
-
* @description:
|
|
39
|
-
* @param {any} url
|
|
40
|
-
* @param {any} data
|
|
41
|
-
* @param {any} config
|
|
42
|
-
* @param {any} fn
|
|
43
|
-
* @return {*}
|
|
44
|
-
* @Author: zhiwei.Wang
|
|
45
|
-
*/
|
|
46
|
-
export declare const cacheFn: (props: any, fn: any) => Promise<any>;
|
package/es/request/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RequestWrapperProps, RequestConfig } from "./type";
|
|
2
|
-
export declare const createRequest: (props: RequestWrapperProps) => Promise<unknown>;
|
|
3
|
-
/**
|
|
4
|
-
* 请求
|
|
5
|
-
* @param props
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare const request: (props: RequestWrapperProps) => any;
|
|
9
|
-
export declare const get: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
|
|
10
|
-
export declare const post: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
|
|
11
|
-
export declare const put: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
|
|
12
|
-
export declare const remove: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
|
|
13
|
-
export declare const custom: (url: RequestWrapperProps["url"], config: RequestWrapperProps["config"]) => any;
|
|
14
|
-
export * from "./type";
|
|
15
|
-
declare const _default: {
|
|
16
|
-
get: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
|
|
17
|
-
post: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
|
|
18
|
-
put: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
|
|
19
|
-
remove: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
|
|
20
|
-
custom: (url: string, config: import("./type").RequestSetting | undefined) => any;
|
|
21
|
-
setConfig: (newConfig: Partial<RequestConfig>) => void;
|
|
22
|
-
getConfig: () => RequestConfig;
|
|
23
|
-
};
|
|
24
|
-
export default _default;
|