@pisell/core 1.0.30 → 1.1.1

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.
@@ -18,18 +18,6 @@ export interface Task {
18
18
  count: number;
19
19
  timerId?: any;
20
20
  };
21
- scheduled?: {
22
- executeAt: string | string[];
23
- repeat?: boolean;
24
- repeatType?: 'daily' | 'weekly' | 'monthly' | 'yearly';
25
- repeatInterval?: number;
26
- endAt?: string;
27
- };
28
- scheduledResult?: {
29
- count: number;
30
- timerId?: any;
31
- nextExecuteTime?: string;
32
- };
33
21
  manual?: boolean;
34
22
  destroy?: boolean;
35
23
  [key: string]: any;
@@ -43,14 +31,6 @@ declare type TaskStatus = "uncompleted" | "completed";
43
31
  export interface TaskQueue {
44
32
  status: TaskStatus;
45
33
  tasks: Task[];
46
- isRunning?: boolean;
47
- progress?: {
48
- total: number;
49
- completed: number;
50
- failed: number;
51
- inProgress: number;
52
- };
53
- lastRunAt?: string;
54
34
  }
55
35
  export interface RunTaskParams {
56
36
  module: TaskModuleName;
@@ -67,33 +47,15 @@ export interface AddTaskParams {
67
47
  queueId: TaskQueueName;
68
48
  tasks: Task[];
69
49
  }
70
- export interface AddTaskDataParams {
71
- module: TaskModuleName;
72
- queueId: TaskQueueName;
73
- [key: string]: any;
74
- }
75
50
  export interface TaskRunResult {
76
51
  status: TaskRunStatus;
77
52
  [key: string]: any;
78
53
  }
79
- /**
80
- * 任务模块
81
- * 注意:'scheduledTasks' 是保留的模块名,专门用于定时任务
82
- * 在其他模块中,scheduled 配置会被忽略,任务将作为普通任务执行
83
- */
84
54
  export interface TasksModule {
85
55
  [key: TaskModuleName]: {
86
56
  [key: TaskQueueName]: {
87
57
  status: TaskStatus;
88
58
  tasks: Task[];
89
- isRunning?: boolean;
90
- progress?: {
91
- total: number;
92
- completed: number;
93
- failed: number;
94
- inProgress: number;
95
- };
96
- lastRunAt?: string;
97
59
  };
98
60
  };
99
61
  }
package/lib/app/app.d.ts CHANGED
@@ -8,8 +8,8 @@ import { MenuManager } from '../menuManager';
8
8
  import LoggerManager, { LoggerOptions } from '../logger';
9
9
  import { TasksManager } from '../tasks';
10
10
  import IndexDBManager, { DBOptions } from '../indexDB';
11
- import CMD, { CMDOptions } from "../cmd";
12
- import AWS, { AWSOptions } from "../aws";
11
+ import CMD from "../cmd";
12
+ import AWS from "../aws";
13
13
  declare global {
14
14
  interface Window {
15
15
  app: App;
@@ -22,9 +22,6 @@ export interface AppOptions {
22
22
  history?: HistoryOptions;
23
23
  storage?: StorageOptions;
24
24
  locales?: LocalesOptions;
25
- cmd?: CMDOptions;
26
- aws?: AWSOptions;
27
- getPisellos?: () => any;
28
25
  }
29
26
  declare class App {
30
27
  private static instance;
@@ -46,7 +43,7 @@ declare class App {
46
43
  post: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
47
44
  put: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
48
45
  remove: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
49
- custom: (url: string, config: import("../request").RequestSetting | undefined) => any;
46
+ custom: (url: string, config: import("../request").RequestSetting | undefined) => Promise<any>;
50
47
  setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
51
48
  getConfig: () => import("../request").RequestConfig;
52
49
  };
@@ -69,7 +66,6 @@ declare class App {
69
66
  cmd: CMD;
70
67
  aws: AWS;
71
68
  tasksManager: TasksManager;
72
- getPisellos: any;
73
69
  dbManager: IndexDBManager | null;
74
70
  constants: {
75
71
  channel: string;
package/lib/app/app.js CHANGED
@@ -92,8 +92,6 @@ var App = class _App {
92
92
  aws;
93
93
  // 任务管理
94
94
  tasksManager;
95
- // getPisellos
96
- getPisellos;
97
95
  dbManager = null;
98
96
  constants = {
99
97
  channel: ""
@@ -115,7 +113,6 @@ var App = class _App {
115
113
  this.tasksManager = new import_tasks.TasksManager(this);
116
114
  this.cmd = new import_cmd.default(this, options == null ? void 0 : options.cmd);
117
115
  this.aws = new import_aws.default(this, options == null ? void 0 : options.aws);
118
- this.getPisellos = options == null ? void 0 : options.getPisellos;
119
116
  if (options == null ? void 0 : options.constants) {
120
117
  this.constants = options.constants || {};
121
118
  }
@@ -72,10 +72,11 @@ declare class IndexDBManager {
72
72
  * 添加数据到指定的存储对象
73
73
  * @param {string} storeName - 存储对象名称
74
74
  * @param {T} data - 要添加的数据
75
+ * * @param {boolean} [log=true] - 是否记录日志
75
76
  * @returns {Promise<T>} 添加的数据
76
77
  * @template T
77
78
  */
78
- add<T>(storeName: string, data: T): Promise<T>;
79
+ add<T>(storeName: string, data: T, log?: boolean): Promise<T>;
79
80
  /**
80
81
  * 快速检查指定存储对象中的数据是否存在
81
82
  * @param {string} storeName - 存储对象名称
@@ -87,18 +88,20 @@ declare class IndexDBManager {
87
88
  * 获取指定存储对象中的数据
88
89
  * @param {string} storeName - 存储对象名称
89
90
  * @param {string|number} key - 数据主键
91
+ * * @param {boolean} [log=true] - 是否记录日志
90
92
  * @returns {Promise<T|null>} 获取的数据,不存在则返回 null
91
93
  * @template T
92
94
  */
93
- get<T>(storeName: string, key: string | number): Promise<T | null>;
95
+ get<T>(storeName: string, key: string | number, log?: boolean): Promise<T | null>;
94
96
  /**
95
97
  * 更新指定存储对象中的数据
96
98
  * @param {string} storeName - 存储对象名称
97
99
  * @param {T} data - 要更新的数据
100
+ * * @param {boolean} [log=true] - 是否记录日志
98
101
  * @returns {Promise<T>} 更新后的数据
99
102
  * @template T
100
103
  */
101
- update<T>(storeName: string, data: T): Promise<T>;
104
+ update<T>(storeName: string, data: T, log?: boolean): Promise<T>;
102
105
  /**
103
106
  * 删除指定存储对象中的数据
104
107
  * @param {string} storeName - 存储对象名称
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/indexDB/index.ts
@@ -22,6 +32,7 @@ __export(indexDB_exports, {
22
32
  default: () => indexDB_default
23
33
  });
24
34
  module.exports = __toCommonJS(indexDB_exports);
35
+ var import_dayjs = __toESM(require("dayjs"));
25
36
  var IndexDBManager = class _IndexDBManager {
26
37
  /**
27
38
  * 检查环境是否支持 IndexedDB
@@ -92,29 +103,87 @@ var IndexDBManager = class _IndexDBManager {
92
103
  return `${this.dbName}_${storeName}${key ? `_${key}` : ""}`;
93
104
  }
94
105
  /**
95
- * 添加数据到指定的存储对象
96
- * @param {string} storeName - 存储对象名称
97
- * @param {T} data - 要添加的数据
98
- * @returns {Promise<T>} 添加的数据
99
- * @template T
100
- */
101
- async add(storeName, data) {
106
+ * 添加数据到指定的存储对象
107
+ * @param {string} storeName - 存储对象名称
108
+ * @param {T} data - 要添加的数据
109
+ * * @param {boolean} [log=true] - 是否记录日志
110
+ * @returns {Promise<T>} 添加的数据
111
+ * @template T
112
+ */
113
+ async add(storeName, data, log) {
102
114
  var _a;
103
115
  if (!this.useIndexDB) {
104
116
  const key = this.getStorageKey(storeName, data[((_a = this.stores.find((s) => s.name === storeName)) == null ? void 0 : _a.keyPath) || "id"]);
105
117
  this.app.storage.setStorage(key, JSON.stringify(data));
106
118
  return data;
107
119
  }
120
+ const uuid = `[ IndexDB ] ADD: - ${storeName} - ${(0, import_dayjs.default)().valueOf()}`;
108
121
  return new Promise((resolve, reject) => {
109
122
  if (!this.db) {
123
+ if (log) {
124
+ this.app.logger.addLog({
125
+ type: "info",
126
+ title: uuid,
127
+ metadata: { msg: "添加数据前", data }
128
+ });
129
+ }
110
130
  reject(new Error("数据库未连接"));
111
131
  return;
112
132
  }
113
133
  const transaction = this.db.transaction(storeName, "readwrite");
114
134
  const store = transaction.objectStore(storeName);
115
135
  const request = store.add(data);
116
- request.onsuccess = () => resolve(data);
117
- request.onerror = () => reject(new Error("添加数据失败"));
136
+ request.onsuccess = () => {
137
+ if (log) {
138
+ this.app.logger.addLog({
139
+ type: "info",
140
+ title: uuid,
141
+ metadata: { msg: "添加数据成功" }
142
+ });
143
+ }
144
+ return resolve(data);
145
+ };
146
+ request.onerror = () => {
147
+ if (log) {
148
+ this.app.logger.addLog({
149
+ type: "info",
150
+ title: uuid,
151
+ metadata: { msg: "添加数据失败" }
152
+ });
153
+ }
154
+ return reject(new Error("添加数据失败"));
155
+ };
156
+ transaction.oncomplete = () => {
157
+ console.log("✅ 添加事务完成");
158
+ if (log) {
159
+ this.app.logger.addLog({
160
+ type: "info",
161
+ title: uuid,
162
+ metadata: { msg: "事务完成" }
163
+ });
164
+ }
165
+ return;
166
+ };
167
+ transaction.onerror = (e) => {
168
+ if (log) {
169
+ this.app.logger.addLog({
170
+ type: "info",
171
+ title: uuid,
172
+ metadata: { msg: "事务错误" }
173
+ });
174
+ }
175
+ return reject(transaction.error ?? new Error("事务错误"));
176
+ };
177
+ transaction.onabort = (e) => {
178
+ if (log) {
179
+ this.app.logger.addLog({
180
+ type: "info",
181
+ title: uuid,
182
+ metadata: { msg: "事务被中止" }
183
+ });
184
+ }
185
+ return reject(new Error("事务被中止"));
186
+ };
118
187
  });
119
188
  }
120
189
  /**
@@ -144,10 +213,19 @@ var IndexDBManager = class _IndexDBManager {
144
213
  * 获取指定存储对象中的数据
145
214
  * @param {string} storeName - 存储对象名称
146
215
  * @param {string|number} key - 数据主键
216
+ * * @param {boolean} [log=true] - 是否记录日志
147
217
  * @returns {Promise<T|null>} 获取的数据,不存在则返回 null
148
218
  * @template T
149
219
  */
150
- async get(storeName, key) {
220
+ async get(storeName, key, log) {
221
+ const uuid = `[ IndexDB ] GET: - ${storeName} - ${key} - ${(0, import_dayjs.default)().valueOf()}`;
222
+ if (log) {
223
+ this.app.logger.addLog({
224
+ type: "info",
225
+ title: uuid,
226
+ metadata: { msg: "获取数据前" }
227
+ });
228
+ }
151
229
  if (!this.useIndexDB) {
152
230
  const storageKey = this.getStorageKey(storeName, key);
153
231
  let data = this.app.storage.getStorage(storageKey);
@@ -158,40 +236,159 @@ var IndexDBManager = class _IndexDBManager {
158
236
  }
159
237
  return new Promise((resolve, reject) => {
160
238
  if (!this.db) {
239
+ if (log) {
240
+ this.app.logger.addLog({
241
+ type: "info",
242
+ title: uuid,
243
+ metadata: { msg: "数据库未连接" }
244
+ });
245
+ }
161
246
  reject(new Error("数据库未连接"));
162
247
  return;
163
248
  }
164
- const transaction = this.db.transaction(storeName, "readonly");
165
- const store = transaction.objectStore(storeName);
166
- const request = store.get(key);
167
- request.onsuccess = () => resolve(request.result || null);
168
- request.onerror = () => reject(new Error("获取数据失败"));
249
+ let resolved = false;
250
+ try {
251
+ const transaction = this.db.transaction(storeName, "readonly");
252
+ const store = transaction.objectStore(storeName);
253
+ const request = store.get(key);
254
+ request.onsuccess = () => {
255
+ resolved = true;
256
+ if (log) {
257
+ this.app.logger.addLog({
258
+ type: "info",
259
+ title: uuid,
260
+ metadata: { msg: "获取成功" }
261
+ });
262
+ }
263
+ resolve(request.result ?? null);
264
+ };
265
+ request.onerror = () => {
266
+ resolved = true;
267
+ if (log) {
268
+ this.app.logger.addLog({
269
+ type: "info",
270
+ title: uuid,
271
+ metadata: { msg: "获取失败" }
272
+ });
273
+ }
274
+ reject(request.error ?? new Error("获取数据失败"));
275
+ };
276
+ transaction.onabort = () => {
277
+ if (log) {
278
+ this.app.logger.addLog({
279
+ type: "info",
280
+ title: uuid,
281
+ metadata: { msg: "事务被中止" }
282
+ });
283
+ }
284
+ if (!resolved) reject(new Error("事务被中止"));
285
+ };
286
+ transaction.onerror = (event) => {
287
+ if (log) {
288
+ this.app.logger.addLog({
289
+ type: "info",
290
+ title: uuid,
291
+ metadata: { msg: `事务错误: ${event.target.error}` }
292
+ });
293
+ }
294
+ if (!resolved) reject(new Error(`事务错误: ${event.target.error}`));
295
+ };
296
+ transaction.oncomplete = () => {
297
+ if (log) {
298
+ this.app.logger.addLog({
299
+ type: "info",
300
+ title: uuid,
301
+ metadata: { msg: "事务完成" }
302
+ });
303
+ }
304
+ };
305
+ } catch (e) {
306
+ reject(e);
307
+ }
169
308
  });
170
309
  }
171
310
  /**
172
311
  * 更新指定存储对象中的数据
173
312
  * @param {string} storeName - 存储对象名称
174
313
  * @param {T} data - 要更新的数据
314
+ * * @param {boolean} [log=true] - 是否记录日志
175
315
  * @returns {Promise<T>} 更新后的数据
176
316
  * @template T
177
317
  */
178
- async update(storeName, data) {
318
+ async update(storeName, data, log) {
179
319
  var _a;
180
320
  if (!this.useIndexDB) {
181
321
  const key = this.getStorageKey(storeName, data[((_a = this.stores.find((s) => s.name === storeName)) == null ? void 0 : _a.keyPath) || "id"]);
182
322
  this.app.storage.setStorage(key, JSON.stringify(data));
183
323
  return data;
184
324
  }
325
+ const uuid = `[ IndexDB ] UPDATE: - ${storeName} - ${(0, import_dayjs.default)().valueOf()}`;
326
+ if (log) {
327
+ this.app.logger.addLog({
328
+ type: "info",
329
+ title: uuid,
330
+ metadata: { msg: "更新数据前", data }
331
+ });
332
+ }
185
333
  return new Promise((resolve, reject) => {
186
334
  if (!this.db) {
335
+ if (log) {
336
+ this.app.logger.addLog({
337
+ type: "info",
338
+ title: uuid,
339
+ metadata: { msg: "数据库未连接" }
340
+ });
341
+ }
187
342
  reject(new Error("数据库未连接"));
188
343
  return;
189
344
  }
190
- const transaction = this.db.transaction(storeName, "readwrite");
191
- const store = transaction.objectStore(storeName);
192
- const request = store.put(data);
193
- request.onsuccess = () => resolve(data);
194
- request.onerror = () => reject(new Error("更新数据失败"));
345
+ try {
346
+ const transaction = this.db.transaction(storeName, "readwrite");
347
+ const store = transaction.objectStore(storeName);
348
+ const request = store.put(data);
349
+ request.onsuccess = () => {
350
+ this.app.logger.addLog({
351
+ type: "info",
352
+ title: uuid,
353
+ metadata: { msg: "数据更新完成" }
354
+ });
355
+ return resolve(data);
356
+ };
357
+ request.onerror = () => {
358
+ this.app.logger.addLog({
359
+ type: "info",
360
+ title: uuid,
361
+ metadata: { msg: "数据更新失败" }
362
+ });
363
+ return reject(request.error ?? new Error("更新数据失败"));
364
+ };
365
+ transaction.oncomplete = () => {
366
+ this.app.logger.addLog({
367
+ type: "info",
368
+ title: uuid,
369
+ metadata: { msg: "事务完成" }
370
+ });
371
+ return console.log("✅ 事务完成");
372
+ };
373
+ transaction.onabort = (e) => {
374
+ this.app.logger.addLog({
375
+ type: "info",
376
+ title: uuid,
377
+ metadata: { msg: "事务被中止" }
378
+ });
379
+ return reject(new Error("事务被中止"));
380
+ };
381
+ transaction.onerror = (e) => {
382
+ this.app.logger.addLog({
383
+ type: "info",
384
+ title: uuid,
385
+ metadata: { msg: "事务错误" }
386
+ });
387
+ return reject(transaction.error ?? new Error("事务错误"));
388
+ };
389
+ } catch (e) {
390
+ reject(e);
391
+ }
195
392
  });
196
393
  }
197
394
  /**
@@ -32,7 +32,7 @@ export declare const getCacheData: (url: string, data: any, cache: CacheProps) =
32
32
  * @return {*}
33
33
  * @Author: zhiwei.Wang
34
34
  */
35
- export declare const setCacheData: (url: string, data: any, res: any, cache?: CacheProps) => any | null;
35
+ export declare const setCacheData: (url: string, data: any, res: any, cache: CacheProps) => any | null;
36
36
  /**
37
37
  * @title: 缓存函数包装器
38
38
  * @description:
@@ -38,14 +38,12 @@ __export(cache_exports, {
38
38
  module.exports = __toCommonJS(cache_exports);
39
39
  var import_js_md5 = __toESM(require("js-md5"));
40
40
  var import_config = require("./config");
41
- var import_type = require("./type");
42
41
  var import_app = require("../app");
43
42
  var CACHES = {};
44
43
  var MAX_CACHE_TIME = 7 * 60 * 60 * 1e3;
45
44
  var createCacheKey = (url, data, cache) => {
46
45
  const { storage } = (0, import_config.getConfig)();
47
- let _data = (cache == null ? void 0 : cache.cacheKeyData) || data;
48
- return cache.key ? storage.createKey(cache.key) : (0, import_js_md5.default)(`${url}_${JSON.stringify(_data)}`);
46
+ return cache.key ? storage.createKey(cache.key) : (0, import_js_md5.default)(`${url}_${JSON.stringify(data)}`);
49
47
  };
50
48
  var setCache = async (key, data, cache) => {
51
49
  const { storage } = (0, import_config.getConfig)();
@@ -79,9 +77,6 @@ var getIsEffectiveTime = (time) => {
79
77
  var getCache = async (key, cache) => {
80
78
  const { storage } = (0, import_config.getConfig)();
81
79
  if (cache.type === "memory") {
82
- if (!CACHES[key]) {
83
- return null;
84
- }
85
80
  if (getIsEffectiveTime(CACHES[key].time)) {
86
81
  return CACHES[key].data;
87
82
  }
@@ -127,47 +122,15 @@ var getCacheData = async (url, data, cache) => {
127
122
  const res = await getCache(_key, cache);
128
123
  return res;
129
124
  };
130
- var setCacheData = (url, data, res, cache = {
131
- type: "memory"
132
- }) => {
125
+ var setCacheData = (url, data, res, cache) => {
133
126
  let _key = createCacheKey(url, data, cache);
134
127
  setCache(_key, res, cache);
135
128
  };
136
- var getIsCache = (config) => {
137
- var _a, _b;
138
- if (!(config == null ? void 0 : config.cache) && !(config == null ? void 0 : config.useCache)) {
139
- return false;
140
- }
141
- const cache = (config == null ? void 0 : config.cache) || {};
142
- if (cache.mode === import_type.RequestModeENUM.LOCAL) {
143
- return true;
144
- }
145
- if (cache.mode === import_type.RequestModeENUM.REMOTE) {
146
- return false;
147
- }
148
- if (cache.mode === import_type.RequestModeENUM.LOCAL_REMOTE) {
149
- return true;
150
- }
151
- if (cache.mode === import_type.RequestModeENUM.REMOTE_LOCAL) {
152
- if ((_b = (_a = (0, import_app.getApp)()) == null ? void 0 : _a.getPlugin("network")) == null ? void 0 : _b.connected) {
153
- return false;
154
- }
155
- return true;
156
- }
157
- return true;
158
- };
159
129
  var cacheFn = async (props, fn) => {
160
130
  var _a;
161
131
  const { url, data, config } = props;
162
- const isCache = getIsCache(config);
163
- if (isCache) {
164
- let cache = config.cache;
165
- if (config.useCache) {
166
- cache = {
167
- type: "memory"
168
- };
169
- }
170
- let _data = await getCacheData(url, data, cache);
132
+ if (config == null ? void 0 : config.cache) {
133
+ let _data = await getCacheData(url, data, config.cache);
171
134
  if (_data) {
172
135
  if ((_a = config.cache) == null ? void 0 : _a.updateCache) {
173
136
  fn({
@@ -175,7 +138,7 @@ var cacheFn = async (props, fn) => {
175
138
  config: {
176
139
  ...props.config,
177
140
  cache: {
178
- ...cache,
141
+ ...props.config.cache,
179
142
  updateCache: false
180
143
  }
181
144
  }
@@ -5,19 +5,19 @@ export declare const createRequest: (props: RequestWrapperProps) => Promise<unkn
5
5
  * @param props
6
6
  * @returns
7
7
  */
8
- export declare const request: (props: RequestWrapperProps) => any;
8
+ export declare const request: (props: RequestWrapperProps) => Promise<any>;
9
9
  export declare const get: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
10
10
  export declare const post: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
11
11
  export declare const put: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
12
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;
13
+ export declare const custom: (url: RequestWrapperProps["url"], config: RequestWrapperProps["config"]) => Promise<any>;
14
14
  export * from "./type";
15
15
  declare const _default: {
16
16
  get: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
17
17
  post: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
18
18
  put: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
19
19
  remove: (url: string, data: any, config: import("./type").RequestSetting | undefined) => Promise<any>;
20
- custom: (url: string, config: import("./type").RequestSetting | undefined) => any;
20
+ custom: (url: string, config: import("./type").RequestSetting | undefined) => Promise<any>;
21
21
  setConfig: (newConfig: Partial<RequestConfig>) => void;
22
22
  getConfig: () => RequestConfig;
23
23
  };
@@ -46,7 +46,6 @@ var import_cache = require("./cache");
46
46
  var import_utils = require("./utils");
47
47
  var import_axios = __toESM(require("axios"));
48
48
  var import_config = require("./config");
49
- var import_app = require("../app");
50
49
  __reExport(request_exports, require("./type"), module.exports);
51
50
  var axiosInstance = import_axios.default.create(import_constants.axiosConfig);
52
51
  axiosInstance.interceptors.request.use(import_utils.interceptorsRequest, import_utils.interceptorsRequestError);
@@ -75,19 +74,11 @@ var createRequest = (props) => {
75
74
  });
76
75
  };
77
76
  var request = (props) => {
78
- var _a, _b, _c, _d, _e;
79
- const { config, url, method } = props;
77
+ const { config, url } = props;
80
78
  if (config == null ? void 0 : config.abort) {
81
79
  let signal = (0, import_cancelToken.createSignal)(config.abort, url);
82
80
  config.signal = signal;
83
81
  }
84
- if (config == null ? void 0 : config.osServer) {
85
- const app = (0, import_app.getApp)();
86
- const pisellos = (_a = app.getPisellos) == null ? void 0 : _a.call(app);
87
- if ((pisellos == null ? void 0 : pisellos.server) && ((_c = (_b = pisellos == null ? void 0 : pisellos.server) == null ? void 0 : _b.hasRoute) == null ? void 0 : _c.call(_b, method, url))) {
88
- return (_e = (_d = pisellos == null ? void 0 : pisellos.server) == null ? void 0 : _d.handleRoute) == null ? void 0 : _e.call(_d, method, url, props);
89
- }
90
- }
91
82
  return (0, import_cache.cacheFn)(props, createRequest);
92
83
  };
93
84
  var get = async (url, data, config) => {
@@ -19,21 +19,11 @@ export interface RequestConfig {
19
19
  [key: string]: any;
20
20
  };
21
21
  }
22
- export declare enum RequestModeENUM {
23
- LOCAL = "local",
24
- REMOTE = "remote",
25
- LOCAL_REMOTE = "local_remote",
26
- REMOTE_LOCAL = "remote_local",
27
- OS_SERVER = "os_server"
28
- }
29
- export declare type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
30
22
  export interface CacheProps {
31
23
  key?: string;
32
24
  type?: CacheType;
33
25
  updateCache?: boolean;
34
26
  cacheUpdateChange?: (data: any) => void;
35
- mode?: RequestModeType;
36
- cacheKeyData?: any;
37
27
  }
38
28
  export interface RequestSetting {
39
29
  abort?: boolean;
@@ -41,7 +31,6 @@ export interface RequestSetting {
41
31
  cache?: CacheProps;
42
32
  signal?: any;
43
33
  token?: string;
44
- osServer?: boolean;
45
34
  [key: string]: any;
46
35
  }
47
36
  export interface RequestWrapperProps {