@aiao/rxdb-test 0.0.5 → 0.0.6

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.
@@ -1,6 +1,61 @@
1
- import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, FindTreeRootOptions, IEntity, IEntityStaticType, ITreeEntity, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationStringRules, RelationUUIDRules, RuleGroupCustom, StringRules, TreeAdjacencyListEntityBase, UUID, UUIDRules } from '@aiao/rxdb';
1
+ import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, FindTreeRootOptions, IEntity, IEntityStaticType, ITreeEntity, KeyValueRules, NumberArrayRules, NumberRules, RelationBooleanRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringArrayRules, StringRules, TreeAdjacencyListEntityBase, UUID, UUIDRules } from '@aiao/rxdb';
2
2
  import { Observable } from 'rxjs';
3
3
 
4
+ /**
5
+ * rule
6
+ */
7
+ declare type TypeDemoRule = UUIDRules<TypeDemo, 'id'>
8
+ | DateRules<TypeDemo, 'createdAt'>
9
+ | DateRules<TypeDemo, 'updatedAt'>
10
+ | DateRules<TypeDemo, 'removedAt'>
11
+ | StringRules<TypeDemo, 'createdBy'>
12
+ | StringRules<TypeDemo, 'updatedBy'>
13
+ | StringRules<TypeDemo, 'removedBy'>
14
+ | StringRules<TypeDemo, 'string'>
15
+ | NumberRules<TypeDemo, 'number'>
16
+ | NumberRules<TypeDemo, 'integer'>
17
+ | BooleanRules<TypeDemo, 'boolean'>
18
+ | DateRules<TypeDemo, 'date'>
19
+ | StringArrayRules<TypeDemo, 'stringArray', string>
20
+ | NumberArrayRules<TypeDemo, 'numberArray', number>
21
+ | KeyValueRules<TypeDemo, 'keyValue', Partial<TypeDemoKeyValueKeyValue>>
22
+ | RelationStringRules<'keyValue.string', string>
23
+ | RelationNumberRules<'keyValue.number', number>
24
+ | RelationNumberRules<'keyValue.integer', number>
25
+ | RelationBooleanRules<'keyValue.boolean', boolean>
26
+ | RelationDateRules<'keyValue.date', Date>;
27
+
28
+ /**
29
+ * RuleGroupBase
30
+ */
31
+ export declare type TypeDemoRuleGroup = RuleGroupBase<typeof TypeDemo,
32
+ |'id'
33
+ |'createdAt'
34
+ |'updatedAt'
35
+ |'removedAt'
36
+ |'createdBy'
37
+ |'updatedBy'
38
+ |'removedBy'
39
+ |'string'
40
+ |'number'
41
+ |'integer'
42
+ |'boolean'
43
+ |'date'
44
+ |'stringArray'
45
+ |'numberArray'
46
+ |'keyValue'
47
+ |'keyValue.string'
48
+ |'keyValue.number'
49
+ |'keyValue.integer'
50
+ |'keyValue.boolean'
51
+ |'keyValue.date',
52
+ TypeDemoRule>;
53
+
54
+ /**
55
+ * OrderByField
56
+ */
57
+ declare type TypeDemoOrderByField = "id" | "createdAt" | "updatedAt" | "removedAt" | "createdBy" | "updatedBy" | "removedBy" | "string" | "number" | "integer" | "boolean" | "date" | "stringArray" | "numberArray" | "keyValue" | "json";
58
+
4
59
  /**
5
60
  * rule
6
61
  */
@@ -15,9 +70,9 @@ declare type TodoRule = UUIDRules<Todo, 'id'>
15
70
  | BooleanRules<Todo, 'completed'>;
16
71
 
17
72
  /**
18
- * RuleGroupCustom
73
+ * RuleGroupBase
19
74
  */
20
- export declare type TodoRuleGroup = RuleGroupCustom<typeof Todo,
75
+ export declare type TodoRuleGroup = RuleGroupBase<typeof Todo,
21
76
  |'id'
22
77
  |'createdAt'
23
78
  |'updatedAt'
@@ -64,9 +119,9 @@ declare type MenuRule = UUIDRules<Menu, 'id'>
64
119
  | RelationStringRules<'parent.title', string>;
65
120
 
66
121
  /**
67
- * RuleGroupCustom
122
+ * RuleGroupBase
68
123
  */
69
- export declare type MenuRuleGroup = RuleGroupCustom<typeof Menu,
124
+ export declare type MenuRuleGroup = RuleGroupBase<typeof Menu,
70
125
  |'id'
