@ruiapp/rapid-core 0.1.5 → 0.1.6

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.
Files changed (100) hide show
  1. package/dist/bootstrapApplicationConfig.d.ts +1 -1
  2. package/dist/core/{httpHandler.d.ts → actionHandler.d.ts} +4 -5
  3. package/dist/core/pluginManager.d.ts +1 -1
  4. package/dist/core/server.d.ts +5 -5
  5. package/dist/helpers/runCollectionEntityActionHandler.d.ts +5 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +56 -56
  8. package/dist/plugins/auth/actionHandlers/createSession.d.ts +8 -0
  9. package/dist/plugins/auth/actionHandlers/deleteSession.d.ts +4 -0
  10. package/dist/plugins/auth/actionHandlers/getMyProfile.d.ts +4 -0
  11. package/dist/plugins/auth/mod.d.ts +1 -1
  12. package/dist/plugins/auth/routes/getMyProfile.d.ts +1 -1
  13. package/dist/plugins/auth/routes/signin.d.ts +1 -1
  14. package/dist/plugins/auth/routes/signout.d.ts +1 -1
  15. package/dist/plugins/dataManage/actionHandlers/addEntityRelations.d.ts +5 -0
  16. package/dist/plugins/dataManage/actionHandlers/countCollectionEntities.d.ts +5 -0
  17. package/dist/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.d.ts +5 -0
  18. package/dist/plugins/dataManage/actionHandlers/createCollectionEntity.d.ts +5 -0
  19. package/dist/plugins/dataManage/actionHandlers/deleteCollectionEntityById.d.ts +5 -0
  20. package/dist/plugins/dataManage/actionHandlers/findCollectionEntities.d.ts +5 -0
  21. package/dist/plugins/dataManage/actionHandlers/findCollectionEntityById.d.ts +5 -0
  22. package/dist/plugins/dataManage/actionHandlers/queryDatabase.d.ts +5 -0
  23. package/dist/plugins/dataManage/actionHandlers/removeEntityRelations.d.ts +5 -0
  24. package/dist/plugins/dataManage/actionHandlers/updateCollectionEntityById.d.ts +5 -0
  25. package/dist/plugins/dataManage/mod.d.ts +1 -1
  26. package/dist/plugins/fileManage/actionHandlers/downloadDocument.d.ts +4 -0
  27. package/dist/plugins/fileManage/actionHandlers/downloadFile.d.ts +4 -0
  28. package/dist/plugins/fileManage/actionHandlers/uploadFile.d.ts +4 -0
  29. package/dist/plugins/fileManage/mod.d.ts +1 -1
  30. package/dist/plugins/metaManage/actionHandlers/getMetaModelDetail.d.ts +4 -0
  31. package/dist/plugins/metaManage/actionHandlers/listMetaModels.d.ts +4 -0
  32. package/dist/plugins/metaManage/actionHandlers/listMetaRoutes.d.ts +4 -0
  33. package/dist/plugins/metaManage/mod.d.ts +1 -1
  34. package/dist/plugins/routeManage/actionHandlers/httpProxy.d.ts +5 -0
  35. package/dist/plugins/routeManage/mod.d.ts +1 -1
  36. package/dist/plugins/webhooks/mod.d.ts +1 -1
  37. package/dist/server.d.ts +3 -3
  38. package/dist/types.d.ts +3 -3
  39. package/package.json +1 -1
  40. package/src/bootstrapApplicationConfig.ts +6 -6
  41. package/src/core/{httpHandler.ts → actionHandler.ts} +5 -11
  42. package/src/core/pluginManager.ts +3 -3
  43. package/src/core/routesBuilder.ts +4 -4
  44. package/src/core/server.ts +6 -6
  45. package/src/helpers/{runCollectionEntityHttpHandler.ts → runCollectionEntityActionHandler.ts} +5 -5
  46. package/src/index.ts +2 -0
  47. package/src/plugins/auth/{httpHandlers → actionHandlers}/createSession.ts +2 -2
  48. package/src/plugins/auth/{httpHandlers → actionHandlers}/deleteSession.ts +2 -2
  49. package/src/plugins/auth/{httpHandlers → actionHandlers}/getMyProfile.ts +2 -2
  50. package/src/plugins/auth/{httpHandlers → actionHandlers}/index.ts +2 -2
  51. package/src/plugins/auth/mod.ts +4 -4
  52. package/src/plugins/auth/routes/getMyProfile.ts +1 -1
  53. package/src/plugins/auth/routes/signin.ts +1 -1
  54. package/src/plugins/auth/routes/signout.ts +1 -1
  55. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/addEntityRelations.ts +4 -4
  56. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/countCollectionEntities.ts +6 -6
  57. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/createCollectionEntitiesBatch.ts +4 -4
  58. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/createCollectionEntity.ts +4 -4
  59. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/deleteCollectionEntityById.ts +4 -4
  60. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/findCollectionEntities.ts +6 -6
  61. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/findCollectionEntityById.ts +4 -4
  62. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/queryDatabase.ts +2 -2
  63. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/removeEntityRelations.ts +4 -4
  64. package/src/plugins/dataManage/{httpHandlers → actionHandlers}/updateCollectionEntityById.ts +4 -4
  65. package/src/plugins/dataManage/mod.ts +24 -24
  66. package/src/plugins/fileManage/{httpHandlers → actionHandlers}/downloadDocument.ts +2 -2
  67. package/src/plugins/fileManage/{httpHandlers → actionHandlers}/downloadFile.ts +2 -2
  68. package/src/plugins/fileManage/{httpHandlers → actionHandlers}/uploadFile.ts +2 -2
  69. package/src/plugins/fileManage/mod.ts +7 -7
  70. package/src/plugins/metaManage/{httpHandlers → actionHandlers}/getMetaModelDetail.ts +2 -2
  71. package/src/plugins/metaManage/{httpHandlers → actionHandlers}/listMetaModels.ts +2 -2
  72. package/src/plugins/metaManage/{httpHandlers → actionHandlers}/listMetaRoutes.ts +2 -2
  73. package/src/plugins/metaManage/mod.ts +7 -7
  74. package/src/plugins/routeManage/{httpHandlers → actionHandlers}/httpProxy.ts +2 -2
  75. package/src/plugins/routeManage/mod.ts +3 -3
  76. package/src/plugins/webhooks/mod.ts +1 -1
  77. package/src/server.ts +10 -10
  78. package/src/types.ts +3 -3
  79. package/dist/helpers/runCollectionEntityHttpHandler.d.ts +0 -5
  80. package/dist/plugins/auth/httpHandlers/createSession.d.ts +0 -8
  81. package/dist/plugins/auth/httpHandlers/deleteSession.d.ts +0 -4
  82. package/dist/plugins/auth/httpHandlers/getMyProfile.d.ts +0 -4
  83. package/dist/plugins/dataManage/httpHandlers/addEntityRelations.d.ts +0 -5
  84. package/dist/plugins/dataManage/httpHandlers/countCollectionEntities.d.ts +0 -5
  85. package/dist/plugins/dataManage/httpHandlers/createCollectionEntitiesBatch.d.ts +0 -5
  86. package/dist/plugins/dataManage/httpHandlers/createCollectionEntity.d.ts +0 -5
  87. package/dist/plugins/dataManage/httpHandlers/deleteCollectionEntityById.d.ts +0 -5
  88. package/dist/plugins/dataManage/httpHandlers/findCollectionEntities.d.ts +0 -5
  89. package/dist/plugins/dataManage/httpHandlers/findCollectionEntityById.d.ts +0 -5
  90. package/dist/plugins/dataManage/httpHandlers/queryDatabase.d.ts +0 -5
  91. package/dist/plugins/dataManage/httpHandlers/removeEntityRelations.d.ts +0 -5
  92. package/dist/plugins/dataManage/httpHandlers/updateCollectionEntityById.d.ts +0 -5
  93. package/dist/plugins/fileManage/httpHandlers/downloadDocument.d.ts +0 -4
  94. package/dist/plugins/fileManage/httpHandlers/downloadFile.d.ts +0 -4
  95. package/dist/plugins/fileManage/httpHandlers/uploadFile.d.ts +0 -4
  96. package/dist/plugins/metaManage/httpHandlers/getMetaModelDetail.d.ts +0 -4
  97. package/dist/plugins/metaManage/httpHandlers/listMetaModels.d.ts +0 -4
  98. package/dist/plugins/metaManage/httpHandlers/listMetaRoutes.d.ts +0 -4
  99. package/dist/plugins/routeManage/httpHandlers/httpProxy.d.ts +0 -5
  100. /package/dist/plugins/auth/{httpHandlers → actionHandlers}/index.d.ts +0 -0
