@aiao/rxdb 0.0.1 → 0.0.3
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/RxDBError.d.ts +0 -8
- package/entity/@TreeEntity.d.ts +1 -26
- package/entity/EntityBase.d.ts +2 -0
- package/entity/TreeEntityBase.d.ts +2 -0
- package/entity/entity-metadata-options.interface.d.ts +30 -10
- package/entity/transition-metadata.d.ts +2 -2
- package/index.d.ts +7 -0
- package/index.js +354 -348
- package/package.json +2 -2
- package/repository/query.interface.d.ts +0 -5
- package/repository/relation-query.interface.d.ts +62 -0
- package/rxdb-utils.d.ts +1 -1
- package/rxdb.interface.d.ts +4 -1
- package/rxdb.private.d.ts +25 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiao/rxdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"uuid": "^11.1.0",
|
|
8
8
|
"type-fest": "^4.41.0",
|
|
9
|
-
"@aiao/utils": "0.0.
|
|
9
|
+
"@aiao/utils": "0.0.3",
|
|
10
10
|
"rxjs": "~7.8.0"
|
|
11
11
|
},
|
|
12
12
|
".": {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SetNonNullable } from 'type-fest';
|
|
2
|
-
import { UUID } from '../entity/entity.interface';
|
|
3
2
|
/**
|
|
4
3
|
* 判断相等
|
|
5
4
|
*/
|
|
@@ -60,10 +59,6 @@ export type BooleanRules<T, K extends keyof T = keyof T, VT = T[K]> = RuleEqualN
|
|
|
60
59
|
* Date
|
|
61
60
|
*/
|
|
62
61
|
export type DateRules<T, K extends keyof T = keyof T, VT = T[K]> = RuleEqualNullable<T, K, VT> | RuleNumberNonNullable<T, K, VT> | RuleIn<T, K, VT> | RuleBetween<T, K, VT>;
|
|
63
|
-
export type OneToOneRules<T, K extends keyof T = keyof T> = RuleEqualNullable<T, K, UUID> | RuleIn<T, K, UUID>;
|
|
64
|
-
export type ManyToOneRules<T, K extends keyof T = keyof T> = RuleEqualNullable<T, K, UUID> | RuleIn<T, K, UUID>;
|
|
65
|
-
export type OneToManyRules<T, K extends keyof T = keyof T> = RuleIn<T, K, UUID>;
|
|
66
|
-
export type ManyToManyRules<T, K extends keyof T = keyof T> = RuleIn<T, K, UUID>;
|
|
67
62
|
/**
|
|
68
63
|
* 查询规则
|
|
69
64
|
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SetNonNullable } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* 判断相等
|
|
4
|
+
*/
|
|
5
|
+
interface RuleEqualNullable<K, VT> {
|
|
6
|
+
field: K;
|
|
7
|
+
operator: '=' | '!=';
|
|
8
|
+
value: VT;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 字符串比较
|
|
12
|
+
*/
|
|
13
|
+
interface RuleStringNonNullable<K, VT> {
|
|
14
|
+
field: K;
|
|
15
|
+
operator: '<' | '>' | '<=' | '>=' | 'contains' | 'notContain' | 'beginWith' | 'notBeginWith' | 'endWith' | 'notEndWith';
|
|
16
|
+
value: SetNonNullable<VT>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 数值比较
|
|
20
|
+
*/
|
|
21
|
+
interface RuleNumberNonNullable<K, VT> {
|
|
22
|
+
field: K;
|
|
23
|
+
operator: '<' | '>' | '<=' | '>=';
|
|
24
|
+
value: SetNonNullable<VT>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* in
|
|
28
|
+
*/
|
|
29
|
+
interface RuleIn<K, VT> {
|
|
30
|
+
field: K;
|
|
31
|
+
operator: 'in' | 'notIn';
|
|
32
|
+
value: SetNonNullable<VT>[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* between
|
|
36
|
+
*/
|
|
37
|
+
interface RuleBetween<K, VT> {
|
|
38
|
+
field: K;
|
|
39
|
+
operator: 'between' | 'notBetween';
|
|
40
|
+
value: [SetNonNullable<VT>, SetNonNullable<VT>];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* UUID
|
|
44
|
+
*/
|
|
45
|
+
export type RelationUUIDRules<K, VT> = RuleEqualNullable<K, VT> | RuleIn<K, VT>;
|
|
46
|
+
/**
|
|
47
|
+
* string
|
|
48
|
+
*/
|
|
49
|
+
export type RelationStringRules<K, VT> = RuleEqualNullable<K, VT> | RuleStringNonNullable<K, VT> | RuleIn<K, VT> | RuleBetween<K, VT>;
|
|
50
|
+
/**
|
|
51
|
+
* number
|
|
52
|
+
*/
|
|
53
|
+
export type RelationNumberRules<K, VT> = RuleEqualNullable<K, VT> | RuleNumberNonNullable<K, VT> | RuleIn<K, VT> | RuleBetween<K, VT>;
|
|
54
|
+
/**
|
|
55
|
+
* Boolean
|
|
56
|
+
*/
|
|
57
|
+
export type RelationBooleanRules<K, VT> = RuleEqualNullable<K, VT>;
|
|
58
|
+
/**
|
|
59
|
+
* Date
|
|
60
|
+
*/
|
|
61
|
+
export type RelationDateRules<K, VT> = RuleEqualNullable<K, VT> | RuleNumberNonNullable<K, VT> | RuleIn<K, VT> | RuleBetween<K, VT>;
|
|
62
|
+
export {};
|
package/rxdb-utils.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export declare const getEntityStatus: <T extends EntityType>(target: InstanceTyp
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const __decorateClass: (decorators: any, target: any, key: any, kind: number) => any;
|
|
17
17
|
/**
|
|
18
|
-
* 生成 uuid
|
|
18
|
+
* 生成 uuid v7
|
|
19
19
|
*/
|
|
20
20
|
export declare const uuid: () => UUID;
|
package/rxdb.interface.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SyncOptions } from './entity/entity-metadata-options.interface';
|
|
2
2
|
import { EntityType } from './entity/entity.interface';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 升级脚本
|
|
5
5
|
*/
|
|
6
6
|
export interface MigrationType {
|
|
7
7
|
up(): Promise<void>;
|
|
@@ -11,6 +11,9 @@ export interface MigrationType {
|
|
|
11
11
|
* RxDB 环境上下文
|
|
12
12
|
*/
|
|
13
13
|
export interface RxDBContext {
|
|
14
|
+
/**
|
|
15
|
+
* 用户 ID
|
|
16
|
+
*/
|
|
14
17
|
userId?: string;
|
|
15
18
|
}
|
|
16
19
|
/**
|
package/rxdb.private.d.ts
CHANGED
|
@@ -23,9 +23,21 @@ export declare const STATUS_CHECK: unique symbol;
|
|
|
23
23
|
* 实体管理器
|
|
24
24
|
*/
|
|
25
25
|
export declare const ENTITY_MANAGER: unique symbol;
|
|
26
|
+
/**
|
|
27
|
+
* 实体删除检查
|
|
28
|
+
*/
|
|
26
29
|
export declare const ɵEntityDeleteCheck: unique symbol;
|
|
30
|
+
/**
|
|
31
|
+
* 更新者
|
|
32
|
+
*/
|
|
27
33
|
export declare const UPDATED_BY: unique symbol;
|
|
34
|
+
/**
|
|
35
|
+
* 更新来自系统
|
|
36
|
+
*/
|
|
28
37
|
export declare const UPDATED_BY_SYSTEM: string;
|
|
38
|
+
/**
|
|
39
|
+
* 更新来自用户
|
|
40
|
+
*/
|
|
29
41
|
export declare const UPDATED_BY_USER: string;
|
|
30
42
|
export type UpdatedBy = typeof UPDATED_BY_SYSTEM | typeof UPDATED_BY_USER | UUID | null;
|
|
31
43
|
/**
|
|
@@ -44,7 +56,20 @@ export declare const isDatabaseEvent: (event: RxDBEvent) => boolean;
|
|
|
44
56
|
* 实体管理内部方法
|
|
45
57
|
*/
|
|
46
58
|
export type EntityManagerPrivate = {
|
|
59
|
+
/**
|
|
60
|
+
* 设置实体代理创建函数
|
|
61
|
+
* 用于创建新的实体代理对象,并初始化其状态
|
|
62
|
+
*
|
|
63
|
+
* @param entity - 要代理的实体
|
|
64
|
+
* @returns 代理后的实体实例
|
|
65
|
+
*/
|
|
47
66
|
[ɵProxy]: (entity: any) => any;
|
|
67
|
+
/**
|
|
68
|
+
* 设置实体删除检查函数
|
|
69
|
+
* 用于处理数据库适配器的删除事件,更新实体状态
|
|
70
|
+
*
|
|
71
|
+
* @param event - 删除事件
|
|
72
|
+
*/
|
|
48
73
|
[ɵEntityDeleteCheck]: (event: RxDBEvent) => void;
|
|
49
74
|
} & EntityManager;
|
|
50
75
|
/**
|