71
126
  |'createdAt'
72
127
  |'updatedAt'
@@ -115,7 +170,7 @@ declare type MenuTreeRule = RelationDateRules<'children.createdAt', Date>
115
170
  /**
116
171
  * TreeRuleGroup
117
172
  */
118
- export declare type MenuTreeRuleGroup = RuleGroupCustom<typeof Menu, 'children.createdAt' | 'children.updatedAt' | 'children.removedAt' | 'children.createdBy' | 'children.updatedBy' | 'children.removedBy' | 'children.title', MenuTreeRule>;
173
+ export declare type MenuTreeRuleGroup = RuleGroupBase<typeof Menu, 'children.createdAt' | 'children.updatedAt' | 'children.removedAt' | 'children.createdBy' | 'children.updatedBy' | 'children.removedBy' | 'children.title', MenuTreeRule>;
119
174
 
120
175
  /**
121
176
  * rxdb
@@ -125,6 +180,10 @@ declare module "@aiao/rxdb" {
125
180
  * RxDB
126
181
  */
127
182
  interface RxDB {
183
+ /**
184
+ * TypeDemo
185
+ */
186
+ TypeDemo: typeof TypeDemo;
128
187
  /**
129
188
  * Todo
130
189
  */
@@ -136,6 +195,97 @@ declare module "@aiao/rxdb" {
136
195
  }
137
196
  }
138
197
 
198
+ /**
199
+ * 静态类型
200
+ */
201
+ export interface TypeDemoStaticTypes {
202
+ /**
203
+ * id 类型
204
+ */
205
+ idType: UUID;
206
+ /**
207
+ * 查询选项
208
+ */
209
+ getOptions: UUID;
210
+ /**
211
+ * 查询选项
212
+ */
213
+ findOneOrFailOptions: FindOneOrFailOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>;
214
+ /**
215
+ * 查询选项
216
+ */
217
+ findOptions: FindOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>;
218
+ /**
219
+ * 查询选项
220
+ */
221
+ findOneOptions: FindOneOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>;
222
+ /**
223
+ * 查询选项
224
+ */
225
+ findAllOptions: FindAllOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>;
226
+ /**
227
+ * 查询选项
228
+ */
229
+ findByCursorOptions: FindByCursorOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>;
230
+ /**
231
+ * 查询选项
232
+ */
233
+ countOptions: CountOptions<typeof TypeDemo,TypeDemoRuleGroup>;
234
+ }
235
+
236
+ /**
237
+ * 初始化数据
238
+ */
239
+ export interface TypeDemoInitData {
240
+ /**
241
+ * string
242
+ */
243
+ string?: string;
244
+ /**
245
+ * number
246
+ */
247
+ number?: number;
248
+ /**
249
+ * integer
250
+ */
251
+ integer?: number;
252
+ /**
253
+ * boolean
254
+ */
255
+ boolean?: boolean;
256
+ /**
257
+ * date
258
+ */
259
+ date?: Date;
260
+ /**
261
+ * stringArray
262
+ */
263
+ stringArray?: string[];
264
+ /**
265
+ * numberArray
266
+ */
267
+ numberArray?: number[];
268
+ /**
269
+ * keyValue
270
+ */
271
+ keyValue?: TypeDemoKeyValueKeyValue;
272
+ /**
273
+ * json
274
+ */
275
+ json?: Record<string, any>;
276
+ }
277
+
278
+ /**
279
+ * keyValue keyValue 类型
280
+ */
281
+ export interface TypeDemoKeyValueKeyValue {
282
+ string: string;
283
+ number: number;
284
+ integer: number;
285
+ boolean: boolean;
286
+ date: Date;
287
+ }
288
+
139
289
  /**
140
290
  * 静态类型
141
291
  */
