@aiao/rxdb-test 0.0.14 → 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.
Files changed (49) hide show
  1. package/dist/entities/FileLarge.d.ts +339 -0
  2. package/dist/entities/FileLarge.js +77 -0
  3. package/dist/entities/FileNode.d.ts +335 -0
  4. package/dist/entities/FileNode.js +77 -0
  5. package/dist/entities/MenuLarge.d.ts +294 -0
  6. package/dist/entities/MenuLarge.js +41 -0
  7. package/dist/entities/MenuSimple.d.ts +290 -0
  8. package/dist/entities/MenuSimple.js +41 -0
  9. package/dist/entities/Todo.d.ts +165 -0
  10. package/dist/entities/Todo.js +34 -0
  11. package/dist/entities/TypeDemo.d.ts +264 -0
  12. package/dist/entities/TypeDemo.js +101 -0
  13. package/dist/entities/index.d.ts +14 -1664
  14. package/dist/entities/index.js +6 -360
  15. package/dist/graph/index.d.ts +1 -2
  16. package/dist/graph/index.js +1 -1
  17. package/dist/shop/Attribute.d.ts +359 -0
  18. package/dist/shop/Attribute.js +50 -0
  19. package/dist/shop/AttributeValue.d.ts +366 -0
  20. package/dist/shop/AttributeValue.js +51 -0
  21. package/dist/shop/Category.d.ts +280 -0
  22. package/dist/shop/Category.js +41 -0
  23. package/dist/shop/IdCard.d.ts +237 -0
  24. package/dist/shop/IdCard.js +43 -0
  25. package/dist/shop/Order.d.ts +270 -0
  26. package/dist/shop/Order.js +58 -0
  27. package/dist/shop/OrderItem.d.ts +293 -0
  28. package/dist/shop/OrderItem.js +64 -0
  29. package/dist/shop/Product.d.ts +321 -0
  30. package/dist/shop/Product.js +47 -0
  31. package/dist/shop/SKU.d.ts +343 -0
  32. package/dist/shop/SKU.js +63 -0
  33. package/dist/shop/SKUAttributes.d.ts +306 -0
  34. package/dist/shop/SKUAttributes.js +56 -0
  35. package/dist/shop/User.d.ts +269 -0
  36. package/dist/shop/User.js +74 -0
  37. package/dist/shop/index.d.ts +22 -2980
  38. package/dist/shop/index.js +10 -528
  39. package/dist/system/RxDBBranch.d.ts +396 -0
  40. package/dist/system/RxDBBranch.js +106 -0
  41. package/dist/system/RxDBChange.d.ts +361 -0
  42. package/dist/system/RxDBChange.js +123 -0
  43. package/dist/system/RxDBMigration.d.ts +167 -0
  44. package/dist/system/RxDBMigration.js +40 -0
  45. package/dist/system/RxDBSync.d.ts +339 -0
  46. package/dist/system/RxDBSync.js +122 -0
  47. package/dist/system/index.d.ts +9 -1240
  48. package/dist/system/index.js +4 -384
  49. package/package.json +3 -3
