@aiao/rxdb-test 0.0.16 → 0.0.17
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 +30 -1
- package/dist/entities/TypeDemo.d.ts +75 -50
- package/dist/entities/TypeDemo.js +43 -7
- package/dist/shop/Attribute.d.ts +634 -1
- package/dist/shop/Attribute.js +3 -3
- package/dist/shop/AttributeValue.d.ts +634 -1
- package/dist/shop/AttributeValue.js +3 -3
- package/dist/shop/Category.d.ts +494 -2
- package/dist/shop/Category.js +13 -2
- package/dist/shop/IdCard.d.ts +412 -2
- package/dist/shop/IdCard.js +2 -2
- package/dist/shop/Order.d.ts +423 -3
- package/dist/shop/Order.js +11 -3
- package/dist/shop/OrderItem.d.ts +374 -2
- package/dist/shop/OrderItem.js +15 -3
- package/dist/shop/Product.d.ts +443 -3
- package/dist/shop/Product.js +13 -2
- package/dist/shop/SKU.d.ts +294 -3
- package/dist/shop/SKU.js +15 -4
- package/dist/shop/SKUAttributes.d.ts +320 -1
- package/dist/shop/SKUAttributes.js +5 -5
- package/dist/shop/User.d.ts +412 -2
- package/dist/shop/User.js +3 -3
- package/dist/shop/index.d.ts +30 -10
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
# rxdb-test
|
|
1
|
+
# @aiao/rxdb-test
|
|
2
|
+
|
|
3
|
+
RxDB 测试工具库,提供测试用的数据库创建和常用测试工具。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **快速创建测试数据库**: 便捷的测试数据库初始化
|
|
8
|
+
- **测试工具**: 常用的测试辅助函数
|
|
9
|
+
- **Vitest 集成**: 开箱即用的 Vitest 支持
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @aiao/rxdb-test
|
|
15
|
+
# 或
|
|
16
|
+
pnpm add @aiao/rxdb-test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 使用
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { createTestDb } from '@aiao/rxdb-test';
|
|
23
|
+
|
|
24
|
+
describe('RxDB Tests', () => {
|
|
25
|
+
it('should create database', async () => {
|
|
26
|
+
const db = await createTestDb();
|
|
27
|
+
// 测试代码
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
```
|
|
@@ -9,6 +9,7 @@ declare type TypeDemoRule = UUIDRules<TypeDemo, 'id'>
|
|
|
9
9
|
| DateRules<TypeDemo, 'updatedAt'>
|
|
10
10
|
| StringRules<TypeDemo, 'createdBy'>
|
|
11
11
|
| StringRules<TypeDemo, 'updatedBy'>
|
|
12
|
+
| UUIDRules<TypeDemo, 'uuid'>
|
|
12
13
|
| StringRules<TypeDemo, 'string'>
|
|
13
14
|
| NumberRules<TypeDemo, 'number'>
|
|
14
15
|
| NumberRules<TypeDemo, 'integer'>
|
|
@@ -18,11 +19,11 @@ declare type TypeDemoRule = UUIDRules<TypeDemo, 'id'>
|
|
|
18
19
|
| StringArrayRules<TypeDemo, 'stringArray', string>
|
|
19
20
|
| NumberArrayRules<TypeDemo, 'numberArray', number>
|
|
20
21
|
| KeyValueRules<TypeDemo, 'keyValue', Partial<TypeDemoKeyValueKeyValue>>
|
|
21
|
-
| RelationStringRules<'keyValue.string', string>
|
|
22
|
-
| RelationNumberRules<'keyValue.number', number>
|
|
23
|
-
| RelationNumberRules<'keyValue.integer', number>
|
|
24
|
-
| RelationBooleanRules<'keyValue.boolean', boolean>
|
|
25
|
-
| RelationDateRules<'keyValue.date', Date>;
|
|
22
|
+
| RelationStringRules<'keyValue.string', string | null>
|
|
23
|
+
| RelationNumberRules<'keyValue.number', number | null>
|
|
24
|
+
| RelationNumberRules<'keyValue.integer', number | null>
|
|
25
|
+
| RelationBooleanRules<'keyValue.boolean', boolean | null>
|
|
26
|
+
| RelationDateRules<'keyValue.date', Date | null>;
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* RuleGroupBase
|
|
@@ -33,6 +34,7 @@ export declare type TypeDemoRuleGroup = RuleGroupBase<typeof TypeDemo,
|
|
|
33
34
|
|'updatedAt'
|
|
34
35
|
|'createdBy'
|
|
35
36
|
|'updatedBy'
|
|
37
|
+
|'uuid'
|
|
36
38
|
|'string'
|
|
37
39
|
|'number'
|
|
38
40
|
|'integer'
|
|
@@ -52,7 +54,7 @@ TypeDemoRule>;
|
|
|
52
54
|
/**
|
|
53
55
|
* OrderByField
|
|
54
56
|
*/
|
|
55
|
-
declare type TypeDemoOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "string" | "number" | "integer" | "boolean" | "date" | "enum" | "stringArray" | "numberArray" | "keyValue" | "json";
|
|
57
|
+
declare type TypeDemoOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "uuid" | "string" | "number" | "integer" | "boolean" | "date" | "enum" | "stringArray" | "numberArray" | "keyValue" | "json";
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
* 静态类型
|
|
@@ -97,56 +99,75 @@ export interface TypeDemoStaticTypes {
|
|
|
97
99
|
*/
|
|
98
100
|
export interface TypeDemoInitData {
|
|
99
101
|
/**
|
|
100
|
-
*
|
|
102
|
+
* UUID
|
|
101
103
|
*/
|
|
102
|
-
|
|
104
|
+
uuid?: UUID | null;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
106
|
+
* 字符串
|
|
105
107
|
*/
|
|
106
|
-
|
|
108
|
+
string?: string | null;
|
|
107
109
|
/**
|
|
108
|
-
*
|
|
110
|
+
* 数字
|
|
109
111
|
*/
|
|
110
|
-
|
|
112
|
+
number?: number | null;
|
|
111
113
|
/**
|
|
112
|
-
*
|
|
114
|
+
* 整数
|
|
113
115
|
*/
|
|
114
|
-
|
|
116
|
+
integer?: number | null;
|
|
115
117
|
/**
|
|
116
|
-
*
|
|
118
|
+
* 布尔值
|
|
117
119
|
*/
|
|
118
|
-
|
|
120
|
+
boolean?: boolean | null;
|
|
119
121
|
/**
|
|
120
|
-
*
|
|
122
|
+
* 日期
|
|
123
|
+
*/
|
|
124
|
+
date?: Date | null;
|
|
125
|
+
/**
|
|
126
|
+
* 枚举
|
|
121
127
|
*/
|
|
122
128
|
enum?: 'active' | 'inactive' | 'pending' | null;
|
|
123
129
|
/**
|
|
124
|
-
*
|
|
130
|
+
* 字符串数组
|
|
125
131
|
*/
|
|
126
|
-
stringArray?: string[];
|
|
132
|
+
stringArray?: string[] | null;
|
|
127
133
|
/**
|
|
128
|
-
*
|
|
134
|
+
* 数字数组
|
|
129
135
|
*/
|
|
130
|
-
numberArray?: number[];
|
|
136
|
+
numberArray?: number[] | null;
|
|
131
137
|
/**
|
|
132
|
-
*
|
|
138
|
+
* 键值对
|
|
133
139
|
*/
|
|
134
|
-
keyValue?: TypeDemoKeyValueKeyValue;
|
|
140
|
+
keyValue?: TypeDemoKeyValueKeyValue | null;
|
|
135
141
|
/**
|
|
136
|
-
*
|
|
142
|
+
* JSON
|
|
137
143
|
*/
|
|
138
|
-
json?: Record<string, any
|
|
144
|
+
json?: Record<string, any> | null;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
/**
|
|
142
|
-
*
|
|
148
|
+
* 键值对
|
|
143
149
|
*/
|
|
144
150
|
export interface TypeDemoKeyValueKeyValue {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
/**
|
|
152
|
+
* 字符串
|
|
153
|
+
*/
|
|
154
|
+
string?: string | null;
|
|
155
|
+
/**
|
|
156
|
+
* 数字
|
|
157
|
+
*/
|
|
158
|
+
number?: number | null;
|
|
159
|
+
/**
|
|
160
|
+
* 整数
|
|
161
|
+
*/
|
|
162
|
+
integer?: number | null;
|
|
163
|
+
/**
|
|
164
|
+
* 布尔值
|
|
165
|
+
*/
|
|
166
|
+
boolean?: boolean | null;
|
|
167
|
+
/**
|
|
168
|
+
* 日期
|
|
169
|
+
*/
|
|
170
|
+
date?: Date | null;
|
|
150
171
|
}
|
|
151
172
|
|
|
152
173
|
/**
|
|
@@ -155,45 +176,49 @@ export interface TypeDemoKeyValueKeyValue {
|
|
|
155
176
|
export declare class TypeDemo extends EntityBase implements IEntity {
|
|
156
177
|
static [ENTITY_STATIC_TYPES]: TypeDemoStaticTypes;
|
|
157
178
|
/**
|
|
158
|
-
*
|
|
179
|
+
* 布尔值
|
|
159
180
|
*/
|
|
160
|
-
boolean
|
|
181
|
+
boolean?: boolean | null;
|
|
161
182
|
/**
|
|
162
|
-
*
|
|
183
|
+
* 日期
|
|
163
184
|
*/
|
|
164
|
-
date
|
|
185
|
+
date?: Date | null;
|
|
165
186
|
/**
|
|
166
|
-
*
|
|
187
|
+
* 枚举
|
|
167
188
|
*/
|
|
168
189
|
enum?: 'active' | 'inactive' | 'pending' | null;
|
|
169
190
|
/**
|
|
170
|
-
*
|
|
191
|
+
* 整数
|
|
192
|
+
*/
|
|
193
|
+
integer?: number | null;
|
|
194
|
+
/**
|
|
195
|
+
* JSON
|
|
171
196
|
*/
|
|
172
|
-
|
|
197
|
+
json?: Record<string, any> | null;
|
|
173
198
|
/**
|
|
174
|
-
*
|
|
199
|
+
* 键值对
|
|
175
200
|
*/
|
|
176
|
-
|
|
201
|
+
keyValue?: TypeDemoKeyValueKeyValue | null;
|
|
177
202
|
/**
|
|
178
|
-
*
|
|
203
|
+
* 数字
|
|
179
204
|
*/
|
|
180
|
-
|
|
205
|
+
number?: number | null;
|
|
181
206
|
/**
|
|
182
|
-
*
|
|
207
|
+
* 数字数组
|
|
183
208
|
*/
|
|
184
|
-
number
|
|
209
|
+
numberArray?: number[] | null;
|
|
185
210
|
/**
|
|
186
|
-
*
|
|
211
|
+
* 字符串
|
|
187
212
|
*/
|
|
188
|
-
|
|
213
|
+
string?: string | null;
|
|
189
214
|
/**
|
|
190
|
-
*
|
|
215
|
+
* 字符串数组
|
|
191
216
|
*/
|
|
192
|
-
string
|
|
217
|
+
stringArray?: string[] | null;
|
|
193
218
|
/**
|
|
194
|
-
*
|
|
219
|
+
* UUID
|
|
195
220
|
*/
|
|
196
|
-
|
|
221
|
+
uuid?: UUID | null;
|
|
197
222
|
/**
|
|
198
223
|
* 初始化数据
|
|
199
224
|
* @param initData 初始化数据
|
|
@@ -7,31 +7,49 @@ TypeDemo = __decorateClass(
|
|
|
7
7
|
tableName: "type_demo",
|
|
8
8
|
properties: [
|
|
9
9
|
{
|
|
10
|
+
displayName: "UUID",
|
|
11
|
+
name: "uuid",
|
|
12
|
+
type: PropertyType.uuid,
|
|
13
|
+
nullable: true,
|
|
14
|
+
columnName: "uuid"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
displayName: "字符串",
|
|
10
18
|
name: "string",
|
|
11
19
|
type: PropertyType.string,
|
|
20
|
+
nullable: true,
|
|
12
21
|
columnName: "string"
|
|
13
22
|
},
|
|
14
23
|
{
|
|
24
|
+
displayName: "数字",
|
|
15
25
|
name: "number",
|
|
16
26
|
type: PropertyType.number,
|
|
27
|
+
nullable: true,
|
|
17
28
|
columnName: "number"
|
|
18
29
|
},
|
|
19
30
|
{
|
|
31
|
+
displayName: "整数",
|
|
20
32
|
name: "integer",
|
|
21
33
|
type: PropertyType.integer,
|
|
34
|
+
nullable: true,
|
|
22
35
|
columnName: "integer"
|
|
23
36
|
},
|
|
24
37
|
{
|
|
38
|
+
displayName: "布尔值",
|
|
25
39
|
name: "boolean",
|
|
26
40
|
type: PropertyType.boolean,
|
|
41
|
+
nullable: true,
|
|
27
42
|
columnName: "boolean"
|
|
28
43
|
},
|
|
29
44
|
{
|
|
45
|
+
displayName: "日期",
|
|
30
46
|
name: "date",
|
|
31
47
|
type: PropertyType.date,
|
|
48
|
+
nullable: true,
|
|
32
49
|
columnName: "date"
|
|
33
50
|
},
|
|
34
51
|
{
|
|
52
|
+
displayName: "枚举",
|
|
35
53
|
name: "enum",
|
|
36
54
|
type: PropertyType.enum,
|
|
37
55
|
enum: [
|
|
@@ -43,45 +61,63 @@ TypeDemo = __decorateClass(
|
|
|
43
61
|
columnName: "enum"
|
|
44
62
|
},
|
|
45
63
|
{
|
|
64
|
+
displayName: "字符串数组",
|
|
46
65
|
name: "stringArray",
|
|
47
66
|
columnName: "string_array",
|
|
48
|
-
type: PropertyType.stringArray
|
|
67
|
+
type: PropertyType.stringArray,
|
|
68
|
+
nullable: true
|
|
49
69
|
},
|
|
50
70
|
{
|
|
71
|
+
displayName: "数字数组",
|
|
51
72
|
name: "numberArray",
|
|
52
73
|
columnName: "number_array",
|
|
53
|
-
type: PropertyType.numberArray
|
|
74
|
+
type: PropertyType.numberArray,
|
|
75
|
+
nullable: true
|
|
54
76
|
},
|
|
55
77
|
{
|
|
56
78
|
name: "keyValue",
|
|
57
79
|
columnName: "key_value",
|
|
58
80
|
type: PropertyType.keyValue,
|
|
81
|
+
displayName: "键值对",
|
|
82
|
+
nullable: true,
|
|
59
83
|
properties: [
|
|
60
84
|
{
|
|
85
|
+
displayName: "字符串",
|
|
61
86
|
name: "string",
|
|
62
|
-
type: PropertyType.string
|
|
87
|
+
type: PropertyType.string,
|
|
88
|
+
nullable: true
|
|
63
89
|
},
|
|
64
90
|
{
|
|
91
|
+
displayName: "数字",
|
|
65
92
|
name: "number",
|
|
66
|
-
type: PropertyType.number
|
|
93
|
+
type: PropertyType.number,
|
|
94
|
+
nullable: true
|
|
67
95
|
},
|
|
68
96
|
{
|
|
97
|
+
displayName: "整数",
|
|
69
98
|
name: "integer",
|
|
70
|
-
type: PropertyType.integer
|
|
99
|
+
type: PropertyType.integer,
|
|
100
|
+
nullable: true
|
|
71
101
|
},
|
|
72
102
|
{
|
|
103
|
+
displayName: "布尔值",
|
|
73
104
|
name: "boolean",
|
|
74
|
-
type: PropertyType.boolean
|
|
105
|
+
type: PropertyType.boolean,
|
|
106
|
+
nullable: true
|
|
75
107
|
},
|
|
76
108
|
{
|
|
109
|
+
displayName: "日期",
|
|
77
110
|
name: "date",
|
|
78
|
-
type: PropertyType.date
|
|
111
|
+
type: PropertyType.date,
|
|
112
|
+
nullable: true
|
|
79
113
|
}
|
|
80
114
|
]
|
|
81
115
|
},
|
|
82
116
|
{
|
|
117
|
+
displayName: "JSON",
|
|
83
118
|
name: "json",
|
|
84
119
|
type: PropertyType.json,
|
|
120
|
+
nullable: true,
|
|
85
121
|
columnName: "json"
|
|
86
122
|
}
|
|
87
123
|
],
|