@pisell/core 1.0.44 → 1.0.46

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 (59) hide show
  1. package/es/app/app.d.ts +7 -7
  2. package/es/app/index.d.ts +1 -1
  3. package/es/applicationManager/application.d.ts +2 -2
  4. package/es/cmd/const.d.ts +5 -5
  5. package/es/hooks/useStore/index.d.ts +1 -1
  6. package/es/locales/type.d.ts +3 -3
  7. package/es/logger/index.d.ts +1 -1
  8. package/es/logger/index.js +24 -22
  9. package/es/models/index.d.ts +4 -4
  10. package/es/pubsub/index.d.ts +1 -1
  11. package/es/request/cache.d.ts +1 -1
  12. package/es/request/config.js +5 -0
  13. package/es/request/index.js +82 -4
  14. package/es/request/pisell2Request.d.ts +1 -1
  15. package/es/request/type.d.ts +6 -1
  16. package/es/routes/index.d.ts +2 -2
  17. package/es/socket/types.d.ts +1 -1
  18. package/es/tasks/index.d.ts +1 -1
  19. package/es/tasks/type.d.ts +4 -4
  20. package/es/utils/adaptiveThrottle/index.d.ts +2 -2
  21. package/es/variables/index.d.ts +3 -3
  22. package/lib/app/app.d.ts +7 -7
  23. package/lib/app/index.d.ts +1 -1
  24. package/lib/applicationManager/application.d.ts +2 -2
  25. package/lib/aws/index.js +0 -3
  26. package/lib/cmd/const.d.ts +5 -5
  27. package/lib/cmd/const.js +5 -5
  28. package/lib/cmd/index.js +0 -2
  29. package/lib/cookie/index.js +4 -2
  30. package/lib/data/index.js +0 -3
  31. package/lib/hooks/useStore/index.d.ts +1 -1
  32. package/lib/locales/index.js +94 -95
  33. package/lib/locales/type.d.ts +3 -3
  34. package/lib/logger/index.d.ts +1 -1
  35. package/lib/logger/index.js +3 -2
  36. package/lib/models/index.d.ts +4 -4
  37. package/lib/pubsub/index.d.ts +1 -1
  38. package/lib/pubsub/index.js +3 -1
  39. package/lib/request/cache.d.ts +1 -1
  40. package/lib/request/config.js +5 -0
  41. package/lib/request/index.js +60 -3
  42. package/lib/request/pisell2Request.d.ts +1 -1
  43. package/lib/request/type.d.ts +6 -1
  44. package/lib/routes/index.d.ts +2 -2
  45. package/lib/routes/index.js +1 -3
  46. package/lib/socket/components/SocketMonitorPage.js +12 -6
  47. package/lib/socket/heartbeat.js +5 -10
  48. package/lib/socket/index.js +3 -1
  49. package/lib/socket/monitor.js +24 -26
  50. package/lib/socket/reconnect.js +3 -10
  51. package/lib/socket/socket.js +10 -12
  52. package/lib/socket/types.d.ts +1 -1
  53. package/lib/storage/index.js +24 -25
  54. package/lib/tasks/index.d.ts +1 -1
  55. package/lib/tasks/index.js +329 -333
  56. package/lib/tasks/type.d.ts +4 -4
  57. package/lib/utils/adaptiveThrottle/index.d.ts +2 -2
  58. package/lib/variables/index.d.ts +3 -3
  59. package/package.json +1 -1
package/es/app/app.d.ts CHANGED
@@ -47,13 +47,13 @@ declare class App {
47
47
  setConfig: (models: any[]) => void;
48
48
  };
49
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;
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
57
  };
58
58
  storage: Storage;
59
59
  menuManager: MenuManager;
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;
@@ -5,7 +5,7 @@ import { MenuItem } from '../menuManager/index';
5
5
  * 应用接口类型定义
6
6
  * @description 描述应用中单个页面、组件或功能的接口结构
7
7
  */
