@pisell/core 1.0.9 → 1.0.11

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.
@@ -0,0 +1,96 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
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
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/cmd/index.ts
30
+ var cmd_exports = {};
31
+ __export(cmd_exports, {
32
+ CMDCoreEnum: () => import_const.CMDCoreEnum,
33
+ default: () => cmd_default
34
+ });
35
+ module.exports = __toCommonJS(cmd_exports);
36
+ var import_socket = __toESM(require("../socket"));
37
+ var import_const = require("./const");
38
+ var CMD = class {
39
+ app;
40
+ options;
41
+ constructor(app, options) {
42
+ this.app = app;
43
+ this.options = options;
44
+ }
45
+ init() {
46
+ var _a, _b;
47
+ if (!((_a = this.options) == null ? void 0 : _a.socketUrl)) {
48
+ return;
49
+ }
50
+ const cmdSocket = import_socket.default.create(
51
+ (_b = this.options) == null ? void 0 : _b.socketUrl,
52
+ {
53
+ autoConnect: false,
54
+ // 自动连接
55
+ reconnection: true,
56
+ // 启用断线重连
57
+ heartbeat: true,
58
+ // 启用心跳检测
59
+ heartbeatInterval: 3e4,
60
+ // 心跳间隔(毫秒)
61
+ heartbeatTimeout: 5e4
62
+ // 请求超时时间(毫秒)
63
+ },
64
+ "front_cmd"
65
+ // Socket标识键
66
+ );
67
+ cmdSocket.on("connect", (res) => {
68
+ this.app.pubsub.publish(import_const.CMDCoreEnum.CMD_CONNECT, res);
69
+ this.app.logger.addLog({ type: "info", title: "cmdSocket连接成功", metadata: res });
70
+ });
71
+ cmdSocket.on("disconnect", (res) => {
72
+ this.app.pubsub.publish(import_const.CMDCoreEnum.CMD_DISCONNECT, res);
73
+ this.app.logger.addLog({ type: "info", title: "cmdSocket连接断开", metadata: res });
74
+ });
75
+ cmdSocket.on("reconnect", (res) => {
76
+ this.app.pubsub.publish(import_const.CMDCoreEnum.CMD_RECONNECT, res);
77
+ this.app.logger.addLog({ type: "info", title: "cmdSocket重连", metadata: res });
78
+ });
79
+ cmdSocket.on("message", (res) => {
80
+ this.app.pubsub.publish(import_const.CMDCoreEnum.CMD_MESSAGE, res);
81
+ this.app.logger.addLog({ type: "info", title: "cmdSocket收到消息", metadata: res });
82
+ });
83
+ cmdSocket.on("error", (res) => {
84
+ this.app.pubsub.publish(import_const.CMDCoreEnum.CMD_ERROR, res);
85
+ this.app.logger.addLog({ type: "info", title: "cmdSocket连接错误", metadata: res });
86
+ });
87
+ cmdSocket.connect().catch((error) => {
88
+ this.app.logger.addLog({ type: "info", title: "cmdSocket连接失败", metadata: error });
89
+ });
90
+ }
91
+ };
92
+ var cmd_default = CMD;
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ CMDCoreEnum
96
+ });
@@ -0,0 +1,5 @@
1
+ export interface CDMItem {
2
+ key: string;
3
+ code: string;
4
+ [key: string]: any;
5
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/cmd/type.ts
16
+ var type_exports = {};
17
+ module.exports = __toCommonJS(type_exports);
@@ -4,10 +4,12 @@ export declare type LogConsoleType = "info" | "warning" | "error" | "debug";
4
4
  * 日志项接口
5
5
  */
6
6
  interface LogItem {
7
+ logId?: string | number;
7
8
  type: LogConsoleType;
8
9
  title: string;
9
10
  date?: string;
10
11
  metadata?: any;
12
+ feishu?: any;
11
13
  }
12
14
  interface LogFile {
13
15
  fileName: string;
@@ -38,6 +40,7 @@ declare class LoggerManager {
38
40
  private feishuConfig;
39
41
  private retentionDays;
40
42
  private metadataFunction;
43
+ private status;
41
44
  /**
42
45
  * 构造函数
43
46
  * @param prefix 日志前缀
@@ -59,6 +62,8 @@ declare class LoggerManager {
59
62
  * 初始化定时器
60
63
  */
61
64
  initTimer(): void;
65
+ private setStatus;
66
+ stop(): void;
62
67
  /**
63
68
  * 添加日志
64
69
  * @param log 日志项
@@ -74,6 +79,12 @@ declare class LoggerManager {
74
79
  * @returns 日志文件名
75
80
  */
76
81
  private createFileName;
82
+ /**
83
+ * 创建AWS日志文件名
84
+ * @param isManual 是否手动上传
85
+ * @returns 日志文件名
86
+ */
87
+ createAWSFileName(isManual?: boolean): Promise<any>;
77
88
  /**
78
89
  * 创建日志文件
79
90
  * @param _fileName 文件名
@@ -83,7 +94,8 @@ declare class LoggerManager {
83
94
  /**
84
95
  * 存储日志到持久化存储
85
96
  */
86
- private storeLog;
97
+ storeLog(): Promise<void>;
98
+ private storeLogToIndexDB;
87
99
  /**
88
100
  * 清理旧日志,只保留最近指定天数的日志
89
101
  */
@@ -52,6 +52,8 @@ var LoggerManager = class {
52
52
  retentionDays;
53
53
  // 日志保留天数
54
54
  metadataFunction;
55
+ status = "running";
56
+ // 日志管理器状态
55
57
  /**
56
58
  * 构造函数
57
59
  * @param prefix 日志前缀
@@ -66,6 +68,7 @@ var LoggerManager = class {
66
68
  this.initDB();
67
69
  }
68
70
  init() {
71
+ this.setStatus("running");
69
72
  this.initTimer();
70
73
  this.cleanupOldLogs();
71
74
  }
@@ -97,19 +100,34 @@ var LoggerManager = class {
97
100
  }
98
101
  }, this.checkInterval);
99
102
  }
103
+ setStatus(status) {
104
+ this.status = status;
105
+ }
106
+ stop() {
107
+ this.setStatus("stop");
108
+ if (this.timer) {
109
+ clearInterval(this.timer);
110
+ }
111
+ }
100
112
  /**
101
113
  * 添加日志
102
114
  * @param log 日志项
103
115
  */
104
116
  addLog(log) {
117
+ if (this.status === "stop") {
118
+ return;
119
+ }
120
+ const { feishu, ...restLog } = log || {};
105
121
  const logItem = {
106
- ...log,
122
+ ...restLog,
107
123
  date: log.date || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
108
- metadata: JSON.stringify(log.metadata || "{}")
124
+ metadata: JSON.stringify(log.metadata || {}),
125
+ // 以时间戳生成logId
126
+ logId: (0, import_dayjs.default)().valueOf()
109
127
  };
110
128
  console.log("---- 行为日志", logItem);
111
129
  if (log.type === "error") {
112
- this.sendFeishuNotification(logItem);
130
+ this.sendFeishuNotification({ ...logItem || {}, feishu });
113
131
  }
114
132
  this.logBuffer.push(logItem);
115
133
  }
@@ -121,14 +139,19 @@ var LoggerManager = class {
121
139
  var _a;
122
140
  if (this.feishuConfig) {
123
141
  const _metadata = ((_a = this.metadataFunction) == null ? void 0 : _a.call(this)) || {};
142
+ const content = [
143
+ { key: "日志类型", value: log.type },
144
+ { key: "日志时间", value: log.date || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss") },
145
+ { key: "日志来源", value: JSON.stringify({ ...this.metadata || {}, ..._metadata }) }
146
+ ];
147
+ if (log.feishu) {
148
+ content.push({ key: "日志内容", value: JSON.stringify(log.feishu || {}) });
149
+ } else {
150
+ content.push({ key: "日志内容", value: JSON.stringify(log.metadata || {}) });
151
+ }
124
152
  (0, import_feishu.sendWarningLog)({
125
153
  title: log.title,
126
- content: [
127
- { key: "日志类型", value: log.type },
128
- { key: "日志时间", value: log.date || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss") },
129
- { key: "日志来源", value: JSON.stringify({ ...this.metadata || {}, ..._metadata }) },
130
- { key: "日志内容", value: JSON.stringify(log.metadata) }
131
- ],
154
+ content,
132
155
  webhook: this.feishuConfig.webhook
133
156
  });
134
157
  console.log("-------- 发送飞书通知", log);
@@ -143,6 +166,28 @@ var LoggerManager = class {
143
166
  const fileName = `${this.prefix}_${_date}.log`;
144
167
  return fileName;
145
168
  }
169
+ /**
170
+ * 创建AWS日志文件名
171
+ * @param isManual 是否手动上传
172
+ * @returns 日志文件名
173
+ */
174
+ async createAWSFileName(isManual) {
175
+ var _a, _b, _c, _d;
176
+ const _date = (0, import_dayjs.default)().format("YYYY-MM-DD");
177
+ const _hour = (0, import_dayjs.default)().format("HH:mm");
178
+ if ((_b = (_a = this.app) == null ? void 0 : _a.getPlugin("aws")) == null ? void 0 : _b.getFileName) {
179
+ return (_d = (_c = this.app) == null ? void 0 : _c.getPlugin("aws")) == null ? void 0 : _d.getFileName({
180
+ date: _date,
181
+ hour: _hour,
182
+ isManual
183
+ });
184
+ }
185
+ let fileName = `logs/${"pisell"}/${_date}/${_hour}`;
186
+ if (isManual) {
187
+ fileName += "-manual";
188
+ }
189
+ return `${fileName}.json`;
190
+ }
146
191
  /**
147
192
  * 创建日志文件
148
193
  * @param _fileName 文件名
@@ -164,26 +209,48 @@ var LoggerManager = class {
164
209
  * 存储日志到持久化存储
165
210
  */
166
211
  async storeLog() {
212
+ var _a;
167
213
  if (this.logBuffer.length === 0 || !this.db) {
168
214
  return;
169
215
  }
170
- const fileName = this.createFileName();
171
216
  try {
172
- let logFile = await this.db.get("logs", fileName);
217
+ const fileName = await this.createAWSFileName();
218
+ console.log("-------- 存储日志到AWS 开始", fileName);
219
+ const buffer = (_a = this.logBuffer) == null ? void 0 : _a.map((item) => {
220
+ item.metadata = JSON.parse(item.metadata || "{}");
221
+ return item;
222
+ });
223
+ const logs = JSON.stringify(buffer, null, 2);
224
+ await this.app.aws.upload({ Bucket: "", Key: fileName, Body: logs });
225
+ console.log("-------- 存储日志到AWS 成功");
226
+ this.logBuffer = [];
227
+ } catch (error) {
228
+ console.error("存储日志上传AWS失败:", error);
229
+ try {
230
+ await this.storeLogToIndexDB();
231
+ } catch (indexDBError) {
232
+ console.error("存储日志到IndexDB也失败:", indexDBError);
233
+ }
234
+ }
235
+ }
236
+ async storeLogToIndexDB() {
237
+ var _a, _b, _c;
238
+ try {
239
+ const fileName = this.createFileName();
240
+ console.log("storeLog", fileName);
241
+ let logFile = await ((_a = this.db) == null ? void 0 : _a.get("logs", fileName));
173
242
  if (!logFile) {
174
243
  logFile = this.createFile(fileName);
175
- await this.db.add("logs", logFile);
244
+ await ((_b = this.db) == null ? void 0 : _b.add("logs", logFile));
176
245
  }
177
246
  logFile.fileContent.logs = [...logFile.fileContent.logs, ...this.logBuffer];
178
- await this.db.update("logs", logFile);
179
- console.log("-------- 存储日志", {
180
- fileName,
181
- logFile
182
- });
247
+ await ((_c = this.db) == null ? void 0 : _c.update("logs", logFile));
248
+ console.log("-------- 存储日志到IndexDB", { fileName, logFile });
249
+ this.logBuffer = [];
183
250
  } catch (error) {
184
- console.error("存储日志到IndexDB失败:", error);
251
+ console.log("-------- 存储日志到IndexDB 失败", error);
252
+ throw error;
185
253
  }
186
- this.logBuffer = [];
187
254
  }
188
255
  /**
189
256
  * 清理旧日志,只保留最近指定天数的日志
@@ -11,7 +11,7 @@ export interface SocketHistoryItem {
11
11
  /** 消息方向(发送/接收) */
12
12
  direction: 'in' | 'out';
13
13
  /** 消息内容 */
14
- message: SocketMessage | Partial<SocketMessage>;
14
+ message: SocketMessage;
15
15
  /** 消息大小(字节) */
16
16
  size?: number;
17
17
  }
@@ -1,4 +1,4 @@
1
- import { ReconnectOptions } from './types';
1
+ import { ReconnectOptions } from "./types";
2
2
  /**
3
3
  * Socket重连管理器
4
4
  * 处理断线重连逻辑
@@ -143,10 +143,7 @@ var ReconnectManager = class {
143
143
  const { delay, delayMax, jitter } = this.options;
144
144
  let calculatedDelay = delay;
145
145
  if (this.attempts > 0) {
146
- calculatedDelay = Math.min(
147
- delayMax || Infinity,
148
- delay * Math.pow(1.5, this.attempts - 1)
149
- );
146
+ calculatedDelay = Math.min(delayMax || Infinity, delay * Math.pow(1.5, this.attempts - 1));
150
147
  }
151
148
  if (jitter) {
152
149
  calculatedDelay = Math.random() * calculatedDelay;
@@ -25,8 +25,9 @@ export declare class Socket {
25
25
  connect(): Promise<void>;
26
26
  /**
27
27
  * 关闭WebSocket连接
28
+ * @param isManual 是否手动关闭
28
29
  */
29
- disconnect(): void;
30
+ disconnect(isManual?: boolean): void;
30
31
  /**
31
32
  * 发送消息到服务器
32
33
  * @param event 事件名称
@@ -28,6 +28,7 @@ var import_events = require("./events");
28
28
  var import_heartbeat = require("./heartbeat");
29
29
  var import_reconnect = require("./reconnect");
30
30
  var import_monitor = require("./monitor");
31
+ var import_app = require("../app");
31
32
  var Socket = class {
32
33
  ws = null;
33
34
  url;
@@ -52,14 +53,26 @@ var Socket = class {
52
53
  ...options
53
54
  };
54
55
  if (this.options.autoConnect) {
55
- this.connect();
56
+ this.connect().catch((error) => {
57
+ console.warn("Socket connection failed:", error);
58
+ });
56
59
  }
57
60
  }
58
61
  /**
59
62
  * 建立WebSocket连接
60
63
  */
61
64
  async connect() {
62
- if (this.isConnected() || this.status === import_types.SocketStatus.CONNECTING) {
65
+ const app = (0, import_app.getApp)();
66
+ const isConnected = this.isConnected();
67
+ if (isConnected || this.status === import_types.SocketStatus.CONNECTING) {
68
+ app.logger.addLog({
69
+ type: "info",
70
+ title: "socket已连接或连接中",
71
+ metadata: {
72
+ isConnected,
73
+ status: this.status
74
+ }
75
+ });
63
76
  return;
64
77
  }
65
78
  this.setStatus(import_types.SocketStatus.CONNECTING);
@@ -94,8 +107,9 @@ var Socket = class {
94
107
  }
95
108
  /**
96
109
  * 关闭WebSocket连接
110
+ * @param isManual 是否手动关闭
97
111
  */
98
- disconnect() {
112
+ disconnect(isManual = false) {
99
113
  if (!this.ws || this.status === import_types.SocketStatus.CLOSED || this.status === import_types.SocketStatus.CLOSING) {
100
114
  return;
101
115
  }
@@ -113,7 +127,7 @@ var Socket = class {
113
127
  }
114
128
  this.setStatus(import_types.SocketStatus.CLOSED);
115
129
  this.ws = null;
116
- this.emit(import_events.SocketEvents.DISCONNECT);
130
+ this.emit(import_events.SocketEvents.DISCONNECT, { isManual });
117
131
  }
118
132
  /**
119
133
  * 发送消息到服务器
@@ -322,7 +336,7 @@ var Socket = class {
322
336
  attempts: this.options.reconnectionAttempts,
323
337
  delay: this.options.reconnectionDelay,
324
338
  delayMax: this.options.reconnectionDelayMax,
325
- jitter: true
339
+ jitter: false
326
340
  };
327
341
  this.reconnectManager = new import_reconnect.ReconnectManager(
328
342
  reconnectOptions,
@@ -396,7 +410,7 @@ var Socket = class {
396
410
  * 释放资源
397
411
  */
398
412
  destroy() {
399
- this.disconnect();
413
+ this.disconnect(true);
400
414
  if (this.monitor) {
401
415
  this.monitor.destroy();
402
416
  this.monitor = null;
@@ -45,7 +45,6 @@ export interface SocketMessage<T = any> {
45
45
  data?: T;
46
46
  /** 消息ID */
47
47
  id?: string;
48
- event?: any;
49
48
  }
50
49
  /**
51
50
  * 心跳配置选项
@@ -10,6 +10,7 @@ export declare class TasksManager {
10
10
  tasks: TasksModule;
11
11
  };
12
12
  watchTaskCallback: (taskModule: TasksModule) => void;
13
+ private timerIds;
13
14
  constructor(app: App);
14
15
  static getInstance(app?: App): TasksManager;
15
16
  addTaskFunction<T>(name: string, fun: T): void;
@@ -31,6 +32,11 @@ export declare class TasksManager {
31
32
  * @Date: 2024-09-26 13:53
32
33
  */
33
34
  private runTask;
35
+ /**
36
+ * @title: 清除任务定时器
37
+ * @param {NodeJS.Timeout} timerId
38
+ */
39
+ private clearTaskTimer;
34
40
  /**
35
41
  * @title: 启动轮询
36
42
  * @description: 根据轮询间隔定期执行任务
@@ -44,6 +44,7 @@ var TasksManager = class _TasksManager {
44
44
  useTasks = import_useTasks.default;
45
45
  watchTaskCallback = () => {
46
46
  };
47
+ timerIds = [];
47
48
  constructor(app) {
48
49
  if (!app) {
49
50
  throw new Error("app is required");
@@ -52,6 +53,7 @@ var TasksManager = class _TasksManager {
52
53
  this.taskFunctions = /* @__PURE__ */ new Map();
53
54
  this.tasks = {};
54
55
  this.db = app.dbManager;
56
+ this.timerIds = [];
55
57
  }
56
58
  // 单例模式
57
59
  static getInstance(app) {
@@ -148,16 +150,39 @@ var TasksManager = class _TasksManager {
148
150
  }
149
151
  } catch (error) {
150
152
  this.app.logger.addLog({
151
- type: "error",
153
+ type: "info",
152
154
  title: `任务执行失败-${task.id}`,
153
155
  metadata: { error, taskPayload: task == null ? void 0 : task.payload }
154
156
  });
155
- console.log("任务执行失败", error);
156
157
  actionRes = { status: "failure" };
157
158
  }
158
159
  console.log("Tasks--->", `任务执行成功: ${task.id}`);
159
160
  return actionRes;
160
161
  };
162
+ /**
163
+ * @title: 清除任务定时器
164
+ * @param {NodeJS.Timeout} timerId
165
+ */
166
+ clearTaskTimer = (params) => {
167
+ const { timerId, taskId } = params;
168
+ const _timerIds = [];
169
+ const needClearTimerIds = [];
170
+ this.timerIds.forEach((id) => {
171
+ const taskIdRult = taskId ? (id == null ? void 0 : id.taskId) === taskId : true;
172
+ const timerIdRult = timerId ? (id == null ? void 0 : id.timerId) === timerId : true;
173
+ if (taskIdRult && timerIdRult) {
174
+ needClearTimerIds.push(id);
175
+ } else {
176
+ _timerIds.push(id);
177
+ }
178
+ });
179
+ if (needClearTimerIds.length) {
180
+ for (let id of needClearTimerIds) {
181
+ clearTimeout(id.timerId);
182
+ }
183
+ }
184
+ this.timerIds = [..._timerIds || []];
185
+ };
161
186
  /**
162
187
  * @title: 启动轮询
163
188
  * @description: 根据轮询间隔定期执行任务
@@ -190,10 +215,11 @@ var TasksManager = class _TasksManager {
190
215
  }
191
216
  this.startPolling(newTask);
192
217
  } catch (error) {
193
- clearTimeout(timerId);
218
+ this.clearTaskTimer({ timerId });
194
219
  console.error("轮询任务异常", error);
195
220
  }
196
221
  }, task.polling.interval);
222
+ this.timerIds.push({ taskId: task.id, timerId });
197
223
  };
198
224
  /**
199
225
  * @title: 创建任务数据
@@ -320,7 +346,7 @@ var TasksManager = class _TasksManager {
320
346
  this.tasks[module2][queueId].tasks = (_d = (_c = (_b = (_a = this.tasks) == null ? void 0 : _a[module2]) == null ? void 0 : _b[queueId]) == null ? void 0 : _c.tasks) == null ? void 0 : _d.filter((task) => {
321
347
  var _a2;
322
348
  if ((_a2 = task.pollingResult) == null ? void 0 : _a2.timerId) {
323
- clearTimeout(task.pollingResult.timerId);
349
+ this.clearTaskTimer({ timerId: task.pollingResult.timerId });
324
350
  }
325
351
  return task.id !== taskId;
326
352
  });
@@ -413,11 +439,8 @@ var TasksManager = class _TasksManager {
413
439
  this.tasks = newState;
414
440
  }
415
441
  clearAllTaskTimer(tasks) {
416
- var _a;
417
442
  for (let task of tasks || []) {
418
- if ((_a = task.pollingResult) == null ? void 0 : _a.timerId) {
419
- clearTimeout(task.pollingResult.timerId);
420
- }
443
+ this.clearTaskTimer({ taskId: task.id });
421
444
  }
422
445
  }
423
446
  // 清空任务
@@ -432,6 +455,12 @@ var TasksManager = class _TasksManager {
432
455
  clearAllTasks() {
433
456
  this.tasks = {};
434
457
  this.saveTaskQueueToLocal(this.tasks);
458
+ if (this.timerIds.length) {
459
+ for (let timerId of this.timerIds) {
460
+ clearTimeout(timerId);
461
+ }
462
+ this.timerIds = [];
463
+ }
435
464
  console.log("Tasks--->", "清空全部任务");
436
465
  }
437
466
  watchTask(callback) {
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@pisell/core",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
+ "scripts": {
5
+ "build": "father build",
6
+ "dev": "father dev",
7
+ "build:types": "tsc --project tsconfig.types.json",
8
+ "publish:types": "npm run build:types && cd types && cp ../types-package.json package.json && npm publish"
9
+ },
4
10
  "sideEffects": false,
5
11
  "main": "./lib/index.js",
6
12
  "module": "./es/index.js",
@@ -23,11 +29,12 @@
23
29
  "history": "^4.9.0",
24
30
  "react-router-dom": "^5.3.4",
25
31
  "react-redux": "^9.1.2",
32
+ "@pisell/utils": "workspace:*",
26
33
  "dva": "^2.4.1",
27
34
  "dva-core": "^2.0.4",
28
35
  "js-md5": "^0.8.3",
29
36
  "axios": "^1.7.2",
30
- "@pisell/utils": "1.0.51"
37
+ "@aws-sdk/client-s3": "^3.456.0"
31
38
  },
32
39
  "files": [
33
40
  "es",
@@ -37,11 +44,5 @@
37
44
  ],
38
45
  "publishConfig": {
39
46
  "access": "public"
40
- },
41
- "scripts": {
42
- "build": "father build",
43
- "dev": "father dev",
44
- "build:types": "tsc --project tsconfig.types.json",
45
- "publish:types": "npm run build:types && cd types && cp ../types-package.json package.json && npm publish"
46
47
  }
47
48
  }