@aiao/rxdb-test 0.0.6 → 0.0.8

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,119 @@
1
- import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, FindTreeRootOptions, IEntity, IEntityStaticType, ITreeEntity, NumberRules, RelationBooleanRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, UUID, UUIDRules } from '@aiao/rxdb';
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
2
  import { Observable } from 'rxjs';
3
3
 
4
+ /**
5
+ * rule
6
+ */
7
+ declare type RxDBRepositorySyncRule = StringRules<RxDBRepositorySync, 'id'>
8
+ | StringRules<RxDBRepositorySync, 'namespace'>
9
+ | StringRules<RxDBRepositorySync, 'entity'>
10
+ | StringRules<RxDBRepositorySync, 'syncType'>
11
+ | NumberRules<RxDBRepositorySync, 'lastPushedChangeId'>
12
+ | DateRules<RxDBRepositorySync, 'lastPushedAt'>
13
+ | DateRules<RxDBRepositorySync, 'lastPulledAt'>
14
+ | NumberRules<RxDBRepositorySync, 'lastPullRemoteChangeId'>
15
+ | BooleanRules<RxDBRepositorySync, 'enabled'>
16
+ | DateRules<RxDBRepositorySync, 'createdAt'>
17
+ | DateRules<RxDBRepositorySync, 'updatedAt'>
18
+ | StringRules<RxDBRepositorySync, 'branchId'>
19
+ | RelationExistsRules<'branch', RxDBBranchRuleGroup>
20
+ | RelationStringRules<'branch.id', string>
21
+ | RelationBooleanRules<'branch.activated', boolean>
22
+ | RelationNumberRules<'branch.fromChangeId', number | null>
23
+ | RelationBooleanRules<'branch.local', boolean>
24
+ | RelationBooleanRules<'branch.remote', boolean>
25
+ | RelationDateRules<'branch.createdAt', Date | null>
26
+ | RelationDateRules<'branch.updatedAt', Date | null>
27
+ | StringRules<RxDBBranch, 'parentId'>
28
+ | RelationNumberRules<'branch.changes.id', number>
29
+ | RelationNumberRules<'branch.changes.remoteId', number | null>
30
+ | RelationStringRules<'branch.changes.type', string>
31
+ | RelationUUIDRules<'branch.changes.transactionId', UUID | null>
32
+ | RelationStringRules<'branch.changes.namespace', string>
33
+ | RelationStringRules<'branch.changes.entity', string>
34
+ | RelationUUIDRules<'branch.changes.entityId', UUID>
35
+ | RelationDateRules<'branch.changes.createdAt', Date>
36
+ | RelationDateRules<'branch.changes.updatedAt', Date>
37
+ | RelationDateRules<'branch.changes.revertChangedAt', Date | null>
38
+ | RelationNumberRules<'branch.changes.revertChangeId', number | null>
39
+ | RelationDateRules<'branch.changes.redoInvalidatedAt', Date | null>
40
+ | StringRules<RxDBChange, 'branchId'>
41
+ | RelationStringRules<'branch.children.id', string>
42
+ | RelationBooleanRules<'branch.children.activated', boolean>
43
+ | RelationNumberRules<'branch.children.fromChangeId', number | null>
44
+ | RelationBooleanRules<'branch.children.local', boolean>
45
+ | RelationBooleanRules<'branch.children.remote', boolean>
46
+ | RelationDateRules<'branch.children.createdAt', Date | null>
47
+ | RelationDateRules<'branch.children.updatedAt', Date | null>
48
+ | RelationStringRules<'branch.parent.id', string>
49
+ | RelationBooleanRules<'branch.parent.activated', boolean>
50
+ | RelationNumberRules<'branch.parent.fromChangeId', number | null>
51
+ | RelationBooleanRules<'branch.parent.local', boolean>
52
+ | RelationBooleanRules<'branch.parent.remote', boolean>
53
+ | RelationDateRules<'branch.parent.createdAt', Date | null>
54
+ | RelationDateRules<'branch.parent.updatedAt', Date | null>;
55
+
56
+ /**
57
+ * RuleGroupBase
58
+ */
59
+ export declare type RxDBRepositorySyncRuleGroup = RuleGroupBase<typeof RxDBRepositorySync,
60
+ |'id'
61
+ |'namespace'
62
+ |'entity'
63
+ |'syncType'
64
+ |'lastPushedChangeId'
65
+ |'lastPushedAt'
66
+ |'lastPulledAt'
67
+ |'lastPullRemoteChangeId'
68
+ |'enabled'
69
+ |'createdAt'
70
+ |'updatedAt'
71
+ |'branchId'
72
+ |'branch'
73
+ |'branch.id'
74
+ |'branch.activated'
75
+ |'branch.fromChangeId'
76
+ |'branch.local'
77
+ |'branch.remote'
78
+ |'branch.createdAt'
79
+ |'branch.updatedAt'
80
+ |'parentId'
81
+ |'branch.changes.id'
82
+ |'branch.changes.remoteId'
83
+ |'branch.changes.type'
84
+ |'branch.changes.transactionId'
85
+ |'branch.changes.namespace'
86
+ |'branch.changes.entity'
87
+ |'branch.changes.entityId'
88
+ |'branch.changes.createdAt'
89
+ |'branch.changes.updatedAt'
90
+ |'branch.changes.revertChangedAt'
91
+ |'branch.changes.revertChangeId'
92
+ |'branch.changes.redoInvalidatedAt'
93
+ |'branchId'
94
+ |'branch.children.id'
95
+ |'branch.children.activated'
96
+ |'branch.children.fromChangeId'
97
+ |'branch.children.local'
98
+ |'branch.children.remote'
99
+ |'branch.children.createdAt'
100
+ |'branch.children.updatedAt'
101
+ |'parentId'
102
+ |'branch.parent.id'
103
+ |'branch.parent.activated'
104
+ |'branch.parent.fromChangeId'
105
+ |'branch.parent.local'
106
+ |'branch.parent.remote'
107
+ |'branch.parent.createdAt'
108
+ |'branch.parent.updatedAt'
109
+ |'parentId',
110
+ RxDBRepositorySyncRule>;
111
+
112
+ /**
113
+ * OrderByField
114
+ */
115
+ declare type RxDBRepositorySyncOrderByField = "id" | "namespace" | "entity" | "syncType" | "lastPushedChangeId" | "lastPushedAt" | "lastPulledAt" | "lastPullRemoteChangeId" | "enabled" | "createdAt" | "updatedAt";
116
+
4
117
  /**
5
118
  * rule
6
119
  */
@@ -11,7 +124,7 @@ declare type RxDBMigrationRule = NumberRules<RxDBMigration, 'id'>
11
124
  /**
12
125
  * RuleGroupBase
13
126
  */
