midway-fatcms 0.0.1-beta.3 → 0.0.1-beta.30
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/.eslintrc.json +14 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/package.json +25 -24
- package/tsconfig.json +32 -0
- package/dist/config/config.default.d.ts +0 -3
- package/dist/config/config.default.js +0 -148
- package/dist/config/seed/aeskey.txt +0 -1
- package/dist/config/utils.d.ts +0 -1
- package/dist/config/utils.js +0 -23
- package/dist/configuration.d.ts +0 -6
- package/dist/configuration.js +0 -89
- package/dist/controller/base/BaseApiController.d.ts +0 -31
- package/dist/controller/base/BaseApiController.js +0 -138
- package/dist/controller/gateway/AnyApiGatewayController.d.ts +0 -13
- package/dist/controller/gateway/AnyApiGatewayController.js +0 -55
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +0 -21
- package/dist/controller/gateway/CrudMtdGatewayController.js +0 -116
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +0 -38
- package/dist/controller/gateway/CrudStdGatewayController.js +0 -137
- package/dist/controller/gateway/DocGatewayController.d.ts +0 -27
- package/dist/controller/gateway/DocGatewayController.js +0 -174
- package/dist/controller/gateway/FileController.d.ts +0 -25
- package/dist/controller/gateway/FileController.js +0 -129
- package/dist/controller/gateway/ProxyApiGatewayController.d.ts +0 -18
- package/dist/controller/gateway/ProxyApiGatewayController.js +0 -78
- package/dist/controller/gateway/PublicApiController.d.ts +0 -27
- package/dist/controller/gateway/PublicApiController.js +0 -167
- package/dist/controller/gateway/StaticController.d.ts +0 -21
- package/dist/controller/gateway/StaticController.js +0 -265
- package/dist/controller/helpers.controller.d.ts +0 -39
- package/dist/controller/helpers.controller.js +0 -188
- package/dist/controller/home.controller.d.ts +0 -9
- package/dist/controller/home.controller.js +0 -71
- package/dist/controller/manage/AnyApiMangeApi.d.ts +0 -10
- package/dist/controller/manage/AnyApiMangeApi.js +0 -98
- package/dist/controller/manage/AppLogMangeApi.d.ts +0 -10
- package/dist/controller/manage/AppLogMangeApi.js +0 -88
- package/dist/controller/manage/AppMangeApi.d.ts +0 -10
- package/dist/controller/manage/AppMangeApi.js +0 -88
- package/dist/controller/manage/AppPageMangeApi.d.ts +0 -10
- package/dist/controller/manage/AppPageMangeApi.js +0 -87
- package/dist/controller/manage/AppSchemaHistoryApi.d.ts +0 -10
- package/dist/controller/manage/AppSchemaHistoryApi.js +0 -83
- package/dist/controller/manage/CrudMethodsMangeApi.d.ts +0 -10
- package/dist/controller/manage/CrudMethodsMangeApi.js +0 -84
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +0 -38
- package/dist/controller/manage/CrudStandardDesignApi.js +0 -339
- package/dist/controller/manage/DataDictManageApi.d.ts +0 -15
- package/dist/controller/manage/DataDictManageApi.js +0 -133
- package/dist/controller/manage/DeployManageApi.d.ts +0 -19
- package/dist/controller/manage/DeployManageApi.js +0 -176
- package/dist/controller/manage/DocLibManageApi.d.ts +0 -10
- package/dist/controller/manage/DocLibManageApi.js +0 -104
- package/dist/controller/manage/DocManageApi.d.ts +0 -11
- package/dist/controller/manage/DocManageApi.js +0 -130
- package/dist/controller/manage/FileManageApi.d.ts +0 -13
- package/dist/controller/manage/FileManageApi.js +0 -77
- package/dist/controller/manage/LowCodeTplManageApi.d.ts +0 -13
- package/dist/controller/manage/LowCodeTplManageApi.js +0 -86
- package/dist/controller/manage/MenuManageApi.d.ts +0 -10
- package/dist/controller/manage/MenuManageApi.js +0 -93
- package/dist/controller/manage/ProxyApiMangeApi.d.ts +0 -10
- package/dist/controller/manage/ProxyApiMangeApi.js +0 -87
- package/dist/controller/manage/SuperAdminManageApi.d.ts +0 -24
- package/dist/controller/manage/SuperAdminManageApi.js +0 -149
- package/dist/controller/manage/SysConfigMangeApi.d.ts +0 -11
- package/dist/controller/manage/SysConfigMangeApi.js +0 -124
- package/dist/controller/manage/SystemInfoManageApi.d.ts +0 -12
- package/dist/controller/manage/SystemInfoManageApi.js +0 -66
- package/dist/controller/manage/UserAccountManageApi.d.ts +0 -14
- package/dist/controller/manage/UserAccountManageApi.js +0 -124
- package/dist/controller/manage/WorkbenchMangeApi.d.ts +0 -11
- package/dist/controller/manage/WorkbenchMangeApi.js +0 -103
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/dist/controller/myinfo/AuthController.d.ts +0 -37
- package/dist/controller/myinfo/AuthController.js +0 -189
- package/dist/controller/myinfo/MyInfoController.d.ts +0 -13
- package/dist/controller/myinfo/MyInfoController.js +0 -51
- package/dist/controller/render/AppRenderController.d.ts +0 -11
- package/dist/controller/render/AppRenderController.js +0 -85
- package/dist/controller/test.controller.d.ts +0 -8
- package/dist/controller/test.controller.js +0 -51
- package/dist/filter/default.filter.d.ts +0 -7
- package/dist/filter/default.filter.js +0 -23
- package/dist/filter/notfound.filter.d.ts +0 -5
- package/dist/filter/notfound.filter.js +0 -20
- package/dist/index.d.ts +0 -71
- package/dist/index.js +0 -89
- package/dist/interface.d.ts +0 -27
- package/dist/interface.js +0 -3
- package/dist/libs/crud-pro/CrudPro.d.ts +0 -36
- package/dist/libs/crud-pro/CrudPro.js +0 -131
- package/dist/libs/crud-pro/defaultConfigs.d.ts +0 -4
- package/dist/libs/crud-pro/defaultConfigs.js +0 -13
- package/dist/libs/crud-pro/exceptions.d.ts +0 -104
- package/dist/libs/crud-pro/exceptions.js +0 -117
- package/dist/libs/crud-pro/interfaces.d.ts +0 -157
- package/dist/libs/crud-pro/interfaces.js +0 -12
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +0 -42
- package/dist/libs/crud-pro/models/ExecuteContext.js +0 -79
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +0 -31
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +0 -64
- package/dist/libs/crud-pro/models/FuncContext.d.ts +0 -18
- package/dist/libs/crud-pro/models/FuncContext.js +0 -6
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +0 -65
- package/dist/libs/crud-pro/models/RequestCfgModel.js +0 -81
- package/dist/libs/crud-pro/models/RequestModel.d.ts +0 -25
- package/dist/libs/crud-pro/models/RequestModel.js +0 -113
- package/dist/libs/crud-pro/models/ServiceHub.d.ts +0 -20
- package/dist/libs/crud-pro/models/ServiceHub.js +0 -2
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +0 -22
- package/dist/libs/crud-pro/models/SqlCfgModel.js +0 -40
- package/dist/libs/crud-pro/models/SqlSegArg.d.ts +0 -6
- package/dist/libs/crud-pro/models/SqlSegArg.js +0 -12
- package/dist/libs/crud-pro/models/Transaction.d.ts +0 -29
- package/dist/libs/crud-pro/models/Transaction.js +0 -67
- package/dist/libs/crud-pro/models/TransactionMySQL.d.ts +0 -28
- package/dist/libs/crud-pro/models/TransactionMySQL.js +0 -76
- package/dist/libs/crud-pro/models/TransactionPostgres.d.ts +0 -28
- package/dist/libs/crud-pro/models/TransactionPostgres.js +0 -85
- package/dist/libs/crud-pro/models/TransactionSqlServer.d.ts +0 -34
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +0 -92
- package/dist/libs/crud-pro/models/keys.d.ts +0 -106
- package/dist/libs/crud-pro/models/keys.js +0 -149
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +0 -10
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +0 -61
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.d.ts +0 -9
- package/dist/libs/crud-pro/services/CrudProExecuteFuncService.js +0 -112
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.d.ts +0 -17
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +0 -227
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.d.ts +0 -9
- package/dist/libs/crud-pro/services/CrudProFieldUpdateService.js +0 -51
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.d.ts +0 -13
- package/dist/libs/crud-pro/services/CrudProFieldValidateService.js +0 -148
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +0 -24
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +0 -342
- package/dist/libs/crud-pro/services/CrudProGenSqlService.d.ts +0 -25
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +0 -174
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.d.ts +0 -32
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +0 -333
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +0 -28
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +0 -78
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +0 -8
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +0 -53
- package/dist/libs/crud-pro/services/CurdProServiceHub.d.ts +0 -32
- package/dist/libs/crud-pro/services/CurdProServiceHub.js +0 -64
- package/dist/libs/crud-pro/sql.txt +0 -120
- package/dist/libs/crud-pro/utils/CompareUtils.d.ts +0 -9
- package/dist/libs/crud-pro/utils/CompareUtils.js +0 -25
- package/dist/libs/crud-pro/utils/DatabaseName.d.ts +0 -9
- package/dist/libs/crud-pro/utils/DatabaseName.js +0 -29
- package/dist/libs/crud-pro/utils/DateTimeUtils.d.ts +0 -7
- package/dist/libs/crud-pro/utils/DateTimeUtils.js +0 -21
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.d.ts +0 -19
- package/dist/libs/crud-pro/utils/MemoryRefreshCache.js +0 -47
- package/dist/libs/crud-pro/utils/MessageParseUtils.d.ts +0 -5
- package/dist/libs/crud-pro/utils/MessageParseUtils.js +0 -33
- package/dist/libs/crud-pro/utils/MixinUtils.d.ts +0 -39
- package/dist/libs/crud-pro/utils/MixinUtils.js +0 -255
- package/dist/libs/crud-pro/utils/ModelUtils.d.ts +0 -11
- package/dist/libs/crud-pro/utils/ModelUtils.js +0 -49
- package/dist/libs/crud-pro/utils/MultiKeyMap.d.ts +0 -11
- package/dist/libs/crud-pro/utils/MultiKeyMap.js +0 -63
- package/dist/libs/crud-pro/utils/SqlFuncUtils.d.ts +0 -5
- package/dist/libs/crud-pro/utils/SqlFuncUtils.js +0 -29
- package/dist/libs/crud-pro/utils/TypeUtils.d.ts +0 -40
- package/dist/libs/crud-pro/utils/TypeUtils.js +0 -166
- package/dist/libs/crud-pro/utils/ValidateUtils.d.ts +0 -3
- package/dist/libs/crud-pro/utils/ValidateUtils.js +0 -165
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.d.ts +0 -3
- package/dist/libs/crud-pro/utils/pool/MySQLUtils.js +0 -19
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.d.ts +0 -3
- package/dist/libs/crud-pro/utils/pool/PostgresUtils.js +0 -20
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.d.ts +0 -3
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.js +0 -20
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.d.ts +0 -4
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +0 -21
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.d.ts +0 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.js +0 -11
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.d.ts +0 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.js +0 -11
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.d.ts +0 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgType.js +0 -128
- package/dist/libs/utils/common-dto.d.ts +0 -18
- package/dist/libs/utils/common-dto.js +0 -40
- package/dist/libs/utils/crypto-utils.d.ts +0 -3
- package/dist/libs/utils/crypto-utils.js +0 -46
- package/dist/libs/utils/fatcms-request.d.ts +0 -30
- package/dist/libs/utils/fatcms-request.js +0 -104
- package/dist/libs/utils/functions.d.ts +0 -4
- package/dist/libs/utils/functions.js +0 -63
- package/dist/libs/utils/ordernum-utils.d.ts +0 -2
- package/dist/libs/utils/ordernum-utils.js +0 -13
- package/dist/libs/utils/parseConfig.d.ts +0 -7
- package/dist/libs/utils/parseConfig.js +0 -44
- package/dist/libs/utils/parseCreateSql.d.ts +0 -5
- package/dist/libs/utils/parseCreateSql.js +0 -86
- package/dist/libs/utils/render-utils.d.ts +0 -28
- package/dist/libs/utils/render-utils.js +0 -135
- package/dist/middleware/forbidden.middleware.d.ts +0 -10
- package/dist/middleware/forbidden.middleware.js +0 -70
- package/dist/middleware/global.middleware.d.ts +0 -10
- package/dist/middleware/global.middleware.js +0 -246
- package/dist/middleware/permission.middleware.d.ts +0 -18
- package/dist/middleware/permission.middleware.js +0 -74
- package/dist/middleware/tx.middleware.d.ts +0 -9
- package/dist/middleware/tx.middleware.js +0 -40
- package/dist/models/SystemEntities.d.ts +0 -98
- package/dist/models/SystemEntities.js +0 -2
- package/dist/models/SystemPerm.d.ts +0 -95
- package/dist/models/SystemPerm.js +0 -100
- package/dist/models/SystemTables.d.ts +0 -27
- package/dist/models/SystemTables.js +0 -30
- package/dist/models/bizmodels.d.ts +0 -69
- package/dist/models/bizmodels.js +0 -34
- package/dist/models/contextLogger.d.ts +0 -25
- package/dist/models/contextLogger.js +0 -112
- package/dist/models/devops.d.ts +0 -12
- package/dist/models/devops.js +0 -19
- package/dist/models/userSession.d.ts +0 -61
- package/dist/models/userSession.js +0 -165
- package/dist/schedule/index.d.ts +0 -3
- package/dist/schedule/index.js +0 -69
- package/dist/service/AuthService.d.ts +0 -70
- package/dist/service/AuthService.js +0 -248
- package/dist/service/EnumInfoService.d.ts +0 -30
- package/dist/service/EnumInfoService.js +0 -123
- package/dist/service/FileCenterService.d.ts +0 -43
- package/dist/service/FileCenterService.js +0 -347
- package/dist/service/SysConfigService.d.ts +0 -7
- package/dist/service/SysConfigService.js +0 -45
- package/dist/service/UserAccountService.d.ts +0 -23
- package/dist/service/UserAccountService.js +0 -103
- package/dist/service/UserSessionService.d.ts +0 -16
- package/dist/service/UserSessionService.js +0 -85
- package/dist/service/VisitStatService.d.ts +0 -14
- package/dist/service/VisitStatService.js +0 -165
- package/dist/service/WorkbenchService.d.ts +0 -20
- package/dist/service/WorkbenchService.js +0 -153
- package/dist/service/anyapi/AnyApiSandboxService.d.ts +0 -15
- package/dist/service/anyapi/AnyApiSandboxService.js +0 -122
- package/dist/service/anyapi/AnyApiService.d.ts +0 -27
- package/dist/service/anyapi/AnyApiService.js +0 -179
- package/dist/service/base/ApiBaseService.d.ts +0 -15
- package/dist/service/base/ApiBaseService.js +0 -50
- package/dist/service/base/ApiRateLimiter.d.ts +0 -10
- package/dist/service/base/ApiRateLimiter.js +0 -51
- package/dist/service/base/BaseService.d.ts +0 -29
- package/dist/service/base/BaseService.js +0 -79
- package/dist/service/base/RedisCacheService.d.ts +0 -13
- package/dist/service/base/RedisCacheService.js +0 -50
- package/dist/service/crudstd/CrudStdActionService.d.ts +0 -17
- package/dist/service/crudstd/CrudStdActionService.js +0 -32
- package/dist/service/crudstd/CrudStdConstant.d.ts +0 -58
- package/dist/service/crudstd/CrudStdConstant.js +0 -64
- package/dist/service/crudstd/CrudStdRelationService.d.ts +0 -10
- package/dist/service/crudstd/CrudStdRelationService.js +0 -85
- package/dist/service/crudstd/CrudStdService.d.ts +0 -50
- package/dist/service/crudstd/CrudStdService.js +0 -182
- package/dist/service/curd/CurdMixByAccountService.d.ts +0 -9
- package/dist/service/curd/CurdMixByAccountService.js +0 -87
- package/dist/service/curd/CurdMixByDictService.d.ts +0 -13
- package/dist/service/curd/CurdMixByDictService.js +0 -111
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +0 -22
- package/dist/service/curd/CurdMixByLinkToCustomService.js +0 -154
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +0 -9
- package/dist/service/curd/CurdMixBySysConfigService.js +0 -78
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +0 -10
- package/dist/service/curd/CurdMixByWorkbenchService.js +0 -76
- package/dist/service/curd/CurdMixService.d.ts +0 -17
- package/dist/service/curd/CurdMixService.js +0 -76
- package/dist/service/curd/CurdMixUtils.d.ts +0 -28
- package/dist/service/curd/CurdMixUtils.js +0 -201
- package/dist/service/curd/CurdProService.d.ts +0 -39
- package/dist/service/curd/CurdProService.js +0 -322
- package/dist/service/proxyapi/ProxyApiLoadService.d.ts +0 -21
- package/dist/service/proxyapi/ProxyApiLoadService.js +0 -164
- package/dist/service/proxyapi/ProxyApiService.d.ts +0 -60
- package/dist/service/proxyapi/ProxyApiService.js +0 -260
- package/dist/service/proxyapi/ProxyApiUtils.d.ts +0 -15
- package/dist/service/proxyapi/ProxyApiUtils.js +0 -34
- package/dist/service/proxyapi/RouteHandler.d.ts +0 -5
- package/dist/service/proxyapi/RouteHandler.js +0 -9
- package/dist/service/proxyapi/RouteTrie.d.ts +0 -12
- package/dist/service/proxyapi/RouteTrie.js +0 -63
- package/dist/service/proxyapi/WeightedRandom.d.ts +0 -9
- package/dist/service/proxyapi/WeightedRandom.js +0 -31
- package/dist/service/proxyapi/WeightedRoundRobin.d.ts +0 -8
- package/dist/service/proxyapi/WeightedRoundRobin.js +0 -32
- package/dist/views/404_app.html +0 -31
- package/dist/views/404_workbench.html +0 -34
- package/dist/views/static/favicon.ico +0 -0
- package/src/config/config.default.ts +0 -172
- package/src/config/seed/aeskey.txt +0 -1
- package/src/config/utils.ts +0 -23
- package/src/configuration.ts +0 -83
- package/src/controller/base/BaseApiController.ts +0 -145
- package/src/controller/gateway/AnyApiGatewayController.ts +0 -33
- package/src/controller/gateway/CrudMtdGatewayController.ts +0 -107
- package/src/controller/gateway/CrudStdGatewayController.ts +0 -101
- package/src/controller/gateway/DocGatewayController.ts +0 -165
- package/src/controller/gateway/FileController.ts +0 -110
- package/src/controller/gateway/ProxyApiGatewayController.ts +0 -47
- package/src/controller/gateway/PublicApiController.ts +0 -145
- package/src/controller/gateway/StaticController.ts +0 -303
- package/src/controller/helpers.controller.ts +0 -161
- package/src/controller/home.controller.ts +0 -71
- package/src/controller/manage/AnyApiMangeApi.ts +0 -66
- package/src/controller/manage/AppLogMangeApi.ts +0 -53
- package/src/controller/manage/AppMangeApi.ts +0 -53
- package/src/controller/manage/AppPageMangeApi.ts +0 -52
- package/src/controller/manage/AppSchemaHistoryApi.ts +0 -49
- package/src/controller/manage/CrudMethodsMangeApi.ts +0 -49
- package/src/controller/manage/CrudStandardDesignApi.ts +0 -353
- package/src/controller/manage/DataDictManageApi.ts +0 -78
- package/src/controller/manage/DeployManageApi.ts +0 -179
- package/src/controller/manage/DocLibManageApi.ts +0 -69
- package/src/controller/manage/DocManageApi.ts +0 -99
- package/src/controller/manage/FileManageApi.ts +0 -45
- package/src/controller/manage/LowCodeTplManageApi.ts +0 -52
- package/src/controller/manage/MenuManageApi.ts +0 -63
- package/src/controller/manage/ProxyApiMangeApi.ts +0 -52
- package/src/controller/manage/SuperAdminManageApi.ts +0 -138
- package/src/controller/manage/SysConfigMangeApi.ts +0 -95
- package/src/controller/manage/SystemInfoManageApi.ts +0 -48
- package/src/controller/manage/UserAccountManageApi.ts +0 -88
- package/src/controller/manage/WorkbenchMangeApi.ts +0 -72
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
- package/src/controller/myinfo/AuthController.ts +0 -174
- package/src/controller/myinfo/MyInfoController.ts +0 -32
- package/src/controller/render/AppRenderController.ts +0 -76
- package/src/controller/test.controller.ts +0 -37
- package/src/filter/default.filter.ts +0 -13
- package/src/filter/notfound.filter.ts +0 -10
- package/src/index.ts +0 -71
- package/src/interface.ts +0 -31
- package/src/libs/crud-pro/CrudPro.ts +0 -158
- package/src/libs/crud-pro/defaultConfigs.ts +0 -13
- package/src/libs/crud-pro/exceptions.ts +0 -124
- package/src/libs/crud-pro/interfaces.ts +0 -183
- package/src/libs/crud-pro/models/ExecuteContext.ts +0 -111
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +0 -86
- package/src/libs/crud-pro/models/FuncContext.ts +0 -21
- package/src/libs/crud-pro/models/RequestCfgModel.ts +0 -141
- package/src/libs/crud-pro/models/RequestModel.ts +0 -141
- package/src/libs/crud-pro/models/ServiceHub.ts +0 -32
- package/src/libs/crud-pro/models/SqlCfgModel.ts +0 -52
- package/src/libs/crud-pro/models/SqlSegArg.ts +0 -13
- package/src/libs/crud-pro/models/Transaction.ts +0 -74
- package/src/libs/crud-pro/models/TransactionMySQL.ts +0 -79
- package/src/libs/crud-pro/models/TransactionPostgres.ts +0 -91
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +0 -107
- package/src/libs/crud-pro/models/keys.ts +0 -159
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +0 -75
- package/src/libs/crud-pro/services/CrudProExecuteFuncService.ts +0 -128
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +0 -279
- package/src/libs/crud-pro/services/CrudProFieldUpdateService.ts +0 -60
- package/src/libs/crud-pro/services/CrudProFieldValidateService.ts +0 -180
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +0 -373
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +0 -202
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +0 -397
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +0 -98
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +0 -59
- package/src/libs/crud-pro/services/CurdProServiceHub.ts +0 -92
- package/src/libs/crud-pro/sql.txt +0 -120
- package/src/libs/crud-pro/utils/CompareUtils.ts +0 -23
- package/src/libs/crud-pro/utils/DatabaseName.ts +0 -40
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +0 -20
- package/src/libs/crud-pro/utils/MemoryRefreshCache.ts +0 -64
- package/src/libs/crud-pro/utils/MessageParseUtils.ts +0 -33
- package/src/libs/crud-pro/utils/MixinUtils.ts +0 -285
- package/src/libs/crud-pro/utils/ModelUtils.ts +0 -55
- package/src/libs/crud-pro/utils/MultiKeyMap.ts +0 -72
- package/src/libs/crud-pro/utils/SqlFuncUtils.ts +0 -29
- package/src/libs/crud-pro/utils/TypeUtils.ts +0 -188
- package/src/libs/crud-pro/utils/ValidateUtils.ts +0 -167
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +0 -20
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +0 -22
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +0 -22
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +0 -26
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +0 -129
- package/src/libs/utils/common-dto.ts +0 -52
- package/src/libs/utils/crypto-utils.ts +0 -52
- package/src/libs/utils/fatcms-request.ts +0 -115
- package/src/libs/utils/functions.ts +0 -67
- package/src/libs/utils/ordernum-utils.ts +0 -18
- package/src/libs/utils/parseConfig.ts +0 -62
- package/src/libs/utils/parseCreateSql.ts +0 -91
- package/src/libs/utils/render-utils.ts +0 -184
- package/src/middleware/forbidden.middleware.ts +0 -71
- package/src/middleware/global.middleware.ts +0 -278
- package/src/middleware/permission.middleware.ts +0 -81
- package/src/middleware/tx.middleware.ts +0 -30
- package/src/models/SystemEntities.ts +0 -115
- package/src/models/SystemPerm.ts +0 -105
- package/src/models/SystemTables.ts +0 -30
- package/src/models/bizmodels.ts +0 -89
- package/src/models/contextLogger.ts +0 -132
- package/src/models/devops.ts +0 -17
- package/src/models/userSession.ts +0 -216
- package/src/schedule/index.ts +0 -73
- package/src/service/AuthService.ts +0 -270
- package/src/service/EnumInfoService.ts +0 -129
- package/src/service/FileCenterService.ts +0 -394
- package/src/service/SysConfigService.ts +0 -34
- package/src/service/UserAccountService.ts +0 -100
- package/src/service/UserSessionService.ts +0 -81
- package/src/service/VisitStatService.ts +0 -179
- package/src/service/WorkbenchService.ts +0 -160
- package/src/service/anyapi/AnyApiSandboxService.ts +0 -121
- package/src/service/anyapi/AnyApiService.ts +0 -184
- package/src/service/base/ApiBaseService.ts +0 -42
- package/src/service/base/ApiRateLimiter.ts +0 -59
- package/src/service/base/BaseService.ts +0 -74
- package/src/service/base/RedisCacheService.ts +0 -38
- package/src/service/crudstd/CrudStdActionService.ts +0 -27
- package/src/service/crudstd/CrudStdConstant.ts +0 -62
- package/src/service/crudstd/CrudStdRelationService.ts +0 -78
- package/src/service/crudstd/CrudStdService.ts +0 -188
- package/src/service/curd/CurdMixByAccountService.ts +0 -83
- package/src/service/curd/CurdMixByDictService.ts +0 -113
- package/src/service/curd/CurdMixByLinkToCustomService.ts +0 -167
- package/src/service/curd/CurdMixBySysConfigService.ts +0 -78
- package/src/service/curd/CurdMixByWorkbenchService.ts +0 -68
- package/src/service/curd/CurdMixService.ts +0 -65
- package/src/service/curd/CurdMixUtils.ts +0 -248
- package/src/service/curd/CurdProService.ts +0 -379
- package/src/service/proxyapi/ProxyApiLoadService.ts +0 -165
- package/src/service/proxyapi/ProxyApiService.ts +0 -262
- package/src/service/proxyapi/ProxyApiUtils.ts +0 -32
- package/src/service/proxyapi/RouteHandler.ts +0 -8
- package/src/service/proxyapi/RouteTrie.ts +0 -74
- package/src/service/proxyapi/WeightedRandom.ts +0 -37
- package/src/service/proxyapi/WeightedRoundRobin.ts +0 -44
- package/src/views/404_app.html +0 -31
- package/src/views/404_workbench.html +0 -34
- package/src/views/static/favicon.ico +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { RequestCfgModel } from './RequestCfgModel';
|
|
2
|
-
import { RequestModel } from './RequestModel';
|
|
3
|
-
import { SqlCfgModel } from './SqlCfgModel';
|
|
4
|
-
import { ExecuteContext } from './ExecuteContext';
|
|
5
|
-
import { IFuncCfgModel, IRequestCfgModel, ITableMeta } from '../interfaces';
|
|
6
|
-
import { FuncContext } from './FuncContext';
|
|
7
|
-
|
|
8
|
-
export interface ICurdProServiceHub {
|
|
9
|
-
getExecuteContext(): ExecuteContext;
|
|
10
|
-
|
|
11
|
-
validateByAllow(cfgModel: RequestCfgModel, reqModel: RequestModel);
|
|
12
|
-
|
|
13
|
-
validateByReject(cfgModel: RequestCfgModel, reqModel: RequestModel);
|
|
14
|
-
|
|
15
|
-
validateByCfg(cfgModel: RequestCfgModel, reqModel: RequestModel);
|
|
16
|
-
|
|
17
|
-
validateByAuthCfg(cfgModel: RequestCfgModel, reqModel: RequestModel): void;
|
|
18
|
-
|
|
19
|
-
updateByCfg(cfgModel: RequestCfgModel, reqModel: RequestModel);
|
|
20
|
-
|
|
21
|
-
getCachedCfgByMethod(method: string, isEnableCache: boolean): Promise<IRequestCfgModel>;
|
|
22
|
-
|
|
23
|
-
generateSQLList(exeCtx: ExecuteContext): Promise<void>;
|
|
24
|
-
|
|
25
|
-
executeSqlCfgModels(exeCtx: ExecuteContext): Promise<void>;
|
|
26
|
-
|
|
27
|
-
convertOriginToExecuteSql(sqlCfgModel: SqlCfgModel): Promise<void>;
|
|
28
|
-
|
|
29
|
-
executeFuncCfg(tmpFunCfg: IFuncCfgModel, exeFunCtx: FuncContext): string;
|
|
30
|
-
|
|
31
|
-
getTableMeta(sqlCfgModel: SqlCfgModel): Promise<ITableMeta>;
|
|
32
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ColumnRelation, IFuncCfgModel, ISqlCfgModel } from '../interfaces';
|
|
2
|
-
import { MixinUtils } from '../utils/MixinUtils';
|
|
3
|
-
import { KeyOfCrudTypes, KeysOfSqlResPicker, SqlDbType} from './keys';
|
|
4
|
-
import { parseJsonObject } from '../../utils/functions';
|
|
5
|
-
|
|
6
|
-
const { isEmpty } = MixinUtils;
|
|
7
|
-
|
|
8
|
-
class SqlCfgModel {
|
|
9
|
-
columns: string[]; // "columns": "id,name,age,sex,addr",
|
|
10
|
-
columnsRelation?: ColumnRelation[]; //只能关联基本信息:如枚举值
|
|
11
|
-
sqlTable: string; // 可以为空. originSql中不包含@@table时可以为空
|
|
12
|
-
sqlSchema?: string; // 可以为空
|
|
13
|
-
sqlDatabase?: string; // 可以为空,用此字段进行connection的选择和切换。配合getBizConnectionPool使用
|
|
14
|
-
sqlDdType?: SqlDbType; // 数据库类型,mysql(默认) 、postgres
|
|
15
|
-
maxLimit: number; // 最大一次性返回的数量
|
|
16
|
-
resName: string;
|
|
17
|
-
resPicker: KeysOfSqlResPicker;
|
|
18
|
-
originSql: string; // 有特殊占位符的SQL, 原始的SQL constructor(resName: string, originSql: string) {}
|
|
19
|
-
validate: IFuncCfgModel; //执行前,进行校验,校验不通过就抛出异常. 校验函数可以返回 boolean或直接抛出异常
|
|
20
|
-
executeWhen: IFuncCfgModel; //满足表达式的结果,才能执行。 默认:true 校验函数必须返回 booleansetResPicker(resPicker: string) {}
|
|
21
|
-
executeSql: string; // 可以运行的SQL
|
|
22
|
-
executeSqlArgs: any[]; //可以运行的SQL的参数setExecuteWhen(executeWhenFunCfg: IFuncCfgModel) {}
|
|
23
|
-
crudType: KeyOfCrudTypes = null;
|
|
24
|
-
|
|
25
|
-
constructor(json: Partial<ISqlCfgModel>) {
|
|
26
|
-
Object.assign(this, json);
|
|
27
|
-
this.columns = MixinUtils.parseColumns(json.columns);
|
|
28
|
-
this.executeWhen = parseJsonObject(json.executeWhen);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public getCrudType(): KeyOfCrudTypes {
|
|
32
|
-
if (!this.crudType) {
|
|
33
|
-
const sql = this.executeSql.trim().toUpperCase();
|
|
34
|
-
if (isEmpty(sql)) {
|
|
35
|
-
this.crudType = KeyOfCrudTypes.EMPTY_SQL;
|
|
36
|
-
} else if (sql.startsWith(KeyOfCrudTypes.SELECT)) {
|
|
37
|
-
this.crudType = KeyOfCrudTypes.SELECT;
|
|
38
|
-
} else if (sql.startsWith(KeyOfCrudTypes.UPDATE)) {
|
|
39
|
-
this.crudType = KeyOfCrudTypes.UPDATE;
|
|
40
|
-
} else if (sql.startsWith(KeyOfCrudTypes.DELETE)) {
|
|
41
|
-
this.crudType = KeyOfCrudTypes.DELETE;
|
|
42
|
-
} else if (sql.startsWith(KeyOfCrudTypes.INSERT)) {
|
|
43
|
-
this.crudType = KeyOfCrudTypes.INSERT;
|
|
44
|
-
} else {
|
|
45
|
-
this.crudType = KeyOfCrudTypes.NOT_CRUD;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return this.crudType;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { SqlCfgModel };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {IConnectionPool, IPoolConnectionClient} from '../interfaces';
|
|
2
|
-
import {SqlDbType} from "./keys";
|
|
3
|
-
import {TransactionMySQL} from "./TransactionMySQL";
|
|
4
|
-
import {TransactionPostgres} from "./TransactionPostgres";
|
|
5
|
-
import {TransactionSqlServer} from "./TransactionSqlServer";
|
|
6
|
-
|
|
7
|
-
class Transaction {
|
|
8
|
-
|
|
9
|
-
private transactionMySQL : TransactionMySQL = new TransactionMySQL();
|
|
10
|
-
private transactionPostgres : TransactionPostgres = new TransactionPostgres();
|
|
11
|
-
private transactionSqlServer : TransactionSqlServer = new TransactionSqlServer();
|
|
12
|
-
|
|
13
|
-
private getTxObj(pool: IConnectionPool): TransactionMySQL | TransactionPostgres | TransactionSqlServer {
|
|
14
|
-
if (pool.dbType === SqlDbType.postgres) {
|
|
15
|
-
return this.transactionPostgres;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (pool.dbType === SqlDbType.sqlserver) {
|
|
19
|
-
return this.transactionSqlServer;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!pool.dbType || pool.dbType === SqlDbType.mysql) {
|
|
23
|
-
return this.transactionMySQL;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 获取链接对象
|
|
30
|
-
* @param pool
|
|
31
|
-
*/
|
|
32
|
-
public async getTxConnection(pool: IConnectionPool): Promise<IPoolConnectionClient> {
|
|
33
|
-
const txObj = this.getTxObj(pool);
|
|
34
|
-
return txObj.getTxConnection(pool);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 开始事务
|
|
39
|
-
*/
|
|
40
|
-
public beginTx() {
|
|
41
|
-
this.transactionMySQL.beginTx();
|
|
42
|
-
this.transactionPostgres.beginTx();
|
|
43
|
-
this.transactionSqlServer.beginTx();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 提交事务
|
|
48
|
-
*/
|
|
49
|
-
public async commitTx() {
|
|
50
|
-
await this.transactionMySQL.commitTx();
|
|
51
|
-
await this.transactionPostgres.commitTx();
|
|
52
|
-
await this.transactionSqlServer.commitTx();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 事务回滚
|
|
57
|
-
*/
|
|
58
|
-
public async rollbackTx() {
|
|
59
|
-
await this.transactionMySQL.rollbackTx();
|
|
60
|
-
await this.transactionPostgres.rollbackTx();
|
|
61
|
-
await this.transactionSqlServer.rollbackTx();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 释放连接
|
|
66
|
-
*/
|
|
67
|
-
public async releaseTx() {
|
|
68
|
-
await this.transactionMySQL.releaseTx();
|
|
69
|
-
await this.transactionPostgres.releaseTx();
|
|
70
|
-
await this.transactionSqlServer.releaseTx();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { Transaction };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { PoolConnection, Pool } from 'mysql2/promise';
|
|
2
|
-
import { IConnectionPool } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
class TransactionMySQL {
|
|
5
|
-
private isBeginTransaction = false;
|
|
6
|
-
private connectionMap: Record<string, PoolConnection> = {};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 获取链接对象
|
|
10
|
-
* @param pool
|
|
11
|
-
*/
|
|
12
|
-
public async getTxConnection(pool: IConnectionPool): Promise<PoolConnection> {
|
|
13
|
-
let connection = this.connectionMap[pool.poolName];
|
|
14
|
-
if (!connection) {
|
|
15
|
-
const poolInstance: Pool = pool.poolInstance as any;
|
|
16
|
-
connection = await poolInstance.getConnection();
|
|
17
|
-
this.connectionMap[pool.poolName] = connection;
|
|
18
|
-
// 开启了事务
|
|
19
|
-
if (this.isBeginTransaction) {
|
|
20
|
-
await connection.beginTransaction();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return connection;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 开始事务
|
|
28
|
-
*/
|
|
29
|
-
public beginTx() {
|
|
30
|
-
this.isBeginTransaction = true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 提交事务
|
|
35
|
-
*/
|
|
36
|
-
public async commitTx() {
|
|
37
|
-
if (!this.isBeginTransaction) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const connections = Object.values(this.connectionMap);
|
|
41
|
-
for (let i = 0; i < connections.length; i++) {
|
|
42
|
-
const connection = connections[i];
|
|
43
|
-
await connection.commit();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 事务回滚
|
|
49
|
-
*/
|
|
50
|
-
public async rollbackTx() {
|
|
51
|
-
if (!this.isBeginTransaction) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const connections = Object.values(this.connectionMap);
|
|
55
|
-
for (let i = 0; i < connections.length; i++) {
|
|
56
|
-
const connection = connections[i];
|
|
57
|
-
await connection.rollback();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 释放连接
|
|
63
|
-
*/
|
|
64
|
-
public async releaseTx() {
|
|
65
|
-
// 不管有没有开启事务,都要释放连接。
|
|
66
|
-
const connections = Object.values(this.connectionMap);
|
|
67
|
-
for (let i = 0; i < connections.length; i++) {
|
|
68
|
-
const connection = connections[i];
|
|
69
|
-
try {
|
|
70
|
-
await connection.release();
|
|
71
|
-
} catch (e) {
|
|
72
|
-
console.error(e);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
this.connectionMap = {};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export { TransactionMySQL };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { PoolClient, Pool } from 'pg';
|
|
2
|
-
import { IConnectionPool } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
async function beginTransaction(connection: PoolClient) {
|
|
5
|
-
return await connection.query('BEGIN');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
async function commit(connection: PoolClient) {
|
|
9
|
-
return await connection.query('COMMIT');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function rollback(connection:PoolClient ) {
|
|
13
|
-
return await connection.query('ROLLBACK');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class TransactionPostgres {
|
|
17
|
-
private isBeginTransaction = false;
|
|
18
|
-
private connectionMap: Record<string, PoolClient> = {};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 获取链接对象
|
|
22
|
-
* @param pool
|
|
23
|
-
*/
|
|
24
|
-
public async getTxConnection(pool: IConnectionPool): Promise<PoolClient> {
|
|
25
|
-
let connection = this.connectionMap[pool.poolName];
|
|
26
|
-
if (!connection) {
|
|
27
|
-
const poolInstance: Pool = pool.poolInstance as any;
|
|
28
|
-
connection = await poolInstance.connect();
|
|
29
|
-
this.connectionMap[pool.poolName] = connection;
|
|
30
|
-
// 开启了事务
|
|
31
|
-
if (this.isBeginTransaction) {
|
|
32
|
-
await beginTransaction(connection);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return connection;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 开始事务
|
|
40
|
-
*/
|
|
41
|
-
public beginTx() {
|
|
42
|
-
this.isBeginTransaction = true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 提交事务
|
|
47
|
-
*/
|
|
48
|
-
public async commitTx() {
|
|
49
|
-
if (!this.isBeginTransaction) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const connections = Object.values(this.connectionMap);
|
|
53
|
-
for (let i = 0; i < connections.length; i++) {
|
|
54
|
-
const connection = connections[i];
|
|
55
|
-
await commit(connection);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 事务回滚
|
|
61
|
-
*/
|
|
62
|
-
public async rollbackTx() {
|
|
63
|
-
if (!this.isBeginTransaction) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const connections = Object.values(this.connectionMap);
|
|
67
|
-
for (let i = 0; i < connections.length; i++) {
|
|
68
|
-
const connection = connections[i];
|
|
69
|
-
await rollback(connection);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* 释放连接
|
|
75
|
-
*/
|
|
76
|
-
public async releaseTx() {
|
|
77
|
-
// 不管有没有开启事务,都要释放连接。
|
|
78
|
-
const connections = Object.values(this.connectionMap);
|
|
79
|
-
for (let i = 0; i < connections.length; i++) {
|
|
80
|
-
const connection = connections[i];
|
|
81
|
-
try {
|
|
82
|
-
await connection.release();
|
|
83
|
-
} catch (e) {
|
|
84
|
-
console.error(e);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
this.connectionMap = {};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { TransactionPostgres };
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { ConnectionPool, Request, Transaction } from 'mssql';
|
|
2
|
-
import { IConnectionPool, IPoolConnectionClient } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
interface ISqlServerConnection extends IPoolConnectionClient {
|
|
6
|
-
originConnection: ConnectionPool
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class TransactionSqlServer {
|
|
12
|
-
private isBeginTransaction = false;
|
|
13
|
-
private connectionMap: Record<string, ISqlServerConnection> = {};
|
|
14
|
-
private transactionMap: Record<string, Transaction> = {};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 获取链接对象
|
|
18
|
-
* @param pool
|
|
19
|
-
*/
|
|
20
|
-
public async getTxConnection(pool: IConnectionPool): Promise<ISqlServerConnection> {
|
|
21
|
-
let connection = this.connectionMap[pool.poolName];
|
|
22
|
-
if (!connection) {
|
|
23
|
-
connection = await this.connectAndCreateConnection(pool);
|
|
24
|
-
this.connectionMap[pool.poolName] = connection;
|
|
25
|
-
|
|
26
|
-
// 开启了事务
|
|
27
|
-
if (this.isBeginTransaction) {
|
|
28
|
-
await this.beginTransaction(pool.poolName);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return connection;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private async connectAndCreateConnection(pool: IConnectionPool) : Promise<ISqlServerConnection> {
|
|
35
|
-
const poolInstance: ConnectionPool = pool.poolInstance as any;
|
|
36
|
-
const originConnection = await poolInstance.connect();
|
|
37
|
-
return {
|
|
38
|
-
originConnection,
|
|
39
|
-
query: (sql:string, values: any) : Promise<any> =>{
|
|
40
|
-
const request = new Request(originConnection);
|
|
41
|
-
if (Array.isArray(values)) {
|
|
42
|
-
for (let i = 0; i < values.length; i++) {
|
|
43
|
-
const index = i+1;
|
|
44
|
-
const value = values[i];
|
|
45
|
-
request.input(`fatcms_ms${index}`, value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return request.query(sql);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 开始事务
|
|
55
|
-
*/
|
|
56
|
-
public beginTx() {
|
|
57
|
-
this.isBeginTransaction = true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* 提交事务
|
|
62
|
-
*/
|
|
63
|
-
public async commitTx() {
|
|
64
|
-
if (!this.isBeginTransaction) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const transactions = Object.values(this.transactionMap);
|
|
68
|
-
for (let i = 0; i < transactions.length; i++) {
|
|
69
|
-
const tmpTx = transactions[i];
|
|
70
|
-
await tmpTx.commit();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 事务回滚
|
|
76
|
-
*/
|
|
77
|
-
public async rollbackTx() {
|
|
78
|
-
if (!this.isBeginTransaction) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const transactions = Object.values(this.transactionMap);
|
|
82
|
-
for (let i = 0; i < transactions.length; i++) {
|
|
83
|
-
const tmpTx = transactions[i];
|
|
84
|
-
await tmpTx.rollback();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 释放连接
|
|
90
|
-
*/
|
|
91
|
-
public async releaseTx() {
|
|
92
|
-
this.connectionMap = {};
|
|
93
|
-
this.transactionMap = {};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
private async beginTransaction(poolName: string) {
|
|
98
|
-
const connection = this.connectionMap[poolName];
|
|
99
|
-
const originConnection: ConnectionPool = connection.originConnection;
|
|
100
|
-
const tmpTx = new Transaction(originConnection);
|
|
101
|
-
this.transactionMap[poolName] = tmpTx;
|
|
102
|
-
return await tmpTx.begin()
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export { TransactionSqlServer };
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
export enum SqlDbType {
|
|
2
|
-
mysql = 'mysql',
|
|
3
|
-
postgres = 'postgres',
|
|
4
|
-
sqlserver = 'sqlserver', //微软 SQL Server
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export enum KeysOfFunCtx {
|
|
8
|
-
FUNC_CTX = '$',
|
|
9
|
-
CURRENT_VALUE = '$current',
|
|
10
|
-
VISITOR = 'visitor',
|
|
11
|
-
VISITOR_ATTR = 'visitor.',
|
|
12
|
-
REQUEST = 'req.',
|
|
13
|
-
RESULT = 'res.',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//鉴权类型;free无需鉴权,login仅登录即可,byRoleCode校验角色,byFuncCode校验功能点
|
|
17
|
-
export enum KeysOfAuthType {
|
|
18
|
-
free = 'free', // 无需任何校验
|
|
19
|
-
login = 'login', // 仅仅登录即可
|
|
20
|
-
byRoleCode = 'byRoleCode', // 根据角色校验
|
|
21
|
-
byFuncCode = 'byFuncCode', // 根据功能点校验
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export enum KeysOfValidators {
|
|
25
|
-
REQUIRED = 'required',
|
|
26
|
-
BOOLEAN = 'boolean', // 布尔值类型
|
|
27
|
-
OBJECT = 'object', // 普通对象类型类型
|
|
28
|
-
ARRAY = 'array', // 数组
|
|
29
|
-
ARRAY_STRING = 'array:string', // 数组
|
|
30
|
-
ARRAY_NUMBER = 'array:number', // 数组
|
|
31
|
-
STRING = 'string', // 字符串类型
|
|
32
|
-
EMAIL = 'email',
|
|
33
|
-
NAME = 'name', //必须以字母开头,只能包含:字母/数字/下划线
|
|
34
|
-
PHONE_CN = 'phone:cn', // 中国手机号:11位
|
|
35
|
-
INTEGER = 'integer', // long,int,short,bigInteger
|
|
36
|
-
NUMBER = 'number', // long,int,short,float,double
|
|
37
|
-
NUMERIC = 'numeric', //long,int,short,float,double或只包含数字的字符串
|
|
38
|
-
MOMENT = 'moment:', // moment:YYYY-MM-DD HH:mm:ss 时间日期格式校验
|
|
39
|
-
SCALE = 'scale:', // 判断参数是否位于这个区间:scale:[1,3] ; scale:(1,3) ; scale:(1,3] ;
|
|
40
|
-
LENGTH = 'length:', // length:1,5 ; length >=1 and length <=5
|
|
41
|
-
REG_EXP = 'regexp:', // regexp:[a-zA-Z-_.]
|
|
42
|
-
ENUM = 'enum:', // enum : 1,2,3,4,5,6,aa,bb,cc :比较时用字符串比较
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export enum KeyOfCrudTypes {
|
|
46
|
-
SELECT = 'SELECT',
|
|
47
|
-
UPDATE = 'UPDATE',
|
|
48
|
-
INSERT = 'INSERT',
|
|
49
|
-
DELETE = 'DELETE',
|
|
50
|
-
NOT_CRUD = 'NOT_CRUD',
|
|
51
|
-
EMPTY_SQL = 'EMPTY_SQL',
|
|
52
|
-
SYS_QUERY = 'SYS_QUERY',
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export enum KeysOfSimpleSQL {
|
|
56
|
-
SIMPLE_QUERY = 'SIMPLE_QUERY', // select * from xx where @condition limit 100,
|
|
57
|
-
SIMPLE_QUERY_ONE = 'SIMPLE_QUERY_ONE', //只查询一条 select * from xx where @condition limit 1,
|
|
58
|
-
SIMPLE_QUERY_PAGE = 'SIMPLE_QUERY_PAGE', //分页查询 select * from xx where @condition limit 100 offset 100,
|
|
59
|
-
SIMPLE_QUERY_COUNT = 'SIMPLE_QUERY_COUNT', //查询数量 select count(0) as totalCount from xx where @condition,
|
|
60
|
-
SIMPLE_UPDATE = 'SIMPLE_UPDATE', // update xx set @data where @condition limit 1
|
|
61
|
-
SIMPLE_INSERT = 'SIMPLE_INSERT', // insert into xx values @datas
|
|
62
|
-
SIMPLE_DELETE = 'SIMPLE_DELETE', // delete from xx values where @condition limit 1
|
|
63
|
-
SIMPLE_INSERT_ON_DUPLICATE_UPDATE = 'SIMPLE_INSERT_ON_DUPLICATE_UPDATE',
|
|
64
|
-
SIMPLE_INSERT_OR_UPDATE = 'SIMPLE_INSERT_OR_UPDATE',
|
|
65
|
-
CUSTOM = 'CUSTOM',
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export enum KeysOfSqlResPicker {
|
|
69
|
-
UPDATE_RESULT = 'UPDATE_RESULT', // update/insert/delete 产生影响的结果
|
|
70
|
-
RESULT_FIRST_ROW = 'RESULT_FIRST_ROW', // $ResultSet[0], 只取第一行的数据返回。返回JSONObject
|
|
71
|
-
RESULT_TOTAL_COUNT = 'RESULT_TOTAL_COUNT', // $ResultSet[0].total_count , 只取第一行的的total_count。返回long
|
|
72
|
-
RESULT_ONE_VALUE = 'RESULT_ONE_VALUE', // $ResultSet[0].total_count , 只取第一行的的total_count。返回long
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const KeysOfCustomSQL = {
|
|
76
|
-
SQL_COLUMNS: '@@columns',
|
|
77
|
-
SQL_TABLE: '@@table', // 只有简单查询才能用得到
|
|
78
|
-
SQL_OFFSET_LIMIT: '@@offsetLimit',
|
|
79
|
-
SQL_ORDER_BYS: '@@orderBys',
|
|
80
|
-
|
|
81
|
-
SQL_AS_WHERE: '@@asWhere:', // @@asWhere:condition , @@asWhere:condition_zhangsan
|
|
82
|
-
SQL_AS_UPDATE: '@@asUpdate:', // @@asUpdate:data, @@asWhere:data_zhangsan
|
|
83
|
-
SQL_AS_INSERT_KEYS: '@@asInsertKeys:', // @@asInsertKeys:data, @@asInsertKeys:data_zhangsan
|
|
84
|
-
SQL_AS_INSERT_VALUES: '@@asInsertValues:', // @@asInsertValues:data, @@asInsertValues:data_zhangsan
|
|
85
|
-
|
|
86
|
-
// 从Req中取值:单独取Data中的某个字段:获取单个值。
|
|
87
|
-
SQL_GET_DATA_ATTR_START: '@@data', // // select * from fa_lang_faq where id = @@data.id
|
|
88
|
-
SQL_GET_CONDITION_ATTR_START: '@@condition', // select * from fa_lang_faq where id = @@condition.id
|
|
89
|
-
|
|
90
|
-
// 从Res中取值
|
|
91
|
-
SQL_PICK_RES_AS_NUMBER: '@@pickResAsNumber:', // select * from fa_lang_faq where id = @@pickResAsNumber:rows[0].id
|
|
92
|
-
SQL_PICK_RES_AS_STRING: '@@pickResAsString:', // select * from fa_lang_faq where lang_code = @@pickResAsString:row.lang_code
|
|
93
|
-
|
|
94
|
-
// 使用java函数:获取单个值
|
|
95
|
-
SQL_FUNCTION: '@@function:', // @@function:aaa
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* 查询条件中允许出现的关键词
|
|
100
|
-
* 与MongoDB的语法完全一致
|
|
101
|
-
*/
|
|
102
|
-
export const KeysOfConditions = {
|
|
103
|
-
$OR: '$or', //或
|
|
104
|
-
|
|
105
|
-
$NE: '$ne', //不等于
|
|
106
|
-
$LT: '$lt', //小于
|
|
107
|
-
$LTE: '$lte', //小于或等于
|
|
108
|
-
$GT: '$gt', //大于
|
|
109
|
-
$GTE: '$gte', //大于或等于
|
|
110
|
-
$IN: '$in', //in
|
|
111
|
-
$NIN: '$nin', // not in
|
|
112
|
-
$NOT_NULL: '$notNull', // is not null
|
|
113
|
-
$NULL: '$null', // is null
|
|
114
|
-
$RANGE: '$range', // between 1 and 2
|
|
115
|
-
$LIKE: '$like', // A% 以A开头 {age:1, name:{"$like":"张"} }
|
|
116
|
-
$NOT_LIKE: '$notLike', // A% 以A开头 {age:1, name:{"$notLike":"张"} }
|
|
117
|
-
|
|
118
|
-
$LIKE_INCLUDE: '$likeInclude', // %A% 包含A {age:1, name:{"$like":"张"} }
|
|
119
|
-
$NOT_LIKE_INCLUDE: '$notLikeInclude', // %A% 包含A {age:1, name:{"$notLike":"张"} }
|
|
120
|
-
|
|
121
|
-
$MATCH: '$match', // 全文索引 {age:1, name:{"$match":"张"} }
|
|
122
|
-
$MATCH_BOOL: '$matchBool', // 全文索引 {age:1, name:{"$matchBool":"张"} }
|
|
123
|
-
|
|
124
|
-
COMPARE_KEYS: new Set<string>([]),
|
|
125
|
-
ALL_KEYS: new Set<string>([]),
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
function initKeysOfConditions() {
|
|
129
|
-
const addIgnoreCase = (keys: Set<string>, key: string) => {
|
|
130
|
-
keys.add(key);
|
|
131
|
-
keys.add(key.toUpperCase());
|
|
132
|
-
keys.add(key.toLowerCase());
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// 比较操作符, 支持忽略大小写
|
|
136
|
-
KeysOfConditions.COMPARE_KEYS = new Set([]);
|
|
137
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NE);
|
|
138
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$LT);
|
|
139
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$LTE);
|
|
140
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$GT);
|
|
141
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$GTE);
|
|
142
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$IN);
|
|
143
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NIN);
|
|
144
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$LIKE);
|
|
145
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$LIKE_INCLUDE);
|
|
146
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NOT_LIKE);
|
|
147
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NOT_LIKE_INCLUDE);
|
|
148
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$MATCH);
|
|
149
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$MATCH_BOOL);
|
|
150
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$RANGE);
|
|
151
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NULL);
|
|
152
|
-
addIgnoreCase(KeysOfConditions.COMPARE_KEYS, KeysOfConditions.$NOT_NULL);
|
|
153
|
-
|
|
154
|
-
// 所有操作符
|
|
155
|
-
KeysOfConditions.ALL_KEYS = new Set([...KeysOfConditions.COMPARE_KEYS]);
|
|
156
|
-
addIgnoreCase(KeysOfConditions.ALL_KEYS, KeysOfConditions.$OR);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
initKeysOfConditions();
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { camelizeKeys } from 'humps';
|
|
2
|
-
import { CrudProServiceBase } from './CrudProServiceBase';
|
|
3
|
-
import { IRequestCfgModel } from '../interfaces';
|
|
4
|
-
import { MixinUtils } from '../utils/MixinUtils';
|
|
5
|
-
import { ICurdProServiceHub } from '../models/ServiceHub';
|
|
6
|
-
import MemoryRefreshCache from '../utils/MemoryRefreshCache';
|
|
7
|
-
|
|
8
|
-
const methodCache = new MemoryRefreshCache();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function parseMethodInfo(methodInfo: any): any {
|
|
12
|
-
const row: any = camelizeKeys(methodInfo as object); //转换成驼峰
|
|
13
|
-
const configObject = MixinUtils.parseJsonObject(row.moreConfig) || {};
|
|
14
|
-
const sqlCfgList = MixinUtils.parseJsonObject(row.sqlCfgList) || [];
|
|
15
|
-
return {...configObject, ...row, sqlCfgList};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class CrudProCachedCfgService extends CrudProServiceBase {
|
|
21
|
-
constructor(serviceHub: ICurdProServiceHub) {
|
|
22
|
-
super(serviceHub);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public async getCachedCfgByMethod(method: string, isEnableCache: boolean): Promise<IRequestCfgModel | null> {
|
|
26
|
-
|
|
27
|
-
// 不使用缓存
|
|
28
|
-
if (!isEnableCache) {
|
|
29
|
-
return await this.loadMethodInfo(method)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
methodCache.setProps({
|
|
33
|
-
keepTime: 2000,
|
|
34
|
-
requestFn: () => this.loadMethodInfoList(),
|
|
35
|
-
getKeyFn: item => item.method,
|
|
36
|
-
});
|
|
37
|
-
return await methodCache.getItem(method);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private async loadMethodInfo(method: string): Promise<any> {
|
|
42
|
-
const {methodsTableName, sysDatabaseName} = this.getContextCfg();
|
|
43
|
-
const sql = `select *
|
|
44
|
-
from ${methodsTableName}
|
|
45
|
-
where method = ? `; // 全部加载到内存
|
|
46
|
-
const baseInfo = {
|
|
47
|
-
tableName: methodsTableName, // // 方法配置的表名,默认 sys_crud_pro_methods
|
|
48
|
-
dbName: sysDatabaseName,
|
|
49
|
-
};
|
|
50
|
-
const [rows] = await this.executeUnsafeQuery(baseInfo, sql, [method]);
|
|
51
|
-
const rows2: any[] = rows as object[];
|
|
52
|
-
if (rows2.length > 0) {
|
|
53
|
-
return parseMethodInfo(rows2[0]);
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
private async loadMethodInfoList(): Promise<any[]> {
|
|
61
|
-
const { methodsTableName, sysDatabaseName } = this.getContextCfg();
|
|
62
|
-
const sql = `select * from ${methodsTableName}`; // 全部加载到内存
|
|
63
|
-
const baseInfo = {
|
|
64
|
-
tableName: methodsTableName, // // 方法配置的表名,默认 sys_crud_pro_methods
|
|
65
|
-
dbName: sysDatabaseName,
|
|
66
|
-
};
|
|
67
|
-
const [rows] = await this.executeUnsafeQuery(baseInfo, sql);
|
|
68
|
-
const rows2: any[] = rows as object[];
|
|
69
|
-
return rows2.map(row => {
|
|
70
|
-
return parseMethodInfo(row);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { CrudProCachedCfgService };
|