@posx/core 5.5.360 → 5.5.363
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/CLAUDE.md +23 -23
- package/LICENSE +21 -21
- package/README.md +85 -85
- package/build/index.d.ts +8 -3
- package/build/index.js +9 -4
- package/jest.config.cjs +36 -36
- package/jest.setup.cjs +80 -80
- package/package.json +1 -1
- package/package.publish.json +120 -120
- package/tsdown.config.ts +18 -18
- package/vite.config.ts +86 -86
package/CLAUDE.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# Claude AI Development Guidelines
|
|
2
|
-
|
|
3
|
-
## Rules you have to follow strictly
|
|
4
|
-
|
|
5
|
-
- You are top-notch programmer who always write simplest code to achieve the ideal result
|
|
6
|
-
- you are one liner engineers and we believe "The Great Tao is Simple", so try to keep changes small and focused
|
|
7
|
-
- keep the changes as minimal as possible
|
|
8
|
-
- if or else has one line of code, then { } are not needed and it should be wrote into same line
|
|
9
|
-
- DO NOT write uncessary comment do not make newlines within a function and try to make the code compact
|
|
10
|
-
- All crucial code should have proper explanation in English
|
|
11
|
-
- Keep the simplifications as small and focused within the function or scope.
|
|
12
|
-
- Do not overhaul the whole file or codebase which is irrelevant to the current task.
|
|
13
|
-
|
|
14
|
-
## Best Practices for AI-Assisted Development
|
|
15
|
-
|
|
16
|
-
1. **在开始编码前先充分讨论和规划架构,确保理解用户的真实需求和使用场景,避免过度设计。**
|
|
17
|
-
|
|
18
|
-
2. **不要急于提交代码,应该等待用户明确指示后再进行 commit 和 push 操作。**
|
|
19
|
-
|
|
20
|
-
3. **优先选择简洁的实现方式(如函数导出而非类),并删除冗余的中间层方法以保持代码清晰。**
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
1
|
+
# Claude AI Development Guidelines
|
|
2
|
+
|
|
3
|
+
## Rules you have to follow strictly
|
|
4
|
+
|
|
5
|
+
- You are top-notch programmer who always write simplest code to achieve the ideal result
|
|
6
|
+
- you are one liner engineers and we believe "The Great Tao is Simple", so try to keep changes small and focused
|
|
7
|
+
- keep the changes as minimal as possible
|
|
8
|
+
- if or else has one line of code, then { } are not needed and it should be wrote into same line
|
|
9
|
+
- DO NOT write uncessary comment do not make newlines within a function and try to make the code compact
|
|
10
|
+
- All crucial code should have proper explanation in English
|
|
11
|
+
- Keep the simplifications as small and focused within the function or scope.
|
|
12
|
+
- Do not overhaul the whole file or codebase which is irrelevant to the current task.
|
|
13
|
+
|
|
14
|
+
## Best Practices for AI-Assisted Development
|
|
15
|
+
|
|
16
|
+
1. **在开始编码前先充分讨论和规划架构,确保理解用户的真实需求和使用场景,避免过度设计。**
|
|
17
|
+
|
|
18
|
+
2. **不要急于提交代码,应该等待用户明确指示后再进行 commit 和 push 操作。**
|
|
19
|
+
|
|
20
|
+
3. **优先选择简洁的实现方式(如函数导出而非类),并删除冗余的中间层方法以保持代码清晰。**
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
24
|
*This file contains guidelines learned from AI-human collaboration to improve development efficiency and code quality.*
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Francisco Hodge
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Francisco Hodge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# 第一阶段
|
|
2
|
-
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
-
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
-
|
|
5
|
-
# 第二阶段 (单机版)
|
|
6
|
-
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<div align="center">
|
|
19
|
-
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
-
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
-
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
-
|
|
23
|
-
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
-
|
|
25
|
-
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
-
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
## ⭐️ Features
|
|
30
|
-
|
|
31
|
-
- Webpack 5
|
|
32
|
-
- Babel 7
|
|
33
|
-
- Hot reloading (`npm start`)
|
|
34
|
-
- Automatic Types file generation (index.d.ts)
|
|
35
|
-
- UMD exports, so your library works everywhere.
|
|
36
|
-
- Jest unit testing
|
|
37
|
-
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
-
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
-
|
|
40
|
-
## 📦 Getting Started
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
-
npm install
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## 💎 Customization
|
|
48
|
-
|
|
49
|
-
> Before shipping, make sure to:
|
|
50
|
-
|
|
51
|
-
1. Edit `LICENSE` file
|
|
52
|
-
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
-
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
-
|
|
55
|
-
## 🚀 Deployment
|
|
56
|
-
|
|
57
|
-
1. `npm publish`
|
|
58
|
-
2. Your users can include your library as usual
|
|
59
|
-
|
|
60
|
-
### npm
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
import MyLibrary from 'my-library';
|
|
64
|
-
const libraryInstance = new MyLibrary();
|
|
65
|
-
...
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### self-host/cdn
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
<script src="build/index.js"></script>
|
|
72
|
-
|
|
73
|
-
const MyLibrary = window.MyLibrary.default;
|
|
74
|
-
const libraryInstance = new MyLibrary();
|
|
75
|
-
...
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## ✅ Libraries built with this boilerplate
|
|
79
|
-
|
|
80
|
-
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
-
|
|
82
|
-
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
-
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
-
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
-
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
|
1
|
+
# 第一阶段
|
|
2
|
+
- 1. 创建,更新,删除都是通过 -> Http API
|
|
3
|
+
- 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
|
|
4
|
+
|
|
5
|
+
# 第二阶段 (单机版)
|
|
6
|
+
1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<div align="center">
|
|
19
|
+
<img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
|
|
20
|
+
<h2>Typescript Library Boilerplate Basic</h2>
|
|
21
|
+
<blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
|
|
22
|
+
|
|
23
|
+
<a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
|
|
24
|
+
|
|
25
|
+
<strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
|
|
26
|
+
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
## ⭐️ Features
|
|
30
|
+
|
|
31
|
+
- Webpack 5
|
|
32
|
+
- Babel 7
|
|
33
|
+
- Hot reloading (`npm start`)
|
|
34
|
+
- Automatic Types file generation (index.d.ts)
|
|
35
|
+
- UMD exports, so your library works everywhere.
|
|
36
|
+
- Jest unit testing
|
|
37
|
+
- Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
|
|
38
|
+
- Daily [dependabot](https://dependabot.com) dependency updates
|
|
39
|
+
|
|
40
|
+
## 📦 Getting Started
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 💎 Customization
|
|
48
|
+
|
|
49
|
+
> Before shipping, make sure to:
|
|
50
|
+
|
|
51
|
+
1. Edit `LICENSE` file
|
|
52
|
+
2. Edit `package.json` information (These will be used to generate the headers for your built files)
|
|
53
|
+
3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
|
|
54
|
+
|
|
55
|
+
## 🚀 Deployment
|
|
56
|
+
|
|
57
|
+
1. `npm publish`
|
|
58
|
+
2. Your users can include your library as usual
|
|
59
|
+
|
|
60
|
+
### npm
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
import MyLibrary from 'my-library';
|
|
64
|
+
const libraryInstance = new MyLibrary();
|
|
65
|
+
...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### self-host/cdn
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
<script src="build/index.js"></script>
|
|
72
|
+
|
|
73
|
+
const MyLibrary = window.MyLibrary.default;
|
|
74
|
+
const libraryInstance = new MyLibrary();
|
|
75
|
+
...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## ✅ Libraries built with this boilerplate
|
|
79
|
+
|
|
80
|
+
> Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
|
|
81
|
+
|
|
82
|
+
- [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
|
|
83
|
+
- [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
|
|
84
|
+
- [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
|
|
85
|
+
- [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
|
package/build/index.d.ts
CHANGED
|
@@ -2725,9 +2725,11 @@ interface IInvoiceCoreLine {
|
|
|
2725
2725
|
unit_of_measure: UomType;
|
|
2726
2726
|
/** Quantity if it is quantity, e.g. 5*/
|
|
2727
2727
|
quantity: number;
|
|
2728
|
-
/**
|
|
2729
|
-
/**
|
|
2728
|
+
/** 已发送到厨房的数量,如 qty=5, sent=3 表示还有2个未发送 */
|
|
2729
|
+
/** minusLineQuantity 用 (quantity - sent) 计算可自由删除的未发送数量 */
|
|
2730
2730
|
sent: number;
|
|
2731
|
+
/** UI标志,用于Order List区分已下单/未下单,应与 sent > 0 同步 */
|
|
2732
|
+
is_sent: boolean;
|
|
2731
2733
|
/** Whether cancel slip is printed */
|
|
2732
2734
|
is_cancel_printed: boolean;
|
|
2733
2735
|
/** Whether it is selected */
|
|
@@ -2942,6 +2944,7 @@ declare class InvoiceCoreLine implements IInvoiceCoreLine {
|
|
|
2942
2944
|
unit_of_measure: UomType;
|
|
2943
2945
|
quantity: number;
|
|
2944
2946
|
sent: number;
|
|
2947
|
+
is_sent: boolean;
|
|
2945
2948
|
is_cancel_printed: boolean;
|
|
2946
2949
|
selected: boolean;
|
|
2947
2950
|
constructor();
|
|
@@ -2971,6 +2974,7 @@ declare class InvoiceLine extends AppCoreModel implements IInvoiceLine {
|
|
|
2971
2974
|
modifiers: any[];
|
|
2972
2975
|
duplicated_from_uid: string;
|
|
2973
2976
|
sent: number;
|
|
2977
|
+
is_sent: boolean;
|
|
2974
2978
|
is_cancel_printed: boolean;
|
|
2975
2979
|
selected: boolean;
|
|
2976
2980
|
meta: {};
|
|
@@ -5093,6 +5097,7 @@ type LineOptions = {
|
|
|
5093
5097
|
quantity?: number;
|
|
5094
5098
|
price?: number;
|
|
5095
5099
|
remark?: string;
|
|
5100
|
+
is_sent?: boolean;
|
|
5096
5101
|
};
|
|
5097
5102
|
declare class InvoiceBaseService extends AppRemoteService<IInvoice> implements IInvoiceBaseService {
|
|
5098
5103
|
readonly http: AxiosInstance;
|
|
@@ -5381,7 +5386,7 @@ declare class LineOperationService extends InvoiceBaseService implements ILineOp
|
|
|
5381
5386
|
addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
5382
5387
|
changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
|
|
5383
5388
|
overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
|
|
5384
|
-
findOrCreateLine(invoice: IInvoice, item: IItem, quantity: number, price?: number, modifiers?: IInvoiceCoreLine[], remark?: string, createNewLine?: boolean, comboLineUid?: string, comboGroupUid?: string): IInvoiceLine;
|
|
5389
|
+
findOrCreateLine(invoice: IInvoice, item: IItem, quantity: number, price?: number, modifiers?: IInvoiceCoreLine[], remark?: string, createNewLine?: boolean, comboLineUid?: string, comboGroupUid?: string, is_sent?: boolean): IInvoiceLine;
|
|
5385
5390
|
private createInvoiceLine;
|
|
5386
5391
|
protected compareModifiers(target: IInvoiceCoreLine[], source: IInvoiceCoreLine[]): boolean;
|
|
5387
5392
|
/**
|
package/build/index.js
CHANGED
|
@@ -1715,6 +1715,7 @@ var InvoiceCoreLine = class {
|
|
|
1715
1715
|
_defineProperty(this, "unit_of_measure", UomType.quantity);
|
|
1716
1716
|
_defineProperty(this, "quantity", 0);
|
|
1717
1717
|
_defineProperty(this, "sent", 0);
|
|
1718
|
+
_defineProperty(this, "is_sent", false);
|
|
1718
1719
|
_defineProperty(this, "is_cancel_printed", false);
|
|
1719
1720
|
_defineProperty(this, "selected", false);
|
|
1720
1721
|
}
|
|
@@ -1746,6 +1747,7 @@ var InvoiceLine = class extends AppCoreModel {
|
|
|
1746
1747
|
_defineProperty(this, "modifiers", []);
|
|
1747
1748
|
_defineProperty(this, "duplicated_from_uid", "");
|
|
1748
1749
|
_defineProperty(this, "sent", 0);
|
|
1750
|
+
_defineProperty(this, "is_sent", false);
|
|
1749
1751
|
_defineProperty(this, "is_cancel_printed", false);
|
|
1750
1752
|
_defineProperty(this, "selected", false);
|
|
1751
1753
|
_defineProperty(this, "meta", {});
|
|
@@ -3622,7 +3624,7 @@ var LineOperationService = class extends InvoiceBaseService {
|
|
|
3622
3624
|
...lineOptions
|
|
3623
3625
|
};
|
|
3624
3626
|
if (invoice.lines == null) invoice.lines = [];
|
|
3625
|
-
const line = this.findOrCreateLine(invoice, item, options.quantity, options.price, modifiers, options.remark, createNewLine, comboLineUid, comboGroupUid);
|
|
3627
|
+
const line = this.findOrCreateLine(invoice, item, options.quantity, options.price, modifiers, options.remark, createNewLine, comboLineUid, comboGroupUid, options.is_sent);
|
|
3626
3628
|
if (item.type == ProductType.Combo) line.is_combo = true;
|
|
3627
3629
|
if (line.uid) {
|
|
3628
3630
|
line.quantity += options.quantity;
|
|
@@ -3743,7 +3745,7 @@ var LineOperationService = class extends InvoiceBaseService {
|
|
|
3743
3745
|
line.remark = note;
|
|
3744
3746
|
return line;
|
|
3745
3747
|
}
|
|
3746
|
-
findOrCreateLine(invoice, item, quantity, price = 0, modifiers = [], remark = "", createNewLine = false, comboLineUid, comboGroupUid) {
|
|
3748
|
+
findOrCreateLine(invoice, item, quantity, price = 0, modifiers = [], remark = "", createNewLine = false, comboLineUid, comboGroupUid, is_sent) {
|
|
3747
3749
|
price = price ?? item.price;
|
|
3748
3750
|
if (!invoice.lines || invoice.lines.length <= 0 || createNewLine) return this.createInvoiceLine(item, quantity, price, modifiers, remark);
|
|
3749
3751
|
else {
|
|
@@ -3752,7 +3754,7 @@ var LineOperationService = class extends InvoiceBaseService {
|
|
|
3752
3754
|
else {
|
|
3753
3755
|
if (comboLineUid && comboGroupUid) {
|
|
3754
3756
|
for (const line of lines.filter((l) => l.is_combo_item)) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && line.combo_line_uid === comboLineUid && line.combo_group_uid === comboGroupUid) return line;
|
|
3755
|
-
} else for (const line of lines) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && !line.is_take_out) return line;
|
|
3757
|
+
} else for (const line of lines) if (this.compareModifiers(line.modifiers, modifiers) && line.remark === remark && line.price === price && !line.is_take_out && (is_sent === void 0 || line.is_sent === is_sent)) return line;
|
|
3756
3758
|
return this.createInvoiceLine(item, quantity, price, modifiers, remark);
|
|
3757
3759
|
}
|
|
3758
3760
|
}
|
|
@@ -4587,7 +4589,10 @@ var InvoiceOperationService = class extends LineOperationService {
|
|
|
4587
4589
|
});
|
|
4588
4590
|
}
|
|
4589
4591
|
async preprocessInvoice(invoice) {
|
|
4590
|
-
if (invoice.lines) for (const line of invoice.lines)
|
|
4592
|
+
if (invoice.lines) for (const line of invoice.lines) {
|
|
4593
|
+
line.sent = line.quantity;
|
|
4594
|
+
line.is_sent = true;
|
|
4595
|
+
}
|
|
4591
4596
|
return invoice;
|
|
4592
4597
|
}
|
|
4593
4598
|
/**
|
package/jest.config.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// jest.config.js
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'jsdom',
|
|
5
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.ts$': ['ts-jest', {
|
|
8
|
-
tsconfig: {
|
|
9
|
-
module: 'commonjs',
|
|
10
|
-
esModuleInterop: true,
|
|
11
|
-
}
|
|
12
|
-
}],
|
|
13
|
-
'^.+\\.(mjs|js)$': ['ts-jest', {
|
|
14
|
-
tsconfig: {
|
|
15
|
-
allowJs: true,
|
|
16
|
-
module: 'commonjs',
|
|
17
|
-
esModuleInterop: true,
|
|
18
|
-
}
|
|
19
|
-
}]
|
|
20
|
-
},
|
|
21
|
-
transformIgnorePatterns: [
|
|
22
|
-
'node_modules/(?!(.pnpm|nanoid|@litepos|dexie)/)', // Transform ESM packages
|
|
23
|
-
],
|
|
24
|
-
testMatch: [
|
|
25
|
-
'<rootDir>/src/test/**/*.test.ts'
|
|
26
|
-
],
|
|
27
|
-
moduleNameMapper: {
|
|
28
|
-
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/scripts/testMock.cjs',
|
|
29
|
-
'\\.(css|less)$': '<rootDir>/scripts/testMock.cjs',
|
|
30
|
-
'^nanoid$': '<rootDir>/src/test/__mocks__/nanoid.js',
|
|
31
|
-
'^dexie$': '<rootDir>/src/test/__mocks__/dexie.js',
|
|
32
|
-
'^@awesome-cordova-plugins/network-interface$': '<rootDir>/src/test/__mocks__/@awesome-cordova-plugins/network-interface.js',
|
|
33
|
-
'^canvas$': '<rootDir>/scripts/testMock.cjs'
|
|
34
|
-
},
|
|
35
|
-
moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'],
|
|
36
|
-
};
|
|
1
|
+
// jest.config.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
testEnvironment: 'jsdom',
|
|
5
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.ts$': ['ts-jest', {
|
|
8
|
+
tsconfig: {
|
|
9
|
+
module: 'commonjs',
|
|
10
|
+
esModuleInterop: true,
|
|
11
|
+
}
|
|
12
|
+
}],
|
|
13
|
+
'^.+\\.(mjs|js)$': ['ts-jest', {
|
|
14
|
+
tsconfig: {
|
|
15
|
+
allowJs: true,
|
|
16
|
+
module: 'commonjs',
|
|
17
|
+
esModuleInterop: true,
|
|
18
|
+
}
|
|
19
|
+
}]
|
|
20
|
+
},
|
|
21
|
+
transformIgnorePatterns: [
|
|
22
|
+
'node_modules/(?!(.pnpm|nanoid|@litepos|dexie)/)', // Transform ESM packages
|
|
23
|
+
],
|
|
24
|
+
testMatch: [
|
|
25
|
+
'<rootDir>/src/test/**/*.test.ts'
|
|
26
|
+
],
|
|
27
|
+
moduleNameMapper: {
|
|
28
|
+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/scripts/testMock.cjs',
|
|
29
|
+
'\\.(css|less)$': '<rootDir>/scripts/testMock.cjs',
|
|
30
|
+
'^nanoid$': '<rootDir>/src/test/__mocks__/nanoid.js',
|
|
31
|
+
'^dexie$': '<rootDir>/src/test/__mocks__/dexie.js',
|
|
32
|
+
'^@awesome-cordova-plugins/network-interface$': '<rootDir>/src/test/__mocks__/@awesome-cordova-plugins/network-interface.js',
|
|
33
|
+
'^canvas$': '<rootDir>/scripts/testMock.cjs'
|
|
34
|
+
},
|
|
35
|
+
moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'],
|
|
36
|
+
};
|
package/jest.setup.cjs
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
// Jest setup file to polyfill File and Blob APIs
|
|
2
|
-
// This ensures consistent behavior across different Node.js versions and test environments
|
|
3
|
-
|
|
4
|
-
// Polyfill Blob.text() if not available
|
|
5
|
-
if (typeof Blob !== 'undefined' && !Blob.prototype.text) {
|
|
6
|
-
Blob.prototype.text = async function() {
|
|
7
|
-
const reader = new FileReader();
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
reader.onload = () => resolve(reader.result);
|
|
10
|
-
reader.onerror = reject;
|
|
11
|
-
reader.readAsText(this);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Polyfill FileReader if not available
|
|
17
|
-
if (typeof FileReader === 'undefined') {
|
|
18
|
-
global.FileReader = class FileReader {
|
|
19
|
-
result = null;
|
|
20
|
-
error = null;
|
|
21
|
-
onload = null;
|
|
22
|
-
onerror = null;
|
|
23
|
-
|
|
24
|
-
readAsText(blob) {
|
|
25
|
-
try {
|
|
26
|
-
// For our polyfilled Blob
|
|
27
|
-
if (blob.parts) {
|
|
28
|
-
this.result = blob.parts.join('');
|
|
29
|
-
} else if (typeof blob === 'string') {
|
|
30
|
-
this.result = blob;
|
|
31
|
-
} else {
|
|
32
|
-
this.result = String(blob);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (this.onload) {
|
|
36
|
-
setTimeout(() => this.onload({ target: this }), 0);
|
|
37
|
-
}
|
|
38
|
-
} catch (err) {
|
|
39
|
-
this.error = err;
|
|
40
|
-
if (this.onerror) {
|
|
41
|
-
setTimeout(() => this.onerror({ target: this }), 0);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Polyfill Blob if not available (for Node.js < 18)
|
|
49
|
-
if (typeof Blob === 'undefined') {
|
|
50
|
-
global.Blob = class Blob {
|
|
51
|
-
constructor(parts = [], options = {}) {
|
|
52
|
-
this.parts = parts;
|
|
53
|
-
this.type = options.type || '';
|
|
54
|
-
this.size = parts.reduce((acc, part) => {
|
|
55
|
-
return acc + (typeof part === 'string' ? part.length : part.length || 0);
|
|
56
|
-
}, 0);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async text() {
|
|
60
|
-
return this.parts.join('');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async arrayBuffer() {
|
|
64
|
-
const text = await this.text();
|
|
65
|
-
const buffer = Buffer.from(text);
|
|
66
|
-
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Polyfill File if not available (for Node.js < 18)
|
|
72
|
-
if (typeof File === 'undefined') {
|
|
73
|
-
global.File = class File extends global.Blob {
|
|
74
|
-
constructor(bits, name, options = {}) {
|
|
75
|
-
super(bits, options);
|
|
76
|
-
this.name = name;
|
|
77
|
-
this.lastModified = options.lastModified || Date.now();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
1
|
+
// Jest setup file to polyfill File and Blob APIs
|
|
2
|
+
// This ensures consistent behavior across different Node.js versions and test environments
|
|
3
|
+
|
|
4
|
+
// Polyfill Blob.text() if not available
|
|
5
|
+
if (typeof Blob !== 'undefined' && !Blob.prototype.text) {
|
|
6
|
+
Blob.prototype.text = async function() {
|
|
7
|
+
const reader = new FileReader();
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
reader.onload = () => resolve(reader.result);
|
|
10
|
+
reader.onerror = reject;
|
|
11
|
+
reader.readAsText(this);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Polyfill FileReader if not available
|
|
17
|
+
if (typeof FileReader === 'undefined') {
|
|
18
|
+
global.FileReader = class FileReader {
|
|
19
|
+
result = null;
|
|
20
|
+
error = null;
|
|
21
|
+
onload = null;
|
|
22
|
+
onerror = null;
|
|
23
|
+
|
|
24
|
+
readAsText(blob) {
|
|
25
|
+
try {
|
|
26
|
+
// For our polyfilled Blob
|
|
27
|
+
if (blob.parts) {
|
|
28
|
+
this.result = blob.parts.join('');
|
|
29
|
+
} else if (typeof blob === 'string') {
|
|
30
|
+
this.result = blob;
|
|
31
|
+
} else {
|
|
32
|
+
this.result = String(blob);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.onload) {
|
|
36
|
+
setTimeout(() => this.onload({ target: this }), 0);
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
this.error = err;
|
|
40
|
+
if (this.onerror) {
|
|
41
|
+
setTimeout(() => this.onerror({ target: this }), 0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Polyfill Blob if not available (for Node.js < 18)
|
|
49
|
+
if (typeof Blob === 'undefined') {
|
|
50
|
+
global.Blob = class Blob {
|
|
51
|
+
constructor(parts = [], options = {}) {
|
|
52
|
+
this.parts = parts;
|
|
53
|
+
this.type = options.type || '';
|
|
54
|
+
this.size = parts.reduce((acc, part) => {
|
|
55
|
+
return acc + (typeof part === 'string' ? part.length : part.length || 0);
|
|
56
|
+
}, 0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async text() {
|
|
60
|
+
return this.parts.join('');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async arrayBuffer() {
|
|
64
|
+
const text = await this.text();
|
|
65
|
+
const buffer = Buffer.from(text);
|
|
66
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Polyfill File if not available (for Node.js < 18)
|
|
72
|
+
if (typeof File === 'undefined') {
|
|
73
|
+
global.File = class File extends global.Blob {
|
|
74
|
+
constructor(bits, name, options = {}) {
|
|
75
|
+
super(bits, options);
|
|
76
|
+
this.name = name;
|
|
77
|
+
this.lastModified = options.lastModified || Date.now();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
package/package.json
CHANGED
package/package.publish.json
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@posx/core",
|
|
3
|
-
"version": "5.5.
|
|
4
|
-
"description": "POSX core libraries",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./build/index.js",
|
|
7
|
-
"module": "./build/index.js",
|
|
8
|
-
"types": "./build/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./build/index.js",
|
|
12
|
-
"types": "./build/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"build"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"up": "node ./scripts/upload-to-s3.cjs --trace-warnings",
|
|
20
|
-
"start": "tsdown --watch",
|
|
21
|
-
"build": "tsdown",
|
|
22
|
-
"build:dts": "tsdown --dts-only",
|
|
23
|
-
"post:build": "node ./scripts/clean-build.cjs",
|
|
24
|
-
"mvm": "mv build/*.map scripts/sourcemaps/ && mv build/**/*.map scripts/sourcemaps/ && find build -name '*.map' -type f -delete",
|
|
25
|
-
"build:demo": "vite build --mode demo",
|
|
26
|
-
"test": "jest --maxWorkers=2",
|
|
27
|
-
"test:watch": "jest --watch",
|
|
28
|
-
"publish": "node ./scripts/publish.cjs",
|
|
29
|
-
"p": "pnpm i && npm test && npm run up:p && npm run build && npm run post:build && npm run publish && rm -rf build",
|
|
30
|
-
"debug": "npm run build && npm run post:build",
|
|
31
|
-
"coverage": "jest --coverage",
|
|
32
|
-
"trypublish": "npm publish || true",
|
|
33
|
-
"gen:index": "node ./scriptswc/generateIndex.cjs",
|
|
34
|
-
"up:p": "npm version patch && git push",
|
|
35
|
-
"up:m": "npm version minor && git push",
|
|
36
|
-
"docs": "typedoc --out docs src --excludePrivate --exclude '**/demo/**/*' --exclude '**/*+(interface|function|enum).ts'",
|
|
37
|
-
"see": "node ./scripts/lookup-sm.cjs"
|
|
38
|
-
},
|
|
39
|
-
"repository": {
|
|
40
|
-
"type": "git"
|
|
41
|
-
},
|
|
42
|
-
"author": "Steven Lee",
|
|
43
|
-
"license": "UNLICENSED",
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": ""
|
|
46
|
-
},
|
|
47
|
-
"homepage": "",
|
|
48
|
-
"keywords": [
|
|
49
|
-
"library",
|
|
50
|
-
"starter",
|
|
51
|
-
"es6"
|
|
52
|
-
],
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@capacitor/core": "5.4.2",
|
|
55
|
-
"@litepos/autoquery": "5.0.6",
|
|
56
|
-
"@types/bcryptjs": "2.4.6",
|
|
57
|
-
"@types/jest": "30.0.0",
|
|
58
|
-
"@types/lodash": "4.14.199",
|
|
59
|
-
"@types/node": "20.8.2",
|
|
60
|
-
"@types/uuid": "9.0.4",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
|
-
"@typescript-eslint/parser": "^4.33.0",
|
|
63
|
-
"@vitest/coverage-v8": "^2.1.0",
|
|
64
|
-
"ajv": "8.17.1",
|
|
65
|
-
"aws-sdk": "2.1550.0",
|
|
66
|
-
"colors": "1.4.0",
|
|
67
|
-
"eslint": "^7.32.0",
|
|
68
|
-
"fs-extra": "11.1.1",
|
|
69
|
-
"glob": "10.3.10",
|
|
70
|
-
"jest": "30.2.0",
|
|
71
|
-
"jest-environment-jsdom": "30.2.0",
|
|
72
|
-
"jsdom": "27.1.0",
|
|
73
|
-
"prompt-sync": "4.2.0",
|
|
74
|
-
"rollup-plugin-obfuscator": "^1.1.0",
|
|
75
|
-
"sqlite3": "5.1.6",
|
|
76
|
-
"terser": "^5.36.0",
|
|
77
|
-
"ts-jest": "29.4.5",
|
|
78
|
-
"tsdown": "0.16.1",
|
|
79
|
-
"typedoc": "^0.26.0",
|
|
80
|
-
"typescript": "^5.6.3",
|
|
81
|
-
"vite": "^5.4.11",
|
|
82
|
-
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
83
|
-
"vite-plugin-dts": "^4.3.0",
|
|
84
|
-
"vitest": "^2.1.0"
|
|
85
|
-
},
|
|
86
|
-
"dependencies": {
|
|
87
|
-
"@awesome-cordova-plugins/core": "6.6.0",
|
|
88
|
-
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
89
|
-
"@microsoft/signalr": "7.0.11",
|
|
90
|
-
"axios": "1.5.1",
|
|
91
|
-
"bcryptjs": "2.4.3",
|
|
92
|
-
"buffer": "6.0.3",
|
|
93
|
-
"crypto-browserify": "3.12.0",
|
|
94
|
-
"crypto-js": "4.2.0",
|
|
95
|
-
"dayjs": "^1.11.10",
|
|
96
|
-
"dexie": "3.2.4",
|
|
97
|
-
"esc-pos-encoder-ionic": "1.1.3",
|
|
98
|
-
"handlebars": "4.7.8",
|
|
99
|
-
"lodash": "4.17.21",
|
|
100
|
-
"mathjs": "12.3.2",
|
|
101
|
-
"nanoid": "3.3.4",
|
|
102
|
-
"save": "2.9.0",
|
|
103
|
-
"selecttransform": "1.6.1",
|
|
104
|
-
"sockets-for-cordova": "1.0.0",
|
|
105
|
-
"stream-browserify": "3.0.0",
|
|
106
|
-
"uuid": "9.0.1",
|
|
107
|
-
"vm-browserify": "1.1.2",
|
|
108
|
-
"wcwidth": "1.0.1",
|
|
109
|
-
"zod": "3.23.8"
|
|
110
|
-
},
|
|
111
|
-
"peerDependencies": {
|
|
112
|
-
"@litepos/autoquery": "^5.0.6",
|
|
113
|
-
"rxjs": "^7.0.0"
|
|
114
|
-
},
|
|
115
|
-
"peerDependenciesMeta": {
|
|
116
|
-
"rxjs": {
|
|
117
|
-
"optional": true
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@posx/core",
|
|
3
|
+
"version": "5.5.363",
|
|
4
|
+
"description": "POSX core libraries",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./build/index.js",
|
|
7
|
+
"module": "./build/index.js",
|
|
8
|
+
"types": "./build/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"types": "./build/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"build"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"up": "node ./scripts/upload-to-s3.cjs --trace-warnings",
|
|
20
|
+
"start": "tsdown --watch",
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"build:dts": "tsdown --dts-only",
|
|
23
|
+
"post:build": "node ./scripts/clean-build.cjs",
|
|
24
|
+
"mvm": "mv build/*.map scripts/sourcemaps/ && mv build/**/*.map scripts/sourcemaps/ && find build -name '*.map' -type f -delete",
|
|
25
|
+
"build:demo": "vite build --mode demo",
|
|
26
|
+
"test": "jest --maxWorkers=2",
|
|
27
|
+
"test:watch": "jest --watch",
|
|
28
|
+
"publish": "node ./scripts/publish.cjs",
|
|
29
|
+
"p": "pnpm i && npm test && npm run up:p && npm run build && npm run post:build && npm run publish && rm -rf build",
|
|
30
|
+
"debug": "npm run build && npm run post:build",
|
|
31
|
+
"coverage": "jest --coverage",
|
|
32
|
+
"trypublish": "npm publish || true",
|
|
33
|
+
"gen:index": "node ./scriptswc/generateIndex.cjs",
|
|
34
|
+
"up:p": "npm version patch && git push",
|
|
35
|
+
"up:m": "npm version minor && git push",
|
|
36
|
+
"docs": "typedoc --out docs src --excludePrivate --exclude '**/demo/**/*' --exclude '**/*+(interface|function|enum).ts'",
|
|
37
|
+
"see": "node ./scripts/lookup-sm.cjs"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git"
|
|
41
|
+
},
|
|
42
|
+
"author": "Steven Lee",
|
|
43
|
+
"license": "UNLICENSED",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": ""
|
|
46
|
+
},
|
|
47
|
+
"homepage": "",
|
|
48
|
+
"keywords": [
|
|
49
|
+
"library",
|
|
50
|
+
"starter",
|
|
51
|
+
"es6"
|
|
52
|
+
],
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@capacitor/core": "5.4.2",
|
|
55
|
+
"@litepos/autoquery": "5.0.6",
|
|
56
|
+
"@types/bcryptjs": "2.4.6",
|
|
57
|
+
"@types/jest": "30.0.0",
|
|
58
|
+
"@types/lodash": "4.14.199",
|
|
59
|
+
"@types/node": "20.8.2",
|
|
60
|
+
"@types/uuid": "9.0.4",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
63
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
64
|
+
"ajv": "8.17.1",
|
|
65
|
+
"aws-sdk": "2.1550.0",
|
|
66
|
+
"colors": "1.4.0",
|
|
67
|
+
"eslint": "^7.32.0",
|
|
68
|
+
"fs-extra": "11.1.1",
|
|
69
|
+
"glob": "10.3.10",
|
|
70
|
+
"jest": "30.2.0",
|
|
71
|
+
"jest-environment-jsdom": "30.2.0",
|
|
72
|
+
"jsdom": "27.1.0",
|
|
73
|
+
"prompt-sync": "4.2.0",
|
|
74
|
+
"rollup-plugin-obfuscator": "^1.1.0",
|
|
75
|
+
"sqlite3": "5.1.6",
|
|
76
|
+
"terser": "^5.36.0",
|
|
77
|
+
"ts-jest": "29.4.5",
|
|
78
|
+
"tsdown": "0.16.1",
|
|
79
|
+
"typedoc": "^0.26.0",
|
|
80
|
+
"typescript": "^5.6.3",
|
|
81
|
+
"vite": "^5.4.11",
|
|
82
|
+
"vite-plugin-bundle-obfuscator": "1.8.0",
|
|
83
|
+
"vite-plugin-dts": "^4.3.0",
|
|
84
|
+
"vitest": "^2.1.0"
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@awesome-cordova-plugins/core": "6.6.0",
|
|
88
|
+
"@awesome-cordova-plugins/network-interface": "6.6.0",
|
|
89
|
+
"@microsoft/signalr": "7.0.11",
|
|
90
|
+
"axios": "1.5.1",
|
|
91
|
+
"bcryptjs": "2.4.3",
|
|
92
|
+
"buffer": "6.0.3",
|
|
93
|
+
"crypto-browserify": "3.12.0",
|
|
94
|
+
"crypto-js": "4.2.0",
|
|
95
|
+
"dayjs": "^1.11.10",
|
|
96
|
+
"dexie": "3.2.4",
|
|
97
|
+
"esc-pos-encoder-ionic": "1.1.3",
|
|
98
|
+
"handlebars": "4.7.8",
|
|
99
|
+
"lodash": "4.17.21",
|
|
100
|
+
"mathjs": "12.3.2",
|
|
101
|
+
"nanoid": "3.3.4",
|
|
102
|
+
"save": "2.9.0",
|
|
103
|
+
"selecttransform": "1.6.1",
|
|
104
|
+
"sockets-for-cordova": "1.0.0",
|
|
105
|
+
"stream-browserify": "3.0.0",
|
|
106
|
+
"uuid": "9.0.1",
|
|
107
|
+
"vm-browserify": "1.1.2",
|
|
108
|
+
"wcwidth": "1.0.1",
|
|
109
|
+
"zod": "3.23.8"
|
|
110
|
+
},
|
|
111
|
+
"peerDependencies": {
|
|
112
|
+
"@litepos/autoquery": "^5.0.6",
|
|
113
|
+
"rxjs": "^7.0.0"
|
|
114
|
+
},
|
|
115
|
+
"peerDependenciesMeta": {
|
|
116
|
+
"rxjs": {
|
|
117
|
+
"optional": true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
package/tsdown.config.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineConfig } from 'tsdown'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: 'src/index.ts',
|
|
5
|
-
outDir: 'build',
|
|
6
|
-
format: 'esm',
|
|
7
|
-
platform: 'neutral',
|
|
8
|
-
target: 'es2020',
|
|
9
|
-
clean: true,
|
|
10
|
-
sourcemap: true,
|
|
11
|
-
dts: {
|
|
12
|
-
resolve: true,
|
|
13
|
-
},
|
|
14
|
-
external: [
|
|
15
|
-
'@litepos/autoquery',
|
|
16
|
-
'rxjs',
|
|
17
|
-
],
|
|
18
|
-
})
|
|
1
|
+
import { defineConfig } from 'tsdown'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: 'src/index.ts',
|
|
5
|
+
outDir: 'build',
|
|
6
|
+
format: 'esm',
|
|
7
|
+
platform: 'neutral',
|
|
8
|
+
target: 'es2020',
|
|
9
|
+
clean: true,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
dts: {
|
|
12
|
+
resolve: true,
|
|
13
|
+
},
|
|
14
|
+
external: [
|
|
15
|
+
'@litepos/autoquery',
|
|
16
|
+
'rxjs',
|
|
17
|
+
],
|
|
18
|
+
})
|
package/vite.config.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { defineConfig, Plugin } from 'vite'
|
|
2
|
-
import { resolve } from 'path'
|
|
3
|
-
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator'
|
|
4
|
-
import { getBanner } from './scripts/getBanner.mjs'
|
|
5
|
-
|
|
6
|
-
const bannerPlugin = (): Plugin => ({
|
|
7
|
-
name: 'banner-plugin',
|
|
8
|
-
generateBundle(_, bundle) {
|
|
9
|
-
for (const chunk of Object.values(bundle)) {
|
|
10
|
-
if (chunk.type === 'chunk' && chunk.fileName === 'index.js') {
|
|
11
|
-
chunk.code = getBanner() + '\n' + chunk.code
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export default defineConfig({
|
|
18
|
-
plugins: [
|
|
19
|
-
bannerPlugin(),
|
|
20
|
-
vitePluginBundleObfuscator({
|
|
21
|
-
enable: true,
|
|
22
|
-
log: false,
|
|
23
|
-
autoExcludeNodeModules: true,
|
|
24
|
-
threadPool: { enable: true, size: 4 },
|
|
25
|
-
options: {
|
|
26
|
-
compact: true,
|
|
27
|
-
controlFlowFlattening: false,
|
|
28
|
-
deadCodeInjection: false,
|
|
29
|
-
debugProtection: false,
|
|
30
|
-
identifierNamesGenerator: 'hexadecimal',
|
|
31
|
-
renameGlobals: false,
|
|
32
|
-
selfDefending: false,
|
|
33
|
-
simplify: true,
|
|
34
|
-
stringArray: true,
|
|
35
|
-
stringArrayRotate: true,
|
|
36
|
-
stringArrayShuffle: true,
|
|
37
|
-
stringArrayIndexShift: true,
|
|
38
|
-
stringArrayThreshold: 0.6,
|
|
39
|
-
unicodeEscapeSequence: false,
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
build: {
|
|
44
|
-
outDir: 'build',
|
|
45
|
-
lib: {
|
|
46
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
47
|
-
name: '@posx/core',
|
|
48
|
-
formats: ['es'],
|
|
49
|
-
fileName: () => 'index.js',
|
|
50
|
-
},
|
|
51
|
-
rollupOptions: {
|
|
52
|
-
external: [
|
|
53
|
-
'@litepos/autoquery',
|
|
54
|
-
'rxjs',
|
|
55
|
-
],
|
|
56
|
-
output: {
|
|
57
|
-
preserveModules: false,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
sourcemap: true,
|
|
61
|
-
minify: 'terser',
|
|
62
|
-
terserOptions: {
|
|
63
|
-
compress: {
|
|
64
|
-
drop_console: true,
|
|
65
|
-
drop_debugger: true,
|
|
66
|
-
pure_funcs: ['console.log', 'console.info', 'console.debug', 'console.warn'],
|
|
67
|
-
passes: 2,
|
|
68
|
-
},
|
|
69
|
-
mangle: true,
|
|
70
|
-
format: {
|
|
71
|
-
comments: false,
|
|
72
|
-
beautify: false,
|
|
73
|
-
semicolons: true,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
cssMinify: true,
|
|
77
|
-
},
|
|
78
|
-
resolve: {
|
|
79
|
-
alias: {
|
|
80
|
-
buffer: 'buffer/',
|
|
81
|
-
crypto: 'crypto-browserify',
|
|
82
|
-
stream: 'stream-browserify',
|
|
83
|
-
vm: 'vm-browserify',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
})
|
|
1
|
+
import { defineConfig, Plugin } from 'vite'
|
|
2
|
+
import { resolve } from 'path'
|
|
3
|
+
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator'
|
|
4
|
+
import { getBanner } from './scripts/getBanner.mjs'
|
|
5
|
+
|
|
6
|
+
const bannerPlugin = (): Plugin => ({
|
|
7
|
+
name: 'banner-plugin',
|
|
8
|
+
generateBundle(_, bundle) {
|
|
9
|
+
for (const chunk of Object.values(bundle)) {
|
|
10
|
+
if (chunk.type === 'chunk' && chunk.fileName === 'index.js') {
|
|
11
|
+
chunk.code = getBanner() + '\n' + chunk.code
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [
|
|
19
|
+
bannerPlugin(),
|
|
20
|
+
vitePluginBundleObfuscator({
|
|
21
|
+
enable: true,
|
|
22
|
+
log: false,
|
|
23
|
+
autoExcludeNodeModules: true,
|
|
24
|
+
threadPool: { enable: true, size: 4 },
|
|
25
|
+
options: {
|
|
26
|
+
compact: true,
|
|
27
|
+
controlFlowFlattening: false,
|
|
28
|
+
deadCodeInjection: false,
|
|
29
|
+
debugProtection: false,
|
|
30
|
+
identifierNamesGenerator: 'hexadecimal',
|
|
31
|
+
renameGlobals: false,
|
|
32
|
+
selfDefending: false,
|
|
33
|
+
simplify: true,
|
|
34
|
+
stringArray: true,
|
|
35
|
+
stringArrayRotate: true,
|
|
36
|
+
stringArrayShuffle: true,
|
|
37
|
+
stringArrayIndexShift: true,
|
|
38
|
+
stringArrayThreshold: 0.6,
|
|
39
|
+
unicodeEscapeSequence: false,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
build: {
|
|
44
|
+
outDir: 'build',
|
|
45
|
+
lib: {
|
|
46
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
47
|
+
name: '@posx/core',
|
|
48
|
+
formats: ['es'],
|
|
49
|
+
fileName: () => 'index.js',
|
|
50
|
+
},
|
|
51
|
+
rollupOptions: {
|
|
52
|
+
external: [
|
|
53
|
+
'@litepos/autoquery',
|
|
54
|
+
'rxjs',
|
|
55
|
+
],
|
|
56
|
+
output: {
|
|
57
|
+
preserveModules: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
sourcemap: true,
|
|
61
|
+
minify: 'terser',
|
|
62
|
+
terserOptions: {
|
|
63
|
+
compress: {
|
|
64
|
+
drop_console: true,
|
|
65
|
+
drop_debugger: true,
|
|
66
|
+
pure_funcs: ['console.log', 'console.info', 'console.debug', 'console.warn'],
|
|
67
|
+
passes: 2,
|
|
68
|
+
},
|
|
69
|
+
mangle: true,
|
|
70
|
+
format: {
|
|
71
|
+
comments: false,
|
|
72
|
+
beautify: false,
|
|
73
|
+
semicolons: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
cssMinify: true,
|
|
77
|
+
},
|
|
78
|
+
resolve: {
|
|
79
|
+
alias: {
|
|
80
|
+
buffer: 'buffer/',
|
|
81
|
+
crypto: 'crypto-browserify',
|
|
82
|
+
stream: 'stream-browserify',
|
|
83
|
+
vm: 'vm-browserify',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
})
|