14
- export declare type RxDBMigrationRuleGroup = RuleGroupBase<typeof RxDBMigration,
127
+ export declare type RxDBMigrationRuleGroup = RuleGroupBase<typeof RxDBMigration,
15
128
  |'id'
16
129
  |'name'
17
130
  |'executedAt',
@@ -26,6 +139,7 @@ declare type RxDBMigrationOrderByField = "id" | "name" | "executedAt";
26
139
  * rule
27
140
  */
28
141
  declare type RxDBChangeRule = NumberRules<RxDBChange, 'id'>
142
+ | NumberRules<RxDBChange, 'remoteId'>
29
143
  | StringRules<RxDBChange, 'type'>
30
144
  | UUIDRules<RxDBChange, 'transactionId'>
31
145
  | StringRules<RxDBChange, 'namespace'>
@@ -35,38 +149,50 @@ declare type RxDBChangeRule = NumberRules<RxDBChange, 'id'>
35
149
  | DateRules<RxDBChange, 'updatedAt'>
36
150
  | DateRules<RxDBChange, 'revertChangedAt'>
37
151
  | NumberRules<RxDBChange, 'revertChangeId'>
38
- | UUIDRules<RxDBChange, 'parentId'>
39
- | UUIDRules<RxDBChange, 'branchId'>
40
- | RelationNumberRules<'children.id', number>
41
- | RelationStringRules<'children.type', string>
42
- | RelationUUIDRules<'children.transactionId', UUID | null>
43
- | RelationStringRules<'children.namespace', string | null>
44
- | RelationStringRules<'children.entity', string | null>
45
- | RelationUUIDRules<'children.entityId', UUID | null>
46
- | RelationDateRules<'children.createdAt', Date | null>
47
- | RelationDateRules<'children.updatedAt', Date | null>
48
- | RelationDateRules<'children.revertChangedAt', Date | null>
49
- | RelationNumberRules<'children.revertChangeId', number | null>
50
- | RelationNumberRules<'parent.id', number>
51
- | RelationStringRules<'parent.type', string>
52
- | RelationUUIDRules<'parent.transactionId', UUID | null>
53
- | RelationStringRules<'parent.namespace', string | null>
54
- | RelationStringRules<'parent.entity', string | null>
55
- | RelationUUIDRules<'parent.entityId', UUID | null>
56
- | RelationDateRules<'parent.createdAt', Date | null>
57
- | RelationDateRules<'parent.updatedAt', Date | null>
58
- | RelationDateRules<'parent.revertChangedAt', Date | null>
59
- | RelationNumberRules<'parent.revertChangeId', number | null>
152
+ | DateRules<RxDBChange, 'redoInvalidatedAt'>
153
+ | StringRules<RxDBChange, 'branchId'>
154
+ | RelationExistsRules<'branch', RxDBBranchRuleGroup>
60
155
  | RelationStringRules<'branch.id', string>
61
156
  | RelationBooleanRules<'branch.activated', boolean>
157
+ | RelationNumberRules<'branch.fromChangeId', number | null>
62
158
  | RelationBooleanRules<'branch.local', boolean>
63
- | RelationBooleanRules<'branch.remote', boolean>;
159
+ | RelationBooleanRules<'branch.remote', boolean>
160
+ | RelationDateRules<'branch.createdAt', Date | null>
161
+ | RelationDateRules<'branch.updatedAt', Date | null>
162
+ | StringRules<RxDBBranch, 'parentId'>
163
+ | RelationStringRules<'branch.repositorySyncs.id', string>
164
+ | RelationStringRules<'branch.repositorySyncs.namespace', string>
165
+ | RelationStringRules<'branch.repositorySyncs.entity', string>
166
+ | RelationStringRules<'branch.repositorySyncs.syncType', string>
167
+ | RelationNumberRules<'branch.repositorySyncs.lastPushedChangeId', number | null>
168
+ | RelationDateRules<'branch.repositorySyncs.lastPushedAt', Date | null>
169
+ | RelationDateRules<'branch.repositorySyncs.lastPulledAt', Date | null>
170
+ | RelationNumberRules<'branch.repositorySyncs.lastPullRemoteChangeId', number | null>
171
+ | RelationBooleanRules<'branch.repositorySyncs.enabled', boolean>
172
+ | RelationDateRules<'branch.repositorySyncs.createdAt', Date | null>
173
+ | RelationDateRules<'branch.repositorySyncs.updatedAt', Date | null>
174
+ | StringRules<RxDBRepositorySync, 'branchId'>
175
+ | RelationStringRules<'branch.children.id', string>
176
+ | RelationBooleanRules<'branch.children.activated', boolean>
177
+ | RelationNumberRules<'branch.children.fromChangeId', number | null>
178
+ | RelationBooleanRules<'branch.children.local', boolean>
179
+ | RelationBooleanRules<'branch.children.remote', boolean>
180
+ | RelationDateRules<'branch.children.createdAt', Date | null>
181
+ | RelationDateRules<'branch.children.updatedAt', Date | null>
182
+ | RelationStringRules<'branch.parent.id', string>
183
+ | RelationBooleanRules<'branch.parent.activated', boolean>
184
+ | RelationNumberRules<'branch.parent.fromChangeId', number | null>
185
+ | RelationBooleanRules<'branch.parent.local', boolean>
186
+ | RelationBooleanRules<'branch.parent.remote', boolean>
187
+ | RelationDateRules<'branch.parent.createdAt', Date | null>
188
+ | RelationDateRules<'branch.parent.updatedAt', Date | null>;
64
189
 
65
190
  /**
66
191
  * RuleGroupBase
67
192
  */
68
- export declare type RxDBChangeRuleGroup = RuleGroupBase<typeof RxDBChange,
193
+ export declare type RxDBChangeRuleGroup = RuleGroupBase<typeof RxDBChange,
69
194
  |'id'
195
+ |'remoteId'
70
196
  |'type'
71
197
  |'transactionId'
72
198
  |'namespace'
@@ -76,110 +202,122 @@ export declare type RxDBChangeRuleGroup = RuleGroupBase<typeof RxDBChange,
76
202
  |'updatedAt'
77
203
  |'revertChangedAt'
78
204
  |'revertChangeId'
79
- |'parentId'
80
- |'branchId'
81
- |'children.id'
82
- |'children.type'
83
- |'children.transactionId'
84
- |'children.namespace'
85
- |'children.entity'
86
- |'children.entityId'
87
- |'children.createdAt'
88
- |'children.updatedAt'
89
- |'children.revertChangedAt'
90
- |'children.revertChangeId'
91
- |'parentId'
92
- |'branchId'
93
- |'parent.id'
94
- |'parent.type'
95
- |'parent.transactionId'
96
- |'parent.namespace'
97
- |'parent.entity'
98
- |'parent.entityId'
99
- |'parent.createdAt'
100
- |'parent.updatedAt'
101
- |'parent.revertChangedAt'
102
- |'parent.revertChangeId'
103
- |'parentId'
205
+ |'redoInvalidatedAt'
104
206
  |'branchId'
