@ruiapp/rapid-core 0.1.7 → 0.1.9
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/core/actionHandler.d.ts +1 -1
- package/dist/core/eventManager.d.ts +1 -1
- package/dist/core/pluginManager.d.ts +8 -8
- package/dist/core/routesBuilder.d.ts +2 -2
- package/dist/core/server.d.ts +3 -1
- package/dist/dataAccess/dataAccessor.d.ts +2 -2
- package/dist/dataAccess/entityManager.d.ts +14 -6
- package/dist/dataAccess/entityMapper.d.ts +1 -1
- package/dist/dataAccess/filterHelper.d.ts +1 -1
- package/dist/dataAccess/propertyMapper.d.ts +1 -1
- package/dist/helpers/runCollectionEntityActionHandler.d.ts +5 -4
- package/dist/index.js +667 -622
- package/dist/plugins/auth/AuthPlugin.d.ts +3 -3
- package/dist/plugins/auth/actionHandlers/createSession.d.ts +2 -2
- package/dist/plugins/auth/actionHandlers/deleteSession.d.ts +2 -2
- package/dist/plugins/auth/actionHandlers/getMyProfile.d.ts +2 -2
- package/dist/plugins/auth/models/AccessToken.d.ts +1 -1
- package/dist/plugins/dataManage/DataManagePlugin.d.ts +2 -2
- package/dist/plugins/dataManage/actionHandlers/addEntityRelations.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/countCollectionEntities.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/createCollectionEntity.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/deleteCollectionEntityById.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/findCollectionEntities.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/findCollectionEntityById.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/queryDatabase.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/removeEntityRelations.d.ts +3 -3
- package/dist/plugins/dataManage/actionHandlers/updateCollectionEntityById.d.ts +3 -3
- package/dist/plugins/fileManage/FileManagePlugin.d.ts +2 -2
- package/dist/plugins/fileManage/actionHandlers/downloadDocument.d.ts +2 -2
- package/dist/plugins/fileManage/actionHandlers/downloadFile.d.ts +2 -2
- package/dist/plugins/fileManage/actionHandlers/uploadFile.d.ts +2 -2
- package/dist/plugins/metaManage/MetaManagePlugin.d.ts +2 -2
- package/dist/plugins/metaManage/actionHandlers/getMetaModelDetail.d.ts +2 -2
- package/dist/plugins/metaManage/actionHandlers/listMetaModels.d.ts +2 -2
- package/dist/plugins/metaManage/actionHandlers/listMetaRoutes.d.ts +2 -2
- package/dist/plugins/routeManage/RouteManagePlugin.d.ts +2 -2
- package/dist/plugins/routeManage/actionHandlers/httpProxy.d.ts +3 -3
- package/dist/plugins/webhooks/WebhooksPlugin.d.ts +2 -2
- package/dist/proxy/mod.d.ts +1 -1
- package/dist/proxy/types.d.ts +2 -2
- package/dist/server.d.ts +2 -0
- package/dist/types.d.ts +3 -0
- package/package.json +2 -2
- package/rollup.config.js +19 -2
- package/src/core/pluginManager.ts +7 -14
- package/src/core/server.ts +2 -0
- package/src/dataAccess/entityManager.ts +57 -6
- package/src/helpers/runCollectionEntityActionHandler.ts +6 -5
- package/src/plugins/auth/AuthPlugin.ts +7 -3
- package/src/plugins/auth/actionHandlers/getMyProfile.ts +2 -6
- package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +2 -2
- package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +2 -3
- package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +2 -3
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +4 -4
- package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +3 -4
- package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +4 -13
- package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +4 -5
- package/src/plugins/metaManage/MetaManagePlugin.ts +3 -7
- package/src/plugins/routeManage/RouteManagePlugin.ts +2 -7
- package/src/plugins/webhooks/WebhooksPlugin.ts +2 -7
- package/src/server.ts +32 -8
- package/src/types.ts +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpdApplicationConfig } from "
|
|
1
|
+
import { RpdApplicationConfig } from "../types";
|
|
2
2
|
import { IRpdServer, RapidPlugin } from "./server";
|
|
3
3
|
import { RouteContext } from "./routeContext";
|
|
4
4
|
declare class PluginManager {
|
|
@@ -18,18 +18,18 @@ declare class PluginManager {
|
|
|
18
18
|
/** 注册任务处理程序 */
|
|
19
19
|
registerTaskProcessors(): Promise<void>;
|
|
20
20
|
/** 在加载应用前调用。 */
|
|
21
|
-
onLoadingApplication(
|
|
21
|
+
onLoadingApplication(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
22
22
|
/** 配置数据模型 */
|
|
23
|
-
configureModels(
|
|
23
|
+
configureModels(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
24
24
|
/** 配置模型属性 */
|
|
25
|
-
configureModelProperties(
|
|
25
|
+
configureModelProperties(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
26
26
|
/** 配置路由 */
|
|
27
|
-
configureRoutes(
|
|
27
|
+
configureRoutes(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
28
28
|
/** 在应用配置加载完成后调用。此时插件可以进行一些数据的初始化工作。 */
|
|
29
|
-
onApplicationLoaded(
|
|
29
|
+
onApplicationLoaded(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
30
30
|
/** 在应用准备完成后调用。此时服务器已经可以处理网络请求。 */
|
|
31
|
-
onApplicationReady(
|
|
31
|
+
onApplicationReady(applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
32
32
|
/** 在接收到HTTP请求,准备路由上下文时调用。 */
|
|
33
|
-
onPrepareRouteContext(
|
|
33
|
+
onPrepareRouteContext(routeContext: RouteContext): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
export default PluginManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Router from "koa-tree-router";
|
|
2
|
-
import { IRpdServer } from "
|
|
3
|
-
import { RpdApplicationConfig } from "
|
|
2
|
+
import { IRpdServer } from "../core/server";
|
|
3
|
+
import { RpdApplicationConfig } from "../types";
|
|
4
4
|
export declare function buildRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<Router.Middleware<any, {}>>;
|
package/dist/core/server.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { GetDataAccessorOptions, GetModelOptions, IDatabaseConfig, IQueryBuilder, IRpdDataAccessor, RapidServerConfig, RpdApplicationConfig, RpdDataModel, RpdServerEventTypes } from "
|
|
1
|
+
import { GetDataAccessorOptions, GetModelOptions, IDatabaseConfig, IQueryBuilder, IRpdDataAccessor, RapidServerConfig, RpdApplicationConfig, RpdDataModel, RpdServerEventTypes } from "../types";
|
|
2
2
|
import { IPluginActionHandler, ActionHandler } from "./actionHandler";
|
|
3
3
|
import { Next, RouteContext } from "./routeContext";
|
|
4
|
+
import EntityManager from "../dataAccess/entityManager";
|
|
4
5
|
export interface IRpdServer {
|
|
5
6
|
config: RapidServerConfig;
|
|
6
7
|
databaseConfig: IDatabaseConfig;
|
|
@@ -11,6 +12,7 @@ export interface IRpdServer {
|
|
|
11
12
|
registerActionHandler(plugin: RapidPlugin, options: IPluginActionHandler): void;
|
|
12
13
|
getActionHandlerByCode(code: string): ActionHandler | undefined;
|
|
13
14
|
getDataAccessor<T = any>(options: GetDataAccessorOptions): IRpdDataAccessor<T>;
|
|
15
|
+
getEntityManager(singularCode: string): EntityManager;
|
|
14
16
|
getApplicationConfig(): RpdApplicationConfig;
|
|
15
17
|
appendApplicationConfig(config: Partial<RpdApplicationConfig>): any;
|
|
16
18
|
getModel(options: GetModelOptions): RpdDataModel | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CountEntityOptions, FindEntityOptions, IRpdDataAccessor, RpdDataModel, IDatabaseAccessor } from "
|
|
2
|
-
import QueryBuilder from "
|
|
1
|
+
import { CountEntityOptions, FindEntityOptions, IRpdDataAccessor, RpdDataModel, IDatabaseAccessor } from "../types";
|
|
2
|
+
import QueryBuilder from "../queryBuilder/queryBuilder";
|
|
3
3
|
export interface IDataAccessorOptions {
|
|
4
4
|
model: RpdDataModel;
|
|
5
5
|
queryBuilder: QueryBuilder;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { CreateEntityOptions, FindEntityOptions, IRpdDataAccessor, UpdateEntityByIdOptions } from "
|
|
2
|
-
import { IRpdServer } from "
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { CountEntityOptions, CountEntityResult, CreateEntityOptions, FindEntityOptions, IRpdDataAccessor, RpdDataModel, UpdateEntityByIdOptions } from "../types";
|
|
2
|
+
import { IRpdServer } from "../core/server";
|
|
3
|
+
export default class EntityManager<TEntity = any> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(server: IRpdServer, dataAccessor: IRpdDataAccessor);
|
|
6
|
+
findEntities(options: FindEntityOptions): Promise<TEntity[]>;
|
|
7
|
+
findEntity(options: FindEntityOptions): Promise<TEntity | null>;
|
|
8
|
+
findById(id: any): Promise<TEntity | null>;
|
|
9
|
+
createEntity(options: CreateEntityOptions): Promise<TEntity>;
|
|
10
|
+
updateEntityById(options: UpdateEntityByIdOptions): Promise<TEntity>;
|
|
11
|
+
count(options: CountEntityOptions): Promise<CountEntityResult>;
|
|
12
|
+
deleteById(id: any): Promise<void>;
|
|
13
|
+
getModel(): RpdDataModel;
|
|
14
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityFilterOptions } from "
|
|
1
|
+
import { EntityFilterOptions } from "../types";
|
|
2
2
|
export declare function removeFiltersWithNullValue(filters?: EntityFilterOptions[]): EntityFilterOptions[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RpdDataModel } from "
|
|
1
|
+
import { RpdDataModel } from "../types";
|
|
2
2
|
export declare function mapPropertyNameToColumnName(model: RpdDataModel, propertyName: string): string;
|
|
3
3
|
export declare function mapPropertyNamesToColumnNames(model: RpdDataModel, propertyNames: string[]): string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ActionHandlerContext } from "
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { RunEntityActionHandlerOptions } from "../types";
|
|
2
|
+
import { ActionHandlerContext } from "../core/actionHandler";
|
|
3
|
+
import EntityManager from "../dataAccess/entityManager";
|
|
4
|
+
type EntityActionHandler = (entityManager: EntityManager, input: any) => Promise<any>;
|
|
5
|
+
export default function runCollectionEntityActionHandler(ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions, code: string, handleEntityAction: EntityActionHandler): Promise<void>;
|
|
5
6
|
export {};
|