@ruiapp/rapid-core 0.1.70 → 0.1.72
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/dataAccess/dataAccessTypes.d.ts +11 -0
- package/dist/dataAccess/propertyMapper.d.ts +3 -2
- package/dist/helpers/metaHelper.d.ts +1 -0
- package/dist/index.js +276 -159
- package/dist/plugins/setting/actionHandlers/index.d.ts +2 -1
- package/dist/plugins/setting/routes/index.d.ts +12 -2
- package/dist/queryBuilder/queryBuilder.d.ts +2 -1
- package/package.json +1 -1
- package/src/dataAccess/dataAccessTypes.ts +122 -109
- package/src/dataAccess/entityManager.ts +1342 -1298
- package/src/dataAccess/propertyMapper.ts +28 -27
- package/src/helpers/metaHelper.ts +13 -0
- package/src/plugins/setting/actionHandlers/index.ts +2 -1
- package/src/plugins/setting/routes/index.ts +2 -1
- package/src/queryBuilder/queryBuilder.ts +512 -473
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as getUserSettingValues from "./getUserSettingValues";
|
|
2
2
|
import * as getSystemSettingValues from "./getSystemSettingValues";
|
|
3
|
-
|
|
3
|
+
import * as setSystemSettingValues from "./setSystemSettingValues";
|
|
4
|
+
declare const _default: (typeof getUserSettingValues | typeof getSystemSettingValues | typeof setSystemSettingValues)[];
|
|
4
5
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: {
|
|
1
|
+
declare const _default: ({
|
|
2
2
|
namespace: string;
|
|
3
3
|
name: string;
|
|
4
4
|
code: string;
|
|
@@ -8,5 +8,15 @@ declare const _default: {
|
|
|
8
8
|
actions: {
|
|
9
9
|
code: string;
|
|
10
10
|
}[];
|
|
11
|
-
}
|
|
11
|
+
} | {
|
|
12
|
+
namespace: string;
|
|
13
|
+
name: string;
|
|
14
|
+
code: string;
|
|
15
|
+
type: "RESTful";
|
|
16
|
+
method: "PATCH";
|
|
17
|
+
endpoint: string;
|
|
18
|
+
actions: {
|
|
19
|
+
code: string;
|
|
20
|
+
}[];
|
|
21
|
+
})[];
|
|
12
22
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RpdDataModel, CreateEntityOptions, QuoteTableOptions, DatabaseQuery } from "../types";
|
|
2
2
|
import { CountRowOptions, DeleteRowOptions, FindRowOptions, RowFilterOptions, UpdateRowOptions, ColumnSelectOptions } from "../dataAccess/dataAccessTypes";
|
|
3
3
|
export interface BuildQueryContext {
|
|
4
|
+
model: RpdDataModel;
|
|
4
5
|
builder: QueryBuilder;
|
|
5
6
|
params: any[];
|
|
6
7
|
emitTableAlias: boolean;
|
|
@@ -13,7 +14,7 @@ export default class QueryBuilder {
|
|
|
13
14
|
constructor(options: InitQueryBuilderOptions);
|
|
14
15
|
quoteTable(options: QuoteTableOptions): string;
|
|
15
16
|
quoteObject(name: string): string;
|
|
16
|
-
quoteColumn(column: ColumnSelectOptions, emitTableAlias: boolean): string;
|
|
17
|
+
quoteColumn(model: RpdDataModel, column: ColumnSelectOptions, emitTableAlias: boolean): string;
|
|
17
18
|
select(model: RpdDataModel, options: FindRowOptions): DatabaseQuery;
|
|
18
19
|
selectDerived(derivedModel: RpdDataModel, baseModel: RpdDataModel, options: FindRowOptions): DatabaseQuery;
|
|
19
20
|
count(model: RpdDataModel, options: CountRowOptions): DatabaseQuery;
|
package/package.json
CHANGED
|
@@ -1,109 +1,122 @@
|
|
|
1
|
-
export type RowFilterRelationalOperators =
|
|
2
|
-
| "eq"
|
|
3
|
-
| "ne"
|
|
4
|
-
| "lt"
|
|
5
|
-
| "lte"
|
|
6
|
-
| "gt"
|
|
7
|
-
| "gte"
|
|
8
|
-
| "contains"
|
|
9
|
-
| "notContains"
|
|
10
|
-
| "containsCS"
|
|
11
|
-
| "notContainsCS"
|
|
12
|
-
| "startsWith"
|
|
13
|
-
| "notStartsWith"
|
|
14
|
-
| "endsWith"
|
|
15
|
-
| "notEndsWith";
|
|
16
|
-
|
|
17
|
-
export type RowFilterSetOperators = "in" | "notIn";
|
|
18
|
-
|
|
19
|
-
export type RowFilterLogicalOperators = "or" | "and";
|
|
20
|
-
|
|
21
|
-
export type RowFilterUnaryOperators = "null" | "notNull";
|
|
22
|
-
|
|
23
|
-
export type RowFilterExistenceOperators = "exists" | "notExists";
|
|
24
|
-
|
|
25
|
-
export type RowFilterOperators =
|
|
26
|
-
| RowFilterRelationalOperators
|
|
27
|
-
| RowFilterSetOperators
|
|
28
|
-
| RowFilterLogicalOperators
|
|
29
|
-
| RowFilterUnaryOperators
|
|
30
|
-
| RowFilterExistenceOperators;
|
|
31
|
-
|
|
32
|
-
export type RowFilterOptions =
|
|
33
|
-
| FindRowRelationalFilterOptions
|
|
34
|
-
| FindRowSetFilterOptions
|
|
35
|
-
| FindRowLogicalFilterOptions
|
|
36
|
-
| FindRowUnaryFilterOptions
|
|
37
|
-
| FindRowExistenceFilterOptions;
|
|
38
|
-
|
|
39
|
-
export type RowNonRelationPropertyFilterOptions = FindRowRelationalFilterOptions | FindRowSetFilterOptions | FindRowUnaryFilterOptions;
|
|
40
|
-
|
|
41
|
-
export type ColumnSelectOptions = string | ColumnNameWithTableName;
|
|
42
|
-
|
|
43
|
-
export type ColumnNameWithTableName = {
|
|
44
|
-
name: string;
|
|
45
|
-
tableName?: string;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
1
|
+
export type RowFilterRelationalOperators =
|
|
2
|
+
| "eq"
|
|
3
|
+
| "ne"
|
|
4
|
+
| "lt"
|
|
5
|
+
| "lte"
|
|
6
|
+
| "gt"
|
|
7
|
+
| "gte"
|
|
8
|
+
| "contains"
|
|
9
|
+
| "notContains"
|
|
10
|
+
| "containsCS"
|
|
11
|
+
| "notContainsCS"
|
|
12
|
+
| "startsWith"
|
|
13
|
+
| "notStartsWith"
|
|
14
|
+
| "endsWith"
|
|
15
|
+
| "notEndsWith";
|
|
16
|
+
|
|
17
|
+
export type RowFilterSetOperators = "in" | "notIn";
|
|
18
|
+
|
|
19
|
+
export type RowFilterLogicalOperators = "or" | "and";
|
|
20
|
+
|
|
21
|
+
export type RowFilterUnaryOperators = "null" | "notNull";
|
|
22
|
+
|
|
23
|
+
export type RowFilterExistenceOperators = "exists" | "notExists";
|
|
24
|
+
|
|
25
|
+
export type RowFilterOperators =
|
|
26
|
+
| RowFilterRelationalOperators
|
|
27
|
+
| RowFilterSetOperators
|
|
28
|
+
| RowFilterLogicalOperators
|
|
29
|
+
| RowFilterUnaryOperators
|
|
30
|
+
| RowFilterExistenceOperators;
|
|
31
|
+
|
|
32
|
+
export type RowFilterOptions =
|
|
33
|
+
| FindRowRelationalFilterOptions
|
|
34
|
+
| FindRowSetFilterOptions
|
|
35
|
+
| FindRowLogicalFilterOptions
|
|
36
|
+
| FindRowUnaryFilterOptions
|
|
37
|
+
| FindRowExistenceFilterOptions;
|
|
38
|
+
|
|
39
|
+
export type RowNonRelationPropertyFilterOptions = FindRowRelationalFilterOptions | FindRowSetFilterOptions | FindRowUnaryFilterOptions;
|
|
40
|
+
|
|
41
|
+
export type ColumnSelectOptions = string | ColumnNameWithTableName;
|
|
42
|
+
|
|
43
|
+
export type ColumnNameWithTableName = {
|
|
44
|
+
name: string;
|
|
45
|
+
tableName?: string;
|
|
46
|
+
schema?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export interface FindRowOptions {
|
|
50
|
+
filters?: RowFilterOptions[];
|
|
51
|
+
orderBy?: FindRowOrderByOptions[];
|
|
52
|
+
pagination?: FindRowPaginationOptions;
|
|
53
|
+
// TODO: may be `columns` is a better name.
|
|
54
|
+
fields?: ColumnSelectOptions[];
|
|
55
|
+
keepNonPropertyFields?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface FindRowRelationalFilterOptions {
|
|
59
|
+
// TODO: may be `column` is a better name.
|
|
60
|
+
field: ColumnSelectOptions;
|
|
61
|
+
operator: RowFilterRelationalOperators;
|
|
62
|
+
value: any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface FindRowSetFilterOptions {
|
|
66
|
+
field: ColumnSelectOptions;
|
|
67
|
+
operator: RowFilterSetOperators;
|
|
68
|
+
value: any[];
|
|
69
|
+
itemType?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface FindRowLogicalFilterOptions {
|
|
73
|
+
operator: RowFilterLogicalOperators;
|
|
74
|
+
filters: RowFilterOptions[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface FindRowUnaryFilterOptions {
|
|
78
|
+
field: ColumnSelectOptions;
|
|
79
|
+
operator: RowFilterUnaryOperators;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface FindRowExistenceFilterOptions {
|
|
83
|
+
field: ColumnSelectOptions;
|
|
84
|
+
operator: RowFilterExistenceOperators;
|
|
85
|
+
filters: RowFilterOptions[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface FindRowPaginationOptions {
|
|
89
|
+
offset: number;
|
|
90
|
+
limit: number;
|
|
91
|
+
withoutTotal?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface FindRowOrderByOptions {
|
|
95
|
+
/**
|
|
96
|
+
* 排序字段
|
|
97
|
+
*/
|
|
98
|
+
field: ColumnSelectOptions;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 是否倒序
|
|
102
|
+
*/
|
|
103
|
+
desc?: boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 关系字段
|
|
107
|
+
*/
|
|
108
|
+
relationField?: ColumnNameWithTableName;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CountRowOptions {
|
|
112
|
+
filters?: RowFilterOptions[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface UpdateRowOptions {
|
|
116
|
+
filters?: RowFilterOptions[];
|
|
117
|
+
entity: any;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface DeleteRowOptions {
|
|
121
|
+
filters?: RowFilterOptions[];
|
|
122
|
+
}
|