midway-fatcms 0.0.1-beta.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/README.md +1 -0
- package/dist/config/config.default.d.ts +3 -0
- package/dist/config/config.default.js +148 -0
- package/dist/config/seed/aeskey.txt +1 -0
- package/dist/config/utils.d.ts +1 -0
- package/dist/config/utils.js +23 -0
- package/dist/configuration.d.ts +6 -0
- package/dist/configuration.js +89 -0
- package/dist/controller/base/BaseApiController.d.ts +31 -0
- package/dist/controller/base/BaseApiController.js +138 -0
- package/dist/controller/gateway/AnyApiGatewayController.d.ts +13 -0
- package/dist/controller/gateway/AnyApiGatewayController.js +55 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +21 -0
- package/dist/controller/gateway/CrudMtdGatewayController.js +116 -0
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +38 -0
- package/dist/controller/gateway/CrudStdGatewayController.js +137 -0
- package/dist/controller/gateway/DocGatewayController.d.ts +27 -0
- package/dist/controller/gateway/DocGatewayController.js +174 -0
- package/dist/controller/gateway/FileController.d.ts +25 -0
- package/dist/controller/gateway/FileController.js +129 -0
- package/dist/controller/gateway/ProxyApiGatewayController.d.ts +18 -0
- package/dist/controller/gateway/ProxyApiGatewayController.js +78 -0
- package/dist/controller/gateway/PublicApiController.d.ts +27 -0
- package/dist/controller/gateway/PublicApiController.js +167 -0
- package/dist/controller/gateway/StaticController.d.ts +21 -0
- package/dist/controller/gateway/StaticController.js +265 -0
- package/dist/controller/helpers.controller.d.ts +39 -0
- package/dist/controller/helpers.controller.js +188 -0
- package/dist/controller/home.controller.d.ts +9 -0
- package/dist/controller/home.controller.js +71 -0
- package/dist/controller/manage/AnyApiMangeApi.d.ts +10 -0
- package/dist/controller/manage/AnyApiMangeApi.js +98 -0
- package/dist/controller/manage/AppLogMangeApi.d.ts +10 -0
- package/dist/controller/manage/AppLogMangeApi.js +88 -0
- package/dist/controller/manage/AppMangeApi.d.ts +10 -0
- package/dist/controller/manage/AppMangeApi.js +88 -0
- package/dist/controller/manage/AppPageMangeApi.d.ts +10 -0
- package/dist/controller/manage/AppPageMangeApi.js +87 -0
- package/dist/controller/manage/AppSchemaHistoryApi.d.ts +10 -0
- package/dist/controller/manage/AppSchemaHistoryApi.js +83 -0
- package/dist/controller/manage/CrudMethodsMangeApi.d.ts +10 -0
- package/dist/controller/manage/CrudMethodsMangeApi.js +84 -0
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +38 -0
- package/dist/controller/manage/CrudStandardDesignApi.js +339 -0
- package/dist/controller/manage/DataDictManageApi.d.ts +15 -0
- package/dist/controller/manage/DataDictManageApi.js +133 -0
- package/dist/controller/manage/DeployManageApi.d.ts +19 -0
- package/dist/controller/manage/DeployManageApi.js +176 -0
- package/dist/controller/manage/DocLibManageApi.d.ts +10 -0
- package/dist/controller/manage/DocLibManageApi.js +104 -0
- package/dist/controller/manage/DocManageApi.d.ts +11 -0
- package/dist/controller/manage/DocManageApi.js +130 -0
- package/dist/controller/manage/FileManageApi.d.ts +13 -0
- package/dist/controller/manage/FileManageApi.js +77 -0
- package/dist/controller/manage/LowCodeTplManageApi.d.ts +13 -0
- package/dist/controller/manage/LowCodeTplManageApi.js +86 -0
- package/dist/controller/manage/MenuManageApi.d.ts +10 -0
- package/dist/controller/manage/MenuManageApi.js +93 -0
- package/dist/controller/manage/ProxyApiMangeApi.d.ts +10 -0
- package/dist/controller/manage/ProxyApiMangeApi.js +87 -0
- package/dist/controller/manage/SuperAdminManageApi.d.ts +24 -0
- package/dist/controller/manage/SuperAdminManageApi.js +149 -0
- package/dist/controller/manage/SysConfigMangeApi.d.ts +11 -0
- package/dist/controller/manage/SysConfigMangeApi.js +124 -0
- package/dist/controller/manage/SystemInfoManageApi.d.ts +12 -0
- package/dist/controller/manage/SystemInfoManageApi.js +66 -0
- package/dist/controller/manage/UserAccountManageApi.d.ts +14 -0
- package/dist/controller/manage/UserAccountManageApi.js +124 -0
- package/dist/controller/manage/WorkbenchMangeApi.d.ts +11 -0
- package/dist/controller/manage/WorkbenchMangeApi.js +103 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +35 -0
- package/dist/controller/medstatistic/MedAdminController.js +205 -0
- package/dist/controller/medstatistic/MedClientController.d.ts +28 -0
- package/dist/controller/medstatistic/MedClientController.js +188 -0
- package/dist/controller/medstatistic/MedMessageService.d.ts +19 -0
- package/dist/controller/medstatistic/MedMessageService.js +95 -0
- package/dist/controller/medstatistic/MedScoreService.d.ts +21 -0
- package/dist/controller/medstatistic/MedScoreService.js +107 -0
- package/dist/controller/medstatistic/constants.d.ts +32 -0
- package/dist/controller/medstatistic/constants.js +43 -0
- package/dist/controller/myinfo/AuthController.d.ts +37 -0
- package/dist/controller/myinfo/AuthController.js +189 -0
- package/dist/controller/myinfo/MyInfoController.d.ts +13 -0
- package/dist/controller/myinfo/MyInfoController.js +51 -0
- package/dist/controller/render/AppRenderController.d.ts +11 -0
- package/dist/controller/render/AppRenderController.js +85 -0
- package/dist/controller/test.controller.d.ts +8 -0
- package/dist/controller/test.controller.js +51 -0
- package/dist/filter/default.filter.d.ts +7 -0
- package/dist/filter/default.filter.js +23 -0
- package/dist/filter/notfound.filter.d.ts +5 -0
- package/dist/filter/notfound.filter.js +20 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +88 -0
- package/dist/interface.d.ts +27 -0
- package/dist/interface.js +3 -0
- package/dist/libs/crud-pro/CrudPro.d.ts +36 -0
- package/dist/libs/crud-pro/CrudPro.js +131 -0
- package/dist/libs/crud-pro/defaultConfigs.d.ts +4 -0
- package/dist/libs/crud-pro/defaultConfigs.js +13 -0
- package/dist/libs/crud-pro/exceptions.d.ts +104 -0
- package/dist/libs/crud-pro/exceptions.js +117 -0
- package/dist/libs/crud-pro/interfaces.d.ts +157 -0
- package/dist/libs/crud-pro/interfaces.js +12 -0
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +42 -0
- package/dist/libs/crud-pro/models/ExecuteContext.js +79 -0
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +31 -0
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +64 -0
- package/dist/libs/crud-pro/models/FuncContext.d.ts +18 -0
- package/dist/libs/crud-pro/models/FuncContext.js +6 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +65 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.js +81 -0
- package/dist/libs/crud-pro/models/RequestModel.d.ts +25 -0
- package/dist/libs/crud-pro/models/RequestModel.js +113 -0
- package/dist/libs/crud-pro/models/ServiceHub.d.ts +20 -0
- package/dist/libs/crud-pro/models/ServiceHub.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +22 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.js +40 -0
- package/dist/libs/crud-pro/models/SqlSegArg.d.ts +6 -0
- package/dist/libs/crud-pro/models/SqlSegArg.js +12 -0
- package/dist/libs/crud-pro/models/Transaction.d.ts +29 -0
- package/dist/libs/crud-pro/models/Transaction.js +67 -0
- package/dist/libs/crud-pro/models/TransactionMySQL.d.ts +28 -0
- package/dist/libs/crud-pro/models/TransactionMySQL.js +76 -0
- package/dist/libs/crud-pro/models/TransactionPostgres.d.ts +28 -0
- package/dist/libs/crud-pro/models/TransactionPostgres.js +85 -0
- package/dist/libs/crud-pro/models/TransactionSqlServer.d.ts +34 -0
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +92 -0
- package/dist/libs/crud-pro/models/keys.d.ts +106 -0
- package/dist/libs/crud-pro/models/keys.js +149 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +10 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +61 -0
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.d.ts +9 -0
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.js +112 -0
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.d.ts +17 -0
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +227 -0
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.d.ts +9 -0
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.js +51 -0
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.d.ts +13 -0
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.js +148 -0
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +24 -0
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +342 -0
- package/dist/libs/crud-pro/services/CrudProGenSqlService.d.ts +25 -0
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +174 -0
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.d.ts +32 -0
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +333 -0
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +28 -0
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +78 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +8 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +53 -0
- package/dist/libs/crud-pro/services/CurdProServiceHub.d.ts +32 -0
- package/dist/libs/crud-pro/services/CurdProServiceHub.js +64 -0
- package/dist/libs/crud-pro/sql.txt +120 -0
- package/dist/libs/crud-pro/utils/CompareUtils.d.ts +9 -0
- package/dist/libs/crud-pro/utils/CompareUtils.js +25 -0
- package/dist/libs/crud-pro/utils/DatabaseName.d.ts +9 -0
- package/dist/libs/crud-pro/utils/DatabaseName.js +29 -0
- package/dist/libs/crud-pro/utils/DateTimeUtils.d.ts +7 -0
- package/dist/libs/crud-pro/utils/DateTimeUtils.js +21 -0
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.d.ts +19 -0
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.js +47 -0
- package/dist/libs/crud-pro/utils/MessageParseUtils.d.ts +5 -0
- package/dist/libs/crud-pro/utils/MessageParseUtils.js +33 -0
- package/dist/libs/crud-pro/utils/MixinUtils.d.ts +39 -0
- package/dist/libs/crud-pro/utils/MixinUtils.js +255 -0
- package/dist/libs/crud-pro/utils/ModelUtils.d.ts +11 -0
- package/dist/libs/crud-pro/utils/ModelUtils.js +49 -0
- package/dist/libs/crud-pro/utils/MultiKeyMap.d.ts +11 -0
- package/dist/libs/crud-pro/utils/MultiKeyMap.js +63 -0
- package/dist/libs/crud-pro/utils/SqlFuncUtils.d.ts +5 -0
- package/dist/libs/crud-pro/utils/SqlFuncUtils.js +29 -0
- package/dist/libs/crud-pro/utils/TypeUtils.d.ts +40 -0
- package/dist/libs/crud-pro/utils/TypeUtils.js +166 -0
- package/dist/libs/crud-pro/utils/ValidateUtils.d.ts +3 -0
- package/dist/libs/crud-pro/utils/ValidateUtils.js +165 -0
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.d.ts +3 -0
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.js +19 -0
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.d.ts +3 -0
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.js +20 -0
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.d.ts +3 -0
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.js +20 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.d.ts +4 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +21 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.d.ts +2 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.js +11 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.d.ts +2 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.js +11 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.d.ts +2 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.js +128 -0
- package/dist/libs/utils/common-dto.d.ts +18 -0
- package/dist/libs/utils/common-dto.js +40 -0
- package/dist/libs/utils/crypto-utils.d.ts +3 -0
- package/dist/libs/utils/crypto-utils.js +46 -0
- package/dist/libs/utils/fatcms-request.d.ts +30 -0
- package/dist/libs/utils/fatcms-request.js +104 -0
- package/dist/libs/utils/functions.d.ts +4 -0
- package/dist/libs/utils/functions.js +63 -0
- package/dist/libs/utils/ordernum-utils.d.ts +2 -0
- package/dist/libs/utils/ordernum-utils.js +13 -0
- package/dist/libs/utils/parseConfig.d.ts +7 -0
- package/dist/libs/utils/parseConfig.js +44 -0
- package/dist/libs/utils/parseCreateSql.d.ts +5 -0
- package/dist/libs/utils/parseCreateSql.js +86 -0
- package/dist/libs/utils/render-utils.d.ts +28 -0
- package/dist/libs/utils/render-utils.js +135 -0
- package/dist/middleware/forbidden.middleware.d.ts +10 -0
- package/dist/middleware/forbidden.middleware.js +70 -0
- package/dist/middleware/global.middleware.d.ts +10 -0
- package/dist/middleware/global.middleware.js +246 -0
- package/dist/middleware/permission.middleware.d.ts +18 -0
- package/dist/middleware/permission.middleware.js +74 -0
- package/dist/middleware/tx.middleware.d.ts +9 -0
- package/dist/middleware/tx.middleware.js +40 -0
- package/dist/models/SystemEntities.d.ts +98 -0
- package/dist/models/SystemEntities.js +2 -0
- package/dist/models/SystemPerm.d.ts +95 -0
- package/dist/models/SystemPerm.js +100 -0
- package/dist/models/SystemTables.d.ts +27 -0
- package/dist/models/SystemTables.js +30 -0
- package/dist/models/bizmodels.d.ts +69 -0
- package/dist/models/bizmodels.js +34 -0
- package/dist/models/contextLogger.d.ts +25 -0
- package/dist/models/contextLogger.js +112 -0
- package/dist/models/devops.d.ts +12 -0
- package/dist/models/devops.js +19 -0
- package/dist/models/userSession.d.ts +61 -0
- package/dist/models/userSession.js +165 -0
- package/dist/schedule/index.d.ts +3 -0
- package/dist/schedule/index.js +69 -0
- package/dist/service/AuthService.d.ts +70 -0
- package/dist/service/AuthService.js +248 -0
- package/dist/service/EnumInfoService.d.ts +30 -0
- package/dist/service/EnumInfoService.js +123 -0
- package/dist/service/FileCenterService.d.ts +43 -0
- package/dist/service/FileCenterService.js +347 -0
- package/dist/service/SysConfigService.d.ts +7 -0
- package/dist/service/SysConfigService.js +45 -0
- package/dist/service/UserAccountService.d.ts +23 -0
- package/dist/service/UserAccountService.js +103 -0
- package/dist/service/UserSessionService.d.ts +16 -0
- package/dist/service/UserSessionService.js +85 -0
- package/dist/service/VisitStatService.d.ts +14 -0
- package/dist/service/VisitStatService.js +165 -0
- package/dist/service/WorkbenchService.d.ts +20 -0
- package/dist/service/WorkbenchService.js +153 -0
- package/dist/service/anyapi/AnyApiSandboxService.d.ts +15 -0
- package/dist/service/anyapi/AnyApiSandboxService.js +122 -0
- package/dist/service/anyapi/AnyApiService.d.ts +27 -0
- package/dist/service/anyapi/AnyApiService.js +179 -0
- package/dist/service/base/ApiBaseService.d.ts +15 -0
- package/dist/service/base/ApiBaseService.js +50 -0
- package/dist/service/base/ApiRateLimiter.d.ts +10 -0
- package/dist/service/base/ApiRateLimiter.js +51 -0
- package/dist/service/base/BaseService.d.ts +29 -0
- package/dist/service/base/BaseService.js +79 -0
- package/dist/service/base/RedisCacheService.d.ts +13 -0
- package/dist/service/base/RedisCacheService.js +50 -0
- package/dist/service/crudstd/CrudStdActionService.d.ts +17 -0
- package/dist/service/crudstd/CrudStdActionService.js +32 -0
- package/dist/service/crudstd/CrudStdConstant.d.ts +58 -0
- package/dist/service/crudstd/CrudStdConstant.js +64 -0
- package/dist/service/crudstd/CrudStdRelationService.d.ts +10 -0
- package/dist/service/crudstd/CrudStdRelationService.js +85 -0
- package/dist/service/crudstd/CrudStdService.d.ts +50 -0
- package/dist/service/crudstd/CrudStdService.js +182 -0
- package/dist/service/curd/CurdMixByAccountService.d.ts +9 -0
- package/dist/service/curd/CurdMixByAccountService.js +87 -0
- package/dist/service/curd/CurdMixByDictService.d.ts +13 -0
- package/dist/service/curd/CurdMixByDictService.js +111 -0
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +22 -0
- package/dist/service/curd/CurdMixByLinkToCustomService.js +154 -0
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +9 -0
- package/dist/service/curd/CurdMixBySysConfigService.js +78 -0
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +10 -0
- package/dist/service/curd/CurdMixByWorkbenchService.js +76 -0
- package/dist/service/curd/CurdMixService.d.ts +17 -0
- package/dist/service/curd/CurdMixService.js +76 -0
- package/dist/service/curd/CurdMixUtils.d.ts +28 -0
- package/dist/service/curd/CurdMixUtils.js +201 -0
- package/dist/service/curd/CurdProService.d.ts +39 -0
- package/dist/service/curd/CurdProService.js +322 -0
- package/dist/service/proxyapi/ProxyApiLoadService.d.ts +21 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +164 -0
- package/dist/service/proxyapi/ProxyApiService.d.ts +60 -0
- package/dist/service/proxyapi/ProxyApiService.js +260 -0
- package/dist/service/proxyapi/ProxyApiUtils.d.ts +15 -0
- package/dist/service/proxyapi/ProxyApiUtils.js +34 -0
- package/dist/service/proxyapi/RouteHandler.d.ts +5 -0
- package/dist/service/proxyapi/RouteHandler.js +9 -0
- package/dist/service/proxyapi/RouteTrie.d.ts +12 -0
- package/dist/service/proxyapi/RouteTrie.js +63 -0
- package/dist/service/proxyapi/WeightedRandom.d.ts +9 -0
- package/dist/service/proxyapi/WeightedRandom.js +31 -0
- package/dist/service/proxyapi/WeightedRoundRobin.d.ts +8 -0
- package/dist/service/proxyapi/WeightedRoundRobin.js +32 -0
- package/index.d.ts +10 -0
- package/package.json +71 -0
- package/src/config/config.default.ts +172 -0
- package/src/config/seed/aeskey.txt +1 -0
- package/src/config/utils.ts +23 -0
- package/src/configuration.ts +83 -0
- package/src/controller/base/BaseApiController.ts +145 -0
- package/src/controller/gateway/AnyApiGatewayController.ts +33 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +107 -0
- package/src/controller/gateway/CrudStdGatewayController.ts +101 -0
- package/src/controller/gateway/DocGatewayController.ts +165 -0
- package/src/controller/gateway/FileController.ts +110 -0
- package/src/controller/gateway/ProxyApiGatewayController.ts +47 -0
- package/src/controller/gateway/PublicApiController.ts +145 -0
- package/src/controller/gateway/StaticController.ts +303 -0
- package/src/controller/helpers.controller.ts +161 -0
- package/src/controller/home.controller.ts +71 -0
- package/src/controller/manage/AnyApiMangeApi.ts +66 -0
- package/src/controller/manage/AppLogMangeApi.ts +53 -0
- package/src/controller/manage/AppMangeApi.ts +53 -0
- package/src/controller/manage/AppPageMangeApi.ts +52 -0
- package/src/controller/manage/AppSchemaHistoryApi.ts +49 -0
- package/src/controller/manage/CrudMethodsMangeApi.ts +49 -0
- package/src/controller/manage/CrudStandardDesignApi.ts +353 -0
- package/src/controller/manage/DataDictManageApi.ts +78 -0
- package/src/controller/manage/DeployManageApi.ts +179 -0
- package/src/controller/manage/DocLibManageApi.ts +69 -0
- package/src/controller/manage/DocManageApi.ts +99 -0
- package/src/controller/manage/FileManageApi.ts +45 -0
- package/src/controller/manage/LowCodeTplManageApi.ts +52 -0
- package/src/controller/manage/MenuManageApi.ts +63 -0
- package/src/controller/manage/ProxyApiMangeApi.ts +52 -0
- package/src/controller/manage/SuperAdminManageApi.ts +138 -0
- package/src/controller/manage/SysConfigMangeApi.ts +95 -0
- package/src/controller/manage/SystemInfoManageApi.ts +48 -0
- package/src/controller/manage/UserAccountManageApi.ts +88 -0
- package/src/controller/manage/WorkbenchMangeApi.ts +72 -0
- package/src/controller/medstatistic/MedAdminController.ts +221 -0
- package/src/controller/medstatistic/MedClientController.ts +188 -0
- package/src/controller/medstatistic/MedMessageService.ts +89 -0
- package/src/controller/medstatistic/MedScoreService.ts +108 -0
- package/src/controller/medstatistic/constants.ts +63 -0
- package/src/controller/myinfo/AuthController.ts +174 -0
- package/src/controller/myinfo/MyInfoController.ts +32 -0
- package/src/controller/render/AppRenderController.ts +76 -0
- package/src/controller/test.controller.ts +37 -0
- package/src/filter/default.filter.ts +13 -0
- package/src/filter/notfound.filter.ts +10 -0
- package/src/index.ts +70 -0
- package/src/interface.ts +31 -0
- package/src/libs/crud-pro/CrudPro.ts +158 -0
- package/src/libs/crud-pro/defaultConfigs.ts +13 -0
- package/src/libs/crud-pro/exceptions.ts +124 -0
- package/src/libs/crud-pro/interfaces.ts +183 -0
- package/src/libs/crud-pro/models/ExecuteContext.ts +111 -0
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +86 -0
- package/src/libs/crud-pro/models/FuncContext.ts +21 -0
- package/src/libs/crud-pro/models/RequestCfgModel.ts +141 -0
- package/src/libs/crud-pro/models/RequestModel.ts +141 -0
- package/src/libs/crud-pro/models/ServiceHub.ts +32 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +52 -0
- package/src/libs/crud-pro/models/SqlSegArg.ts +13 -0
- package/src/libs/crud-pro/models/Transaction.ts +74 -0
- package/src/libs/crud-pro/models/TransactionMySQL.ts +79 -0
- package/src/libs/crud-pro/models/TransactionPostgres.ts +91 -0
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +107 -0
- package/src/libs/crud-pro/models/keys.ts +159 -0
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +75 -0
- package/src/libs/crud-pro/services/CrudProExecuteFuncService.ts +128 -0
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +279 -0
- package/src/libs/crud-pro/services/CrudProFieldUpdateService.ts +60 -0
- package/src/libs/crud-pro/services/CrudProFieldValidateService.ts +180 -0
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +373 -0
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +202 -0
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +397 -0
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +98 -0
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +59 -0
- package/src/libs/crud-pro/services/CurdProServiceHub.ts +92 -0
- package/src/libs/crud-pro/sql.txt +120 -0
- package/src/libs/crud-pro/utils/CompareUtils.ts +23 -0
- package/src/libs/crud-pro/utils/DatabaseName.ts +40 -0
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +20 -0
- package/src/libs/crud-pro/utils/MemoryRefreshCache.ts +64 -0
- package/src/libs/crud-pro/utils/MessageParseUtils.ts +33 -0
- package/src/libs/crud-pro/utils/MixinUtils.ts +285 -0
- package/src/libs/crud-pro/utils/ModelUtils.ts +55 -0
- package/src/libs/crud-pro/utils/MultiKeyMap.ts +72 -0
- package/src/libs/crud-pro/utils/SqlFuncUtils.ts +29 -0
- package/src/libs/crud-pro/utils/TypeUtils.ts +188 -0
- package/src/libs/crud-pro/utils/ValidateUtils.ts +167 -0
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +20 -0
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +22 -0
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +22 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +26 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +11 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +11 -0
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +129 -0
- package/src/libs/utils/common-dto.ts +52 -0
- package/src/libs/utils/crypto-utils.ts +52 -0
- package/src/libs/utils/fatcms-request.ts +115 -0
- package/src/libs/utils/functions.ts +67 -0
- package/src/libs/utils/ordernum-utils.ts +18 -0
- package/src/libs/utils/parseConfig.ts +62 -0
- package/src/libs/utils/parseCreateSql.ts +91 -0
- package/src/libs/utils/render-utils.ts +184 -0
- package/src/middleware/forbidden.middleware.ts +71 -0
- package/src/middleware/global.middleware.ts +278 -0
- package/src/middleware/permission.middleware.ts +81 -0
- package/src/middleware/tx.middleware.ts +30 -0
- package/src/models/SystemEntities.ts +115 -0
- package/src/models/SystemPerm.ts +105 -0
- package/src/models/SystemTables.ts +30 -0
- package/src/models/bizmodels.ts +89 -0
- package/src/models/contextLogger.ts +132 -0
- package/src/models/devops.ts +17 -0
- package/src/models/userSession.ts +216 -0
- package/src/schedule/index.ts +73 -0
- package/src/service/AuthService.ts +270 -0
- package/src/service/EnumInfoService.ts +129 -0
- package/src/service/FileCenterService.ts +394 -0
- package/src/service/SysConfigService.ts +34 -0
- package/src/service/UserAccountService.ts +100 -0
- package/src/service/UserSessionService.ts +81 -0
- package/src/service/VisitStatService.ts +179 -0
- package/src/service/WorkbenchService.ts +160 -0
- package/src/service/anyapi/AnyApiSandboxService.ts +121 -0
- package/src/service/anyapi/AnyApiService.ts +184 -0
- package/src/service/base/ApiBaseService.ts +42 -0
- package/src/service/base/ApiRateLimiter.ts +59 -0
- package/src/service/base/BaseService.ts +74 -0
- package/src/service/base/RedisCacheService.ts +38 -0
- package/src/service/crudstd/CrudStdActionService.ts +27 -0
- package/src/service/crudstd/CrudStdConstant.ts +62 -0
- package/src/service/crudstd/CrudStdRelationService.ts +78 -0
- package/src/service/crudstd/CrudStdService.ts +188 -0
- package/src/service/curd/CurdMixByAccountService.ts +83 -0
- package/src/service/curd/CurdMixByDictService.ts +113 -0
- package/src/service/curd/CurdMixByLinkToCustomService.ts +167 -0
- package/src/service/curd/CurdMixBySysConfigService.ts +78 -0
- package/src/service/curd/CurdMixByWorkbenchService.ts +68 -0
- package/src/service/curd/CurdMixService.ts +65 -0
- package/src/service/curd/CurdMixUtils.ts +248 -0
- package/src/service/curd/CurdProService.ts +379 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +165 -0
- package/src/service/proxyapi/ProxyApiService.ts +262 -0
- package/src/service/proxyapi/ProxyApiUtils.ts +32 -0
- package/src/service/proxyapi/RouteHandler.ts +8 -0
- package/src/service/proxyapi/RouteTrie.ts +74 -0
- package/src/service/proxyapi/WeightedRandom.ts +37 -0
- package/src/service/proxyapi/WeightedRoundRobin.ts +44 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as _ from 'lodash';
|
|
2
|
+
import { decamelizeKeys } from 'humps';
|
|
3
|
+
import { Controller, Inject, Param, All } from '@midwayjs/core';
|
|
4
|
+
import { Context } from '@midwayjs/koa';
|
|
5
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
6
|
+
import { WorkbenchService } from '../../service/WorkbenchService';
|
|
7
|
+
import { API_BASE_TYPE, ApiBaseService } from '../../service/base/ApiBaseService';
|
|
8
|
+
import { CurdProService } from '../../service/curd/CurdProService';
|
|
9
|
+
import { CurdMixService } from '../../service/curd/CurdMixService';
|
|
10
|
+
import { IRequestCfgModel2 } from '../../models/bizmodels';
|
|
11
|
+
import {parseDatabaseName} from "../../libs/crud-pro/utils/DatabaseName";
|
|
12
|
+
|
|
13
|
+
const QUERY_AS_LIST = ['condition', 'data'];
|
|
14
|
+
|
|
15
|
+
function pickAsQuery(query_as_pick: string, query: any): any {
|
|
16
|
+
if (query_as_pick && typeof query_as_pick === 'string') {
|
|
17
|
+
const pickArray = query_as_pick.split(',');
|
|
18
|
+
return _.pick(query, pickArray);
|
|
19
|
+
}
|
|
20
|
+
return query;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// /ns/gw/api/crudMtd/getUser?__query_as_condition__=id&_query_as_data__=name&&id=1&name=22
|
|
24
|
+
/**
|
|
25
|
+
* query形式1:GET: /ns/gw/api/crudMtd/getUser?__query_json__=%7B%22condition%22%3A%7B%22id%22%3A2%7D%7D
|
|
26
|
+
* query形式2:GET: /ns/gw/api/crudMtd/getUser?__query_as__=condition&id=1&name=22
|
|
27
|
+
* query形式3:GET: /ns/gw/api/crudMtd/createUser?__query_as__=data&__query_pick__=id,name&id=1&name=22
|
|
28
|
+
*
|
|
29
|
+
* 执行单个配置的接口
|
|
30
|
+
*/
|
|
31
|
+
@Controller('/ns/gw/crudApi')
|
|
32
|
+
export class CrudMtdGatewayController extends ApiBaseService {
|
|
33
|
+
@Inject()
|
|
34
|
+
protected ctx: Context;
|
|
35
|
+
|
|
36
|
+
@Inject()
|
|
37
|
+
protected workbenchService: WorkbenchService;
|
|
38
|
+
|
|
39
|
+
@Inject()
|
|
40
|
+
private curdProService: CurdProService;
|
|
41
|
+
|
|
42
|
+
@Inject()
|
|
43
|
+
private curdMixService: CurdMixService;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 执行配置出来的接口的接口。此接口本身不需要鉴权。鉴权信息在配置中由curdPro底层进行鉴权
|
|
47
|
+
*/
|
|
48
|
+
@All('/execute/:methodCode')
|
|
49
|
+
async executeCrudMethod(@Param('methodCode') methodCode: string) {
|
|
50
|
+
if (!methodCode) {
|
|
51
|
+
return CommonResult.errorRes('method参数不存在');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const methodInfo = (await this.curdProService.getCachedCfgByMethod(methodCode)) as any;
|
|
55
|
+
if (!methodInfo || methodInfo.status !== 1) {
|
|
56
|
+
return CommonResult.errorRes('接口不存在或已下线: ' + methodCode);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.logInfo("methodInfo=== ", methodInfo)
|
|
60
|
+
|
|
61
|
+
const workbench_code_array = methodInfo.workbench_code_array || methodInfo.workbenchCodeArray;
|
|
62
|
+
const isSupport = await this.workbenchService.isSupportCurrentWorkbench(workbench_code_array);
|
|
63
|
+
if (!isSupport) {
|
|
64
|
+
return CommonResult.errorRes('此接口不支持在当前站点打开');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 权限等校验\服务降级\限流令牌桶
|
|
68
|
+
const entity = decamelizeKeys(methodInfo) as any;
|
|
69
|
+
await super.beforeCheckApiAccessibility(API_BASE_TYPE.CRUD_METHOD, entity);
|
|
70
|
+
|
|
71
|
+
const reqJson: any = {};
|
|
72
|
+
|
|
73
|
+
const body = this.ctx.request.body as any;
|
|
74
|
+
if (body && typeof body === 'object') {
|
|
75
|
+
Object.assign(reqJson, body);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const query = this.ctx.query || {};
|
|
79
|
+
|
|
80
|
+
const query_json = query['__query_json__'];
|
|
81
|
+
const query_as = query['__query_as__'] as string;
|
|
82
|
+
const query_pick = query['__query_pick__'] as string; // 以逗号分割的字段列表。只部分字段作为参数。。
|
|
83
|
+
|
|
84
|
+
delete query['__query_json__'];
|
|
85
|
+
delete query['__query_as__'];
|
|
86
|
+
delete query['__query_pick__'];
|
|
87
|
+
|
|
88
|
+
if (query_json && typeof query_json === 'string') {
|
|
89
|
+
const queryJson = JSON.parse(query_json);
|
|
90
|
+
Object.assign(reqJson, queryJson);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (query_as && QUERY_AS_LIST.includes(query_as)) {
|
|
94
|
+
const pickedQuery = pickAsQuery(query_pick, query);
|
|
95
|
+
_.set(reqJson, query_as, pickedQuery);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Object.assign(reqJson, { method: methodCode });
|
|
99
|
+
|
|
100
|
+
const cfgModel = methodInfo as IRequestCfgModel2;
|
|
101
|
+
const { dbType, dbName } = parseDatabaseName(cfgModel.sqlDatabase);
|
|
102
|
+
cfgModel.sqlDatabase = dbName;
|
|
103
|
+
cfgModel.sqlDdType = dbType;
|
|
104
|
+
|
|
105
|
+
return this.curdMixService.executeCrudByCfg(reqJson, cfgModel);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { BaseApiController } from '../base/BaseApiController';
|
|
4
|
+
import { CrudStdService, SPECIAL_SETTING_KEY } from '../../service/crudstd/CrudStdService';
|
|
5
|
+
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
6
|
+
import { IRequestModel } from '../../libs/crud-pro/interfaces';
|
|
7
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
8
|
+
|
|
9
|
+
interface ICrudStdActionParams {
|
|
10
|
+
appCode: string;
|
|
11
|
+
settingKey?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ICrudStdParams = { stdAction: ICrudStdActionParams } & IRequestModel;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 零代码配置的界面,相关的接口的执行
|
|
18
|
+
*/
|
|
19
|
+
@Controller('/ns/gw/api/crudStd')
|
|
20
|
+
export class CrudStdGatewayController extends BaseApiController {
|
|
21
|
+
@Inject()
|
|
22
|
+
protected ctx: Context;
|
|
23
|
+
|
|
24
|
+
@Inject()
|
|
25
|
+
private crudStdService: CrudStdService;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取零代码应用基本信息
|
|
29
|
+
*/
|
|
30
|
+
@Post('/getParsedCrudStdAppInfo')
|
|
31
|
+
async getParsedCrudStdAppInfo(): Promise<CommonResult> {
|
|
32
|
+
const body = this.ctx.request.body as ICrudStdParams;
|
|
33
|
+
const appCode = body.stdAction.appCode;
|
|
34
|
+
const parsedAppInfo = await this.crudStdService.getParsedCrudStdAppInfo(appCode);
|
|
35
|
+
return CommonResult.successNotNull(parsedAppInfo);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 列表查询: 分页查询
|
|
40
|
+
*/
|
|
41
|
+
@Post('/getObjectList')
|
|
42
|
+
async getObjectList() {
|
|
43
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
44
|
+
const appCode = stdAction.appCode;
|
|
45
|
+
return this.crudStdService.executeStdQuery(appCode, SPECIAL_SETTING_KEY.QUERY_LIST, otherParams, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 单个查询
|
|
50
|
+
*/
|
|
51
|
+
@Post('/getObjectOne')
|
|
52
|
+
async getObjectOne() {
|
|
53
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
54
|
+
const appCode = stdAction.appCode;
|
|
55
|
+
return this.crudStdService.executeStdQuery(appCode, SPECIAL_SETTING_KEY.QUERY_ONE, otherParams, KeysOfSimpleSQL.SIMPLE_QUERY_ONE);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 单个删除
|
|
60
|
+
*/
|
|
61
|
+
@Post('/deleteObject')
|
|
62
|
+
async deleteObject() {
|
|
63
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
64
|
+
const appCode = stdAction.appCode;
|
|
65
|
+
const settingKey = stdAction.settingKey;
|
|
66
|
+
return this.crudStdService.executeStdQuery(appCode, settingKey, otherParams, KeysOfSimpleSQL.SIMPLE_DELETE);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 单个创建
|
|
71
|
+
*/
|
|
72
|
+
@Post('/createObject')
|
|
73
|
+
async createObject() {
|
|
74
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
75
|
+
const appCode = stdAction.appCode;
|
|
76
|
+
const settingKey = stdAction.settingKey;
|
|
77
|
+
return this.crudStdService.executeStdQuery(appCode, settingKey, otherParams, KeysOfSimpleSQL.SIMPLE_INSERT);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 单个更新
|
|
82
|
+
*/
|
|
83
|
+
@Post('/updateObject')
|
|
84
|
+
async updateObject() {
|
|
85
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
86
|
+
const appCode = stdAction.appCode;
|
|
87
|
+
const settingKey = stdAction.settingKey;
|
|
88
|
+
return this.crudStdService.executeStdQuery(appCode, settingKey, otherParams, KeysOfSimpleSQL.SIMPLE_UPDATE);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 执行操作
|
|
93
|
+
*/
|
|
94
|
+
@Post('/executeStdAction')
|
|
95
|
+
async executeStdAction() {
|
|
96
|
+
const { stdAction, ...otherParams } = this.ctx.request.body as ICrudStdParams;
|
|
97
|
+
const appCode = stdAction.appCode;
|
|
98
|
+
const settingKey = stdAction.settingKey;
|
|
99
|
+
return await this.crudStdService.executeStdActionByReq(appCode, settingKey, otherParams);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {Get, Controller, Inject, Query} from '@midwayjs/core';
|
|
2
|
+
import {Context} from '@midwayjs/koa';
|
|
3
|
+
import {BaseApiController} from '../base/BaseApiController';
|
|
4
|
+
import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
|
|
5
|
+
import {KeysOfSimpleSQL} from '../../libs/crud-pro/models/keys';
|
|
6
|
+
import {WorkbenchService} from '../../service/WorkbenchService';
|
|
7
|
+
import {CommonResult} from '../../libs/utils/common-dto';
|
|
8
|
+
|
|
9
|
+
function checkIsNumber(value: string, name: string) {
|
|
10
|
+
if (!value) {
|
|
11
|
+
throw `${name}参数不存在`;
|
|
12
|
+
}
|
|
13
|
+
if (!parseInt(value)) {
|
|
14
|
+
throw `${name}参数不是一个整数`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* C端用户接口。
|
|
20
|
+
* 对外开发接口。
|
|
21
|
+
*/
|
|
22
|
+
@Controller('/ns/gw/doc')
|
|
23
|
+
export class DocGatewayController extends BaseApiController {
|
|
24
|
+
@Inject()
|
|
25
|
+
protected ctx: Context;
|
|
26
|
+
|
|
27
|
+
@Inject()
|
|
28
|
+
protected workbenchService: WorkbenchService;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
private async updateDocPV(docId: string, docLibId: string, pv: number) {
|
|
32
|
+
const ip = this.ctx.headers['x-real-ip'];
|
|
33
|
+
const lockKey = `doc_ip_pv_${docId}_${ip}`;
|
|
34
|
+
const EXPIRE_TIME = 5 * 60 * 1000; // 在五分钟内,同一个IP地址重复刷新同一篇文章,认为是一个PV
|
|
35
|
+
const nxRes = await this.redisService.set(lockKey, 1, 'EX', EXPIRE_TIME, 'NX')
|
|
36
|
+
if (nxRes !== 'OK') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await this.curdMixService.executeCrudByCfg({
|
|
41
|
+
data: {
|
|
42
|
+
pv: pv + 1
|
|
43
|
+
},
|
|
44
|
+
condition: {
|
|
45
|
+
id: parseInt(docId),
|
|
46
|
+
doc_lib_id: parseInt(docLibId),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
sqlTable: SystemTables.sys_doc,
|
|
51
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
52
|
+
sqlDatabase: SystemDbName,
|
|
53
|
+
sqlDdType: SystemDbType,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param docId
|
|
60
|
+
* @param docLibId 文档库
|
|
61
|
+
*/
|
|
62
|
+
@Get('/getDocInfo')
|
|
63
|
+
async getDocInfo(@Query('docId') docId: string, @Query('docLibId') docLibId: string) {
|
|
64
|
+
checkIsNumber(docId, 'docId');
|
|
65
|
+
checkIsNumber(docLibId, 'docLibId');
|
|
66
|
+
|
|
67
|
+
const docLibInfoRes = await this.getDocLibInfo(docLibId);
|
|
68
|
+
if (!docLibInfoRes.success) {
|
|
69
|
+
return docLibInfoRes;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
const res = await this.curdMixService.executeCrudByCfg(
|
|
74
|
+
{
|
|
75
|
+
condition: {
|
|
76
|
+
id: parseInt(docId),
|
|
77
|
+
doc_lib_id: parseInt(docLibId),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
sqlTable: SystemTables.sys_doc,
|
|
82
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
83
|
+
sqlDatabase: SystemDbName,
|
|
84
|
+
sqlDdType: SystemDbType,
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// 更新PV数据
|
|
89
|
+
const docObj = res.getOneObj();
|
|
90
|
+
if (docObj) {
|
|
91
|
+
const pv: number = parseInt(docObj.pv) || 0;
|
|
92
|
+
await this.updateDocPV(docId, docLibId, pv);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return res;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @param docLibId
|
|
100
|
+
*/
|
|
101
|
+
@Get('/getDocList')
|
|
102
|
+
async getDocList(@Query('docLibId') docLibId: string) {
|
|
103
|
+
checkIsNumber(docLibId, 'docLibId');
|
|
104
|
+
|
|
105
|
+
const docLibInfoRes = await this.getDocLibInfo(docLibId);
|
|
106
|
+
if (!docLibInfoRes.success) {
|
|
107
|
+
return docLibInfoRes;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return this.curdMixService.executeCrudByCfg(
|
|
111
|
+
{
|
|
112
|
+
columns: 'id,title,doc_category_code,sort_index',
|
|
113
|
+
orderBy: 'sort_index+,id-',
|
|
114
|
+
condition: {
|
|
115
|
+
doc_lib_id: parseInt(docLibId),
|
|
116
|
+
doc_category_code: {
|
|
117
|
+
$notNull: '',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
sqlTable: SystemTables.sys_doc,
|
|
123
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
124
|
+
sqlDatabase: SystemDbName,
|
|
125
|
+
sqlDdType: SystemDbType,
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* TODO 权限控制
|
|
132
|
+
* @param docLibId
|
|
133
|
+
*/
|
|
134
|
+
@Get('/getDocLibInfo')
|
|
135
|
+
async getDocLibInfo(@Query('docLibId') docLibId: string) {
|
|
136
|
+
checkIsNumber(docLibId, 'docLibId');
|
|
137
|
+
|
|
138
|
+
const s = await this.curdMixService.executeCrudByCfg(
|
|
139
|
+
{
|
|
140
|
+
condition: {
|
|
141
|
+
id: parseInt(docLibId),
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
sqlTable: SystemTables.sys_doc_lib,
|
|
146
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
147
|
+
sqlDatabase: SystemDbName,
|
|
148
|
+
sqlDdType: SystemDbType,
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
const docLibInfo = s.getOneObj();
|
|
152
|
+
|
|
153
|
+
if (!docLibInfo) {
|
|
154
|
+
throw '此文档库查询失败';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const workbench_code_array = docLibInfo.workbench_code_array;
|
|
158
|
+
const isSupportCurrentWorkbench = await this.workbenchService.isSupportCurrentWorkbench(workbench_code_array);
|
|
159
|
+
if (!isSupportCurrentWorkbench) {
|
|
160
|
+
throw '此文档库不支持在当前站点打开';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return CommonResult.successRes(docLibInfo);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Get, Post, Inject, Controller, Files, Fields, Param, Query } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import * as _ from 'lodash';
|
|
4
|
+
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
+
import { BizException } from '../../models/devops';
|
|
6
|
+
import {AccessType, FILE_GET_TYPES} from '../../models/bizmodels';
|
|
7
|
+
import { FileCenterService, PATH_PREFIX, toDownloadPaths, isImageFile } from '../../service/FileCenterService';
|
|
8
|
+
import { checkPermission } from '../../middleware/permission.middleware';
|
|
9
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
10
|
+
import {SystemFuncCode} from "../../models/SystemPerm";
|
|
11
|
+
|
|
12
|
+
function isTrue(obj: any) {
|
|
13
|
+
return obj === true || obj === 'true';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 文件上传下载服务
|
|
19
|
+
*/
|
|
20
|
+
@Controller(PATH_PREFIX)
|
|
21
|
+
export class FileController extends BaseApiController {
|
|
22
|
+
@Inject()
|
|
23
|
+
ctx: Context;
|
|
24
|
+
|
|
25
|
+
@Inject()
|
|
26
|
+
private fileCenterService: FileCenterService;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 上传普通文件。必须是登录用户才能上传。
|
|
30
|
+
* @param files
|
|
31
|
+
* @param fields
|
|
32
|
+
* @param queryData
|
|
33
|
+
*/
|
|
34
|
+
@Post('/uploadFile', { middleware: [checkPermission([SystemFuncCode.DocMangeWrite, SystemFuncCode.FileMangeWrite, SystemFuncCode.UserAccountMangeWrite])] } )
|
|
35
|
+
async uploadFile(@Files() files, @Fields() fields, @Query() queryData): Promise<CommonResult> {
|
|
36
|
+
const accessType = queryData?.accessType || fields?.accessType || AccessType.open;
|
|
37
|
+
const referer = this.ctx.req.headers.referer;
|
|
38
|
+
|
|
39
|
+
if (!Object.keys(AccessType).includes(accessType)) {
|
|
40
|
+
throw new BizException(`仅支持 ${Object.keys(AccessType).join('、')} 上传模式`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const { fileKey, filename, storageUrl } = await this.fileCenterService.uploadFileToOSS(files, accessType, referer);
|
|
44
|
+
|
|
45
|
+
const origin = this.ctx.request.origin;
|
|
46
|
+
|
|
47
|
+
const downloadUrls = toDownloadPaths(origin, fileKey);
|
|
48
|
+
|
|
49
|
+
const data = {
|
|
50
|
+
fileKey,
|
|
51
|
+
filename,
|
|
52
|
+
storageUrl,
|
|
53
|
+
...downloadUrls,
|
|
54
|
+
};
|
|
55
|
+
return CommonResult.successRes(data);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// http://localhost:5173/ns/gw/file/get/download/6114718c6e2cb192bf6e99c3ede2b6d41743401594182.png&process=doc/preview
|
|
59
|
+
/**
|
|
60
|
+
* 文件下载或预览
|
|
61
|
+
* @param byMethod
|
|
62
|
+
* @param fileKey
|
|
63
|
+
* @param process 图片处理:https://help.aliyun.com/document_detail/44688.html
|
|
64
|
+
* @param streaming 是否直接返回流,默认返回 302 跳转
|
|
65
|
+
*/
|
|
66
|
+
@Get('/get/:byMethod/:fileKey*')
|
|
67
|
+
async downloadFile(@Param('byMethod') byMethod: string ,@Param('fileKey') fileKey: string) {
|
|
68
|
+
if (!fileKey) {
|
|
69
|
+
throw new BizException('fileKey不能为空');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const byMethodSet = new Set<string>(FILE_GET_TYPES);
|
|
73
|
+
if (!byMethodSet.has(byMethod)) {
|
|
74
|
+
throw new BizException('byMethod不正确');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// eslint-disable-next-line prefer-const
|
|
78
|
+
let { process, preview, streaming } = (this.ctx.query || {}) as any;
|
|
79
|
+
|
|
80
|
+
const isThumbnail = this.ctx.path.startsWith(`${PATH_PREFIX}/get/thumbnail/`);
|
|
81
|
+
const isPreview = this.ctx.path.startsWith(`${PATH_PREFIX}/get/preview/`) || isTrue(preview);
|
|
82
|
+
const isStreaming = isTrue(streaming);
|
|
83
|
+
|
|
84
|
+
if (isThumbnail && isImageFile(fileKey) && !process) {
|
|
85
|
+
// x-oss-process=image/resize,w_200,p_10/quality,q_60
|
|
86
|
+
process = 'image/resize,w_200'; //图片缩略图(小图片)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const isOutByStreaming = isStreaming || isPreview || isThumbnail;
|
|
90
|
+
|
|
91
|
+
const result = await this.fileCenterService.downloadFile(fileKey, isOutByStreaming, process);
|
|
92
|
+
|
|
93
|
+
if (isOutByStreaming) {
|
|
94
|
+
// 移除这些属性
|
|
95
|
+
const headers: any = _.omitBy(result.res.headers, (_v, key) => {
|
|
96
|
+
if (key === 'content-length') {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if ((isPreview || isThumbnail) && key.toLowerCase() === 'content-disposition') {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return key.startsWith('x-oss-meta-');
|
|
103
|
+
});
|
|
104
|
+
this.ctx.set(headers);
|
|
105
|
+
this.ctx.body = result.stream;
|
|
106
|
+
} else {
|
|
107
|
+
this.ctx.redirect(result.downloadURL);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { All, Controller, Inject, Query } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { BaseApiController } from '../base/BaseApiController';
|
|
4
|
+
import { ProxyApiService } from '../../service/proxyapi/ProxyApiService';
|
|
5
|
+
import { WorkbenchService } from '../../service/WorkbenchService';
|
|
6
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
7
|
+
import { ProxyApiLoadService } from '../../service/proxyapi/ProxyApiLoadService';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 只支持前缀匹配
|
|
11
|
+
* 【/ns/gw/proxy/[upstreamName]/】api/userinfo ==> http://127.0.0.1:3000/api/userinfo
|
|
12
|
+
* FaaS方式配置的接口
|
|
13
|
+
*/
|
|
14
|
+
@Controller('/ns/gw/proxy')
|
|
15
|
+
export class ProxyApiGatewayController extends BaseApiController {
|
|
16
|
+
@Inject()
|
|
17
|
+
protected ctx: Context;
|
|
18
|
+
|
|
19
|
+
@Inject()
|
|
20
|
+
private proxyApiService: ProxyApiService;
|
|
21
|
+
|
|
22
|
+
@Inject()
|
|
23
|
+
private workbenchService: WorkbenchService;
|
|
24
|
+
|
|
25
|
+
@Inject()
|
|
26
|
+
private proxyApiLoadService: ProxyApiLoadService;
|
|
27
|
+
/**
|
|
28
|
+
* 执行配置出来的接口的接口。此接口本身不需要鉴权。鉴权信息在配置中由curdPro底层进行鉴权
|
|
29
|
+
*/
|
|
30
|
+
@All('/*')
|
|
31
|
+
async executeProxyApi() {
|
|
32
|
+
const workbenchInfo = await this.workbenchService.getCurrentHostWorkbenchInfo();
|
|
33
|
+
if (!workbenchInfo) {
|
|
34
|
+
return CommonResult.errorRes('域名站点不存在');
|
|
35
|
+
}
|
|
36
|
+
const workbench_code = workbenchInfo.workbench_code;
|
|
37
|
+
// const path_prefix2 = '/' + entity.upstream_code + entity.path_prefix;
|
|
38
|
+
// 路由树的结构是 /${entity.upstream_code}${entity.path_prefix}
|
|
39
|
+
const path2 = this.ctx.path.replace(/^\/ns\/gw\/proxy/, '');
|
|
40
|
+
return this.proxyApiService.handleProxyRequest(workbench_code, path2);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@All('/buildRouteTrie')
|
|
44
|
+
async buildRouteTrie(@Query('workbench_code') workbench_code: string) {
|
|
45
|
+
return this.proxyApiLoadService.buildRouteTrie(workbench_code);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {Controller, Get, Inject, Post} from '@midwayjs/core';
|
|
2
|
+
import {Context} from '@midwayjs/koa';
|
|
3
|
+
import * as _ from 'lodash';
|
|
4
|
+
import {BaseApiController} from '../base/BaseApiController';
|
|
5
|
+
import {SystemTables} from '../../models/SystemTables';
|
|
6
|
+
import {EnumInfoService} from '../../service/EnumInfoService';
|
|
7
|
+
import {CommonResult} from '../../libs/utils/common-dto';
|
|
8
|
+
import {parseJsonObject} from '../../libs/utils/functions';
|
|
9
|
+
import {WorkbenchService} from '../../service/WorkbenchService';
|
|
10
|
+
import {SystemRoleCode} from "../../models/SystemPerm";
|
|
11
|
+
import {KeysOfAuthType} from "../../libs/crud-pro/models/keys";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 公开的API,无需鉴权,所有人可以直接访问
|
|
15
|
+
*/
|
|
16
|
+
@Controller('/ns/gw/api/publicApi')
|
|
17
|
+
export class PublicApiController extends BaseApiController {
|
|
18
|
+
@Inject()
|
|
19
|
+
protected ctx: Context;
|
|
20
|
+
|
|
21
|
+
@Inject()
|
|
22
|
+
private enumInfoService: EnumInfoService;
|
|
23
|
+
|
|
24
|
+
@Inject()
|
|
25
|
+
private workbenchService: WorkbenchService;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取所有站点列表
|
|
29
|
+
*/
|
|
30
|
+
@Get('/getAllWorkbenchInfoList')
|
|
31
|
+
async getAllWorkbenchInfoList(): Promise<CommonResult> {
|
|
32
|
+
const entities = await this.workbenchService.getAllWorkbenchInfoList(false);
|
|
33
|
+
const entities2 = entities.map(e => {
|
|
34
|
+
return {
|
|
35
|
+
workbench_domain: e.workbench_domain,
|
|
36
|
+
workbench_code: e.workbench_code,
|
|
37
|
+
workbench_desc: e.workbench_desc,
|
|
38
|
+
workbench_name: e.workbench_name,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
return CommonResult.successRes(entities2);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 获取菜单信息
|
|
46
|
+
*/
|
|
47
|
+
@Get('/getWorkbenchMenu')
|
|
48
|
+
async getWorkbenchMenu(): Promise<CommonResult> {
|
|
49
|
+
const query = this.ctx.query || {};
|
|
50
|
+
const workbenchMenuCode = query.workbenchMenuCode;
|
|
51
|
+
if (!workbenchMenuCode) {
|
|
52
|
+
return CommonResult.errorRes('param workbenchMenuCode is null');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const workbenchMenuCodeStr = "" + workbenchMenuCode;
|
|
56
|
+
const workbenchMenuCodeArray = workbenchMenuCodeStr.split(',');
|
|
57
|
+
|
|
58
|
+
const condition = {
|
|
59
|
+
menu_code: {
|
|
60
|
+
"$in": workbenchMenuCodeArray
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const rows = await this.sysDBUtil.getList({ condition }, SystemTables.sys_menus);
|
|
64
|
+
if (!rows || rows.length === 0) {
|
|
65
|
+
return CommonResult.errorRes('sys_config is null', '', { condition });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const map = {};
|
|
69
|
+
for (let i = 0; i < rows.length; i++) {
|
|
70
|
+
const rowElement = rows[i];
|
|
71
|
+
const menu_code = rowElement.menu_code;
|
|
72
|
+
const view_auth_config = rowElement.view_auth_config;
|
|
73
|
+
const view_auth_type = rowElement.view_auth_type;
|
|
74
|
+
|
|
75
|
+
const hasPermission = this.ctx.userSession.isAuthPass(view_auth_type, view_auth_config)
|
|
76
|
+
|
|
77
|
+
const menu_config_content = rowElement.menu_config_content;
|
|
78
|
+
delete rowElement.menu_config_content;
|
|
79
|
+
const menu_list = parseJsonObject(menu_config_content) || [];
|
|
80
|
+
map[menu_code] = { ...rowElement, menu_list, hasPermission }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// 特殊的devops菜单
|
|
85
|
+
map['devops'] = {
|
|
86
|
+
menu_list: [], // 这个特殊的菜单在前端写死。
|
|
87
|
+
hasPermission: this.ctx.userSession.isAuthPass(KeysOfAuthType.byRoleCode, [
|
|
88
|
+
SystemRoleCode.DevOpsWriter,SystemRoleCode.DevOpsViewer, SystemRoleCode.SuperAdmin
|
|
89
|
+
])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return CommonResult.successRes(map);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 获取页面信息
|
|
97
|
+
*/
|
|
98
|
+
@Post('/getNavPageInfo')
|
|
99
|
+
async getNavPageInfo(): Promise<CommonResult> {
|
|
100
|
+
const body = this.ctx.request.body as any;
|
|
101
|
+
const { workbenchCode, appCode, pathname } = body;
|
|
102
|
+
const resultData: any = {};
|
|
103
|
+
const getOne = async (condition: any, tablenName: string, key: string) => {
|
|
104
|
+
const values = Object.values(condition).filter(Boolean);
|
|
105
|
+
// 查询条件不能为空
|
|
106
|
+
if (values.length > 0) {
|
|
107
|
+
const oneData = await this.sysDBUtil.getOne({ condition }, tablenName);
|
|
108
|
+
if (oneData && oneData['app_schema']) {
|
|
109
|
+
oneData['app_schema'] = parseJsonObject(oneData['app_schema']);
|
|
110
|
+
}
|
|
111
|
+
resultData[key] = oneData
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
await getOne({ app_code: appCode }, SystemTables.sys_app, 'appData');
|
|
116
|
+
await getOne({ page_path: pathname, workbench_code: workbenchCode }, SystemTables.sys_app_page, 'pageData');
|
|
117
|
+
|
|
118
|
+
return CommonResult.successRes(resultData);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 获取配置的枚举项信息: 都是无需鉴权的
|
|
123
|
+
*/
|
|
124
|
+
@Post('/getEnumInfo')
|
|
125
|
+
async getEnumInfo(): Promise<CommonResult> {
|
|
126
|
+
const body = this.ctx.request.body as any;
|
|
127
|
+
const query = this.ctx.query || {};
|
|
128
|
+
let codeList = _.get(body, 'codeList');
|
|
129
|
+
let refreshCache = `${_.get(body, 'refreshCache')}` === 'true' || query.refreshCache === 'true';
|
|
130
|
+
|
|
131
|
+
if (query.codeList) {
|
|
132
|
+
//codeList=dict@@SexEnum,sysCfgEnum@@EntityStatusEnum
|
|
133
|
+
const codeListStr: string = query.codeList as string;
|
|
134
|
+
codeList = codeListStr.split(',').map(str => {
|
|
135
|
+
const ss = str.split('@@');
|
|
136
|
+
return {
|
|
137
|
+
type: ss[0],
|
|
138
|
+
code: ss[1],
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const enumInfos = await this.enumInfoService.queryEnumInfo(codeList, refreshCache);
|
|
143
|
+
return CommonResult.successRes(enumInfos);
|
|
144
|
+
}
|
|
145
|
+
}
|