207
+ |'branch'
105
208
  |'branch.id'
106
209
  |'branch.activated'
210
+ |'branch.fromChangeId'
107
211
  |'branch.local'
108
- |'branch.remote',
212
+ |'branch.remote'
213
+ |'branch.createdAt'
214
+ |'branch.updatedAt'
215
+ |'parentId'
216
+ |'branch.repositorySyncs.id'
217
+ |'branch.repositorySyncs.namespace'
218
+ |'branch.repositorySyncs.entity'
219
+ |'branch.repositorySyncs.syncType'
220
+ |'branch.repositorySyncs.lastPushedChangeId'
221
+ |'branch.repositorySyncs.lastPushedAt'
222
+ |'branch.repositorySyncs.lastPulledAt'
223
+ |'branch.repositorySyncs.lastPullRemoteChangeId'
224
+ |'branch.repositorySyncs.enabled'
225
+ |'branch.repositorySyncs.createdAt'
226
+ |'branch.repositorySyncs.updatedAt'
227
+ |'branchId'
228
+ |'branch.children.id'
229
+ |'branch.children.activated'
230
+ |'branch.children.fromChangeId'
231
+ |'branch.children.local'
232
+ |'branch.children.remote'
233
+ |'branch.children.createdAt'
234
+ |'branch.children.updatedAt'
235
+ |'parentId'
236
+ |'branch.parent.id'
237
+ |'branch.parent.activated'
238
+ |'branch.parent.fromChangeId'
239
+ |'branch.parent.local'
240
+ |'branch.parent.remote'
241
+ |'branch.parent.createdAt'
242
+ |'branch.parent.updatedAt'
243
+ |'parentId',
109
244
  RxDBChangeRule>;
110
245
 
111
246
  /**
112
247
  * OrderByField
113
248
  */
114
- declare type RxDBChangeOrderByField = "id" | "type" | "transactionId" | "namespace" | "entity" | "entityId" | "inversePatch" | "patch" | "createdAt" | "updatedAt" | "revertChangedAt" | "revertChangeId";
115
-
116
- /**
117
- * TreeRule
118
- */
119
- declare type RxDBChangeTreeRule = RelationStringRules<'children.type', string>
120
- | RelationUUIDRules<'children.transactionId', UUID | null>
121
- | RelationStringRules<'children.namespace', string | null>
122
- | RelationStringRules<'children.entity', string | null>
123
- | RelationUUIDRules<'children.entityId', UUID | null>
124
- | RelationDateRules<'children.createdAt', Date | null>
125
- | RelationDateRules<'children.updatedAt', Date | null>
126
- | RelationDateRules<'children.revertChangedAt', Date | null>
127
- | RelationNumberRules<'children.revertChangeId', number | null>;
128
-
129
- /**
130
- * TreeRuleGroup
131
- */
132
- export declare type RxDBChangeTreeRuleGroup = RuleGroupBase<typeof RxDBChange, 'children.type' | 'children.transactionId' | 'children.namespace' | 'children.entity' | 'children.entityId' | 'children.createdAt' | 'children.updatedAt' | 'children.revertChangedAt' | 'children.revertChangeId', RxDBChangeTreeRule>;
249
+ declare type RxDBChangeOrderByField = "id" | "remoteId" | "type" | "transactionId" | "namespace" | "entity" | "entityId" | "inversePatch" | "patch" | "createdAt" | "updatedAt" | "revertChangedAt" | "revertChangeId" | "redoInvalidatedAt";
133
250
 
134
251
  /**
135
252
  * rule
136
253
  */
137
254
  declare type RxDBBranchRule = StringRules<RxDBBranch, 'id'>
138
255
  | BooleanRules<RxDBBranch, 'activated'>
256
+ | NumberRules<RxDBBranch, 'fromChangeId'>
139
257
  | BooleanRules<RxDBBranch, 'local'>
140
258
  | BooleanRules<RxDBBranch, 'remote'>
259
+ | DateRules<RxDBBranch, 'createdAt'>
260
+ | DateRules<RxDBBranch, 'updatedAt'>
261
+ | StringRules<RxDBBranch, 'parentId'>
262
+ | RelationExistsRules<'changes', RxDBChangeRuleGroup>
141
263
  | RelationNumberRules<'changes.id', number>
264
+ | RelationNumberRules<'changes.remoteId', number | null>
142
265
  | RelationStringRules<'changes.type', string>
143
266
  | RelationUUIDRules<'changes.transactionId', UUID | null>
144
- | RelationStringRules<'changes.namespace', string | null>
145
- | RelationStringRules<'changes.entity', string | null>
146
- | RelationUUIDRules<'changes.entityId', UUID | null>
147
- | RelationDateRules<'changes.createdAt', Date | null>
148
- | RelationDateRules<'changes.updatedAt', Date | null>
267
+ | RelationStringRules<'changes.namespace', string>
268
+ | RelationStringRules<'changes.entity', string>
269
+ | RelationUUIDRules<'changes.entityId', UUID>
270
+ | RelationDateRules<'changes.createdAt', Date>
271
+ | RelationDateRules<'changes.updatedAt', Date>
149
272
  | RelationDateRules<'changes.revertChangedAt', Date | null>
150
273
  | RelationNumberRules<'changes.revertChangeId', number | null>
