@ruiapp/rapid-core 0.11.8 → 0.12.0
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/index.js +20 -1
- package/dist/types.d.ts +32 -0
- package/package.json +1 -1
- package/src/bootstrapApplicationConfig.ts +15 -0
- package/src/dataAccess/entityManager.ts +5 -1
- package/src/types.ts +35 -0
package/dist/index.js
CHANGED
|
@@ -1798,6 +1798,21 @@ var bootstrapApplicationConfig = {
|
|
|
1798
1798
|
required: true,
|
|
1799
1799
|
defaultValue: "false",
|
|
1800
1800
|
},
|
|
1801
|
+
{
|
|
1802
|
+
name: "enableEventLog",
|
|
1803
|
+
code: "enableEventLog",
|
|
1804
|
+
columnName: "enable_event_log",
|
|
1805
|
+
type: "boolean",
|
|
1806
|
+
required: true,
|
|
1807
|
+
defaultValue: "false",
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
name: "eventTypePolicy",
|
|
1811
|
+
code: "eventTypePolicy",
|
|
1812
|
+
columnName: "event_type_policy",
|
|
1813
|
+
type: "json",
|
|
1814
|
+
required: false,
|
|
1815
|
+
},
|
|
1801
1816
|
{
|
|
1802
1817
|
name: "defaultOrderBy",
|
|
1803
1818
|
code: "defaultOrderBy",
|
|
@@ -4497,8 +4512,12 @@ class EntityManager {
|
|
|
4497
4512
|
singularCode: model.base,
|
|
4498
4513
|
});
|
|
4499
4514
|
}
|
|
4515
|
+
let entityFilters = options.filters;
|
|
4516
|
+
if (!options.includingSoftDeleted) {
|
|
4517
|
+
entityFilters = tryAddUndeletedEntityFilter(model, baseModel, entityFilters);
|
|
4518
|
+
}
|
|
4500
4519
|
const countRowOptions = {
|
|
4501
|
-
filters: await convertEntityFiltersToRowFilters(routeContext, this.#server, model, baseModel,
|
|
4520
|
+
filters: await convertEntityFiltersToRowFilters(routeContext, this.#server, model, baseModel, entityFilters),
|
|
4502
4521
|
};
|
|
4503
4522
|
return await this.#dataAccessor.count(countRowOptions, routeContext?.getDbTransactionClient());
|
|
4504
4523
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -228,6 +228,14 @@ export interface RpdDataModel {
|
|
|
228
228
|
* 是否使用软删除
|
|
229
229
|
*/
|
|
230
230
|
softDelete?: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* 是否启用事件日志
|
|
233
|
+
*/
|
|
234
|
+
enableEventLog?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* 事件类型策略
|
|
237
|
+
*/
|
|
238
|
+
eventTypePolicy?: RapidEntityEventTypePolicy;
|
|
231
239
|
/**
|
|
232
240
|
* 多语言配置
|
|
233
241
|
*/
|
|
@@ -255,6 +263,29 @@ export interface PermissionPolicy {
|
|
|
255
263
|
any?: string[];
|
|
256
264
|
all?: string[];
|
|
257
265
|
}
|
|
266
|
+
export interface RapidEntityEventTypePolicy {
|
|
267
|
+
/**
|
|
268
|
+
* 区分事件类型属性code
|
|
269
|
+
*/
|
|
270
|
+
propertyCode?: string;
|
|
271
|
+
/**
|
|
272
|
+
* 属性值事件类型
|
|
273
|
+
*/
|
|
274
|
+
eventTypes?: {
|
|
275
|
+
/**
|
|
276
|
+
* 属性值
|
|
277
|
+
*/
|
|
278
|
+
propertyValue: string;
|
|
279
|
+
/**
|
|
280
|
+
* 事件code前缀 默认取 propertyValue 的值
|
|
281
|
+
*/
|
|
282
|
+
eventTypeCodePrefix?: string;
|
|
283
|
+
/**
|
|
284
|
+
* 属性值名称 区分定义事件类型名称
|
|
285
|
+
*/
|
|
286
|
+
name: string;
|
|
287
|
+
}[];
|
|
288
|
+
}
|
|
258
289
|
export interface RpdDataModelProperty {
|
|
259
290
|
/**
|
|
260
291
|
* 表示此属性由谁来维护
|
|
@@ -604,6 +635,7 @@ export interface FindEntityOrderByOptions {
|
|
|
604
635
|
export interface CountEntityOptions {
|
|
605
636
|
routeContext?: RouteContext;
|
|
606
637
|
filters?: EntityFilterOptions[];
|
|
638
|
+
includingSoftDeleted?: boolean;
|
|
607
639
|
}
|
|
608
640
|
export interface CountEntityResult {
|
|
609
641
|
count: number;
|
package/package.json
CHANGED
|
@@ -153,6 +153,21 @@ export default {
|
|
|
153
153
|
required: true,
|
|
154
154
|
defaultValue: "false",
|
|
155
155
|
},
|
|
156
|
+
{
|
|
157
|
+
name: "enableEventLog",
|
|
158
|
+
code: "enableEventLog",
|
|
159
|
+
columnName: "enable_event_log",
|
|
160
|
+
type: "boolean",
|
|
161
|
+
required: true,
|
|
162
|
+
defaultValue: "false",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "eventTypePolicy",
|
|
166
|
+
code: "eventTypePolicy",
|
|
167
|
+
columnName: "event_type_policy",
|
|
168
|
+
type: "json",
|
|
169
|
+
required: false,
|
|
170
|
+
},
|
|
156
171
|
{
|
|
157
172
|
name: "defaultOrderBy",
|
|
158
173
|
code: "defaultOrderBy",
|
|
@@ -1892,8 +1892,12 @@ export default class EntityManager<TEntity = any> {
|
|
|
1892
1892
|
singularCode: model.base,
|
|
1893
1893
|
});
|
|
1894
1894
|
}
|
|
1895
|
+
let entityFilters = options.filters;
|
|
1896
|
+
if (!options.includingSoftDeleted) {
|
|
1897
|
+
entityFilters = tryAddUndeletedEntityFilter(model, baseModel, entityFilters);
|
|
1898
|
+
}
|
|
1895
1899
|
const countRowOptions: CountRowOptions = {
|
|
1896
|
-
filters: await convertEntityFiltersToRowFilters(routeContext, this.#server, model, baseModel,
|
|
1900
|
+
filters: await convertEntityFiltersToRowFilters(routeContext, this.#server, model, baseModel, entityFilters),
|
|
1897
1901
|
};
|
|
1898
1902
|
return await this.#dataAccessor.count(countRowOptions, routeContext?.getDbTransactionClient());
|
|
1899
1903
|
}
|
package/src/types.ts
CHANGED
|
@@ -265,6 +265,16 @@ export interface RpdDataModel {
|
|
|
265
265
|
*/
|
|
266
266
|
softDelete?: boolean;
|
|
267
267
|
|
|
268
|
+
/**
|
|
269
|
+
* 是否启用事件日志
|
|
270
|
+
*/
|
|
271
|
+
enableEventLog?: boolean;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* 事件类型策略
|
|
275
|
+
*/
|
|
276
|
+
eventTypePolicy?: RapidEntityEventTypePolicy;
|
|
277
|
+
|
|
268
278
|
/**
|
|
269
279
|
* 多语言配置
|
|
270
280
|
*/
|
|
@@ -297,6 +307,30 @@ export interface PermissionPolicy {
|
|
|
297
307
|
all?: string[];
|
|
298
308
|
}
|
|
299
309
|
|
|
310
|
+
export interface RapidEntityEventTypePolicy {
|
|
311
|
+
/**
|
|
312
|
+
* 区分事件类型属性code
|
|
313
|
+
*/
|
|
314
|
+
propertyCode?: string;
|
|
315
|
+
/**
|
|
316
|
+
* 属性值事件类型
|
|
317
|
+
*/
|
|
318
|
+
eventTypes?: {
|
|
319
|
+
/**
|
|
320
|
+
* 属性值
|
|
321
|
+
*/
|
|
322
|
+
propertyValue: string;
|
|
323
|
+
/**
|
|
324
|
+
* 事件code前缀 默认取 propertyValue 的值
|
|
325
|
+
*/
|
|
326
|
+
eventTypeCodePrefix?: string;
|
|
327
|
+
/**
|
|
328
|
+
* 属性值名称 区分定义事件类型名称
|
|
329
|
+
*/
|
|
330
|
+
name: string;
|
|
331
|
+
}[];
|
|
332
|
+
}
|
|
333
|
+
|
|
300
334
|
export interface RpdDataModelProperty {
|
|
301
335
|
/**
|
|
302
336
|
* 表示此属性由谁来维护
|
|
@@ -772,6 +806,7 @@ export interface FindEntityOrderByOptions {
|
|
|
772
806
|
export interface CountEntityOptions {
|
|
773
807
|
routeContext?: RouteContext;
|
|
774
808
|
filters?: EntityFilterOptions[];
|
|
809
|
+
includingSoftDeleted?: boolean;
|
|
775
810
|
}
|
|
776
811
|
|
|
777
812
|
export interface CountEntityResult {
|