@pisell/core 1.0.1 → 1.0.2
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.
- package/es/app/app.d.ts +15 -54
- package/es/app/app.js +33 -48
- package/es/app/const.js +3 -3
- package/es/app/index.d.ts +1 -1
- package/es/app/index.js +9 -11
- package/es/applicationManager/application.d.ts +2 -2
- package/es/applicationManager/application.js +9 -12
- package/es/applicationManager/index.js +4 -4
- package/es/config.js +5 -5
- package/es/data/index.d.ts +8 -29
- package/es/data/index.js +16 -8
- package/es/history/config.js +5 -5
- package/es/history/index.d.ts +1 -1
- package/es/history/index.js +4 -4
- package/es/hooks/useDelayedValue/index.js +1 -1
- package/es/hooks/useLowCode/index.js +5 -5
- package/es/hooks/useStore/index.d.ts +2 -2
- package/es/index.d.ts +0 -7
- package/es/index.js +8 -7
- package/es/indexDB/index.d.ts +3 -1
- package/es/indexDB/index.js +28 -22
- package/es/locales/index.d.ts +30 -89
- package/es/locales/index.js +202 -243
- package/es/locales/type.d.ts +3 -3
- package/es/logger/feishu.js +2 -2
- package/es/logger/index.d.ts +1 -1
- package/es/logger/index.js +31 -23
- package/es/menuManager/hooks.d.ts +10 -1
- package/es/menuManager/hooks.js +4 -6
- package/es/menuManager/index.d.ts +1 -1
- package/es/menuManager/index.js +3 -3
- package/es/models/global.js +8 -7
- package/es/models/index.d.ts +6 -6
- package/es/models/index.js +1 -2
- package/es/pubsub/index.d.ts +1 -1
- package/es/pubsub/index.js +3 -3
- package/es/request/cache.d.ts +1 -1
- package/es/request/cache.js +7 -6
- package/es/request/config.js +7 -7
- package/es/request/index.js +12 -11
- package/es/request/pisell2Request.d.ts +1 -1
- package/es/request/pisell2Request.js +5 -5
- package/es/request/type.d.ts +1 -0
- package/es/request/utils.js +5 -3
- package/es/routes/index.d.ts +2 -2
- package/es/routes/index.js +11 -17
- package/es/socket/components/SocketMonitorPage.js +255 -462
- package/es/socket/events.js +3 -3
- package/es/socket/heartbeat.js +6 -7
- package/es/socket/index.js +7 -7
- package/es/socket/monitor.d.ts +1 -1
- package/es/socket/monitor.js +24 -15
- package/es/socket/reconnect.js +9 -9
- package/es/socket/socket.js +11 -13
- package/es/socket/types.d.ts +2 -1
- package/es/socket/types.js +23 -7
- package/es/storage/index.d.ts +17 -42
- package/es/storage/index.js +55 -61
- package/es/tasks/index.d.ts +1 -1
- package/es/tasks/index.js +46 -22
- package/es/tasks/type.d.ts +4 -4
- package/es/tasks/useTasks.d.ts +2 -1
- package/es/tasks/useTasks.js +1 -1
- package/es/variables/VariablesProvider.js +3 -5
- package/es/variables/config.js +5 -5
- package/es/variables/index.d.ts +3 -3
- package/lib/app/app.d.ts +15 -54
- package/lib/app/app.js +7 -10
- package/lib/app/index.d.ts +1 -1
- package/lib/applicationManager/application.d.ts +2 -2
- package/lib/data/index.d.ts +8 -29
- package/lib/data/index.js +8 -22
- package/lib/history/index.d.ts +1 -1
- package/lib/hooks/useStore/index.d.ts +2 -2
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -37
- package/lib/indexDB/index.d.ts +3 -1
- package/lib/indexDB/index.js +8 -18
- package/lib/locales/index.d.ts +30 -89
- package/lib/locales/index.js +111 -124
- package/lib/locales/type.d.ts +3 -3
- package/lib/logger/index.d.ts +1 -1
- package/lib/menuManager/hooks.d.ts +10 -1
- package/lib/menuManager/index.d.ts +1 -1
- package/lib/models/index.d.ts +6 -6
- package/lib/models/index.js +1 -2
- package/lib/pubsub/index.d.ts +1 -1
- package/lib/request/cache.d.ts +1 -1
- package/lib/request/config.js +2 -12
- package/lib/request/index.js +5 -1
- package/lib/request/pisell2Request.d.ts +1 -1
- package/lib/request/type.d.ts +1 -0
- package/lib/request/utils.js +2 -0
- package/lib/routes/index.d.ts +2 -2
- package/lib/socket/monitor.d.ts +1 -1
- package/lib/socket/types.d.ts +2 -1
- package/lib/storage/index.d.ts +17 -42
- package/lib/storage/index.js +35 -38
- package/lib/tasks/index.d.ts +1 -1
- package/lib/tasks/type.d.ts +4 -4
- package/lib/tasks/useTasks.d.ts +2 -1
- package/lib/variables/VariablesProvider.js +1 -1
- package/lib/variables/index.d.ts +3 -3
- package/package.json +11 -4
- package/es/locales/config.d.ts +0 -24
- package/es/locales/config.js +0 -59
- package/es/models/tasks.d.ts +0 -31
- package/es/models/tasks.js +0 -331
- package/es/models/tasksUtils.d.ts +0 -65
- package/es/models/tasksUtils.js +0 -179
- package/es/storage/config.d.ts +0 -3
- package/es/storage/config.js +0 -16
- package/es/storage/type.d.ts +0 -5
- package/es/storage/type.js +0 -1
- package/lib/locales/config.d.ts +0 -24
- package/lib/locales/config.js +0 -66
- package/lib/models/tasks.d.ts +0 -31
- package/lib/models/tasks.js +0 -199
- package/lib/models/tasksUtils.d.ts +0 -65
- package/lib/models/tasksUtils.js +0 -160
- package/lib/storage/config.d.ts +0 -3
- package/lib/storage/config.js +0 -38
- package/lib/storage/type.d.ts +0 -5
- package/lib/storage/type.js +0 -17
package/lib/models/tasksUtils.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
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/models/tasksUtils.ts
|
|
30
|
-
var tasksUtils_exports = {};
|
|
31
|
-
__export(tasksUtils_exports, {
|
|
32
|
-
TasksManager: () => TasksManager
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(tasksUtils_exports);
|
|
35
|
-
var import_storage = __toESM(require("../storage"));
|
|
36
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
-
var import_utils = require("@pisell/utils");
|
|
38
|
-
var { getStorage, setStorage } = import_storage.default;
|
|
39
|
-
var TasksManager = class {
|
|
40
|
-
constructor() {
|
|
41
|
-
// 将任务队列状态同步到 localStorage
|
|
42
|
-
this.saveTaskQueueToLocalStorage = (state) => {
|
|
43
|
-
setStorage("tasks", JSON.stringify(state));
|
|
44
|
-
};
|
|
45
|
-
// 从 localStorage 加载任务队列状态
|
|
46
|
-
this.loadTaskQueueFromLocalStorage = () => {
|
|
47
|
-
const tasks = getStorage("tasks");
|
|
48
|
-
return tasks ? JSON.parse(tasks) : null;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* @title: 执行任务
|
|
52
|
-
* @description:
|
|
53
|
-
* @param {Task} task
|
|
54
|
-
* @return {*}
|
|
55
|
-
* @Author: zhiwei.Wang
|
|
56
|
-
* @Date: 2024-09-26 13:53
|
|
57
|
-
*/
|
|
58
|
-
this.runTask = async (task) => {
|
|
59
|
-
const beforeAction = this.getTask(task.beforeAction);
|
|
60
|
-
const afterAction = this.getTask(task.afterAction);
|
|
61
|
-
const action = this.getTask(task.action);
|
|
62
|
-
let res = { status: "success" };
|
|
63
|
-
try {
|
|
64
|
-
if (beforeAction) {
|
|
65
|
-
await beforeAction(task.beforePayload);
|
|
66
|
-
}
|
|
67
|
-
if (action) {
|
|
68
|
-
res = await action(task.payload);
|
|
69
|
-
}
|
|
70
|
-
if (afterAction) {
|
|
71
|
-
await afterAction(task.afterPayload);
|
|
72
|
-
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
res = { status: "failure" };
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* @title: 创建任务数据
|
|
80
|
-
* @description:
|
|
81
|
-
* @param {Partial} payload
|
|
82
|
-
* @return {*}
|
|
83
|
-
* @Author: zhiwei.Wang
|
|
84
|
-
* @Date: 2024-09-26 13:54
|
|
85
|
-
*/
|
|
86
|
-
this.createTaskData = (payload) => {
|
|
87
|
-
return {
|
|
88
|
-
id: (0, import_utils.getUniqueId)("task_"),
|
|
89
|
-
create_at: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
|
|
90
|
-
type: "local",
|
|
91
|
-
retries: 0,
|
|
92
|
-
maxRetries: 3,
|
|
93
|
-
status: "pending",
|
|
94
|
-
// 执行函数
|
|
95
|
-
action: "",
|
|
96
|
-
// 执行参数
|
|
97
|
-
payload: {},
|
|
98
|
-
// 执行前的钩子
|
|
99
|
-
beforeAction: "",
|
|
100
|
-
// 执行前的参数
|
|
101
|
-
beforePayload: {},
|
|
102
|
-
// 执行后的钩子
|
|
103
|
-
afterAction: "",
|
|
104
|
-
// 执行后的参数
|
|
105
|
-
afterPayload: {},
|
|
106
|
-
...payload
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
// 创建任务
|
|
110
|
-
this.createTask = (payload) => {
|
|
111
|
-
dispatch({
|
|
112
|
-
type: "tasks/addTasks",
|
|
113
|
-
payload: {
|
|
114
|
-
queueId: "order_1",
|
|
115
|
-
module: "orders",
|
|
116
|
-
tasks: [
|
|
117
|
-
{
|
|
118
|
-
action: "createOrder",
|
|
119
|
-
payload: { order: 1 }
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
action: "syncCloudOrder",
|
|
123
|
-
payload: { order: 1 }
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
action: "goPayment",
|
|
127
|
-
payload: { order: 1 }
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
this.tasks = /* @__PURE__ */ new Map();
|
|
134
|
-
}
|
|
135
|
-
// 单例模式
|
|
136
|
-
static getInstance() {
|
|
137
|
-
if (!TasksManager.instance) {
|
|
138
|
-
TasksManager.instance = new TasksManager();
|
|
139
|
-
}
|
|
140
|
-
return TasksManager.instance;
|
|
141
|
-
}
|
|
142
|
-
// 注册任务
|
|
143
|
-
useTask(name, plugin) {
|
|
144
|
-
this.tasks.set(name, plugin);
|
|
145
|
-
}
|
|
146
|
-
// 注册任务列表
|
|
147
|
-
useTasks(tasks) {
|
|
148
|
-
tasks.forEach(({ name, plugin }) => {
|
|
149
|
-
this.tasks.set(name, plugin);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
// 获取任务
|
|
153
|
-
getTask(name) {
|
|
154
|
-
return this.tasks.get(name);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
158
|
-
0 && (module.exports = {
|
|
159
|
-
TasksManager
|
|
160
|
-
});
|
package/lib/storage/config.d.ts
DELETED
package/lib/storage/config.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/storage/config.ts
|
|
20
|
-
var config_exports = {};
|
|
21
|
-
__export(config_exports, {
|
|
22
|
-
getConfig: () => getConfig,
|
|
23
|
-
setConfig: () => setConfig
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(config_exports);
|
|
26
|
-
var defaultConfig = {
|
|
27
|
-
STORAGE_KEY: "CapacitorStorage.native_"
|
|
28
|
-
};
|
|
29
|
-
var config = { ...defaultConfig };
|
|
30
|
-
var setConfig = (newConfig) => {
|
|
31
|
-
config = { ...config, ...newConfig };
|
|
32
|
-
};
|
|
33
|
-
var getConfig = () => config;
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
getConfig,
|
|
37
|
-
setConfig
|
|
38
|
-
});
|
package/lib/storage/type.d.ts
DELETED
package/lib/storage/type.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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/storage/type.ts
|
|
16
|
-
var type_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(type_exports);
|