151
- | UUIDRules<RxDBChange, 'parentId'>
152
- | UUIDRules<RxDBChange, 'branchId'>
153
- | RelationNumberRules<'changes.children.id', number>
154
- | RelationStringRules<'changes.children.type', string>
155
- | RelationUUIDRules<'changes.children.transactionId', UUID | null>
156
- | RelationStringRules<'changes.children.namespace', string | null>
157
- | RelationStringRules<'changes.children.entity', string | null>
158
- | RelationUUIDRules<'changes.children.entityId', UUID | null>
159
- | RelationDateRules<'changes.children.createdAt', Date | null>
160
- | RelationDateRules<'changes.children.updatedAt', Date | null>
161
- | RelationDateRules<'changes.children.revertChangedAt', Date | null>
162
- | RelationNumberRules<'changes.children.revertChangeId', number | null>
163
- | RelationNumberRules<'changes.parent.id', number>
164
- | RelationStringRules<'changes.parent.type', string>
165
- | RelationUUIDRules<'changes.parent.transactionId', UUID | null>
166
- | RelationStringRules<'changes.parent.namespace', string | null>
167
- | RelationStringRules<'changes.parent.entity', string | null>
168
- | RelationUUIDRules<'changes.parent.entityId', UUID | null>
169
- | RelationDateRules<'changes.parent.createdAt', Date | null>
170
- | RelationDateRules<'changes.parent.updatedAt', Date | null>
171
- | RelationDateRules<'changes.parent.revertChangedAt', Date | null>
172
- | RelationNumberRules<'changes.parent.revertChangeId', number | null>;
274
+ | RelationDateRules<'changes.redoInvalidatedAt', Date | null>
275
+ | StringRules<RxDBChange, 'branchId'>
276
+ | RelationExistsRules<'repositorySyncs', RxDBRepositorySyncRuleGroup>
277
+ | RelationStringRules<'repositorySyncs.id', string>
278
+ | RelationStringRules<'repositorySyncs.namespace', string>
279
+ | RelationStringRules<'repositorySyncs.entity', string>
280
+ | RelationStringRules<'repositorySyncs.syncType', string>
281
+ | RelationNumberRules<'repositorySyncs.lastPushedChangeId', number | null>
282
+ | RelationDateRules<'repositorySyncs.lastPushedAt', Date | null>
283
+ | RelationDateRules<'repositorySyncs.lastPulledAt', Date | null>
284
+ | RelationNumberRules<'repositorySyncs.lastPullRemoteChangeId', number | null>
285
+ | RelationBooleanRules<'repositorySyncs.enabled', boolean>
286
+ | RelationDateRules<'repositorySyncs.createdAt', Date | null>
287
+ | RelationDateRules<'repositorySyncs.updatedAt', Date | null>
288
+ | StringRules<RxDBRepositorySync, 'branchId'>
289
+ | RelationExistsRules<'children', RxDBBranchRuleGroup>
290
+ | RelationStringRules<'children.id', string>
291
+ | RelationBooleanRules<'children.activated', boolean>
292
+ | RelationNumberRules<'children.fromChangeId', number | null>
293
+ | RelationBooleanRules<'children.local', boolean>
294
+ | RelationBooleanRules<'children.remote', boolean>
295
+ | RelationDateRules<'children.createdAt', Date | null>
296
+ | RelationDateRules<'children.updatedAt', Date | null>
297
+ | RelationExistsRules<'parent', RxDBBranchRuleGroup>
298
+ | RelationStringRules<'parent.id', string>
299
+ | RelationBooleanRules<'parent.activated', boolean>
300
+ | RelationNumberRules<'parent.fromChangeId', number | null>
301
+ | RelationBooleanRules<'parent.local', boolean>
302
+ | RelationBooleanRules<'parent.remote', boolean>
303
+ | RelationDateRules<'parent.createdAt', Date | null>
304
+ | RelationDateRules<'parent.updatedAt', Date | null>;
173
305
 
174
306
  /**
175
307
  * RuleGroupBase
176
308
  */
177
- export declare type RxDBBranchRuleGroup = RuleGroupBase<typeof RxDBBranch,
309
+ export declare type RxDBBranchRuleGroup = RuleGroupBase<typeof RxDBBranch,
178
310
  |'id'
179
311
  |'activated'
312
+ |'fromChangeId'
180
313
  |'local'
181
314
  |'remote'
315
+ |'createdAt'
316
+ |'updatedAt'
317
+ |'parentId'
318
+ |'changes'
182
319
  |'changes.id'
320
+ |'changes.remoteId'
183
321
  |'changes.type'
184
322
  |'changes.transactionId'
185
323
  |'changes.namespace'
@@ -189,38 +327,60 @@ export declare type RxDBBranchRuleGroup = RuleGroupBase<typeof RxDBBranch,
189
327
  |'changes.updatedAt'
190
328
  |'changes.revertChangedAt'
191
329
  |'changes.revertChangeId'
192
- |'parentId'
330
+ |'changes.redoInvalidatedAt'
193
331
  |'branchId'
194
- |'changes.children.id'
195
- |'changes.children.type'
196
- |'changes.children.transactionId'
197
- |'changes.children.namespace'
198
- |'changes.children.entity'
199
- |'changes.children.entityId'
200
- |'changes.children.createdAt'
201
- |'changes.children.updatedAt'
202
- |'changes.children.revertChangedAt'
203
- |'changes.children.revertChangeId'
204
- |'parentId'
332
+ |'repositorySyncs'
333
+ |'repositorySyncs.id'
334
+ |'repositorySyncs.namespace'
335
+ |'repositorySyncs.entity'
336
+ |'repositorySyncs.syncType'
337
+ |'repositorySyncs.lastPushedChangeId'
338
+ |'repositorySyncs.lastPushedAt'
339
+ |'repositorySyncs.lastPulledAt'
340
+ |'repositorySyncs.lastPullRemoteChangeId'
341
+ |'repositorySyncs.enabled'
342
+ |'repositorySyncs.createdAt'
343
+ |'repositorySyncs.updatedAt'
205
344
  |'branchId'
206
- |'changes.parent.id'
207
- |'changes.parent.type'
208
- |'changes.parent.transactionId'
209
- |'changes.parent.namespace'
210
- |'changes.parent.entity'
211
- |'changes.parent.entityId'
212
- |'changes.parent.createdAt'
213
- |'changes.parent.updatedAt'
214
- |'changes.parent.revertChangedAt'
215
- |'changes.parent.revertChangeId'
345
+ |'children'
346
+ |'children.id'
347
+ |'children.activated'
348
+ |'children.fromChangeId'
349
+ |'children.local'
350
+ |'children.remote'
351
+ |'children.createdAt'
352
+ |'children.updatedAt'
216
353
  |'parentId'
217
- |'branchId',
354
+ |'parent'
355
+ |'parent.id'
356
+ |'parent.activated'
357
+ |'parent.fromChangeId'
358
+ |'parent.local'
359
+ |'parent.remote'
360
+ |'parent.createdAt'
361
+ |'parent.updatedAt'
362
+ |'parentId',
218
363
  RxDBBranchRule>;
219
364
 
220
365
  /**
221
366
  * OrderByField
222
367
  */
223
- declare type RxDBBranchOrderByField = "id" | "activated" | "local" | "remote";
368
+ declare type RxDBBranchOrderByField = "id" | "activated" | "fromChangeId" | "local" | "remote" | "createdAt" | "updatedAt";
369
+
370
+ /**
371
+ * TreeRule
372
+ */
373
+ declare type RxDBBranchTreeRule = RelationBooleanRules<'children.activated', boolean>
374
+ | RelationNumberRules<'children.fromChangeId', number | null>
375
+ | RelationBooleanRules<'children.local', boolean>
376
+ | RelationBooleanRules<'children.remote', boolean>
377
+ | RelationDateRules<'children.createdAt', Date | null>
378
+ | RelationDateRules<'children.updatedAt', Date | null>;
379
+
380
+ /**
381
+ * TreeRuleGroup
382
+ */
383
+ export declare type RxDBBranchTreeRuleGroup = RuleGroupBase<typeof RxDBBranch, 'children.activated' | 'children.fromChangeId' | 'children.local' | 'children.remote' | 'children.createdAt' | 'children.updatedAt', RxDBBranchTreeRule>;
224
384
 
