@aiao/rxdb-test 0.0.2
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/README.md +1 -0
- package/entities/index.d.ts +251 -0
- package/entities/index.js +55 -0
- package/index.d.ts +1 -0
- package/index.js +4 -0
- package/package.json +27 -0
- package/shop/index.d.ts +1343 -0
- package/shop/index.js +411 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# rxdb-test
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { BooleanRules, CountOptions, DateRules, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, FindTreeOptions, GetOptions, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationStringRules, RelationUUIDRules, RuleGroup, StringRules, TreeAdjacencyListEntityBase, UUID, UUIDRules } from '@aiao/rxdb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
/** rule */
|
|
5
|
+
declare type TodoRule =
|
|
6
|
+
| UUIDRules<Todo, 'id'>
|
|
7
|
+
| DateRules<Todo, 'createdAt'>
|
|
8
|
+
| DateRules<Todo, 'updatedAt'>
|
|
9
|
+
| DateRules<Todo, 'removedAt'>
|
|
10
|
+
| StringRules<Todo, 'createdBy'>
|
|
11
|
+
| StringRules<Todo, 'updatedBy'>
|
|
12
|
+
| StringRules<Todo, 'removedBy'>
|
|
13
|
+
| StringRules<Todo, 'title'>
|
|
14
|
+
| BooleanRules<Todo, 'completed'>;
|
|
15
|
+
|
|
16
|
+
/** RuleGroup */
|
|
17
|
+
export declare type TodoRuleGroup = RuleGroup<Todo, keyof Todo, TodoRule>;
|
|
18
|
+
|
|
19
|
+
/** OrderByField */
|
|
20
|
+
declare type TodoOrderByField = "id" | "createdAt" | "updatedAt" | "removedAt" | "createdBy" | "updatedBy" | "removedBy" | "title" | "completed";
|
|
21
|
+
|
|
22
|
+
/** rule */
|
|
23
|
+
declare type MenuRule =
|
|
24
|
+
| UUIDRules<Menu, 'id'>
|
|
25
|
+
| DateRules<Menu, 'createdAt'>
|
|
26
|
+
| DateRules<Menu, 'updatedAt'>
|
|
27
|
+
| DateRules<Menu, 'removedAt'>
|
|
28
|
+
| StringRules<Menu, 'createdBy'>
|
|
29
|
+
| StringRules<Menu, 'updatedBy'>
|
|
30
|
+
| StringRules<Menu, 'removedBy'>
|
|
31
|
+
| StringRules<Menu, 'title'>
|
|
32
|
+
| UUIDRules<Menu, 'parentId'>
|
|
33
|
+
| RelationUUIDRules<'children.id', UUID>
|
|
34
|
+
| RelationDateRules<'children.createdAt', Date>
|
|
35
|
+
| RelationDateRules<'children.updatedAt', Date>
|
|
36
|
+
| RelationDateRules<'children.removedAt', Date | null>
|
|
37
|
+
| RelationStringRules<'children.createdBy', string | null>
|
|
38
|
+
| RelationStringRules<'children.updatedBy', string | null>
|
|
39
|
+
| RelationStringRules<'children.removedBy', string | null>
|
|
40
|
+
| RelationStringRules<'children.title', string>
|
|
41
|
+
| RelationUUIDRules<'parent.id', UUID>
|
|
42
|
+
| RelationDateRules<'parent.createdAt', Date>
|
|
43
|
+
| RelationDateRules<'parent.updatedAt', Date>
|
|
44
|
+
| RelationDateRules<'parent.removedAt', Date | null>
|
|
45
|
+
| RelationStringRules<'parent.createdBy', string | null>
|
|
46
|
+
| RelationStringRules<'parent.updatedBy', string | null>
|
|
47
|
+
| RelationStringRules<'parent.removedBy', string | null>
|
|
48
|
+
| RelationStringRules<'parent.title', string>;
|
|
49
|
+
|
|
50
|
+
/** RuleGroup */
|
|
51
|
+
export declare type MenuRuleGroup = RuleGroup<Menu, keyof Menu, MenuRule>;
|
|
52
|
+
|
|
53
|
+
/** OrderByField */
|
|
54
|
+
declare type MenuOrderByField = "id" | "createdAt" | "updatedAt" | "removedAt" | "createdBy" | "updatedBy" | "removedBy" | "title";
|
|
55
|
+
|
|
56
|
+
/** TreeRule */
|
|
57
|
+
declare type MenuTreeRule =
|
|
58
|
+
| RelationDateRules<'children.createdAt', Date>
|
|
59
|
+
| RelationDateRules<'children.updatedAt', Date>
|
|
60
|
+
| RelationDateRules<'children.removedAt', Date | null>
|
|
61
|
+
| RelationStringRules<'children.createdBy', string | null>
|
|
62
|
+
| RelationStringRules<'children.updatedBy', string | null>
|
|
63
|
+
| RelationStringRules<'children.removedBy', string | null>
|
|
64
|
+
| RelationStringRules<'children.title', string>;
|
|
65
|
+
|
|
66
|
+
/** TreeRuleGroup */
|
|
67
|
+
export declare type MenuTreeRuleGroup = RuleGroup<Menu, keyof Menu, MenuTreeRule>;
|
|
68
|
+
|
|
69
|
+
/** rxdb */
|
|
70
|
+
declare module "@aiao/rxdb" {
|
|
71
|
+
/** RxDB */
|
|
72
|
+
interface RxDB {
|
|
73
|
+
/** Todo */
|
|
74
|
+
Todo: typeof Todo;
|
|
75
|
+
/** Menu */
|
|
76
|
+
Menu: typeof Menu;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 初始化数据 */
|
|
81
|
+
export interface TodoInitData {
|
|
82
|
+
/** title */
|
|
83
|
+
title?: string;
|
|
84
|
+
/** completed
|
|
85
|
+
@default false */
|
|
86
|
+
completed?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** 初始化数据 */
|
|
90
|
+
export interface MenuInitData {
|
|
91
|
+
/** title */
|
|
92
|
+
title?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Todo
|
|
97
|
+
*/
|
|
98
|
+
export declare class Todo extends EntityBase {
|
|
99
|
+
/** completed
|
|
100
|
+
@default false */
|
|
101
|
+
completed: boolean;
|
|
102
|
+
/** title */
|
|
103
|
+
title: string;
|
|
104
|
+
/**
|
|
105
|
+
* 初始化数据
|
|
106
|
+
* @param initData 初始化数据
|
|
107
|
+
*/
|
|
108
|
+
constructor(initData?: TodoInitData);
|
|
109
|
+
/**
|
|
110
|
+
* 查询
|
|
111
|
+
* @param where 查询条件
|
|
112
|
+
* @param options 查询选项
|
|
113
|
+
*/
|
|
114
|
+
static count(where: TodoRuleGroup, options?: CountOptions): Observable<number>;
|
|
115
|
+
/**
|
|
116
|
+
* 查询
|
|
117
|
+
* @param where 查询条件
|
|
118
|
+
* @param options 查询选项
|
|
119
|
+
*/
|
|
120
|
+
static find(where: TodoRuleGroup, options?: FindOptions<TodoOrderByField>): Observable<Todo[]>;
|
|
121
|
+
/**
|
|
122
|
+
* 查询
|
|
123
|
+
* @param where 查询条件
|
|
124
|
+
* @param options 查询选项
|
|
125
|
+
*/
|
|
126
|
+
static findAll(where: TodoRuleGroup, options?: FindAllOptions<TodoOrderByField>): Observable<Todo[]>;
|
|
127
|
+
/**
|
|
128
|
+
* 查询
|
|
129
|
+
* @param where 查询条件
|
|
130
|
+
* @param options 查询选项
|
|
131
|
+
*/
|
|
132
|
+
static findByCursor(where: TodoRuleGroup, options?: FindByCursorOptions<TodoOrderByField>): Observable<Todo[]>;
|
|
133
|
+
/**
|
|
134
|
+
* 查询
|
|
135
|
+
* @param where 查询条件
|
|
136
|
+
* @param options 查询选项
|
|
137
|
+
*/
|
|
138
|
+
static findOne(where: TodoRuleGroup, options?: FindOneOptions<TodoOrderByField>): Observable<Todo | undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* 查询
|
|
141
|
+
* @param where 查询条件
|
|
142
|
+
* @param options 查询选项
|
|
143
|
+
*/
|
|
144
|
+
static findOneOrFail(where: TodoRuleGroup, options?: FindOneOrFailOptions<TodoOrderByField>): Observable<Todo>;
|
|
145
|
+
/**
|
|
146
|
+
* 查询
|
|
147
|
+
* @param id 实体的 id
|
|
148
|
+
* @param options 查询选项
|
|
149
|
+
*/
|
|
150
|
+
static get(id: string, options?: GetOptions): Observable<Todo>;
|
|
151
|
+
/**
|
|
152
|
+
* 删除
|
|
153
|
+
*/
|
|
154
|
+
remove(): Promise<Todo>;
|
|
155
|
+
/**
|
|
156
|
+
* 保存
|
|
157
|
+
*/
|
|
158
|
+
save(): Promise<Todo>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Menu
|
|
163
|
+
*/
|
|
164
|
+
export declare class Menu extends TreeAdjacencyListEntityBase {
|
|
165
|
+
/** children */
|
|
166
|
+
children$: RelationEntitiesObservable<Menu>;
|
|
167
|
+
/** parent */
|
|
168
|
+
parent$: RelationEntityObservable<Menu | null>;
|
|
169
|
+
/** parent id */
|
|
170
|
+
parentId: UUID;
|
|
171
|
+
/** title */
|
|
172
|
+
title: string;
|
|
173
|
+
/**
|
|
174
|
+
* 初始化数据
|
|
175
|
+
* @param initData 初始化数据
|
|
176
|
+
*/
|
|
177
|
+
constructor(initData?: MenuInitData);
|
|
178
|
+
/**
|
|
179
|
+
* 查询
|
|
180
|
+
* @param where 查询条件
|
|
181
|
+
* @param options 查询选项
|
|
182
|
+
*/
|
|
183
|
+
static count(where: MenuRuleGroup, options?: CountOptions): Observable<number>;
|
|
184
|
+
/**
|
|
185
|
+
* 查询祖先实体数量
|
|
186
|
+
* @param options 查询选项
|
|
187
|
+
*/
|
|
188
|
+
static countAncestors(entity: Menu, where: MenuTreeRuleGroup, options?: FindTreeOptions): Observable<number>;
|
|
189
|
+
/**
|
|
190
|
+
* 查询子孙实体数量
|
|
191
|
+
* @param options 查询选项
|
|
192
|
+
*/
|
|
193
|
+
static countDescendants(entity: Menu, where: MenuTreeRuleGroup, options?: FindTreeOptions): Observable<number>;
|
|
194
|
+
/**
|
|
195
|
+
* 查询
|
|
196
|
+
* @param where 查询条件
|
|
197
|
+
* @param options 查询选项
|
|
198
|
+
*/
|
|
199
|
+
static find(where: MenuRuleGroup, options?: FindOptions<MenuOrderByField>): Observable<Menu[]>;
|
|
200
|
+
/**
|
|
201
|
+
* 查询
|
|
202
|
+
* @param where 查询条件
|
|
203
|
+
* @param options 查询选项
|
|
204
|
+
*/
|
|
205
|
+
static findAll(where: MenuRuleGroup, options?: FindAllOptions<MenuOrderByField>): Observable<Menu[]>;
|
|
206
|
+
/**
|
|
207
|
+
* 查询祖先实体
|
|
208
|
+
* @param options 查询选项
|
|
209
|
+
*/
|
|
210
|
+
static findAncestors(entity: Menu, where: MenuTreeRuleGroup, options?: FindTreeOptions): Observable<Menu[]>;
|
|
211
|
+
/**
|
|
212
|
+
* 查询
|
|
213
|
+
* @param where 查询条件
|
|
214
|
+
* @param options 查询选项
|
|
215
|
+
*/
|
|
216
|
+
static findByCursor(where: MenuRuleGroup, options?: FindByCursorOptions<MenuOrderByField>): Observable<Menu[]>;
|
|
217
|
+
/**
|
|
218
|
+
* 查询子孙实体
|
|
219
|
+
* @param options 查询选项
|
|
220
|
+
*/
|
|
221
|
+
static findDescendants(entity: Menu, where: MenuTreeRuleGroup, options?: FindTreeOptions): Observable<Menu[]>;
|
|
222
|
+
/**
|
|
223
|
+
* 查询
|
|
224
|
+
* @param where 查询条件
|
|
225
|
+
* @param options 查询选项
|
|
226
|
+
*/
|
|
227
|
+
static findOne(where: MenuRuleGroup, options?: FindOneOptions<MenuOrderByField>): Observable<Menu | undefined>;
|
|
228
|
+
/**
|
|
229
|
+
* 查询
|
|
230
|
+
* @param where 查询条件
|
|
231
|
+
* @param options 查询选项
|
|
232
|
+
*/
|
|
233
|
+
static findOneOrFail(where: MenuRuleGroup, options?: FindOneOrFailOptions<MenuOrderByField>): Observable<Menu>;
|
|
234
|
+
/**
|
|
235
|
+
* 查询
|
|
236
|
+
* @param id 实体的 id
|
|
237
|
+
* @param options 查询选项
|
|
238
|
+
*/
|
|
239
|
+
static get(id: string, options?: GetOptions): Observable<Menu>;
|
|
240
|
+
/**
|
|
241
|
+
* 删除
|
|
242
|
+
*/
|
|
243
|
+
remove(): Promise<Menu>;
|
|
244
|
+
/**
|
|
245
|
+
* 保存
|
|
246
|
+
*/
|
|
247
|
+
save(): Promise<Menu>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export declare const ENTITIES: EntityType[];
|
|
251
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Entity, EntityBase, PropertyType, TreeAdjacencyListEntityBase, __decorateClass } from '@aiao/rxdb';
|
|
2
|
+
let Todo = class extends EntityBase {};
|
|
3
|
+
Todo = __decorateClass(
|
|
4
|
+
[
|
|
5
|
+
Entity({
|
|
6
|
+
name: "Todo",
|
|
7
|
+
properties: [
|
|
8
|
+
{
|
|
9
|
+
name: "title",
|
|
10
|
+
type: PropertyType.string
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "completed",
|
|
14
|
+
type: PropertyType.boolean,
|
|
15
|
+
default: false
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
repository: "Repository",
|
|
19
|
+
namespace: "public",
|
|
20
|
+
relations: [],
|
|
21
|
+
indexes: [],
|
|
22
|
+
extends: [
|
|
23
|
+
"EntityBase"
|
|
24
|
+
],
|
|
25
|
+
displayName: "Todo"
|
|
26
|
+
})
|
|
27
|
+
],
|
|
28
|
+
Todo
|
|
29
|
+
);
|
|
30
|
+
let Menu = class extends TreeAdjacencyListEntityBase {};
|
|
31
|
+
Menu = __decorateClass(
|
|
32
|
+
[
|
|
33
|
+
Entity({
|
|
34
|
+
name: "Menu",
|
|
35
|
+
properties: [
|
|
36
|
+
{
|
|
37
|
+
name: "title",
|
|
38
|
+
type: PropertyType.string
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
repository: "TreeRepository",
|
|
42
|
+
namespace: "public",
|
|
43
|
+
relations: [],
|
|
44
|
+
indexes: [],
|
|
45
|
+
extends: [
|
|
46
|
+
"TreeAdjacencyListEntityBase",
|
|
47
|
+
"EntityBase"
|
|
48
|
+
],
|
|
49
|
+
displayName: "Menu"
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
Menu
|
|
53
|
+
);
|
|
54
|
+
const ENTITIES = [ Menu, Todo ];
|
|
55
|
+
export { ENTITIES, Menu, Todo };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const name = "rxdb-test";
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiao/rxdb-test",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@aiao/rxdb": "0.0.1"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"types": "./index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./entities": {
|
|
16
|
+
"import": "./entities/index.js",
|
|
17
|
+
"types": "./entities/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./shop": {
|
|
20
|
+
"import": "./shop/index.js",
|
|
21
|
+
"types": "./shop/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
}
|
|
27
|
+
}
|