@pisell/core 1.0.1 → 1.0.3

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 (124) hide show
  1. package/es/app/app.d.ts +15 -54
  2. package/es/app/app.js +33 -48
  3. package/es/app/const.js +3 -3
  4. package/es/app/index.d.ts +1 -1
  5. package/es/app/index.js +9 -11
  6. package/es/applicationManager/application.d.ts +2 -2
  7. package/es/applicationManager/application.js +9 -12
  8. package/es/applicationManager/index.js +4 -4
  9. package/es/config.js +5 -5
  10. package/es/data/index.d.ts +8 -29
  11. package/es/data/index.js +16 -8
  12. package/es/history/config.js +5 -5
  13. package/es/history/index.d.ts +1 -1
  14. package/es/history/index.js +4 -4
  15. package/es/hooks/useDelayedValue/index.js +1 -1
  16. package/es/hooks/useLowCode/index.js +5 -5
  17. package/es/hooks/useStore/index.d.ts +2 -2
  18. package/es/index.d.ts +0 -2
  19. package/es/index.js +2 -2
  20. package/es/indexDB/index.d.ts +3 -1
  21. package/es/indexDB/index.js +28 -22
  22. package/es/locales/index.d.ts +30 -89
  23. package/es/locales/index.js +202 -243
  24. package/es/locales/type.d.ts +3 -3
  25. package/es/logger/feishu.js +2 -2
  26. package/es/logger/index.d.ts +1 -1
  27. package/es/logger/index.js +31 -23
  28. package/es/menuManager/hooks.d.ts +10 -1
  29. package/es/menuManager/hooks.js +4 -6
  30. package/es/menuManager/index.d.ts +1 -1
  31. package/es/menuManager/index.js +3 -3
  32. package/es/models/global.js +8 -7
  33. package/es/models/index.d.ts +6 -6
  34. package/es/models/index.js +1 -2
  35. package/es/pubsub/index.d.ts +1 -1
  36. package/es/pubsub/index.js +3 -3
  37. package/es/request/cache.d.ts +1 -1
  38. package/es/request/cache.js +7 -6
  39. package/es/request/config.js +7 -7
  40. package/es/request/index.js +12 -11
  41. package/es/request/pisell2Request.d.ts +1 -1
  42. package/es/request/pisell2Request.js +5 -5
  43. package/es/request/type.d.ts +1 -0
  44. package/es/request/utils.js +5 -3
  45. package/es/routes/index.d.ts +2 -2
  46. package/es/routes/index.js +11 -17
  47. package/es/socket/components/SocketMonitorPage.js +255 -462
  48. package/es/socket/events.js +3 -3
  49. package/es/socket/heartbeat.js +6 -7
  50. package/es/socket/index.js +7 -7
  51. package/es/socket/monitor.d.ts +1 -1
  52. package/es/socket/monitor.js +24 -15
  53. package/es/socket/reconnect.js +9 -9
  54. package/es/socket/socket.js +11 -13
  55. package/es/socket/types.d.ts +2 -1
  56. package/es/socket/types.js +23 -7
  57. package/es/storage/index.d.ts +17 -42
  58. package/es/storage/index.js +55 -61
  59. package/es/tasks/index.d.ts +1 -1
  60. package/es/tasks/index.js +46 -22
  61. package/es/tasks/type.d.ts +4 -4
  62. package/es/tasks/useTasks.d.ts +2 -1
  63. package/es/tasks/useTasks.js +1 -1
  64. package/es/variables/VariablesProvider.js +3 -5
  65. package/es/variables/config.js +5 -5
  66. package/es/variables/index.d.ts +3 -3
  67. package/lib/app/app.d.ts +15 -54
  68. package/lib/app/app.js +7 -10
  69. package/lib/app/index.d.ts +1 -1
  70. package/lib/applicationManager/application.d.ts +2 -2
  71. package/lib/data/index.d.ts +8 -29
  72. package/lib/data/index.js +8 -22
  73. package/lib/history/index.d.ts +1 -1
  74. package/lib/hooks/useStore/index.d.ts +2 -2
  75. package/lib/index.d.ts +0 -2
  76. package/lib/index.js +1 -7
  77. package/lib/indexDB/index.d.ts +3 -1
  78. package/lib/indexDB/index.js +8 -18
  79. package/lib/locales/index.d.ts +30 -89
  80. package/lib/locales/index.js +111 -124
  81. package/lib/locales/type.d.ts +3 -3
  82. package/lib/logger/index.d.ts +1 -1
  83. package/lib/menuManager/hooks.d.ts +10 -1
  84. package/lib/menuManager/index.d.ts +1 -1
  85. package/lib/models/index.d.ts +6 -6
  86. package/lib/models/index.js +1 -2
  87. package/lib/pubsub/index.d.ts +1 -1
  88. package/lib/request/cache.d.ts +1 -1
  89. package/lib/request/config.js +2 -12
  90. package/lib/request/index.js +5 -1
  91. package/lib/request/pisell2Request.d.ts +1 -1
  92. package/lib/request/type.d.ts +1 -0
  93. package/lib/request/utils.js +2 -0
  94. package/lib/routes/index.d.ts +2 -2
  95. package/lib/socket/monitor.d.ts +1 -1
  96. package/lib/socket/types.d.ts +2 -1
  97. package/lib/storage/index.d.ts +17 -42
  98. package/lib/storage/index.js +35 -38
  99. package/lib/tasks/index.d.ts +1 -1
  100. package/lib/tasks/type.d.ts +4 -4
  101. package/lib/tasks/useTasks.d.ts +2 -1
  102. package/lib/variables/VariablesProvider.js +1 -1
  103. package/lib/variables/index.d.ts +3 -3
  104. package/package.json +11 -4
  105. package/es/locales/config.d.ts +0 -24
  106. package/es/locales/config.js +0 -59
  107. package/es/models/tasks.d.ts +0 -31
  108. package/es/models/tasks.js +0 -331
  109. package/es/models/tasksUtils.d.ts +0 -65
  110. package/es/models/tasksUtils.js +0 -179
  111. package/es/storage/config.d.ts +0 -3
  112. package/es/storage/config.js +0 -16
  113. package/es/storage/type.d.ts +0 -5
  114. package/es/storage/type.js +0 -1
  115. package/lib/locales/config.d.ts +0 -24
  116. package/lib/locales/config.js +0 -66
  117. package/lib/models/tasks.d.ts +0 -31
  118. package/lib/models/tasks.js +0 -199
  119. package/lib/models/tasksUtils.d.ts +0 -65
  120. package/lib/models/tasksUtils.js +0 -160
  121. package/lib/storage/config.d.ts +0 -3
  122. package/lib/storage/config.js +0 -38
  123. package/lib/storage/type.d.ts +0 -5
  124. package/lib/storage/type.js +0 -17