225
385
  /**
226
386
  * rxdb
@@ -230,6 +390,10 @@ declare module "@aiao/rxdb" {
230
390
  * RxDB
231
391
  */
232
392
  interface RxDB {
393
+ /**
394
+ * RxDBRepositorySync
395
+ */
396
+ RxDBRepositorySync: typeof RxDBRepositorySync;
233
397
  /**
234
398
  * RxDBMigration
235
399
  */
@@ -245,6 +409,97 @@ declare module "@aiao/rxdb" {
245
409
  }
246
410
  }
247
411
 
412
+ /**
413
+ * 静态类型
414
+ */
415
+ export interface RxDBRepositorySyncStaticTypes {
416
+ /**
417
+ * id 类型
418
+ */
419
+ idType: string;
420
+ /**
421
+ * 查询选项
422
+ */
423
+ getOptions: string;
424
+ /**
425
+ * 查询选项
426
+ */
427
+ findOneOrFailOptions: FindOneOrFailOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>;
428
+ /**
429
+ * 查询选项
430
+ */
431
+ findOptions: FindOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>;
432
+ /**
433
+ * 查询选项
434
+ */
435
+ findOneOptions: FindOneOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>;
436
+ /**
437
+ * 查询选项
438
+ */
439
+ findAllOptions: FindAllOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>;
440
+ /**
441
+ * 查询选项
442
+ */
443
+ findByCursorOptions: FindByCursorOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>;
444
+ /**
445
+ * 查询选项
446
+ */
447
+ countOptions: CountOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup>;
448
+ }
449
+
450
+ /**
451
+ * 初始化数据
452
+ */
453
+ export interface RxDBRepositorySyncInitData {
454
+ /**
455
+ * id
456
+ */
457
+ id?: string;
458
+ /**
459
+ * namespace
460
+ */
461
+ namespace?: string;
462
+ /**
463
+ * entity
464
+ */
465
+ entity?: string;
466
+ /**
467
+ * syncType
468
+ * @default 'none'
469
+ */
470
+ syncType?: string;
471
+ /**
472
+ * lastPushedChangeId
473
+ */
474
+ lastPushedChangeId?: number | null;
475
+ /**
476
+ * lastPushedAt
477
+ */
478
+ lastPushedAt?: Date | null;
479
+ /**
480
+ * lastPulledAt
481
+ */
482
+ lastPulledAt?: Date | null;
483
+ /**
484
+ * lastPullRemoteChangeId
485
+ */
486
+ lastPullRemoteChangeId?: number | null;
487
+ /**
488
+ * enabled
489
+ */
490
+ enabled?: boolean;
491
+ /**
492
+ * createdAt
493
+ * @default new Date()
494
+ */
495
+ createdAt?: Date | null;
496
+ /**
497
+ * updatedAt
498
+ * @default new Date()
499
+ */
500
+ updatedAt?: Date | null;
501
+ }
502
+
248
503
  /**
249
504
  * 静态类型
250
505
  */
@@ -338,26 +593,6 @@ export interface RxDBChangeStaticTypes {
338
593
  * 查询选项
339
594
  */
340
595
  countOptions: CountOptions<typeof RxDBChange,RxDBChangeRuleGroup>;
341
- /**
342
- * 查询的实体
343
- */
344
- entity: RxDBChange;
345
- /**
346
- * 查询选项
347
- */
348
- findDescendantsOptions: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>;
349
- /**
350
- * 查询选项
351
- */
352
- countDescendantsOptions: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>;
353
- /**
354
- * 查询选项
355
- */
356
- findAncestorsOptions: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>;
357
- /**
358
- * 查询选项
359
- */
360
- countAncestorsOptions: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>;
361
596
  }
362
597
 
363
598
  /**
@@ -368,6 +603,10 @@ export interface RxDBChangeInitData {
368
603
  * id
369
604
  */
370
605
  id?: number;
606
+ /**
607
+ * remoteId
608
+ */
609
+ remoteId?: number | null;
371
610
  /**
372
611
  * type
373
612
  */
