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