@@ -164,6 +314,10 @@ export interface TodoStaticTypes {
164
314
  * 查询选项
165
315
  */
166
316
  findAllOptions: FindAllOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
317
+ /**
318
+ * 查询选项
319
+ */
320
+ findByCursorOptions: FindByCursorOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
167
321
  /**
168
322
  * 查询选项
169
323
  */
@@ -215,19 +369,15 @@ export interface MenuStaticTypes {
215
369
  /**
216
370
  * 查询选项
217
371
  */
218
- countOptions: CountOptions<typeof Menu,MenuRuleGroup>;
219
- /**
220
- * 查询的实体
221
- */
222
- entity: Menu;
372
+ findByCursorOptions: FindByCursorOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>;
223
373
  /**
224
374
  * 查询选项
225
375
  */
226
- findRootOptions: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>;
376
+ countOptions: CountOptions<typeof Menu,MenuRuleGroup>;
227
377
  /**
228
- * 查询选项
378
+ * 查询的实体
229
379
  */
230
- countRootOptions: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>;
380
+ entity: Menu;
231
381
  /**
232
382
  * 查询选项
233
383
  */
@@ -256,11 +406,106 @@ export interface MenuInitData {
256
406
  title?: string;
257
407
  }
258
408
 
409
+ /**
410
+ * TypeDemo
411
+ */
412
+ export declare class TypeDemo extends EntityBase implements IEntity, IEntityStaticType {
413
+ static [ENTITY_STATIC_TYPES]: TypeDemoStaticTypes;
414
+ /**
415
+ * boolean
416
+ */
417
+ boolean: boolean;
418
+ /**
419
+ * date
420
+ */
421
+ date: Date;
422
+ /**
423
+ * integer
424
+ */
425
+ integer: number;
426
+ /**
427
+ * json
428
+ */
429
+ json: Record<string, any>;
430
+ /**
431
+ * keyValue
432
+ */
433
+ keyValue: TypeDemoKeyValueKeyValue;
434
+ /**
435
+ * number
436
+ */
437
+ number: number;
438
+ /**
439
+ * numberArray
440
+ */
441
+ numberArray: number[];
442
+ /**
443
+ * string
444
+ */
445
+ string: string;
446
+ /**
447
+ * stringArray
448
+ */
449
+ stringArray: string[];
450
+ /**
451
+ * 初始化数据
452
+ * @param initData 初始化数据
453
+ */
454
+ constructor(initData?: TypeDemoInitData);
455
+ /**
456
+ * count 查询
457
+ * @param options 查询选项
458
+ */
459
+ static count(options: CountOptions<typeof TypeDemo,TypeDemoRuleGroup>): Observable<number>;
460
+ /**
461
+ * find 查询
462
+ * @param options 查询选项
463
+ */
464
+ static find(options: FindOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>): Observable<TypeDemo[]>;
465
+ /**
466
+ * findAll 查询
467
+ * @param options 查询选项
468
+ */
469
+ static findAll(options: FindAllOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>): Observable<TypeDemo[]>;
470
+ /**
471
+ * findByCursor 查询
472
+ * @param options 查询选项
473
+ */
474
+ static findByCursor(options: FindByCursorOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>): Observable<TypeDemo[]>;
475
+ /**
476
+ * findOne 查询
477
+ * @param options 查询选项
478
+ */
479
+ static findOne(options: FindOneOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>): Observable<TypeDemo | undefined>;
480
+ /**
481
+ * findOneOrFail 查询
482
+ * @param options 查询选项
483
+ */
484
+ static findOneOrFail(options: FindOneOrFailOptions<typeof TypeDemo,TypeDemoRuleGroup,TypeDemoOrderByField>): Observable<TypeDemo>;
485
+ /**
486
+ * get 查询
487
+ * @param options 查询选项
488
+ */
489
+ static get(options: UUID): Observable<TypeDemo>;
490
+ /**
491
+ * 删除
492
+ */
493
+ remove(): Promise<TypeDemo>;
494
+ /**
495
+ * 重置数据
496
+ */
497
+ reset(): void;
498
+ /**
499
+ * 保存
500
+ */
501
+ save(): Promise<TypeDemo>;
502
+ }
503
+
259
504
  /**
260
505
  * Todo
261
506
  */
262
507
  export declare class Todo extends EntityBase implements IEntity, IEntityStaticType {
263
- [ENTITY_STATIC_TYPES]: TodoStaticTypes;
508
+ static [ENTITY_STATIC_TYPES]: TodoStaticTypes;
264
509
  /**
265
510
  * completed
266
511
  */
@@ -289,6 +534,11 @@ export declare class Todo extends EntityBase implements IEntity, IEntityStaticTy
289
534
  * @param options 查询选项
290
535
  */
291
536
  static findAll(options: FindAllOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo[]>;
537
+ /**
538
+ * findByCursor 查询
539
+ * @param options 查询选项
540
+ */
541
+ static findByCursor(options: FindByCursorOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo[]>;
292
542
  /**
293
543
  * findOne 查询
294
544
  * @param options 查询选项
@@ -322,6 +572,7 @@ export declare class Todo extends EntityBase implements IEntity, IEntityStaticTy
322
572
  * Menu
323
573
  */
324
574
  export declare class Menu extends TreeAdjacencyListEntityBase implements IEntityStaticType, ITreeEntity {
575
+ static [ENTITY_STATIC_TYPES]: MenuStaticTypes;
325
576
  /**
326
577
  * children
327
578
  */
@@ -334,7 +585,6 @@ export declare class Menu extends TreeAdjacencyListEntityBase implements IEntity
334
585
  * parent id
335
586
  */
336
587
  parentId?: UUID;
337
- [ENTITY_STATIC_TYPES]: MenuStaticTypes;
338
588
  /**
339
589
  * title
340
590
  */
@@ -359,11 +609,6 @@ export declare class Menu extends TreeAdjacencyListEntityBase implements IEntity
359
609
  * @param options 查询选项
360
610
  */
361
611
  static countDescendants(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<number>;
362
- /**
363
- * 查询子孙实体数量
364
- * @param options 查询选项
365
- */
366
- static countRoot(options?: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>): Observable<number>;
367
612
  /**
368
613
  * find 查询
369
614
  * @param options 查询选项
@@ -379,6 +624,11 @@ export declare class Menu extends TreeAdjacencyListEntityBase implements IEntity
379
624
  * @param options 查询选项
380
625
  */
381
626
  static findAncestors(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<Menu[]>;
627
+ /**
628
+ * findByCursor 查询
629
+ * @param options 查询选项
630
+ */
631
+ static findByCursor(options: FindByCursorOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu[]>;
382
632
  /**
383
633
  * 查询子孙实体
384
634
  * @param options 查询选项
@@ -394,11 +644,6 @@ export declare class Menu extends TreeAdjacencyListEntityBase implements IEntity
394
644
  * @param options 查询选项
395
645
  */
396
646
  static findOneOrFail(options: FindOneOrFailOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu>;
397
- /**
398
- * 查询子孙实体
399
- * @param options 查询选项
400
- */
401
- static findRoot(options?: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>): Observable<Menu[]>;
402
647
  /**
403
648
  * get 查询
404
649
  * @param options 查询选项
@@ -1,4 +1,81 @@
1
1
  import { Entity, EntityBase, PropertyType, TreeAdjacencyListEntityBase, __decorateClass } from '@aiao/rxdb';
2
+ let TypeDemo = class extends EntityBase {};
3
+ TypeDemo = __decorateClass(
4
+ [
5
+ Entity({
6
+ name: "TypeDemo",
7
+ properties: [
8
+ {
9
+ name: "string",
10
+ type: PropertyType.string
11
+ },
12
+ {
13
+ name: "number",
14
+ type: PropertyType.number
15
+ },
16
+ {
17
+ name: "integer",
18
+ type: PropertyType.integer
19
+ },
20
+ {
21
+ name: "boolean",
22
+ type: PropertyType.boolean
23
+ },
24
+ {
25
+ name: "date",
26
+ type: PropertyType.date
27
+ },
28
+ {
29
+ name: "stringArray",
30
+ type: PropertyType.stringArray
31
+ },
32
+ {
33
+ name: "numberArray",
34
+ type: PropertyType.numberArray
35
+ },
36
+ {
37
+ name: "keyValue",
38
+ type: PropertyType.keyValue,
39
+ properties: [
40
+ {
41
+ name: "string",
42
+ type: PropertyType.string
43
+ },
44
+ {
45
+ name: "number",
46
+ type: PropertyType.number
47
+ },
48
+ {
49
+ name: "integer",
50
+ type: PropertyType.integer
51
+ },
52
+ {
53
+ name: "boolean",
54
+ type: PropertyType.boolean
55
+ },
56
+ {
57
+ name: "date",
58
+ type: PropertyType.date
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ name: "json",
64
+ type: PropertyType.json
65
+ }
66
+ ],
67
+ repository: "Repository",
68
+ namespace: "public",
69
+ relations: [],
70
+ indexes: [],
71
+ extends: [
72
+ "EntityBase"
73
+ ],
74
+ displayName: "TypeDemo"
75
+ })
76
+ ],
77
+ TypeDemo
78
+ );
2
79
  let Todo = class extends EntityBase {};
3
80
  Todo = __decorateClass(
4
81
  [
@@ -51,5 +128,5 @@ Menu = __decorateClass(
51
128
  ],
52
129
  Menu
53
130
  );
54
- const ENTITIES = [ Menu, Todo ];
55
- export { ENTITIES, Menu, Todo };
131
+ const ENTITIES = [ Menu, Todo, TypeDemo ];
132
+ export { ENTITIES, Menu, Todo, TypeDemo };