@aiao/rxdb-test 0.0.15 → 0.0.16
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/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 +264 -0
- package/dist/entities/TypeDemo.js +101 -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 +359 -0
- package/dist/shop/Attribute.js +50 -0
- package/dist/shop/AttributeValue.d.ts +366 -0
- package/dist/shop/AttributeValue.js +51 -0
- package/dist/shop/Category.d.ts +280 -0
- package/dist/shop/Category.js +41 -0
- package/dist/shop/IdCard.d.ts +237 -0
- package/dist/shop/IdCard.js +43 -0
- package/dist/shop/Order.d.ts +270 -0
- package/dist/shop/Order.js +58 -0
- package/dist/shop/OrderItem.d.ts +293 -0
- package/dist/shop/OrderItem.js +64 -0
- package/dist/shop/Product.d.ts +321 -0
- package/dist/shop/Product.js +47 -0
- package/dist/shop/SKU.d.ts +343 -0
- package/dist/shop/SKU.js +63 -0
- package/dist/shop/SKUAttributes.d.ts +306 -0
- package/dist/shop/SKUAttributes.js +56 -0
- package/dist/shop/User.d.ts +269 -0
- package/dist/shop/User.js +74 -0
- package/dist/shop/index.d.ts +22 -2980
- 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,306 @@
|
|
|
1
|
+
import { CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, IEntity, ITreeEntity, NumberRules, RelationDateRules, RelationEntityObservable, RelationExistsRules, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, UUID, UUIDRules } from '@aiao/rxdb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* rule
|
|
6
|
+
*/
|
|
7
|
+
declare type SKUAttributesRule = UUIDRules<SKUAttributes, 'id'>
|
|
8
|
+
| DateRules<SKUAttributes, 'createdAt'>
|
|
9
|
+
| DateRules<SKUAttributes, 'updatedAt'>
|
|
10
|
+
| StringRules<SKUAttributes, 'createdBy'>
|
|
11
|
+
| StringRules<SKUAttributes, 'updatedBy'>
|
|
12
|
+
| UUIDRules<SKUAttributes, 'skuId'>
|
|
13
|
+
| UUIDRules<SKUAttributes, 'attributeId'>
|
|
14
|
+
| UUIDRules<SKUAttributes, 'valueId'>
|
|
15
|
+
| RelationExistsRules<'sku', SKURuleGroup>
|
|
16
|
+
| RelationUUIDRules<'sku.id', UUID>
|
|
17
|
+
| RelationDateRules<'sku.createdAt', Date>
|
|
18
|
+
| RelationDateRules<'sku.updatedAt', Date>
|
|
19
|
+
| RelationStringRules<'sku.createdBy', string | null>
|
|
20
|
+
| RelationStringRules<'sku.updatedBy', string | null>
|
|
21
|
+
| RelationStringRules<'sku.code', string>
|
|
22
|
+
| RelationNumberRules<'sku.price', number>
|
|
23
|
+
| RelationNumberRules<'sku.stock', number>
|
|
24
|
+
| UUIDRules<SKU, 'productId'>
|
|
25
|
+
| RelationUUIDRules<'sku.product.id', UUID>
|
|
26
|
+
| RelationDateRules<'sku.product.createdAt', Date>
|
|
27
|
+
| RelationDateRules<'sku.product.updatedAt', Date>
|
|
28
|
+
| RelationStringRules<'sku.product.createdBy', string | null>
|
|
29
|
+
| RelationStringRules<'sku.product.updatedBy', string | null>
|
|
30
|
+
| RelationStringRules<'sku.product.name', string>
|
|
31
|
+
| RelationStringRules<'sku.product.description', string | null>
|
|
32
|
+
| RelationUUIDRules<'sku.product.skus.id', UUID>
|
|
33
|
+
| RelationDateRules<'sku.product.skus.createdAt', Date>
|
|
34
|
+
| RelationDateRules<'sku.product.skus.updatedAt', Date>
|
|
35
|
+
| RelationStringRules<'sku.product.skus.createdBy', string | null>
|
|
36
|
+
| RelationStringRules<'sku.product.skus.updatedBy', string | null>
|
|
37
|
+
| RelationStringRules<'sku.product.skus.code', string>
|
|
38
|
+
| RelationNumberRules<'sku.product.skus.price', number>
|
|
39
|
+
| RelationNumberRules<'sku.product.skus.stock', number>
|
|
40
|
+
| RelationExistsRules<'attribute', AttributeRuleGroup>
|
|
41
|
+
| RelationUUIDRules<'attribute.id', UUID>
|
|
42
|
+
| RelationDateRules<'attribute.createdAt', Date>
|
|
43
|
+
| RelationDateRules<'attribute.updatedAt', Date>
|
|
44
|
+
| RelationStringRules<'attribute.createdBy', string | null>
|
|
45
|
+
| RelationStringRules<'attribute.updatedBy', string | null>
|
|
46
|
+
| RelationStringRules<'attribute.name', string>
|
|
47
|
+
| RelationUUIDRules<'attribute.values.id', UUID>
|
|
48
|
+
| RelationDateRules<'attribute.values.createdAt', Date>
|
|
49
|
+
| RelationDateRules<'attribute.values.updatedAt', Date>
|
|
50
|
+
| RelationStringRules<'attribute.values.createdBy', string | null>
|
|
51
|
+
| RelationStringRules<'attribute.values.updatedBy', string | null>
|
|
52
|
+
| RelationStringRules<'attribute.values.name', string>
|
|
53
|
+
| UUIDRules<AttributeValue, 'attributeId'>
|
|
54
|
+
| RelationExistsRules<'value', AttributeValueRuleGroup>
|
|
55
|
+
| RelationUUIDRules<'value.id', UUID>
|
|
56
|
+
| RelationDateRules<'value.createdAt', Date>
|
|
57
|
+
| RelationDateRules<'value.updatedAt', Date>
|
|
58
|
+
| RelationStringRules<'value.createdBy', string | null>
|
|
59
|
+
| RelationStringRules<'value.updatedBy', string | null>
|
|
60
|
+
| RelationStringRules<'value.name', string>
|
|
61
|
+
| RelationUUIDRules<'value.attribute.id', UUID>
|
|
62
|
+
| RelationDateRules<'value.attribute.createdAt', Date>
|
|
63
|
+
| RelationDateRules<'value.attribute.updatedAt', Date>
|
|
64
|
+
| RelationStringRules<'value.attribute.createdBy', string | null>
|
|
65
|
+
| RelationStringRules<'value.attribute.updatedBy', string | null>
|
|
66
|
+
| RelationStringRules<'value.attribute.name', string>
|
|
67
|
+
| RelationUUIDRules<'value.attribute.values.id', UUID>
|
|
68
|
+
| RelationDateRules<'value.attribute.values.createdAt', Date>
|
|
69
|
+
| RelationDateRules<'value.attribute.values.updatedAt', Date>
|
|
70
|
+
| RelationStringRules<'value.attribute.values.createdBy', string | null>
|
|
71
|
+
| RelationStringRules<'value.attribute.values.updatedBy', string | null>
|
|
72
|
+
| RelationStringRules<'value.attribute.values.name', string>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* RuleGroupBase
|
|
76
|
+
*/
|
|
77
|
+
export declare type SKUAttributesRuleGroup = RuleGroupBase<typeof SKUAttributes,
|
|
78
|
+
|'id'
|
|
79
|
+
|'createdAt'
|
|
80
|
+
|'updatedAt'
|
|
81
|
+
|'createdBy'
|
|
82
|
+
|'updatedBy'
|
|
83
|
+
|'skuId'
|
|
84
|
+
|'attributeId'
|
|
85
|
+
|'valueId'
|
|
86
|
+
|'sku'
|
|
87
|
+
|'sku.id'
|
|
88
|
+
|'sku.createdAt'
|
|
89
|
+
|'sku.updatedAt'
|
|
90
|
+
|'sku.createdBy'
|
|
91
|
+
|'sku.updatedBy'
|
|
92
|
+
|'sku.code'
|
|
93
|
+
|'sku.price'
|
|
94
|
+
|'sku.stock'
|
|
95
|
+
|'productId'
|
|
96
|
+
|'sku.product.id'
|
|
97
|
+
|'sku.product.createdAt'
|
|
98
|
+
|'sku.product.updatedAt'
|
|
99
|
+
|'sku.product.createdBy'
|
|
100
|
+
|'sku.product.updatedBy'
|
|
101
|
+
|'sku.product.name'
|
|
102
|
+
|'sku.product.description'
|
|
103
|
+
|'sku.product.skus.id'
|
|
104
|
+
|'sku.product.skus.createdAt'
|
|
105
|
+
|'sku.product.skus.updatedAt'
|
|
106
|
+
|'sku.product.skus.createdBy'
|
|
107
|
+
|'sku.product.skus.updatedBy'
|
|
108
|
+
|'sku.product.skus.code'
|
|
109
|
+
|'sku.product.skus.price'
|
|
110
|
+
|'sku.product.skus.stock'
|
|
111
|
+
|'productId'
|
|
112
|
+
|'attribute'
|
|
113
|
+
|'attribute.id'
|
|
114
|
+
|'attribute.createdAt'
|
|
115
|
+
|'attribute.updatedAt'
|
|
116
|
+
|'attribute.createdBy'
|
|
117
|
+
|'attribute.updatedBy'
|
|
118
|
+
|'attribute.name'
|
|
119
|
+
|'attribute.values.id'
|
|
120
|
+
|'attribute.values.createdAt'
|
|
121
|
+
|'attribute.values.updatedAt'
|
|
122
|
+
|'attribute.values.createdBy'
|
|
123
|
+
|'attribute.values.updatedBy'
|
|
124
|
+
|'attribute.values.name'
|
|
125
|
+
|'attributeId'
|
|
126
|
+
|'value'
|
|
127
|
+
|'value.id'
|
|
128
|
+
|'value.createdAt'
|
|
129
|
+
|'value.updatedAt'
|
|
130
|
+
|'value.createdBy'
|
|
131
|
+
|'value.updatedBy'
|
|
132
|
+
|'value.name'
|
|
133
|
+
|'attributeId'
|
|
134
|
+
|'value.attribute.id'
|
|
135
|
+
|'value.attribute.createdAt'
|
|
136
|
+
|'value.attribute.updatedAt'
|
|
137
|
+
|'value.attribute.createdBy'
|
|
138
|
+
|'value.attribute.updatedBy'
|
|
139
|
+
|'value.attribute.name'
|
|
140
|
+
|'value.attribute.values.id'
|
|
141
|
+
|'value.attribute.values.createdAt'
|
|
142
|
+
|'value.attribute.values.updatedAt'
|
|
143
|
+
|'value.attribute.values.createdBy'
|
|
144
|
+
|'value.attribute.values.updatedBy'
|
|
145
|
+
|'value.attribute.values.name'
|
|
146
|
+
|'attributeId',
|
|
147
|
+
SKUAttributesRule>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* OrderByField
|
|
151
|
+
*/
|
|
152
|
+
declare type SKUAttributesOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy";
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 静态类型
|
|
156
|
+
*/
|
|
157
|
+
export interface SKUAttributesStaticTypes {
|
|
158
|
+
/**
|
|
159
|
+
* id 类型
|
|
160
|
+
*/
|
|
161
|
+
idType: UUID;
|
|
162
|
+
/**
|
|
163
|
+
* 查询选项
|
|
164
|
+
*/
|
|
165
|
+
getOptions: UUID;
|
|
166
|
+
/**
|
|
167
|
+
* 查询选项
|
|
168
|
+
*/
|
|
169
|
+
findOneOrFailOptions: FindOneOrFailOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>;
|
|
170
|
+
/**
|
|
171
|
+
* 查询选项
|
|
172
|
+
*/
|
|
173
|
+
findOptions: FindOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>;
|
|
174
|
+
/**
|
|
175
|
+
* 查询选项
|
|
176
|
+
*/
|
|
177
|
+
findOneOptions: FindOneOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>;
|
|
178
|
+
/**
|
|
179
|
+
* 查询选项
|
|
180
|
+
*/
|
|
181
|
+
findAllOptions: FindAllOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>;
|
|
182
|
+
/**
|
|
183
|
+
* 查询选项
|
|
184
|
+
*/
|
|
185
|
+
findByCursorOptions: FindByCursorOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>;
|
|
186
|
+
/**
|
|
187
|
+
* 查询选项
|
|
188
|
+
*/
|
|
189
|
+
countOptions: CountOptions<typeof SKUAttributes,SKUAttributesRuleGroup>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 初始化数据
|
|
194
|
+
*/
|
|
195
|
+
export interface SKUAttributesInitData {
|
|
196
|
+
/**
|
|
197
|
+
* SKU id
|
|
198
|
+
*/
|
|
199
|
+
skuId?: UUID;
|
|
200
|
+
/**
|
|
201
|
+
* 属性 id
|
|
202
|
+
*/
|
|
203
|
+
attributeId?: UUID;
|
|
204
|
+
/**
|
|
205
|
+
* 属性值 id
|
|
206
|
+
*/
|
|
207
|
+
valueId?: UUID;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* SKU属性关联
|
|
212
|
+
*/
|
|
213
|
+
export declare class SKUAttributes extends EntityBase implements IEntity {
|
|
214
|
+
static [ENTITY_STATIC_TYPES]: SKUAttributesStaticTypes;
|
|
215
|
+
/**
|
|
216
|
+
* 属性
|
|
217
|
+
*/
|
|
218
|
+
readonly attribute$: RelationEntityObservable<typeof Attribute>;
|
|
219
|
+
/**
|
|
220
|
+
* SKU
|
|
221
|
+
*/
|
|
222
|
+
readonly sku$: RelationEntityObservable<typeof SKU>;
|
|
223
|
+
/**
|
|
224
|
+
* 属性值
|
|
225
|
+
*/
|
|
226
|
+
readonly value$: RelationEntityObservable<typeof AttributeValue>;
|
|
227
|
+
/**
|
|
228
|
+
* 属性 id
|
|
229
|
+
*/
|
|
230
|
+
attributeId: UUID;
|
|
231
|
+
/**
|
|
232
|
+
* SKU id
|
|
233
|
+
*/
|
|
234
|
+
skuId: UUID;
|
|
235
|
+
/**
|
|
236
|
+
* 属性值 id
|
|
237
|
+
*/
|
|
238
|
+
valueId: UUID;
|
|
239
|
+
/**
|
|
240
|
+
* 初始化数据
|
|
241
|
+
* @param initData 初始化数据
|
|
242
|
+
*/
|
|
243
|
+
constructor(initData?: SKUAttributesInitData);
|
|
244
|
+
/**
|
|
245
|
+
* 统计实体数量
|
|
246
|
+
* @param options 查询选项
|
|
247
|
+
* @example
|
|
248
|
+
* SKUAttributes.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
|
|
249
|
+
*/
|
|
250
|
+
static count(options: CountOptions<typeof SKUAttributes,SKUAttributesRuleGroup>): Observable<number>;
|
|
251
|
+
/**
|
|
252
|
+
* 查询多个实体
|
|
253
|
+
* @param options 查询选项
|
|
254
|
+
* @example
|
|
255
|
+
* SKUAttributes.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
|
|
256
|
+
*/
|
|
257
|
+
static find(options: FindOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>): Observable<SKUAttributes[]>;
|
|
258
|
+
/**
|
|
259
|
+
* 查询所有实体
|
|
260
|
+
* @param options 查询选项
|
|
261
|
+
* @example
|
|
262
|
+
* SKUAttributes.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
263
|
+
*/
|
|
264
|
+
static findAll(options: FindAllOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>): Observable<SKUAttributes[]>;
|
|
265
|
+
/**
|
|
266
|
+
* 游标分页查询
|
|
267
|
+
* @param options 查询选项
|
|
268
|
+
* @example
|
|
269
|
+
* SKUAttributes.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
270
|
+
*/
|
|
271
|
+
static findByCursor(options: FindByCursorOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>): Observable<SKUAttributes[]>;
|
|
272
|
+
/**
|
|
273
|
+
* 查询单个实体,未找到时返回 undefined
|
|
274
|
+
* @param options 查询选项
|
|
275
|
+
* @example
|
|
276
|
+
* SKUAttributes.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
277
|
+
*/
|
|
278
|
+
static findOne(options: FindOneOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>): Observable<SKUAttributes | undefined>;
|
|
279
|
+
/**
|
|
280
|
+
* 查询单个实体,未找到时抛出错误
|
|
281
|
+
* @param options 查询选项
|
|
282
|
+
* @example
|
|
283
|
+
* SKUAttributes.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
284
|
+
*/
|
|
285
|
+
static findOneOrFail(options: FindOneOrFailOptions<typeof SKUAttributes,SKUAttributesRuleGroup,SKUAttributesOrderByField>): Observable<SKUAttributes>;
|
|
286
|
+
/**
|
|
287
|
+
* 根据 ID 获取单个实体
|
|
288
|
+
* @param options 查询选项
|
|
289
|
+
* @example
|
|
290
|
+
* SKUAttributes.get('123').subscribe(entity => console.log(entity));
|
|
291
|
+
*/
|
|
292
|
+
static get(options: UUID): Observable<SKUAttributes>;
|
|
293
|
+
/**
|
|
294
|
+
* 删除
|
|
295
|
+
*/
|
|
296
|
+
remove(): Promise<SKUAttributes>;
|
|
297
|
+
/**
|
|
298
|
+
* 重置数据
|
|
299
|
+
*/
|
|
300
|
+
reset(): void;
|
|
301
|
+
/**
|
|
302
|
+
* 保存
|
|
303
|
+
*/
|
|
304
|
+
save(): Promise<SKUAttributes>;
|
|
305
|
+
}
|
|
306
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Entity, EntityBase, RelationKind, __decorateClass } from '@aiao/rxdb';
|
|
2
|
+
let SKUAttributes = class extends EntityBase {};
|
|
3
|
+
SKUAttributes = __decorateClass(
|
|
4
|
+
[
|
|
5
|
+
Entity({
|
|
6
|
+
name: "SKUAttributes",
|
|
7
|
+
tableName: "sku_attributes",
|
|
8
|
+
displayName: "SKU属性关联",
|
|
9
|
+
relations: [
|
|
10
|
+
{
|
|
11
|
+
name: "sku",
|
|
12
|
+
displayName: "SKU",
|
|
13
|
+
kind: RelationKind.MANY_TO_ONE,
|
|
14
|
+
mappedEntity: "SKU",
|
|
15
|
+
mappedProperty: "attributes",
|
|
16
|
+
mappedNamespace: "public",
|
|
17
|
+
onDelete: "RESTRICT",
|
|
18
|
+
onUpdate: "RESTRICT",
|
|
19
|
+
columnName: "skuId"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "attribute",
|
|
23
|
+
displayName: "属性",
|
|
24
|
+
kind: RelationKind.MANY_TO_ONE,
|
|
25
|
+
mappedEntity: "Attribute",
|
|
26
|
+
mappedProperty: "skuAttributes",
|
|
27
|
+
mappedNamespace: "public",
|
|
28
|
+
onDelete: "RESTRICT",
|
|
29
|
+
onUpdate: "RESTRICT",
|
|
30
|
+
columnName: "attributeId"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "value",
|
|
34
|
+
displayName: "属性值",
|
|
35
|
+
kind: RelationKind.MANY_TO_ONE,
|
|
36
|
+
mappedEntity: "AttributeValue",
|
|
37
|
+
mappedProperty: "skuAttributeValues",
|
|
38
|
+
mappedNamespace: "public",
|
|
39
|
+
onDelete: "RESTRICT",
|
|
40
|
+
onUpdate: "RESTRICT",
|
|
41
|
+
columnName: "valueId"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
repository: "Repository",
|
|
45
|
+
namespace: "public",
|
|
46
|
+
properties: [],
|
|
47
|
+
indexes: [],
|
|
48
|
+
computedProperties: [],
|
|
49
|
+
extends: [
|
|
50
|
+
"EntityBase"
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
],
|
|
54
|
+
SKUAttributes
|
|
55
|
+
);
|
|
56
|
+
export { SKUAttributes };
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, IEntity, ITreeEntity, NumberRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationExistsRules, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, UUID, UUIDRules } from '@aiao/rxdb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* rule
|
|
6
|
+
*/
|
|
7
|
+
declare type UserRule = UUIDRules<User, 'id'>
|
|
8
|
+
| DateRules<User, 'createdAt'>
|
|
9
|
+
| DateRules<User, 'updatedAt'>
|
|
10
|
+
| StringRules<User, 'createdBy'>
|
|
11
|
+
| StringRules<User, 'updatedBy'>
|
|
12
|
+
| StringRules<User, 'name'>
|
|
13
|
+
| BooleanRules<User, 'married'>
|
|
14
|
+
| NumberRules<User, 'age'>
|
|
15
|
+
| StringRules<User, 'gender'>
|
|
16
|
+
| UUIDRules<User, 'idCardId'>
|
|
17
|
+
| RelationExistsRules<'idCard', IdCardRuleGroup>
|
|
18
|
+
| RelationUUIDRules<'idCard.id', UUID>
|
|
19
|
+
| RelationDateRules<'idCard.createdAt', Date>
|
|
20
|
+
| RelationDateRules<'idCard.updatedAt', Date>
|
|
21
|
+
| RelationStringRules<'idCard.createdBy', string | null>
|
|
22
|
+
| RelationStringRules<'idCard.updatedBy', string | null>
|
|
23
|
+
| RelationStringRules<'idCard.code', string>
|
|
24
|
+
| UUIDRules<IdCard, 'ownerId'>
|
|
25
|
+
| RelationExistsRules<'orders', OrderRuleGroup>
|
|
26
|
+
| RelationUUIDRules<'orders.id', UUID>
|
|
27
|
+
| RelationDateRules<'orders.createdAt', Date>
|
|
28
|
+
| RelationDateRules<'orders.updatedAt', Date>
|
|
29
|
+
| RelationStringRules<'orders.createdBy', string | null>
|
|
30
|
+
| RelationStringRules<'orders.updatedBy', string | null>
|
|
31
|
+
| RelationStringRules<'orders.number', string>
|
|
32
|
+
| RelationNumberRules<'orders.amount', number>
|
|
33
|
+
| UUIDRules<Order, 'ownerId'>
|
|
34
|
+
| RelationUUIDRules<'orders.items.id', UUID>
|
|
35
|
+
| RelationDateRules<'orders.items.createdAt', Date>
|
|
36
|
+
| RelationDateRules<'orders.items.updatedAt', Date>
|
|
37
|
+
| RelationStringRules<'orders.items.createdBy', string | null>
|
|
38
|
+
| RelationStringRules<'orders.items.updatedBy', string | null>
|
|
39
|
+
| RelationStringRules<'orders.items.productName', string>
|
|
40
|
+
| RelationNumberRules<'orders.items.quantity', number>
|
|
41
|
+
| RelationNumberRules<'orders.items.price', number>
|
|
42
|
+
| UUIDRules<OrderItem, 'orderId'>
|
|
43
|
+
| RelationUUIDRules<'orders.items.categories.id', UUID>
|
|
44
|
+
| RelationDateRules<'orders.items.categories.createdAt', Date>
|
|
45
|
+
| RelationDateRules<'orders.items.categories.updatedAt', Date>
|
|
46
|
+
| RelationStringRules<'orders.items.categories.createdBy', string | null>
|
|
47
|
+
| RelationStringRules<'orders.items.categories.updatedBy', string | null>
|
|
48
|
+
| RelationStringRules<'orders.items.categories.name', string>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* RuleGroupBase
|
|
52
|
+
*/
|
|
53
|
+
export declare type UserRuleGroup = RuleGroupBase<typeof User,
|
|
54
|
+
|'id'
|
|
55
|
+
|'createdAt'
|
|
56
|
+
|'updatedAt'
|
|
57
|
+
|'createdBy'
|
|
58
|
+
|'updatedBy'
|
|
59
|
+
|'name'
|
|
60
|
+
|'married'
|
|
61
|
+
|'age'
|
|
62
|
+
|'gender'
|
|
63
|
+
|'idCardId'
|
|
64
|
+
|'idCard'
|
|
65
|
+
|'idCard.id'
|
|
66
|
+
|'idCard.createdAt'
|
|
67
|
+
|'idCard.updatedAt'
|
|
68
|
+
|'idCard.createdBy'
|
|
69
|
+
|'idCard.updatedBy'
|
|
70
|
+
|'idCard.code'
|
|
71
|
+
|'ownerId'
|
|
72
|
+
|'orders'
|
|
73
|
+
|'orders.id'
|
|
74
|
+
|'orders.createdAt'
|
|
75
|
+
|'orders.updatedAt'
|
|
76
|
+
|'orders.createdBy'
|
|
77
|
+
|'orders.updatedBy'
|
|
78
|
+
|'orders.number'
|
|
79
|
+
|'orders.amount'
|
|
80
|
+
|'ownerId'
|
|
81
|
+
|'orders.items.id'
|
|
82
|
+
|'orders.items.createdAt'
|
|
83
|
+
|'orders.items.updatedAt'
|
|
84
|
+
|'orders.items.createdBy'
|
|
85
|
+
|'orders.items.updatedBy'
|
|
86
|
+
|'orders.items.productName'
|
|
87
|
+
|'orders.items.quantity'
|
|
88
|
+
|'orders.items.price'
|
|
89
|
+
|'orderId'
|
|
90
|
+
|'orders.items.categories.id'
|
|
91
|
+
|'orders.items.categories.createdAt'
|
|
92
|
+
|'orders.items.categories.updatedAt'
|
|
93
|
+
|'orders.items.categories.createdBy'
|
|
94
|
+
|'orders.items.categories.updatedBy'
|
|
95
|
+
|'orders.items.categories.name',
|
|
96
|
+
UserRule>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* OrderByField
|
|
100
|
+
*/
|
|
101
|
+
declare type UserOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "name" | "married" | "age" | "gender";
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 静态类型
|
|
105
|
+
*/
|
|
106
|
+
export interface UserStaticTypes {
|
|
107
|
+
/**
|
|
108
|
+
* id 类型
|
|
109
|
+
*/
|
|
110
|
+
idType: UUID;
|
|
111
|
+
/**
|
|
112
|
+
* 查询选项
|
|
113
|
+
*/
|
|
114
|
+
getOptions: UUID;
|
|
115
|
+
/**
|
|
116
|
+
* 查询选项
|
|
117
|
+
*/
|
|
118
|
+
findOneOrFailOptions: FindOneOrFailOptions<typeof User,UserRuleGroup,UserOrderByField>;
|
|
119
|
+
/**
|
|
120
|
+
* 查询选项
|
|
121
|
+
*/
|
|
122
|
+
findOptions: FindOptions<typeof User,UserRuleGroup,UserOrderByField>;
|
|
123
|
+
/**
|
|
124
|
+
* 查询选项
|
|
125
|
+
*/
|
|
126
|
+
findOneOptions: FindOneOptions<typeof User,UserRuleGroup,UserOrderByField>;
|
|
127
|
+
/**
|
|
128
|
+
* 查询选项
|
|
129
|
+
*/
|
|
130
|
+
findAllOptions: FindAllOptions<typeof User,UserRuleGroup,UserOrderByField>;
|
|
131
|
+
/**
|
|
132
|
+
* 查询选项
|
|
133
|
+
*/
|
|
134
|
+
findByCursorOptions: FindByCursorOptions<typeof User,UserRuleGroup,UserOrderByField>;
|
|
135
|
+
/**
|
|
136
|
+
* 查询选项
|
|
137
|
+
*/
|
|
138
|
+
countOptions: CountOptions<typeof User,UserRuleGroup>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 初始化数据
|
|
143
|
+
*/
|
|
144
|
+
export interface UserInitData {
|
|
145
|
+
/**
|
|
146
|
+
* 姓名
|
|
147
|
+
*/
|
|
148
|
+
name?: string;
|
|
149
|
+
/**
|
|
150
|
+
* 已婚
|
|
151
|
+
*/
|
|
152
|
+
married?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* 年龄
|
|
155
|
+
*/
|
|
156
|
+
age?: number;
|
|
157
|
+
/**
|
|
158
|
+
* 性别
|
|
159
|
+
* @default '男'
|
|
160
|
+
*/
|
|
161
|
+
gender?: string | null;
|
|
162
|
+
/**
|
|
163
|
+
* 身份证 id
|
|
164
|
+
*/
|
|
165
|
+
idCardId?: UUID | null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 用户表
|
|
170
|
+
*/
|
|
171
|
+
export declare class User extends EntityBase implements IEntity {
|
|
172
|
+
static [ENTITY_STATIC_TYPES]: UserStaticTypes;
|
|
173
|
+
/**
|
|
174
|
+
* 身份证
|
|
175
|
+
*/
|
|
176
|
+
readonly idCard$: RelationEntityObservable<typeof IdCard>;
|
|
177
|
+
/**
|
|
178
|
+
* 订单
|
|
179
|
+
*/
|
|
180
|
+
readonly orders$: RelationEntitiesObservable<Order>;
|
|
181
|
+
/**
|
|
182
|
+
* 年龄
|
|
183
|
+
*/
|
|
184
|
+
age: number;
|
|
185
|
+
/**
|
|
186
|
+
* 性别
|
|
187
|
+
* @default '男'
|
|
188
|
+
*/
|
|
189
|
+
gender?: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* 身份证 id
|
|
192
|
+
*/
|
|
193
|
+
idCardId?: UUID | null;
|
|
194
|
+
/**
|
|
195
|
+
* 已婚
|
|
196
|
+
*/
|
|
197
|
+
married: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* 姓名
|
|
200
|
+
*/
|
|
201
|
+
name: string;
|
|
202
|
+
/**
|
|
203
|
+
* 初始化数据
|
|
204
|
+
* @param initData 初始化数据
|
|
205
|
+
*/
|
|
206
|
+
constructor(initData?: UserInitData);
|
|
207
|
+
/**
|
|
208
|
+
* 统计实体数量
|
|
209
|
+
* @param options 查询选项
|
|
210
|
+
* @example
|
|
211
|
+
* User.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
|
|
212
|
+
*/
|
|
213
|
+
static count(options: CountOptions<typeof User,UserRuleGroup>): Observable<number>;
|
|
214
|
+
/**
|
|
215
|
+
* 查询多个实体
|
|
216
|
+
* @param options 查询选项
|
|
217
|
+
* @example
|
|
218
|
+
* User.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
|
|
219
|
+
*/
|
|
220
|
+
static find(options: FindOptions<typeof User,UserRuleGroup,UserOrderByField>): Observable<User[]>;
|
|
221
|
+
/**
|
|
222
|
+
* 查询所有实体
|
|
223
|
+
* @param options 查询选项
|
|
224
|
+
* @example
|
|
225
|
+
* User.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
226
|
+
*/
|
|
227
|
+
static findAll(options: FindAllOptions<typeof User,UserRuleGroup,UserOrderByField>): Observable<User[]>;
|
|
228
|
+
/**
|
|
229
|
+
* 游标分页查询
|
|
230
|
+
* @param options 查询选项
|
|
231
|
+
* @example
|
|
232
|
+
* User.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
233
|
+
*/
|
|
234
|
+
static findByCursor(options: FindByCursorOptions<typeof User,UserRuleGroup,UserOrderByField>): Observable<User[]>;
|
|
235
|
+
/**
|
|
236
|
+
* 查询单个实体,未找到时返回 undefined
|
|
237
|
+
* @param options 查询选项
|
|
238
|
+
* @example
|
|
239
|
+
* User.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
240
|
+
*/
|
|
241
|
+
static findOne(options: FindOneOptions<typeof User,UserRuleGroup,UserOrderByField>): Observable<User | undefined>;
|
|
242
|
+
/**
|
|
243
|
+
* 查询单个实体,未找到时抛出错误
|
|
244
|
+
* @param options 查询选项
|
|
245
|
+
* @example
|
|
246
|
+
* User.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
247
|
+
*/
|
|
248
|
+
static findOneOrFail(options: FindOneOrFailOptions<typeof User,UserRuleGroup,UserOrderByField>): Observable<User>;
|
|
249
|
+
/**
|
|
250
|
+
* 根据 ID 获取单个实体
|
|
251
|
+
* @param options 查询选项
|
|
252
|
+
* @example
|
|
253
|
+
* User.get('123').subscribe(entity => console.log(entity));
|
|
254
|
+
*/
|
|
255
|
+
static get(options: UUID): Observable<User>;
|
|
256
|
+
/**
|
|
257
|
+
* 删除
|
|
258
|
+
*/
|
|
259
|
+
remove(): Promise<User>;
|
|
260
|
+
/**
|
|
261
|
+
* 重置数据
|
|
262
|
+
*/
|
|
263
|
+
reset(): void;
|
|
264
|
+
/**
|
|
265
|
+
* 保存
|
|
266
|
+
*/
|
|
267
|
+
save(): Promise<User>;
|
|
268
|
+
}
|
|
269
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Entity, EntityBase, PropertyType, RelationKind, __decorateClass } from '@aiao/rxdb';
|
|
2
|
+
let User = class extends EntityBase {};
|
|
3
|
+
User = __decorateClass(
|
|
4
|
+
[
|
|
5
|
+
Entity({
|
|
6
|
+
name: "User",
|
|
7
|
+
tableName: "user",
|
|
8
|
+
displayName: "用户表",
|
|
9
|
+
properties: [
|
|
10
|
+
{
|
|
11
|
+
type: PropertyType.string,
|
|
12
|
+
name: "name",
|
|
13
|
+
displayName: "姓名",
|
|
14
|
+
columnName: "name"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: PropertyType.boolean,
|
|
18
|
+
name: "married",
|
|
19
|
+
displayName: "已婚",
|
|
20
|
+
default: false,
|
|
21
|
+
columnName: "married"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: PropertyType.number,
|
|
25
|
+
name: "age",
|
|
26
|
+
displayName: "年龄",
|
|
27
|
+
default: 25,
|
|
28
|
+
columnName: "age"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: PropertyType.string,
|
|
32
|
+
name: "gender",
|
|
33
|
+
displayName: "性别",
|
|
34
|
+
default: "男",
|
|
35
|
+
nullable: true,
|
|
36
|
+
columnName: "gender"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
relations: [
|
|
40
|
+
{
|
|
41
|
+
name: "idCard",
|
|
42
|
+
displayName: "身份证",
|
|
43
|
+
kind: RelationKind.ONE_TO_ONE,
|
|
44
|
+
mappedEntity: "IdCard",
|
|
45
|
+
mappedProperty: "owner",
|
|
46
|
+
nullable: true,
|
|
47
|
+
mappedNamespace: "public",
|
|
48
|
+
onDelete: "CASCADE",
|
|
49
|
+
onUpdate: "RESTRICT",
|
|
50
|
+
columnName: "idCardId"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "orders",
|
|
54
|
+
displayName: "订单",
|
|
55
|
+
kind: RelationKind.ONE_TO_MANY,
|
|
56
|
+
mappedEntity: "Order",
|
|
57
|
+
mappedProperty: "owner",
|
|
58
|
+
mappedNamespace: "public",
|
|
59
|
+
onDelete: "CASCADE",
|
|
60
|
+
onUpdate: "RESTRICT"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
repository: "Repository",
|
|
64
|
+
namespace: "public",
|
|
65
|
+
indexes: [],
|
|
66
|
+
computedProperties: [],
|
|
67
|
+
extends: [
|
|
68
|
+
"EntityBase"
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
],
|
|
72
|
+
User
|
|
73
|
+
);
|
|
74
|
+
export { User };
|