@aiao/rxdb-test 0.0.15 → 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.
Files changed (50) hide show
  1. package/README.md +30 -1
  2. package/dist/entities/FileLarge.d.ts +339 -0
  3. package/dist/entities/FileLarge.js +77 -0
  4. package/dist/entities/FileNode.d.ts +335 -0
  5. package/dist/entities/FileNode.js +77 -0
  6. package/dist/entities/MenuLarge.d.ts +294 -0
  7. package/dist/entities/MenuLarge.js +41 -0
  8. package/dist/entities/MenuSimple.d.ts +290 -0
  9. package/dist/entities/MenuSimple.js +41 -0
  10. package/dist/entities/Todo.d.ts +165 -0
  11. package/dist/entities/Todo.js +34 -0
  12. package/dist/entities/TypeDemo.d.ts +289 -0
  13. package/dist/entities/TypeDemo.js +137 -0
  14. package/dist/entities/index.d.ts +14 -1655
  15. package/dist/entities/index.js +6 -360
  16. package/dist/graph/index.d.ts +1 -2
  17. package/dist/graph/index.js +1 -1
  18. package/dist/shop/Attribute.d.ts +992 -0
  19. package/dist/shop/Attribute.js +50 -0
  20. package/dist/shop/AttributeValue.d.ts +999 -0
  21. package/dist/shop/AttributeValue.js +51 -0
  22. package/dist/shop/Category.d.ts +772 -0
  23. package/dist/shop/Category.js +52 -0
  24. package/dist/shop/IdCard.d.ts +647 -0
  25. package/dist/shop/IdCard.js +43 -0
  26. package/dist/shop/Order.d.ts +690 -0
  27. package/dist/shop/Order.js +66 -0
  28. package/dist/shop/OrderItem.d.ts +665 -0
  29. package/dist/shop/OrderItem.js +76 -0
  30. package/dist/shop/Product.d.ts +761 -0
  31. package/dist/shop/Product.js +58 -0
  32. package/dist/shop/SKU.d.ts +634 -0
  33. package/dist/shop/SKU.js +74 -0
  34. package/dist/shop/SKUAttributes.d.ts +625 -0
  35. package/dist/shop/SKUAttributes.js +56 -0
  36. package/dist/shop/User.d.ts +679 -0
  37. package/dist/shop/User.js +74 -0
  38. package/dist/shop/index.d.ts +52 -2990
  39. package/dist/shop/index.js +10 -528
  40. package/dist/system/RxDBBranch.d.ts +396 -0
  41. package/dist/system/RxDBBranch.js +106 -0
  42. package/dist/system/RxDBChange.d.ts +361 -0
  43. package/dist/system/RxDBChange.js +123 -0
  44. package/dist/system/RxDBMigration.d.ts +167 -0
  45. package/dist/system/RxDBMigration.js +40 -0
  46. package/dist/system/RxDBSync.d.ts +339 -0
  47. package/dist/system/RxDBSync.js +122 -0
  48. package/dist/system/index.d.ts +9 -1240
  49. package/dist/system/index.js +4 -384
  50. 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
