@ruiapp/rapid-core 0.0.1
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/bootstrapApplicationConfig.d.ts +3 -0
- package/dist/core/eventManager.d.ts +7 -0
- package/dist/core/http-types.d.ts +3 -0
- package/dist/core/httpHandler.d.ts +18 -0
- package/dist/core/plugin.d.ts +6 -0
- package/dist/core/pluginManager.d.ts +27 -0
- package/dist/core/request.d.ts +15 -0
- package/dist/core/response.d.ts +17 -0
- package/dist/core/routeContext.d.ts +17 -0
- package/dist/core/routesBuilder.d.ts +4 -0
- package/dist/core/server.d.ts +83 -0
- package/dist/dataAccess/dataAccessor.d.ts +20 -0
- package/dist/dataAccess/entityManager.d.ts +6 -0
- package/dist/dataAccess/entityMapper.d.ts +3 -0
- package/dist/dataAccess/filterHelper.d.ts +2 -0
- package/dist/dataAccess/propertyMapper.d.ts +3 -0
- package/dist/deno-std/assert/assert.d.ts +2 -0
- package/dist/deno-std/assert/assertion_error.d.ts +4 -0
- package/dist/deno-std/datetime/to_imf.d.ts +17 -0
- package/dist/deno-std/http/cookie.d.ts +134 -0
- package/dist/helpers/entityHelpers.d.ts +1 -0
- package/dist/helpers/inputHelper.d.ts +1 -0
- package/dist/helpers/runCollectionEntityHttpHandler.d.ts +5 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3590 -0
- package/dist/plugins/authManager/httpHandlers/createSession.d.ts +8 -0
- package/dist/plugins/authManager/httpHandlers/deleteSession.d.ts +4 -0
- package/dist/plugins/authManager/httpHandlers/getMyProfile.d.ts +4 -0
- package/dist/plugins/authManager/httpHandlers/index.d.ts +5 -0
- package/dist/plugins/authManager/mod.d.ts +16 -0
- package/dist/plugins/authManager/models/AccessToken.d.ts +3 -0
- package/dist/plugins/authManager/models/index.d.ts +2 -0
- package/dist/plugins/authManager/routes/getMyProfile.d.ts +3 -0
- package/dist/plugins/authManager/routes/index.d.ts +2 -0
- package/dist/plugins/authManager/routes/signin.d.ts +3 -0
- package/dist/plugins/authManager/routes/signout.d.ts +3 -0
- package/dist/plugins/dataManager/httpHandlers/addEntityRelations.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/countCollectionEntities.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/createCollectionEntitiesBatch.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/createCollectionEntity.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/deleteCollectionEntityById.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/findCollectionEntities.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/findCollectionEntityById.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/queryDatabase.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/removeEntityRelations.d.ts +4 -0
- package/dist/plugins/dataManager/httpHandlers/updateCollectionEntityById.d.ts +4 -0
- package/dist/plugins/dataManager/mod.d.ts +16 -0
- package/dist/plugins/metaManager/httpHandlers/getMetaModelDetail.d.ts +4 -0
- package/dist/plugins/metaManager/httpHandlers/listMetaModels.d.ts +4 -0
- package/dist/plugins/metaManager/mod.d.ts +15 -0
- package/dist/plugins/routeManager/httpHandlers/httpProxy.d.ts +4 -0
- package/dist/plugins/routeManager/httpHandlers/listMetaRoutes.d.ts +4 -0
- package/dist/plugins/routeManager/mod.d.ts +15 -0
- package/dist/plugins/webhooks/mod.d.ts +24 -0
- package/dist/plugins/webhooks/pluginConfig.d.ts +48 -0
- package/dist/polyfill.d.ts +1 -0
- package/dist/proxy/mod.d.ts +13 -0
- package/dist/proxy/types.d.ts +17 -0
- package/dist/queryBuilder/index.d.ts +1 -0
- package/dist/queryBuilder/queryBuilder.d.ts +34 -0
- package/dist/server.d.ts +31 -0
- package/dist/types.d.ts +327 -0
- package/dist/utilities/httpUtility.d.ts +1 -0
- package/dist/utilities/jwtUtility.d.ts +8 -0
- package/dist/utilities/rapidUtility.d.ts +2 -0
- package/dist/utilities/typeUtility.d.ts +3 -0
- package/package.json +29 -0
- package/rollup.config.js +20 -0
- package/src/bootstrapApplicationConfig.ts +524 -0
- package/src/core/eventManager.ts +21 -0
- package/src/core/http-types.ts +4 -0
- package/src/core/httpHandler.ts +29 -0
- package/src/core/plugin.ts +13 -0
- package/src/core/pluginManager.ts +143 -0
- package/src/core/request.ts +23 -0
- package/src/core/response.ts +77 -0
- package/src/core/routeContext.ts +38 -0
- package/src/core/routesBuilder.ts +86 -0
- package/src/core/server.ts +144 -0
- package/src/dataAccess/dataAccessor.ts +110 -0
- package/src/dataAccess/entityManager.ts +651 -0
- package/src/dataAccess/entityMapper.ts +74 -0
- package/src/dataAccess/filterHelper.ts +47 -0
- package/src/dataAccess/propertyMapper.ts +27 -0
- package/src/deno-std/assert/assert.ts +9 -0
- package/src/deno-std/assert/assertion_error.ts +7 -0
- package/src/deno-std/datetime/to_imf.ts +47 -0
- package/src/deno-std/http/cookie.ts +398 -0
- package/src/helpers/entityHelpers.ts +24 -0
- package/src/helpers/inputHelper.ts +11 -0
- package/src/helpers/runCollectionEntityHttpHandler.ts +34 -0
- package/src/index.ts +12 -0
- package/src/plugins/authManager/httpHandlers/createSession.ts +57 -0
- package/src/plugins/authManager/httpHandlers/deleteSession.ts +22 -0
- package/src/plugins/authManager/httpHandlers/getMyProfile.ts +43 -0
- package/src/plugins/authManager/httpHandlers/index.ts +10 -0
- package/src/plugins/authManager/mod.ts +56 -0
- package/src/plugins/authManager/models/AccessToken.ts +56 -0
- package/src/plugins/authManager/models/index.ts +5 -0
- package/src/plugins/authManager/routes/getMyProfile.ts +15 -0
- package/src/plugins/authManager/routes/index.ts +9 -0
- package/src/plugins/authManager/routes/signin.ts +15 -0
- package/src/plugins/authManager/routes/signout.ts +15 -0
- package/src/plugins/dataManager/httpHandlers/addEntityRelations.ts +76 -0
- package/src/plugins/dataManager/httpHandlers/countCollectionEntities.ts +22 -0
- package/src/plugins/dataManager/httpHandlers/createCollectionEntitiesBatch.ts +57 -0
- package/src/plugins/dataManager/httpHandlers/createCollectionEntity.ts +43 -0
- package/src/plugins/dataManager/httpHandlers/deleteCollectionEntityById.ts +38 -0
- package/src/plugins/dataManager/httpHandlers/findCollectionEntities.ts +35 -0
- package/src/plugins/dataManager/httpHandlers/findCollectionEntityById.ts +30 -0
- package/src/plugins/dataManager/httpHandlers/queryDatabase.ts +29 -0
- package/src/plugins/dataManager/httpHandlers/removeEntityRelations.ts +72 -0
- package/src/plugins/dataManager/httpHandlers/updateCollectionEntityById.ts +53 -0
- package/src/plugins/dataManager/mod.ts +150 -0
- package/src/plugins/metaManager/httpHandlers/getMetaModelDetail.ts +14 -0
- package/src/plugins/metaManager/httpHandlers/listMetaModels.ts +13 -0
- package/src/plugins/metaManager/mod.ts +419 -0
- package/src/plugins/routeManager/httpHandlers/httpProxy.ts +15 -0
- package/src/plugins/routeManager/httpHandlers/listMetaRoutes.ts +13 -0
- package/src/plugins/routeManager/mod.ts +97 -0
- package/src/plugins/webhooks/mod.ts +144 -0
- package/src/plugins/webhooks/pluginConfig.ts +74 -0
- package/src/polyfill.ts +5 -0
- package/src/proxy/mod.ts +47 -0
- package/src/proxy/types.ts +21 -0
- package/src/queryBuilder/index.ts +1 -0
- package/src/queryBuilder/queryBuilder.ts +424 -0
- package/src/server.ts +192 -0
- package/src/types.ts +438 -0
- package/src/utilities/httpUtility.ts +23 -0
- package/src/utilities/jwtUtility.ts +16 -0
- package/src/utilities/rapidUtility.ts +5 -0
- package/src/utilities/typeUtility.ts +11 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPluginInstance } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export interface UserAccessToken {
|
|
4
|
+
sub: "userAccessToken";
|
|
5
|
+
aud: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const code = "createSession";
|
|
8
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: any): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as createSession from "./createSession";
|
|
2
|
+
import * as deleteSession from "./deleteSession";
|
|
3
|
+
import * as getMyProfile from "./getMyProfile";
|
|
4
|
+
declare const _default: (typeof createSession | typeof deleteSession | typeof getMyProfile)[];
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta manager plugin
|
|
3
|
+
*/
|
|
4
|
+
import { IPluginInstance, RpdApplicationConfig } from "~/types";
|
|
5
|
+
import { IRpdServer, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "~/core/server";
|
|
6
|
+
export declare const code = "authManager";
|
|
7
|
+
export declare const description = "authManager";
|
|
8
|
+
export declare const extendingAbilities: RpdServerPluginExtendingAbilities[];
|
|
9
|
+
export declare const configurableTargets: RpdServerPluginConfigurableTargetOptions[];
|
|
10
|
+
export declare const configurations: RpdConfigurationItemOptions[];
|
|
11
|
+
export declare function initPlugin(plugin: IPluginInstance, server: IRpdServer): Promise<void>;
|
|
12
|
+
export declare function registerHttpHandlers(server: IRpdServer): Promise<void>;
|
|
13
|
+
export declare function registerEventHandlers(server: IRpdServer): Promise<void>;
|
|
14
|
+
export declare function configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
15
|
+
export declare function configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
16
|
+
export declare function onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "addEntityRelations";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "countCollectionEntities";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "createCollectionEntitiesBatch";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "createCollectionEntity";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "deleteCollectionEntityById";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "findCollectionEntities";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "findCollectionEntityById";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunQueryDatabaseHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "queryDatabase";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunQueryDatabaseHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "removeEntityRelations";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunEntityHttpHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "updateCollectionEntityById";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunEntityHttpHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Support manage data in database.
|
|
3
|
+
* This plugin provide:
|
|
4
|
+
* - routes for manage data in database.
|
|
5
|
+
*/
|
|
6
|
+
import { IPluginInstance, RpdApplicationConfig } from "~/types";
|
|
7
|
+
import { RpdServerPluginExtendingAbilities, RpdServerPluginConfigurableTargetOptions, RpdConfigurationItemOptions, IRpdServer } from "~/core/server";
|
|
8
|
+
export declare const code = "dataManager";
|
|
9
|
+
export declare const description = "\u5BF9\u6570\u636E\u8FDB\u884C\u7BA1\u7406\uFF0C\u63D0\u4F9B\u589E\u5220\u6539\u67E5\u7B49\u63A5\u53E3\u3002";
|
|
10
|
+
export declare const extendingAbilities: RpdServerPluginExtendingAbilities[];
|
|
11
|
+
export declare const configurableTargets: RpdServerPluginConfigurableTargetOptions[];
|
|
12
|
+
export declare const configurations: RpdConfigurationItemOptions[];
|
|
13
|
+
export declare function initPlugin(plugin: IPluginInstance, server: IRpdServer): Promise<void>;
|
|
14
|
+
export declare function registerHttpHandlers(server: IRpdServer): Promise<void>;
|
|
15
|
+
export declare function configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
16
|
+
export declare function onApplicationLoaded(server: IRpdServer, application: RpdApplicationConfig): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta manager plugin
|
|
3
|
+
*/
|
|
4
|
+
import { IPluginInstance, RpdApplicationConfig } from "~/types";
|
|
5
|
+
import { IRpdServer, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "~/core/server";
|
|
6
|
+
export declare const code = "metaManager";
|
|
7
|
+
export declare const description = "metaManager";
|
|
8
|
+
export declare const extendingAbilities: RpdServerPluginExtendingAbilities[];
|
|
9
|
+
export declare const configurableTargets: RpdServerPluginConfigurableTargetOptions[];
|
|
10
|
+
export declare const configurations: RpdConfigurationItemOptions[];
|
|
11
|
+
export declare function initPlugin(plugin: IPluginInstance, server: IRpdServer): Promise<void>;
|
|
12
|
+
export declare function registerHttpHandlers(server: IRpdServer): Promise<void>;
|
|
13
|
+
export declare function registerEventHandlers(server: IRpdServer): Promise<void>;
|
|
14
|
+
export declare function configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
15
|
+
export declare function onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPluginInstance, RunProxyHandlerOptions } from "~/types";
|
|
2
|
+
import { HttpHandlerContext } from "~/core/httpHandler";
|
|
3
|
+
export declare const code = "httpProxy";
|
|
4
|
+
export declare function handler(plugin: IPluginInstance, ctx: HttpHandlerContext, options: RunProxyHandlerOptions): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route manager plugin
|
|
3
|
+
*/
|
|
4
|
+
import { IPluginInstance, RpdApplicationConfig } from "~/types";
|
|
5
|
+
import { RpdServerPluginExtendingAbilities, RpdServerPluginConfigurableTargetOptions, RpdConfigurationItemOptions, IRpdServer } from "~/core/server";
|
|
6
|
+
export declare const code = "routeManager";
|
|
7
|
+
export declare const description = "routeManager";
|
|
8
|
+
export declare const extendingAbilities: RpdServerPluginExtendingAbilities[];
|
|
9
|
+
export declare const configurableTargets: RpdServerPluginConfigurableTargetOptions[];
|
|
10
|
+
export declare const configurations: RpdConfigurationItemOptions[];
|
|
11
|
+
export declare function initPlugin(plugin: IPluginInstance, server: IRpdServer): Promise<void>;
|
|
12
|
+
export declare function registerMiddlewares(server: IRpdServer): Promise<void>;
|
|
13
|
+
export declare function registerHttpHandlers(server: IRpdServer): Promise<void>;
|
|
14
|
+
export declare function configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
15
|
+
export declare function onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhooks plugin
|
|
3
|
+
*/
|
|
4
|
+
import { IPluginInstance, RpdApplicationConfig } from "~/types";
|
|
5
|
+
import { RpdServerPluginExtendingAbilities, RpdServerPluginConfigurableTargetOptions, RpdConfigurationItemOptions, IRpdServer } from "~/core/server";
|
|
6
|
+
export declare const code = "webhooks";
|
|
7
|
+
export declare const description = "webhooks";
|
|
8
|
+
export declare const extendingAbilities: RpdServerPluginExtendingAbilities[];
|
|
9
|
+
export declare const configurableTargets: RpdServerPluginConfigurableTargetOptions[];
|
|
10
|
+
export declare const configurations: RpdConfigurationItemOptions[];
|
|
11
|
+
export interface Webhook {
|
|
12
|
+
name: string;
|
|
13
|
+
url: string;
|
|
14
|
+
secret: string;
|
|
15
|
+
namespace: string;
|
|
16
|
+
modelSingularCode: string;
|
|
17
|
+
events: string[];
|
|
18
|
+
properties: string[];
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function initPlugin(plugin: IPluginInstance, server: IRpdServer): Promise<void>;
|
|
22
|
+
export declare function configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
23
|
+
export declare function registerEventHandlers(server: IRpdServer): Promise<void>;
|
|
24
|
+
export declare function onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<void>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
models: {
|
|
3
|
+
name: string;
|
|
4
|
+
namespace: string;
|
|
5
|
+
singularCode: string;
|
|
6
|
+
pluralCode: string;
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
properties: ({
|
|
10
|
+
name: string;
|
|
11
|
+
code: string;
|
|
12
|
+
columnName: string;
|
|
13
|
+
type: "integer";
|
|
14
|
+
required: true;
|
|
15
|
+
autoIncrement: true;
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
code: string;
|
|
19
|
+
columnName: string;
|
|
20
|
+
type: "text";
|
|
21
|
+
required: true;
|
|
22
|
+
autoIncrement?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
name: string;
|
|
25
|
+
code: string;
|
|
26
|
+
columnName: string;
|
|
27
|
+
type: "text";
|
|
28
|
+
required: false;
|
|
29
|
+
autoIncrement?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
name: string;
|
|
32
|
+
code: string;
|
|
33
|
+
columnName: string;
|
|
34
|
+
type: "json";
|
|
35
|
+
required: false;
|
|
36
|
+
autoIncrement?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
name: string;
|
|
39
|
+
code: string;
|
|
40
|
+
columnName: string;
|
|
41
|
+
type: "boolean";
|
|
42
|
+
required: true;
|
|
43
|
+
autoIncrement?: undefined;
|
|
44
|
+
})[];
|
|
45
|
+
}[];
|
|
46
|
+
routes: any[];
|
|
47
|
+
};
|
|
48
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fixBigIntJSONSerialize(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProxyContext, ProxyOptions } from "./types";
|
|
2
|
+
import { RouteContext } from "~/core/routeContext";
|
|
3
|
+
export declare function doProxy(sourceRouterCtx: RouteContext, options: ProxyOptions): Promise<void>;
|
|
4
|
+
export declare function createProxyContext(sourceRouterCtx: RouteContext, options: ProxyOptions): {
|
|
5
|
+
sourceContext: {
|
|
6
|
+
request: import("..").RapidRequest;
|
|
7
|
+
response: import("../core/response").RapidResponse;
|
|
8
|
+
};
|
|
9
|
+
targetContext: {};
|
|
10
|
+
options: import("..").RunProxyHandlerOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare function sendTargetRequest(proxyCtx: ProxyContext): Promise<Response>;
|
|
13
|
+
export declare function sendSourceResponse(proxyCtx: ProxyContext, targetRes: Response): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RapidRequest } from "~/core/request";
|
|
2
|
+
import { RunProxyHandlerOptions } from "../types";
|
|
3
|
+
import { RapidResponse } from "~/core/response";
|
|
4
|
+
export interface ProxyContext {
|
|
5
|
+
sourceContext: ProxySourceContext;
|
|
6
|
+
targetContext: ProxyTargetContext;
|
|
7
|
+
options: ProxyOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface ProxySourceContext {
|
|
10
|
+
request: RapidRequest;
|
|
11
|
+
response: RapidResponse;
|
|
12
|
+
}
|
|
13
|
+
export interface ProxyTargetContext {
|
|
14
|
+
request?: RapidRequest;
|
|
15
|
+
response?: RapidResponse;
|
|
16
|
+
}
|
|
17
|
+
export type ProxyOptions = RunProxyHandlerOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./queryBuilder";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CountEntityOptions, DeleteEntityOptions, EntityFilterOptions, FindEntityOptions, CreateEntityOptions, RpdDataModel, UpdateEntityOptions, QuoteTableOptions } from "../types";
|
|
2
|
+
export interface BuildQueryContext {
|
|
3
|
+
params: any[];
|
|
4
|
+
}
|
|
5
|
+
export interface InitQueryBuilderOptions {
|
|
6
|
+
dbDefaultSchema: string;
|
|
7
|
+
}
|
|
8
|
+
export default class QueryBuilder {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(options: InitQueryBuilderOptions);
|
|
11
|
+
quoteTable(options: QuoteTableOptions): string;
|
|
12
|
+
quoteObject(name: string): string;
|
|
13
|
+
select(model: RpdDataModel, options: FindEntityOptions): {
|
|
14
|
+
command: string;
|
|
15
|
+
params: any[];
|
|
16
|
+
};
|
|
17
|
+
count(model: RpdDataModel, options: CountEntityOptions): {
|
|
18
|
+
command: string;
|
|
19
|
+
params: any[];
|
|
20
|
+
};
|
|
21
|
+
insert(model: RpdDataModel, options: CreateEntityOptions): {
|
|
22
|
+
command: string;
|
|
23
|
+
params: any[];
|
|
24
|
+
};
|
|
25
|
+
update(model: RpdDataModel, options: UpdateEntityOptions): {
|
|
26
|
+
command: string;
|
|
27
|
+
params: any[];
|
|
28
|
+
};
|
|
29
|
+
delete(model: RpdDataModel, options: DeleteEntityOptions): {
|
|
30
|
+
command: string;
|
|
31
|
+
params: any[];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare function buildFiltersQuery(ctx: BuildQueryContext, filters: EntityFilterOptions[]): string;
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GetDataAccessorOptions, GetModelOptions, IDatabaseAccessor, IDatabaseConfig, IPluginInstance, IQueryBuilder, IRpdDataAccessor, RpdApplicationConfig, RpdDataModel, RpdServerEventTypes, RapidServerConfig } from "./types";
|
|
2
|
+
import { HttpRequestHandler, IPluginHttpHandler } from "./core/httpHandler";
|
|
3
|
+
import { IRpdServer } from "./core/server";
|
|
4
|
+
import { Next } from "./core/routeContext";
|
|
5
|
+
export interface InitServerOptions {
|
|
6
|
+
databaseAccessor: IDatabaseAccessor;
|
|
7
|
+
databaseConfig: IDatabaseConfig;
|
|
8
|
+
serverConfig: RapidServerConfig;
|
|
9
|
+
applicationConfig: RpdApplicationConfig;
|
|
10
|
+
}
|
|
11
|
+
export default class RpdServer implements IRpdServer {
|
|
12
|
+
#private;
|
|
13
|
+
queryBuilder: IQueryBuilder;
|
|
14
|
+
config: RapidServerConfig;
|
|
15
|
+
databaseConfig: IDatabaseConfig;
|
|
16
|
+
constructor(options: InitServerOptions);
|
|
17
|
+
getApplicationConfig(): RpdApplicationConfig;
|
|
18
|
+
registerHttpHandler(plugin: IPluginInstance, options: IPluginHttpHandler): void;
|
|
19
|
+
getHttpHandlerByCode(code: string): HttpRequestHandler;
|
|
20
|
+
registerMiddleware(middleware: any): void;
|
|
21
|
+
getDataAccessor<T = any>(options: GetDataAccessorOptions): IRpdDataAccessor<T>;
|
|
22
|
+
getModel(options: GetModelOptions): RpdDataModel | undefined;
|
|
23
|
+
registerEventHandler<K extends keyof RpdServerEventTypes>(eventName: K, listener: (...args: RpdServerEventTypes[K]) => void): this;
|
|
24
|
+
emitEvent<K extends keyof RpdServerEventTypes>(eventName: K, sender: IPluginInstance, payload: RpdServerEventTypes[K][1]): Promise<void>;
|
|
25
|
+
start(): Promise<void>;
|
|
26
|
+
configureApplication(): Promise<void>;
|
|
27
|
+
queryDatabaseObject(sql: string, params?: unknown[] | Record<string, unknown>): Promise<any[]>;
|
|
28
|
+
tryQueryDatabaseObject(sql: string, params?: unknown[] | Record<string, unknown>): Promise<any[]>;
|
|
29
|
+
get middlewares(): any[];
|
|
30
|
+
handleRequest(request: Request, next: Next): Promise<Response>;
|
|
31
|
+
}
|