@@ -379,15 +618,15 @@ export interface RxDBChangeInitData {
379
618
  /**
380
619
  * namespace
381
620
  */
382
- namespace?: string | null;
621
+ namespace?: string;
383
622
  /**
384
623
  * entity
385
624
  */
386
- entity?: string | null;
625
+ entity?: string;
387
626
  /**
388
627
  * entityId
389
628
  */
390
- entityId?: UUID | null;
629
+ entityId?: UUID;
391
630
  /**
392
631
  * inversePatch
393
632
  */
@@ -400,12 +639,12 @@ export interface RxDBChangeInitData {
400
639
  * createdAt
401
640
  * @default new Date()
402
641
  */
403
- createdAt?: Date | null;
642
+ createdAt?: Date;
404
643
  /**
405
644
  * updatedAt
406
645
  * @default new Date()
407
646
  */
408
- updatedAt?: Date | null;
647
+ updatedAt?: Date;
409
648
  /**
410
649
  * revertChangedAt
411
650
  */
@@ -414,6 +653,10 @@ export interface RxDBChangeInitData {
414
653
  * revertChangeId
415
654
  */
416
655
  revertChangeId?: number | null;
656
+ /**
657
+ * redoInvalidatedAt
658
+ */
659
+ redoInvalidatedAt?: Date | null;
417
660
  }
418
661
 
419
662
  /**
@@ -452,6 +695,26 @@ export interface RxDBBranchStaticTypes {
452
695
  * 查询选项
453
696
  */
454
697
  countOptions: CountOptions<typeof RxDBBranch,RxDBBranchRuleGroup>;
698
+ /**
699
+ * 查询的实体
700
+ */
701
+ entity: RxDBBranch;
702
+ /**
703
+ * 查询选项
704
+ */
705
+ findDescendantsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
706
+ /**
707
+ * 查询选项
708
+ */
709
+ countDescendantsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
710
+ /**
711
+ * 查询选项
712
+ */
713
+ findAncestorsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
714
+ /**
715
+ * 查询选项
716
+ */
717
+ countAncestorsOptions: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>;
455
718
  }
456
719
 
457
720
  /**
@@ -466,6 +729,10 @@ export interface RxDBBranchInitData {
466
729
  * activated
467
730
  */
468
731
  activated?: boolean;
732
+ /**
733
+ * fromChangeId
734
+ */
735
+ fromChangeId?: number | null;
469
736
  /**
470
737
  * local
471
738
  */
@@ -474,22 +741,160 @@ export interface RxDBBranchInitData {
474
741
  * remote
475
742
  */
476
743
  remote?: boolean;
744
+ /**
745
+ * createdAt
746
+ * @default new Date()
747
+ */
748
+ createdAt?: Date | null;
749
+ /**
750
+ * updatedAt
751
+ * @default new Date()
752
+ */
753
+ updatedAt?: Date | null;
754
+ }
755
+
756
+ /**
757
+ * RxDBRepositorySync
758
+ */
759
+ export declare class RxDBRepositorySync {
760
+ static [ENTITY_STATIC_TYPES]: RxDBRepositorySyncStaticTypes;
761
+ /**
762
+ * branch
763
+ */
764
+ readonly branch$: RelationEntityObservable<typeof RxDBBranch>;
765
+ /**
766
+ * createdAt
767
+ * @default new Date()
768
+ */
769
+ readonly createdAt?: Date | null;
770
+ /**
771
+ * updatedAt
772
+ * @default new Date()
773
+ */
774
+ readonly updatedAt?: Date | null;
775
+ /**
776
+ * branch id
777
+ */
778
+ branchId: string;
779
+ /**
780
+ * enabled
781
+ */
782
+ enabled: boolean;
783
+ /**
784
+ * entity
785
+ */
786
+ entity: string;
787
+ /**
788
+ * id
789
+ */
790
+ id: string;
791
+ /**
792
+ * lastPulledAt
793
+ */
794
+ lastPulledAt?: Date | null;
795
+ /**
796
+ * lastPullRemoteChangeId
797
+ */
798
+ lastPullRemoteChangeId?: number | null;
799
+ /**
800
+ * lastPushedAt
801
+ */
802
+ lastPushedAt?: Date | null;
803
+ /**
804
+ * lastPushedChangeId
805
+ */
806
+ lastPushedChangeId?: number | null;
807
+ /**
808
+ * namespace
809
+ */
810
+ namespace: string;
811
+ /**
812
+ * syncType
813
+ * @default 'none'
814
+ */
815
+ syncType: string;
816
+ /**
817
+ * 初始化数据
818
+ * @param initData 初始化数据
819
+ */
820
+ constructor(initData?: RxDBRepositorySyncInitData);
821
+ /**
822
+ * 统计实体数量
823
+ * @param options 查询选项
824
+ * @example
825
+ * RxDBRepositorySync.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
826
+ */
827
+ static count(options: CountOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup>): Observable<number>;
828
+ /**
829
+ * 查询多个实体
830
+ * @param options 查询选项
831
+ * @example
832
+ * RxDBRepositorySync.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
833
+ */
834
+ static find(options: FindOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>): Observable<RxDBRepositorySync[]>;
835
+ /**
836
+ * 查询所有实体
837
+ * @param options 查询选项
838
+ * @example
839
+ * RxDBRepositorySync.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
840
+ */
841
+ static findAll(options: FindAllOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>): Observable<RxDBRepositorySync[]>;
842
+ /**
843
+ * 游标分页查询
844
+ * @param options 查询选项
845
+ * @example
846
+ * RxDBRepositorySync.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
847
+ */
848
+ static findByCursor(options: FindByCursorOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>): Observable<RxDBRepositorySync[]>;
849
+ /**
850
+ * 查询单个实体,未找到时返回 undefined
851
+ * @param options 查询选项
852
+ * @example
853
+ * RxDBRepositorySync.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
854
+ */
855
+ static findOne(options: FindOneOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>): Observable<RxDBRepositorySync | undefined>;
856
+ /**
857
+ * 查询单个实体,未找到时抛出错误
858
+ * @param options 查询选项
859
+ * @example
860
+ * RxDBRepositorySync.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
861
+ */
862
+ static findOneOrFail(options: FindOneOrFailOptions<typeof RxDBRepositorySync,RxDBRepositorySyncRuleGroup,RxDBRepositorySyncOrderByField>): Observable<RxDBRepositorySync>;
863
+ /**
864
+ * 根据 ID 获取单个实体
865
+ * @param options 查询选项
866
+ * @example
867
+ * RxDBRepositorySync.get('123').subscribe(entity => console.log(entity));
868
+ */
869
+ static get(options: string): Observable<RxDBRepositorySync>;
870
+ /**
871
+ * 删除
872
+ */
873
+ remove(): Promise<RxDBRepositorySync>;
874
+ /**
875
+ * 重置数据
876
+ */
877
+ reset(): void;
878
+ /**
879
+ * 保存
880
+ */
881
+ save(): Promise<RxDBRepositorySync>;
477
882
  }
478
883
 
479
884
  /**
480
885
  * RxDBMigration
481
886
  */
482
- export declare class RxDBMigration implements IEntityStaticType {
887
+ export declare class RxDBMigration {
483
888
  static [ENTITY_STATIC_TYPES]: RxDBMigrationStaticTypes;
484
889
  /**
485
890
  * executedAt
486
891
  * @default new Date()
487
892
  */
488
- executedAt: Date;
893
+ readonly executedAt: Date;
489
894
  /**
490
895
  * name
491
896
  */
492
- name: string;
897
+ readonly name: string;
493
898
  /**
494
899
  * id
495
900
  */
@@ -500,38 +905,52 @@ export declare class RxDBMigration implements IEntityStaticType {
500
905
  */
501
906
  constructor(initData?: RxDBMigrationInitData);
502
907
  /**
503
- * count 查询
908
+ * 统计实体数量
504
909
  * @param options 查询选项
910
+ * @example
911
+ * RxDBMigration.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
505
912
  */
506
913
  static count(options: CountOptions<typeof RxDBMigration,RxDBMigrationRuleGroup>): Observable<number>;
507
914
  /**
508
- * find 查询
915
+ * 查询多个实体
509
916
  * @param options 查询选项
917
+ * @example
918
+ * RxDBMigration.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
510
919
  */
511
920
  static find(options: FindOptions<typeof RxDBMigration,RxDBMigrationRuleGroup,RxDBMigrationOrderByField>): Observable<RxDBMigration[]>;
512
921
  /**
513
- * findAll 查询
922
+ * 查询所有实体
514
923
  * @param options 查询选项
924
+ * @example
925
+ * RxDBMigration.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
515
926
  */
516
927
  static findAll(options: FindAllOptions<typeof RxDBMigration,RxDBMigrationRuleGroup,RxDBMigrationOrderByField>): Observable<RxDBMigration[]>;
517
928
  /**
518
- * findByCursor 查询
929
+ * 游标分页查询
519
930
  * @param options 查询选项
931
+ * @example
932
+ * RxDBMigration.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
520
933
  */
521
934
  static findByCursor(options: FindByCursorOptions<typeof RxDBMigration,RxDBMigrationRuleGroup,RxDBMigrationOrderByField>): Observable<RxDBMigration[]>;
522
935
  /**
523
- * findOne 查询
936
+ * 查询单个实体,未找到时返回 undefined
524
937
  * @param options 查询选项
938
+ * @example
939
+ * RxDBMigration.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
525
940
  */
526
941
  static findOne(options: FindOneOptions<typeof RxDBMigration,RxDBMigrationRuleGroup,RxDBMigrationOrderByField>): Observable<RxDBMigration | undefined>;
527
942
  /**
528
- * findOneOrFail 查询
943
+ * 查询单个实体,未找到时抛出错误
529
944
  * @param options 查询选项
945
+ * @example
946
+ * RxDBMigration.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
530
947
  */
531
948
  static findOneOrFail(options: FindOneOrFailOptions<typeof RxDBMigration,RxDBMigrationRuleGroup,RxDBMigrationOrderByField>): Observable<RxDBMigration>;
532
949
  /**
533
- * get 查询
950
+ * 根据 ID 获取单个实体
534
951
  * @param options 查询选项
952
+ * @example
953
+ * RxDBMigration.get('123').subscribe(entity => console.log(entity));
535
954
  */
536
955
  static get(options: number): Observable<RxDBMigration>;
537
956
  /**
@@ -551,66 +970,62 @@ export declare class RxDBMigration implements IEntityStaticType {
551
970
  /**
552
971
  * RxDBChange
553
972
  */
554
- export declare class RxDBChange implements IEntityStaticType {
973
+ export declare class RxDBChange {
555
974
  static [ENTITY_STATIC_TYPES]: RxDBChangeStaticTypes;
556
975
  /**
557
976
  * branch
558
977
  */
559
- branch$: RelationEntityObservable<RxDBBranch | null>;
560
- /**
561
- * branch id
562
- */
563
- branchId?: string;
564
- /**
565
- * children
566
- */
567
- children$: RelationEntitiesObservable<RxDBChange>;
978
+ readonly branch$: RelationEntityObservable<typeof RxDBBranch>;
568
979
  /**
569
980
  * createdAt
570
981
  * @default new Date()
571
982
  */
572
- createdAt?: Date | null;
983
+ readonly createdAt: Date;
573
984
  /**
574
985
  * entity
575
986
  */
576
- entity?: string | null;
987
+ readonly entity: string;
577
988
  /**
578
989
  * entityId
579
990
  */
580
- entityId?: UUID | null;
991
+ readonly entityId: UUID;
581
992
  /**
582
993
  * inversePatch
583
994
  */
584
- inversePatch?: Record<string, any> | null;
995
+ readonly inversePatch?: Record<string, any> | null;
585
996
  /**
586
997
  * namespace
587
998
  */
588
- namespace?: string | null;
589
- /**
590
- * parent
591
- */
592
- parent$: RelationEntityObservable<RxDBChange | null>;
999
+ readonly namespace: string;
593
1000
  /**
594
- * parent id
1001
+ * patch
595
1002
  */
596
- parentId?: number;
1003
+ readonly patch?: Record<string, any> | null;
597
1004
  /**
598
- * patch
1005
+ * remoteId
599
1006
  */
600
- patch?: Record<string, any> | null;
1007
+ readonly remoteId?: number | null;
601
1008
  /**
602
1009
  * type
603
1010
  */
604
- type: string;
1011
+ readonly type: string;
605
1012
  /**
606
1013
  * updatedAt
607
1014
  * @default new Date()
608
1015
  */
609
- updatedAt?: Date | null;
1016
+ readonly updatedAt: Date;
1017
+ /**
1018
+ * branch id
1019
+ */
1020
+ branchId?: string | null;
610
1021
  /**
611
1022
  * id
612
1023
  */
613
1024
  id: number;
1025
+ /**
1026
+ * redoInvalidatedAt
1027
+ */
1028
+ redoInvalidatedAt?: Date | null;
614
1029
  /**
615
1030
  * revertChangedAt
616
1031
  */
@@ -629,58 +1044,52 @@ export declare class RxDBChange implements IEntityStaticType {
629
1044
  */
630
1045
  constructor(initData?: RxDBChangeInitData);
631
1046
  /**
632
- * count 查询
1047
+ * 统计实体数量
633
1048
  * @param options 查询选项
1049
+ * @example
1050
+ * RxDBChange.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
634
1051
  */
635
1052
  static count(options: CountOptions<typeof RxDBChange,RxDBChangeRuleGroup>): Observable<number>;
636
1053
  /**
637
- * 查询祖先实体数量
638
- * @param options 查询选项
639
- */
640
- static countAncestors(options?: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>): Observable<number>;
641
- /**
642
- * 查询子孙实体数量
643
- * @param options 查询选项
644
- */
645
- static countDescendants(options?: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>): Observable<number>;
646
- /**
647
- * find 查询
1054
+ * 查询多个实体
648
1055
  * @param options 查询选项
1056
+ * @example
1057
+ * RxDBChange.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
649
1058
  */
650
1059
  static find(options: FindOptions<typeof RxDBChange,RxDBChangeRuleGroup,RxDBChangeOrderByField>): Observable<RxDBChange[]>;
651
1060
  /**
652
- * findAll 查询
1061
+ * 查询所有实体
653
1062
  * @param options 查询选项
1063
+ * @example
1064
+ * RxDBChange.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
654
1065
  */
655
1066
  static findAll(options: FindAllOptions<typeof RxDBChange,RxDBChangeRuleGroup,RxDBChangeOrderByField>): Observable<RxDBChange[]>;
656
1067
  /**
657
- * 查询祖先实体
658
- * @param options 查询选项
659
- */
660
- static findAncestors(options?: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>): Observable<RxDBChange[]>;
661
- /**
662
- * findByCursor 查询
1068
+ * 游标分页查询
663
1069
  * @param options 查询选项
1070
+ * @example
1071
+ * RxDBChange.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
664
1072
  */
665
1073
  static findByCursor(options: FindByCursorOptions<typeof RxDBChange,RxDBChangeRuleGroup,RxDBChangeOrderByField>): Observable<RxDBChange[]>;
666
1074
  /**
667
- * 查询子孙实体
668
- * @param options 查询选项
669
- */
670
- static findDescendants(options?: FindTreeOptions<typeof RxDBChange,RxDBChangeTreeRuleGroup>): Observable<RxDBChange[]>;
671
- /**
672
- * findOne 查询
1075
+ * 查询单个实体,未找到时返回 undefined
673
1076
  * @param options 查询选项
1077
+ * @example
1078
+ * RxDBChange.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
674
1079
  */
675
1080
  static findOne(options: FindOneOptions<typeof RxDBChange,RxDBChangeRuleGroup,RxDBChangeOrderByField>): Observable<RxDBChange | undefined>;
676
1081
  /**
677
- * findOneOrFail 查询
1082
+ * 查询单个实体,未找到时抛出错误
678
1083
  * @param options 查询选项
1084
+ * @example
1085
+ * RxDBChange.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
679
1086
  */
680
1087
  static findOneOrFail(options: FindOneOrFailOptions<typeof RxDBChange,RxDBChangeRuleGroup,RxDBChangeOrderByField>): Observable<RxDBChange>;
681
1088
  /**
682
- * get 查询
1089
+ * 根据 ID 获取单个实体
683
1090
  * @param options 查询选项
1091
+ * @example
1092
+ * RxDBChange.get('123').subscribe(entity => console.log(entity));
684
1093
  */
685
1094
  static get(options: number): Observable<RxDBChange>;
686
1095
  /**
@@ -700,16 +1109,42 @@ export declare class RxDBChange implements IEntityStaticType {
700
1109
  /**
701
1110
  * RxDBBranch
702
1111
  */
703
- export declare class RxDBBranch implements IEntityStaticType {
1112
+ export declare class RxDBBranch {
704
1113
  static [ENTITY_STATIC_TYPES]: RxDBBranchStaticTypes;
705
1114
  /**
706
1115
  * changes
707
1116
  */
708
- changes$: RelationEntitiesObservable<RxDBChange>;
1117
+ readonly changes$: RelationEntitiesObservable<RxDBChange>;
1118
+ /**
1119
+ * children
1120
+ */
1121
+ readonly children$: RelationEntitiesObservable<RxDBBranch>;
1122
+ /**
1123
+ * createdAt
1124
+ * @default new Date()
1125
+ */
1126
+ readonly createdAt?: Date | null;
1127
+ /**
1128
+ * parent
1129
+ */
1130
+ readonly parent$: RelationEntityObservable<typeof RxDBBranch>;
1131
+ /**
1132
+ * repositorySyncs
1133
+ */
1134
+ readonly repositorySyncs$: RelationEntitiesObservable<RxDBRepositorySync>;
1135
+ /**
1136
+ * updatedAt
1137
+ * @default new Date()
1138
+ */
1139
+ readonly updatedAt?: Date | null;
709
1140
  /**
710
1141
  * activated
711
1142
  */
712
1143
  activated: boolean;
1144
+ /**
1145
+ * fromChangeId
1146
+ */
1147
+ fromChangeId?: number | null;
713
1148
  /**
714
1149
  * id
715
1150
  */
@@ -718,6 +1153,10 @@ export declare class RxDBBranch implements IEntityStaticType {
718
1153
  * local
719
1154
  */
720
1155
  local: boolean;
1156
+ /**
1157
+ * parent id
1158
+ */
1159
+ parentId?: string | null;
721
1160
  /**
722
1161
  * remote
723
1162
  */
@@ -728,38 +1167,90 @@ export declare class RxDBBranch implements IEntityStaticType {
728
1167
  */
729
1168
  constructor(initData?: RxDBBranchInitData);
730
1169
  /**
731
- * count 查询
1170
+ * 统计实体数量
732
1171
  * @param options 查询选项
1172
+ * @example
1173
+ * RxDBBranch.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
733
1174
  */
734
1175
  static count(options: CountOptions<typeof RxDBBranch,RxDBBranchRuleGroup>): Observable<number>;
735
1176
  /**
736
- * find 查询
1177
+ * 统计祖先实体数量(不包含自身)
737
1178
  * @param options 查询选项
1179
+ * @example
1180
+ * // 统计某节点的祖先层级深度
1181
+ RxDBBranch.countAncestors({ entityId: grand.id }).subscribe(depth => console.log(depth));
1182
+ */
1183
+ static countAncestors(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<number>;
1184
+ /**
1185
+ * 统计子孙实体数量(不包含自身)
1186
+ * @param options 查询选项
1187
+ * @example
1188
+ * // 统计某节点下的后代数量
1189
+ RxDBBranch.countDescendants({ entityId: root.id }).subscribe(count => console.log(count));
1190
+ */
1191
+ static countDescendants(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<number>;
1192
+ /**
1193
+ * 查询多个实体
1194
+ * @param options 查询选项
1195
+ * @example
1196
+ * RxDBBranch.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
738
1197
  */
739
1198
  static find(options: FindOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
740
1199
  /**
741
- * findAll 查询
1200
+ * 查询所有实体
742
1201
  * @param options 查询选项
1202
+ * @example
1203
+ * RxDBBranch.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
743
1204
  */
744
1205
  static findAll(options: FindAllOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
745
1206
  /**
746
- * findByCursor 查询
1207
+ * 查询祖先实体(包含自身)
1208
+ * @param options 查询选项
1209
+ * @example
1210
+ * // 查询某节点的所有祖先(面包屑导航)
1211
+ RxDBBranch.findAncestors({ entityId: grand.id }).subscribe(ancestors => console.log(ancestors));
1212
+
1213
+ // 仅查询直接父节点(level 1)
1214
+ RxDBBranch.findAncestors({ entityId: grand.id, level: 1 }).subscribe(parents => console.log(parents));
1215
+ */
1216
+ static findAncestors(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<RxDBBranch[]>;
1217
+ /**
1218
+ * 游标分页查询
747
1219
  * @param options 查询选项
1220
+ * @example
1221
+ * RxDBBranch.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
748
1222
  */
749
1223
  static findByCursor(options: FindByCursorOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch[]>;
750
1224
  /**
751
- * findOne 查询
1225
+ * 查询子孙实体(包含自身)
1226
+ * @param options 查询选项
1227
+ * @example
1228
+ * // 查询某节点的所有后代
1229
+ RxDBBranch.findDescendants({ entityId: root.id }).subscribe(list => console.log(list));
1230
+
1231
+ // 仅查询直接子节点(level 1)
1232
+ RxDBBranch.findDescendants({ entityId: root.id, level: 1 }).subscribe(children => console.log(children));
1233
+ */
1234
+ static findDescendants(options?: FindTreeOptions<typeof RxDBBranch,RxDBBranchTreeRuleGroup>): Observable<RxDBBranch[]>;
1235
+ /**
1236
+ * 查询单个实体,未找到时返回 undefined
752
1237
  * @param options 查询选项
1238
+ * @example
1239
+ * RxDBBranch.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
753
1240
  */
754
1241
  static findOne(options: FindOneOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch | undefined>;
755
1242
  /**
756
- * findOneOrFail 查询
1243
+ * 查询单个实体,未找到时抛出错误
757
1244
  * @param options 查询选项
1245
+ * @example
1246
+ * RxDBBranch.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
758
1247
  */
759
1248
  static findOneOrFail(options: FindOneOrFailOptions<typeof RxDBBranch,RxDBBranchRuleGroup,RxDBBranchOrderByField>): Observable<RxDBBranch>;
760
1249
  /**
761
- * get 查询
1250
+ * 根据 ID 获取单个实体
762
1251
  * @param options 查询选项
1252
+ * @example
1253
+ * RxDBBranch.get('123').subscribe(entity => console.log(entity));
763
1254
  */
764
1255
  static get(options: string): Observable<RxDBBranch>;
765
1256
  /**