@@ -0,0 +1,396 @@
1
+ import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, IEntity, ITreeEntity, NumberRules, RelationBooleanRules, 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 RxDBBranchRule = StringRules<RxDBBranch, 'id'>
8
+ | BooleanRules<RxDBBranch, 'activated'>
9
+ | NumberRules<RxDBBranch, 'fromChangeId'>
10
+ | BooleanRules<RxDBBranch, 'local'>
11
+ | BooleanRules<RxDBBranch, 'remote'>
12
+ | DateRules<RxDBBranch, 'createdAt'>
13
+ | DateRules<RxDBBranch, 'updatedAt'>
14
+ | StringRules<RxDBBranch, 'parentId'>
15
+ | RelationExistsRules<'changes', RxDBChangeRuleGroup>
16
+ | RelationNumberRules<'changes.id', number>
17
+ | RelationNumberRules<'changes.remoteId', number | null>
18
+ | RelationStringRules<'changes.type', string>
19
+ | RelationUUIDRules<'changes.transactionId', UUID | null>
20
+ | RelationStringRules<'changes.namespace', string>
21
+ | RelationStringRules<'changes.entity', string>
22
+ | RelationUUIDRules<'changes.entityId', UUID>
23
+ | RelationDateRules<'changes.createdAt', Date>
24
+ | RelationDateRules<'changes.updatedAt', Date>
25
+ | RelationDateRules<'changes.revertChangedAt', Date | null>
26
+ | RelationNumberRules<'changes.revertChangeId', number | null>
27
+ | RelationDateRules<'changes.redoInvalidatedAt', Date | null>
28
+ | StringRules<RxDBChange, 'branchId'>
29
+ | RelationExistsRules<'syncs', RxDBSyncRuleGroup>
30
+ | RelationStringRules<'syncs.id', string>
31
+ | RelationStringRules<'syncs.namespace', string>
32
+ | RelationStringRules<'syncs.entity', string>
33
+ | RelationStringRules<'syncs.syncType', string>
34
+ | RelationNumberRules<'syncs.lastPushedChangeId', number | null>
35
+ | RelationDateRules<'syncs.lastPushedAt', Date | null>
36
+ | RelationDateRules<'syncs.lastPulledAt', Date | null>
37
+ | RelationNumberRules<'syncs.lastPullRemoteChangeId', number | null>
38
+ | RelationBooleanRules<'syncs.enabled', boolean>
39
+ | RelationDateRules<'syncs.createdAt', Date | null>
40
+ | RelationDateRules<'syncs.updatedAt', Date | null>
41
+ | StringRules<RxDBSync, 'branchId'>
42
+ | RelationExistsRules<'children', RxDBBranchRuleGroup>
43
+ | RelationStringRules<'children.id', string>
44
+ | RelationBooleanRules<'children.activated', boolean>
45
+ | RelationNumberRules<'children.fromChangeId', number | null>
46
+ | RelationBooleanRules<'children.local', boolean>
47
+ | RelationBooleanRules<'children.remote', boolean>
48
+ | RelationDateRules<'children.createdAt', Date | null>
49
+ | RelationDateRules<'children.updatedAt', Date | null>
50
+ | RelationExistsRules<'parent', RxDBBranchRuleGroup>
51
+ | RelationStringRules<'parent.id', string>
52
+ | RelationBooleanRules<'parent.activated', boolean>
53
+ | RelationNumberRules<'parent.fromChangeId', number | null>
54
+ | RelationBooleanRules<'parent.local', boolean>
55
+ | RelationBooleanRules<'parent.remote', boolean>
56
+ | RelationDateRules<'parent.createdAt', Date | null>
57
+ | RelationDateRules<'parent.updatedAt', Date | null>;
58
+
59
+ /**
60
+ * RuleGroupBase
61
+ */
62
+ export declare type RxDBBranchRuleGroup = RuleGroupBase<typeof RxDBBranch,
63
+ |'id'
64
+ |'activated'
65
+ |'fromChangeId'
66
+ |'local'
67
+ |'remote'
68
+ |'createdAt'
69
+ |'updatedAt'
70
+ |'parentId'
71
+ |'changes'
72
+ |'changes.id'
73
+ |'changes.remoteId'
74
+ |'changes.type'
75
+ |'changes.transactionId'
76
+ |'changes.namespace'
77
+ |'changes.entity'
78
+ |'changes.entityId'
79
+ |'changes.createdAt'
80
+ |'changes.updatedAt'
81
+ |'changes.revertChangedAt'
82
+ |'changes.revertChangeId'
83
+ |'changes.redoInvalidatedAt'
84
+ |'branchId'
85
+ |'syncs'
86
+ |'syncs.id'
87
+ |'syncs.namespace'
88
+ |'syncs.entity'
89
+ |'syncs.syncType'
90
+ |'syncs.lastPushedChangeId'
91
+ |'syncs.lastPushedAt'
92
+ |'syncs.lastPulledAt'
93
+ |'syncs.lastPullRemoteChangeId'
94
+ |'syncs.enabled'
95
+ |'syncs.createdAt'
96
+ |'syncs.updatedAt'
97
+ |'branchId'
98
+ |'children'
99
+ |'children.id'
100
+ |'children.activated'
101
+ |'children.fromChangeId'
102
+ |'children.local'
103
+ |'children.remote'
104
+ |'children.createdAt'
105
+ |'children.updatedAt'
106
+ |'parentId'
107
+ |'parent'
108
+ |'parent.id'
109
+ |'parent.activated'
110
+ |'parent.fromChangeId'
111
+ |'parent.local'
112
+ |'parent.remote'
113
+ |'parent.createdAt'
114
+ |'parent.updatedAt'
115
+ |'parentId',
116
+ RxDBBranchRule>;
117
+
118
+ /**
119
+ * OrderByField
120
+ */
121
+ declare type RxDBBranchOrderByField = "id" | "activated" | "fromChangeId" | "local" | "remote" | "createdAt" | "updatedAt";
122
+
123
+ /**
124
+ * TreeRule
125
+ */
126
+ declare type RxDBBranchTreeRule = RelationBooleanRules<'children.activated', boolean>
127
+ | RelationNumberRules<'children.fromChangeId', number | null>
128
+ | RelationBooleanRules<'children.local', boolean>
129
+ | RelationBooleanRules<'children.remote', boolean>
130
+ | RelationDateRules<'children.createdAt', Date | null>
131
+ | RelationDateRules<'children.updatedAt', Date | null>;
132
+
133
+ /**
134
+ * TreeRuleGroup
135
+ */
136
+ export declare type RxDBBranchTreeRuleGroup = RuleGroupBase<typeof RxDBBranch, 'children.activated' | 'children.fromChangeId' | 'children.local' | 'children.remote' | 'children.createdAt' | 'children.updatedAt', RxDBBranchTreeRule>;
137
+
138
+ /**
139
+ * 静态类型
140
+ */
141
+ export interface RxDBBranchStaticTypes {
142
+ /**
143
+ * id 类型
144
+ */
145
+ idType: string;
146
+ /**
147
+ * 查询选项
148
+ */
149
+ getOptions: string;
150
+ /**
151
+ * 查询选项
152
+ */
153
+ findOneOrFailOptions: FindOneOrFailOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>;
154
+ /**
155
+ * 查询选项
156
+ */
157
+ findOptions: FindOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>;
158
+ /**
159
+ * 查询选项
160
+ */
161
+ findOneOptions: FindOneOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>;
162
+ /**
163
+ * 查询选项
164
+ */
165
+ findAllOptions: FindAllOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>;
166
+ /**
167
+ * 查询选项
168
+ */
169
+ findByCursorOptions: FindByCursorOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>;
170
+ /**
171
+ * 查询选项
172
+ */
173
+ countOptions: CountOptions<typeof RxDBBranch,RxDBBranchRuleGroup>;
174
+ /**
175
+ * 查询的实体
176
+ */
177
+ entity: RxDBBranch;
178
+ /**
179
+ * 查询选项
180
+ */
181
+ findDescendantsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
182
+ /**
183
+ * 查询选项
184
+ */
185
+ countDescendantsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
186
+ /**
187
+ * 查询选项
188
+ */
189
+ findAncestorsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
190
+ /**
191
+ * 查询选项
192
+ */
193
+ countAncestorsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
194
+ }
195
+
196
+ /**
197
+ * 初始化数据
198
+ */
199
+ export interface RxDBBranchInitData {
200
+ /**
201
+ * id
202
+ */
203
+ id?: string;
204
+ /**
205
+ * activated
206
+ */
207
+ activated?: boolean;
208
+ /**
209
+ * fromChangeId
210
+ */
211
+ fromChangeId?: number | null;
212
+ /**
213
+ * local
214
+ */
215
+ local?: boolean;
216
+ /**
217
+ * remote
218
+ */
219
+ remote?: boolean;
220
+ /**
221
+ * createdAt
222
+ * @default new Date()
223
+ */
224
+ createdAt?: Date | null;
225
+ /**
226
+ * updatedAt
227
+ * @default new Date()
228
+ */
229
+ updatedAt?: Date | null;
230
+ /**
231
+ * parent id
232
+ */
233
+ parentId?: string | null;
234
+ }
235
+
236
+ /**
237
+ * RxDBBranch
238
+ */
239
+ export declare class RxDBBranch {
240
+ static [ENTITY_STATIC_TYPES]: RxDBBranchStaticTypes;
241
+ /**
242
+ * changes
243
+ */
244
+ readonly changes$: RelationEntitiesObservable<RxDBChange>;
245
+ /**
246
+ * children
247
+ */
248
+ readonly children$: RelationEntitiesObservable<RxDBBranch>;
249
+ /**
250
+ * createdAt
251
+ * @default new Date()
252
+ */
253
+ readonly createdAt?: Date | null;
254
+ /**
255
+ * parent
256
+ */
257
+ readonly parent$: RelationEntityObservable<typeof RxDBBranch>;
258
+ /**
259
+ * syncs
260
+ */
261
+ readonly syncs$: RelationEntitiesObservable<RxDBSync>;
262
+ /**
263
+ * updatedAt
264
+ * @default new Date()
265
+ */
266
+ readonly updatedAt?: Date | null;
267
+ /**
268
+ * activated
269
+ */
270
+ activated: boolean;
271
+ /**
272
+ * fromChangeId
273
+ */
274
+ fromChangeId?: number | null;
275
+ /**
276
+ * id
277
+ */
278
+ id: string;
279
+ /**
280
+ * local
281
+ */
282
+ local: boolean;
283
+ /**
284
+ * parent id
285
+ */
286
+ parentId?: string | null;
287
+ /**
288
+ * remote
289
+ */
290
+ remote: boolean;
291
+ /**
292
+ * 初始化数据
293
+ * @param initData 初始化数据
294
+ */
295
+ constructor(initData?: RxDBBranchInitData);
296
+ /**
297
+ * 统计实体数量
298
+ * @param options 查询选项
299
+ * @example
300
+ * RxDBBranch.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
301
+ */
302
+ static count(options: CountOptions<typeof RxDBBranch,RxDBBranchRuleGroup>): Observable<number>;
303
+ /**
304
+ * 统计祖先实体数量(不包含自身)
305
+ * @param options 查询选项
306
+ * @example
307
+ * // 统计某节点的祖先层级深度
308
+ RxDBBranch.countAncestors({ entityId: grand.id }).subscribe(depth => console.log(depth));
309
+ */
310
+ static countAncestors(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<number>;
311
+ /**
312
+ * 统计子孙实体数量(不包含自身)
313
+ * @param options 查询选项
314
+ * @example
315
+ * // 统计某节点下的后代数量
316
+ RxDBBranch.countDescendants({ entityId: root.id }).subscribe(count => console.log(count));
317
+ */
318
+ static countDescendants(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<number>;
319
+ /**
320
+ * 查询多个实体
321
+ * @param options 查询选项
322
+ * @example
323
+ * RxDBBranch.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
324
+ */
325
+ static find(options: FindOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
326
+ /**
327
+ * 查询所有实体
328
+ * @param options 查询选项
329
+ * @example
330
+ * RxDBBranch.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
331
+ */
332
+ static findAll(options: FindAllOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
333
+ /**
334
+ * 查询祖先实体(包含自身)
335
+ * @param options 查询选项
336
+ * @example
337
+ * // 查询某节点的所有祖先(面包屑导航)
338
+ RxDBBranch.findAncestors({ entityId: grand.id }).subscribe(ancestors => console.log(ancestors));
339
+
340
+ // 仅查询直接父节点(level 1)
341
+ RxDBBranch.findAncestors({ entityId: grand.id, level: 1 }).subscribe(parents => console.log(parents));
342
+ */
343
+ static findAncestors(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<RxDBBranch[]>;
344
+ /**
345
+ * 游标分页查询
346
+ * @param options 查询选项
347
+ * @example
348
+ * RxDBBranch.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
349
+ */
350
+ static findByCursor(options: FindByCursorOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
351
+ /**
352
+ * 查询子孙实体(包含自身)
353
+ * @param options 查询选项
354
+ * @example
355
+ * // 查询某节点的所有后代
356
+ RxDBBranch.findDescendants({ entityId: root.id }).subscribe(list => console.log(list));
357
+
358
+ // 仅查询直接子节点(level 1)
359
+ RxDBBranch.findDescendants({ entityId: root.id, level: 1 }).subscribe(children => console.log(children));
360
+ */
361
+ static findDescendants(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<RxDBBranch[]>;
362
+ /**
363
+ * 查询单个实体,未找到时返回 undefined
364
+ * @param options 查询选项
365
+ * @example
366
+ * RxDBBranch.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
367
+ */
368
+ static findOne(options: FindOneOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch | undefined>;
369
+ /**
370
+ * 查询单个实体,未找到时抛出错误
371
+ * @param options 查询选项
372
+ * @example
373
+ * RxDBBranch.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
374
+ */
375
+ static findOneOrFail(options: FindOneOrFailOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch>;
376
+ /**
377
+ * 根据 ID 获取单个实体
378
+ * @param options 查询选项
379
+ * @example
380
+ * RxDBBranch.get('123').subscribe(entity => console.log(entity));
381
+ */
382
+ static get(options: string): Observable<RxDBBranch>;
383
+ /**
384
+ * 删除
385
+ */
386
+ remove(): Promise<RxDBBranch>;
387
+ /**
388
+ * 重置数据
389
+ */
390
+ reset(): void;
391
+ /**
392
+ * 保存
393
+ */
394
+ save(): Promise<RxDBBranch>;
395
+ }
396
+
@@ -0,0 +1,106 @@
1
+ import { Entity, PropertyType, RelationKind, __decorateClass } from '@aiao/rxdb';
2
+ let RxDBBranch = class {};
3
+ RxDBBranch = __decorateClass(
4
+ [
5
+ Entity({
6
+ name: "RxDBBranch",
7
+ tableName: "rxdb_branch",
8
+ log: false,
9
+ properties: [
10
+ {
11
+ name: "id",
12
+ type: PropertyType.string,
13
+ primary: true,
14
+ unique: true,
15
+ columnName: "id"
16
+ },
17
+ {
18
+ name: "activated",
19
+ type: PropertyType.boolean,
20
+ default: false,
21
+ columnName: "activated"
22
+ },
23
+ {
24
+ name: "fromChangeId",
25
+ columnName: "from_change_id",
26
+ type: PropertyType.number,
27
+ nullable: true
28
+ },
29
+ {
30
+ name: "local",
31
+ type: PropertyType.boolean,
32
+ default: true,
33
+ columnName: "local"
34
+ },
35
+ {
36
+ name: "remote",
37
+ type: PropertyType.boolean,
38
+ default: false,
39
+ columnName: "remote"
40
+ },
41
+ {
42
+ name: "createdAt",
43
+ columnName: "created_at",
44
+ type: PropertyType.date,
45
+ readonly: true,
46
+ nullable: true
47
+ },
48
+ {
49
+ name: "updatedAt",
50
+ columnName: "updated_at",
51
+ type: PropertyType.date,
52
+ readonly: true,
53
+ nullable: true
54
+ }
55
+ ],
56
+ relations: [
57
+ {
58
+ name: "changes",
59
+ kind: RelationKind.ONE_TO_MANY,
60
+ mappedEntity: "RxDBChange",
61
+ mappedProperty: "branch",
62
+ mappedNamespace: "public",
63
+ onDelete: "CASCADE",
64
+ onUpdate: "RESTRICT"
65
+ },
66
+ {
67
+ name: "syncs",
68
+ kind: RelationKind.ONE_TO_MANY,
69
+ mappedEntity: "RxDBSync",
70
+ mappedProperty: "branch",
71
+ mappedNamespace: "public",
72
+ onDelete: "CASCADE",
73
+ onUpdate: "RESTRICT"
74
+ },
75
+ {
76
+ name: "children",
77
+ kind: RelationKind.ONE_TO_MANY,
78
+ mappedEntity: "RxDBBranch",
79
+ mappedProperty: "parent",
80
+ mappedNamespace: "public",
81
+ onDelete: "CASCADE",
82
+ onUpdate: "RESTRICT"
83
+ },
84
+ {
85
+ name: "parent",
86
+ kind: RelationKind.MANY_TO_ONE,
87
+ mappedEntity: "RxDBBranch",
88
+ mappedProperty: "children",
89
+ nullable: true,
90
+ mappedNamespace: "public",
91
+ onDelete: "SET NULL",
92
+ onUpdate: "RESTRICT",
93
+ columnName: "parentId"
94
+ }
95
+ ],
96
+ repository: "TreeRepository",
97
+ namespace: "public",
98
+ indexes: [],
99
+ computedProperties: [],
100
+ extends: [],
101
+ displayName: "RxDBBranch"
102
+ })
103
+ ],
104
+ RxDBBranch
105
+ );
106
+ export { RxDBBranch };