@@ -29,143 +29,130 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/locales/index.ts
30
30
  var locales_exports = {};
31
31
  __export(locales_exports, {
32
- createTextsByLibrary: () => createTextsByLibrary,
33
- default: () => locales_default,
34
- getCurrentTexts: () => getCurrentTexts,
35
- getLibraryByData: () => getLibraryByData,
36
- getLocale: () => getLocale,
37
- getText: () => getText,
38
- isCN: () => isCN,
39
- loadLibrary: () => loadLibrary,
40
- loadLibraryByItems: () => loadLibraryByItems,
41
- loadLibraryByUrl: () => loadLibraryByUrl,
42
- setLocale: () => setLocale,
43
- translation: () => translation
32
+ Locales: () => Locales
44
33
  });
45
34
  module.exports = __toCommonJS(locales_exports);
46
- var import_config = require("./config");
47
35
  var import_lodash = __toESM(require("lodash"));
48
36
  var import_utils = require("@pisell/utils");
49
- var getLocale = () => {
50
- return (0, import_config.getConfig)().locale;
51
- };
52
- var getCurrentTexts = (locale) => {
53
- let config = (0, import_config.getConfig)();
54
- return config.library[locale || config.locale].translations;
55
- };
56
- var setLocale = (locale, reload = false) => {
57
- (0, import_config.setConfig)({ locale });
58
- if (reload) {
59
- window.location.reload();
60
- return;
61
- }
62
- };
63
- var getText = (id, locale) => {
64
- var _a;
65
- return ((_a = getCurrentTexts(locale)) == null ? void 0 : _a[id]) || id;
66
- };
67
- var isCN = () => {
68
- let locale = getLocale();
69
- return locale === "zh-CN" || locale === "zh-HK";
70
- };
71
- var loadLibraryByUrl = async (urls) => {
72
- try {
73
- let fetchList = urls.map((item) => {
74
- if (typeof item === "string") {
75
- return fetch(item);
76
- }
77
- if (typeof item === "function") {
78
- return item();
37
+ var import_en = __toESM(require("./en"));
38
+ var import_zh_CN = __toESM(require("./zh-CN"));
39
+ var import_zh_HK = __toESM(require("./zh-HK"));
40
+ var import_original = __toESM(require("./original"));
41
+ var Locales = class {
42
+ constructor(app, options) {
43
+ // 当前语言 本地语言 > 英文语言包
44
+ this.locale = import_en.default.locale;
45
+ // 语言包
46
+ this.library = [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default].reduce((pre, cur) => {
47
+ pre[cur.locale] = cur;
48
+ return pre;
49
+ }, {});
50
+ this.loadLibraryByUrl = async (urls) => {
51
+ try {
52
+ let fetchList = urls.map((item) => {
53
+ if (typeof item === "string") {
54
+ return fetch(item);
55
+ }
56
+ if (typeof item === "function") {
57
+ return item();
58
+ }
59
+ if (typeof item === "object" && item !== null && "locale" in item) {
60
+ return Promise.resolve(item);
61
+ }
62
+ return item;
63
+ });
64
+ let res = await Promise.all(fetchList);
65
+ let library = { ...this.library };
66
+ for (const item of res) {
67
+ const _item = item instanceof Response ? await item.json() : item;
68
+ library = {
69
+ ...library,
70
+ [_item.locale]: import_lodash.default.mergeWith(library[_item.locale] || {}, _item)
71
+ };
72
+ }
73
+ this.library = library;
74
+ return library;
75
+ } catch (err) {
76
+ console.log(err);
77
+ throw err;
79
78
  }
80
- if (typeof item === "object" && item !== null && "locale" in item) {
81
- return Promise.resolve(item);
82
- }
83
- return item;
84
- });
85
- let res = await Promise.all(fetchList);
86
- let library = { ...(0, import_config.getConfig)().library };
87
- for (const item of res) {
88
- const _item = item instanceof Response ? await item.json() : item;
79
+ };
80
+ this.app = app;
81
+ this.locale = (options == null ? void 0 : options.locale) || this.app.storage.getStorage("locale") || import_en.default.locale;
82
+ this.library = (options == null ? void 0 : options.library) || [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default].reduce((pre, cur) => {
83
+ pre[cur.locale] = cur;
84
+ return pre;
85
+ }, {});
86
+ }
87
+ getLocale() {
88
+ return this.locale;
89
+ }
90
+ getCurrentTexts(locale) {
91
+ return this.library[locale || this.locale].translations;
92
+ }
93
+ setLocale(locale, reload = false) {
94
+ this.locale = locale;
95
+ if (reload) {
96
+ window.location.reload();
97
+ return;
98
+ }
99
+ }
100
+ getText(id, locale) {
101
+ var _a;
102
+ return ((_a = this.getCurrentTexts(locale)) == null ? void 0 : _a[id]) || id;
103
+ }
104
+ isCN() {
105
+ let locale = this.getLocale();
106
+ return locale === "zh-CN" || locale === "zh-HK";
107
+ }
108
+ loadLibraryByItems(libraryList) {
109
+ let library = { ...this.library };
110
+ libraryList.forEach((item) => {
89
111
  library = {
90
112
  ...library,
91
- [_item.locale]: import_lodash.default.mergeWith(library[_item.locale] || {}, _item)
113
+ [item.locale]: import_lodash.default.mergeWith(library[item.locale] || {}, item)
92
114
  };
115
+ });
116
+ this.library = library;
117
+ }
118
+ loadLibrary(urls) {
119
+ return this.loadLibraryByUrl(urls);
120
+ }
121
+ translation(text, locale) {
122
+ if (!text) {
123
+ return "";
124
+ }
125
+ if ((0, import_utils.isString)(text) || (0, import_utils.isNumber)(text)) {
126
+ return text;
127
+ }
128
+ let primary = locale || this.getLocale();
129
+ if (typeof text === "string") {
130
+ return text;
93
131
  }
94
- (0, import_config.setConfig)({ library });
95
- return library;
96
- } catch (err) {
97
- console.log(err);
98
- throw err;
132
+ return text[primary] || text["original"] || text["en"] || text["zh-CN"] || text["zh-HK"];
99
133
  }
100
- };
101
- var loadLibraryByItems = (libraryList) => {
102
- let library = { ...(0, import_config.getConfig)().library };
103
- libraryList.forEach((item) => {
104
- library = {
105
- ...library,
106
- [item.locale]: import_lodash.default.mergeWith(library[item.locale] || {}, item)
107
- };
108
- });
109
- (0, import_config.setConfig)({ library });
110
- };
111
- var loadLibrary = async (urls) => {
112
- return loadLibraryByUrl(urls);
113
- };
114
- var translation = (text, locale) => {
115
- if (!text) {
116
- return "";
134
+ getLibraryByData(data) {
135
+ return data.reduce((pre, next) => {
136
+ return {
137
+ ...pre,
138
+ [next.locale]: next
139
+ };
140
+ }, {});
117
141
  }
118
- if ((0, import_utils.isString)(text) || (0, import_utils.isNumber)(text)) {
119
- return text;
142
+ createTextsByLibrary(id, library) {
143
+ const _library = library || this.library;
144
+ return Object.keys(_library).reduce((pre, next) => {
145
+ var _a;
146
+ let _pre = { ...pre };
147
+ let cur = (_a = _library[next].translations) == null ? void 0 : _a[id];
148
+ if (cur) {
149
+ _pre[_library[next].locale] = cur;
150
+ }
151
+ return _pre;
152
+ }, {});
120
153
  }
121
- let primary = locale || getLocale();
122
- return text[primary] || text["original"] || text["en"] || text["zh-CN"] || text["zh-HK"];
123
- };
124
- var getLibraryByData = (data) => {
125
- return data.reduce((pre, next) => {
126
- return {
127
- ...pre,
128
- [next.locale]: next
129
- };
130
- }, {});
131
- };
132
- var createTextsByLibrary = (id, library) => {
133
- const _library = library || (0, import_config.getConfig)().library;
134
- return Object.keys(_library).reduce((pre, next) => {
135
- var _a;
136
- let _pre = { ...pre };
137
- let cur = (_a = _library[next].translations) == null ? void 0 : _a[id];
138
- if (cur) {
139
- _pre[_library[next].locale] = cur;
140
- }
141
- return _pre;
142
- }, {});
143
- };
144
- var locales_default = {
145
- getLocale,
146
- getCurrentTexts,
147
- setLocale,
148
- getText,
149
- isCN,
150
- getConfig: import_config.getConfig,
151
- setConfig: import_config.setConfig,
152
- loadLibraryByUrl,
153
- translation,
154
- loadLibraryByItems,
155
- getLibraryByData,
156
- createTextsByLibrary
157
154
  };
158
155
  // Annotate the CommonJS export names for ESM import in node:
159
156
  0 && (module.exports = {
160
- createTextsByLibrary,
161
- getCurrentTexts,
162
- getLibraryByData,
163
- getLocale,
164
- getText,
165
- isCN,
166
- loadLibrary,
167
- loadLibraryByItems,
168
- loadLibraryByUrl,
169
- setLocale,
170
- translation
157
+ Locales
171
158
  });
@@ -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,8 +1,17 @@
1
1
  import React from "react";
2
2
  import { MenuItem } from "./index";
3
3
  export declare const isHttp: (url: string) => boolean;
4
+ export interface MenuContextType {
5
+ selectedKeys: string[];
6
+ openKeys: string[];
7
+ setOpenKeys: (keys: string[]) => void;
8
+ handleClick: (key: string) => void;
9
+ menuItems: MenuItem[];
10
+ getShowChildren: (children: MenuItem[]) => MenuItem[];
11
+ setMenuItems: (items: MenuItem[]) => void;
12
+ }
4
13
  export declare const MenuProvider: React.FC<{
5
14
  children: React.ReactNode;
6
15
  menus: MenuItem[];
7
16
  }>;
8
- export declare const useMenu: () => any;
17
+ export declare const useMenu: () => MenuContextType;
@@ -12,7 +12,7 @@ export declare class MenuManager {
12
12
  private menuItems;
13
13
  private menuMaps;
14
14
  private app;
15
- useMenu: () => any;
15
+ useMenu: () => import("./hooks").MenuContextType;
16
16
  MenuProvider: React.FC<{
17
17
  children: React.ReactNode;
18
18
  menus: MenuItem[];
@@ -1,7 +1,7 @@
1
1
  import hooks from '../hooks';
2
2
  import { Provider as StoreProvider } from "react-redux";
3
- declare const models: (import("./global").GlobalModal | import("./tasks").TasksModal)[];
4
- declare type ModalsType = (typeof models[number]);
3
+ declare const models: import("./global").GlobalModal[];
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 "tasks" | "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:
@@ -36,7 +36,7 @@ declare const getDataByModel: <T extends "tasks" | "global", D extends keyof Mod
36
36
  * @Author: zhiwei.Wang
37
37
  * @Date: 2024-09-08 15:17
38
38
  */
39
- declare const setDataByModel: <T extends "tasks" | "global", D extends keyof ModelsState[T]>(model: string, key: any, value: any) => void;
39
+ declare const setDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key: any, value: any) => void;
40
40
  declare const _default: {
41
41
  getStore: () => Store;
42
42
  StoreProvider: typeof StoreProvider;
@@ -35,9 +35,8 @@ module.exports = __toCommonJS(models_exports);
35
35
  var import_dva_core = require("dva-core");
36
36
  var import_hooks = __toESM(require("../hooks"));
37
37
  var import_global = __toESM(require("./global"));
38
- var import_tasks = __toESM(require("./tasks"));
39
38
  var import_react_redux = require("react-redux");
40
- var models = [import_global.default, import_tasks.default];
39
+ var models = [import_global.default];
41
40
  var app = (0, import_dva_core.create)();
42
41
  models.forEach((item) => app.model(item));
43
42
  var getStore = () => app._store;
@@ -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:
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/request/config.ts
@@ -34,11 +24,11 @@ __export(config_exports, {
34
24
  });
35
25
  module.exports = __toCommonJS(config_exports);
36
26
  var import_constants = require("./constants");
37
- var import_storage = __toESM(require("../storage"));
27
+ var import_storage = require("../storage");
38
28
  var import_lodash = require("lodash");
39
29
  var defaultConfig = {
40
30
  axiosConfig: import_constants.axiosConfig,
41
- storage: import_storage.default,
31
+ storage: new import_storage.Storage(),
42
32
  requestCallbacks: {
43
33
  200: (resData) => {
44
34
  const { res, props, resolve, reject, err } = resData;
@@ -48,7 +48,11 @@ var import_axios = __toESM(require("axios"));
48
48
  var import_config = require("./config");
49
49
  __reExport(request_exports, require("./type"), module.exports);
50
50
  var axiosInstance = import_axios.default.create(import_constants.axiosConfig);
51
- axiosInstance.interceptors.request.use(import_utils.interceptorsRequest, import_utils.interceptorsRequestError);
51
+ console.log("config1111");
52
+ axiosInstance.interceptors.request.use((config) => {
53
+ console.log("config11", config);
54
+ return config;
55
+ }, import_utils.interceptorsRequestError);
52
56
  axiosInstance.interceptors.response.use(import_utils.interceptorsResponse, import_utils.interceptorsResponseError);
53
57
  var createRequest = (props) => {
54
58
  const { data, config, method } = props;
@@ -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;
@@ -23,6 +23,7 @@ export interface CacheProps {
23
23
  key?: string;
24
24
  type?: CacheType;
25
25
  updateCache?: boolean;
26
+ cacheUpdateChange?: (data: any) => void;
26
27
  }
27
28
  export interface RequestSetting {
28
29
  abort?: boolean;
@@ -78,6 +78,7 @@ var interceptorsResponseError = (response) => {
78
78
  return (_b = (_a = (0, import_config.getConfig)()).interceptorsResponseError) == null ? void 0 : _b.call(_a, response);
79
79
  };
80
80
  var requestCallback = (resData) => {
81
+ var _a;
81
82
  const { res, props, resolve, reject, err } = resData;
82
83
  try {
83
84
  const { config } = props;
@@ -87,6 +88,7 @@ var requestCallback = (resData) => {
87
88
  if ((res == null ? void 0 : res.code) === 200) {
88
89
  if (config == null ? void 0 : config.cache) {
89
90
  (0, import_cache.setCacheData)(props.url, props.data, res, config == null ? void 0 : config.cache);
91
+ (_a = config == null ? void 0 : config.cacheUpdateChange) == null ? void 0 : _a.call(config, res);
90
92
  }
91
93
  }
92
94
  return codeFn(resData);
@@ -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): any;
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
  }
@@ -11,7 +11,7 @@ export interface SocketHistoryItem {
11
11
  /** 消息方向(发送/接收) */
12
12
  direction: 'in' | 'out';
13
13
  /** 消息内容 */
14
- message: SocketMessage;
14
+ message: SocketMessage | Partial<SocketMessage>;
15
15
  /** 消息大小(字节) */
16
16
  size?: number;
17
17
  }
@@ -45,6 +45,7 @@ export interface SocketMessage<T = any> {
45
45
  data?: T;
46
46
  /** 消息ID */
47
47
  id?: string;
48
+ event?: any;
48
49
  }
49
50
  /**
50
51
  * 心跳配置选项
@@ -75,7 +76,7 @@ export interface ReconnectOptions {
75
76
  /**
76
77
  * 事件处理函数类型
77
78
  */
78
- export declare type EventHandler = (...args: any[]) => void;
79
+ export type EventHandler = (...args: any[]) => void;
79
80
  /**
80
81
  * 事件处理函数映射
81
82
  */
@@ -1,42 +1,17 @@
1
- /**
2
- * @title: 创建storage的key
3
- * @description:
4
- * @param {string} key
5
- * @return {*}
6
- * @Author: zhiwei.Wang
7
- * @Date: 2024-09-08 14:52
8
- */
9
- export declare const createKey: (key: string) => string;
10
- /**
11
- * storage 的增删查, 同时更新 Preferences 内的数据
12
- * @param key
13
- * @param value
14
- */
15
- export declare const setStorage: (key: string, value: string) => void;
16
- /**
17
- * @title: 获取数据 --storage
18
- * @description:
19
- * @param {string} key
20
- * @return {*}
21
- * @Author: zhiwei.Wang
22
- * @Date: 2024-09-08 14:53
23
- */
24
- export declare const getStorage: (key: string) => string | null;
25
- /**
26
- * @title: 删除数据 --storage
27
- * @description:
28
- * @param {string} key
29
- * @return {*}
30
- * @Author: zhiwei.Wang
31
- * @Date: 2024-09-08 14:53
32
- */
33
- export declare const removeStorage: (key: string) => void;
34
- declare const _default: {
35
- setStorage: (key: string, value: string) => void;
36
- getStorage: (key: string) => string | null;
37
- removeStorage: (key: string) => void;
38
- createKey: (key: string) => string;
39
- setConfig: (newConfig: Partial<import("./type").StorageConfig>) => void;
40
- getConfig: () => import("./type").StorageConfig;
41
- };
42
- export default _default;
1
+ import App from '../app';
2
+ export interface StorageOptions {
3
+ storageKey?: string;
4
+ removeStorageAfter?: (key: string) => void;
5
+ setStorageAfter?: (key: string, value: string) => void;
6
+ }
7
+ export declare class Storage {
8
+ private storageKey;
9
+ private app?;
10
+ private options;
11
+ constructor(app?: App, options?: StorageOptions);
12
+ createKey(key: string): string;
13
+ setStorage(key: string, value: string): void;
14
+ getStorage(key: string): string | null;
15
+ removeStorage(key: string): void;
16
+ clear(): void;
17
+ }
@@ -19,48 +19,45 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/storage/index.ts
20
20
  var storage_exports = {};
21
21
  __export(storage_exports, {
22
- createKey: () => createKey,
23
- default: () => storage_default,
24
- getStorage: () => getStorage,
25
- removeStorage: () => removeStorage,
26
- setStorage: () => setStorage
22
+ Storage: () => Storage
27
23
  });
28
24
  module.exports = __toCommonJS(storage_exports);
29
- var import_config = require("./config");
30
- var getStorageKey = () => {
31
- return (0, import_config.getConfig)().STORAGE_KEY;
32
- };
33
- var createKey = (key) => {
34
- if (key.indexOf(getStorageKey()) !== -1) {
35
- return key;
25
+ var Storage = class {
26
+ constructor(app, options) {
27
+ this.storageKey = "CapacitorStorage.native_";
28
+ this.options = {};
29
+ this.app = app;
30
+ if (options) {
31
+ this.options = options;
32
+ }
33
+ if (options == null ? void 0 : options.storageKey) {
34
+ this.storageKey = options.storageKey;
35
+ }
36
+ }
37
+ createKey(key) {
38
+ if (key.indexOf(this.storageKey) !== -1) {
39
+ return key;
40
+ }
41
+ return this.storageKey + key;
42
+ }
43
+ setStorage(key, value) {
44
+ var _a, _b;
45
+ localStorage.setItem(this.createKey(key), value);
46
+ (_b = (_a = this.options) == null ? void 0 : _a.setStorageAfter) == null ? void 0 : _b.call(_a, key, value);
47
+ }
48
+ getStorage(key) {
49
+ return localStorage.getItem(this.createKey(key));
50
+ }
51
+ removeStorage(key) {
52
+ var _a, _b;
53
+ localStorage.removeItem(this.createKey(key));
54
+ (_b = (_a = this.options) == null ? void 0 : _a.removeStorageAfter) == null ? void 0 : _b.call(_a, key);
55
+ }
56
+ clear() {
57
+ localStorage.clear();
36
58
  }
37
- return getStorageKey() + key;
38
- };
39
- var setStorage = (key, value) => {
40
- var _a, _b;
41
- localStorage.setItem(createKey(key), value);
42
- (_b = (_a = (0, import_config.getConfig)()).setStorageAfter) == null ? void 0 : _b.call(_a, key, value);
43
- };
44
- var getStorage = (key) => {
45
- return localStorage.getItem(createKey(key));
46
- };
47
- var removeStorage = (key) => {
48
- var _a, _b;
49
- localStorage.removeItem(createKey(key));
50
- (_b = (_a = (0, import_config.getConfig)()).removeStorageAfter) == null ? void 0 : _b.call(_a, key);
51
- };
52
- var storage_default = {
53
- setStorage,
54
- getStorage,
55
- removeStorage,
56
- createKey,
57
- setConfig: import_config.setConfig,
58
- getConfig: import_config.getConfig
59
59
  };
60
60
  // Annotate the CommonJS export names for ESM import in node:
61
61
  0 && (module.exports = {
62
- createKey,
63
- getStorage,
64
- removeStorage,
65
- setStorage
62
+ Storage
66
63
  });
@@ -7,7 +7,7 @@ export declare class TasksManager {
7
7
  private app;
8
8
  private db;
9
9
  useTasks: () => {
10
- tasks: any;
10
+ tasks: TasksModule;
11
11
  };
12
12
  watchTaskCallback: (taskModule: TasksModule) => void;
13
13
  constructor(app: App);