@pisell/core 1.0.45 → 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 (57) hide show
  1. package/es/app/app.d.ts +8 -8
  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/history/index.d.ts +4 -3
  6. package/es/hooks/useStore/index.d.ts +1 -1
  7. package/es/locales/type.d.ts +3 -3
  8. package/es/logger/index.d.ts +1 -1
  9. package/es/models/index.d.ts +6 -5
  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 +68 -24
  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/type.d.ts +4 -4
  19. package/es/utils/adaptiveThrottle/index.d.ts +2 -2
  20. package/es/variables/index.d.ts +3 -3
  21. package/lib/app/app.d.ts +8 -8
  22. package/lib/app/index.d.ts +1 -1
  23. package/lib/applicationManager/application.d.ts +2 -2
  24. package/lib/aws/index.js +0 -3
  25. package/lib/cmd/const.d.ts +5 -5
  26. package/lib/cmd/const.js +5 -5
  27. package/lib/cmd/index.js +0 -2
  28. package/lib/cookie/index.js +4 -2
  29. package/lib/data/index.js +0 -3
  30. package/lib/history/index.d.ts +4 -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/models/index.d.ts +6 -5
  36. package/lib/pubsub/index.d.ts +1 -1
  37. package/lib/pubsub/index.js +3 -1
  38. package/lib/request/cache.d.ts +1 -1
  39. package/lib/request/config.js +5 -0
  40. package/lib/request/index.js +50 -21
  41. package/lib/request/pisell2Request.d.ts +1 -1
  42. package/lib/request/type.d.ts +6 -1
  43. package/lib/routes/index.d.ts +2 -2
  44. package/lib/routes/index.js +1 -3
  45. package/lib/socket/components/SocketMonitorPage.js +12 -6
  46. package/lib/socket/heartbeat.js +5 -10
  47. package/lib/socket/index.js +3 -1
  48. package/lib/socket/monitor.js +24 -26
  49. package/lib/socket/reconnect.js +3 -10
  50. package/lib/socket/socket.js +10 -12
  51. package/lib/socket/types.d.ts +1 -1
  52. package/lib/storage/index.js +24 -25
  53. package/lib/tasks/index.js +329 -333
  54. package/lib/tasks/type.d.ts +4 -4
  55. package/lib/utils/adaptiveThrottle/index.d.ts +2 -2
  56. package/lib/variables/index.d.ts +3 -3
  57. package/package.json +1 -1
