@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
@@ -9,19 +9,19 @@ import {
9
9
  RpdApplicationConfig,
10
10
  RpdHttpMethod,
11
11
  RpdRoute,
12
- RunEntityHttpHandlerOptions,
12
+ RunEntityActionHandlerOptions,
13
13
  } from "~/types";
14
14
 
15
- import * as findCollectionEntitiesHttpHandler from "./httpHandlers/findCollectionEntities";
16
- import * as findCollectionEntityById from "./httpHandlers/findCollectionEntityById";
17
- import * as countCollectionEntities from "./httpHandlers/countCollectionEntities";
18
- import * as createCollectionEntity from "./httpHandlers/createCollectionEntity";
19
- import * as createCollectionEntitiesBatch from "./httpHandlers/createCollectionEntitiesBatch";
20
- import * as updateCollectionEntityById from "./httpHandlers/updateCollectionEntityById";
21
- import * as deleteCollectionEntityById from "./httpHandlers/deleteCollectionEntityById";
22
- import * as addEntityRelations from "./httpHandlers/addEntityRelations";
23
- import * as removeEntityRelations from "./httpHandlers/removeEntityRelations";
24
- import * as queryDatabase from "./httpHandlers/queryDatabase";
15
+ import * as findCollectionEntities from "./actionHandlers/findCollectionEntities";
16
+ import * as findCollectionEntityById from "./actionHandlers/findCollectionEntityById";
17
+ import * as countCollectionEntities from "./actionHandlers/countCollectionEntities";
18
+ import * as createCollectionEntity from "./actionHandlers/createCollectionEntity";
19
+ import * as createCollectionEntitiesBatch from "./actionHandlers/createCollectionEntitiesBatch";
20
+ import * as updateCollectionEntityById from "./actionHandlers/updateCollectionEntityById";
21
+ import * as deleteCollectionEntityById from "./actionHandlers/deleteCollectionEntityById";
22
+ import * as addEntityRelations from "./actionHandlers/addEntityRelations";
23
+ import * as removeEntityRelations from "./actionHandlers/removeEntityRelations";
24
+ import * as queryDatabase from "./actionHandlers/queryDatabase";
25
25
  import { RpdServerPluginExtendingAbilities, RpdServerPluginConfigurableTargetOptions, RpdConfigurationItemOptions, IRpdServer, RapidPlugin } from "~/core/server";
26
26
 
27
27
 
