@qubit-ltd/common-decorator 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/README.zh_CN.md +24 -2
- package/dist/common-decorator.cjs +2 -2
- package/dist/common-decorator.cjs.map +1 -1
- package/dist/common-decorator.min.cjs.map +1 -1
- package/dist/common-decorator.min.mjs.map +1 -1
- package/dist/common-decorator.mjs +2 -2
- package/dist/common-decorator.mjs.map +1 -1
- package/doc/api/DefaultAssignmentOptions.html +1 -1
- package/doc/api/DefaultOptions.html +1 -1
- package/doc/api/DefaultToJsonOptions.html +1 -1
- package/doc/api/Enum.html +1 -1
- package/doc/api/Model.html +1 -1
- package/doc/api/Page.html +1 -1
- package/doc/api/global.html +35 -2
- package/doc/api/index.html +22 -5
- package/doc/common-decorator.min.visualization.html +1 -1
- package/doc/common-decorator.visualization.html +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
[](https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-common-decorator/tree/master)
|
|
7
7
|
[](https://coveralls.io/github/Haixing-Hu/js-common-decorator?branch=master)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
supports the most recent (
|
|
12
|
-
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
[@qubit-ltd/common-decorator] is a JavaScript library of common decorators that provides powerful tools to enhance your domain classes. The library supports the most recent (as of November 2023) [stage 3 proposal of JavaScript decorators].
|
|
12
|
+
|
|
13
|
+
With this library, you can easily add common methods to your domain classes, implement Java-like enum functionality, add validation and normalization capabilities, and much more - all using the modern decorator syntax.
|
|
13
14
|
|
|
14
15
|
## Features
|
|
15
16
|
|
|
@@ -20,6 +21,7 @@ supports the most recent (currently November 2023)
|
|
|
20
21
|
- **Normalization Support**: `@Normalizable` decorator enables field normalization
|
|
21
22
|
- **Type Safety**: `@Type` and `@ElementType` decorators for type checking
|
|
22
23
|
- **Serialization Utilities**: Built-in JSON serialization/deserialization support
|
|
24
|
+
- **High Test Coverage**: Comprehensive test suite ensuring reliability of all features
|
|
23
25
|
|
|
24
26
|
## Installation
|
|
25
27
|
|
|
@@ -29,6 +31,9 @@ npm install @qubit-ltd/common-decorator
|
|
|
29
31
|
|
|
30
32
|
# Using yarn
|
|
31
33
|
yarn add @qubit-ltd/common-decorator
|
|
34
|
+
|
|
35
|
+
# Using pnpm
|
|
36
|
+
pnpm add @qubit-ltd/common-decorator
|
|
32
37
|
```
|
|
33
38
|
|
|
34
39
|
## <span id="content">Table of Contents</span>
|
|
@@ -74,6 +79,7 @@ yarn add @qubit-ltd/common-decorator
|
|
|
74
79
|
- [Configuration](#configuration)
|
|
75
80
|
- [Bundling with webpack](#webpack)
|
|
76
81
|
- [Bundling with vite](#vite)
|
|
82
|
+
- [Recent Updates](#recent-updates)
|
|
77
83
|
- [Contributing](#contributing)
|
|
78
84
|
- [License](#license)
|
|
79
85
|
|
|
@@ -1152,6 +1158,20 @@ must be at least `7.24.0`.
|
|
|
1152
1158
|
});
|
|
1153
1159
|
```
|
|
1154
1160
|
|
|
1161
|
+
## <span id="recent-updates">Recent Updates</span>
|
|
1162
|
+
|
|
1163
|
+
### Test Coverage Enhancements (December 2023)
|
|
1164
|
+
|
|
1165
|
+
- **Enum Clone Hook Test**: Added comprehensive tests to verify the behavior of enum clone hooks, ensuring that enumerator objects are properly handled during cloning operations.
|
|
1166
|
+
- **Field Validation Coverage**: Enhanced test coverage for field validation, specifically targeting edge cases to ensure robust validation in all scenarios.
|
|
1167
|
+
- **Model Implementation Tests**: Added additional tests for various model implementation functions to achieve higher code coverage.
|
|
1168
|
+
|
|
1169
|
+
The latest updates focus on improving test coverage and reliability, with particular attention to:
|
|
1170
|
+
|
|
1171
|
+
- Ensuring enumerator objects maintain their singleton pattern during cloning
|
|
1172
|
+
- Validating empty fields with proper error handling
|
|
1173
|
+
- Verifying that model implementation functions work correctly in all edge cases
|
|
1174
|
+
|
|
1155
1175
|
## <span id="contributing">Contributing</span>
|
|
1156
1176
|
|
|
1157
1177
|
If you find any issues or have suggestions for improvements, please feel free
|
package/README.zh_CN.md
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
[](https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-common-decorator/tree/master)
|
|
7
7
|
[](https://coveralls.io/github/Haixing-Hu/js-common-decorator?branch=master)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
## 概述
|
|
10
|
+
|
|
11
|
+
[@qubit-ltd/common-decorator] 是一个JavaScript通用装饰器库,为您的领域类提供强大的增强工具。该库支持最新的(截至2023年11月)JavaScript装饰器[stage 3 提案]。
|
|
12
|
+
|
|
13
|
+
使用这个库,您可以轻松地为领域类添加常用方法,实现类似Java的枚举功能,添加验证和规范化功能等 - 所有这些都使用现代装饰器语法。
|
|
11
14
|
|
|
12
15
|
## 特性
|
|
13
16
|
|
|
@@ -18,6 +21,7 @@
|
|
|
18
21
|
- **规范化支持**:`@Normalizable` 装饰器实现字段规范化
|
|
19
22
|
- **类型安全**:`@Type` 和 `@ElementType` 装饰器用于类型检查
|
|
20
23
|
- **序列化工具**:内置 JSON 序列化/反序列化支持
|
|
24
|
+
- **高测试覆盖率**:全面的测试套件确保所有功能的可靠性
|
|
21
25
|
|
|
22
26
|
## 安装
|
|
23
27
|
|
|
@@ -27,6 +31,9 @@ npm install @qubit-ltd/common-decorator
|
|
|
27
31
|
|
|
28
32
|
# 使用 yarn
|
|
29
33
|
yarn add @qubit-ltd/common-decorator
|
|
34
|
+
|
|
35
|
+
# 使用 pnpm
|
|
36
|
+
pnpm add @qubit-ltd/common-decorator
|
|
30
37
|
```
|
|
31
38
|
|
|
32
39
|
## <span id="content">目录</span>
|
|
@@ -72,6 +79,7 @@ yarn add @qubit-ltd/common-decorator
|
|
|
72
79
|
- [配置](#configuration)
|
|
73
80
|
- [使用 webpack 打包](#webpack)
|
|
74
81
|
- [使用 vite 打包](#vite)
|
|
82
|
+
- [最新更新](#recent-updates)
|
|
75
83
|
- [贡献](#contributing)
|
|
76
84
|
- [许可证](#license)
|
|
77
85
|
|
|
@@ -927,6 +935,20 @@ expect(opt1.convertNaming).toBe(false);
|
|
|
927
935
|
});
|
|
928
936
|
```
|
|
929
937
|
|
|
938
|
+
## <span id="recent-updates">最新更新</span>
|
|
939
|
+
|
|
940
|
+
### 测试覆盖增强(2023年12月)
|
|
941
|
+
|
|
942
|
+
- **枚举克隆钩子测试**:添加了全面的测试,验证枚举克隆钩子的行为,确保在克隆操作中正确处理枚举器对象。
|
|
943
|
+
- **字段验证覆盖**:增强了字段验证的测试覆盖率,特别针对边缘情况,确保在所有场景下都能进行可靠的验证。
|
|
944
|
+
- **模型实现测试**:为各种模型实现函数添加了额外的测试,以实现更高的代码覆盖率。
|
|
945
|
+
|
|
946
|
+
最新更新主要集中在提高测试覆盖率和可靠性,特别关注:
|
|
947
|
+
|
|
948
|
+
- 确保枚举器对象在克隆过程中保持单例模式
|
|
949
|
+
- 验证空字段的处理与适当的错误处理
|
|
950
|
+
- 验证模型实现函数在所有边缘情况下都能正常工作
|
|
951
|
+
|
|
930
952
|
## <span id="contributing">贡献</span>
|
|
931
953
|
|
|
932
954
|
如果你发现任何问题或有改进建议,请随时在 [GitHub 仓库] 上提交 issue 或 pull request。
|
|
@@ -12786,11 +12786,11 @@ function createDeferredReadonlyInitializer(propertyName) {
|
|
|
12786
12786
|
* ```js
|
|
12787
12787
|
* class Meal {
|
|
12788
12788
|
* // Field with initial value - immediately read-only
|
|
12789
|
-
*
|
|
12789
|
+
* @Readonly
|
|
12790
12790
|
* entree = 'steak';
|
|
12791
12791
|
*
|
|
12792
12792
|
* // Field without initial value - will be read-only after first assignment
|
|
12793
|
-
*
|
|
12793
|
+
* @Readonly
|
|
12794
12794
|
* dessert;
|
|
12795
12795
|
* }
|
|
12796
12796
|
*
|