@aiao/rxdb-test 0.0.2 → 0.0.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aiao Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,422 @@
1
+ import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, FindTreeRootOptions, GetOptions, IEntityStaticType, ITreeEntity, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationStringRules, RelationUUIDRules, RuleGroupCustom, StringRules, TreeAdjacencyListEntityBase, UUID, UUIDRules } from '@aiao/rxdb';
2
+ import { Observable } from 'rxjs';
3
+
4
+ /**
5
+ * rule
6
+ */
7
+ declare type TodoRule = UUIDRules<Todo, 'id'>
8
+ | DateRules<Todo, 'createdAt'>
9
+ | DateRules<Todo, 'updatedAt'>
10
+ | DateRules<Todo, 'removedAt'>
11
+ | StringRules<Todo, 'createdBy'>
12
+ | StringRules<Todo, 'updatedBy'>
13
+ | StringRules<Todo, 'removedBy'>
14
+ | StringRules<Todo, 'title'>
15
+ | BooleanRules<Todo, 'completed'>;
16
+
17
+ /**
18
+ * RuleGroupCustom
19
+ */
20
+ export declare type TodoRuleGroup = RuleGroupCustom<typeof Todo,
21
+ |'id'
22
+ |'createdAt'
23
+ |'updatedAt'
24
+ |'removedAt'
25
+ |'createdBy'
26
+ |'updatedBy'
27
+ |'removedBy'
28
+ |'title'
29
+ |'completed',
30
+ TodoRule>;
31
+
32
+ /**
33
+ * OrderByField
34
+ */
35
+ declare type TodoOrderByField = "id" | "createdAt" | "updatedAt" | "removedAt" | "createdBy" | "updatedBy" | "removedBy" | "title" | "completed";
36
+
37
+ /**
38
+ * rule
39
+ */
40
+ declare type MenuRule = UUIDRules<Menu, 'id'>
41
+ | DateRules<Menu, 'createdAt'>
42
+ | DateRules<Menu, 'updatedAt'>
43
+ | DateRules<Menu, 'removedAt'>
44
+ | StringRules<Menu, 'createdBy'>
45
+ | StringRules<Menu, 'updatedBy'>
46
+ | StringRules<Menu, 'removedBy'>
47
+ | StringRules<Menu, 'title'>
48
+ | UUIDRules<Menu, 'parentId'>
49
+ | RelationUUIDRules<'children.id', UUID>
50
+ | RelationDateRules<'children.createdAt', Date>
51
+ | RelationDateRules<'children.updatedAt', Date>
52
+ | RelationDateRules<'children.removedAt', Date | null>
53
+ | RelationStringRules<'children.createdBy', string | null>
54
+ | RelationStringRules<'children.updatedBy', string | null>
55
+ | RelationStringRules<'children.removedBy', string | null>
56
+ | RelationStringRules<'children.title', string>
57
+ | RelationUUIDRules<'parent.id', UUID>
58
+ | RelationDateRules<'parent.createdAt', Date>
59
+ | RelationDateRules<'parent.updatedAt', Date>
60
+ | RelationDateRules<'parent.removedAt', Date | null>
61
+ | RelationStringRules<'parent.createdBy', string | null>
62
+ | RelationStringRules<'parent.updatedBy', string | null>
63
+ | RelationStringRules<'parent.removedBy', string | null>
64
+ | RelationStringRules<'parent.title', string>;
65
+
66
+ /**
67
+ * RuleGroupCustom
68
+ */
69
+ export declare type MenuRuleGroup = RuleGroupCustom<typeof Menu,
70
+ |'id'
71
+ |'createdAt'
72
+ |'updatedAt'
73
+ |'removedAt'
74
+ |'createdBy'
75
+ |'updatedBy'
76
+ |'removedBy'
77
+ |'title'
78
+ |'parentId'
79
+ |'children.id'
80
+ |'children.createdAt'
81
+ |'children.updatedAt'
82
+ |'children.removedAt'
83
+ |'children.createdBy'
84
+ |'children.updatedBy'
85
+ |'children.removedBy'
86
+ |'children.title'
87
+ |'parentId'
88
+ |'parent.id'
89
+ |'parent.createdAt'
90
+ |'parent.updatedAt'
91
+ |'parent.removedAt'
92
+ |'parent.createdBy'
93
+ |'parent.updatedBy'
94
+ |'parent.removedBy'
95
+ |'parent.title'
96
+ |'parentId',
97
+ MenuRule>;
98
+
99
+ /**
100
+ * OrderByField
101
+ */
102
+ declare type MenuOrderByField = "id" | "createdAt" | "updatedAt" | "removedAt" | "createdBy" | "updatedBy" | "removedBy" | "title";
103
+
104
+ /**
105
+ * TreeRule
106
+ */
107
+ declare type MenuTreeRule = RelationDateRules<'children.createdAt', Date>
108
+ | RelationDateRules<'children.updatedAt', Date>
109
+ | RelationDateRules<'children.removedAt', Date | null>
110
+ | RelationStringRules<'children.createdBy', string | null>
111
+ | RelationStringRules<'children.updatedBy', string | null>
112
+ | RelationStringRules<'children.removedBy', string | null>
113
+ | RelationStringRules<'children.title', string>;
114
+
115
+ /**
116
+ * TreeRuleGroup
117
+ */
118
+ export declare type MenuTreeRuleGroup = RuleGroupCustom<typeof Menu, 'children.createdAt' | 'children.updatedAt' | 'children.removedAt' | 'children.createdBy' | 'children.updatedBy' | 'children.removedBy' | 'children.title', MenuTreeRule>;
119
+
120
+ /**
121
+ * rxdb
122
+ */
123
+ declare module "@aiao/rxdb" {
124
+ /**
125
+ * RxDB
126
+ */
127
+ interface RxDB {
128
+ /**
129
+ * Todo
130
+ */
131
+ Todo: typeof Todo;
132
+ /**
133
+ * Menu
134
+ */
135
+ Menu: typeof Menu;
136
+ }
137
+ }
138
+
139
+ /**
140
+ * 静态类型
141
+ */
142
+ export interface TodoStaticTypes {
143
+ /**
144
+ * id 类型
145
+ */
146
+ idType: UUID;
147
+ /**
148
+ * 查询选项
149
+ */
150
+ getOptions: UUID;
151
+ /**
152
+ * 查询选项
153
+ */
154
+ findOneOrFailOptions: FindOneOrFailOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
155
+ /**
156
+ * 查询选项
157
+ */
158
+ findOptions: FindOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
159
+ /**
160
+ * 查询选项
161
+ */
162
+ findOneOptions: FindOneOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
163
+ /**
164
+ * 查询选项
165
+ */
166
+ findAllOptions: FindAllOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>;
167
+ /**
168
+ * 查询选项
169
+ */
170
+ countOptions: CountOptions<typeof Todo,TodoRuleGroup>;
171
+ }
172
+
173
+ /**
174
+ * 初始化数据
175
+ */
176
+ export interface TodoInitData {
177
+ /**
178
+ * title
179
+ */
180
+ title?: string;
181
+ /**
182
+ * completed
183
+ */
184
+ completed?: boolean;
185
+ }
186
+
187
+ /**
188
+ * 静态类型
189
+ */
190
+ export interface MenuStaticTypes {
191
+ /**
192
+ * id 类型
193
+ */
194
+ idType: UUID;
195
+ /**
196
+ * 查询选项
197
+ */
198
+ getOptions: UUID;
199
+ /**
200
+ * 查询选项
201
+ */
202
+ findOneOrFailOptions: FindOneOrFailOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>;
203
+ /**
204
+ * 查询选项
205
+ */
206
+ findOptions: FindOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>;
207
+ /**
208
+ * 查询选项
209
+ */
210
+ findOneOptions: FindOneOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>;
211
+ /**
212
+ * 查询选项
213
+ */
214
+ findAllOptions: FindAllOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>;
215
+ /**
216
+ * 查询选项
217
+ */
218
+ countOptions: CountOptions<typeof Menu,MenuRuleGroup>;
219
+ /**
220
+ * 查询的实体
221
+ */
222
+ entity: Menu;
223
+ /**
224
+ * 查询选项
225
+ */
226
+ findRootOptions: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>;
227
+ /**
228
+ * 查询选项
229
+ */
230
+ countRootOptions: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>;
231
+ /**
232
+ * 查询选项
233
+ */
234
+ findDescendantsOptions: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>;
235
+ /**
236
+ * 查询选项
237
+ */
238
+ countDescendantsOptions: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>;
239
+ /**
240
+ * 查询选项
241
+ */
242
+ findAncestorsOptions: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>;
243
+ /**
244
+ * 查询选项
245
+ */
246
+ countAncestorsOptions: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>;
247
+ }
248
+
249
+ /**
250
+ * 初始化数据
251
+ */
252
+ export interface MenuInitData {
253
+ /**
254
+ * title
255
+ */
256
+ title?: string;
257
+ }
258
+
259
+ /**
260
+ * Todo
261
+ */
262
+ export declare class Todo extends EntityBase implements IEntity, IEntityStaticType {
263
+ [ENTITY_STATIC_TYPES]: TodoStaticTypes;
264
+ /**
265
+ * completed
266
+ */
267
+ completed: boolean;
268
+ /**
269
+ * title
270
+ */
271
+ title: string;
272
+ /**
273
+ * 初始化数据
274
+ * @param initData 初始化数据
275
+ */
276
+ constructor(initData?: TodoInitData);
277
+ /**
278
+ * count 查询
279
+ * @param options 查询选项
280
+ */
281
+ static count(options: CountOptions<typeof Todo,TodoRuleGroup>): Observable<number>;
282
+ /**
283
+ * find 查询
284
+ * @param options 查询选项
285
+ */
286
+ static find(options: FindOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo[]>;
287
+ /**
288
+ * findAll 查询
289
+ * @param options 查询选项
290
+ */
291
+ static findAll(options: FindAllOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo[]>;
292
+ /**
293
+ * findOne 查询
294
+ * @param options 查询选项
295
+ */
296
+ static findOne(options: FindOneOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo | undefined>;
297
+ /**
298
+ * findOneOrFail 查询
299
+ * @param options 查询选项
300
+ */
301
+ static findOneOrFail(options: FindOneOrFailOptions<typeof Todo,TodoRuleGroup,TodoOrderByField>): Observable<Todo>;
302
+ /**
303
+ * get 查询
304
+ * @param options 查询选项
305
+ */
306
+ static get(options: UUID): Observable<Todo>;
307
+ /**
308
+ * 删除
309
+ */
310
+ remove(): Promise<Todo>;
311
+ /**
312
+ * 重置数据
313
+ */
314
+ reset(): void;
315
+ /**
316
+ * 保存
317
+ */
318
+ save(): Promise<Todo>;
319
+ }
320
+
321
+ /**
322
+ * Menu
323
+ */
324
+ export declare class Menu extends TreeAdjacencyListEntityBase implements IEntityStaticType, ITreeEntity {
325
+ /**
326
+ * children
327
+ */
328
+ children$: RelationEntitiesObservable<Menu>;
329
+ /**
330
+ * parent
331
+ */
332
+ parent$: RelationEntityObservable<Menu | null>;
333
+ /**
334
+ * parent id
335
+ */
336
+ parentId?: UUID;
337
+ [ENTITY_STATIC_TYPES]: MenuStaticTypes;
338
+ /**
339
+ * title
340
+ */
341
+ title: string;
342
+ /**
343
+ * 初始化数据
344
+ * @param initData 初始化数据
345
+ */
346
+ constructor(initData?: MenuInitData);
347
+ /**
348
+ * count 查询
349
+ * @param options 查询选项
350
+ */
351
+ static count(options: CountOptions<typeof Menu,MenuRuleGroup>): Observable<number>;
352
+ /**
353
+ * 查询祖先实体数量
354
+ * @param options 查询选项
355
+ */
356
+ static countAncestors(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<number>;
357
+ /**
358
+ * 查询子孙实体数量
359
+ * @param options 查询选项
360
+ */
361
+ static countDescendants(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<number>;
362
+ /**
363
+ * 查询子孙实体数量
364
+ * @param options 查询选项
365
+ */
366
+ static countRoot(options?: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>): Observable<number>;
367
+ /**
368
+ * find 查询
369
+ * @param options 查询选项
370
+ */
371
+ static find(options: FindOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu[]>;
372
+ /**
373
+ * findAll 查询
374
+ * @param options 查询选项
375
+ */
376
+ static findAll(options: FindAllOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu[]>;
377
+ /**
378
+ * 查询祖先实体
379
+ * @param options 查询选项
380
+ */
381
+ static findAncestors(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<Menu[]>;
382
+ /**
383
+ * 查询子孙实体
384
+ * @param options 查询选项
385
+ */
386
+ static findDescendants(options?: FindTreeOptions<typeof Menu,MenuTreeRuleGroup>): Observable<Menu[]>;
387
+ /**
388
+ * findOne 查询
389
+ * @param options 查询选项
390
+ */
391
+ static findOne(options: FindOneOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu | undefined>;
392
+ /**
393
+ * findOneOrFail 查询
394
+ * @param options 查询选项
395
+ */
396
+ static findOneOrFail(options: FindOneOrFailOptions<typeof Menu,MenuRuleGroup,MenuOrderByField>): Observable<Menu>;
397
+ /**
398
+ * 查询子孙实体
399
+ * @param options 查询选项
400
+ */
401
+ static findRoot(options?: FindTreeRootOptions<typeof Menu,MenuTreeRuleGroup>): Observable<Menu[]>;
402
+ /**
403
+ * get 查询
404
+ * @param options 查询选项
405
+ */
406
+ static get(options: UUID): Observable<Menu>;
407
+ /**
408
+ * 删除
409
+ */
410
+ remove(): Promise<Menu>;
411
+ /**
412
+ * 重置数据
413
+ */
414
+ reset(): void;
415
+ /**
416
+ * 保存
417
+ */
418
+ save(): Promise<Menu>;
419
+ }
420
+
421
+ export declare const ENTITIES: EntityType[];
422
+
@@ -0,0 +1,2 @@
1
+ export declare const version = "0.0.1";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ const o = "0.0.1";
2
+ export {
3
+ o as version
4
+ };