@ruiapp/rapid-core 0.1.6 → 0.1.8
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 +4 -1
- package/dist/core/request.d.ts +2 -1
- package/dist/core/routesBuilder.d.ts +2 -2
- package/dist/core/server.d.ts +16 -14
- package/dist/dataAccess/dataAccessor.d.ts +2 -2
- package/dist/dataAccess/entityManager.d.ts +2 -2
- 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 +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +278 -208
- package/dist/plugins/auth/{mod.d.ts → AuthPlugin.d.ts} +6 -4
- 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/auth/routes/index.d.ts +2 -2
- package/dist/plugins/dataManage/{mod.d.ts → 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/{mod.d.ts → 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/{mod.d.ts → 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/{mod.d.ts → RouteManagePlugin.d.ts} +2 -2
- package/dist/plugins/routeManage/actionHandlers/httpProxy.d.ts +3 -3
- package/dist/plugins/webhooks/{mod.d.ts → WebhooksPlugin.d.ts} +2 -2
- package/dist/proxy/mod.d.ts +1 -1
- package/dist/proxy/types.d.ts +2 -2
- package/dist/utilities/jwtUtility.d.ts +2 -2
- package/package.json +2 -2
- package/rollup.config.js +19 -2
- package/src/core/pluginManager.ts +13 -0
- package/src/core/request.ts +16 -3
- package/src/core/server.ts +15 -14
- package/src/index.ts +6 -6
- package/src/plugins/auth/{mod.ts → AuthPlugin.ts} +27 -2
- package/src/server.ts +1 -0
- package/src/utilities/jwtUtility.ts +3 -3
- /package/src/plugins/dataManage/{mod.ts → DataManagePlugin.ts} +0 -0
- /package/src/plugins/fileManage/{mod.ts → FileManagePlugin.ts} +0 -0
- /package/src/plugins/metaManage/{mod.ts → MetaManagePlugin.ts} +0 -0
- /package/src/plugins/routeManage/{mod.ts → RouteManagePlugin.ts} +0 -0
- /package/src/plugins/webhooks/{mod.ts → WebhooksPlugin.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RpdApplicationConfig } from "
|
|
1
|
+
import { RpdApplicationConfig } from "../types";
|
|
2
2
|
import { IRpdServer, RapidPlugin } from "./server";
|
|
3
|
+
import { RouteContext } from "./routeContext";
|
|
3
4
|
declare class PluginManager {
|
|
4
5
|
#private;
|
|
5
6
|
constructor(server: IRpdServer);
|
|
@@ -28,5 +29,7 @@ declare class PluginManager {
|
|
|
28
29
|
onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
29
30
|
/** 在应用准备完成后调用。此时服务器已经可以处理网络请求。 */
|
|
30
31
|
onApplicationReady(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
32
|
+
/** 在接收到HTTP请求,准备路由上下文时调用。 */
|
|
33
|
+
onPrepareRouteContext(server: IRpdServer, routeContext: RouteContext): Promise<void>;
|
|
31
34
|
}
|
|
32
35
|
export default PluginManager;
|
package/dist/core/request.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export declare class RapidRequest {
|
|
|
10
10
|
#private;
|
|
11
11
|
method: string;
|
|
12
12
|
url: URL;
|
|
13
|
-
headers: Headers;
|
|
14
13
|
constructor(req: Request);
|
|
15
14
|
parseBody(): Promise<void>;
|
|
16
15
|
get rawRequest(): Request;
|
|
16
|
+
get headers(): Headers;
|
|
17
|
+
get cookies(): Record<string, string>;
|
|
17
18
|
get body(): RapidRequestBody;
|
|
18
19
|
}
|
|
@@ -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,6 @@
|
|
|
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
|
-
import { Next } from "./routeContext";
|
|
3
|
+
import { Next, RouteContext } from "./routeContext";
|
|
4
4
|
export interface IRpdServer {
|
|
5
5
|
config: RapidServerConfig;
|
|
6
6
|
databaseConfig: IDatabaseConfig;
|
|
@@ -58,27 +58,29 @@ export interface RapidPlugin {
|
|
|
58
58
|
/** 插件的全局配置项 */
|
|
59
59
|
get configurations(): RpdConfigurationItemOptions[];
|
|
60
60
|
/** 初始化插件时调用。插件可以在此时进行一些内部对象的初始化工作。 */
|
|
61
|
-
initPlugin(server: IRpdServer)
|
|
61
|
+
initPlugin?: (server: IRpdServer) => Promise<any>;
|
|
62
62
|
/** 注册中间件 */
|
|
63
|
-
registerMiddlewares(server: IRpdServer)
|
|
63
|
+
registerMiddlewares?: (server: IRpdServer) => Promise<any>;
|
|
64
64
|
/** 注册接口动作处理程序 */
|
|
65
|
-
registerActionHandlers(server: IRpdServer)
|
|
65
|
+
registerActionHandlers?: (server: IRpdServer) => Promise<any>;
|
|
66
66
|
/** 注册事件处理程序 */
|
|
67
|
-
registerEventHandlers(server: IRpdServer)
|
|
67
|
+
registerEventHandlers?: (server: IRpdServer) => Promise<any>;
|
|
68
68
|
/** 注册消息处理程序 */
|
|
69
|
-
registerMessageHandlers(server: IRpdServer)
|
|
69
|
+
registerMessageHandlers?: (server: IRpdServer) => Promise<any>;
|
|
70
70
|
/** 注册任务处理程序 */
|
|
71
|
-
registerTaskProcessors(server: IRpdServer)
|
|
71
|
+
registerTaskProcessors?: (server: IRpdServer) => Promise<any>;
|
|
72
72
|
/** 在加载应用前调用。 */
|
|
73
|
-
onLoadingApplication(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
73
|
+
onLoadingApplication?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
74
74
|
/** 配置数据集合 */
|
|
75
|
-
configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
75
|
+
configureModels?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
76
76
|
/** 配置模型属性 */
|
|
77
|
-
configureModelProperties(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
77
|
+
configureModelProperties?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
78
78
|
/** 配置路由 */
|
|
79
|
-
configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
79
|
+
configureRoutes?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
80
80
|
/** 在应用配置加载完成后调用。此时插件可以进行一些数据的初始化工作。 */
|
|
81
|
-
onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
81
|
+
onApplicationLoaded?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
82
82
|
/** 在应用准备完成后调用。此时服务器已经可以处理网络请求,可以对外广播消息。 */
|
|
83
|
-
onApplicationReady(server: IRpdServer, applicationConfig: RpdApplicationConfig)
|
|
83
|
+
onApplicationReady?: (server: IRpdServer, applicationConfig: RpdApplicationConfig) => Promise<any>;
|
|
84
|
+
/** 在接收到HTTP请求,准备路由上下文时调用。 */
|
|
85
|
+
onPrepareRouteContext?: (server: IRpdServer, routeContext: RouteContext) => Promise<any>;
|
|
84
86
|
}
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import { CreateEntityOptions, FindEntityOptions, IRpdDataAccessor, UpdateEntityByIdOptions } from "
|
|
2
|
-
import { IRpdServer } from "
|
|
1
|
+
import { CreateEntityOptions, FindEntityOptions, IRpdDataAccessor, UpdateEntityByIdOptions } from "../types";
|
|
2
|
+
import { IRpdServer } from "../core/server";
|
|
3
3
|
export declare function findEntities(server: IRpdServer, dataAccessor: IRpdDataAccessor, options: FindEntityOptions): Promise<any[]>;
|
|
4
4
|
export declare function findEntity(server: IRpdServer, dataAccessor: IRpdDataAccessor, options: FindEntityOptions): Promise<any>;
|
|
5
5
|
export declare function createEntity(server: IRpdServer, dataAccessor: IRpdDataAccessor, options: CreateEntityOptions): Promise<any>;
|
|
@@ -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,5 @@
|
|
|
1
|
-
import { IRpdDataAccessor, RunEntityActionHandlerOptions } from "
|
|
2
|
-
import { ActionHandlerContext } from "
|
|
1
|
+
import { IRpdDataAccessor, RunEntityActionHandlerOptions } from "../types";
|
|
2
|
+
import { ActionHandlerContext } from "../core/actionHandler";
|
|
3
3
|
type DataAccessHandler = (dataAccessor: IRpdDataAccessor, input: any) => Promise<any>;
|
|
4
4
|
export default function runCollectionEntityActionHandler(ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions, code: string, handleDataAccess: DataAccessHandler): Promise<void>;
|
|
5
5
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export * from "./core/http-types";
|
|
|
7
7
|
export * from "./core/actionHandler";
|
|
8
8
|
export * from "./utilities/jwtUtility";
|
|
9
9
|
export * as bootstrapApplicationConfig from "./bootstrapApplicationConfig";
|
|
10
|
-
export { default as MetaManagePlugin } from "./plugins/metaManage/
|
|
11
|
-
export { default as DataManagePlugin } from "./plugins/dataManage/
|
|
12
|
-
export { default as RouteManagePlugin } from "./plugins/routeManage/
|
|
13
|
-
export { default as WebhooksPlugin } from "./plugins/webhooks/
|
|
14
|
-
export { default as AuthPlugin } from "./plugins/auth/
|
|
15
|
-
export { default as FileManagePlugin } from "./plugins/fileManage/
|
|
10
|
+
export { default as MetaManagePlugin } from "./plugins/metaManage/MetaManagePlugin";
|
|
11
|
+
export { default as DataManagePlugin } from "./plugins/dataManage/DataManagePlugin";
|
|
12
|
+
export { default as RouteManagePlugin } from "./plugins/routeManage/RouteManagePlugin";
|
|
13
|
+
export { default as WebhooksPlugin } from "./plugins/webhooks/WebhooksPlugin";
|
|
14
|
+
export { default as AuthPlugin } from "./plugins/auth/AuthPlugin";
|
|
15
|
+
export { default as FileManagePlugin } from "./plugins/fileManage/FileManagePlugin";
|