+ ```
@@ -0,0 +1,339 @@
1
+ import { CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, IEntity, ITreeEntity, NumberRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationExistsRules, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, TreeAdjacencyListEntityBase, UUID, UUIDRules } from '@aiao/rxdb';
2
+ import { Observable } from 'rxjs';
3
+
4
+ /**
5
+ * rule
6
+ */
7
+ declare type FileLargeRule = UUIDRules<FileLarge, 'id'>
8
+ | DateRules<FileLarge, 'createdAt'>
9
+ | DateRules<FileLarge, 'updatedAt'>
10
+ | StringRules<FileLarge, 'createdBy'>
11
+ | StringRules<FileLarge, 'updatedBy'>
12
+ | StringRules<FileLarge, 'name'>
13
+ | StringRules<FileLarge, 'type'>
14
+ | StringRules<FileLarge, 'sortOrder'>
15
+ | StringRules<FileLarge, 'extension'>
16
+ | NumberRules<FileLarge, 'size'>
17
+ | UUIDRules<FileLarge, 'parentId'>
18
+ | RelationExistsRules<'children', FileLargeRuleGroup>
19
+ | RelationUUIDRules<'children.id', UUID>
20
+ | RelationDateRules<'children.createdAt', Date>
21
+ | RelationDateRules<'children.updatedAt', Date>
22
+ | RelationStringRules<'children.createdBy', string | null>
23
+ | RelationStringRules<'children.updatedBy', string | null>
24
+ | RelationStringRules<'children.name', string>
25
+ | RelationStringRules<'children.type', string>
26
+ | RelationStringRules<'children.sortOrder', string | null>
27
+ | RelationStringRules<'children.extension', string | null>
28
+ | RelationNumberRules<'children.size', number | null>
29
+ | RelationExistsRules<'parent', FileLargeRuleGroup>
30
+ | RelationUUIDRules<'parent.id', UUID>
31
+ | RelationDateRules<'parent.createdAt', Date>
32
+ | RelationDateRules<'parent.updatedAt', Date>
33
+ | RelationStringRules<'parent.createdBy', string | null>
34
+ | RelationStringRules<'parent.updatedBy', string | null>
35
+ | RelationStringRules<'parent.name', string>
36
+ | RelationStringRules<'parent.type', string>
37
+ | RelationStringRules<'parent.sortOrder', string | null>
38
+ | RelationStringRules<'parent.extension', string | null>
39
+ | RelationNumberRules<'parent.size', number | null>;
40
+
41
+ /**
42
+ * RuleGroupBase
43
+ */
44
+ export declare type FileLargeRuleGroup = RuleGroupBase<typeof FileLarge,
45
+ |'id'
46
+ |'createdAt'
47
+ |'updatedAt'
48
+ |'createdBy'
49
+ |'updatedBy'
50
+ |'name'
51
+ |'type'
52
+ |'sortOrder'
53
+ |'extension'
54
+ |'size'
55
+ |'parentId'
56
+ |'children'
57
+ |'children.id'
58
+ |'children.createdAt'
59
+ |'children.updatedAt'
60
+ |'children.createdBy'
61
+ |'children.updatedBy'
62
+ |'children.name'
63
+ |'children.type'
64
+ |'children.sortOrder'
65
+ |'children.extension'
66
+ |'children.size'
67
+ |'parentId'
68
+ |'parent'
69
+ |'parent.id'
70
+ |'parent.createdAt'
71
+ |'parent.updatedAt'
72
+ |'parent.createdBy'
73
+ |'parent.updatedBy'
74
+ |'parent.name'
75
+ |'parent.type'
76
+ |'parent.sortOrder'
77
+ |'parent.extension'
78
+ |'parent.size'
79
+ |'parentId',
80
+ FileLargeRule>;
81
+
82
+ /**
83
+ * OrderByField
84
+ */
85
+ declare type FileLargeOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "name" | "type" | "sortOrder" | "extension" | "size";
86
+
87
+ /**
88
+ * TreeRule
89
+ */
90
+ declare type FileLargeTreeRule = RelationDateRules<'children.createdAt', Date>
91
+ | RelationDateRules<'children.updatedAt', Date>
92
+ | RelationStringRules<'children.createdBy', string | null>
93
+ | RelationStringRules<'children.updatedBy', string | null>
94
+ | RelationStringRules<'children.name', string>
95
+ | RelationStringRules<'children.type', string>
96
+ | RelationStringRules<'children.sortOrder', string | null>
97
+ | RelationStringRules<'children.extension', string | null>
98
+ | RelationNumberRules<'children.size', number | null>;
99
+
100
+ /**
101
+ * TreeRuleGroup
102
+ */
103
+ export declare type FileLargeTreeRuleGroup = RuleGroupBase<typeof FileLarge, 'children.createdAt' | 'children.updatedAt' | 'children.createdBy' | 'children.updatedBy' | 'children.name' | 'children.type' | 'children.sortOrder' | 'children.extension' | 'children.size', FileLargeTreeRule>;
104
+
105
+ /**
106
+ * 静态类型
107
+ */
108
+ export interface FileLargeStaticTypes {
109
+ /**
110
+ * id 类型
111
+ */
112
+ idType: UUID;
113
+ /**
114
+ * 查询选项
115
+ */
116
+ getOptions: UUID;
117
+ /**
118
+ * 查询选项
119
+ */
120
+ findOneOrFailOptions: FindOneOrFailOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>;
121
+ /**
122
+ * 查询选项
123
+ */
124
+ findOptions: FindOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>;
125
+ /**
126
+ * 查询选项
127
+ */
128
+ findOneOptions: FindOneOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>;
129
+ /**
130
+ * 查询选项
131
+ */
132
+ findAllOptions: FindAllOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>;
133
+ /**
134
+ * 查询选项
135
+ */
136
+ findByCursorOptions: FindByCursorOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>;
137
+ /**
138
+ * 查询选项
139
+ */
140
+ countOptions: CountOptions<typeof FileLarge,FileLargeRuleGroup>;
141
+ /**
142
+ * 查询的实体
143
+ */
144
+ entity: FileLarge;
145
+ /**
146
+ * 查询选项
147
+ */
148
+ findDescendantsOptions: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>;
149
+ /**
150
+ * 查询选项
151
+ */
152
+ countDescendantsOptions: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>;
153
+ /**
154
+ * 查询选项
155
+ */
156
+ findAncestorsOptions: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>;
157
+ /**
158
+ * 查询选项
159
+ */
160
+ countAncestorsOptions: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>;
161
+ }
162
+
163
+ /**
164
+ * 初始化数据
165
+ */
166
+ export interface FileLargeInitData {
167
+ /**
168
+ * name
169
+ */
170
+ name?: string;
171
+ /**
172
+ * type
173
+ */
174
+ type?: string;
175
+ /**
176
+ * sortOrder
177
+ */
178
+ sortOrder?: string | null;
179
+ /**
180
+ * extension
181
+ */
182
+ extension?: string | null;
183
+ /**
184
+ * size
185
+ */
186
+ size?: number | null;
187
+ /**
188
+ * 父节点 id
189
+ */
190
+ parentId?: UUID | null;
191
+ }
192
+
193
+ /**
194
+ * FileLarge
195
+ */
196
+ export declare class FileLarge extends TreeAdjacencyListEntityBase implements ITreeEntity {
197
+ static [ENTITY_STATIC_TYPES]: FileLargeStaticTypes;
198
+ /**
199
+ * 子节点
200
+ */
201
+ readonly children$: RelationEntitiesObservable<FileLarge>;
202
+ /**
203
+ * 是否有子节点
204
+ */
205
+ readonly hasChildren?: boolean | null;
206
+ /**
207
+ * 父节点
208
+ */
209
+ readonly parent$: RelationEntityObservable<typeof FileLarge>;
210
+ /**
211
+ * extension
212
+ */
213
+ extension?: string | null;
214
+ /**
215
+ * name
216
+ */
217
+ name: string;
218
+ /**
219
+ * 父节点 id
220
+ */
221
+ parentId?: UUID | null;
222
+ /**
223
+ * size
224
+ */
225
+ size?: number | null;
226
+ /**
227
+ * sortOrder
228
+ */
229
+ sortOrder?: string | null;
230
+ /**
231
+ * type
232
+ */
233
+ type: string;
234
+ /**
235
+ * 初始化数据
236
+ * @param initData 初始化数据
237
+ */
238
+ constructor(initData?: FileLargeInitData);
239
+ /**
240
+ * 统计实体数量
241
+ * @param options 查询选项
242
+ * @example
243
+ * FileLarge.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
244
+ */
245
+ static count(options: CountOptions<typeof FileLarge,FileLargeRuleGroup>): Observable<number>;
246
+ /**
247
+ * 统计祖先实体数量(不包含自身)
248
+ * @param options 查询选项
249
+ * @example
250
+ * // 统计某节点的祖先层级深度
251
+ FileLarge.countAncestors({ entityId: grand.id }).subscribe(depth => console.log(depth));
252
+ */
253
+ static countAncestors(options?: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>): Observable<number>;
254
+ /**
255
+ * 统计子孙实体数量(不包含自身)
256
+ * @param options 查询选项
257
+ * @example
258
+ * // 统计某节点下的后代数量
259
+ FileLarge.countDescendants({ entityId: root.id }).subscribe(count => console.log(count));
260
+ */
261
+ static countDescendants(options?: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>): Observable<number>;
262
+ /**
263
+ * 查询多个实体
264
+ * @param options 查询选项
265
+ * @example
266
+ * FileLarge.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
267
+ */
268
+ static find(options: FindOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>): Observable<FileLarge[]>;
269
+ /**
270
+ * 查询所有实体
271
+ * @param options 查询选项
272
+ * @example
273
+ * FileLarge.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
274
+ */
275
+ static findAll(options: FindAllOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>): Observable<FileLarge[]>;
276
+ /**
277
+ * 查询祖先实体(包含自身)
278
+ * @param options 查询选项
279
+ * @example
280
+ * // 查询某节点的所有祖先(面包屑导航)
281
+ FileLarge.findAncestors({ entityId: grand.id }).subscribe(ancestors => console.log(ancestors));
282
+
283
+ // 仅查询直接父节点(level 1)
284
+ FileLarge.findAncestors({ entityId: grand.id, level: 1 }).subscribe(parents => console.log(parents));
285
+ */
286
+ static findAncestors(options?: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>): Observable<FileLarge[]>;
287
+ /**
288
+ * 游标分页查询
289
+ * @param options 查询选项
290
+ * @example
291
+ * FileLarge.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
292
+ */
293
+ static findByCursor(options: FindByCursorOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>): Observable<FileLarge[]>;
294
+ /**
295
+ * 查询子孙实体(包含自身)
296
+ * @param options 查询选项
297
+ * @example
298
+ * // 查询某节点的所有后代
299
+ FileLarge.findDescendants({ entityId: root.id }).subscribe(list => console.log(list));
300
+
301
+ // 仅查询直接子节点(level 1)
302
+ FileLarge.findDescendants({ entityId: root.id, level: 1 }).subscribe(children => console.log(children));
303
+ */
304
+ static findDescendants(options?: FindTreeOptions<typeof FileLarge,FileLargeTreeRuleGroup>): Observable<FileLarge[]>;
305
+ /**
306
+ * 查询单个实体,未找到时返回 undefined
307
+ * @param options 查询选项
308
+ * @example
309
+ * FileLarge.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
310
+ */
311
+ static findOne(options: FindOneOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>): Observable<FileLarge | undefined>;
312
+ /**
313
+ * 查询单个实体,未找到时抛出错误
314
+ * @param options 查询选项
315
+ * @example
316
+ * FileLarge.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
317
+ */
318
+ static findOneOrFail(options: FindOneOrFailOptions<typeof FileLarge,FileLargeRuleGroup,FileLargeOrderByField>): Observable<FileLarge>;
319
+ /**
320
+ * 根据 ID 获取单个实体
321
+ * @param options 查询选项
322
+ * @example
323
+ * FileLarge.get('123').subscribe(entity => console.log(entity));
324
+ */
325
+ static get(options: UUID): Observable<FileLarge>;
326
+ /**
327
+ * 删除
328
+ */
329
+ remove(): Promise<FileLarge>;
330
+ /**
331
+ * 重置数据
332
+ */
333
+ reset(): void;
334
+ /**
335
+ * 保存
336
+ */
337
+ save(): Promise<FileLarge>;
338
+ }
339
+
@@ -0,0 +1,77 @@
1
+ import { Entity, PropertyType, TreeAdjacencyListEntityBase, __decorateClass } from '@aiao/rxdb';
2
+ let FileLarge = class extends TreeAdjacencyListEntityBase {};
3
+ FileLarge = __decorateClass(
4
+ [
5
+ Entity({
6
+ name: "FileLarge",
7
+ tableName: "file_large",
8
+ properties: [
9
+ {
10
+ name: "name",
11
+ type: PropertyType.string,
12
+ nullable: false,
13
+ columnName: "name"
14
+ },
15
+ {
16
+ name: "type",
17
+ type: PropertyType.string,
18
+ nullable: false,
19
+ columnName: "type"
20
+ },
21
+ {
22
+ name: "sortOrder",
23
+ columnName: "sort_order",
24
+ type: PropertyType.string,
25
+ nullable: true
26
+ },
27
+ {
28
+ name: "extension",
29
+ type: PropertyType.string,
30
+ nullable: true,
31
+ columnName: "extension"
32
+ },
33
+ {
34
+ name: "size",
35
+ type: PropertyType.number,
36
+ nullable: true,
37
+ columnName: "size"
38
+ }
39
+ ],
40
+ features: {
41
+ tree: {
42
+ type: "adjacency-list",
43
+ hasChildren: true
44
+ }
45
+ },
46
+ indexes: [
47
+ {
48
+ name: "parent_sort",
49
+ properties: [
50
+ "parentId",
51
+ "sortOrder"
52
+ ]
53
+ },
54
+ {
55
+ name: "parent_fullname",
56
+ properties: [
57
+ "parentId",
58
+ "name",
59
+ "extension"
60
+ ],
61
+ unique: true
62
+ }
63
+ ],
64
+ repository: "TreeRepository",
65
+ namespace: "public",
66
+ relations: [],
67
+ computedProperties: [],
68
+ extends: [
69
+ "TreeAdjacencyListEntityBase",
70
+ "EntityBase"
71
+ ],
72
+ displayName: "FileLarge"
73
+ })
74
+ ],
75
+ FileLarge
76
+ );
77
+ export { FileLarge };