8
- export declare type ApplicationInterface = {
8
+ export type ApplicationInterface = {
9
9
  page_type: 'low_code' | 'code';
10
10
  page_id: number | string;
11
11
  page_code: string;
@@ -29,7 +29,7 @@ export declare type ApplicationInterface = {
29
29
  * 应用数据类型定义
30
30
  * @description 描述完整应用的数据结构,包含应用的基本信息、接口、功能等
31
31
  */
32
- export declare type ApplicationData = {
32
+ export type ApplicationData = {
33
33
  /** 应用唯一标识 */
34
34
  app_id: number;
35
35
  /** 应用名称 */
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;
@@ -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)[];
@@ -1,5 +1,5 @@
1
1
  import App from "../app";
2
- export declare type LogConsoleType = "info" | "warning" | "error" | "debug";
2
+ export type LogConsoleType = "info" | "warning" | "error" | "debug";
3
3
  /**
4
4
  * 日志项接口
5
5
  */
@@ -173,12 +173,12 @@ var LoggerManager = /*#__PURE__*/function () {
173
173
  });
174
174
  console.log("---- 行为日志", logItem);
175
175
  this.logBuffer.push(logItem);
176
- if (log.type === "error") {
176
+ if (log.type === "error" || log.type === "warning") {
177
177
  this.sendFeishuNotification(_objectSpread(_objectSpread({}, logItem || {}), {}, {
178
178
  feishu: feishu
179
179
  }));
180
180
  // error 级别日志需要立即存储
181
- this.storeLog(true);
181
+ this.storeLog(log.type === "error");
182
182
  }
183
183
  }
184
184
 
@@ -308,16 +308,18 @@ var LoggerManager = /*#__PURE__*/function () {
308
308
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
309
309
  while (1) switch (_context4.prev = _context4.next) {
310
310
  case 0:
311
+ // 每次上传日志时,检查下IndexDB是否有日志,如果有则上传到AWS
312
+ this.uploadIndexDBLog();
311
313
  if (!(this.logBuffer.length === 0 || !this.db)) {
312
- _context4.next = 2;
314
+ _context4.next = 3;
313
315
  break;
314
316
  }
315
317
  return _context4.abrupt("return");
316
- case 2:
317
- _context4.prev = 2;
318
- _context4.next = 5;
318
+ case 3:
319
+ _context4.prev = 3;
320
+ _context4.next = 6;
319
321
  return this.createAWSFileName(urgent);
320
- case 5:
322
+ case 6:
321
323
  fileName = _context4.sent;
322
324
  console.log("-------- 存储日志到AWS 开始", fileName);
323
325
 
@@ -330,35 +332,35 @@ var LoggerManager = /*#__PURE__*/function () {
330
332
  return item.logId;
331
333
  });
332
334
  logs = JSON.stringify(buffer, null, 2);
333
- _context4.next = 12;
335
+ _context4.next = 13;
334
336
  return this.app.aws.upload({
335
337
  Bucket: "",
336
338
  Key: fileName,
337
339
  Body: logs
338
340
  });
339
- case 12:
341
+ case 13:
340
342
  console.log("-------- 存储日志到AWS 成功");
341
343
  // 上传成功后需要清空缓冲区,避免重复上传
342
344
  this.logBuffer = this.logBuffer.filter(function (item) {
343
345
  return !bufferIds.includes(item.logId);
344
346
  });
345
- _context4.next = 28;
347
+ _context4.next = 29;
346
348
  break;
347
- case 16:
348
- _context4.prev = 16;
349
- _context4.t0 = _context4["catch"](2);
349
+ case 17:
350
+ _context4.prev = 17;
351
+ _context4.t0 = _context4["catch"](3);
350
352
  console.error("存储日志上传AWS失败:", _context4.t0);
351
353
 
352
354
  // 将日志存储到IndexDB
353
- _context4.prev = 19;
354
- _context4.next = 22;
355
+ _context4.prev = 20;
356
+ _context4.next = 23;
355
357
  return this.storeLogToIndexDB();
356
- case 22:
357
- _context4.next = 28;
358
+ case 23:
359
+ _context4.next = 29;
358
360
  break;
359
- case 24:
360
- _context4.prev = 24;
361
- _context4.t1 = _context4["catch"](19);
361
+ case 25:
362
+ _context4.prev = 25;
363
+ _context4.t1 = _context4["catch"](20);
362
364
  this.sendFeishuNotification({
363
365
  type: "error",
364
366
  title: "存储日志到AWS失败",
@@ -376,11 +378,11 @@ var LoggerManager = /*#__PURE__*/function () {
376
378
  }
377
379
  });
378
380
  console.error("存储日志到IndexDB也失败:", _context4.t1);
379
- case 28:
381
+ case 29:
380
382
  case "end":
381
383
  return _context4.stop();
382
384
  }
383
- }, _callee4, this, [[2, 16], [19, 24]]);
385
+ }, _callee4, this, [[3, 17], [20, 25]]);
384
386
  }));