@@ -282,7 +282,7 @@ declare const _default: {
282
282
  type: "RESTful";
283
283
  method: "GET";
284
284
  endpoint: string;
285
- handlers: {
285
+ actions: {
286
286
  code: string;
287
287
  }[];
288
288
  }[];
@@ -1,7 +1,7 @@
1
1
  import { RpdApplicationConfig } from "~/types";
2
2
  import { IRpdServer, RapidPlugin } from "./server";
3
3
  import { Next, RouteContext } from "./routeContext";
4
- export interface HttpHandlerContext {
4
+ export interface ActionHandlerContext {
5
5
  routerContext: RouteContext;
6
6
  next: Next;
7
7
  server: IRpdServer;
@@ -10,9 +10,8 @@ export interface HttpHandlerContext {
10
10
  output?: any;
11
11
  status?: Response["status"];
12
12
  }
13
- export type PluginHttpHandler = (plugin: RapidPlugin, ctx: HttpHandlerContext, options: any) => void | Promise<void>;
14
- export type HttpRequestHandler = (ctx: HttpHandlerContext, options: any) => void | Promise<void>;
15
- export interface IPluginHttpHandler {
13
+ export type ActionHandler = (ctx: ActionHandlerContext, options: any) => void | Promise<void>;
14
+ export interface IPluginActionHandler {
16
15
  code: string;
17
- handler: PluginHttpHandler;
16
+ handler: (plugin: RapidPlugin, ctx: ActionHandlerContext, options: any) => void | Promise<void>;
18
17
  }
@@ -9,7 +9,7 @@ declare class PluginManager {
9
9
  /** 注册中间件 */
10
10
  registerMiddlewares(): Promise<void>;
11
11
  /** 注册接口动作处理程序 */
12
- registerHttpHandlers(): Promise<void>;
12
+ registerActionHandlers(): Promise<void>;
13
13
  /** 注册事件处理程序 */
14
14
  registerEventHandlers(): Promise<void>;
15
15
  /** 注册消息处理程序 */
@@ -1,5 +1,5 @@
1
1
  import { GetDataAccessorOptions, GetModelOptions, IDatabaseConfig, IQueryBuilder, IRpdDataAccessor, RapidServerConfig, RpdApplicationConfig, RpdDataModel, RpdServerEventTypes } from "~/types";
2
- import { IPluginHttpHandler, HttpRequestHandler } from "./httpHandler";
2
+ import { IPluginActionHandler, ActionHandler } from "./actionHandler";
3
3
  import { Next } from "./routeContext";
4
4
  export interface IRpdServer {
5
5
  config: RapidServerConfig;
@@ -8,8 +8,8 @@ export interface IRpdServer {
8
8
  queryDatabaseObject: (sql: string, params?: unknown[] | Record<string, unknown>) => Promise<any[]>;
9
9
  tryQueryDatabaseObject: (sql: string, params?: unknown[] | Record<string, unknown>) => Promise<any[]>;
10
10
  registerMiddleware(middleware: any): void;
11
- registerHttpHandler(plugin: RapidPlugin, options: IPluginHttpHandler): void;
12
- getHttpHandlerByCode(code: string): HttpRequestHandler | undefined;
11
+ registerActionHandler(plugin: RapidPlugin, options: IPluginActionHandler): void;
12
+ getActionHandlerByCode(code: string): ActionHandler | undefined;
13
13
  getDataAccessor<T = any>(options: GetDataAccessorOptions): IRpdDataAccessor<T>;
14
14
  getApplicationConfig(): RpdApplicationConfig;
15
15
  appendApplicationConfig(config: Partial<RpdApplicationConfig>): any;
@@ -41,7 +41,7 @@ export interface RpdConfigurationItemOptions {
41
41
  */
42
42
  defaultValue?: string;
43
43
  }
44
- export type RpdServerPluginExtendingAbilities = /** 是指提供处理网络请求的middleware的能力。 */ "extendMiddleware" | /** 是指增加系统中的集合的能力。 */ "extendModel" | /** 是指可以对模型增加属性的能力。 */ "extendProperty" | /** 是指增加接口动作的能力。 */ "extendHttpHandler" | /** 是指增加或者修改接口定义的能力。 */ "extendRoute" | /** 是指对实体数据进行标准化的能力。 */ "normalizeEntity" | /** 处理事件总线发送过来的事件的能力。 */ "handleEvent" | /** 处理消息队列发送过来的消息的能力。 */ "handleMessage" | /** 对特定任务进行处理的能力。 */ "processTask";
44
+ export type RpdServerPluginExtendingAbilities = /** 是指提供处理网络请求的middleware的能力。 */ "extendMiddleware" | /** 是指增加系统中的集合的能力。 */ "extendModel" | /** 是指可以对模型增加属性的能力。 */ "extendProperty" | /** 是指增加接口动作的能力。 */ "extendActionHandler" | /** 是指增加或者修改接口定义的能力。 */ "extendRoute" | /** 是指对实体数据进行标准化的能力。 */ "normalizeEntity" | /** 处理事件总线发送过来的事件的能力。 */ "handleEvent" | /** 处理消息队列发送过来的消息的能力。 */ "handleMessage" | /** 对特定任务进行处理的能力。 */ "processTask";
45
45
  export interface RpdServerPluginConfigurableTargetOptions {
46
46
  targetCode: string;
47
47
  configurations: RpdConfigurationItemOptions[];
@@ -62,7 +62,7 @@ export interface RapidPlugin {
62
62
  /** 注册中间件 */
63
63
  registerMiddlewares(server: IRpdServer): Promise<any>;
64
64
  /** 注册接口动作处理程序 */
65
- registerHttpHandlers(server: IRpdServer): Promise<any>;
65
+ registerActionHandlers(server: IRpdServer): Promise<any>;
66
66
  /** 注册事件处理程序 */
67
67
  registerEventHandlers(server: IRpdServer): Promise<any>;
68
68
  /** 注册消息处理程序 */
@@ -0,0 +1,5 @@
1
+ import { IRpdDataAccessor, RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ type DataAccessHandler = (dataAccessor: IRpdDataAccessor, input: any) => Promise<any>;
4
+ export default function runCollectionEntityActionHandler(ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions, code: string, handleDataAccess: DataAccessHandler): Promise<void>;
5
+ export {};
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export * from "./server";
3
3
  export * from "./core/request";
4
4
  export * from "./core/routeContext";
5
5
  export * from "./core/server";
6
+ export * from "./core/http-types";
7
+ export * from "./core/actionHandler";
6
8
  export * from "./utilities/jwtUtility";
7
9
  export * as bootstrapApplicationConfig from "./bootstrapApplicationConfig";
8
10
  export { default as MetaManagePlugin } from "./plugins/metaManage/mod";
package/dist/index.js CHANGED
@@ -465,10 +465,10 @@ class PluginManager {
465
465
  }
466
466
  }
467
467
  /** 注册接口动作处理程序 */
468
- async registerHttpHandlers() {
468
+ async registerActionHandlers() {
469
469
  for (const plugin of this.#plugins) {
470
- if (plugin.registerHttpHandlers) {
471
- await plugin.registerHttpHandlers(this.#server);
470
+ if (plugin.registerActionHandlers) {
471
+ await plugin.registerActionHandlers(this.#server);
472
472
  }
473
473
  }
474
474
  }
@@ -611,8 +611,8 @@ async function buildRoutes(server, applicationConfig) {
611
611
  applicationConfig,
612
612
  input,
613
613
  };
614
- for (const handlerConfig of routeConfig.handlers) {
615
- const handler = server.getHttpHandlerByCode(handlerConfig.code);
614
+ for (const handlerConfig of routeConfig.actions) {
615
+ const handler = server.getActionHandlerByCode(handlerConfig.code);
616
616
  if (!handler) {
617
617
  throw new Error("Unknown handler: " + handlerConfig.code);
618
618
  }
@@ -1299,9 +1299,9 @@ var bootstrapApplicationConfig = {
1299
1299
  required: true,
1300
1300
  },
1301
1301
  {
1302
- name: "handlers",
1303
- code: "handlers",
1304
- columnName: "handlers",
1302
+ name: "actions",
1303
+ code: "actions",
1304
+ columnName: "actions",
1305
1305
  type: "json",
1306
1306
  required: true,
1307
1307
  },
@@ -1316,7 +1316,7 @@ var bootstrapApplicationConfig = {
1316
1316
  type: "RESTful",
1317
1317
  method: "GET",
1318
1318
  endpoint: "/_meta/models",
1319
- handlers: [
1319
+ actions: [
1320
1320
  {
1321
1321
  code: "listMetaModels",
1322
1322
  },
@@ -1329,7 +1329,7 @@ var bootstrapApplicationConfig = {
1329
1329
  type: "RESTful",
1330
1330
  method: "GET",
1331
1331
  endpoint: "/_meta/models/:namespace/:singularCode",
1332
- handlers: [
1332
+ actions: [
1333
1333
  {
1334
1334
  code: "getMetaModelDetail",
1335
1335
  },
@@ -1342,7 +1342,7 @@ var bootstrapApplicationConfig = {
1342
1342
  type: "RESTful",
1343
1343
  method: "GET",
1344
1344
  endpoint: "/_meta/routes",
1345
- handlers: [
1345
+ actions: [
1346
1346
  {
1347
1347
  code: "listMetaRoutes",
1348
1348
  },
@@ -1363,7 +1363,7 @@ class RapidServer {
1363
1363
  #middlewares;
1364
1364
  #bootstrapApplicationConfig;
1365
1365
  #applicationConfig;
1366
- #httpHandlersMapByCode;
1366
+ #actionHandlersMapByCode;
1367
1367
  #databaseAccessor;
1368
1368
  queryBuilder;
1369
1369
  config;
@@ -1375,7 +1375,7 @@ class RapidServer {
1375
1375
  this.#middlewares = [];
1376
1376
  this.#bootstrapApplicationConfig = options.applicationConfig || bootstrapApplicationConfig;
1377
1377
  this.#applicationConfig = {};
1378
- this.#httpHandlersMapByCode = new Map();
1378
+ this.#actionHandlersMapByCode = new Map();
1379
1379
  this.#databaseAccessor = options.databaseAccessor;
1380
1380
  this.queryBuilder = new QueryBuilder({
1381
1381
  dbDefaultSchema: options.databaseConfig.dbDefaultSchema,
@@ -1415,7 +1415,7 @@ class RapidServer {
1415
1415
  const originalRoute = ___namespace.find(this.#applicationConfig.routes, (item) => item.code == route.code);
1416
1416
  if (originalRoute) {
1417
1417
  originalRoute.name = route.name;
1418
- originalRoute.handlers = route.handlers;
1418
+ originalRoute.actions = route.actions;
1419
1419
  }
1420
1420
  else {
1421
1421
  this.#applicationConfig.routes.push(route);
@@ -1423,12 +1423,12 @@ class RapidServer {
1423
1423
  }
1424
1424
  }
1425
1425
  }
1426
- registerHttpHandler(plugin, options) {
1426
+ registerActionHandler(plugin, options) {
1427
1427
  const handler = ___namespace.bind(options.handler, null, plugin);
1428
- this.#httpHandlersMapByCode.set(options.code, handler);
1428
+ this.#actionHandlersMapByCode.set(options.code, handler);
1429
1429
  }
1430
- getHttpHandlerByCode(code) {
1431
- return this.#httpHandlersMapByCode.get(code);
1430
+ getActionHandlerByCode(code) {
1431
+ return this.#actionHandlersMapByCode.get(code);
1432
1432
  }
1433
1433
  registerMiddleware(middleware) {
1434
1434
  this.#middlewares.push(middleware);
@@ -1474,7 +1474,7 @@ class RapidServer {
1474
1474
  await pluginManager.loadPlugins(this.#plugins);
1475
1475
  await pluginManager.initPlugins();
1476
1476
  await pluginManager.registerMiddlewares();
1477
- await pluginManager.registerHttpHandlers();
1477
+ await pluginManager.registerActionHandlers();
1478
1478
  await pluginManager.registerEventHandlers();
1479
1479
  await pluginManager.registerMessageHandlers();
1480
1480
  await pluginManager.registerTaskProcessors();
@@ -2305,10 +2305,10 @@ class MetaManager {
2305
2305
  }
2306
2306
  async registerMiddlewares(server) {
2307
2307
  }
2308
- async registerHttpHandlers(server) {
2309
- server.registerHttpHandler(this, listMetaModels);
2310
- server.registerHttpHandler(this, listMetaRoutes);
2311
- server.registerHttpHandler(this, getMetaModelDetail);
2308
+ async registerActionHandlers(server) {
2309
+ server.registerActionHandler(this, listMetaModels);
2310
+ server.registerActionHandler(this, listMetaRoutes);
2311
+ server.registerActionHandler(this, getMetaModelDetail);
2312
2312
  }
2313
2313
  async registerEventHandlers(server) {
2314
2314
  server.registerEventHandler("entity.create", handleEntityCreateEvent.bind(this, server));
@@ -2596,7 +2596,7 @@ function doNotMergeArray(objValue, srcValue) {
2596
2596
  }
2597
2597
  }
2598
2598
 
2599
- async function runCollectionEntityHttpHandler(ctx, options, code, handleDataAccess) {
2599
+ async function runCollectionEntityActionHandler(ctx, options, code, handleDataAccess) {
2600
2600
  const { server, input } = ctx;
2601
2601
  const { defaultInput, fixedInput } = options;
2602
2602
  console.debug(`Running ${code} handler...`);
@@ -2654,7 +2654,7 @@ function transformFilterWithSubFilters(filter) {
2654
2654
 
2655
2655
  const code$g = "findCollectionEntities";
2656
2656
  async function handler$g(plugin, ctx, options) {
2657
- await runCollectionEntityHttpHandler(ctx, options, code$g, async (dataAccessor, input) => {
2657
+ await runCollectionEntityActionHandler(ctx, options, code$g, async (dataAccessor, input) => {
2658
2658
  input.filters = removeFiltersWithNullValue(input.filters);
2659
2659
  const entities = await findEntities(ctx.server, dataAccessor, input);
2660
2660
  const result = { list: entities };
@@ -2667,7 +2667,7 @@ async function handler$g(plugin, ctx, options) {
2667
2667
  });
2668
2668
  }
2669
2669
 
2670
- var findCollectionEntitiesHttpHandler = /*#__PURE__*/Object.freeze({
2670
+ var findCollectionEntities = /*#__PURE__*/Object.freeze({
2671
2671
  __proto__: null,
2672
2672
  code: code$g,
2673
2673
  handler: handler$g
@@ -2702,7 +2702,7 @@ var findCollectionEntityById = /*#__PURE__*/Object.freeze({
2702
2702
 
2703
2703
  const code$e = "countCollectionEntities";
2704
2704
  async function handler$e(plugin, ctx, options) {
2705
- await runCollectionEntityHttpHandler(ctx, options, code$e, (dataAccessor, input) => {
2705
+ await runCollectionEntityActionHandler(ctx, options, code$e, (dataAccessor, input) => {
2706
2706
  input.filters = removeFiltersWithNullValue(input.filters);
2707
2707
  return dataAccessor.count(input);
2708
2708
  });
@@ -3076,17 +3076,17 @@ class DataManager {
3076
3076
  }
3077
3077
  async registerMiddlewares(server) {
3078
3078
  }
3079
- async registerHttpHandlers(server) {
3080
- server.registerHttpHandler(this, findCollectionEntitiesHttpHandler);
3081
- server.registerHttpHandler(this, findCollectionEntityById);
3082
- server.registerHttpHandler(this, countCollectionEntities);
3083
- server.registerHttpHandler(this, createCollectionEntity);
3084
- server.registerHttpHandler(this, createCollectionEntitiesBatch);
3085
- server.registerHttpHandler(this, updateCollectionEntityById);
3086
- server.registerHttpHandler(this, addEntityRelations);
3087
- server.registerHttpHandler(this, removeEntityRelations);
3088
- server.registerHttpHandler(this, deleteCollectionEntityById);
3089
- server.registerHttpHandler(this, queryDatabase);
3079
+ async registerActionHandlers(server) {
3080
+ server.registerActionHandler(this, findCollectionEntities);
3081
+ server.registerActionHandler(this, findCollectionEntityById);
3082
+ server.registerActionHandler(this, countCollectionEntities);
3083
+ server.registerActionHandler(this, createCollectionEntity);
3084
+ server.registerActionHandler(this, createCollectionEntitiesBatch);
3085
+ server.registerActionHandler(this, updateCollectionEntityById);
3086
+ server.registerActionHandler(this, addEntityRelations);
3087
+ server.registerActionHandler(this, removeEntityRelations);
3088
+ server.registerActionHandler(this, deleteCollectionEntityById);
3089
+ server.registerActionHandler(this, queryDatabase);
3090
3090
  }
3091
3091
  async registerEventHandlers(server) {
3092
3092
  }
@@ -3113,7 +3113,7 @@ class DataManager {
3113
3113
  type: "RESTful",
3114
3114
  method: routeConfig.method,
3115
3115
  endpoint: `/${namespace}/${pluralCode}${routeConfig.endpoint}`,
3116
- handlers: [
3116
+ actions: [
3117
3117
  {
3118
3118
  code: routeConfig.handlerCode,
3119
3119
  config: {
@@ -3219,8 +3219,8 @@ class RouteManager {
3219
3219
  }
3220
3220
  async registerMiddlewares(server) {
3221
3221
  }
3222
- async registerHttpHandlers(server) {
3223
- server.registerHttpHandler(this, httpProxy);
3222
+ async registerActionHandlers(server) {
3223
+ server.registerActionHandler(this, httpProxy);
3224
3224
  }
3225
3225
  async registerEventHandlers(server) {
3226
3226
  // TODO: Should rebuild routes after route configurations changed.
@@ -3377,7 +3377,7 @@ class WebhooksPlugin {
3377
3377
  }
3378
3378
  async registerMiddlewares(server) {
3379
3379
  }
3380
- async registerHttpHandlers(server) {
3380
+ async registerActionHandlers(server) {
3381
3381
  }
3382
3382
  async registerEventHandlers(server) {
3383
3383
  const events = [
@@ -3752,7 +3752,7 @@ var getMyProfile$1 = /*#__PURE__*/Object.freeze({
3752
3752
  handler: handler$3
3753
3753
  });
3754
3754
 
3755
- var pluginHttpHandlers = [
3755
+ var pluginActionHandlers = [
3756
3756
  createSession,
3757
3757
  deleteSession,
3758
3758
  getMyProfile$1,
@@ -3824,7 +3824,7 @@ var getMyProfile = {
3824
3824
  type: "RESTful",
3825
3825
  method: "GET",
3826
3826
  endpoint: "/me",
3827
- handlers: [
3827
+ actions: [
3828
3828
  {
3829
3829
  code: "getMyProfile",
3830
3830
  },
@@ -3838,7 +3838,7 @@ var signin = {
3838
3838
  type: "RESTful",
3839
3839
  method: "POST",
3840
3840
  endpoint: "/signin",
3841
- handlers: [
3841
+ actions: [
3842
3842
  {
3843
3843
  code: "createSession",
3844
3844
  },
@@ -3852,7 +3852,7 @@ var signout = {
3852
3852
  type: "RESTful",
3853
3853
  method: "GET",
3854
3854
  endpoint: "/signout",
3855
- handlers: [
3855
+ actions: [
3856
3856
  {
3857
3857
  code: "deleteSession",
3858
3858
  },
@@ -3888,9 +3888,9 @@ class AuthManager {
3888
3888
  }
3889
3889
  async registerMiddlewares(server) {
3890
3890
  }
3891
- async registerHttpHandlers(server) {
3892
- for (const httpHandler of pluginHttpHandlers) {
3893
- server.registerHttpHandler(this, httpHandler);
3891
+ async registerActionHandlers(server) {
3892
+ for (const actionHandler of pluginActionHandlers) {
3893
+ server.registerActionHandler(this, actionHandler);
3894
3894
  }
3895
3895
  }
3896
3896
  async registerEventHandlers(server) {
@@ -3968,7 +3968,7 @@ async function handler$2(plugin, ctx, options) {
3968
3968
  response.headers.set("Content-Disposition", `attachment; filename="${encodeURIComponent(attachmentFileName)}"`);
3969
3969
  }
3970
3970
 
3971
- var downloadDocumentHttpHandler = /*#__PURE__*/Object.freeze({
3971
+ var downloadDocumentActionHandler = /*#__PURE__*/Object.freeze({
3972
3972
  __proto__: null,
3973
3973
  code: code$2,
3974
3974
  handler: handler$2
@@ -3993,7 +3993,7 @@ async function handler$1(plugin, ctx, options) {
3993
3993
  response.headers.set("Content-Disposition", `attachment; filename="${encodeURIComponent(attachmentFileName)}"`);
3994
3994
  }
3995
3995
 
3996
- var downloadFileHttpHandler = /*#__PURE__*/Object.freeze({
3996
+ var downloadFileActionHandler = /*#__PURE__*/Object.freeze({
3997
3997
  __proto__: null,
3998
3998
  code: code$1,
3999
3999
  handler: handler$1
@@ -4019,7 +4019,7 @@ async function handler(plugin, ctx, options) {
4019
4019
  ctx.output = { ok: true, fileKey };
4020
4020
  }
4021
4021
 
4022
- var uploadFileHttpHandler = /*#__PURE__*/Object.freeze({
4022
+ var uploadFileActionHandler = /*#__PURE__*/Object.freeze({
4023
4023
  __proto__: null,
4024
4024
  code: code,
4025
4025
  handler: handler
@@ -4048,10 +4048,10 @@ class FileManager {
4048
4048
  }
4049
4049
  async registerMiddlewares(server) {
4050
4050
  }
4051
- async registerHttpHandlers(server) {
4052
- server.registerHttpHandler(this, downloadDocumentHttpHandler);
4053
- server.registerHttpHandler(this, downloadFileHttpHandler);
4054
- server.registerHttpHandler(this, uploadFileHttpHandler);
4051
+ async registerActionHandlers(server) {
4052
+ server.registerActionHandler(this, downloadDocumentActionHandler);
4053
+ server.registerActionHandler(this, downloadFileActionHandler);
4054
+ server.registerActionHandler(this, uploadFileActionHandler);
4055
4055
  }
4056
4056
  async registerEventHandlers(server) {
4057
4057
  }
@@ -0,0 +1,8 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export interface UserAccessToken {
4
+ sub: "userAccessToken";
5
+ aud: string;
6
+ }
7
+ export declare const code = "createSession";
8
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "deleteSession";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "getMyProfile";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -11,7 +11,7 @@ declare class AuthManager implements RapidPlugin {
11
11
  get configurations(): RpdConfigurationItemOptions[];
12
12
  initPlugin(server: IRpdServer): Promise<any>;
13
13
  registerMiddlewares(server: IRpdServer): Promise<any>;
14
- registerHttpHandlers(server: IRpdServer): Promise<any>;
14
+ registerActionHandlers(server: IRpdServer): Promise<any>;
15
15
  registerEventHandlers(server: IRpdServer): Promise<any>;
16
16
  registerMessageHandlers(server: IRpdServer): Promise<any>;
17
17
  registerTaskProcessors(server: IRpdServer): Promise<any>;
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  type: "RESTful";
6
6
  method: "GET";
7
7
  endpoint: string;
8
- handlers: {
8
+ actions: {
9
9
  code: string;
10
10
  }[];
11
11
  };
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  type: "RESTful";
6
6
  method: "POST";
7
7
  endpoint: string;
8
- handlers: {
8
+ actions: {
9
9
  code: string;
10
10
  }[];
11
11
  };
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  type: "RESTful";
6
6
  method: "GET";
7
7
  endpoint: string;
8
- handlers: {
8
+ actions: {
9
9
  code: string;
10
10
  }[];
11
11
  };
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "addEntityRelations";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "countCollectionEntities";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "createCollectionEntitiesBatch";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "createCollectionEntity";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "deleteCollectionEntityById";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "findCollectionEntities";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "findCollectionEntityById";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunQueryDatabaseHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "queryDatabase";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunQueryDatabaseHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "removeEntityRelations";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { RunEntityActionHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "updateCollectionEntityById";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions): Promise<void>;
@@ -13,7 +13,7 @@ declare class DataManager implements RapidPlugin {
13
13
  get configurations(): RpdConfigurationItemOptions[];
14
14
  initPlugin(server: IRpdServer): Promise<any>;
15
15
  registerMiddlewares(server: IRpdServer): Promise<any>;
16
- registerHttpHandlers(server: IRpdServer): Promise<any>;
16
+ registerActionHandlers(server: IRpdServer): Promise<any>;
17
17
  registerEventHandlers(server: IRpdServer): Promise<any>;
18
18
  registerMessageHandlers(server: IRpdServer): Promise<any>;
19
19
  registerTaskProcessors(server: IRpdServer): Promise<any>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "downloadDocument";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "downloadFile";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "uploadFile";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -11,7 +11,7 @@ declare class FileManager implements RapidPlugin {
11
11
  get configurations(): RpdConfigurationItemOptions[];
12
12
  initPlugin(server: IRpdServer): Promise<any>;
13
13
  registerMiddlewares(server: IRpdServer): Promise<any>;
14
- registerHttpHandlers(server: IRpdServer): Promise<any>;
14
+ registerActionHandlers(server: IRpdServer): Promise<any>;
15
15
  registerEventHandlers(server: IRpdServer): Promise<any>;
16
16
  registerMessageHandlers(server: IRpdServer): Promise<any>;
17
17
  registerTaskProcessors(server: IRpdServer): Promise<any>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "getMetaModelDetail";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "listMetaModels";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
+ import { RapidPlugin } from "~/core/server";
3
+ export declare const code = "listMetaRoutes";
4
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
@@ -11,7 +11,7 @@ declare class MetaManager implements RapidPlugin {
11
11
  get configurations(): RpdConfigurationItemOptions[];
12
12
  initPlugin(server: IRpdServer): Promise<any>;
13
13
  registerMiddlewares(server: IRpdServer): Promise<any>;
14
- registerHttpHandlers(server: IRpdServer): Promise<any>;
14
+ registerActionHandlers(server: IRpdServer): Promise<any>;
15
15
  registerEventHandlers(server: IRpdServer): Promise<any>;
16
16
  registerMessageHandlers(server: IRpdServer): Promise<any>;
17
17
  registerTaskProcessors(server: IRpdServer): Promise<any>;
@@ -0,0 +1,5 @@
1
+ import { RunProxyHandlerOptions } from "~/types";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
+ import { RapidPlugin } from "~/core/server";
4
+ export declare const code = "httpProxy";
5
+ export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunProxyHandlerOptions): Promise<void>;
@@ -11,7 +11,7 @@ declare class RouteManager implements RapidPlugin {
11
11
  get configurations(): RpdConfigurationItemOptions[];
12
12
  initPlugin(server: IRpdServer): Promise<any>;
13
13
  registerMiddlewares(server: IRpdServer): Promise<any>;
14
- registerHttpHandlers(server: IRpdServer): Promise<any>;
14
+ registerActionHandlers(server: IRpdServer): Promise<any>;
15
15
  registerEventHandlers(server: IRpdServer): Promise<any>;
16
16
  registerMessageHandlers(server: IRpdServer): Promise<any>;
17
17
  registerTaskProcessors(server: IRpdServer): Promise<any>;
@@ -23,7 +23,7 @@ declare class WebhooksPlugin implements RapidPlugin {
23
23
  get configurations(): RpdConfigurationItemOptions[];
24
24
  initPlugin(server: IRpdServer): Promise<any>;
25
25
  registerMiddlewares(server: IRpdServer): Promise<any>;
26
- registerHttpHandlers(server: IRpdServer): Promise<any>;
26
+ registerActionHandlers(server: IRpdServer): Promise<any>;
27
27
  registerEventHandlers(server: IRpdServer): Promise<any>;
28
28
  registerMessageHandlers(server: IRpdServer): Promise<any>;
29
29
  registerTaskProcessors(server: IRpdServer): Promise<any>;