@ruiapp/rapid-core 0.1.83 → 0.2.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 +6 -0
- package/dist/helpers/metaHelper.d.ts +3 -3
- package/dist/index.js +64 -25
- package/dist/plugins/webhooks/pluginConfig.d.ts +1 -0
- package/dist/types.d.ts +19 -1
- package/package.json +1 -1
- package/rollup.config.js +16 -16
- package/src/bootstrapApplicationConfig.ts +615 -602
- package/src/core/actionHandler.ts +22 -22
- package/src/core/eventManager.ts +20 -20
- package/src/core/facility.ts +7 -7
- package/src/core/http/formDataParser.ts +89 -89
- package/src/core/pluginManager.ts +175 -175
- package/src/core/providers/runtimeProvider.ts +5 -5
- package/src/core/request.ts +86 -86
- package/src/core/response.ts +76 -76
- package/src/core/routeContext.ts +43 -43
- package/src/core/routesBuilder.ts +88 -88
- package/src/core/server.ts +142 -142
- package/src/dataAccess/columnTypeMapper.ts +22 -22
- package/src/dataAccess/dataAccessTypes.ts +151 -151
- package/src/dataAccess/dataAccessor.ts +137 -137
- package/src/dataAccess/entityManager.ts +1507 -1505
- package/src/dataAccess/entityMapper.ts +100 -100
- package/src/dataAccess/propertyMapper.ts +28 -28
- package/src/deno-std/datetime/to_imf.ts +32 -32
- package/src/deno-std/encoding/base64.ts +141 -141
- package/src/deno-std/http/cookie.ts +372 -372
- package/src/facilities/log/LogFacility.ts +35 -35
- package/src/helpers/entityHelpers.ts +76 -76
- package/src/helpers/filterHelper.ts +47 -47
- package/src/helpers/metaHelper.ts +80 -76
- package/src/helpers/runCollectionEntityActionHandler.ts +27 -27
- package/src/index.ts +46 -46
- package/src/plugins/auth/AuthPlugin.ts +85 -85
- package/src/plugins/auth/actionHandlers/changePassword.ts +54 -54
- package/src/plugins/auth/actionHandlers/createSession.ts +63 -63
- package/src/plugins/auth/actionHandlers/deleteSession.ts +18 -18
- package/src/plugins/auth/actionHandlers/getMyProfile.ts +35 -35
- package/src/plugins/auth/actionHandlers/index.ts +8 -8
- package/src/plugins/auth/actionHandlers/resetPassword.ts +38 -38
- package/src/plugins/auth/models/AccessToken.ts +56 -56
- package/src/plugins/auth/models/index.ts +3 -3
- package/src/plugins/auth/routes/changePassword.ts +15 -15
- package/src/plugins/auth/routes/getMyProfile.ts +15 -15
- package/src/plugins/auth/routes/index.ts +7 -7
- package/src/plugins/auth/routes/resetPassword.ts +15 -15
- package/src/plugins/auth/routes/signin.ts +15 -15
- package/src/plugins/auth/routes/signout.ts +15 -15
- package/src/plugins/cronJob/CronJobPlugin.ts +112 -112
- package/src/plugins/cronJob/CronJobPluginTypes.ts +49 -49
- package/src/plugins/cronJob/actionHandlers/index.ts +4 -4
- package/src/plugins/cronJob/actionHandlers/runCronJob.ts +29 -29
- package/src/plugins/cronJob/routes/index.ts +3 -3
- package/src/plugins/cronJob/routes/runCronJob.ts +15 -15
- package/src/plugins/dataManage/DataManagePlugin.ts +163 -163
- package/src/plugins/dataManage/actionHandlers/addEntityRelations.ts +20 -20
- package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +15 -15
- package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +42 -42
- package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +24 -24
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntities.ts +38 -38
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +22 -22
- package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +26 -26
- package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +21 -21
- package/src/plugins/dataManage/actionHandlers/queryDatabase.ts +22 -22
- package/src/plugins/dataManage/actionHandlers/removeEntityRelations.ts +20 -20
- package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +35 -35
- package/src/plugins/entityAccessControl/EntityAccessControlPlugin.ts +146 -146
- package/src/plugins/fileManage/FileManagePlugin.ts +52 -52
- package/src/plugins/fileManage/actionHandlers/downloadDocument.ts +36 -36
- package/src/plugins/fileManage/actionHandlers/downloadFile.ts +44 -44
- package/src/plugins/fileManage/actionHandlers/uploadFile.ts +33 -33
- package/src/plugins/fileManage/routes/downloadDocument.ts +15 -15
- package/src/plugins/fileManage/routes/downloadFile.ts +15 -15
- package/src/plugins/fileManage/routes/index.ts +5 -5
- package/src/plugins/fileManage/routes/uploadFile.ts +15 -15
- package/src/plugins/metaManage/MetaManagePlugin.ts +500 -488
- package/src/plugins/metaManage/actionHandlers/getMetaModelDetail.ts +10 -10
- package/src/plugins/metaManage/actionHandlers/listMetaModels.ts +9 -9
- package/src/plugins/metaManage/actionHandlers/listMetaRoutes.ts +9 -9
- package/src/plugins/routeManage/RouteManagePlugin.ts +62 -62
- package/src/plugins/routeManage/actionHandlers/httpProxy.ts +13 -13
- package/src/plugins/sequence/SequencePlugin.ts +136 -136
- package/src/plugins/sequence/SequencePluginTypes.ts +69 -69
- package/src/plugins/sequence/SequenceService.ts +81 -81
- package/src/plugins/sequence/actionHandlers/generateSn.ts +32 -32
- package/src/plugins/sequence/actionHandlers/index.ts +4 -4
- package/src/plugins/sequence/models/SequenceAutoIncrementRecord.ts +49 -49
- package/src/plugins/sequence/models/SequenceRule.ts +42 -42
- package/src/plugins/sequence/models/index.ts +4 -4
- package/src/plugins/sequence/routes/generateSn.ts +15 -15
- package/src/plugins/sequence/routes/index.ts +3 -3
- package/src/plugins/sequence/segment-utility.ts +11 -11
- package/src/plugins/sequence/segments/autoIncrement.ts +78 -78
- package/src/plugins/sequence/segments/dayOfMonth.ts +17 -17
- package/src/plugins/sequence/segments/index.ts +9 -9
- package/src/plugins/sequence/segments/literal.ts +14 -14
- package/src/plugins/sequence/segments/month.ts +17 -17
- package/src/plugins/sequence/segments/parameter.ts +18 -18
- package/src/plugins/sequence/segments/year.ts +17 -17
- package/src/plugins/serverOperation/ServerOperationPlugin.ts +91 -91
- package/src/plugins/serverOperation/ServerOperationPluginTypes.ts +15 -15
- package/src/plugins/serverOperation/actionHandlers/index.ts +4 -4
- package/src/plugins/setting/SettingPlugin.ts +68 -68
- package/src/plugins/setting/SettingPluginTypes.ts +37 -37
- package/src/plugins/setting/SettingService.ts +213 -213
- package/src/plugins/setting/actionHandlers/getSystemSettingValues.ts +30 -30
- package/src/plugins/setting/actionHandlers/getUserSettingValues.ts +38 -38
- package/src/plugins/setting/actionHandlers/index.ts +6 -6
- package/src/plugins/setting/actionHandlers/setSystemSettingValues.ts +30 -30
- package/src/plugins/setting/models/SystemSettingGroupSetting.ts +57 -57
- package/src/plugins/setting/models/SystemSettingItem.ts +42 -42
- package/src/plugins/setting/models/SystemSettingItemSetting.ts +73 -73
- package/src/plugins/setting/models/UserSettingGroupSetting.ts +57 -57
- package/src/plugins/setting/models/UserSettingItem.ts +49 -49
- package/src/plugins/setting/models/UserSettingItemSetting.ts +73 -73
- package/src/plugins/setting/models/index.ts +8 -8
- package/src/plugins/setting/routes/getSystemSettingValues.ts +15 -15
- package/src/plugins/setting/routes/getUserSettingValues.ts +15 -15
- package/src/plugins/setting/routes/index.ts +5 -5
- package/src/plugins/setting/routes/setSystemSettingValues.ts +15 -15
- package/src/plugins/stateMachine/StateMachinePlugin.ts +186 -186
- package/src/plugins/stateMachine/StateMachinePluginTypes.ts +48 -48
- package/src/plugins/stateMachine/actionHandlers/index.ts +4 -4
- package/src/plugins/stateMachine/actionHandlers/sendStateMachineEvent.ts +51 -51
- package/src/plugins/stateMachine/models/StateMachine.ts +42 -42
- package/src/plugins/stateMachine/models/index.ts +3 -3
- package/src/plugins/stateMachine/routes/index.ts +3 -3
- package/src/plugins/stateMachine/routes/sendStateMachineEvent.ts +15 -15
- package/src/plugins/webhooks/WebhooksPlugin.ts +148 -148
- package/src/plugins/webhooks/pluginConfig.ts +1 -0
- package/src/polyfill.ts +5 -5
- package/src/proxy/mod.ts +38 -38
- package/src/queryBuilder/queryBuilder.ts +637 -637
- package/src/server.ts +463 -451
- package/src/types.ts +659 -637
- package/src/utilities/accessControlUtility.ts +33 -33
- package/src/utilities/errorUtility.ts +15 -15
- package/src/utilities/fsUtility.ts +61 -61
- package/src/utilities/httpUtility.ts +19 -19
- package/src/utilities/jwtUtility.ts +26 -26
- package/src/utilities/timeUtility.ts +9 -9
- package/tsconfig.json +19 -19
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SequenceDayOfMonthSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
-
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
-
import { padSegment } from "../segment-utility";
|
|
4
|
-
import { IRpdServer } from "~/core/server";
|
|
5
|
-
|
|
6
|
-
export const segmentType = "dayOfMonth";
|
|
7
|
-
|
|
8
|
-
export async function resolveSegmentValue(
|
|
9
|
-
server: IRpdServer,
|
|
10
|
-
ruleCode: string,
|
|
11
|
-
config: SequenceDayOfMonthSegmentConfig,
|
|
12
|
-
input: GenerateSequenceNumbersInput,
|
|
13
|
-
): Promise<string> {
|
|
14
|
-
const segmentValue = new Date().getDate().toString();
|
|
15
|
-
|
|
16
|
-
return padSegment(segmentValue, config.length || 2, config.padding || "0");
|
|
17
|
-
}
|
|
1
|
+
import { SequenceDayOfMonthSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
+
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
+
import { padSegment } from "../segment-utility";
|
|
4
|
+
import { IRpdServer } from "~/core/server";
|
|
5
|
+
|
|
6
|
+
export const segmentType = "dayOfMonth";
|
|
7
|
+
|
|
8
|
+
export async function resolveSegmentValue(
|
|
9
|
+
server: IRpdServer,
|
|
10
|
+
ruleCode: string,
|
|
11
|
+
config: SequenceDayOfMonthSegmentConfig,
|
|
12
|
+
input: GenerateSequenceNumbersInput,
|
|
13
|
+
): Promise<string> {
|
|
14
|
+
const segmentValue = new Date().getDate().toString();
|
|
15
|
+
|
|
16
|
+
return padSegment(segmentValue, config.length || 2, config.padding || "0");
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SegmentResolver } from "../SequenceService";
|
|
2
|
-
import * as literal from "./literal";
|
|
3
|
-
import * as year from "./year";
|
|
4
|
-
import * as month from "./month";
|
|
5
|
-
import * as dayOfMonth from "./dayOfMonth";
|
|
6
|
-
import * as parameter from "./parameter";
|
|
7
|
-
import * as autoIncrement from "./autoIncrement";
|
|
8
|
-
|
|
9
|
-
export default [literal, year, month, dayOfMonth, parameter, autoIncrement] satisfies SegmentResolver[];
|
|
1
|
+
import { SegmentResolver } from "../SequenceService";
|
|
2
|
+
import * as literal from "./literal";
|
|
3
|
+
import * as year from "./year";
|
|
4
|
+
import * as month from "./month";
|
|
5
|
+
import * as dayOfMonth from "./dayOfMonth";
|
|
6
|
+
import * as parameter from "./parameter";
|
|
7
|
+
import * as autoIncrement from "./autoIncrement";
|
|
8
|
+
|
|
9
|
+
export default [literal, year, month, dayOfMonth, parameter, autoIncrement] satisfies SegmentResolver[];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { SequenceLiteralSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
-
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
-
import { IRpdServer } from "~/core/server";
|
|
4
|
-
|
|
5
|
-
export const segmentType = "literal";
|
|
6
|
-
|
|
7
|
-
export async function resolveSegmentValue(
|
|
8
|
-
server: IRpdServer,
|
|
9
|
-
ruleCode: string,
|
|
10
|
-
config: SequenceLiteralSegmentConfig,
|
|
11
|
-
input: GenerateSequenceNumbersInput,
|
|
12
|
-
): Promise<string> {
|
|
13
|
-
return config.content || "";
|
|
14
|
-
}
|
|
1
|
+
import { SequenceLiteralSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
+
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
+
import { IRpdServer } from "~/core/server";
|
|
4
|
+
|
|
5
|
+
export const segmentType = "literal";
|
|
6
|
+
|
|
7
|
+
export async function resolveSegmentValue(
|
|
8
|
+
server: IRpdServer,
|
|
9
|
+
ruleCode: string,
|
|
10
|
+
config: SequenceLiteralSegmentConfig,
|
|
11
|
+
input: GenerateSequenceNumbersInput,
|
|
12
|
+
): Promise<string> {
|
|
13
|
+
return config.content || "";
|
|
14
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SequenceMonthSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
-
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
-
import { padSegment } from "../segment-utility";
|
|
4
|
-
import { IRpdServer } from "~/core/server";
|
|
5
|
-
|
|
6
|
-
export const segmentType = "month";
|
|
7
|
-
|
|
8
|
-
export async function resolveSegmentValue(
|
|
9
|
-
server: IRpdServer,
|
|
10
|
-
ruleCode: string,
|
|
11
|
-
config: SequenceMonthSegmentConfig,
|
|
12
|
-
input: GenerateSequenceNumbersInput,
|
|
13
|
-
): Promise<string> {
|
|
14
|
-
const segmentValue = (new Date().getMonth() + 1).toString();
|
|
15
|
-
|
|
16
|
-
return padSegment(segmentValue, config.length || 2, config.padding || "0");
|
|
17
|
-
}
|
|
1
|
+
import { SequenceMonthSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
+
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
+
import { padSegment } from "../segment-utility";
|
|
4
|
+
import { IRpdServer } from "~/core/server";
|
|
5
|
+
|
|
6
|
+
export const segmentType = "month";
|
|
7
|
+
|
|
8
|
+
export async function resolveSegmentValue(
|
|
9
|
+
server: IRpdServer,
|
|
10
|
+
ruleCode: string,
|
|
11
|
+
config: SequenceMonthSegmentConfig,
|
|
12
|
+
input: GenerateSequenceNumbersInput,
|
|
13
|
+
): Promise<string> {
|
|
14
|
+
const segmentValue = (new Date().getMonth() + 1).toString();
|
|
15
|
+
|
|
16
|
+
return padSegment(segmentValue, config.length || 2, config.padding || "0");
|
|
17
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { SequenceParameterSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
-
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
-
import { padSegment } from "../segment-utility";
|
|
4
|
-
import { get } from "lodash";
|
|
5
|
-
import { IRpdServer } from "~/core/server";
|
|
6
|
-
|
|
7
|
-
export const segmentType = "parameter";
|
|
8
|
-
|
|
9
|
-
export async function resolveSegmentValue(
|
|
10
|
-
server: IRpdServer,
|
|
11
|
-
ruleCode: string,
|
|
12
|
-
config: SequenceParameterSegmentConfig,
|
|
13
|
-
input: GenerateSequenceNumbersInput,
|
|
14
|
-
): Promise<string> {
|
|
15
|
-
const segmentValue = get(input.parameters, config.parameterName, config.defaultContent || "");
|
|
16
|
-
|
|
17
|
-
return padSegment(segmentValue, config.length, config.padding);
|
|
18
|
-
}
|
|
1
|
+
import { SequenceParameterSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
+
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
+
import { padSegment } from "../segment-utility";
|
|
4
|
+
import { get } from "lodash";
|
|
5
|
+
import { IRpdServer } from "~/core/server";
|
|
6
|
+
|
|
7
|
+
export const segmentType = "parameter";
|
|
8
|
+
|
|
9
|
+
export async function resolveSegmentValue(
|
|
10
|
+
server: IRpdServer,
|
|
11
|
+
ruleCode: string,
|
|
12
|
+
config: SequenceParameterSegmentConfig,
|
|
13
|
+
input: GenerateSequenceNumbersInput,
|
|
14
|
+
): Promise<string> {
|
|
15
|
+
const segmentValue = get(input.parameters, config.parameterName, config.defaultContent || "");
|
|
16
|
+
|
|
17
|
+
return padSegment(segmentValue, config.length, config.padding);
|
|
18
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SequenceYearSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
-
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
-
import { padSegment } from "../segment-utility";
|
|
4
|
-
import { IRpdServer } from "~/core/server";
|
|
5
|
-
|
|
6
|
-
export const segmentType = "year";
|
|
7
|
-
|
|
8
|
-
export async function resolveSegmentValue(
|
|
9
|
-
server: IRpdServer,
|
|
10
|
-
ruleCode: string,
|
|
11
|
-
config: SequenceYearSegmentConfig,
|
|
12
|
-
input: GenerateSequenceNumbersInput,
|
|
13
|
-
): Promise<string> {
|
|
14
|
-
const segmentValue = new Date().getFullYear().toString();
|
|
15
|
-
|
|
16
|
-
return padSegment(segmentValue, config.length || 4, config.padding || "0");
|
|
17
|
-
}
|
|
1
|
+
import { SequenceYearSegmentConfig } from "../SequencePluginTypes";
|
|
2
|
+
import { GenerateSequenceNumbersInput } from "../SequenceService";
|
|
3
|
+
import { padSegment } from "../segment-utility";
|
|
4
|
+
import { IRpdServer } from "~/core/server";
|
|
5
|
+
|
|
6
|
+
export const segmentType = "year";
|
|
7
|
+
|
|
8
|
+
export async function resolveSegmentValue(
|
|
9
|
+
server: IRpdServer,
|
|
10
|
+
ruleCode: string,
|
|
11
|
+
config: SequenceYearSegmentConfig,
|
|
12
|
+
input: GenerateSequenceNumbersInput,
|
|
13
|
+
): Promise<string> {
|
|
14
|
+
const segmentValue = new Date().getFullYear().toString();
|
|
15
|
+
|
|
16
|
+
return padSegment(segmentValue, config.length || 4, config.padding || "0");
|
|
17
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import type { RpdApplicationConfig, RpdRoute } from "~/types";
|
|
2
|
-
|
|
3
|
-
import pluginActionHandlers from "./actionHandlers";
|
|
4
|
-
import { ServerOperation, ServerOperationPluginInitOptions } from "./ServerOperationPluginTypes";
|
|
5
|
-
import {
|
|
6
|
-
IRpdServer,
|
|
7
|
-
RapidPlugin,
|
|
8
|
-
RpdConfigurationItemOptions,
|
|
9
|
-
RpdServerPluginConfigurableTargetOptions,
|
|
10
|
-
RpdServerPluginExtendingAbilities,
|
|
11
|
-
} from "~/core/server";
|
|
12
|
-
|
|
13
|
-
class ServerOperationPlugin implements RapidPlugin {
|
|
14
|
-
#operations: ServerOperation[];
|
|
15
|
-
|
|
16
|
-
constructor(options: ServerOperationPluginInitOptions) {
|
|
17
|
-
this.#operations = options.operations || [];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get code(): string {
|
|
21
|
-
return "serverOperation";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get description(): string {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get extendingAbilities(): RpdServerPluginExtendingAbilities[] {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get configurableTargets(): RpdServerPluginConfigurableTargetOptions[] {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get configurations(): RpdConfigurationItemOptions[] {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async initPlugin(server: IRpdServer): Promise<any> {}
|
|
41
|
-
|
|
42
|
-
async registerMiddlewares(server: IRpdServer): Promise<any> {}
|
|
43
|
-
|
|
44
|
-
async registerActionHandlers(server: IRpdServer): Promise<any> {
|
|
45
|
-
for (const actionHandler of pluginActionHandlers) {
|
|
46
|
-
server.registerActionHandler(this, actionHandler);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async registerEventHandlers(server: IRpdServer): Promise<any> {}
|
|
51
|
-
|
|
52
|
-
async registerMessageHandlers(server: IRpdServer): Promise<any> {}
|
|
53
|
-
|
|
54
|
-
async registerTaskProcessors(server: IRpdServer): Promise<any> {}
|
|
55
|
-
|
|
56
|
-
async onLoadingApplication(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
57
|
-
|
|
58
|
-
async configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
59
|
-
|
|
60
|
-
async configureModelProperties(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
61
|
-
|
|
62
|
-
async configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
63
|
-
const routes: RpdRoute[] = [];
|
|
64
|
-
for (const operation of this.#operations) {
|
|
65
|
-
routes.push({
|
|
66
|
-
namespace: "app",
|
|
67
|
-
name: `app.operations.${operation.code}`,
|
|
68
|
-
code: `app.operations.${operation.code}`,
|
|
69
|
-
type: "RESTful",
|
|
70
|
-
method: operation.method,
|
|
71
|
-
endpoint: `/app/${operation.code}`,
|
|
72
|
-
actions: [
|
|
73
|
-
{
|
|
74
|
-
code: "runServerOperation",
|
|
75
|
-
config: {
|
|
76
|
-
operation: operation.handler,
|
|
77
|
-
permissionCheck: operation.permissionCheck,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
server.appendApplicationConfig({ routes });
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
87
|
-
|
|
88
|
-
async onApplicationReady(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default ServerOperationPlugin;
|
|
1
|
+
import type { RpdApplicationConfig, RpdRoute } from "~/types";
|
|
2
|
+
|
|
3
|
+
import pluginActionHandlers from "./actionHandlers";
|
|
4
|
+
import { ServerOperation, ServerOperationPluginInitOptions } from "./ServerOperationPluginTypes";
|
|
5
|
+
import {
|
|
6
|
+
IRpdServer,
|
|
7
|
+
RapidPlugin,
|
|
8
|
+
RpdConfigurationItemOptions,
|
|
9
|
+
RpdServerPluginConfigurableTargetOptions,
|
|
10
|
+
RpdServerPluginExtendingAbilities,
|
|
11
|
+
} from "~/core/server";
|
|
12
|
+
|
|
13
|
+
class ServerOperationPlugin implements RapidPlugin {
|
|
14
|
+
#operations: ServerOperation[];
|
|
15
|
+
|
|
16
|
+
constructor(options: ServerOperationPluginInitOptions) {
|
|
17
|
+
this.#operations = options.operations || [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get code(): string {
|
|
21
|
+
return "serverOperation";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get description(): string {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get extendingAbilities(): RpdServerPluginExtendingAbilities[] {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get configurableTargets(): RpdServerPluginConfigurableTargetOptions[] {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get configurations(): RpdConfigurationItemOptions[] {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async initPlugin(server: IRpdServer): Promise<any> {}
|
|
41
|
+
|
|
42
|
+
async registerMiddlewares(server: IRpdServer): Promise<any> {}
|
|
43
|
+
|
|
44
|
+
async registerActionHandlers(server: IRpdServer): Promise<any> {
|
|
45
|
+
for (const actionHandler of pluginActionHandlers) {
|
|
46
|
+
server.registerActionHandler(this, actionHandler);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async registerEventHandlers(server: IRpdServer): Promise<any> {}
|
|
51
|
+
|
|
52
|
+
async registerMessageHandlers(server: IRpdServer): Promise<any> {}
|
|
53
|
+
|
|
54
|
+
async registerTaskProcessors(server: IRpdServer): Promise<any> {}
|
|
55
|
+
|
|
56
|
+
async onLoadingApplication(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
57
|
+
|
|
58
|
+
async configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
59
|
+
|
|
60
|
+
async configureModelProperties(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
61
|
+
|
|
62
|
+
async configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
63
|
+
const routes: RpdRoute[] = [];
|
|
64
|
+
for (const operation of this.#operations) {
|
|
65
|
+
routes.push({
|
|
66
|
+
namespace: "app",
|
|
67
|
+
name: `app.operations.${operation.code}`,
|
|
68
|
+
code: `app.operations.${operation.code}`,
|
|
69
|
+
type: "RESTful",
|
|
70
|
+
method: operation.method,
|
|
71
|
+
endpoint: `/app/${operation.code}`,
|
|
72
|
+
actions: [
|
|
73
|
+
{
|
|
74
|
+
code: "runServerOperation",
|
|
75
|
+
config: {
|
|
76
|
+
operation: operation.handler,
|
|
77
|
+
permissionCheck: operation.permissionCheck,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
server.appendApplicationConfig({ routes });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
87
|
+
|
|
88
|
+
async onApplicationReady(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default ServerOperationPlugin;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ActionHandlerContext } from "~/core/actionHandler";
|
|
2
|
-
import { RpdHttpMethod } from "~/types";
|
|
3
|
-
import { PermissionCheckPolicy } from "~/utilities/accessControlUtility";
|
|
4
|
-
|
|
5
|
-
export interface ServerOperation {
|
|
6
|
-
code: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
method: RpdHttpMethod;
|
|
9
|
-
permissionCheck?: PermissionCheckPolicy;
|
|
10
|
-
handler: (ctx: ActionHandlerContext) => Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ServerOperationPluginInitOptions {
|
|
14
|
-
operations: ServerOperation[];
|
|
15
|
-
}
|
|
1
|
+
import { ActionHandlerContext } from "~/core/actionHandler";
|
|
2
|
+
import { RpdHttpMethod } from "~/types";
|
|
3
|
+
import { PermissionCheckPolicy } from "~/utilities/accessControlUtility";
|
|
4
|
+
|
|
5
|
+
export interface ServerOperation {
|
|
6
|
+
code: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
method: RpdHttpMethod;
|
|
9
|
+
permissionCheck?: PermissionCheckPolicy;
|
|
10
|
+
handler: (ctx: ActionHandlerContext) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ServerOperationPluginInitOptions {
|
|
14
|
+
operations: ServerOperation[];
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPluginActionHandler } from "~/core/actionHandler";
|
|
2
|
-
import * as runServerOperation from "./runServerOperation";
|
|
3
|
-
|
|
4
|
-
export default [runServerOperation] satisfies IPluginActionHandler[];
|
|
1
|
+
import { IPluginActionHandler } from "~/core/actionHandler";
|
|
2
|
+
import * as runServerOperation from "./runServerOperation";
|
|
3
|
+
|
|
4
|
+
export default [runServerOperation] satisfies IPluginActionHandler[];
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Setting plugin
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { RpdApplicationConfig } from "~/types";
|
|
6
|
-
import {
|
|
7
|
-
IRpdServer,
|
|
8
|
-
RapidPlugin,
|
|
9
|
-
RpdConfigurationItemOptions,
|
|
10
|
-
RpdServerPluginConfigurableTargetOptions,
|
|
11
|
-
RpdServerPluginExtendingAbilities,
|
|
12
|
-
} from "~/core/server";
|
|
13
|
-
|
|
14
|
-
import pluginActionHandlers from "./actionHandlers";
|
|
15
|
-
import pluginModels from "./models";
|
|
16
|
-
import pluginRoutes from "./routes";
|
|
17
|
-
import SettingService from "./SettingService";
|
|
18
|
-
|
|
19
|
-
class SettingPlugin implements RapidPlugin {
|
|
20
|
-
#settingService!: SettingService;
|
|
21
|
-
|
|
22
|
-
get settingService() {
|
|
23
|
-
return this.#settingService;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get code(): string {
|
|
27
|
-
return "settingPlugin";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get description(): string {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get extendingAbilities(): RpdServerPluginExtendingAbilities[] {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get configurableTargets(): RpdServerPluginConfigurableTargetOptions[] {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get configurations(): RpdConfigurationItemOptions[] {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async registerActionHandlers(server: IRpdServer): Promise<any> {
|
|
47
|
-
for (const actionHandler of pluginActionHandlers) {
|
|
48
|
-
server.registerActionHandler(this, actionHandler);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
53
|
-
server.appendApplicationConfig({ models: pluginModels });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async configureServices(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
57
|
-
this.#settingService = new SettingService(server);
|
|
58
|
-
server.registerService("settingService", this.#settingService);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
62
|
-
server.appendApplicationConfig({ routes: pluginRoutes });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig) {}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default SettingPlugin;
|
|
1
|
+
/**
|
|
2
|
+
* Setting plugin
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { RpdApplicationConfig } from "~/types";
|
|
6
|
+
import {
|
|
7
|
+
IRpdServer,
|
|
8
|
+
RapidPlugin,
|
|
9
|
+
RpdConfigurationItemOptions,
|
|
10
|
+
RpdServerPluginConfigurableTargetOptions,
|
|
11
|
+
RpdServerPluginExtendingAbilities,
|
|
12
|
+
} from "~/core/server";
|
|
13
|
+
|
|
14
|
+
import pluginActionHandlers from "./actionHandlers";
|
|
15
|
+
import pluginModels from "./models";
|
|
16
|
+
import pluginRoutes from "./routes";
|
|
17
|
+
import SettingService from "./SettingService";
|
|
18
|
+
|
|
19
|
+
class SettingPlugin implements RapidPlugin {
|
|
20
|
+
#settingService!: SettingService;
|
|
21
|
+
|
|
22
|
+
get settingService() {
|
|
23
|
+
return this.#settingService;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get code(): string {
|
|
27
|
+
return "settingPlugin";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get description(): string {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get extendingAbilities(): RpdServerPluginExtendingAbilities[] {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get configurableTargets(): RpdServerPluginConfigurableTargetOptions[] {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get configurations(): RpdConfigurationItemOptions[] {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async registerActionHandlers(server: IRpdServer): Promise<any> {
|
|
47
|
+
for (const actionHandler of pluginActionHandlers) {
|
|
48
|
+
server.registerActionHandler(this, actionHandler);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async configureModels(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
53
|
+
server.appendApplicationConfig({ models: pluginModels });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async configureServices(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
57
|
+
this.#settingService = new SettingService(server);
|
|
58
|
+
server.registerService("settingService", this.#settingService);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
62
|
+
server.appendApplicationConfig({ routes: pluginRoutes });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async onApplicationLoaded(server: IRpdServer, applicationConfig: RpdApplicationConfig) {}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default SettingPlugin;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export type SettingGroupSetting = {
|
|
2
|
-
code: string;
|
|
3
|
-
name: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
permissionAssignments?: PermissionAssignment[];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type SettingItemSetting = {
|
|
9
|
-
group: SettingGroupSetting;
|
|
10
|
-
orderNum: number;
|
|
11
|
-
type: string;
|
|
12
|
-
code: string;
|
|
13
|
-
name: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
config?: any;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type SystemSettingItem = {
|
|
19
|
-
id: number;
|
|
20
|
-
groupCode: string;
|
|
21
|
-
itemCode: string;
|
|
22
|
-
value: any;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type UserSettingItem = {
|
|
26
|
-
id: number;
|
|
27
|
-
ownerId: number;
|
|
28
|
-
groupCode: string;
|
|
29
|
-
itemCode: string;
|
|
30
|
-
value: any;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type PermissionAssignment = {
|
|
34
|
-
assigneeType: string;
|
|
35
|
-
assigneeId: number;
|
|
36
|
-
actions: string[];
|
|
37
|
-
};
|
|
1
|
+
export type SettingGroupSetting = {
|
|
2
|
+
code: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
permissionAssignments?: PermissionAssignment[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type SettingItemSetting = {
|
|
9
|
+
group: SettingGroupSetting;
|
|
10
|
+
orderNum: number;
|
|
11
|
+
type: string;
|
|
12
|
+
code: string;
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
config?: any;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type SystemSettingItem = {
|
|
19
|
+
id: number;
|
|
20
|
+
groupCode: string;
|
|
21
|
+
itemCode: string;
|
|
22
|
+
value: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type UserSettingItem = {
|
|
26
|
+
id: number;
|
|
27
|
+
ownerId: number;
|
|
28
|
+
groupCode: string;
|
|
29
|
+
itemCode: string;
|
|
30
|
+
value: any;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type PermissionAssignment = {
|
|
34
|
+
assigneeType: string;
|
|
35
|
+
assigneeId: number;
|
|
36
|
+
actions: string[];
|
|
37
|
+
};
|