@aiao/rxdb 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.
- package/dist/RxDB.d.ts +119 -18
- package/dist/RxDB.d.ts.map +1 -1
- package/dist/entity/@TreeEntity.d.ts.map +1 -1
- package/dist/entity/EntityBase.d.ts +58 -10
- package/dist/entity/EntityBase.d.ts.map +1 -1
- package/dist/entity/EntityManager.d.ts +16 -5
- package/dist/entity/EntityManager.d.ts.map +1 -1
- package/dist/entity/EntityStatus.d.ts +145 -87
- package/dist/entity/EntityStatus.d.ts.map +1 -1
- package/dist/entity/EntityStatus.interface.d.ts +59 -0
- package/dist/entity/EntityStatus.interface.d.ts.map +1 -0
- package/dist/entity/TreeEntityBase.d.ts +31 -4
- package/dist/entity/TreeEntityBase.d.ts.map +1 -1
- package/dist/entity/entity.interface.d.ts +16 -15
- package/dist/entity/entity.interface.d.ts.map +1 -1
- package/dist/entity/entity.utils.d.ts +21 -0
- package/dist/entity/entity.utils.d.ts.map +1 -1
- package/dist/entity/many_to_many_entity.d.ts.map +1 -1
- package/dist/entity/metadata-options.interface.d.ts +276 -39
- package/dist/entity/metadata-options.interface.d.ts.map +1 -1
- package/dist/entity/{transition-metadata.d.ts → metadata-transition.d.ts} +1 -1
- package/dist/entity/metadata-transition.d.ts.map +1 -0
- package/dist/entity/metadata.interface.d.ts +6 -0
- package/dist/entity/metadata.interface.d.ts.map +1 -1
- package/dist/entity/metadata_cascade_default.d.ts +54 -0
- package/dist/entity/metadata_cascade_default.d.ts.map +1 -0
- package/dist/entity/proxy.d.ts.map +1 -1
- package/dist/entity/relation_helper.d.ts.map +1 -1
- package/dist/entity/tree-entity.interface.d.ts +5 -0
- package/dist/entity/tree-entity.interface.d.ts.map +1 -0
- package/dist/gateway/RxDBTabsGateway.d.ts +52 -0
- package/dist/gateway/RxDBTabsGateway.d.ts.map +1 -0
- package/dist/gateway/gateway.interface.d.ts +43 -0
- package/dist/gateway/gateway.interface.d.ts.map +1 -0
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5791 -1896
- package/dist/query/entity_type_dependencies.d.ts +3 -2
- package/dist/query/entity_type_dependencies.d.ts.map +1 -1
- package/dist/query/merge-update-basic.d.ts +30 -0
- package/dist/query/merge-update-basic.d.ts.map +1 -0
- package/dist/query/merge-update-tree.d.ts +86 -0
- package/dist/query/merge-update-tree.d.ts.map +1 -0
- package/dist/query/merge-update.utils.d.ts +52 -0
- package/dist/query/merge-update.utils.d.ts.map +1 -0
- package/dist/query/merge_create.d.ts +2 -2
- package/dist/query/merge_create.d.ts.map +1 -1
- package/dist/query/merge_remove.d.ts +2 -15
- package/dist/query/merge_remove.d.ts.map +1 -1
- package/dist/query/merge_update.d.ts +2 -2
- package/dist/query/merge_update.d.ts.map +1 -1
- package/dist/query/need_refresh_create.d.ts +4 -4
- package/dist/query/need_refresh_create.d.ts.map +1 -1
- package/dist/query/need_refresh_remove.d.ts +2 -2
- package/dist/query/need_refresh_remove.d.ts.map +1 -1
- package/dist/query/need_refresh_update.d.ts +4 -4
- package/dist/query/need_refresh_update.d.ts.map +1 -1
- package/dist/query/query-matching.utils.d.ts +18 -2
- package/dist/query/query-matching.utils.d.ts.map +1 -1
- package/dist/query/query-relation.utils.d.ts +44 -0
- package/dist/query/query-relation.utils.d.ts.map +1 -0
- package/dist/query/query-rules-builder.d.ts +68 -0
- package/dist/query/query-rules-builder.d.ts.map +1 -0
- package/dist/query/query-tree.utils.d.ts +54 -0
- package/dist/query/query-tree.utils.d.ts.map +1 -0
- package/dist/repository/QueryManager.d.ts +23 -1
- package/dist/repository/QueryManager.d.ts.map +1 -1
- package/dist/repository/QueryTask.d.ts +42 -5
- package/dist/repository/QueryTask.d.ts.map +1 -1
- package/dist/repository/Repository.d.ts +24 -35
- package/dist/repository/Repository.d.ts.map +1 -1
- package/dist/repository/RepositoryBase.d.ts +5 -3
- package/dist/repository/RepositoryBase.d.ts.map +1 -1
- package/dist/repository/TreeRepository.d.ts +28 -1
- package/dist/repository/TreeRepository.d.ts.map +1 -1
- package/dist/repository/fingerprint.utils.d.ts +28 -0
- package/dist/repository/fingerprint.utils.d.ts.map +1 -0
- package/dist/repository/query-options.interface.d.ts +50 -19
- package/dist/repository/query-options.interface.d.ts.map +1 -1
- package/dist/repository/query.interface.d.ts +70 -25
- package/dist/repository/query.interface.d.ts.map +1 -1
- package/dist/repository/relation-query.interface.d.ts +19 -0
- package/dist/repository/relation-query.interface.d.ts.map +1 -1
- package/dist/repository/repository.interface.d.ts +5 -8
- package/dist/repository/repository.interface.d.ts.map +1 -1
- package/dist/repository/tree-repository.interface.d.ts +29 -2
- package/dist/repository/tree-repository.interface.d.ts.map +1 -1
- package/dist/rxdb-adapter.d.ts +96 -14
- package/dist/rxdb-adapter.d.ts.map +1 -1
- package/dist/rxdb-events.d.ts +316 -172
- package/dist/rxdb-events.d.ts.map +1 -1
- package/dist/rxdb-plugin.d.ts +2 -2
- package/dist/rxdb-plugin.d.ts.map +1 -1
- package/dist/rxdb-utils.d.ts +15 -8
- package/dist/rxdb-utils.d.ts.map +1 -1
- package/dist/rxdb.interface.d.ts +4 -0
- package/dist/rxdb.interface.d.ts.map +1 -1
- package/dist/rxdb.private.d.ts +5 -0
- package/dist/rxdb.private.d.ts.map +1 -1
- package/dist/schema/SchemaManager.d.ts +1 -0
- package/dist/schema/SchemaManager.d.ts.map +1 -1
- package/dist/system/branch.d.ts +124 -7
- package/dist/system/branch.d.ts.map +1 -1
- package/dist/system/change.d.ts +605 -30
- package/dist/system/change.d.ts.map +1 -1
- package/dist/system/migration.d.ts +61 -11
- package/dist/system/migration.d.ts.map +1 -1
- package/dist/system/repository-sync.d.ts +95 -0
- package/dist/system/repository-sync.d.ts.map +1 -0
- package/dist/system/system.interface.d.ts +25 -0
- package/dist/system/system.interface.d.ts.map +1 -0
- package/dist/system/types.d.ts +233 -120
- package/dist/system/types.d.ts.map +1 -1
- package/dist/system/types.local.d.ts +156 -0
- package/dist/system/types.local.d.ts.map +1 -0
- package/dist/system/types.remote.d.ts +103 -0
- package/dist/system/types.remote.d.ts.map +1 -0
- package/dist/version/HistoryManager.d.ts +238 -0
- package/dist/version/HistoryManager.d.ts.map +1 -0
- package/dist/version/LWWConflictResolver.d.ts +41 -0
- package/dist/version/LWWConflictResolver.d.ts.map +1 -0
- package/dist/version/VersionManager.d.ts +407 -0
- package/dist/version/VersionManager.d.ts.map +1 -0
- package/dist/version/VersionManager.interface.d.ts +428 -0
- package/dist/version/VersionManager.interface.d.ts.map +1 -0
- package/dist/version/VersionManager.utils.d.ts +14 -0
- package/dist/version/VersionManager.utils.d.ts.map +1 -0
- package/dist/version/bulk-sync.d.ts +97 -0
- package/dist/version/bulk-sync.d.ts.map +1 -0
- package/dist/version/check-repository-updates.d.ts +53 -0
- package/dist/version/check-repository-updates.d.ts.map +1 -0
- package/dist/version/compact-changes.d.ts +45 -0
- package/dist/version/compact-changes.d.ts.map +1 -0
- package/dist/version/conflict.d.ts +75 -0
- package/dist/version/conflict.d.ts.map +1 -0
- package/dist/version/create_branch.d.ts +13 -0
- package/dist/version/create_branch.d.ts.map +1 -0
- package/dist/version/dependency-graph.d.ts +132 -0
- package/dist/version/dependency-graph.d.ts.map +1 -0
- package/dist/version/find_switch_branch_step.d.ts +53 -0
- package/dist/version/find_switch_branch_step.d.ts.map +1 -0
- package/dist/version/get-all-repository-sync-status.d.ts +58 -0
- package/dist/version/get-all-repository-sync-status.d.ts.map +1 -0
- package/dist/version/get-repository-sync-status.d.ts +74 -0
- package/dist/version/get-repository-sync-status.d.ts.map +1 -0
- package/dist/version/pull-repository.d.ts +99 -0
- package/dist/version/pull-repository.d.ts.map +1 -0
- package/dist/version/pull.d.ts +11 -0
- package/dist/version/pull.d.ts.map +1 -0
- package/dist/version/push-repository.d.ts +93 -0
- package/dist/version/push-repository.d.ts.map +1 -0
- package/dist/version/push.d.ts +11 -0
- package/dist/version/push.d.ts.map +1 -0
- package/dist/version/remove_branch.d.ts +8 -0
- package/dist/version/remove_branch.d.ts.map +1 -0
- package/dist/version/switch_branch_actions.d.ts +17 -0
- package/dist/version/switch_branch_actions.d.ts.map +1 -0
- package/dist/version/sync-repository.d.ts +57 -0
- package/dist/version/sync-repository.d.ts.map +1 -0
- package/dist/version/sync-type-utils.d.ts +145 -0
- package/dist/version/sync-type-utils.d.ts.map +1 -0
- package/dist/version/topological-sort.d.ts +70 -0
- package/dist/version/topological-sort.d.ts.map +1 -0
- package/dist/version/version.utils.d.ts +4 -0
- package/dist/version/version.utils.d.ts.map +1 -0
- package/package.json +4 -4
- package/README.md +0 -1
- package/dist/entity/@GraphEntity.d.ts +0 -8
- package/dist/entity/@GraphEntity.d.ts.map +0 -1
- package/dist/entity/GraphEntityBase.d.ts +0 -10
- package/dist/entity/GraphEntityBase.d.ts.map +0 -1
- package/dist/entity/graph_edge_entity.d.ts +0 -5
- package/dist/entity/graph_edge_entity.d.ts.map +0 -1
- package/dist/entity/transition-metadata.d.ts.map +0 -1
- package/dist/system/VersionManager.d.ts +0 -35
- package/dist/system/VersionManager.d.ts.map +0 -1
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
import { Observable, Observer } from 'rxjs';
|
|
2
2
|
import { EntityStaticType, EntityType } from '../entity/entity.interface.js';
|
|
3
|
-
import {
|
|
3
|
+
import { RxDBEntityLocalEventData } from '../rxdb-events.js';
|
|
4
4
|
import { RxDB } from '../RxDB.js';
|
|
5
5
|
import { QueryOptions } from './QueryManager.interface.js';
|
|
6
|
+
/**
|
|
7
|
+
* 查询任务选项接口
|
|
8
|
+
*/
|
|
6
9
|
export interface QueryTaskOptions<T extends EntityType> {
|
|
10
|
+
/**
|
|
11
|
+
* 缓存键
|
|
12
|
+
*/
|
|
7
13
|
cacheKey: string;
|
|
14
|
+
/**
|
|
15
|
+
* 查询选项
|
|
16
|
+
*/
|
|
8
17
|
options: QueryOptions<T>;
|
|
18
|
+
/**
|
|
19
|
+
* 查询执行函数
|
|
20
|
+
*/
|
|
9
21
|
runner: () => Observable<any>;
|
|
22
|
+
/**
|
|
23
|
+
* 实体类型
|
|
24
|
+
*/
|
|
10
25
|
entityType: T;
|
|
26
|
+
/**
|
|
27
|
+
* RxDB 实例
|
|
28
|
+
*/
|
|
11
29
|
rxdb: RxDB;
|
|
30
|
+
/**
|
|
31
|
+
* 依赖的实体类型映射
|
|
32
|
+
*/
|
|
12
33
|
depEntityTypeMap: Map<T, number>;
|
|
13
|
-
|
|
34
|
+
/**
|
|
35
|
+
* 序列化函数
|
|
36
|
+
*/
|
|
37
|
+
serialize: (data: RxDBEntityLocalEventData<T>) => InstanceType<T>;
|
|
38
|
+
/**
|
|
39
|
+
* 清理函数
|
|
40
|
+
*/
|
|
14
41
|
onClean: (cacheKey: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* 结果指纹计算方法
|
|
44
|
+
*/
|
|
45
|
+
getFingerprint: (result: any) => any[];
|
|
15
46
|
}
|
|
16
47
|
/**
|
|
17
48
|
* 查询任务实现
|
|
@@ -31,7 +62,7 @@ export declare class QueryTask<T extends EntityType, RT = any> {
|
|
|
31
62
|
* 存储所有订阅此查询结果的观察者
|
|
32
63
|
*/
|
|
33
64
|
readonly observers: Set<Observer<any>>;
|
|
34
|
-
readonly serialize: (data:
|
|
65
|
+
readonly serialize: (data: RxDBEntityLocalEventData<T>) => InstanceType<T>;
|
|
35
66
|
readonly cacheKey: string;
|
|
36
67
|
readonly entityType: T;
|
|
37
68
|
readonly rxdb: RxDB;
|
|
@@ -63,7 +94,7 @@ export declare class QueryTask<T extends EntityType, RT = any> {
|
|
|
63
94
|
/**
|
|
64
95
|
* 查询类型
|
|
65
96
|
*/
|
|
66
|
-
readonly type: 'get' | 'findOne' | 'findOneOrFail' | 'find' | 'findAll' | 'findByCursor' | 'count' | 'findDescendants' | 'findAncestors' | 'countDescendants' | 'countAncestors';
|
|
97
|
+
readonly type: 'get' | 'findOne' | 'findOneOrFail' | 'find' | 'findAll' | 'findByCursor' | 'count' | 'findDescendants' | 'findAncestors' | 'countDescendants' | 'countAncestors' | 'findNeighbors' | 'countNeighbors' | 'findPaths';
|
|
67
98
|
/**
|
|
68
99
|
* 查询选项
|
|
69
100
|
*/
|
|
@@ -83,6 +114,10 @@ export declare class QueryTask<T extends EntityType, RT = any> {
|
|
|
83
114
|
* 缓存的最新查询结果数据
|
|
84
115
|
*/
|
|
85
116
|
result?: RT;
|
|
117
|
+
/**
|
|
118
|
+
* 结果指纹计算方法
|
|
119
|
+
*/
|
|
120
|
+
getFingerprint: (result: any) => (string | number)[];
|
|
86
121
|
/**
|
|
87
122
|
* 查询结果流
|
|
88
123
|
* 通过 Observable 发送查询结果的响应式流
|
|
@@ -98,7 +133,9 @@ export declare class QueryTask<T extends EntityType, RT = any> {
|
|
|
98
133
|
*/
|
|
99
134
|
run: () => void;
|
|
100
135
|
/**
|
|
101
|
-
*
|
|
136
|
+
* 发送结果给所有观察者
|
|
137
|
+
* @param result 查询结果
|
|
138
|
+
* @param autoCache 是否自动缓存结果实体
|
|
102
139
|
*/
|
|
103
140
|
next: (result: any, autoCache?: boolean) => void;
|
|
104
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTask.d.ts","sourceRoot":"","sources":["../../src/repository/QueryTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,QAAQ,EAKT,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"QueryTask.d.ts","sourceRoot":"","sources":["../../src/repository/QueryTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,QAAQ,EAKT,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,m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B;CACH"}
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
2
|
import { EntityStaticType, EntityType } from '../entity/entity.interface.js';
|
|
3
3
|
import { SyncOptions } from '../entity/metadata-options.interface.js';
|
|
4
|
-
import { IRxDBAdapter, RxDBAdapterLocalBase, RxDBAdapterRemoteBase } from '../rxdb-adapter.js';
|
|
5
4
|
import { RxDB } from '../RxDB.js';
|
|
6
5
|
import { CountOptions, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions } from './query-options.interface.js';
|
|
7
6
|
import { QueryManager } from './QueryManager.js';
|
|
8
7
|
import { IRepository } from './repository.interface.js';
|
|
8
|
+
import { RepositoryBase } from './RepositoryBase.js';
|
|
9
9
|
/**
|
|
10
10
|
* 实体仓库
|
|
11
11
|
* 根据配置决策实体的具体操作
|
|
12
12
|
*/
|
|
13
|
-
export declare class Repository<T extends EntityType, RT extends IRepository<T> = IRepository<T>> {
|
|
14
|
-
protected
|
|
15
|
-
protected readonly EntityType: T;
|
|
16
|
-
/**
|
|
17
|
-
* 本地适配器
|
|
18
|
-
*/
|
|
19
|
-
protected readonly localAdapterSub: BehaviorSubject<string>;
|
|
20
|
-
protected readonly localAdapter$: Observable<IRxDBAdapter & RxDBAdapterLocalBase>;
|
|
13
|
+
export declare class Repository<T extends EntityType, RT extends IRepository<T> = IRepository<T>> extends RepositoryBase<T> {
|
|
14
|
+
protected static _STATIC_METHODS: string[];
|
|
21
15
|
/**
|
|
22
16
|
* 本地仓库
|
|
23
17
|
*/
|
|
24
18
|
protected readonly local$: Observable<RT>;
|
|
25
19
|
/**
|
|
26
|
-
*
|
|
20
|
+
* 远程仓库
|
|
27
21
|
*/
|
|
28
|
-
protected readonly
|
|
29
|
-
protected readonly remoteAdapter$: Observable<IRxDBAdapter & RxDBAdapterRemoteBase>;
|
|
22
|
+
protected readonly remote$: Observable<IRepository<T>>;
|
|
30
23
|
/**
|
|
31
|
-
*
|
|
24
|
+
* 主仓库(根据 SyncOptions 选择 local 或 remote)
|
|
25
|
+
* - SyncType.None + 只有 remote:使用 remote$
|
|
26
|
+
* - 其他情况:使用 local$
|
|
32
27
|
*/
|
|
33
|
-
protected readonly
|
|
28
|
+
protected readonly primary$: Observable<RT>;
|
|
34
29
|
/**
|
|
35
30
|
* 查询缓存管理器
|
|
36
31
|
*/
|
|
@@ -42,66 +37,60 @@ export declare class Repository<T extends EntityType, RT extends IRepository<T>
|
|
|
42
37
|
constructor(rxdb: RxDB, EntityType: T);
|
|
43
38
|
/**
|
|
44
39
|
* 根据 id 获取实体
|
|
45
|
-
* @param id
|
|
46
|
-
* @param options
|
|
40
|
+
* @param id 实体的唯一标识符
|
|
47
41
|
*/
|
|
48
42
|
get(id: EntityStaticType<T, 'idType'>): Observable<InstanceType<T>>;
|
|
49
43
|
/**
|
|
50
44
|
* 查找一个实体
|
|
51
|
-
* @param where
|
|
52
|
-
* @param options
|
|
45
|
+
* @param options 查询选项,包含 where 条件
|
|
53
46
|
*/
|
|
54
47
|
findOne(options: FindOneOptions<T>): Observable<InstanceType<T> | null>;
|
|
55
48
|
/**
|
|
56
49
|
* 查找一个实体,查不到就抛出错误
|
|
57
|
-
* @param where
|
|
58
|
-
* @param options
|
|
50
|
+
* @param options 查询选项,包含 where 条件
|
|
59
51
|
*/
|
|
60
52
|
findOneOrFail(options: FindOneOrFailOptions<T>): Observable<InstanceType<T>>;
|
|
61
53
|
/**
|
|
62
54
|
* 查询多个实体
|
|
63
|
-
* @param where
|
|
64
|
-
* @param options
|
|
55
|
+
* @param options 查询选项,包含 where 条件、limit、offset 等
|
|
65
56
|
*/
|
|
66
57
|
find(options: FindOptions<T>): Observable<InstanceType<T>[]>;
|
|
67
58
|
/**
|
|
68
59
|
* 查询所有实体
|
|
69
|
-
* @param where
|
|
70
|
-
|
|
60
|
+
* @param options 查询选项,包含 where 条件和排序(不限制数量)
|
|
61
|
+
|
|
71
62
|
*/
|
|
72
63
|
findAll(options: FindAllOptions<T>): Observable<InstanceType<T>[]>;
|
|
73
64
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @param
|
|
76
|
-
* @param options
|
|
65
|
+
* 通过游标进行分页查询
|
|
66
|
+
* @param options 游标分页选项,包含 orderBy、before/after 游标
|
|
77
67
|
*/
|
|
78
68
|
findByCursor(options: FindByCursorOptions<T>): Observable<InstanceType<T>[]>;
|
|
79
69
|
/**
|
|
80
70
|
* 查询实体数量
|
|
81
|
-
* @param where
|
|
82
|
-
* @param options
|
|
71
|
+
* @param options 查询选项,包含 where 条件
|
|
83
72
|
*/
|
|
84
73
|
count(options: CountOptions<T>): Observable<number>;
|
|
85
74
|
/**
|
|
86
75
|
* 创建实体
|
|
87
|
-
* @param entity
|
|
76
|
+
* @param entity 要创建的实体实例
|
|
88
77
|
*/
|
|
89
78
|
create(entity: InstanceType<T>): Promise<InstanceType<T>>;
|
|
90
79
|
/**
|
|
91
80
|
* 更新实体
|
|
92
|
-
* @param entity
|
|
93
|
-
* @param patch
|
|
81
|
+
* @param entity 要更新的实体实例
|
|
82
|
+
* @param patch 部分更新数据
|
|
94
83
|
*/
|
|
95
84
|
update(entity: InstanceType<T>, patch: Partial<InstanceType<T>>): Promise<InstanceType<T>>;
|
|
96
85
|
/**
|
|
97
86
|
* 删除实体
|
|
98
|
-
* @param entity
|
|
87
|
+
* @param entity 要删除的实体实例
|
|
99
88
|
*/
|
|
100
89
|
remove(entity: InstanceType<T>): Promise<InstanceType<T>>;
|
|
101
90
|
/**
|
|
102
91
|
* 设置状态 local
|
|
103
92
|
*/
|
|
104
|
-
protected _setLocal: (entity: InstanceType<T>) =>
|
|
93
|
+
protected _setLocal: (entity: InstanceType<T>) => void;
|
|
105
94
|
protected _setLocals: (entities: InstanceType<T>[]) => void;
|
|
106
95
|
}
|
|
107
96
|
//# sourceMappingURL=Repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.d.ts","sourceRoot":"","sources":["../../src/repository/Repository.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Repository.d.ts","sourceRoot":"","sources":["../../src/repository/Repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAA+B,MAAM,MAAM,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACjH,iBAA0B,eAAe,WASvC;IAEF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAE3C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAExD;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAE7C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAG,WAAW,CAAC;gBAE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,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAKzD;;OAEG;IACH,SAAS,CAAC,SAAS,GAAI,QAAQ,YAAY,CAAC,CAAC,CAAC,UAI5C;IACF,SAAS,CAAC,UAAU,GAAI,UAAU,YAAY,CAAC,CAAC,CAAC,EAAE,UAAsC;CAC1F"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { EntityStaticType, EntityType, EntityUpdateData } from '../entity/entity.interface.js';
|
|
1
|
+
import { EntityStaticType, EntityType, EntityUpdateData, IEntity } from '../entity/entity.interface.js';
|
|
2
2
|
import { RxDB } from '../RxDB.js';
|
|
3
3
|
/**
|
|
4
4
|
* 数据仓库
|
|
5
5
|
* 用来协调数据存取
|
|
6
6
|
*/
|
|
7
|
-
export declare abstract class RepositoryBase<T extends EntityType> {
|
|
7
|
+
export declare abstract class RepositoryBase<T extends EntityType & (new (...args: any[]) => IEntity)> {
|
|
8
8
|
protected readonly rxdb: RxDB;
|
|
9
9
|
readonly EntityType: T;
|
|
10
|
+
protected static _STATIC_METHODS: string[];
|
|
11
|
+
static get staticMethods(): string[];
|
|
10
12
|
constructor(rxdb: RxDB, EntityType: T);
|
|
11
13
|
/**
|
|
12
14
|
* 获取实体实例
|
|
@@ -26,6 +28,6 @@ export declare abstract class RepositoryBase<T extends EntityType> {
|
|
|
26
28
|
/**
|
|
27
29
|
* 更新实体
|
|
28
30
|
*/
|
|
29
|
-
updateEntity(entity: InstanceType<T>, update:
|
|
31
|
+
updateEntity(entity: InstanceType<T>, update: InstanceType<T>): void;
|
|
30
32
|
}
|
|
31
33
|
//# sourceMappingURL=RepositoryBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepositoryBase.d.ts","sourceRoot":"","sources":["../../src/repository/RepositoryBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"RepositoryBase.d.ts","sourceRoot":"","sources":["../../src/repository/RepositoryBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;GAGG;AACH,8BAAsB,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;IAQzF,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI;aACb,UAAU,EAAE,CAAC;IAR/B,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,CAAM;IAEhD,MAAM,KAAK,aAAa,aAEvB;gBAGoB,IAAI,EAAE,IAAI,EACb,UAAU,EAAE,CAAC;IAG/B;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAIzC;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAI5E;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,OAAO;IAIxD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CAK9D"}
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { EntityType } from '../entity/entity.interface.js';
|
|
3
|
+
import { ITreeEntity } from '../entity/tree-entity.interface.js';
|
|
3
4
|
import { Repository } from './Repository.js';
|
|
4
5
|
import { FindTreeOptions, ITreeRepository } from './tree-repository.interface.js';
|
|
5
6
|
/**
|
|
6
7
|
* 树结构实体仓库
|
|
7
8
|
* 根据配置决策实体的具体操作
|
|
9
|
+
*
|
|
10
|
+
* @template T - 必须是实现 ITreeEntity 接口的实体类型(通常继承 TreeAdjacencyListEntityBase)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // ✅ 正确:继承 TreeAdjacencyListEntityBase
|
|
15
|
+
* @Entity({ name: 'Category' })
|
|
16
|
+
* class Category extends TreeAdjacencyListEntityBase {
|
|
17
|
+
* name!: string;
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // 可以使用树查询方法
|
|
21
|
+
* Category.findDescendants({ entityId: 'root-id' });
|
|
22
|
+
* Category.findAncestors({ entityId: 'leaf-id' });
|
|
23
|
+
*
|
|
24
|
+
* // ❌ 错误:只继承 EntityBase,没有实现 ITreeEntity
|
|
25
|
+
* @Entity({ name: 'User' })
|
|
26
|
+
* class User extends EntityBase {
|
|
27
|
+
* name!: string;
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* // 编译错误:User 不满足 TreeRepository 的类型约束
|
|
31
|
+
* // User.findDescendants({ entityId: 'id' }); // TypeScript 错误
|
|
32
|
+
* ```
|
|
8
33
|
*/
|
|
9
|
-
export declare class TreeRepository<T extends EntityType, RepositoryType extends ITreeRepository<T> = ITreeRepository<T>> extends Repository<T, RepositoryType> {
|
|
34
|
+
export declare class TreeRepository<T extends EntityType & (new (...args: any[]) => ITreeEntity), RepositoryType extends ITreeRepository<T> = ITreeRepository<T>> extends Repository<T, RepositoryType> {
|
|
35
|
+
#private;
|
|
36
|
+
protected static _STATIC_METHODS: string[];
|
|
10
37
|
/**
|
|
11
38
|
* 查询子孙
|
|
12
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRepository.d.ts","sourceRoot":"","sources":["../../src/repository/TreeRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAA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AAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC;CAwBhE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EntityType } from '../entity/entity.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* 指纹类型
|
|
4
|
+
*/
|
|
5
|
+
export type Fingerprint = string | number | boolean | null | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* 值类型指纹计算
|
|
8
|
+
* 用于 count 等返回原始值的查询
|
|
9
|
+
*
|
|
10
|
+
* @param value - 要计算指纹的值
|
|
11
|
+
* @returns 指纹数组
|
|
12
|
+
*/
|
|
13
|
+
export declare const getFingerprintPrimitive: <T extends Fingerprint>(value: T | T[]) => Fingerprint[];
|
|
14
|
+
/**
|
|
15
|
+
* 单个实体指纹计算
|
|
16
|
+
*
|
|
17
|
+
* @param entity - 要计算指纹的实体
|
|
18
|
+
* @returns 指纹数组
|
|
19
|
+
*/
|
|
20
|
+
export declare const getFingerprintByEntity: <T extends EntityType>(entity: InstanceType<T> | null | undefined) => Fingerprint[];
|
|
21
|
+
/**
|
|
22
|
+
* 多个实体指纹计算
|
|
23
|
+
*
|
|
24
|
+
* @param entities - 要计算指纹的实体数组
|
|
25
|
+
* @returns 指纹数组
|
|
26
|
+
*/
|
|
27
|
+
export declare const getFingerprintByEntities: <T extends EntityType>(entities: InstanceType<T>[]) => Fingerprint[];
|
|
28
|
+
//# sourceMappingURL=fingerprint.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.utils.d.ts","sourceRoot":"","sources":["../../src/repository/fingerprint.utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,KAAG,WAAW,EACnD,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,UAAU,EACzD,QAAQ,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,KACzC,WAAW,EAIb,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,UAAU,EAAE,UAAU,YAAY,CAAC,CAAC,CAAC,EAAE,KAAG,WAAW,EAIpG,CAAC"}
|
|
@@ -3,11 +3,11 @@ import { RuleGroup } from './query.interface.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* 排序
|
|
5
5
|
*/
|
|
6
|
-
export interface OrderBy<
|
|
6
|
+
export interface OrderBy<T extends string = string> {
|
|
7
7
|
/**
|
|
8
8
|
* 排序字段
|
|
9
9
|
*/
|
|
10
|
-
field:
|
|
10
|
+
field: T;
|
|
11
11
|
/**
|
|
12
12
|
* 排序方式
|
|
13
13
|
*/
|
|
@@ -16,23 +16,23 @@ export interface OrderBy<FieldType extends string = string> {
|
|
|
16
16
|
/**
|
|
17
17
|
* FindOne 查询选项
|
|
18
18
|
*/
|
|
19
|
-
export interface FindOneOptions<T extends EntityType = any,
|
|
20
|
-
where:
|
|
21
|
-
orderBy?: OrderBy<
|
|
19
|
+
export interface FindOneOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>, W extends string = string> {
|
|
20
|
+
where: U;
|
|
21
|
+
orderBy?: OrderBy<W>[];
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* FindOneOrFail 查询选项
|
|
25
25
|
*/
|
|
26
|
-
export interface FindOneOrFailOptions<T extends EntityType = any,
|
|
27
|
-
where:
|
|
28
|
-
orderBy?: OrderBy<
|
|
26
|
+
export interface FindOneOrFailOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>, W extends string = string> {
|
|
27
|
+
where: U;
|
|
28
|
+
orderBy?: OrderBy<W>[];
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Find 查询选项
|
|
32
32
|
*/
|
|
33
|
-
export interface FindOptions<T extends EntityType = any,
|
|
34
|
-
where:
|
|
35
|
-
orderBy?: OrderBy<
|
|
33
|
+
export interface FindOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>, W extends string = string> {
|
|
34
|
+
where: U;
|
|
35
|
+
orderBy?: OrderBy<W>[];
|
|
36
36
|
/**
|
|
37
37
|
* 获取数据量
|
|
38
38
|
* @default 100
|
|
@@ -47,13 +47,20 @@ export interface FindOptions<T extends EntityType = any, WhereType = RuleGroup<I
|
|
|
47
47
|
/**
|
|
48
48
|
* FindByCursor 查询选项
|
|
49
49
|
*/
|
|
50
|
-
export interface FindByCursorOptions<T extends EntityType = any,
|
|
51
|
-
where:
|
|
50
|
+
export interface FindByCursorOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>, W extends string = string> {
|
|
51
|
+
where: U;
|
|
52
52
|
/**
|
|
53
53
|
* 排序条件
|
|
54
54
|
* 指针查询的时候必须包含唯一值的排序例如: id 作为最后一个排序参数,不然无法定位指针
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* orderBy: [
|
|
58
|
+
* { field: 'createdAt', sort: 'DESC' },
|
|
59
|
+
* { field: 'id', sort: 'ASC' } // 必须包含唯一值排序
|
|
60
|
+
* ]
|
|
61
|
+
* ```
|
|
55
62
|
*/
|
|
56
|
-
orderBy: OrderBy<
|
|
63
|
+
orderBy: OrderBy<W>[];
|
|
57
64
|
/**
|
|
58
65
|
* 获取这个实体之前的实体
|
|
59
66
|
*/
|
|
@@ -74,15 +81,39 @@ export interface FindByCursorOptions<T extends EntityType = any, WhereType exten
|
|
|
74
81
|
/**
|
|
75
82
|
* FindAll 查询选项
|
|
76
83
|
*/
|
|
77
|
-
export interface FindAllOptions<T extends EntityType = any,
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
export interface FindAllOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>, W extends string = string> {
|
|
85
|
+
/**
|
|
86
|
+
* 查询条件
|
|
87
|
+
* 用于过滤查询结果
|
|
88
|
+
* 支持组合查询
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* where: {
|
|
92
|
+
* combinator: 'and',
|
|
93
|
+
* rules: [
|
|
94
|
+
* { field: 'status', operator: '=', value: 'active' },
|
|
95
|
+
* { field: 'createdAt', operator: '>=', value: '2023-01-01' }
|
|
96
|
+
* ]
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
where: U;
|
|
101
|
+
/**
|
|
102
|
+
* 排序条件
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* orderBy: [
|
|
106
|
+
* { field: 'createdAt', sort: 'desc' },
|
|
107
|
+
* { field: 'id', sort: 'asc' } // 必须包含唯一值排序
|
|
108
|
+
* ]
|
|
109
|
+
*/
|
|
110
|
+
orderBy?: OrderBy<W>[];
|
|
80
111
|
}
|
|
81
112
|
/**
|
|
82
113
|
* Count 查询选项
|
|
83
114
|
*/
|
|
84
|
-
export interface CountOptions<T extends EntityType = any,
|
|
85
|
-
where:
|
|
115
|
+
export interface CountOptions<T extends EntityType = any, U = RuleGroup<InstanceType<T>>> {
|
|
116
|
+
where: U;
|
|
86
117
|
groupBy?: string[];
|
|
87
118
|
}
|
|
88
119
|
//# sourceMappingURL=query-options.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-options.interface.d.ts","sourceRoot":"","sources":["../../src/repository/query-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"query-options.interface.d.ts","sourceRoot":"","sources":["../../src/repository/query-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAChD;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IACnH,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CACnC,CAAC,SAAS,UAAU,GAAG,GAAG,EAC1B,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAC9B,CAAC,SAAS,MAAM,GAAG,MAAM;IAEzB,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IAChH,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAA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