@pisell/pisellos 0.0.218 → 0.0.220
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/README.md +180 -180
- package/dist/core/index.js +4 -4
- package/dist/index.js +3 -3
- package/dist/modules/Account/types.js +6 -6
- package/dist/modules/AccountList/index.js +14 -14
- package/dist/modules/AccountList/types.js +14 -14
- package/dist/modules/AccountList/utils.js +5 -5
- package/dist/modules/Cart/index.js +35 -35
- package/dist/modules/Cart/types.js +14 -14
- package/dist/modules/Cart/utils/cartAccount.js +8 -8
- package/dist/modules/Cart/utils/cartDate.js +12 -12
- package/dist/modules/Cart/utils/cartDiscount.js +8 -8
- package/dist/modules/Cart/utils/cartNote.js +8 -8
- package/dist/modules/Cart/utils/cartProduct.js +39 -39
- package/dist/modules/Cart/utils/cartRelationForms.js +8 -8
- package/dist/modules/Cart/utils/cartResource.js +8 -8
- package/dist/modules/Cart/utils/index.js +4 -4
- package/dist/modules/Customer/constants.d.ts +1 -1
- package/dist/modules/Customer/constants.js +1 -1
- package/dist/modules/Customer/index.js +67 -67
- package/dist/modules/Customer/types.js +18 -18
- package/dist/modules/Date/types.js +6 -6
- package/dist/modules/Date/utils.js +25 -25
- package/dist/modules/Guests/types.js +8 -8
- package/dist/modules/Order/types.js +4 -4
- package/dist/modules/Order/utils.js +8 -8
- package/dist/modules/Payment/cash.js +2 -2
- package/dist/modules/Payment/eftpos.js +2 -2
- package/dist/modules/Payment/index.js +135 -135
- package/dist/modules/Payment/types.js +50 -50
- package/dist/modules/Payment/wallet.js +2 -2
- package/dist/modules/Product/index.js +22 -22
- package/dist/modules/Product/utils.js +12 -12
- package/dist/modules/ProductList/index.js +4 -4
- package/dist/modules/Resource/types.js +8 -8
- package/dist/modules/Resource/utils.js +14 -14
- package/dist/modules/Schedule/index.js +4 -4
- package/dist/modules/Schedule/utils.js +73 -73
- package/dist/modules/Step/index.js +18 -18
- package/dist/modules/Summary/index.js +4 -4
- package/dist/modules/Summary/utils.js +15 -15
- package/dist/plugins/app-types/app/app.d.ts +83 -83
- package/dist/plugins/app-types/app/const.d.ts +4 -4
- package/dist/plugins/app-types/app/index.d.ts +14 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -13
- package/dist/plugins/app-types/config.d.ts +3 -3
- package/dist/plugins/app-types/cookie/index.d.ts +13 -13
- package/dist/plugins/app-types/data/index.d.ts +8 -8
- package/dist/plugins/app-types/history/config.d.ts +24 -24
- package/dist/plugins/app-types/history/index.d.ts +20 -20
- package/dist/plugins/app-types/history/type.d.ts +2 -2
- package/dist/plugins/app-types/hooks/index.d.ts +12 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -6
- package/dist/plugins/app-types/index.d.ts +6 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -178
- package/dist/plugins/app-types/locales/en.d.ts +3 -3
- package/dist/plugins/app-types/locales/index.d.ts +37 -37
- package/dist/plugins/app-types/locales/original.d.ts +3 -3
- package/dist/plugins/app-types/locales/type.d.ts +19 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -11
- package/dist/plugins/app-types/logger/index.d.ts +122 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -28
- package/dist/plugins/app-types/models/global.d.ts +32 -32
- package/dist/plugins/app-types/models/index.d.ts +45 -45
- package/dist/plugins/app-types/models/type.d.ts +2 -2
- package/dist/plugins/app-types/package.json +14 -14
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -63
- package/dist/plugins/app-types/request/cache.d.ts +46 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -38
- package/dist/plugins/app-types/request/config.d.ts +3 -3
- package/dist/plugins/app-types/request/constants.d.ts +2 -2
- package/dist/plugins/app-types/request/index.d.ts +24 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -6
- package/dist/plugins/app-types/request/type.d.ts +41 -41
- package/dist/plugins/app-types/request/utils.d.ts +46 -46
- package/dist/plugins/app-types/routes/config.d.ts +7 -7
- package/dist/plugins/app-types/routes/index.d.ts +28 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -2
- package/dist/plugins/app-types/socket/constants.d.ts +33 -33
- package/dist/plugins/app-types/socket/events.d.ts +31 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -66
- package/dist/plugins/app-types/socket/index.d.ts +61 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -61
- package/dist/plugins/app-types/socket/socket.d.ts +129 -129
- package/dist/plugins/app-types/socket/types.d.ts +85 -85
- package/dist/plugins/app-types/storage/index.d.ts +17 -17
- package/dist/plugins/app-types/tasks/index.d.ts +77 -77
- package/dist/plugins/app-types/tasks/type.d.ts +62 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -5
- package/dist/plugins/app-types/type.d.ts +2 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
- package/dist/plugins/app-types/variables/config.d.ts +3 -3
- package/dist/plugins/app-types/variables/index.d.ts +6 -6
- package/dist/plugins/app-types/variables/type.d.ts +2 -2
- package/dist/plugins/app-types/website/index.d.ts +6 -6
- package/dist/plugins/request.js +33 -33
- package/dist/plugins/window.js +16 -16
- package/dist/solution/BookingByStep/index.js +126 -126
- package/dist/solution/BookingByStep/utils/capacity.js +30 -30
- package/dist/solution/BookingByStep/utils/products.js +4 -4
- package/dist/solution/BookingByStep/utils/resources.js +146 -146
- package/dist/solution/BookingByStep/utils/timeslots.js +20 -20
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +81 -81
- package/dist/solution/BookingTicket/types.js +8 -8
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +17 -17
- package/dist/solution/BookingTicket/utils/scan/index.js +19 -19
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +52 -52
- package/dist/solution/BuyTickets/types.js +4 -4
- package/dist/utils/task.js +11 -11
- package/dist/utils/watch.js +59 -59
- package/lib/modules/Customer/constants.d.ts +1 -1
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/plugins/app-types/app/app.d.ts +83 -83
- package/lib/plugins/app-types/app/const.d.ts +4 -4
- package/lib/plugins/app-types/app/index.d.ts +14 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -13
- package/lib/plugins/app-types/config.d.ts +3 -3
- package/lib/plugins/app-types/cookie/index.d.ts +13 -13
- package/lib/plugins/app-types/data/index.d.ts +8 -8
- package/lib/plugins/app-types/history/config.d.ts +24 -24
- package/lib/plugins/app-types/history/index.d.ts +20 -20
- package/lib/plugins/app-types/history/type.d.ts +2 -2
- package/lib/plugins/app-types/hooks/index.d.ts +12 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -6
- package/lib/plugins/app-types/index.d.ts +6 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -178
- package/lib/plugins/app-types/locales/en.d.ts +3 -3
- package/lib/plugins/app-types/locales/index.d.ts +37 -37
- package/lib/plugins/app-types/locales/original.d.ts +3 -3
- package/lib/plugins/app-types/locales/type.d.ts +19 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -11
- package/lib/plugins/app-types/logger/index.d.ts +122 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -28
- package/lib/plugins/app-types/models/global.d.ts +32 -32
- package/lib/plugins/app-types/models/index.d.ts +45 -45
- package/lib/plugins/app-types/models/type.d.ts +2 -2
- package/lib/plugins/app-types/package.json +14 -14
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -63
- package/lib/plugins/app-types/request/cache.d.ts +46 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -38
- package/lib/plugins/app-types/request/config.d.ts +3 -3
- package/lib/plugins/app-types/request/constants.d.ts +2 -2
- package/lib/plugins/app-types/request/index.d.ts +24 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -6
- package/lib/plugins/app-types/request/type.d.ts +41 -41
- package/lib/plugins/app-types/request/utils.d.ts +46 -46
- package/lib/plugins/app-types/routes/config.d.ts +7 -7
- package/lib/plugins/app-types/routes/index.d.ts +28 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -2
- package/lib/plugins/app-types/socket/constants.d.ts +33 -33
- package/lib/plugins/app-types/socket/events.d.ts +31 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -66
- package/lib/plugins/app-types/socket/index.d.ts +61 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -61
- package/lib/plugins/app-types/socket/socket.d.ts +129 -129
- package/lib/plugins/app-types/socket/types.d.ts +85 -85
- package/lib/plugins/app-types/storage/index.d.ts +17 -17
- package/lib/plugins/app-types/tasks/index.d.ts +77 -77
- package/lib/plugins/app-types/tasks/type.d.ts +62 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -5
- package/lib/plugins/app-types/type.d.ts +2 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -7
- package/lib/plugins/app-types/variables/config.d.ts +3 -3
- package/lib/plugins/app-types/variables/index.d.ts +6 -6
- package/lib/plugins/app-types/variables/type.d.ts +2 -2
- package/lib/plugins/app-types/website/index.d.ts +6 -6
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
# PisellOS 前端 SDK 框架
|
|
2
|
-
|
|
3
|
-
PisellOS 是一个灵活的、可扩展的前端 SDK 框架,专为构建模块化应用设计。它支持插件系统,允许在不同运行环境中无缝集成功能。
|
|
4
|
-
|
|
5
|
-
## 特性
|
|
6
|
-
|
|
7
|
-
- **模块化架构**:支持各种功能模块(如购物车、结账流程等)的插入和管理
|
|
8
|
-
- **插件系统**:通过插件提供环境抽象,解决跨环境兼容性问题
|
|
9
|
-
- **事件驱动**:基于事件总线的模块间通信机制
|
|
10
|
-
- **类型安全**:使用 TypeScript 构建,提供完整的类型定义
|
|
11
|
-
- **轻量级**:核心框架轻量,按需加载模块
|
|
12
|
-
|
|
13
|
-
## 安装
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install pisell-os
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## 快速开始
|
|
20
|
-
|
|
21
|
-
### 基本用法
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import PisellOSCore, { plugins, modules } from "pisell-os";
|
|
25
|
-
|
|
26
|
-
// 创建 PisellOS 实例
|
|
27
|
-
const pisellOS = new PisellOSCore({
|
|
28
|
-
debug: true, // 开启调试日志
|
|
29
|
-
plugins: [{ plugin: plugins.window }, { plugin: plugins.request }],
|
|
30
|
-
modules: [
|
|
31
|
-
{
|
|
32
|
-
module: modules.cart,
|
|
33
|
-
options: {
|
|
34
|
-
plugins: ["window", "request"], // 依赖的插件
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// 获取购物车模块并使用
|
|
41
|
-
const cartModule = pisellOS.getModuleExports("cart");
|
|
42
|
-
await cartModule.addItem({
|
|
43
|
-
id: "product-001",
|
|
44
|
-
name: "商品1",
|
|
45
|
-
price: 99.9,
|
|
46
|
-
quantity: 1,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// 使用插件
|
|
50
|
-
const windowPlugin = pisellOS.getPlugin("window");
|
|
51
|
-
windowPlugin.localStorage.setItem("key", "value");
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 架构
|
|
55
|
-
|
|
56
|
-
PisellOS 的核心架构包括四个主要部分:
|
|
57
|
-
|
|
58
|
-
1. **核心框架**:负责模块和插件的注册、管理和生命周期控制
|
|
59
|
-
2. **插件系统**:为不同环境提供统一接口,如 window、request 等
|
|
60
|
-
3. **模块系统**:提供业务功能实现,可依赖插件和其他模块
|
|
61
|
-
4. **解决方案**:解决方案是 pisell_os 中对业务流程层的抽象,用于将多个独立的模块(Module)编排成一个完整的业务解决方案。
|
|
62
|
-
它本质上是一个特殊的“业务 orchestrator”,负责协调模块调用、控制数据流动和处理统一状态管理。
|
|
63
|
-
|
|
64
|
-
### 核心 API
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
// 创建实例
|
|
68
|
-
const pisellOS = new PisellOSCore(options);
|
|
69
|
-
|
|
70
|
-
// 注册插件
|
|
71
|
-
pisellOS.registerPlugin(plugin, options);
|
|
72
|
-
|
|
73
|
-
// 注册模块
|
|
74
|
-
pisellOS.registerModule(module, options);
|
|
75
|
-
|
|
76
|
-
// 获取插件
|
|
77
|
-
const plugin = pisellOS.getPlugin<PluginType>(name);
|
|
78
|
-
|
|
79
|
-
// 获取模块
|
|
80
|
-
const module = pisellOS.getModule<ModuleType>(name);
|
|
81
|
-
|
|
82
|
-
// 获取模块导出的 API
|
|
83
|
-
const api = pisellOS.getModuleExports<ApiType>(name);
|
|
84
|
-
|
|
85
|
-
// 事件机制
|
|
86
|
-
pisellOS.on(event, handler);
|
|
87
|
-
pisellOS.emit(event, data);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## 内置插件
|
|
91
|
-
|
|
92
|
-
PisellOS 提供了几个内置插件以简化开发:
|
|
93
|
-
|
|
94
|
-
- **window**:提供 window 对象模拟,包括 localStorage、setTimeout 等
|
|
95
|
-
- **request**:提供网络请求功能,支持各种 HTTP 方法和拦截器
|
|
96
|
-
|
|
97
|
-
## 内置模块
|
|
98
|
-
|
|
99
|
-
- **cart**:购物车模块,提供商品管理、数量更新等功能
|
|
100
|
-
|
|
101
|
-
## 自定义扩展
|
|
102
|
-
|
|
103
|
-
### 创建自定义插件
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import { Plugin } from "pisell-os";
|
|
107
|
-
|
|
108
|
-
class MyPlugin implements Plugin {
|
|
109
|
-
name = "my-plugin";
|
|
110
|
-
version = "1.0.0";
|
|
111
|
-
|
|
112
|
-
initialize() {
|
|
113
|
-
console.log("My plugin initialized");
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
destroy() {
|
|
117
|
-
console.log("My plugin destroyed");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// 自定义方法
|
|
121
|
-
myMethod() {
|
|
122
|
-
return "Hello from my plugin";
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default new MyPlugin();
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 创建自定义模块
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
import { Module, PisellCore } from "pisell-os";
|
|
133
|
-
|
|
134
|
-
class MyModule implements Module {
|
|
135
|
-
name = "my-module";
|
|
136
|
-
version = "1.0.0";
|
|
137
|
-
|
|
138
|
-
private core: PisellCore;
|
|
139
|
-
|
|
140
|
-
// 导出 API
|
|
141
|
-
exports = {
|
|
142
|
-
doSomething: () => this.doSomething(),
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
initialize(core: PisellCore) {
|
|
146
|
-
this.core = core;
|
|
147
|
-
console.log("My module initialized");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
destroy() {
|
|
151
|
-
console.log("My module destroyed");
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private doSomething() {
|
|
155
|
-
return "Hello from my module";
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export default new MyModule();
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## 开发
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
# 安装依赖
|
|
166
|
-
npm install
|
|
167
|
-
|
|
168
|
-
# 构建项目
|
|
169
|
-
npm run build
|
|
170
|
-
|
|
171
|
-
# 运行示例
|
|
172
|
-
npm run example
|
|
173
|
-
|
|
174
|
-
# 开发模式
|
|
175
|
-
npm run dev
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## 许可
|
|
179
|
-
|
|
180
|
-
MIT License
|
|
1
|
+
# PisellOS 前端 SDK 框架
|
|
2
|
+
|
|
3
|
+
PisellOS 是一个灵活的、可扩展的前端 SDK 框架,专为构建模块化应用设计。它支持插件系统,允许在不同运行环境中无缝集成功能。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- **模块化架构**:支持各种功能模块(如购物车、结账流程等)的插入和管理
|
|
8
|
+
- **插件系统**:通过插件提供环境抽象,解决跨环境兼容性问题
|
|
9
|
+
- **事件驱动**:基于事件总线的模块间通信机制
|
|
10
|
+
- **类型安全**:使用 TypeScript 构建,提供完整的类型定义
|
|
11
|
+
- **轻量级**:核心框架轻量,按需加载模块
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install pisell-os
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
### 基本用法
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import PisellOSCore, { plugins, modules } from "pisell-os";
|
|
25
|
+
|
|
26
|
+
// 创建 PisellOS 实例
|
|
27
|
+
const pisellOS = new PisellOSCore({
|
|
28
|
+
debug: true, // 开启调试日志
|
|
29
|
+
plugins: [{ plugin: plugins.window }, { plugin: plugins.request }],
|
|
30
|
+
modules: [
|
|
31
|
+
{
|
|
32
|
+
module: modules.cart,
|
|
33
|
+
options: {
|
|
34
|
+
plugins: ["window", "request"], // 依赖的插件
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// 获取购物车模块并使用
|
|
41
|
+
const cartModule = pisellOS.getModuleExports("cart");
|
|
42
|
+
await cartModule.addItem({
|
|
43
|
+
id: "product-001",
|
|
44
|
+
name: "商品1",
|
|
45
|
+
price: 99.9,
|
|
46
|
+
quantity: 1,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 使用插件
|
|
50
|
+
const windowPlugin = pisellOS.getPlugin("window");
|
|
51
|
+
windowPlugin.localStorage.setItem("key", "value");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 架构
|
|
55
|
+
|
|
56
|
+
PisellOS 的核心架构包括四个主要部分:
|
|
57
|
+
|
|
58
|
+
1. **核心框架**:负责模块和插件的注册、管理和生命周期控制
|
|
59
|
+
2. **插件系统**:为不同环境提供统一接口,如 window、request 等
|
|
60
|
+
3. **模块系统**:提供业务功能实现,可依赖插件和其他模块
|
|
61
|
+
4. **解决方案**:解决方案是 pisell_os 中对业务流程层的抽象,用于将多个独立的模块(Module)编排成一个完整的业务解决方案。
|
|
62
|
+
它本质上是一个特殊的“业务 orchestrator”,负责协调模块调用、控制数据流动和处理统一状态管理。
|
|
63
|
+
|
|
64
|
+
### 核心 API
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// 创建实例
|
|
68
|
+
const pisellOS = new PisellOSCore(options);
|
|
69
|
+
|
|
70
|
+
// 注册插件
|
|
71
|
+
pisellOS.registerPlugin(plugin, options);
|
|
72
|
+
|
|
73
|
+
// 注册模块
|
|
74
|
+
pisellOS.registerModule(module, options);
|
|
75
|
+
|
|
76
|
+
// 获取插件
|
|
77
|
+
const plugin = pisellOS.getPlugin<PluginType>(name);
|
|
78
|
+
|
|
79
|
+
// 获取模块
|
|
80
|
+
const module = pisellOS.getModule<ModuleType>(name);
|
|
81
|
+
|
|
82
|
+
// 获取模块导出的 API
|
|
83
|
+
const api = pisellOS.getModuleExports<ApiType>(name);
|
|
84
|
+
|
|
85
|
+
// 事件机制
|
|
86
|
+
pisellOS.on(event, handler);
|
|
87
|
+
pisellOS.emit(event, data);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 内置插件
|
|
91
|
+
|
|
92
|
+
PisellOS 提供了几个内置插件以简化开发:
|
|
93
|
+
|
|
94
|
+
- **window**:提供 window 对象模拟,包括 localStorage、setTimeout 等
|
|
95
|
+
- **request**:提供网络请求功能,支持各种 HTTP 方法和拦截器
|
|
96
|
+
|
|
97
|
+
## 内置模块
|
|
98
|
+
|
|
99
|
+
- **cart**:购物车模块,提供商品管理、数量更新等功能
|
|
100
|
+
|
|
101
|
+
## 自定义扩展
|
|
102
|
+
|
|
103
|
+
### 创建自定义插件
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { Plugin } from "pisell-os";
|
|
107
|
+
|
|
108
|
+
class MyPlugin implements Plugin {
|
|
109
|
+
name = "my-plugin";
|
|
110
|
+
version = "1.0.0";
|
|
111
|
+
|
|
112
|
+
initialize() {
|
|
113
|
+
console.log("My plugin initialized");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
destroy() {
|
|
117
|
+
console.log("My plugin destroyed");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 自定义方法
|
|
121
|
+
myMethod() {
|
|
122
|
+
return "Hello from my plugin";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default new MyPlugin();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 创建自定义模块
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { Module, PisellCore } from "pisell-os";
|
|
133
|
+
|
|
134
|
+
class MyModule implements Module {
|
|
135
|
+
name = "my-module";
|
|
136
|
+
version = "1.0.0";
|
|
137
|
+
|
|
138
|
+
private core: PisellCore;
|
|
139
|
+
|
|
140
|
+
// 导出 API
|
|
141
|
+
exports = {
|
|
142
|
+
doSomething: () => this.doSomething(),
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
initialize(core: PisellCore) {
|
|
146
|
+
this.core = core;
|
|
147
|
+
console.log("My module initialized");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
destroy() {
|
|
151
|
+
console.log("My module destroyed");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private doSomething() {
|
|
155
|
+
return "Hello from my module";
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default new MyModule();
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 开发
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# 安装依赖
|
|
166
|
+
npm install
|
|
167
|
+
|
|
168
|
+
# 构建项目
|
|
169
|
+
npm run build
|
|
170
|
+
|
|
171
|
+
# 运行示例
|
|
172
|
+
npm run example
|
|
173
|
+
|
|
174
|
+
# 开发模式
|
|
175
|
+
npm run dev
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 许可
|
|
179
|
+
|
|
180
|
+
MIT License
|
package/dist/core/index.js
CHANGED
|
@@ -20,8 +20,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
20
20
|
import { createStore } from "../store/createStore";
|
|
21
21
|
import { EffectsManager } from "../effects";
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* pisell OS 核心实现
|
|
23
|
+
/**
|
|
24
|
+
* pisell OS 核心实现
|
|
25
25
|
*/
|
|
26
26
|
var PisellOSCore = /*#__PURE__*/function () {
|
|
27
27
|
function PisellOSCore(options) {
|
|
@@ -329,8 +329,8 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
329
329
|
}
|
|
330
330
|
return destroy;
|
|
331
331
|
}()
|
|
332
|
-
/**
|
|
333
|
-
* 验证上下文参数
|
|
332
|
+
/**
|
|
333
|
+
* 验证上下文参数
|
|
334
334
|
*/
|
|
335
335
|
}, {
|
|
336
336
|
key: "validateContext",
|
package/dist/index.js
CHANGED
|
@@ -6,14 +6,14 @@ export var AccountHooks = /*#__PURE__*/function (AccountHooks) {
|
|
|
6
6
|
return AccountHooks;
|
|
7
7
|
}({});
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* 用户账户信息
|
|
9
|
+
/**
|
|
10
|
+
* 用户账户信息
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* 账户模块状态
|
|
13
|
+
/**
|
|
14
|
+
* 账户模块状态
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* 账户模块 API
|
|
17
|
+
/**
|
|
18
|
+
* 账户模块 API
|
|
19
19
|
*/
|
|
@@ -98,11 +98,11 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
98
98
|
}
|
|
99
99
|
return initialize;
|
|
100
100
|
}()
|
|
101
|
-
/**
|
|
102
|
-
* 创建账号并添加到列表中
|
|
103
|
-
* @param account 账号信息
|
|
104
|
-
* @param needEmit 是否需要触发事件
|
|
105
|
-
* @param type 添加类型
|
|
101
|
+
/**
|
|
102
|
+
* 创建账号并添加到列表中
|
|
103
|
+
* @param account 账号信息
|
|
104
|
+
* @param needEmit 是否需要触发事件
|
|
105
|
+
* @param type 添加类型
|
|
106
106
|
*/
|
|
107
107
|
}, {
|
|
108
108
|
key: "createAccountAndAdd",
|
|
@@ -447,8 +447,8 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
/**
|
|
451
|
-
* 批量添加holder类型账号
|
|
450
|
+
/**
|
|
451
|
+
* 批量添加holder类型账号
|
|
452
452
|
*/
|
|
453
453
|
}, {
|
|
454
454
|
key: "addHolderAccounts",
|
|
@@ -509,10 +509,10 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
509
509
|
}
|
|
510
510
|
return addHolderAccounts;
|
|
511
511
|
}()
|
|
512
|
-
/**
|
|
513
|
-
* 获取客户列表
|
|
514
|
-
* @param params 查询参数
|
|
515
|
-
* @returns 客户列表
|
|
512
|
+
/**
|
|
513
|
+
* 获取客户列表
|
|
514
|
+
* @param params 查询参数
|
|
515
|
+
* @returns 客户列表
|
|
516
516
|
*/
|
|
517
517
|
)
|
|
518
518
|
}, {
|
|
@@ -571,9 +571,9 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
571
571
|
}
|
|
572
572
|
return getCustomerList;
|
|
573
573
|
}()
|
|
574
|
-
/**
|
|
575
|
-
* 获取holder类型账户列表
|
|
576
|
-
* @param params
|
|
574
|
+
/**
|
|
575
|
+
* 获取holder类型账户列表
|
|
576
|
+
* @param params
|
|
577
577
|
*/
|
|
578
578
|
)
|
|
579
579
|
}, {
|
|
@@ -4,30 +4,30 @@ export var AccountListHooks = /*#__PURE__*/function (AccountListHooks) {
|
|
|
4
4
|
return AccountListHooks;
|
|
5
5
|
}({});
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* 账户列表查询参数
|
|
7
|
+
/**
|
|
8
|
+
* 账户列表查询参数
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* 账户列表状态
|
|
11
|
+
/**
|
|
12
|
+
* 账户列表状态
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* 账户列表模块 API
|
|
15
|
+
/**
|
|
16
|
+
* 账户列表模块 API
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* 获取holder类型账户列表参数
|
|
19
|
+
/**
|
|
20
|
+
* 获取holder类型账户列表参数
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* holder类型数据
|
|
23
|
+
/**
|
|
24
|
+
* holder类型数据
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* 获取客户列表参数
|
|
27
|
+
/**
|
|
28
|
+
* 获取客户列表参数
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 客户数据
|
|
31
|
+
/**
|
|
32
|
+
* 客户数据
|
|
33
33
|
*/
|
|
@@ -4,11 +4,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
/**
|
|
8
|
-
* 创建holder类型账号
|
|
9
|
-
* @param holder
|
|
10
|
-
* @param customer_id 账户id
|
|
11
|
-
* @returns
|
|
7
|
+
/**
|
|
8
|
+
* 创建holder类型账号
|
|
9
|
+
* @param holder
|
|
10
|
+
* @param customer_id 账户id
|
|
11
|
+
* @returns
|
|
12
12
|
*/
|
|
13
13
|
export var createHolderAccount = function createHolderAccount(holder, customerId) {
|
|
14
14
|
var account = {
|