package/es/app/app.d.ts CHANGED
@@ -43,17 +43,17 @@ declare class App {
43
43
  locales: Locales;
44
44
  models: {
45
45
  getStore: () => import("../models").Store;
46
- StoreProvider: any;
46
+ StoreProvider: typeof import("react-redux").Provider;
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,5 +1,6 @@
1
1
  import { LocationDescriptor } from "history";
2
2
  import type { History as HistoryType } from "history";
3
+ import { useHistory, useLocation, useParams } from "react-router-dom";
3
4
  import App from "../app";
4
5
  export interface HistoryOptions {
5
6
  basename?: string;
@@ -7,9 +8,9 @@ export interface HistoryOptions {
7
8
  }
8
9
  export declare class History {
9
10
  instance: HistoryType<unknown>;
10
- useHistory: any;
11
- useLocation: any;
12
- useParams: any;
11
+ useHistory: typeof useHistory;
12
+ useLocation: typeof useLocation;
13
+ useParams: typeof useParams;
13
14
  app: App;
14
15
  interceptor?: (path: LocationDescriptor<unknown>, state: unknown, next: () => void) => void;
15
16
  constructor(app: App, options?: HistoryOptions);
@@ -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
  */
@@ -1,6 +1,7 @@
1
1
  import hooks from '../hooks';
2
+ import { Provider as StoreProvider } from "react-redux";
2
3
  declare const models: import("./global").GlobalModal[];
3
- declare type ModalsType = (typeof models[number]);
4
+ type ModalsType = (typeof models[number]);
4
5
  export interface Store {
5
6
  getDataByModel: typeof getDataByModel;
6
7
  useStore: typeof hooks.useStore;
@@ -9,8 +10,8 @@ export interface Store {
9
10
  dispatch: any;
10
11
  getState: any;
11
12
  }
12
- export declare type ModelsNames = ModalsType['namespace'];
13
- export declare type ModelsState = {
13
+ export type ModelsNames = ModalsType['namespace'];
14
+ export type ModelsState = {
14
15
  [K in (ModalsType['namespace'])]: Extract<ModalsType, {
15
16
  namespace: K;
16
17
  }>['state'];
@@ -24,7 +25,7 @@ export declare type ModelsState = {
24
25
  * @Author: zhiwei.Wang
25
26
  * @Date: 2024-09-03 11:07
26
27
  */
27
- 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];
28
29
  /**
29
30
  * @title: 设置数据到store
30
31
  * @description:
@@ -38,7 +39,7 @@ declare const getDataByModel: <T extends "global", D extends keyof ModelsState[T
38
39
  declare const setDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key: any, value: any) => void;
39
40
  declare const _default: {
40
41
  getStore: () => Store;
41
- StoreProvider: any;
42
+ StoreProvider: typeof StoreProvider;
42
43
  setConfig: (models: any[]) => void;
43
44
  };
44
45
  export default _default;
@@ -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,44 +24,84 @@ 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
41
  method = props.method,
29
42
  url = props.url;
30
- var _getConfig = getConfig(),
31
- getUrl = _getConfig.getUrl;
43
+ var _getConfig2 = getConfig(),
44
+ getUrl = _getConfig2.getUrl,
45
+ logger = _getConfig2.logger;
32
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
+ });
33
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
+ }
34
74
  return new Promise(function (resolve, reject) {
35
75
  var _method = method === "remove" ? "delete" : method;
36
- var _url = getUrl === null || getUrl === void 0 ? void 0 : getUrl(props);
76
+ var _url = (getUrl === null || getUrl === void 0 ? void 0 : getUrl(props)) || '';
37
77
 
38
78
  // 请求完成处理函数
39
- var handleRequestComplete = function handleRequestComplete(result) {
40
- var isError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
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;
41
82
  try {
42
83
  var endTime = Date.now();
43
84
  var duration = endTime - startTime;
85
+ var maxRequestTime = (logger === null || logger === void 0 ? void 0 : logger.maxRequestTime) || 5000;
44
86
 
45
- // 如果请求超过5秒,触发日志报警
46
- if (duration > 5000) {
47
- var app = getApp();
48
- if (app !== null && app !== void 0 && app.logger) {
49
- app.logger.addLog({
50
- type: 'warning',
51
- title: '请求响应超过5秒',
52
- metadata: {
53
- url: _url || url,
54
- data: data,
55
- method: _method,
56
- duration: "".concat((duration / 1000).toFixed(2), "s"),
57
- timestamp: new Date(startTime).toISOString(),
58
- isError: isError
59
- }
60
- });
61
- }
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';
62
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
+ });
63
105
  } catch (error) {}
64
106
  return result;
65
107
  };
@@ -68,7 +110,7 @@ export var createRequest = function createRequest(props) {
68
110
  }, config), _objectSpread({
69
111
  params: !["post", "put"].includes(_method) ? data : null
70
112
  }, config)).then(function (res) {
71
- handleRequestComplete(res, false);
113
+ handleRequestComplete(_url, res, false, requestId);
72
114
  requestCallback({
73
115
  res: res,
74
116
  reject: reject,
@@ -76,13 +118,15 @@ export var createRequest = function createRequest(props) {
76
118
  props: props
77
119
  });
78
120
  }).catch(function (err) {
79
- handleRequestComplete(err, true);
121
+ handleRequestComplete(_url, err, true, requestId);
80
122
  requestCallback({
81
123
  err: err,
82
124
  reject: reject,
83
125
  resolve: resolve,
84
126
  props: props
85
127
  });
128
+ }).finally(function () {
129
+ requestCount--;
86
130
  });
87
131
  });
88
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
  */
@@ -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
@@ -43,17 +43,17 @@ declare class App {
43
43
  locales: Locales;
44
44
  models: {
45
45
  getStore: () => import("../models").Store;
46
- StoreProvider: any;
46
+ StoreProvider: typeof import("react-redux").Provider;
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,5 +1,6 @@
1
1
  import { LocationDescriptor } from "history";
2
2
  import type { History as HistoryType } from "history";
3
+ import { useHistory, useLocation, useParams } from "react-router-dom";
3
4
  import App from "../app";
4
5
  export interface HistoryOptions {
5
6
  basename?: string;
@@ -7,9 +8,9 @@ export interface HistoryOptions {
7
8
  }
8
9
  export declare class History {
9
10
  instance: HistoryType<unknown>;
10
- useHistory: any;
11
- useLocation: any;
12
- useParams: any;
11
+ useHistory: typeof useHistory;
12
+ useLocation: typeof useLocation;
13
+ useParams: typeof useParams;
13
14
  app: App;
14
15
  interceptor?: (path: LocationDescriptor<unknown>, state: unknown, next: () => void) => void;
15
16
  constructor(app: App, options?: HistoryOptions);
@@ -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;