@@ -114,17 +114,17 @@ class DataManager implements RapidPlugin {
114
114
  async registerMiddlewares(server: IRpdServer): Promise<any> {
115
115
  }
116
116
 
117
- async registerHttpHandlers(server: IRpdServer): Promise<any> {
118
- server.registerHttpHandler(this, findCollectionEntitiesHttpHandler);
119
- server.registerHttpHandler(this, findCollectionEntityById);
120
- server.registerHttpHandler(this, countCollectionEntities);
121
- server.registerHttpHandler(this, createCollectionEntity);
122
- server.registerHttpHandler(this, createCollectionEntitiesBatch);
123
- server.registerHttpHandler(this, updateCollectionEntityById);
124
- server.registerHttpHandler(this, addEntityRelations);
125
- server.registerHttpHandler(this, removeEntityRelations);
126
- server.registerHttpHandler(this, deleteCollectionEntityById);
127
- server.registerHttpHandler(this, queryDatabase);
117
+ async registerActionHandlers(server: IRpdServer): Promise<any> {
118
+ server.registerActionHandler(this, findCollectionEntities);
119
+ server.registerActionHandler(this, findCollectionEntityById);
120
+ server.registerActionHandler(this, countCollectionEntities);
121
+ server.registerActionHandler(this, createCollectionEntity);
122
+ server.registerActionHandler(this, createCollectionEntitiesBatch);
123
+ server.registerActionHandler(this, updateCollectionEntityById);
124
+ server.registerActionHandler(this, addEntityRelations);
125
+ server.registerActionHandler(this, removeEntityRelations);
126
+ server.registerActionHandler(this, deleteCollectionEntityById);
127
+ server.registerActionHandler(this, queryDatabase);
128
128
  }
129
129
 
130
130
  async registerEventHandlers(server: IRpdServer): Promise<any> {
@@ -160,13 +160,13 @@ class DataManager implements RapidPlugin {
160
160
  type: "RESTful",
161
161
  method: routeConfig.method,
162
162
  endpoint: `/${namespace}/${pluralCode}${routeConfig.endpoint}`,
163
- handlers: [
163
+ actions: [
164
164
  {
165
165
  code: routeConfig.handlerCode,
166
166
  config: {
167
167
  namespace,
168
168
  singularCode,
169
- } as RunEntityHttpHandlerOptions,
169
+ } as RunEntityActionHandlerOptions,
170
170
  },
171
171
  ],
172
172
  });
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
2
+ import { ActionHandlerContext } from "~/core/actionHandler";
3
3
  import { RapidPlugin } from "~/core/server";
4
4
  import { readFile } from "~/utilities/fsUtility";
5
5
 
@@ -7,7 +7,7 @@ export const code = "downloadDocument";
7
7
 
8
8
  export async function handler(
9
9
  plugin: RapidPlugin,
10
- ctx: HttpHandlerContext,
10
+ ctx: ActionHandlerContext,
11
11
  options: any,
12
12
  ) {
13
13
  const { server, applicationConfig, routerContext, input } = ctx;
@@ -1,13 +1,13 @@
1
1
  import path from "path";
2
2
  import { readFile } from "~/utilities/fsUtility";
3
- import { HttpHandlerContext } from "~/core/httpHandler";
3
+ import { ActionHandlerContext } from "~/core/actionHandler";
4
4
  import { RapidPlugin } from "~/core/server";
5
5
 
6
6
  export const code = "downloadFile";
7
7
 
8
8
  export async function handler(
9
9
  plugin: RapidPlugin,
10
- ctx: HttpHandlerContext,
10
+ ctx: ActionHandlerContext,
11
11
  options: any,
12
12
  ) {
13
13
  const { server, applicationConfig, routerContext, input } = ctx;
@@ -1,6 +1,6 @@
1
1
  import { v1 as uuidv1 } from "uuid";
2
2
  import { appendFile } from "~/utilities/fsUtility";
3
- import { HttpHandlerContext } from "~/core/httpHandler";
3
+ import { ActionHandlerContext } from "~/core/actionHandler";
4
4
  import path from "path";
5
5
  import { isArray } from "lodash";
6
6
  import { RapidPlugin } from "~/core/server";
@@ -9,7 +9,7 @@ export const code = "uploadFile";
9
9
 
10
10
  export async function handler(
11
11
  plugin: RapidPlugin,
12
- ctx: HttpHandlerContext,
12
+ ctx: ActionHandlerContext,
13
13
  options: any,
14
14
  ) {
15
15
  const { server, applicationConfig, routerContext, input } = ctx;
@@ -6,9 +6,9 @@ import {
6
6
  RpdApplicationConfig,
7
7
  } from "~/types";
8
8
 
9
- import * as downloadDocumentHttpHandler from "./httpHandlers/downloadDocument";
10
- import * as downloadFileHttpHandler from "./httpHandlers/downloadFile";
11
- import * as uploadFileHttpHandler from "./httpHandlers/uploadFile";
9
+ import * as downloadDocumentActionHandler from "./actionHandlers/downloadDocument";
10
+ import * as downloadFileActionHandler from "./actionHandlers/downloadFile";
11
+ import * as uploadFileActionHandler from "./actionHandlers/uploadFile";
12
12
  import { IRpdServer, RapidPlugin, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "~/core/server";
13
13
 
14
14
 
@@ -39,10 +39,10 @@ class FileManager implements RapidPlugin {
39
39
  async registerMiddlewares(server: IRpdServer): Promise<any> {
40
40
  }
41
41
 
42
- async registerHttpHandlers(server: IRpdServer): Promise<any> {
43
- server.registerHttpHandler(this, downloadDocumentHttpHandler);
44
- server.registerHttpHandler(this, downloadFileHttpHandler);
45
- server.registerHttpHandler(this, uploadFileHttpHandler);
42
+ async registerActionHandlers(server: IRpdServer): Promise<any> {
43
+ server.registerActionHandler(this, downloadDocumentActionHandler);
44
+ server.registerActionHandler(this, downloadFileActionHandler);
45
+ server.registerActionHandler(this, uploadFileActionHandler);
46
46
  }
47
47
 
48
48
  async registerEventHandlers(server: IRpdServer): Promise<any> {
@@ -1,11 +1,11 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
2
  import { RapidPlugin } from "~/core/server";
3
3
 
4
4
  export const code = "getMetaModelDetail";
5
5
 
6
6
  export async function handler(
7
7
  plugin: RapidPlugin,
8
- ctx: HttpHandlerContext,
8
+ ctx: ActionHandlerContext,
9
9
  options: any,
10
10
  ) {
11
11
  const { server, input } = ctx;
@@ -1,11 +1,11 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
2
  import { RapidPlugin } from "~/core/server";
3
3
 
4
4
  export const code = "listMetaModels";
5
5
 
6
6
  export async function handler(
7
7
  plugin: RapidPlugin,
8
- ctx: HttpHandlerContext,
8
+ ctx: ActionHandlerContext,
9
9
  options: any,
10
10
  ) {
11
11
  const { applicationConfig } = ctx;
@@ -1,11 +1,11 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
1
+ import { ActionHandlerContext } from "~/core/actionHandler";
2
2
  import { RapidPlugin } from "~/core/server";
3
3
 
4
4
  export const code = "listMetaRoutes";
5
5
 
6
6
  export async function handler(
7
7
  plugin: RapidPlugin,
8
- ctx: HttpHandlerContext,
8
+ ctx: ActionHandlerContext,
9
9
  options: any,
10
10
  ) {
11
11
  const { applicationConfig } = ctx;
@@ -17,9 +17,9 @@ import {
17
17
  } from "~/types";
18
18
  import { IRpdServer, RapidPlugin, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "~/core/server";
19
19
 
20
- import * as listMetaModels from "./httpHandlers/listMetaModels";
21
- import * as listMetaRoutes from "./httpHandlers/listMetaRoutes";
22
- import * as getMetaModelDetail from "./httpHandlers/getMetaModelDetail";
20
+ import * as listMetaModels from "./actionHandlers/listMetaModels";
21
+ import * as listMetaRoutes from "./actionHandlers/listMetaRoutes";
22
+ import * as getMetaModelDetail from "./actionHandlers/getMetaModelDetail";
23
23
  import { isRelationProperty } from "~/utilities/rapidUtility";
24
24
 
25
25
  class MetaManager implements RapidPlugin {
@@ -49,10 +49,10 @@ class MetaManager implements RapidPlugin {
49
49
  async registerMiddlewares(server: IRpdServer): Promise<any> {
50
50
  }
51
51
 
52
- async registerHttpHandlers(server: IRpdServer): Promise<any> {
53
- server.registerHttpHandler(this, listMetaModels);
54
- server.registerHttpHandler(this, listMetaRoutes);
55
- server.registerHttpHandler(this, getMetaModelDetail);
52
+ async registerActionHandlers(server: IRpdServer): Promise<any> {
53
+ server.registerActionHandler(this, listMetaModels);
54
+ server.registerActionHandler(this, listMetaRoutes);
55
+ server.registerActionHandler(this, getMetaModelDetail);
56
56
  }
57
57
 
58
58
  async registerEventHandlers(server: IRpdServer): Promise<any> {
@@ -1,13 +1,13 @@
1
1
  import { RunProxyHandlerOptions } from "~/types";
2
2
  import { doProxy } from "~/proxy/mod";
3
- import { HttpHandlerContext } from "~/core/httpHandler";
3
+ import { ActionHandlerContext } from "~/core/actionHandler";
4
4
  import { RapidPlugin } from "~/core/server";
5
5
 
6
6
  export const code = "httpProxy";
7
7
 
8
8
  export async function handler(
9
9
  plugin: RapidPlugin,
10
- ctx: HttpHandlerContext,
10
+ ctx: ActionHandlerContext,
11
11
  options: RunProxyHandlerOptions,
12
12
  ) {
13
13
  console.debug(`Running ${code} handler...`);
@@ -7,7 +7,7 @@ import {
7
7
  } from "~/types";
8
8
  import { RpdServerPluginExtendingAbilities, RpdServerPluginConfigurableTargetOptions, RpdConfigurationItemOptions, IRpdServer, RapidPlugin } from "~/core/server";
9
9
  import { findEntities } from "../../dataAccess/entityManager";
10
- import * as httpProxy from "./httpHandlers/httpProxy";
10
+ import * as httpProxy from "./actionHandlers/httpProxy";
11
11
 
12
12
 
13
13
  class RouteManager implements RapidPlugin {
@@ -37,8 +37,8 @@ class RouteManager implements RapidPlugin {
37
37
  async registerMiddlewares(server: IRpdServer): Promise<any> {
38
38
  }
39
39
 
40
- async registerHttpHandlers(server: IRpdServer): Promise<any> {
41
- server.registerHttpHandler(this, httpProxy);
40
+ async registerActionHandlers(server: IRpdServer): Promise<any> {
41
+ server.registerActionHandler(this, httpProxy);
42
42
  }
43
43
 
44
44
  async registerEventHandlers(server: IRpdServer): Promise<any> {
@@ -81,7 +81,7 @@ class WebhooksPlugin implements RapidPlugin {
81
81
  async registerMiddlewares(server: IRpdServer): Promise<any> {
82
82
  }
83
83
 
84
- async registerHttpHandlers(server: IRpdServer): Promise<any> {
84
+ async registerActionHandlers(server: IRpdServer): Promise<any> {
85
85
  }
86
86
 
87
87
  async registerEventHandlers(server: IRpdServer): Promise<any> {
package/src/server.ts CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  import QueryBuilder from "./queryBuilder/queryBuilder";
17
17
  import PluginManager from "./core/pluginManager";
18
18
  import EventManager from "./core/eventManager";
19
- import { HttpRequestHandler, IPluginHttpHandler } from "./core/httpHandler";
19
+ import { ActionHandler, IPluginActionHandler } from "./core/actionHandler";
20
20
  import { IRpdServer, RapidPlugin } from "./core/server";
21
21
  import { buildRoutes } from "./core/routesBuilder";
22
22
  import { Next, RouteContext } from "./core/routeContext";
@@ -38,7 +38,7 @@ export class RapidServer implements IRpdServer {
38
38
  #middlewares: any[];
39
39
  #bootstrapApplicationConfig: RpdApplicationConfig;
40
40
  #applicationConfig: RpdApplicationConfig;
41
- #httpHandlersMapByCode: Map<string, HttpRequestHandler>;
41
+ #actionHandlersMapByCode: Map<string, ActionHandler>;
42
42
  #databaseAccessor: IDatabaseAccessor;
43
43
  queryBuilder: IQueryBuilder;
44
44
  config: RapidServerConfig;
@@ -52,7 +52,7 @@ export class RapidServer implements IRpdServer {
52
52
  this.#bootstrapApplicationConfig = options.applicationConfig || bootstrapApplicationConfig;
53
53
 
54
54
  this.#applicationConfig = {} as RpdApplicationConfig;
55
- this.#httpHandlersMapByCode = new Map();
55
+ this.#actionHandlersMapByCode = new Map();
56
56
  this.#databaseAccessor = options.databaseAccessor;
57
57
 
58
58
  this.queryBuilder = new QueryBuilder({
@@ -95,7 +95,7 @@ export class RapidServer implements IRpdServer {
95
95
  const originalRoute = _.find(this.#applicationConfig.routes, (item) => item.code == route.code);
96
96
  if (originalRoute) {
97
97
  originalRoute.name = route.name;
98
- originalRoute.handlers = route.handlers;
98
+ originalRoute.actions = route.actions;
99
99
  } else {
100
100
  this.#applicationConfig.routes.push(route);
101
101
  }
@@ -103,16 +103,16 @@ export class RapidServer implements IRpdServer {
103
103
  }
104
104
  }
105
105
 
106
- registerHttpHandler(
106
+ registerActionHandler(
107
107
  plugin: RapidPlugin,
108
- options: IPluginHttpHandler,
108
+ options: IPluginActionHandler,
109
109
  ) {
110
110
  const handler = _.bind(options.handler, null, plugin);
111
- this.#httpHandlersMapByCode.set(options.code, handler);
111
+ this.#actionHandlersMapByCode.set(options.code, handler);
112
112
  }
113
113
 
114
- getHttpHandlerByCode(code: string) {
115
- return this.#httpHandlersMapByCode.get(code);
114
+ getActionHandlerByCode(code: string) {
115
+ return this.#actionHandlersMapByCode.get(code);
116
116
  }
117
117
 
118
118
  registerMiddleware(middleware: any) {
@@ -178,7 +178,7 @@ export class RapidServer implements IRpdServer {
178
178
  await pluginManager.initPlugins();
179
179
 
180
180
  await pluginManager.registerMiddlewares();
181
- await pluginManager.registerHttpHandlers();
181
+ await pluginManager.registerActionHandlers();
182
182
  await pluginManager.registerEventHandlers();
183
183
  await pluginManager.registerMessageHandlers();
184
184
  await pluginManager.registerTaskProcessors();
package/src/types.ts CHANGED
@@ -22,7 +22,7 @@ export interface IDatabaseAccessor {
22
22
  }
23
23
 
24
24
 
25
- export interface RunEntityHttpHandlerOptions {
25
+ export interface RunEntityActionHandlerOptions {
26
26
  /** 模型所在的命名空间 */
27
27
  namespace: string;
28
28
  /** 模型Code的单数表示 */
@@ -298,12 +298,12 @@ export interface RpdRoute {
298
298
  type: "RESTful";
299
299
  method: RpdHttpMethod;
300
300
  endpoint: string;
301
- handlers: RpdHttpHandler[];
301
+ actions: RpdRouteActionConfig[];
302
302
  }
303
303
 
304
304
  export type RpdHttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
305
305
 
306
- export interface RpdHttpHandler {
306
+ export interface RpdRouteActionConfig {
307
307
  code: string;
308
308
  config?: any;
309
309
  }
@@ -1,5 +0,0 @@
1
- import { IRpdDataAccessor, RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- type DataAccessHandler = (dataAccessor: IRpdDataAccessor, input: any) => Promise<any>;
4
- export default function runCollectionEntityHttpHandler(ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions, code: string, handleDataAccess: DataAccessHandler): Promise<void>;
5
- export {};
@@ -1,8 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
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: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "deleteSession";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "getMyProfile";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "addEntityRelations";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "countCollectionEntities";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "createCollectionEntitiesBatch";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "createCollectionEntity";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "deleteCollectionEntityById";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "findCollectionEntities";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "findCollectionEntityById";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunQueryDatabaseHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "queryDatabase";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunQueryDatabaseHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "removeEntityRelations";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunEntityHttpHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "updateCollectionEntityById";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "downloadDocument";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "downloadFile";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "uploadFile";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "getMetaModelDetail";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "listMetaModels";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,4 +0,0 @@
1
- import { HttpHandlerContext } from "~/core/httpHandler";
2
- import { RapidPlugin } from "~/core/server";
3
- export declare const code = "listMetaRoutes";
4
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: any): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { RunProxyHandlerOptions } from "~/types";
2
- import { HttpHandlerContext } from "~/core/httpHandler";
3
- import { RapidPlugin } from "~/core/server";
4
- export declare const code = "httpProxy";
5
- export declare function handler(plugin: RapidPlugin, ctx: HttpHandlerContext, options: RunProxyHandlerOptions): Promise<void>;