385
387
  function storeLog(_x2) {
386
388
  return _storeLog.apply(this, arguments);
@@ -1,7 +1,7 @@
1
1
  import hooks from '../hooks';
2
2
  import { Provider as StoreProvider } from "react-redux";
3
3
  declare const models: import("./global").GlobalModal[];
4
- declare type ModalsType = (typeof models[number]);
4
+ type ModalsType = (typeof models[number]);
5
5
  export interface Store {
6
6
  getDataByModel: typeof getDataByModel;
7
7
  useStore: typeof hooks.useStore;
@@ -10,8 +10,8 @@ export interface Store {
10
10
  dispatch: any;
11
11
  getState: any;
12
12
  }
13
- export declare type ModelsNames = ModalsType['namespace'];
14
- export declare type ModelsState = {
13
+ export type ModelsNames = ModalsType['namespace'];
14
+ export type ModelsState = {
15
15
  [K in (ModalsType['namespace'])]: Extract<ModalsType, {
16
16
  namespace: K;
17
17
  }>['state'];
@@ -25,7 +25,7 @@ export declare type ModelsState = {
25
25
  * @Author: zhiwei.Wang
26
26
  * @Date: 2024-09-03 11:07
27
27
  */
28
- declare const getDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key?: D | undefined) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
28
+ declare const getDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key?: D) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
29
29
  /**
30
30
  * @title: 设置数据到store
31
31
  * @description:
@@ -2,7 +2,7 @@
2
2
  * 发布订阅模块
3
3
  * 用于组件/服务间的事件通信
4
4
  */
5
- declare type EventCallback = (...args: any[]) => void;
5
+ type EventCallback = (...args: any[]) => void;
6
6
  interface EventSubscription {
7
7
  unsubscribe: () => void;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { CacheProps } from './type';
2
- export declare type CacheType = 'memory' | 'storage' | 'indexDB';
2
+ export type CacheType = 'memory' | 'storage' | 'indexDB';
3
3
  /**
4
4
  * @title: 设置缓存
5
5
  * @description:
@@ -10,6 +10,11 @@ import { mergeWith } from 'lodash';
10
10
  var defaultConfig = {
11
11
  axiosConfig: axiosConfig,
12
12
  storage: new Storage(),
13
+ logger: {
14
+ maxRequestCount: 6,
15
+ maxRequestTime: 5000,
16
+ filterUrls: []
17
+ },
13
18
  requestCallbacks: {
14
19
  200: function _(resData) {
15
20
  var res = resData.res,
@@ -11,6 +11,8 @@ import { createSignal } from "./cancelToken";
11
11
  import { axiosConfig } from "./constants";
12
12
  import { cacheFn } from "./cache";
13
13
  import { interceptorsRequest, interceptorsResponse, interceptorsRequestError, interceptorsResponseError, requestCallback } from "./utils";
14
+ // @ts-ignore
15
+ import { getUniqueId } from "@pisell/utils";
14
16
  import axios from "axios";
15
17
  import { getConfig, setConfig } from "./config";
16
18
  import { getApp } from "../app";
@@ -22,20 +24,93 @@ axiosInstance.interceptors.request.use(interceptorsRequest, interceptorsRequestE
22
24
 
23
25
  // 响应拦截器
24
26
  axiosInstance.interceptors.response.use(interceptorsResponse, interceptorsResponseError);
27
+
28
+ // 请求计数
29
+ var requestCount = 0;
30
+ var isFilterUrl = function isFilterUrl(url) {
31
+ var _logger$filterUrls;
32
+ var _getConfig = getConfig(),
33
+ logger = _getConfig.logger;
34
+ return logger === null || logger === void 0 || (_logger$filterUrls = logger.filterUrls) === null || _logger$filterUrls === void 0 ? void 0 : _logger$filterUrls.some(function (filterUrl) {
35
+ return url.includes(filterUrl);
36
+ });
37
+ };
25
38
  export var createRequest = function createRequest(props) {
26
39
  var data = props.data,
27
40
  config = props.config,
28
- method = props.method;
29
- var _getConfig = getConfig(),
30
- getUrl = _getConfig.getUrl;
41
+ method = props.method,
42
+ url = props.url;
43
+ var _getConfig2 = getConfig(),
44
+ getUrl = _getConfig2.getUrl,
45
+ logger = _getConfig2.logger;
46
+ var startTime = Date.now(); // 记录请求开始时间
47
+ var app = getApp();
48
+ var requestId = getUniqueId();
49
+
50
+ // 请求计数增加
51
+ requestCount++;
52
+
53
+ // 记录请求开始日志
54
+ app.logger.addLog({
55
+ type: 'info',
56
+ title: "[ Request ]: Start - ".concat(requestId),
57
+ metadata: {
58
+ url: url,
59
+ data: data,
60
+ method: method
61
+ }
62
+ });
63
+
64
+ // 如果请求计数超过最大请求数,则记录为警告日志
65
+ if (requestCount > ((logger === null || logger === void 0 ? void 0 : logger.maxRequestCount) || 6)) {
66
+ app.logger.addLog({
67
+ type: 'warning',
68
+ title: "[ Request ]: Max Request Count - ".concat(requestCount),
69
+ metadata: {
70
+ requestCount: requestCount
71
+ }
72
+ });
73
+ }
31
74
  return new Promise(function (resolve, reject) {
32
75
  var _method = method === "remove" ? "delete" : method;
33
- var _url = getUrl === null || getUrl === void 0 ? void 0 : getUrl(props);
76
+ var _url = (getUrl === null || getUrl === void 0 ? void 0 : getUrl(props)) || '';
77
+
78
+ // 请求完成处理函数
79
+ var handleRequestComplete = function handleRequestComplete(url, result) {
80
+ var isError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
81
+ var requestId = arguments.length > 3 ? arguments[3] : undefined;
82
+ try {
83
+ var endTime = Date.now();
84
+ var duration = endTime - startTime;
85
+ var maxRequestTime = (logger === null || logger === void 0 ? void 0 : logger.maxRequestTime) || 5000;
86
+
87
+ // 如果请求URL在过滤列表中,则不判断超时时间
88
+ if (isFilterUrl(url)) {
89
+ maxRequestTime = 99999999;
90
+ }
91
+
92
+ // 如果请求错误或者请求超过5秒,则记录为错误日志
93
+ var type = duration > maxRequestTime ? 'warning' : 'info';
94
+ if (isError) {
95
+ type = 'error';
96
+ }
97
+ app.logger.addLog({
98
+ type: type,
99
+ title: "[ Request ]: Complete - ".concat(requestId),
100
+ metadata: {
101
+ error: isError ? JSON.stringify(result) : '',
102
+ duration: "".concat((duration / 1000).toFixed(2), "s")
103
+ }
104
+ });
105
+ } catch (error) {}
106
+ return result;
107
+ };
34
108
  axiosInstance[_method](_url, ["post", "put"].includes(_method) ? data : _objectSpread({
35
109
  params: data
36
110
  }, config), _objectSpread({
37
111
  params: !["post", "put"].includes(_method) ? data : null
38
112
  }, config)).then(function (res) {
113
+ handleRequestComplete(_url, res, false, requestId);
39
114
  requestCallback({
40
115
  res: res,
41
116
  reject: reject,
@@ -43,12 +118,15 @@ export var createRequest = function createRequest(props) {
43
118
  props: props
44
119
  });
45
120
  }).catch(function (err) {
121
+ handleRequestComplete(_url, err, true, requestId);
46
122
  requestCallback({
47
123
  err: err,
48
124
  reject: reject,
49
125
  resolve: resolve,
50
126
  props: props
51
127
  });
128
+ }).finally(function () {
129
+ requestCount--;
52
130
  });
53
131
  });
54
132
  };
@@ -1,4 +1,4 @@
1
- declare type RequestMethod = any;
1
+ type RequestMethod = any;
2
2
  declare const pisell2Get: RequestMethod;
3
3
  declare const pisell2Post: RequestMethod;
4
4
  declare const pisell2Put: RequestMethod;
@@ -1,6 +1,11 @@
1
1
  import { CreateAxiosDefaults } from "axios";
2
2
  import { CacheType } from './cache';
3
3
  export interface RequestConfig {
4
+ logger: {
5
+ maxRequestCount: number;
6
+ maxRequestTime: number;
7
+ filterUrls: string[];
8
+ };
4
9
  interceptorsRequest?: ((value: any) => any | Promise<any>) | null;
5
10
  interceptorsRequestError?: ((error: any) => any) | null;
6
11
  interceptorsResponse?: any;
@@ -26,7 +31,7 @@ export declare enum RequestModeENUM {
26
31
  REMOTE_LOCAL = "remote_local",
27
32
  OS_SERVER = "os_server"
28
33
  }
29
- export declare type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
34
+ export type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
30
35
  export interface CacheProps {
31
36
  key?: string;
32
37
  type?: CacheType;
@@ -20,9 +20,9 @@ export declare class RouterManager {
20
20
  get(name: string): RouteType;
21
21
  has(name: string): boolean;
22
22
  remove(name: string): void;
23
- renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
23
+ renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
24
24
  getPageByRoute(route: string): ApplicationInterface | undefined;
25
25
  getRouterComponent({ fallback }: {
26
26
  fallback?: React.ReactNode;
27
- }): JSX.Element[];
27
+ }): React.JSX.Element[];
28
28
  }
@@ -76,7 +76,7 @@ export interface ReconnectOptions {
76
76
  /**
77
77
  * 事件处理函数类型
78
78
  */
79
- export declare type EventHandler = (...args: any[]) => void;
79
+ export type EventHandler = (...args: any[]) => void;
80
80
  /**
81
81
  * 事件处理函数映射
82
82
  */
@@ -108,7 +108,7 @@ export declare class TasksManager {
108
108
  */
109
109
  getQueueStatus(module: string, queueId: string): {
110
110
  isRunning: boolean;
111
- status: "uncompleted" | "completed";
111
+ status: "completed" | "uncompleted";
112
112
  progress: {
113
113
  total: number;
114
114
  completed: number;
@@ -1,4 +1,4 @@
1
- export declare type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
1
+ export type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
2
2
  export interface Task {
3
3
  id?: string;
4
4
  type?: "local" | "cloud";
@@ -37,9 +37,9 @@ export interface Task {
37
37
  export interface TaskConfig {
38
38
  tasks: Task[];
39
39
  }
40
- declare type TaskModuleName = string;
41
- declare type TaskQueueName = string;
42
- declare type TaskStatus = "uncompleted" | "completed";
40
+ type TaskModuleName = string;
41
+ type TaskQueueName = string;
42
+ type TaskStatus = "uncompleted" | "completed";
43
43
  export interface TaskQueue {
44
44
  status: TaskStatus;
45
45
  tasks: Task[];
@@ -1,4 +1,4 @@
1
- export declare type ThrottleLevel = number;
1
+ export type ThrottleLevel = number;
2
2
  export interface ThrottleExecuteContext {
3
3
  /** 事务唯一 key */
4
4
  key: string;
@@ -11,7 +11,7 @@ export interface ThrottleExecuteContext {
11
11
  /** 上一次执行时间 */
12
12
  lastExecuteTime: number;
13
13
  }
14
- export declare type ThrottleHandler = (ctx: ThrottleExecuteContext) => void | Promise<void>;
14
+ export type ThrottleHandler = (ctx: ThrottleExecuteContext) => void | Promise<void>;
15
15
  export declare const DEFAULT_THROTTLE_INTERVALS: number[];
16
16
  export declare class AdaptiveThrottle {
17
17
  private store;
@@ -1,6 +1,6 @@
1
- export declare type VariableMap = Record<string, string>;
1
+ export type VariableMap = Record<string, string>;
2
2
  declare const _default: {
3
- setConfig: (newConfig: Partial<import("./type").VariablesConfig>) => void;
4
- getConfig: () => import("./type").VariablesConfig;
3
+ setConfig: (newConfig: Partial<import("@").VariablesConfig>) => void;
4
+ getConfig: () => import("@").VariablesConfig;
5
5
  };
6
6
  export default _default;
package/lib/app/app.d.ts CHANGED
@@ -47,13 +47,13 @@ declare class App {
47
47
  setConfig: (models: any[]) => void;
48
48
  };
49
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;
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
57
  };
58
58
  storage: Storage;
59
59
  menuManager: MenuManager;
@@ -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;
@@ -5,7 +5,7 @@ import { MenuItem } from '../menuManager/index';
5
5
  * 应用接口类型定义
6
6
  * @description 描述应用中单个页面、组件或功能的接口结构
7
7
  */
8
- export declare type ApplicationInterface = {
8
+ export type ApplicationInterface = {
9
9
  page_type: 'low_code' | 'code';
10
10
  page_id: number | string;
11
11
  page_code: string;
@@ -29,7 +29,7 @@ export declare type ApplicationInterface = {
29
29
  * 应用数据类型定义
30
30
  * @description 描述完整应用的数据结构,包含应用的基本信息、接口、功能等
31
31
  */
32
- export declare type ApplicationData = {
32
+ export type ApplicationData = {
33
33
  /** 应用唯一标识 */
34
34
  app_id: number;
35
35
  /** 应用名称 */
package/lib/aws/index.js CHANGED
@@ -32,9 +32,6 @@ var defaultUploadParams = {
32
32
  // 设置ACL权限为公共读取
33
33
  };
34
34
  var AWS = class {
35
- s3Client;
36
- app;
37
- config;
38
35
  constructor(app, options) {
39
36
  this.app = app;
40
37
  if (options) {
@@ -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;
package/lib/cmd/const.js CHANGED
@@ -25,11 +25,11 @@ __export(const_exports, {
25
25
  module.exports = __toCommonJS(const_exports);
26
26
  var prefix = "cmd";
27
27
  var CMDCoreEnum = ((CMDCoreEnum2) => {
28
- CMDCoreEnum2["CMD_CONNECT"] = `${prefix}.connect`;
29
- CMDCoreEnum2["CMD_DISCONNECT"] = `${prefix}.disconnect`;
30
- CMDCoreEnum2["CMD_RECONNECT"] = `${prefix}.reconnect`;
31
- CMDCoreEnum2["CMD_MESSAGE"] = `${prefix}.message`;
32
- CMDCoreEnum2["CMD_ERROR"] = `${prefix}.error`;
28
+ CMDCoreEnum2[CMDCoreEnum2["CMD_CONNECT"] = `${prefix}.connect`] = "CMD_CONNECT";
29
+ CMDCoreEnum2[CMDCoreEnum2["CMD_DISCONNECT"] = `${prefix}.disconnect`] = "CMD_DISCONNECT";
30
+ CMDCoreEnum2[CMDCoreEnum2["CMD_RECONNECT"] = `${prefix}.reconnect`] = "CMD_RECONNECT";
31
+ CMDCoreEnum2[CMDCoreEnum2["CMD_MESSAGE"] = `${prefix}.message`] = "CMD_MESSAGE";
32
+ CMDCoreEnum2[CMDCoreEnum2["CMD_ERROR"] = `${prefix}.error`] = "CMD_ERROR";
33
33
  return CMDCoreEnum2;
34
34
  })(CMDCoreEnum || {});
35
35
  var const_default = { CMDCoreEnum };
package/lib/cmd/index.js CHANGED
@@ -36,8 +36,6 @@ module.exports = __toCommonJS(cmd_exports);
36
36
  var import_socket = __toESM(require("../socket"));
37
37
  var import_const = require("./const");
38
38
  var CMD = class {
39
- app;
40
- options;
41
39
  constructor(app, options) {
42
40
  this.app = app;
43
41
  this.options = options;
@@ -35,8 +35,10 @@ function getCookie(name) {
35
35
  const ca = document.cookie.split(";");
36
36
  for (let i = 0; i < ca.length; i++) {
37
37
  let c = ca[i];
38
- while (c.charAt(0) === " ") c = c.substring(1, c.length);
39
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
38
+ while (c.charAt(0) === " ")
39
+ c = c.substring(1, c.length);
40
+ if (c.indexOf(nameEQ) === 0)
41
+ return c.substring(nameEQ.length, c.length);
40
42
  }
41
43
  return null;
42
44
  }
package/lib/data/index.js CHANGED
@@ -23,9 +23,6 @@ __export(data_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(data_exports);
25
25
  var Data = class {
26
- app;
27
- storage;
28
- store;
29
26
  constructor(app) {
30
27
  this.app = app;
31
28
  this.storage = app.storage;
@@ -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;