@ruiapp/rapid-core 0.9.0 → 0.9.2
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/CHANGELOG.md +11 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +134 -97
- package/dist/plugins/auth/AuthPlugin.d.ts +3 -0
- package/dist/plugins/auth/AuthPluginTypes.d.ts +10 -0
- package/dist/plugins/auth/actionHandlers/changePassword.d.ts +2 -2
- package/dist/plugins/auth/actionHandlers/createSession.d.ts +2 -2
- package/dist/plugins/auth/actionHandlers/getMyProfile.d.ts +2 -2
- package/dist/plugins/auth/actionHandlers/resetPassword.d.ts +2 -2
- package/dist/plugins/routeManage/actionHandlers/mock.d.ts +5 -0
- package/dist/types.d.ts +18 -0
- package/package.json +1 -1
- package/rollup.config.js +16 -16
- package/src/bootstrapApplicationConfig.ts +782 -782
- package/src/core/actionHandler.ts +23 -23
- 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/http-types.ts +4 -4
- package/src/core/pluginManager.ts +184 -184
- package/src/core/providers/runtimeProvider.ts +5 -5
- package/src/core/request.ts +96 -96
- package/src/core/response.ts +79 -79
- package/src/core/routeContext.ts +127 -127
- package/src/core/routesBuilder.ts +90 -90
- package/src/core/server.ts +152 -152
- package/src/dataAccess/columnTypeMapper.ts +22 -22
- package/src/dataAccess/dataAccessTypes.ts +165 -165
- package/src/dataAccess/dataAccessor.ts +135 -135
- package/src/dataAccess/entityManager.ts +1932 -1932
- package/src/dataAccess/entityMapper.ts +111 -111
- package/src/dataAccess/entityValidator.ts +33 -33
- package/src/dataAccess/propertyMapper.ts +28 -28
- package/src/deno-std/assert/assert.ts +9 -9
- package/src/deno-std/assert/assertion_error.ts +7 -7
- 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/cache/CacheFacilityTypes.ts +29 -29
- package/src/facilities/cache/CacheFactory.ts +31 -31
- package/src/facilities/cache/MemoryCache.ts +58 -58
- package/src/facilities/cache/MemoryCacheProvider.ts +15 -15
- package/src/facilities/log/LogFacility.ts +35 -35
- package/src/helpers/entityHelpers.ts +76 -76
- package/src/helpers/filterHelper.ts +148 -148
- package/src/helpers/inputHelper.ts +11 -11
- package/src/helpers/licenseHelper.ts +29 -29
- package/src/helpers/metaHelper.ts +111 -111
- package/src/helpers/runCollectionEntityActionHandler.ts +58 -58
- package/src/index.ts +77 -76
- package/src/plugins/auth/AuthPlugin.ts +103 -93
- package/src/plugins/auth/AuthPluginTypes.ts +11 -0
- package/src/plugins/auth/actionHandlers/changePassword.ts +63 -61
- package/src/plugins/auth/actionHandlers/createSession.ts +69 -67
- package/src/plugins/auth/actionHandlers/deleteSession.ts +18 -18
- package/src/plugins/auth/actionHandlers/getMyProfile.ts +38 -35
- package/src/plugins/auth/actionHandlers/index.ts +8 -8
- package/src/plugins/auth/actionHandlers/resetPassword.ts +47 -45
- 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/auth/services/AuthService.ts +39 -39
- package/src/plugins/cronJob/CronJobPlugin.ts +104 -104
- package/src/plugins/cronJob/CronJobPluginTypes.ts +44 -44
- package/src/plugins/cronJob/actionHandlers/index.ts +4 -4
- package/src/plugins/cronJob/actionHandlers/runCronJob.ts +32 -32
- package/src/plugins/cronJob/entityWatchers/cronJobEntityWatchers.ts +24 -24
- package/src/plugins/cronJob/entityWatchers/index.ts +4 -4
- package/src/plugins/cronJob/models/CronJob.ts +129 -129
- package/src/plugins/cronJob/models/index.ts +3 -3
- package/src/plugins/cronJob/routes/index.ts +3 -3
- package/src/plugins/cronJob/routes/runCronJob.ts +15 -15
- package/src/plugins/cronJob/services/CronJobService.ts +252 -252
- package/src/plugins/dataManage/DataManagePlugin.ts +163 -163
- package/src/plugins/dataManage/actionHandlers/addEntityRelations.ts +15 -15
- package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +17 -17
- package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +81 -81
- package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +20 -20
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntities.ts +45 -45
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +20 -20
- package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +27 -27
- package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +30 -30
- package/src/plugins/dataManage/actionHandlers/queryDatabase.ts +22 -22
- package/src/plugins/dataManage/actionHandlers/removeEntityRelations.ts +15 -15
- package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +38 -38
- package/src/plugins/entityAccessControl/EntityAccessControlPlugin.ts +146 -146
- package/src/plugins/fileManage/FileManagePlugin.ts +52 -52
- package/src/plugins/fileManage/actionHandlers/downloadDocument.ts +65 -65
- 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/license/LicensePlugin.ts +79 -79
- package/src/plugins/license/LicensePluginTypes.ts +95 -95
- package/src/plugins/license/LicenseService.ts +118 -118
- package/src/plugins/license/actionHandlers/getLicense.ts +18 -18
- package/src/plugins/license/actionHandlers/index.ts +4 -4
- package/src/plugins/license/helpers/certHelper.ts +21 -21
- package/src/plugins/license/helpers/cryptoHelper.ts +47 -47
- package/src/plugins/license/models/index.ts +1 -1
- package/src/plugins/license/routes/getLicense.ts +15 -15
- package/src/plugins/license/routes/index.ts +3 -3
- package/src/plugins/mail/MailPlugin.ts +74 -74
- package/src/plugins/mail/MailPluginTypes.ts +27 -27
- package/src/plugins/mail/MailService.ts +38 -38
- package/src/plugins/mail/actionHandlers/index.ts +3 -3
- package/src/plugins/mail/models/index.ts +1 -1
- package/src/plugins/mail/routes/index.ts +1 -1
- package/src/plugins/metaManage/MetaManagePlugin.ts +198 -198
- 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/metaManage/services/MetaService.ts +376 -376
- package/src/plugins/notification/NotificationPlugin.ts +68 -68
- package/src/plugins/notification/NotificationPluginTypes.ts +13 -13
- package/src/plugins/notification/NotificationService.ts +25 -25
- package/src/plugins/notification/actionHandlers/index.ts +3 -3
- package/src/plugins/notification/models/Notification.ts +60 -60
- package/src/plugins/notification/models/index.ts +3 -3
- package/src/plugins/notification/routes/index.ts +1 -1
- package/src/plugins/routeManage/RouteManagePlugin.ts +64 -62
- package/src/plugins/routeManage/actionHandlers/httpProxy.ts +13 -13
- package/src/plugins/routeManage/actionHandlers/mock.ts +28 -0
- package/src/plugins/sequence/SequencePlugin.ts +146 -146
- package/src/plugins/sequence/SequencePluginTypes.ts +69 -69
- package/src/plugins/sequence/SequenceService.ts +92 -92
- 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 +90 -90
- package/src/plugins/sequence/segments/dayOfMonth.ts +19 -19
- package/src/plugins/sequence/segments/index.ts +9 -9
- package/src/plugins/sequence/segments/literal.ts +16 -16
- package/src/plugins/sequence/segments/month.ts +19 -19
- package/src/plugins/sequence/segments/parameter.ts +20 -20
- package/src/plugins/sequence/segments/year.ts +19 -19
- 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/serverOperation/actionHandlers/runServerOperation.ts +15 -15
- 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 +48 -48
- 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 +55 -55
- 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 +196 -196
- package/src/plugins/stateMachine/StateMachinePluginTypes.ts +48 -48
- package/src/plugins/stateMachine/actionHandlers/index.ts +4 -4
- package/src/plugins/stateMachine/actionHandlers/sendStateMachineEvent.ts +54 -54
- 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/stateMachine/stateMachineHelper.ts +36 -36
- package/src/plugins/webhooks/WebhooksPlugin.ts +148 -148
- package/src/plugins/webhooks/pluginConfig.ts +75 -75
- package/src/polyfill.ts +5 -5
- package/src/proxy/mod.ts +38 -38
- package/src/proxy/types.ts +21 -21
- package/src/queryBuilder/index.ts +1 -1
- package/src/queryBuilder/queryBuilder.ts +755 -755
- package/src/server.ts +523 -523
- package/src/types/cron-job-types.ts +66 -66
- package/src/types.ts +854 -832
- package/src/utilities/accessControlUtility.ts +33 -33
- package/src/utilities/entityUtility.ts +18 -18
- 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/pathUtility.ts +14 -14
- package/src/utilities/timeUtility.ts +17 -17
- package/src/utilities/typeUtility.ts +15 -15
- package/tsconfig.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @ruiapp/rapid-core
|
|
2
|
-
|
|
3
|
-
## 0.7.0
|
|
4
|
-
|
|
5
|
-
- feature: added server.registerCronJob to allow plugins register cron jobs.
|
|
6
|
-
|
|
7
|
-
## 0.2.4
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- 146a99d: add between filterMode, range is deprecated
|
|
1
|
+
# @ruiapp/rapid-core
|
|
2
|
+
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
- feature: added server.registerCronJob to allow plugins register cron jobs.
|
|
6
|
+
|
|
7
|
+
## 0.2.4
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 146a99d: add between filterMode, range is deprecated
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { default as SequencePlugin } from "./plugins/sequence/SequencePlugin";
|
|
|
29
29
|
export * from "./plugins/sequence/SequencePluginTypes";
|
|
30
30
|
export { default as WebhooksPlugin } from "./plugins/webhooks/WebhooksPlugin";
|
|
31
31
|
export { default as AuthPlugin } from "./plugins/auth/AuthPlugin";
|
|
32
|
+
export * from "./plugins/auth/AuthPluginTypes";
|
|
32
33
|
export { default as FileManagePlugin } from "./plugins/fileManage/FileManagePlugin";
|
|
33
34
|
export { default as LicensePlugin } from "./plugins/license/LicensePlugin";
|
|
34
35
|
export * from "./plugins/license/LicensePluginTypes";
|
package/dist/index.js
CHANGED
|
@@ -2815,8 +2815,8 @@ async function findManyRelationLinksViaLinkTable(options) {
|
|
|
2815
2815
|
const command = `SELECT * FROM ${server.queryBuilder.quoteTable({
|
|
2816
2816
|
schema: relationProperty.linkSchema,
|
|
2817
2817
|
tableName: relationProperty.linkTableName,
|
|
2818
|
-
})} WHERE ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = ANY($1::int[])
|
|
2819
|
-
ORDER BY id
|
|
2818
|
+
})} WHERE ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = ANY($1::int[])
|
|
2819
|
+
ORDER BY id
|
|
2820
2820
|
`;
|
|
2821
2821
|
const params = [mainEntityIds];
|
|
2822
2822
|
const relationLinks = await server.queryDatabaseObject(command, params, routeContext?.getDbTransactionClient());
|
|
@@ -3447,7 +3447,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
|
|
|
3447
3447
|
await server.queryDatabaseObject(`DELETE FROM ${server.queryBuilder.quoteTable({
|
|
3448
3448
|
schema: property.linkSchema,
|
|
3449
3449
|
tableName: property.linkTableName,
|
|
3450
|
-
})} WHERE ${server.queryBuilder.quoteObject(property.selfIdColumnName)} = $1
|
|
3450
|
+
})} WHERE ${server.queryBuilder.quoteObject(property.selfIdColumnName)} = $1
|
|
3451
3451
|
AND ${server.queryBuilder.quoteObject(property.targetIdColumnName)} <> ALL($2::int[])`, [id, targetIdsToKeep], routeContext?.getDbTransactionClient());
|
|
3452
3452
|
}
|
|
3453
3453
|
else {
|
|
@@ -3476,8 +3476,8 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
|
|
|
3476
3476
|
await server.queryDatabaseObject(`UPDATE ${server.queryBuilder.quoteTable({
|
|
3477
3477
|
schema: relationModel.schema,
|
|
3478
3478
|
tableName: relationModel.tableName,
|
|
3479
|
-
})}
|
|
3480
|
-
SET ${server.queryBuilder.quoteObject(property.selfIdColumnName)} = null
|
|
3479
|
+
})}
|
|
3480
|
+
SET ${server.queryBuilder.quoteObject(property.selfIdColumnName)} = null
|
|
3481
3481
|
WHERE id = ANY($1::int[])`, [targetIdsToRemove], routeContext?.getDbTransactionClient());
|
|
3482
3482
|
}
|
|
3483
3483
|
else {
|
|
@@ -3762,7 +3762,7 @@ async function deleteEntityById(server, dataAccessor, options, plugin) {
|
|
|
3762
3762
|
await server.queryDatabaseObject(`DELETE FROM ${server.queryBuilder.quoteTable({
|
|
3763
3763
|
schema: relationProperty.linkSchema,
|
|
3764
3764
|
tableName: relationProperty.linkTableName,
|
|
3765
|
-
})}
|
|
3765
|
+
})}
|
|
3766
3766
|
WHERE ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = $1`, [id], routeContext?.getDbTransactionClient());
|
|
3767
3767
|
}
|
|
3768
3768
|
else {
|
|
@@ -3772,8 +3772,8 @@ async function deleteEntityById(server, dataAccessor, options, plugin) {
|
|
|
3772
3772
|
await server.queryDatabaseObject(`UPDATE ${server.queryBuilder.quoteTable({
|
|
3773
3773
|
schema: relationModel.schema,
|
|
3774
3774
|
tableName: relationModel.tableName,
|
|
3775
|
-
})}
|
|
3776
|
-
SET ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = null
|
|
3775
|
+
})}
|
|
3776
|
+
SET ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = null
|
|
3777
3777
|
WHERE ${server.queryBuilder.quoteObject(relationProperty.selfIdColumnName)} = $1`, [id], routeContext?.getDbTransactionClient());
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
@@ -3870,11 +3870,11 @@ class EntityManager {
|
|
|
3870
3870
|
const command = `INSERT INTO ${queryBuilder.quoteTable({
|
|
3871
3871
|
schema: relationProperty.linkSchema,
|
|
3872
3872
|
tableName: relationProperty.linkTableName,
|
|
3873
|
-
})} (${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)})
|
|
3874
|
-
SELECT $1, $2 WHERE NOT EXISTS (
|
|
3875
|
-
SELECT ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}
|
|
3876
|
-
FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
|
|
3877
|
-
WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2
|
|
3873
|
+
})} (${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)})
|
|
3874
|
+
SELECT $1, $2 WHERE NOT EXISTS (
|
|
3875
|
+
SELECT ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}, ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}
|
|
3876
|
+
FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
|
|
3877
|
+
WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2
|
|
3878
3878
|
)`;
|
|
3879
3879
|
const params = [id, relation.id];
|
|
3880
3880
|
await server.queryDatabaseObject(command, params, routeContext?.getDbTransactionClient());
|
|
@@ -3914,7 +3914,7 @@ class EntityManager {
|
|
|
3914
3914
|
const { queryBuilder } = server;
|
|
3915
3915
|
if (relationProperty.linkTableName) {
|
|
3916
3916
|
for (const relation of relations) {
|
|
3917
|
-
const command = `DELETE FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
|
|
3917
|
+
const command = `DELETE FROM ${queryBuilder.quoteTable({ schema: relationProperty.linkSchema, tableName: relationProperty.linkTableName })}
|
|
3918
3918
|
WHERE ${queryBuilder.quoteObject(relationProperty.selfIdColumnName)}=$1 AND ${queryBuilder.quoteObject(relationProperty.targetIdColumnName)}=$2;`;
|
|
3919
3919
|
const params = [id, relation.id];
|
|
3920
3920
|
await server.queryDatabaseObject(command, params, routeContext?.getDbTransactionClient());
|
|
@@ -5113,32 +5113,32 @@ class CacheFactory {
|
|
|
5113
5113
|
}
|
|
5114
5114
|
}
|
|
5115
5115
|
|
|
5116
|
-
const code$
|
|
5117
|
-
async function handler$
|
|
5116
|
+
const code$v = "listMetaModels";
|
|
5117
|
+
async function handler$v(plugin, ctx, options) {
|
|
5118
5118
|
const { applicationConfig } = ctx;
|
|
5119
5119
|
ctx.output = { list: applicationConfig.models };
|
|
5120
5120
|
}
|
|
5121
5121
|
|
|
5122
5122
|
var listMetaModels = /*#__PURE__*/Object.freeze({
|
|
5123
5123
|
__proto__: null,
|
|
5124
|
-
code: code$
|
|
5125
|
-
handler: handler$
|
|
5124
|
+
code: code$v,
|
|
5125
|
+
handler: handler$v
|
|
5126
5126
|
});
|
|
5127
5127
|
|
|
5128
|
-
const code$
|
|
5129
|
-
async function handler$
|
|
5128
|
+
const code$u = "listMetaRoutes";
|
|
5129
|
+
async function handler$u(plugin, ctx, options) {
|
|
5130
5130
|
const { applicationConfig } = ctx;
|
|
5131
5131
|
ctx.output = { list: applicationConfig.routes };
|
|
5132
5132
|
}
|
|
5133
5133
|
|
|
5134
5134
|
var listMetaRoutes = /*#__PURE__*/Object.freeze({
|
|
5135
5135
|
__proto__: null,
|
|
5136
|
-
code: code$
|
|
5137
|
-
handler: handler$
|
|
5136
|
+
code: code$u,
|
|
5137
|
+
handler: handler$u
|
|
5138
5138
|
});
|
|
5139
5139
|
|
|
5140
|
-
const code$
|
|
5141
|
-
async function handler$
|
|
5140
|
+
const code$t = "getMetaModelDetail";
|
|
5141
|
+
async function handler$t(plugin, ctx, options) {
|
|
5142
5142
|
const { server, input } = ctx;
|
|
5143
5143
|
const model = server.getModel(input);
|
|
5144
5144
|
ctx.output = model;
|
|
@@ -5146,8 +5146,8 @@ async function handler$s(plugin, ctx, options) {
|
|
|
5146
5146
|
|
|
5147
5147
|
var getMetaModelDetail = /*#__PURE__*/Object.freeze({
|
|
5148
5148
|
__proto__: null,
|
|
5149
|
-
code: code$
|
|
5150
|
-
handler: handler$
|
|
5149
|
+
code: code$t,
|
|
5150
|
+
handler: handler$t
|
|
5151
5151
|
});
|
|
5152
5152
|
|
|
5153
5153
|
function removeFiltersWithNullValue(filters) {
|
|
@@ -5372,9 +5372,9 @@ class MetaService {
|
|
|
5372
5372
|
await server.tryQueryDatabaseObject(`COMMENT ON TABLE ${queryBuilder.quoteTable(model)} IS ${queryBuilder.formatValueToSqlLiteral(model.name)};`, []);
|
|
5373
5373
|
}
|
|
5374
5374
|
}
|
|
5375
|
-
const sqlQueryColumnInformations = `SELECT c.table_schema, c.table_name, c.column_name, c.ordinal_position, d.description, c.data_type, c.udt_name, c.is_nullable, c.column_default, c.character_maximum_length, c.numeric_precision, c.numeric_scale
|
|
5376
|
-
FROM information_schema.columns c
|
|
5377
|
-
INNER JOIN pg_catalog.pg_statio_all_tables st ON (st.schemaname = c.table_schema and st.relname = c.table_name)
|
|
5375
|
+
const sqlQueryColumnInformations = `SELECT c.table_schema, c.table_name, c.column_name, c.ordinal_position, d.description, c.data_type, c.udt_name, c.is_nullable, c.column_default, c.character_maximum_length, c.numeric_precision, c.numeric_scale
|
|
5376
|
+
FROM information_schema.columns c
|
|
5377
|
+
INNER JOIN pg_catalog.pg_statio_all_tables st ON (st.schemaname = c.table_schema and st.relname = c.table_name)
|
|
5378
5378
|
LEFT JOIN pg_catalog.pg_description d ON (d.objoid = st.relid and d.objsubid = c.ordinal_position);`;
|
|
5379
5379
|
const columnsInDb = await server.queryDatabaseObject(sqlQueryColumnInformations, []);
|
|
5380
5380
|
for (const model of applicationConfig.models) {
|
|
@@ -5736,9 +5736,9 @@ async function runCollectionEntityActionHandler(ctx, options, code, autoMergeInp
|
|
|
5736
5736
|
}
|
|
5737
5737
|
}
|
|
5738
5738
|
|
|
5739
|
-
const code$
|
|
5740
|
-
async function handler$
|
|
5741
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5739
|
+
const code$s = "findCollectionEntities";
|
|
5740
|
+
async function handler$s(plugin, ctx, options) {
|
|
5741
|
+
await runCollectionEntityActionHandler(ctx, options, code$s, true, false, async (entityManager, input) => {
|
|
5742
5742
|
const { routerContext: routeContext } = ctx;
|
|
5743
5743
|
input.filters = removeFiltersWithNullValue(input.filters);
|
|
5744
5744
|
input.routeContext = routeContext;
|
|
@@ -5755,13 +5755,13 @@ async function handler$r(plugin, ctx, options) {
|
|
|
5755
5755
|
|
|
5756
5756
|
var findCollectionEntities = /*#__PURE__*/Object.freeze({
|
|
5757
5757
|
__proto__: null,
|
|
5758
|
-
code: code$
|
|
5759
|
-
handler: handler$
|
|
5758
|
+
code: code$s,
|
|
5759
|
+
handler: handler$s
|
|
5760
5760
|
});
|
|
5761
5761
|
|
|
5762
|
-
const code$
|
|
5763
|
-
async function handler$
|
|
5764
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5762
|
+
const code$r = "findCollectionEntityById";
|
|
5763
|
+
async function handler$r(plugin, ctx, options) {
|
|
5764
|
+
await runCollectionEntityActionHandler(ctx, options, code$r, true, true, async (entityManager, input) => {
|
|
5765
5765
|
const { routerContext: routeContext } = ctx;
|
|
5766
5766
|
const { id } = input;
|
|
5767
5767
|
const entity = await entityManager.findById({
|
|
@@ -5783,13 +5783,13 @@ async function handler$q(plugin, ctx, options) {
|
|
|
5783
5783
|
|
|
5784
5784
|
var findCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
5785
5785
|
__proto__: null,
|
|
5786
|
-
code: code$
|
|
5787
|
-
handler: handler$
|
|
5786
|
+
code: code$r,
|
|
5787
|
+
handler: handler$r
|
|
5788
5788
|
});
|
|
5789
5789
|
|
|
5790
|
-
const code$
|
|
5791
|
-
async function handler$
|
|
5792
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5790
|
+
const code$q = "countCollectionEntities";
|
|
5791
|
+
async function handler$q(plugin, ctx, options) {
|
|
5792
|
+
await runCollectionEntityActionHandler(ctx, options, code$q, true, false, async (entityManager, input) => {
|
|
5793
5793
|
const { routerContext: routeContext } = ctx;
|
|
5794
5794
|
input.filters = removeFiltersWithNullValue(input.filters);
|
|
5795
5795
|
input.routeContext = routeContext;
|
|
@@ -5800,13 +5800,13 @@ async function handler$p(plugin, ctx, options) {
|
|
|
5800
5800
|
|
|
5801
5801
|
var countCollectionEntities = /*#__PURE__*/Object.freeze({
|
|
5802
5802
|
__proto__: null,
|
|
5803
|
-
code: code$
|
|
5804
|
-
handler: handler$
|
|
5803
|
+
code: code$q,
|
|
5804
|
+
handler: handler$q
|
|
5805
5805
|
});
|
|
5806
5806
|
|
|
5807
|
-
const code$
|
|
5808
|
-
async function handler$
|
|
5809
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5807
|
+
const code$p = "createCollectionEntity";
|
|
5808
|
+
async function handler$p(plugin, ctx, options) {
|
|
5809
|
+
await runCollectionEntityActionHandler(ctx, options, code$p, true, true, async (entityManager, input) => {
|
|
5810
5810
|
const { routerContext: routeContext } = ctx;
|
|
5811
5811
|
const output = await entityManager.createEntity({
|
|
5812
5812
|
entity: input,
|
|
@@ -5818,16 +5818,16 @@ async function handler$o(plugin, ctx, options) {
|
|
|
5818
5818
|
|
|
5819
5819
|
var createCollectionEntity = /*#__PURE__*/Object.freeze({
|
|
5820
5820
|
__proto__: null,
|
|
5821
|
-
code: code$
|
|
5822
|
-
handler: handler$
|
|
5821
|
+
code: code$p,
|
|
5822
|
+
handler: handler$p
|
|
5823
5823
|
});
|
|
5824
5824
|
|
|
5825
|
-
const code$
|
|
5826
|
-
async function handler$
|
|
5825
|
+
const code$o = "createCollectionEntitiesBatch";
|
|
5826
|
+
async function handler$o(plugin, ctx, options) {
|
|
5827
5827
|
const { input } = ctx;
|
|
5828
5828
|
const { noTransaction } = input;
|
|
5829
5829
|
const { defaultInput, fixedInput } = options;
|
|
5830
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5830
|
+
await runCollectionEntityActionHandler(ctx, options, code$o, false, !noTransaction, async (entityManager, input) => {
|
|
5831
5831
|
const { routerContext: routeContext } = ctx;
|
|
5832
5832
|
const { entities } = input;
|
|
5833
5833
|
if (!lodash.isArray(entities)) {
|
|
@@ -5865,13 +5865,13 @@ async function createEntities(options) {
|
|
|
5865
5865
|
|
|
5866
5866
|
var createCollectionEntitiesBatch = /*#__PURE__*/Object.freeze({
|
|
5867
5867
|
__proto__: null,
|
|
5868
|
-
code: code$
|
|
5869
|
-
handler: handler$
|
|
5868
|
+
code: code$o,
|
|
5869
|
+
handler: handler$o
|
|
5870
5870
|
});
|
|
5871
5871
|
|
|
5872
|
-
const code$
|
|
5873
|
-
async function handler$
|
|
5874
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5872
|
+
const code$n = "updateCollectionEntityById";
|
|
5873
|
+
async function handler$n(plugin, ctx, options) {
|
|
5874
|
+
await runCollectionEntityActionHandler(ctx, options, code$n, true, true, async (entityManager, input) => {
|
|
5875
5875
|
const { routerContext: routeContext } = ctx;
|
|
5876
5876
|
const operation = input.$operation;
|
|
5877
5877
|
if (operation) {
|
|
@@ -5900,15 +5900,15 @@ async function handler$m(plugin, ctx, options) {
|
|
|
5900
5900
|
|
|
5901
5901
|
var updateCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
5902
5902
|
__proto__: null,
|
|
5903
|
-
code: code$
|
|
5904
|
-
handler: handler$
|
|
5903
|
+
code: code$n,
|
|
5904
|
+
handler: handler$n
|
|
5905
5905
|
});
|
|
5906
5906
|
|
|
5907
|
-
const code$
|
|
5908
|
-
async function handler$
|
|
5907
|
+
const code$m = "deleteCollectionEntities";
|
|
5908
|
+
async function handler$m(plugin, ctx, options) {
|
|
5909
5909
|
const { input } = ctx;
|
|
5910
5910
|
const { noTransaction } = input;
|
|
5911
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5911
|
+
await runCollectionEntityActionHandler(ctx, options, code$m, true, !noTransaction, async (entityManager, input) => {
|
|
5912
5912
|
const { routerContext: routeContext } = ctx;
|
|
5913
5913
|
const { filters } = input;
|
|
5914
5914
|
if (!filters || !filters.length) {
|
|
@@ -5930,13 +5930,13 @@ async function handler$l(plugin, ctx, options) {
|
|
|
5930
5930
|
|
|
5931
5931
|
var deleteCollectionEntities = /*#__PURE__*/Object.freeze({
|
|
5932
5932
|
__proto__: null,
|
|
5933
|
-
code: code$
|
|
5934
|
-
handler: handler$
|
|
5933
|
+
code: code$m,
|
|
5934
|
+
handler: handler$m
|
|
5935
5935
|
});
|
|
5936
5936
|
|
|
5937
|
-
const code$
|
|
5938
|
-
async function handler$
|
|
5939
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5937
|
+
const code$l = "deleteCollectionEntityById";
|
|
5938
|
+
async function handler$l(plugin, ctx, options) {
|
|
5939
|
+
await runCollectionEntityActionHandler(ctx, options, code$l, true, true, async (entityManager, input) => {
|
|
5940
5940
|
const { routerContext: routeContext } = ctx;
|
|
5941
5941
|
await entityManager.deleteById({
|
|
5942
5942
|
id: input.id,
|
|
@@ -5948,13 +5948,13 @@ async function handler$k(plugin, ctx, options) {
|
|
|
5948
5948
|
|
|
5949
5949
|
var deleteCollectionEntityById = /*#__PURE__*/Object.freeze({
|
|
5950
5950
|
__proto__: null,
|
|
5951
|
-
code: code$
|
|
5952
|
-
handler: handler$
|
|
5951
|
+
code: code$l,
|
|
5952
|
+
handler: handler$l
|
|
5953
5953
|
});
|
|
5954
5954
|
|
|
5955
|
-
const code$
|
|
5956
|
-
async function handler$
|
|
5957
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5955
|
+
const code$k = "addEntityRelations";
|
|
5956
|
+
async function handler$k(plugin, ctx, options) {
|
|
5957
|
+
await runCollectionEntityActionHandler(ctx, options, code$k, true, true, async (entityManager, input) => {
|
|
5958
5958
|
const { routerContext: routeContext } = ctx;
|
|
5959
5959
|
input.routeContext = routeContext;
|
|
5960
5960
|
await entityManager.addRelations(input, plugin);
|
|
@@ -5964,13 +5964,13 @@ async function handler$j(plugin, ctx, options) {
|
|
|
5964
5964
|
|
|
5965
5965
|
var addEntityRelations = /*#__PURE__*/Object.freeze({
|
|
5966
5966
|
__proto__: null,
|
|
5967
|
-
code: code$
|
|
5968
|
-
handler: handler$
|
|
5967
|
+
code: code$k,
|
|
5968
|
+
handler: handler$k
|
|
5969
5969
|
});
|
|
5970
5970
|
|
|
5971
|
-
const code$
|
|
5972
|
-
async function handler$
|
|
5973
|
-
await runCollectionEntityActionHandler(ctx, options, code$
|
|
5971
|
+
const code$j = "removeEntityRelations";
|
|
5972
|
+
async function handler$j(plugin, ctx, options) {
|
|
5973
|
+
await runCollectionEntityActionHandler(ctx, options, code$j, true, true, async (entityManager, input) => {
|
|
5974
5974
|
const { routerContext: routeContext } = ctx;
|
|
5975
5975
|
input.routeContext = routeContext;
|
|
5976
5976
|
await entityManager.removeRelations(input, plugin);
|
|
@@ -5980,16 +5980,16 @@ async function handler$i(plugin, ctx, options) {
|
|
|
5980
5980
|
|
|
5981
5981
|
var removeEntityRelations = /*#__PURE__*/Object.freeze({
|
|
5982
5982
|
__proto__: null,
|
|
5983
|
-
code: code$
|
|
5984
|
-
handler: handler$
|
|
5983
|
+
code: code$j,
|
|
5984
|
+
handler: handler$j
|
|
5985
5985
|
});
|
|
5986
5986
|
|
|
5987
|
-
const code$
|
|
5988
|
-
async function handler$
|
|
5987
|
+
const code$i = "queryDatabase";
|
|
5988
|
+
async function handler$i(plugin, ctx, options) {
|
|
5989
5989
|
const { logger, server, input } = ctx;
|
|
5990
5990
|
const { sql, querySingle, defaultInput, fixedInput } = options;
|
|
5991
5991
|
const mergedInput = mergeInput(defaultInput, input, fixedInput);
|
|
5992
|
-
logger.debug(`Running ${code$
|
|
5992
|
+
logger.debug(`Running ${code$i} handler...`, { defaultInput, fixedInput, mergedInput });
|
|
5993
5993
|
const result = await server.queryDatabaseObject(sql, mergedInput);
|
|
5994
5994
|
if (querySingle) {
|
|
5995
5995
|
ctx.output = lodash.first(result);
|
|
@@ -6001,8 +6001,8 @@ async function handler$h(plugin, ctx, options) {
|
|
|
6001
6001
|
|
|
6002
6002
|
var queryDatabase = /*#__PURE__*/Object.freeze({
|
|
6003
6003
|
__proto__: null,
|
|
6004
|
-
code: code$
|
|
6005
|
-
handler: handler$
|
|
6004
|
+
code: code$i,
|
|
6005
|
+
handler: handler$i
|
|
6006
6006
|
});
|
|
6007
6007
|
|
|
6008
6008
|
/**
|
|
@@ -6180,14 +6180,38 @@ async function sendSourceResponse(proxyCtx, targetRes) {
|
|
|
6180
6180
|
srcRes.body = targetRes.body;
|
|
6181
6181
|
}
|
|
6182
6182
|
|
|
6183
|
-
const code$
|
|
6184
|
-
async function handler$
|
|
6183
|
+
const code$h = "httpProxy";
|
|
6184
|
+
async function handler$h(plugin, ctx, options) {
|
|
6185
6185
|
const { logger } = ctx;
|
|
6186
|
-
logger.debug(`Running ${code$
|
|
6186
|
+
logger.debug(`Running ${code$h} handler...`);
|
|
6187
6187
|
await doProxy(ctx.routerContext, options);
|
|
6188
6188
|
}
|
|
6189
6189
|
|
|
6190
|
-
var
|
|
6190
|
+
var httpProxyActionHandler = /*#__PURE__*/Object.freeze({
|
|
6191
|
+
__proto__: null,
|
|
6192
|
+
code: code$h,
|
|
6193
|
+
handler: handler$h
|
|
6194
|
+
});
|
|
6195
|
+
|
|
6196
|
+
const code$g = "mock";
|
|
6197
|
+
async function handler$g(plugin, ctx, options) {
|
|
6198
|
+
const { logger, routerContext } = ctx;
|
|
6199
|
+
const { response } = routerContext;
|
|
6200
|
+
const { responseTime, responseStatus, responseHeaders, responseBody } = options;
|
|
6201
|
+
if (responseTime) {
|
|
6202
|
+
await waitMilliseconds(responseTime);
|
|
6203
|
+
}
|
|
6204
|
+
for (const [key, value] of Object.entries(responseHeaders)) {
|
|
6205
|
+
response.headers.set(key, value);
|
|
6206
|
+
}
|
|
6207
|
+
response.status = responseStatus || 200;
|
|
6208
|
+
response.body = responseBody || "";
|
|
6209
|
+
}
|
|
6210
|
+
function waitMilliseconds(ms) {
|
|
6211
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6212
|
+
}
|
|
6213
|
+
|
|
6214
|
+
var mockActionHandler = /*#__PURE__*/Object.freeze({
|
|
6191
6215
|
__proto__: null,
|
|
6192
6216
|
code: code$g,
|
|
6193
6217
|
handler: handler$g
|
|
@@ -6213,7 +6237,8 @@ class RouteManager {
|
|
|
6213
6237
|
return [];
|
|
6214
6238
|
}
|
|
6215
6239
|
async registerActionHandlers(server) {
|
|
6216
|
-
server.registerActionHandler(this,
|
|
6240
|
+
server.registerActionHandler(this, httpProxyActionHandler);
|
|
6241
|
+
server.registerActionHandler(this, mockActionHandler);
|
|
6217
6242
|
}
|
|
6218
6243
|
async registerEventHandlers(server) {
|
|
6219
6244
|
// TODO: Should rebuild routes after route configurations changed.
|
|
@@ -6851,8 +6876,9 @@ async function handler$e(plugin, ctx, options) {
|
|
|
6851
6876
|
};
|
|
6852
6877
|
return;
|
|
6853
6878
|
}
|
|
6879
|
+
const userEntitySingularCode = plugin.options?.userEntitySingularCode || "oc_user";
|
|
6854
6880
|
const userDataAccessor = server.getDataAccessor({
|
|
6855
|
-
singularCode:
|
|
6881
|
+
singularCode: userEntitySingularCode,
|
|
6856
6882
|
});
|
|
6857
6883
|
const user = await userDataAccessor.findOne({
|
|
6858
6884
|
filters: [
|
|
@@ -6890,8 +6916,9 @@ async function handler$d(plugin, ctx, options) {
|
|
|
6890
6916
|
const { response } = routeContext;
|
|
6891
6917
|
const { account, password } = input;
|
|
6892
6918
|
validateLicense(server);
|
|
6919
|
+
const userEntitySingularCode = plugin.options?.userEntitySingularCode || "oc_user";
|
|
6893
6920
|
const userDataAccessor = server.getDataAccessor({
|
|
6894
|
-
singularCode:
|
|
6921
|
+
singularCode: userEntitySingularCode,
|
|
6895
6922
|
});
|
|
6896
6923
|
const user = await userDataAccessor.findOne({
|
|
6897
6924
|
filters: [
|
|
@@ -6969,7 +6996,9 @@ async function handler$b(plugin, ctx, options) {
|
|
|
6969
6996
|
};
|
|
6970
6997
|
return;
|
|
6971
6998
|
}
|
|
6972
|
-
const
|
|
6999
|
+
const userEntitySingularCode = plugin.options?.userEntitySingularCode || "oc_user";
|
|
7000
|
+
const profilePropertyCodes = plugin.options?.profilePropertyCodes || ["id", "name", "login", "email", "department", "roles", "state", "createdAt"];
|
|
7001
|
+
const entityManager = server.getEntityManager(userEntitySingularCode);
|
|
6973
7002
|
const user = await entityManager.findEntity({
|
|
6974
7003
|
filters: [
|
|
6975
7004
|
{
|
|
@@ -6978,7 +7007,7 @@ async function handler$b(plugin, ctx, options) {
|
|
|
6978
7007
|
value: userId,
|
|
6979
7008
|
},
|
|
6980
7009
|
],
|
|
6981
|
-
properties:
|
|
7010
|
+
properties: profilePropertyCodes,
|
|
6982
7011
|
});
|
|
6983
7012
|
ctx.output = {
|
|
6984
7013
|
user,
|
|
@@ -6995,8 +7024,9 @@ const code$a = "resetPassword";
|
|
|
6995
7024
|
async function handler$a(plugin, ctx, options) {
|
|
6996
7025
|
const { server, input, routerContext: routeContext } = ctx;
|
|
6997
7026
|
const { userId, password } = input;
|
|
7027
|
+
const userEntitySingularCode = plugin.options?.userEntitySingularCode || "oc_user";
|
|
6998
7028
|
const userDataAccessor = server.getDataAccessor({
|
|
6999
|
-
singularCode:
|
|
7029
|
+
singularCode: userEntitySingularCode,
|
|
7000
7030
|
});
|
|
7001
7031
|
const user = await userDataAccessor.findOne({
|
|
7002
7032
|
filters: [
|
|
@@ -7179,7 +7209,14 @@ class AuthService {
|
|
|
7179
7209
|
* Auth manager plugin
|
|
7180
7210
|
*/
|
|
7181
7211
|
class AuthPlugin {
|
|
7212
|
+
#options;
|
|
7182
7213
|
#authService;
|
|
7214
|
+
constructor(options) {
|
|
7215
|
+
this.#options = Object.freeze(options);
|
|
7216
|
+
}
|
|
7217
|
+
get options() {
|
|
7218
|
+
return this.#options;
|
|
7219
|
+
}
|
|
7183
7220
|
get code() {
|
|
7184
7221
|
return "authManager";
|
|
7185
7222
|
}
|
|
@@ -9481,9 +9518,9 @@ class EntityAccessControlPlugin {
|
|
|
9481
9518
|
if (!userId) {
|
|
9482
9519
|
return;
|
|
9483
9520
|
}
|
|
9484
|
-
const actions = await server.queryDatabaseObject(`select distinct a.* from sys_actions a
|
|
9485
|
-
inner join oc_role_sys_action_links ra on a.id = ra.action_id
|
|
9486
|
-
inner join oc_role_user_links ru on ru.role_id = ra.role_id
|
|
9521
|
+
const actions = await server.queryDatabaseObject(`select distinct a.* from sys_actions a
|
|
9522
|
+
inner join oc_role_sys_action_links ra on a.id = ra.action_id
|
|
9523
|
+
inner join oc_role_user_links ru on ru.role_id = ra.role_id
|
|
9487
9524
|
where ru.user_id = $1;`, [userId]);
|
|
9488
9525
|
routeContext.state.allowedActions = actions.map((item) => item.code);
|
|
9489
9526
|
}
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
import { RpdApplicationConfig } from "../../types";
|
|
5
5
|
import { IRpdServer, RapidPlugin, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "../../core/server";
|
|
6
6
|
import { RouteContext } from "../../core/routeContext";
|
|
7
|
+
import { AuthPluginInitOptions } from "./AuthPluginTypes";
|
|
7
8
|
declare class AuthPlugin implements RapidPlugin {
|
|
8
9
|
#private;
|
|
10
|
+
constructor(options: AuthPluginInitOptions);
|
|
11
|
+
get options(): AuthPluginInitOptions;
|
|
9
12
|
get code(): string;
|
|
10
13
|
get description(): string;
|
|
11
14
|
get extendingAbilities(): RpdServerPluginExtendingAbilities[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ActionHandlerContext } from "../../../core/actionHandler";
|
|
2
|
-
import
|
|
2
|
+
import AuthPlugin from "../AuthPlugin";
|
|
3
3
|
export declare const code = "changePassword";
|
|
4
|
-
export declare function handler(plugin:
|
|
4
|
+
export declare function handler(plugin: AuthPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ActionHandlerContext } from "../../../core/actionHandler";
|
|
2
|
-
import
|
|
2
|
+
import AuthPlugin from "../AuthPlugin";
|
|
3
3
|
export declare const code = "createSession";
|
|
4
|
-
export declare function handler(plugin:
|
|
4
|
+
export declare function handler(plugin: AuthPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ActionHandlerContext } from "../../../core/actionHandler";
|
|
2
|
-
import
|
|
2
|
+
import AuthPlugin from "../AuthPlugin";
|
|
3
3
|
export declare const code = "getMyProfile";
|
|
4
|
-
export declare function handler(plugin:
|
|
4
|
+
export declare function handler(plugin: AuthPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ActionHandlerContext } from "../../../core/actionHandler";
|
|
2
|
-
import
|
|
2
|
+
import AuthPlugin from "../AuthPlugin";
|
|
3
3
|
export declare const code = "resetPassword";
|
|
4
|
-
export declare function handler(plugin:
|
|
4
|
+
export declare function handler(plugin: AuthPlugin, ctx: ActionHandlerContext, options: any): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RunMockHandlerOptions } from "../../../types";
|
|
2
|
+
import { ActionHandlerContext } from "../../../core/actionHandler";
|
|
3
|
+
import { RapidPlugin } from "../../../core/server";
|
|
4
|
+
export declare const code = "mock";
|
|
5
|
+
export declare function handler(plugin: RapidPlugin, ctx: ActionHandlerContext, options: RunMockHandlerOptions): Promise<void>;
|
package/dist/types.d.ts
CHANGED
|
@@ -52,6 +52,24 @@ export interface RunProxyHandlerOptions {
|
|
|
52
52
|
/** Target url to proxy */
|
|
53
53
|
target: string;
|
|
54
54
|
}
|
|
55
|
+
export interface RunMockHandlerOptions {
|
|
56
|
+
/**
|
|
57
|
+
* 响应时间,毫秒
|
|
58
|
+
*/
|
|
59
|
+
responseTime?: number;
|
|
60
|
+
/**
|
|
61
|
+
* 响应状态
|
|
62
|
+
*/
|
|
63
|
+
responseStatus?: number;
|
|
64
|
+
/**
|
|
65
|
+
* 响应头
|
|
66
|
+
*/
|
|
67
|
+
responseHeaders?: Record<string, string>;
|
|
68
|
+
/**
|
|
69
|
+
* 响应体
|
|
70
|
+
*/
|
|
71
|
+
responseBody?: any;
|
|
72
|
+
}
|
|
55
73
|
export interface GetDataAccessorOptions {
|
|
56
74
|
namespace?: string;
|
|
57
75
|
singularCode: string;
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import typescript from "rollup-plugin-typescript2";
|
|
2
|
-
import tscAlias from "rollup-plugin-tsc-alias";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
input: ["src/index.ts"],
|
|
6
|
-
output: [
|
|
7
|
-
{
|
|
8
|
-
dir: "dist",
|
|
9
|
-
entryFileNames: "[name].js",
|
|
10
|
-
format: "cjs",
|
|
11
|
-
exports: "named",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
plugins: [typescript(), tscAlias()],
|
|
15
|
-
external: [],
|
|
16
|
-
};
|
|
1
|
+
import typescript from "rollup-plugin-typescript2";
|
|
2
|
+
import tscAlias from "rollup-plugin-tsc-alias";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
input: ["src/index.ts"],
|
|
6
|
+
output: [
|
|
7
|
+
{
|
|
8
|
+
dir: "dist",
|
|
9
|
+
entryFileNames: "[name].js",
|
|
10
|
+
format: "cjs",
|
|
11
|
+
exports: "named",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
plugins: [typescript(), tscAlias()],
|
|
15
|
+
external: [],
|
|
16
|
+
};
|