├── .eslintignore ├── .eslintrc ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug-report-cn.yml │ ├── bug-report.yml │ ├── feature-request-cn.yml │ ├── feature-request.yml │ ├── rfc-cn.yml │ └── rfc.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── codeql-analysis.yml │ └── nodejs.yml ├── .gitignore ├── .mocharc.yml ├── .nycrc.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── benchmark └── http │ ├── app │ ├── controller │ │ ├── FooTeggController.ts │ │ └── template │ │ │ └── egg_controller_1.js │ └── router.js │ ├── config │ ├── config.default.js │ └── plugin.js │ ├── package.json │ └── tsconfig.json ├── core ├── ajv-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── enum │ │ │ └── TransformEnum.ts │ │ ├── error │ │ │ └── AjvInvalidParamError.ts │ │ └── type │ │ │ └── Ajv.ts │ ├── test │ │ └── TransformEnum.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── aop-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── AspectMetaBuilder.ts │ │ ├── CrosscutAdviceFactory.ts │ │ ├── decorator │ │ │ ├── Advice.ts │ │ │ ├── Crosscut.ts │ │ │ └── Pointcut.ts │ │ ├── model │ │ │ ├── Aspect.ts │ │ │ └── PointcutInfo.ts │ │ └── util │ │ │ ├── AdviceInfoUtil.ts │ │ │ ├── AspectInfoUtil.ts │ │ │ ├── CrosscutInfoUtil.ts │ │ │ └── PointcutAdviceInfoUtil.ts │ ├── test │ │ ├── AspectMetaBuilder.test.ts │ │ └── fixtures │ │ │ ├── CrosscutExample.ts │ │ │ ├── InheritExample.ts │ │ │ └── PointcutExample.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── aop-runtime │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── AspectExecutor.ts │ │ ├── CrossCutGraphHook.ts │ │ ├── EggObjectAopHook.ts │ │ ├── EggPrototypeCrossCutHook.ts │ │ ├── LoadUnitAopHook.ts │ │ └── PointCutGraphHook.ts │ ├── test │ │ ├── aop-runtime.test.ts │ │ └── fixtures │ │ │ ├── modules │ │ │ ├── constructor_inject_aop │ │ │ │ ├── Hello.ts │ │ │ │ └── package.json │ │ │ ├── hello_cross_cut │ │ │ │ ├── CallTrace.ts │ │ │ │ ├── HelloCrossCut.ts │ │ │ │ └── package.json │ │ │ ├── hello_point_cut │ │ │ │ ├── HelloPointCut.ts │ │ │ │ └── package.json │ │ │ ├── hello_succeed │ │ │ │ ├── Hello.ts │ │ │ │ └── package.json │ │ │ └── should_throw │ │ │ │ ├── Hello.ts │ │ │ │ └── package.json │ │ │ └── mutli │ │ │ ├── a │ │ │ ├── A.ts │ │ │ └── package.json │ │ │ ├── b │ │ │ ├── B.ts │ │ │ └── package.json │ │ │ ├── c │ │ │ ├── Base.ts │ │ │ └── package.json │ │ │ └── cross │ │ │ ├── Cross.ts │ │ │ └── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── background-task │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ └── BackgroundTaskHelper.ts │ ├── test │ │ └── BackgroundTaskHelper.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── common-util │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── FSUtil.ts │ │ ├── Graph.ts │ │ ├── MapUtil.ts │ │ ├── ModuleConfig.ts │ │ ├── ModuleConfigs.ts │ │ ├── NameUtil.ts │ │ ├── ObjectUtils.ts │ │ ├── ProxyUtil.ts │ │ ├── StackUtil.ts │ │ ├── StreamUtil.ts │ │ └── TimerUtil.ts │ ├── test │ │ ├── MapUtil.test.ts │ │ ├── ModuleConfig.test.ts │ │ ├── NameUtil.test.ts │ │ ├── ObjectUtil.test.ts │ │ ├── ProtoGraph.test.ts │ │ ├── TimerUtil.test.ts │ │ └── fixtures │ │ │ ├── apps │ │ │ ├── app-with-module-json │ │ │ │ ├── app │ │ │ │ │ ├── module-a │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-b │ │ │ │ │ │ └── package.json │ │ │ │ ├── config │ │ │ │ │ └── module.json │ │ │ │ └── package.json │ │ │ ├── app-with-module-pkg-json │ │ │ │ ├── config │ │ │ │ │ └── module.json │ │ │ │ ├── node_modules │ │ │ │ │ └── module-a │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ ├── app-with-modules │ │ │ │ ├── app │ │ │ │ │ └── module-a │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ ├── app-with-no-module-json-duplicated │ │ │ │ ├── .sff │ │ │ │ │ ├── .other │ │ │ │ │ │ └── module-d │ │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-c │ │ │ │ │ │ └── package.json │ │ │ │ ├── app │ │ │ │ │ ├── module-a │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-b │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── test │ │ │ │ │ │ └── fixtures │ │ │ │ │ │ └── module-e │ │ │ │ │ │ └── package.json │ │ │ │ ├── node_modules │ │ │ │ │ └── module-b │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ ├── app-with-no-module-json │ │ │ │ ├── .sff │ │ │ │ │ ├── .other │ │ │ │ │ │ └── module-d │ │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-c │ │ │ │ │ │ └── package.json │ │ │ │ ├── app │ │ │ │ │ ├── module-a │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-b │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── test │ │ │ │ │ │ └── fixtures │ │ │ │ │ │ └── module-e │ │ │ │ │ │ └── package.json │ │ │ │ ├── node_modules │ │ │ │ │ ├── dep │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ │ └── module-c │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ └── app-with-symlink │ │ │ │ ├── app │ │ │ │ └── module-a │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ ├── modules │ │ │ ├── dev-module-config │ │ │ │ ├── module.dev.yml │ │ │ │ └── module.yml │ │ │ └── foo-yaml │ │ │ │ └── module.yml │ │ │ └── monorepo │ │ │ ├── foo │ │ │ └── .gitkeep │ │ │ ├── node_modules │ │ │ └── a │ │ │ └── packages │ │ │ ├── a │ │ │ ├── node_modules │ │ │ │ └── c │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── b │ │ │ └── package.json │ │ │ └── d │ │ │ ├── node_modules │ │ │ ├── e │ │ │ │ └── package.json │ │ │ └── f │ │ │ │ └── package.json │ │ │ └── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── controller-decorator │ ├── CHANGELOG.md │ ├── README.json │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── builder │ │ │ └── ControllerMetaBuilderFactory.ts │ │ ├── decorator │ │ │ ├── Acl.ts │ │ │ ├── Context.ts │ │ │ ├── Middleware.ts │ │ │ ├── http │ │ │ │ ├── HTTPController.ts │ │ │ │ ├── HTTPMethod.ts │ │ │ │ ├── HTTPParam.ts │ │ │ │ └── Host.ts │ │ │ └── mcp │ │ │ │ ├── Extra.ts │ │ │ │ ├── MCPController.ts │ │ │ │ ├── MCPPrompt.ts │ │ │ │ ├── MCPResource.ts │ │ │ │ └── MCPTool.ts │ │ ├── impl │ │ │ ├── http │ │ │ │ ├── HTTPControllerMetaBuilder.ts │ │ │ │ └── HTTPControllerMethodMetaBuilder.ts │ │ │ └── mcp │ │ │ │ ├── MCPControllerMetaBuilder.ts │ │ │ │ ├── MCPControllerPromptMetaBuilder.ts │ │ │ │ ├── MCPControllerResourceMetaBuilder.ts │ │ │ │ └── MCPControllerToolMetaBuilder.ts │ │ ├── model │ │ │ ├── HTTPControllerMeta.ts │ │ │ ├── HTTPCookies.ts │ │ │ ├── HTTPMethodMeta.ts │ │ │ ├── HTTPRequest.ts │ │ │ ├── HTTPResponse.ts │ │ │ ├── MCPControllerMeta.ts │ │ │ ├── MCPPromptMeta.ts │ │ │ ├── MCPResourceMeta.ts │ │ │ ├── MCPToolMeta.ts │ │ │ └── index.ts │ │ └── util │ │ │ ├── ControllerInfoUtil.ts │ │ │ ├── ControllerMetadataUtil.ts │ │ │ ├── HTTPInfoUtil.ts │ │ │ ├── HTTPPriorityUtil.ts │ │ │ ├── MCPInfoUtil.ts │ │ │ ├── MethodInfoUtil.ts │ │ │ └── validator │ │ │ ├── ControllerValidator.ts │ │ │ └── MethodValidator.ts │ ├── test │ │ ├── Acl.test.ts │ │ ├── Context.test.ts │ │ ├── MCPMeta.test.ts │ │ ├── Middleware.test.ts │ │ ├── decorators.test.ts │ │ ├── fixtures │ │ │ ├── AclController.ts │ │ │ ├── AopMiddlewareController.ts │ │ │ ├── ContextController.ts │ │ │ ├── HTTPFooController.ts │ │ │ ├── HTTPPriorityController.ts │ │ │ ├── HostController.ts │ │ │ ├── MCPController.ts │ │ │ └── MiddlewareController.ts │ │ ├── http │ │ │ ├── HTTPMeta.test.ts │ │ │ └── Host.test.ts │ │ └── util │ │ │ ├── ControllerMetadataUtil.test.ts │ │ │ └── HTTPPriority.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── core-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── decorator │ │ │ ├── ConfigSource.ts │ │ │ ├── ContextProto.ts │ │ │ ├── EggQualifier.ts │ │ │ ├── InitTypeQualifier.ts │ │ │ ├── Inject.ts │ │ │ ├── ModuleQualifier.ts │ │ │ ├── MultiInstanceInfo.ts │ │ │ ├── MultiInstanceProto.ts │ │ │ ├── Prototype.ts │ │ │ └── SingletonProto.ts │ │ └── util │ │ │ ├── MetadataUtil.ts │ │ │ ├── PrototypeUtil.ts │ │ │ └── QualifierUtil.ts │ ├── test │ │ ├── decorators.test.ts │ │ ├── fixtures │ │ │ └── decators │ │ │ │ ├── CacheService.ts │ │ │ │ ├── ChildService.ts │ │ │ │ ├── ConstructorObject.ts │ │ │ │ ├── ContextCache.ts │ │ │ │ ├── FooLogger.ts │ │ │ │ ├── ICache.ts │ │ │ │ ├── OtherService.ts │ │ │ │ ├── QualifierCacheService.ts │ │ │ │ └── SingletonCache.ts │ │ └── util │ │ │ └── MetadataUtil.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── dal-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── decorator │ │ │ ├── Column.ts │ │ │ ├── Dao.ts │ │ │ ├── DataSourceQualifier.ts │ │ │ ├── Index.ts │ │ │ └── Table.ts │ │ ├── model │ │ │ ├── ColumnModel.ts │ │ │ ├── IndexModel.ts │ │ │ └── TableModel.ts │ │ ├── type │ │ │ ├── MySql.ts │ │ │ └── Spatial.ts │ │ └── util │ │ │ ├── ColumnInfoUtil.ts │ │ │ ├── DaoInfoUtil.ts │ │ │ ├── IndexInfoUtil.ts │ │ │ └── TableInfoUtil.ts │ ├── test │ │ ├── fixtures │ │ │ └── modules │ │ │ │ └── dal │ │ │ │ ├── Foo.ts │ │ │ │ └── package.json │ │ └── index.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── dal-runtime │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── BaseSqlMap.ts │ │ ├── CodeGenerator.ts │ │ ├── DaoLoader.ts │ │ ├── DataSource.ts │ │ ├── DatabaseForker.ts │ │ ├── MySqlDataSource.ts │ │ ├── NunjucksConverter.ts │ │ ├── NunjucksUtil.ts │ │ ├── SqlGenerator.ts │ │ ├── SqlMapLoader.ts │ │ ├── SqlUtil.ts │ │ ├── TableModelInstanceBuilder.ts │ │ ├── TableSqlMap.ts │ │ ├── TemplateUtil.ts │ │ └── templates │ │ │ ├── base_dao.njk │ │ │ ├── dao.njk │ │ │ └── extension.njk │ ├── test │ │ ├── CodeGenerator.test.ts │ │ ├── DAO.test.ts │ │ ├── DataSource.test.ts │ │ ├── SqlGenerator.test.ts │ │ ├── SqlUtil.test.ts │ │ ├── TableSqlMap.test.ts │ │ └── fixtures │ │ │ └── modules │ │ │ ├── dal │ │ │ ├── AutoUpdateTime.ts │ │ │ ├── Foo.ts │ │ │ ├── FooIndexName.ts │ │ │ ├── dal │ │ │ │ ├── dao │ │ │ │ │ ├── FooDAO.ts │ │ │ │ │ └── base │ │ │ │ │ │ └── BaseFooDAO.ts │ │ │ │ ├── extension │ │ │ │ │ └── FooExtension.ts │ │ │ │ └── structure │ │ │ │ │ ├── Foo.json │ │ │ │ │ └── Foo.sql │ │ │ └── package.json │ │ │ ├── generate_codes │ │ │ ├── Foo.ts │ │ │ ├── MultiPrimaryKey.ts │ │ │ ├── dal │ │ │ │ ├── dao │ │ │ │ │ ├── FooDAO.ts │ │ │ │ │ ├── MultiPrimaryKeyDAO.ts │ │ │ │ │ └── base │ │ │ │ │ │ ├── BaseFooDAO.ts │ │ │ │ │ │ └── BaseMultiPrimaryKeyDAO.ts │ │ │ │ ├── extension │ │ │ │ │ ├── FooExtension.ts │ │ │ │ │ └── MultiPrimaryKeyExtension.ts │ │ │ │ └── structure │ │ │ │ │ ├── Foo.json │ │ │ │ │ ├── Foo.sql │ │ │ │ │ ├── MultiPrimaryKey.json │ │ │ │ │ └── MultiPrimaryKey.sql │ │ │ └── package.json │ │ │ ├── generate_codes_not_overwrite_dao │ │ │ ├── Foo.ts │ │ │ ├── dal │ │ │ │ ├── dao │ │ │ │ │ └── FooDAO.ts │ │ │ │ └── extension │ │ │ │ │ └── FooExtension.ts │ │ │ └── package.json │ │ │ └── generate_codes_to_src │ │ │ ├── package.json │ │ │ └── src │ │ │ └── Foo.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── dynamic-inject-runtime │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── EggObjectFactory.ts │ │ ├── EggObjectFactoryObject.ts │ │ └── EggObjectFactoryPrototype.ts │ ├── test │ │ ├── fixtures │ │ │ └── modules │ │ │ │ └── dynamic-inject-module │ │ │ │ ├── AbstractContextHello.ts │ │ │ │ ├── AbstractSingletonHello.ts │ │ │ │ ├── FooType.ts │ │ │ │ ├── HelloService.ts │ │ │ │ ├── decorator │ │ │ │ ├── ContextHello.ts │ │ │ │ └── SingletonHello.ts │ │ │ │ ├── impl │ │ │ │ ├── BarContextHello.ts │ │ │ │ ├── BarSingletonHello.ts │ │ │ │ ├── FooContextHello.ts │ │ │ │ └── FooSingletonHello.ts │ │ │ │ └── package.json │ │ └── index.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── dynamic-inject │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── QualifierImplDecoratorUtil.ts │ │ └── QualifierImplUtil.ts │ ├── test │ │ ├── fixtures │ │ │ └── modules │ │ │ │ ├── base │ │ │ │ ├── AbstractContextHello.ts │ │ │ │ ├── ContextHello.ts │ │ │ │ └── FooType.ts │ │ │ │ ├── wrong-enum-module │ │ │ │ ├── WrongEnumCase.ts │ │ │ │ └── tsconfig.json │ │ │ │ └── wrong-extends-module │ │ │ │ ├── WrongExtendsCase.ts │ │ │ │ └── tsconfig.json │ │ └── typing.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── eventbus-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── Event.ts │ │ ├── EventBus.ts │ │ ├── EventContext.ts │ │ ├── EventInfoUtil.ts │ │ └── type.d.ts │ ├── test │ │ ├── Event.test.ts │ │ └── fixtures │ │ │ ├── empty-handle.ts │ │ │ ├── event-handle-with-context.ts │ │ │ ├── multiple-events-handle.ts │ │ │ ├── right-event-handle.ts │ │ │ └── wrong-event-handle.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── eventbus-runtime │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── EventContextFactory.ts │ │ ├── EventHandlerFactory.ts │ │ └── SingletonEventBus.ts │ ├── test │ │ ├── EventBus.test.ts │ │ └── fixtures │ │ │ └── modules │ │ │ ├── event │ │ │ ├── HelloEvent.ts │ │ │ ├── MultiEvent.ts │ │ │ ├── MultiEventWithContext.ts │ │ │ └── package.json │ │ │ └── mock-module │ │ │ ├── MockLogger.ts │ │ │ └── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── lifecycle │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── IdenticalObject.ts │ │ ├── LifycycleUtil.ts │ │ └── decorator │ │ │ └── index.ts │ ├── test │ │ └── IdenticalObject.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── loader │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── LoaderFactory.ts │ │ ├── LoaderUtil.ts │ │ └── impl │ │ │ └── ModuleLoader.ts │ ├── test │ │ ├── Loader.test.ts │ │ └── fixtures │ │ │ └── modules │ │ │ ├── loader-failed │ │ │ ├── AppRepo.ts │ │ │ └── package.json │ │ │ ├── module-for-loader │ │ │ ├── AppRepo.ts │ │ │ ├── SprintRepo.ts │ │ │ ├── UserRepo.ts │ │ │ └── package.json │ │ │ ├── module-with-extra │ │ │ ├── .dist │ │ │ │ └── ThrowError.ts │ │ │ ├── AppRepo.ts │ │ │ ├── extra │ │ │ │ └── UserRepo.ts │ │ │ └── package.json │ │ │ └── module-with-test │ │ │ ├── .gitignore │ │ │ ├── AppRepo.ts │ │ │ ├── coverage │ │ │ └── fixtures │ │ │ │ └── UserRepo.ts │ │ │ ├── package.json │ │ │ └── test │ │ │ └── fixtures │ │ │ └── UserRepo.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── metadata │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── errors.ts │ │ ├── factory │ │ │ ├── EggPrototypeCreatorFactory.ts │ │ │ ├── EggPrototypeFactory.ts │ │ │ └── LoadUnitFactory.ts │ │ ├── impl │ │ │ ├── EggPrototypeBuilder.ts │ │ │ ├── EggPrototypeImpl.ts │ │ │ ├── LoadUnitMultiInstanceProtoHook.ts │ │ │ └── ModuleLoadUnit.ts │ │ ├── model │ │ │ ├── AppGraph.ts │ │ │ ├── EggPrototype.ts │ │ │ ├── LoadUnit.ts │ │ │ ├── ModuleDescriptor.ts │ │ │ ├── ProtoDescriptor │ │ │ │ ├── AbstractProtoDescriptor.ts │ │ │ │ └── ClassProtoDescriptor.ts │ │ │ ├── ProtoDescriptorHelper.ts │ │ │ └── graph │ │ │ │ ├── GlobalGraph.ts │ │ │ │ ├── GlobalModuleNode.ts │ │ │ │ ├── GlobalModuleNodeBuilder.ts │ │ │ │ ├── ProtoNode.ts │ │ │ │ └── ProtoSelector.ts │ │ └── util │ │ │ └── ClassUtil.ts │ ├── test │ │ ├── AppGraph.test.ts │ │ ├── GlobalGraph.test.ts │ │ ├── LoadUnit.test.ts │ │ ├── ModuleGraph.test.ts │ │ └── fixtures │ │ │ ├── LoaderUtil.ts │ │ │ ├── TestLoader.ts │ │ │ └── modules │ │ │ ├── app-graph-modules │ │ │ ├── root │ │ │ │ ├── Root.ts │ │ │ │ ├── RootConstructor.ts │ │ │ │ └── package.json │ │ │ ├── unused │ │ │ │ ├── Unused.ts │ │ │ │ └── package.json │ │ │ └── used │ │ │ │ ├── Used.ts │ │ │ │ └── package.json │ │ │ ├── app-multi-inject-multi │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ ├── app │ │ │ │ │ ├── App.ts │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ │ ├── app2 │ │ │ │ │ ├── App.ts │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ │ ├── bar │ │ │ │ │ ├── BizManager.ts │ │ │ │ │ └── package.json │ │ │ │ │ └── foo │ │ │ │ │ ├── Secret.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── extends-constructor-module │ │ │ ├── Base.ts │ │ │ └── package.json │ │ │ ├── extends-module │ │ │ ├── Base.ts │ │ │ └── package.json │ │ │ ├── incompatible-proto-inject │ │ │ ├── package.json │ │ │ └── test.ts │ │ │ ├── invalid-multimodule │ │ │ ├── invalidService.ts │ │ │ ├── invalidService2.ts │ │ │ ├── package.json │ │ │ └── test.ts │ │ │ ├── invalidate-module │ │ │ ├── InvalidateService.ts │ │ │ └── package.json │ │ │ ├── load-unit │ │ │ ├── AppRepo.ts │ │ │ ├── SprintRepo.ts │ │ │ ├── UserRepo.ts │ │ │ └── package.json │ │ │ ├── multi-callback-instance-module │ │ │ ├── MultiInstance.ts │ │ │ ├── module.yml │ │ │ └── package.json │ │ │ ├── multi-instance-module │ │ │ ├── MultiInstance.ts │ │ │ └── package.json │ │ │ ├── optional-inject-module │ │ │ ├── OptionalInjectService.ts │ │ │ └── package.json │ │ │ ├── recursive-load-unit │ │ │ ├── AppRepo.ts │ │ │ ├── SprintRepo.ts │ │ │ ├── UserRepo.ts │ │ │ └── package.json │ │ │ └── same-name-object │ │ │ ├── AppCache.ts │ │ │ ├── ContextAppCache.ts │ │ │ ├── CountService.ts │ │ │ ├── SingletonAppCache.ts │ │ │ └── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── orm-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── builder │ │ │ ├── AttributeMetaBuilder.ts │ │ │ ├── IndexMetaBuilder.ts │ │ │ └── ModelMetaBuilder.ts │ │ ├── decorator │ │ │ ├── Attribute.ts │ │ │ ├── DataSource.ts │ │ │ ├── Index.ts │ │ │ └── Model.ts │ │ ├── model │ │ │ ├── AttributeMeta.ts │ │ │ ├── IndexMeta.ts │ │ │ └── ModelMetadata.ts │ │ └── util │ │ │ ├── ModelInfoUtil.ts │ │ │ ├── ModelMetadataUtil.ts │ │ │ └── NameUtil.ts │ ├── test │ │ ├── builder │ │ │ ├── AttributeMetaBuilder.test.ts │ │ │ ├── IndexMetaBuilder.test.ts │ │ │ └── ModelMetaBuilder.test.ts │ │ ├── decorator.test.ts │ │ └── fixtures │ │ │ ├── AttributeModel.ts │ │ │ ├── DefaultAttributeModel.ts │ │ │ ├── DefaultIndexModel.ts │ │ │ ├── Foo.ts │ │ │ ├── IndexModel.ts │ │ │ └── InvalidateIndexModel.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── runtime │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── factory │ │ │ ├── EggContainerFactory.ts │ │ │ ├── EggObjectFactory.ts │ │ │ └── LoadUnitInstanceFactory.ts │ │ ├── impl │ │ │ ├── ContextInitiator.ts │ │ │ ├── ContextObjectGraph.ts │ │ │ ├── EggAlwaysNewObjectContainer.ts │ │ │ ├── EggObjectImpl.ts │ │ │ ├── EggObjectUtil.ts │ │ │ └── ModuleLoadUnitInstance.ts │ │ └── model │ │ │ ├── AbstractEggContext.ts │ │ │ ├── ContextHandler.ts │ │ │ ├── EggContext.ts │ │ │ ├── EggObject.ts │ │ │ └── LoadUnitInstance.ts │ ├── test │ │ ├── EggObject.test.ts │ │ ├── EggObjectUtil.test.ts │ │ ├── LoadUnitInstance.test.ts │ │ ├── QualifierLoadUnitInstance.test.ts │ │ ├── fixtures │ │ │ ├── EggContextStorage.ts │ │ │ ├── EggTestContext.ts │ │ │ └── modules │ │ │ │ ├── extends-module │ │ │ │ ├── Base.ts │ │ │ │ └── package.json │ │ │ │ ├── init-type-qualifier-module │ │ │ │ ├── Cache.ts │ │ │ │ ├── CacheService.ts │ │ │ │ ├── ContextCache.ts │ │ │ │ ├── SingletonCache.ts │ │ │ │ └── package.json │ │ │ │ ├── inject-constructor-context-to-singleton │ │ │ │ ├── object.ts │ │ │ │ └── package.json │ │ │ │ ├── inject-context-to-singleton │ │ │ │ ├── object.ts │ │ │ │ └── package.json │ │ │ │ ├── lifecycle-hook │ │ │ │ ├── object.ts │ │ │ │ └── package.json │ │ │ │ ├── module-for-load-unit-instance │ │ │ │ ├── AppCache.ts │ │ │ │ ├── CountController.ts │ │ │ │ ├── CountService.ts │ │ │ │ ├── TempObj.ts │ │ │ │ └── package.json │ │ │ │ ├── multi-instance-module │ │ │ │ ├── MultiInstance.ts │ │ │ │ ├── MultiInstanceConstructor.ts │ │ │ │ └── package.json │ │ │ │ └── multi-module │ │ │ │ ├── multi-module-common │ │ │ │ ├── model │ │ │ │ │ └── App.ts │ │ │ │ └── package.json │ │ │ │ ├── multi-module-repo │ │ │ │ ├── AppRepo.ts │ │ │ │ ├── PersistenceService.ts │ │ │ │ └── package.json │ │ │ │ └── multi-module-service │ │ │ │ ├── AppService.ts │ │ │ │ └── package.json │ │ └── util.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── schedule-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── builder │ │ │ └── ScheduleMetaBuilder.ts │ │ ├── decorator │ │ │ └── Schedule.ts │ │ ├── model │ │ │ └── ScheduleMetadata.ts │ │ └── util │ │ │ ├── ScheduleInfoUtil.ts │ │ │ └── ScheduleMetadataUtil.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── standalone-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── decorator │ │ │ └── Runner.ts │ │ ├── typing.ts │ │ └── util │ │ │ └── StandaloneUtil.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── tegg │ ├── CHANGELOG.md │ ├── README.md │ ├── ajv.ts │ ├── aop.ts │ ├── dal.ts │ ├── helper.ts │ ├── index.ts │ ├── orm.ts │ ├── package.json │ ├── schedule.ts │ ├── standalone.ts │ ├── test │ │ ├── helper.test.ts │ │ └── index.test.ts │ ├── transaction.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── test-util │ ├── CHANGELOG.md │ ├── CoreTestHelper.ts │ ├── EggTestContext.ts │ ├── LoaderUtil.ts │ ├── TestLoader.ts │ ├── index.ts │ ├── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── transaction-decorator │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ │ ├── builder │ │ │ └── TransactionMetaBuilder.ts │ │ ├── decorator │ │ │ └── Transactional.ts │ │ └── util │ │ │ └── TransactionMetadataUtil.ts │ ├── test │ │ ├── builder │ │ │ └── TransactionMetaBuilder.test.ts │ │ └── fixtures │ │ │ └── transaction.ts │ ├── tsconfig.json │ └── tsconfig.pub.json └── types │ ├── CHANGELOG.md │ ├── README.md │ ├── aop │ ├── Advice.ts │ ├── Aspect.ts │ ├── Crosscut.ts │ ├── Pointcut.ts │ └── index.ts │ ├── common │ ├── Graph.ts │ ├── Logger.ts │ ├── ModuleConfig.ts │ ├── RuntimeConfig.ts │ └── index.ts │ ├── controller-decorator │ ├── HTTPController.ts │ ├── HTTPMethod.ts │ ├── HTTPParam.ts │ ├── MCPController.ts │ ├── MCPPromptParams.ts │ ├── MCPResourceParams.ts │ ├── MCPToolParams.ts │ ├── MetadataKey.ts │ ├── builder.ts │ ├── index.ts │ └── model │ │ ├── ControllerMetadata.ts │ │ ├── MethodMeta.ts │ │ └── types.ts │ ├── core-decorator │ ├── ContextProto.ts │ ├── Inject.ts │ ├── Metadata.ts │ ├── MultiInstanceProto.ts │ ├── Prototype.ts │ ├── SingletonProto.ts │ ├── enum │ │ ├── AccessLevel.ts │ │ ├── EggType.ts │ │ ├── InjectType.ts │ │ ├── MultiInstanceType.ts │ │ ├── ObjectInitType.ts │ │ └── Qualifier.ts │ ├── index.ts │ └── model │ │ ├── EggMultiInstancePrototypeInfo.ts │ │ ├── EggPrototypeInfo.ts │ │ ├── InjectConstructorInfo.ts │ │ ├── InjectObjectInfo.ts │ │ └── QualifierInfo.ts │ ├── dal │ ├── Qualifier.ts │ ├── decorator │ │ ├── Column.ts │ │ ├── DataSourceQualifier.ts │ │ ├── Index.ts │ │ └── Table.ts │ ├── enum │ │ ├── ColumnFormat.ts │ │ ├── ColumnType.ts │ │ ├── CompressionType.ts │ │ ├── IndexStoreType.ts │ │ ├── IndexType.ts │ │ ├── InsertMethod.ts │ │ ├── RowFormat.ts │ │ ├── SqlType.ts │ │ └── Templates.ts │ ├── index.ts │ └── type │ │ ├── BaseDao.ts │ │ ├── CodeGenerator.ts │ │ ├── ColumnTsType.ts │ │ ├── DateSource.ts │ │ ├── Spatial.ts │ │ └── SqlMap.ts │ ├── dynamic-inject.ts │ ├── index.ts │ ├── lifecycle │ ├── EggObjectLifecycle.ts │ ├── IdenticalObject.ts │ ├── LifecycleHook.ts │ └── index.ts │ ├── metadata │ ├── enum │ │ └── ProtoDescriptorType.ts │ ├── errors.ts │ ├── index.ts │ └── model │ │ ├── EggPrototype.ts │ │ ├── LoadUnit.ts │ │ ├── Loader.ts │ │ └── ProtoDescriptor.ts │ ├── orm.ts │ ├── package.json │ ├── runtime │ ├── Factory.ts │ ├── index.ts │ └── model │ │ ├── EggContainer.ts │ │ ├── EggContext.ts │ │ ├── EggObject.ts │ │ └── LoadUnitInstance.ts │ ├── schedule.ts │ ├── transaction.ts │ ├── tsconfig.json │ └── tsconfig.pub.json ├── lerna.json ├── package.json ├── plugin ├── ajv │ ├── CHANGELOG.md │ ├── README.md │ ├── lib │ │ └── Ajv.ts │ ├── package.json │ ├── test │ │ ├── ajv.test.ts │ │ └── fixtures │ │ │ └── apps │ │ │ └── ajv-app │ │ │ ├── config │ │ │ ├── config.default.js │ │ │ ├── module.json │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ └── demo │ │ │ │ ├── FooController.ts │ │ │ │ ├── module.yml │ │ │ │ └── package.json │ │ │ └── package.json │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── aop │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── lib │ │ └── AopContextHook.ts │ ├── package.json │ ├── test │ │ ├── aop.test.ts │ │ └── fixtures │ │ │ └── apps │ │ │ └── aop-app │ │ │ ├── app │ │ │ ├── controller │ │ │ │ └── app.ts │ │ │ ├── router.ts │ │ │ └── typings │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ ├── config.default.js │ │ │ ├── module.json │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ └── aop-module │ │ │ │ ├── Hello.ts │ │ │ │ └── package.json │ │ │ └── package.json │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── common │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── tsconfig.json │ └── tsconfig.pub.json ├── config │ ├── CHANGELOG.md │ ├── README.md │ ├── agent.ts │ ├── app.ts │ ├── lib │ │ └── ModuleScanner.ts │ ├── package.json │ ├── test │ │ ├── DuplicateOptionalModule.test.ts │ │ ├── ReadModule.test.ts │ │ └── fixtures │ │ │ └── apps │ │ │ ├── app-with-modules │ │ │ ├── app │ │ │ │ └── module-a │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ └── config.default.ts │ │ │ └── package.json │ │ │ └── duplicate-optional-module │ │ │ ├── config │ │ │ ├── config.default.js │ │ │ └── plugin.js │ │ │ ├── node_modules │ │ │ ├── foo │ │ │ │ └── package.json │ │ │ ├── unused │ │ │ │ ├── Unused.js │ │ │ │ └── package.json │ │ │ └── used │ │ │ │ ├── Used.js │ │ │ │ └── package.json │ │ │ └── package.json │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── controller │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── app │ │ └── middleware │ │ │ ├── mcp_body_middleware.ts │ │ │ └── tegg_root_proto.ts │ ├── config │ │ └── config.default.ts │ ├── lib │ │ ├── AppLoadUnitControllerHook.ts │ │ ├── ControllerLoadUnit.ts │ │ ├── ControllerLoadUnitHandler.ts │ │ ├── ControllerLoadUnitInstance.ts │ │ ├── ControllerMetadataManager.ts │ │ ├── ControllerRegister.ts │ │ ├── ControllerRegisterFactory.ts │ │ ├── EggControllerLoader.ts │ │ ├── EggControllerPrototypeHook.ts │ │ ├── RootProtoManager.ts │ │ ├── errors.ts │ │ └── impl │ │ │ ├── http │ │ │ ├── Acl.ts │ │ │ ├── HTTPControllerRegister.ts │ │ │ ├── HTTPMethodRegister.ts │ │ │ └── Req.ts │ │ │ └── mcp │ │ │ ├── MCPConfig.ts │ │ │ ├── MCPControllerRegister.ts │ │ │ └── MCPServerHelper.ts │ ├── package.json │ ├── test │ │ ├── fixtures │ │ │ └── apps │ │ │ │ ├── acl-app │ │ │ │ ├── app │ │ │ │ │ ├── controller │ │ │ │ │ │ └── AclController.ts │ │ │ │ │ └── extend │ │ │ │ │ │ └── context.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── controller-app │ │ │ │ ├── app │ │ │ │ │ ├── controller │ │ │ │ │ │ ├── AopMiddlewareController.ts │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ ├── MiddlewareController.ts │ │ │ │ │ │ ├── ParamController.ts │ │ │ │ │ │ ├── PriorityController.ts │ │ │ │ │ │ ├── RedirectController.ts │ │ │ │ │ │ ├── TimeoutController.ts │ │ │ │ │ │ └── ViewController.ts │ │ │ │ │ └── middleware │ │ │ │ │ │ ├── call_module.ts │ │ │ │ │ │ ├── count_mw.ts │ │ │ │ │ │ └── log_mw.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ ├── module.json │ │ │ │ │ └── plugin.js │ │ │ │ ├── modules │ │ │ │ │ ├── multi-module-common │ │ │ │ │ │ ├── advice │ │ │ │ │ │ │ ├── BarMethodAdvice.ts │ │ │ │ │ │ │ ├── CountAdvice.ts │ │ │ │ │ │ │ ├── FooControllerAdvice.ts │ │ │ │ │ │ │ └── FooMethodAdvice.ts │ │ │ │ │ │ ├── model │ │ │ │ │ │ │ └── App.ts │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── multi-module-repo │ │ │ │ │ │ ├── AppRepo.ts │ │ │ │ │ │ ├── PersistenceService.ts │ │ │ │ │ │ └── package.json │ │ │ │ │ └── multi-module-service │ │ │ │ │ │ ├── AppService.ts │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ │ ├── duplicate-controller-name-app │ │ │ │ ├── app │ │ │ │ │ └── controller │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ └── AppController2.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── duplicate-proto-name-app │ │ │ │ ├── app │ │ │ │ │ └── controller │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ └── AppController2.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── host-controller-app │ │ │ │ ├── app │ │ │ │ │ └── controller │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ ├── AppController2.ts │ │ │ │ │ │ ├── MultiHostController.ts │ │ │ │ │ │ └── MultiMethodHostController.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── http-conflict-app │ │ │ │ ├── app │ │ │ │ │ └── controller │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ ├── HostController1.ts │ │ │ │ │ │ └── HostController2.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── http-inject-app │ │ │ │ ├── app │ │ │ │ │ ├── controller │ │ │ │ │ │ └── AppController.ts │ │ │ │ │ └── middleware │ │ │ │ │ │ ├── call_module.ts │ │ │ │ │ │ ├── count_mw.ts │ │ │ │ │ │ └── log_mw.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ ├── module.json │ │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ │ │ ├── mcp-app │ │ │ │ ├── app │ │ │ │ │ └── controller │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ └── McpController.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ └── plugin.js │ │ │ │ ├── hook-plugin │ │ │ │ │ ├── app.ts │ │ │ │ │ ├── lib │ │ │ │ │ │ └── MCPControllerHook.ts │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ │ ├── module-app │ │ │ │ ├── app │ │ │ │ │ ├── controller │ │ │ │ │ │ └── AppController2.ts │ │ │ │ │ └── router.ts │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ ├── module.json │ │ │ │ │ └── plugin.js │ │ │ │ ├── modules │ │ │ │ │ ├── foo-module │ │ │ │ │ │ ├── AppService.ts │ │ │ │ │ │ └── package.json │ │ │ │ │ └── http-module │ │ │ │ │ │ ├── AppController.ts │ │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ │ └── proto-poisoning │ │ │ │ ├── app │ │ │ │ └── controller │ │ │ │ │ └── HelloController.ts │ │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ ├── http │ │ │ ├── acl.test.ts │ │ │ ├── decorator.test.ts │ │ │ ├── edgecase.test.ts │ │ │ ├── host.test.ts │ │ │ ├── middleware.test.ts │ │ │ ├── module.test.ts │ │ │ ├── params.test.ts │ │ │ ├── priority.test.ts │ │ │ ├── proto-poisoning.test.ts │ │ │ └── request.test.ts │ │ ├── lib │ │ │ ├── ControllerMetaManager.test.ts │ │ │ ├── EggControllerLoader.test.ts │ │ │ └── HTTPMethodRegister.test.ts │ │ └── mcp │ │ │ ├── helper.test.ts │ │ │ ├── mcp.test.ts │ │ │ └── mcpCluster.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── dal │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── lib │ │ ├── DalModuleLoadUnitHook.ts │ │ ├── DalTableEggPrototypeHook.ts │ │ ├── DataSource.ts │ │ ├── MysqlDataSourceManager.ts │ │ ├── SqlMapManager.ts │ │ ├── TableModelManager.ts │ │ ├── TransactionPrototypeHook.ts │ │ └── TransactionalAOP.ts │ ├── package.json │ ├── test │ │ ├── dal.test.ts │ │ ├── fixtures │ │ │ └── apps │ │ │ │ └── dal-app │ │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ │ ├── modules │ │ │ │ └── dal │ │ │ │ │ ├── Foo.ts │ │ │ │ │ ├── FooService.ts │ │ │ │ │ ├── dal │ │ │ │ │ ├── dao │ │ │ │ │ │ ├── FooDAO.ts │ │ │ │ │ │ └── base │ │ │ │ │ │ │ └── BaseFooDAO.ts │ │ │ │ │ ├── extension │ │ │ │ │ │ └── FooExtension.ts │ │ │ │ │ └── structure │ │ │ │ │ │ ├── Foo.json │ │ │ │ │ │ └── Foo.sql │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ └── transaction.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── eventbus │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── app │ │ └── extend │ │ │ ├── application.unittest.ts │ │ │ └── context.ts │ ├── lib │ │ ├── EggContextEventBus.ts │ │ ├── EggEventContext.ts │ │ ├── EventHandlerProtoManager.ts │ │ ├── EventbusLoadUnitHook.ts │ │ └── EventbusProtoHook.ts │ ├── package.json │ ├── test │ │ ├── eventbus.test.ts │ │ └── fixtures │ │ │ └── apps │ │ │ └── event-app │ │ │ ├── app │ │ │ └── event-module │ │ │ │ ├── HelloLogger.ts │ │ │ │ ├── HelloService.ts │ │ │ │ ├── MultiEventHandler.ts │ │ │ │ └── package.json │ │ │ ├── config │ │ │ ├── config.default.js │ │ │ └── plugin.js │ │ │ └── package.json │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── mcp-proxy │ ├── CHANGELOG.md │ ├── README.md │ ├── agent.ts │ ├── app.ts │ ├── app │ │ └── extend │ │ │ ├── agent.ts │ │ │ └── application.ts │ ├── config │ │ └── config.default.ts │ ├── index.ts │ ├── lib │ │ └── MCPProxyDataClient.ts │ ├── package.json │ ├── test │ │ ├── fixtures │ │ │ └── apps │ │ │ │ └── mcp-proxy │ │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ └── router.ts │ │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ └── proxy.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ ├── types.ts │ └── typings │ │ └── index.d.ts ├── orm │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── lib │ │ ├── DataSourceManager.ts │ │ ├── LeoricRegister.ts │ │ ├── ModelProtoHook.ts │ │ ├── ModelProtoManager.ts │ │ ├── ORMLoadUnitHook.ts │ │ ├── SingletonModelObject.ts │ │ ├── SingletonModelProto.ts │ │ └── SingletonORM.ts │ ├── package.json │ ├── test │ │ ├── fixtures │ │ │ ├── apps │ │ │ │ └── orm-app │ │ │ │ │ ├── app.ts │ │ │ │ │ ├── config │ │ │ │ │ ├── config.default.js │ │ │ │ │ ├── module.json │ │ │ │ │ └── plugin.js │ │ │ │ │ ├── modules │ │ │ │ │ └── orm-module │ │ │ │ │ │ ├── AppService.ts │ │ │ │ │ │ ├── CtxService.ts │ │ │ │ │ │ ├── PkgService.ts │ │ │ │ │ │ ├── model │ │ │ │ │ │ ├── App.ts │ │ │ │ │ │ └── Pkg.ts │ │ │ │ │ │ └── package.json │ │ │ │ │ └── package.json │ │ │ └── prepare.js │ │ └── index.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts ├── schedule │ ├── CHANGELOG.md │ ├── README.md │ ├── agent.ts │ ├── app.ts │ ├── lib │ │ ├── EggScheduleAdapter.ts │ │ ├── EggScheduleMetadataConvertor.ts │ │ ├── SchedulePrototypeHook.ts │ │ ├── ScheduleSubscriberRegister.ts │ │ ├── ScheduleWorkerLoadUnitHook.ts │ │ └── ScheduleWorkerRegister.ts │ ├── package.json │ ├── test │ │ ├── fixtures │ │ │ └── schedule-app │ │ │ │ ├── app │ │ │ │ └── subscriber │ │ │ │ │ ├── Subscriber.ts │ │ │ │ │ └── package.json │ │ │ │ ├── config │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ │ └── package.json │ │ └── schedule.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ │ └── index.d.ts └── tegg │ ├── CHANGELOG.md │ ├── README.md │ ├── app.ts │ ├── app │ ├── extend │ │ ├── application.ts │ │ ├── application.unittest.ts │ │ └── context.ts │ └── middleware │ │ └── tegg_ctx_lifecycle_middleware.ts │ ├── lib │ ├── AppLoadUnit.ts │ ├── AppLoadUnitInstance.ts │ ├── CompatibleUtil.ts │ ├── ConfigSourceLoadUnitHook.ts │ ├── EggAppLoader.ts │ ├── EggCompatibleObject.ts │ ├── EggCompatibleProtoImpl.ts │ ├── EggContextCompatibleHook.ts │ ├── EggContextHandler.ts │ ├── EggContextImpl.ts │ ├── EggModuleLoader.ts │ ├── EggQualifierProtoHook.ts │ ├── ModuleConfigLoader.ts │ ├── ModuleHandler.ts │ ├── Utils.ts │ ├── ctx_lifecycle_middleware.ts │ └── run_in_background.ts │ ├── package.json │ ├── test │ ├── AccessLevelCheck.test.ts │ ├── BackgroundTask.test.ts │ ├── ConstructorModuleConfig.test.ts │ ├── DynamicInject.test.ts │ ├── EggCompatible.test.ts │ ├── Inject.test.ts │ ├── ModuleConfig.test.ts │ ├── MultiInstanceInjectMultiInstance.test.ts │ ├── NoModuleJson.test.ts │ ├── OptionalModule.test.ts │ ├── OptionalPluginModule.test.ts │ ├── SameProtoName.test.ts │ ├── Subscription.test.ts │ ├── app │ │ └── extend │ │ │ ├── application.test.ts │ │ │ ├── application.unittest.test.ts │ │ │ └── context.test.ts │ ├── close.test.ts │ ├── fixtures │ │ └── apps │ │ │ ├── access-level-check │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ └── router.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ ├── module-a │ │ │ │ │ ├── BarService.ts │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ │ ├── module-main │ │ │ │ │ ├── BarService.ts │ │ │ │ │ ├── FooService.ts │ │ │ │ │ ├── MainService.ts │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ └── typings │ │ │ │ └── index.d.ts │ │ │ ├── app-multi-inject-multi │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ ├── app │ │ │ │ │ ├── App.ts │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ │ ├── app2 │ │ │ │ │ ├── App.ts │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ │ ├── bar │ │ │ │ │ ├── BizManager.ts │ │ │ │ │ └── package.json │ │ │ │ │ └── foo │ │ │ │ │ ├── Secret.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ │ ├── app-with-no-module-json │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── extend │ │ │ │ │ ├── application.unittest.ts │ │ │ │ │ └── context.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ └── config-module │ │ │ │ │ ├── ConfigService.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── background-app │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ └── multi-module-background │ │ │ │ │ ├── BackgroundService.ts │ │ │ │ │ ├── CountService.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── constructor-module-config │ │ │ ├── app.ts │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── extend │ │ │ │ │ ├── application.unittest.ts │ │ │ │ │ └── context.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ └── module-with-config │ │ │ │ │ ├── foo.ts │ │ │ │ │ ├── module.unittest.yml │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── dynamic-inject-app │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ └── dynamic-inject-module │ │ │ │ │ ├── AbstractContextHello.ts │ │ │ │ │ ├── AbstractSingletonHello.ts │ │ │ │ │ ├── FooType.ts │ │ │ │ │ ├── HelloService.ts │ │ │ │ │ ├── SingletonHelloService.ts │ │ │ │ │ ├── decorator │ │ │ │ │ ├── ContextHello.ts │ │ │ │ │ └── SingletonHello.ts │ │ │ │ │ ├── impl │ │ │ │ │ ├── BarContextHello.ts │ │ │ │ │ ├── BarSingletonHello.ts │ │ │ │ │ ├── FooContextHello.ts │ │ │ │ │ └── FooSingletonHello.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── egg-app │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── extend │ │ │ │ │ ├── application.ts │ │ │ │ │ ├── application.unittest.ts │ │ │ │ │ └── context.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ ├── multi-module-common │ │ │ │ │ ├── model │ │ │ │ │ │ └── App.ts │ │ │ │ │ └── package.json │ │ │ │ ├── multi-module-repo │ │ │ │ │ ├── AppRepo.ts │ │ │ │ │ ├── GlobalAppRepo.ts │ │ │ │ │ ├── PersistenceService.ts │ │ │ │ │ └── package.json │ │ │ │ └── multi-module-service │ │ │ │ │ ├── AppService.ts │ │ │ │ │ ├── ConfigService.ts │ │ │ │ │ ├── CustomLoggerService.ts │ │ │ │ │ ├── EggTypeService.ts │ │ │ │ │ ├── SingletonFooService.ts │ │ │ │ │ ├── TraceService.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── inject-module-config │ │ │ ├── app.ts │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ ├── extend │ │ │ │ │ ├── application.unittest.ts │ │ │ │ │ └── context.ts │ │ │ │ ├── router.ts │ │ │ │ └── typings │ │ │ │ │ └── index.d.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ ├── module-with-config │ │ │ │ │ ├── foo.ts │ │ │ │ │ ├── module.unittest.yml │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ │ └── module-with-overwrite-config │ │ │ │ │ ├── bar.ts │ │ │ │ │ ├── module.unittest.yml │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── invalid-inject │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ └── module-a │ │ │ │ │ ├── BarService.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ │ ├── optional-inject │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ └── module-a │ │ │ │ │ ├── BarService.ts │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ │ ├── optional-module │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ └── root │ │ │ │ │ ├── Root.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── node_modules │ │ │ │ ├── foo │ │ │ │ │ └── package.json │ │ │ │ ├── unused │ │ │ │ │ ├── Unused.js │ │ │ │ │ └── package.json │ │ │ │ └── used │ │ │ │ │ ├── Used.js │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── plugin-module │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── node_modules │ │ │ │ ├── foo-plugin │ │ │ │ │ ├── Used.js │ │ │ │ │ └── package.json │ │ │ │ └── foo │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── recursive-module-app │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── app.ts │ │ │ │ └── router.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ ├── multi-module-repo │ │ │ │ │ ├── AppRepo.ts │ │ │ │ │ └── package.json │ │ │ │ └── multi-module-service │ │ │ │ │ ├── AppService.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── same-name-protos │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ ├── module-a │ │ │ │ │ ├── BarService.ts │ │ │ │ │ └── package.json │ │ │ │ │ ├── module-bar │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ │ │ └── module-foo │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ │ ├── same-name-singleton-and-context-proto │ │ │ ├── app │ │ │ │ └── modules │ │ │ │ │ ├── module-bar │ │ │ │ │ ├── BarConstructorService1.ts │ │ │ │ │ ├── BarConstructorService2.ts │ │ │ │ │ ├── BarService1.ts │ │ │ │ │ ├── BarService2.ts │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ │ │ └── module-foo │ │ │ │ │ ├── FooService.ts │ │ │ │ │ └── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ │ ├── schedule-app │ │ │ ├── app │ │ │ │ └── schedule │ │ │ │ │ └── foo.ts │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ ├── module.json │ │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ │ ├── multi-module-repo │ │ │ │ │ ├── AppRepo.ts │ │ │ │ │ └── package.json │ │ │ │ └── multi-module-service │ │ │ │ │ ├── AppService.ts │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ └── wrong-order-app │ │ │ ├── app │ │ │ ├── controller │ │ │ │ └── app.ts │ │ │ └── router.ts │ │ │ ├── config │ │ │ ├── config.default.js │ │ │ ├── module.json │ │ │ └── plugin.js │ │ │ ├── modules │ │ │ ├── multi-module-repo │ │ │ │ ├── AppRepo.ts │ │ │ │ └── package.json │ │ │ └── multi-module-service │ │ │ │ ├── AppService.ts │ │ │ │ └── package.json │ │ │ └── package.json │ └── lib │ │ └── EggModuleLoader.test.ts │ ├── tsconfig.json │ ├── tsconfig.pub.json │ └── typings │ └── index.d.ts ├── standalone └── standalone │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── src │ ├── ConfigSourceLoadUnitHook.ts │ ├── EggModuleLoader.ts │ ├── ModuleConfig.ts │ ├── Runner.ts │ ├── StandaloneContext.ts │ ├── StandaloneContextHandler.ts │ ├── StandaloneContextImpl.ts │ ├── StandaloneInnerObject.ts │ ├── StandaloneInnerObjectProto.ts │ ├── StandaloneLoadUnit.ts │ └── main.ts │ ├── test │ ├── fixtures │ │ ├── ajv-module-pass │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── ajv-module │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── aop-module │ │ │ ├── Hello.ts │ │ │ ├── main.ts │ │ │ └── package.json │ │ ├── custom-context │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── dal-module │ │ │ ├── module.yml │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── Foo.ts │ │ │ │ ├── dal │ │ │ │ │ ├── dao │ │ │ │ │ │ ├── FooDAO.ts │ │ │ │ │ │ └── base │ │ │ │ │ │ │ └── BaseFooDAO.ts │ │ │ │ │ ├── extension │ │ │ │ │ │ └── FooExtension.ts │ │ │ │ │ └── structure │ │ │ │ │ │ ├── Foo.json │ │ │ │ │ │ └── Foo.sql │ │ │ │ └── main.ts │ │ │ └── tsconfig.json │ │ ├── dal-transaction-module │ │ │ ├── module.yml │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── Foo.ts │ │ │ │ ├── FooService.ts │ │ │ │ ├── dal │ │ │ │ │ ├── dao │ │ │ │ │ │ ├── FooDAO.ts │ │ │ │ │ │ └── base │ │ │ │ │ │ │ └── BaseFooDAO.ts │ │ │ │ │ ├── extension │ │ │ │ │ │ └── FooExtension.ts │ │ │ │ │ └── structure │ │ │ │ │ │ ├── Foo.json │ │ │ │ │ │ └── Foo.sql │ │ │ │ └── main.ts │ │ │ └── tsconfig.json │ │ ├── dependency │ │ │ ├── foo.ts │ │ │ ├── node_modules │ │ │ │ ├── dependency-1 │ │ │ │ │ └── package.json │ │ │ │ └── dependency-2 │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── module.yml │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ ├── dynamic-inject-module │ │ │ ├── AbstractContextHello.ts │ │ │ ├── AbstractSingletonHello.ts │ │ │ ├── FooType.ts │ │ │ ├── HelloService.ts │ │ │ ├── decorator │ │ │ │ ├── ContextHello.ts │ │ │ │ └── SingletonHello.ts │ │ │ ├── impl │ │ │ │ ├── BarContextHello.ts │ │ │ │ ├── BarSingletonHello.ts │ │ │ │ ├── FooContextHello.ts │ │ │ │ └── FooSingletonHello.ts │ │ │ ├── main.ts │ │ │ └── package.json │ │ ├── inner-object │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── invalid-inject │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── lifecycle │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── module-with-config │ │ │ ├── foo.ts │ │ │ ├── module.yml │ │ │ └── package.json │ │ ├── module-with-empty-config │ │ │ ├── foo.ts │ │ │ ├── module.yml │ │ │ └── package.json │ │ ├── module-with-empty-default-config │ │ │ ├── foo.ts │ │ │ ├── module.dev.yml │ │ │ ├── module.yml │ │ │ └── package.json │ │ ├── module-with-env-config │ │ │ ├── foo.ts │ │ │ ├── module.dev.yml │ │ │ ├── module.yml │ │ │ └── package.json │ │ ├── multi-callback-instance-module │ │ │ ├── biz │ │ │ │ ├── biz.ts │ │ │ │ ├── module.yml │ │ │ │ └── package.json │ │ │ ├── logger │ │ │ │ ├── DynamicLogger.ts │ │ │ │ └── package.json │ │ │ └── main │ │ │ │ ├── foo.ts │ │ │ │ ├── module.yml │ │ │ │ └── package.json │ │ ├── multi-modules │ │ │ ├── bar │ │ │ │ ├── module.yml │ │ │ │ └── package.json │ │ │ └── foo │ │ │ │ ├── foo.ts │ │ │ │ ├── module.yml │ │ │ │ └── package.json │ │ ├── optional-inject │ │ │ ├── bar.ts │ │ │ ├── foo.ts │ │ │ └── package.json │ │ ├── runtime-config │ │ │ ├── foo.ts │ │ │ └── package.json │ │ └── simple │ │ │ ├── foo.ts │ │ │ └── package.json │ └── index.test.ts │ ├── tsconfig.json │ └── tsconfig.pub.json └── tsconfig.json /.mocharc.yml: -------------------------------------------------------------------------------- 1 | timeout: "120000" 2 | spec: 3 | - test/**/*.test.ts 4 | recursive: true 5 | extension: 6 | - ts 7 | require: 8 | - ts-node/register 9 | - source-map-support/register 10 | full-trace: true 11 | exit: true 12 | -------------------------------------------------------------------------------- /benchmark/http/app/controller/FooTeggController.ts: -------------------------------------------------------------------------------- 1 | import { HTTPController, HTTPMethod, HTTPMethodEnum } from '@eggjs/tegg'; 2 | 3 | @HTTPController() 4 | export default class FooTeggController { 5 | @HTTPMethod({ 6 | method: HTTPMethodEnum.GET, 7 | path: '/hello', 8 | }) 9 | async hello() { 10 | return 'hello, tegg'; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /benchmark/http/app/controller/template/egg_controller_1.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Controller } = require('egg'); 4 | 5 | module.exports = class EggController1 extends Controller { 6 | async hello() { 7 | this.ctx.body = 'hello,egg'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /benchmark/http/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (app) { 4 | const { router, controller } = app; 5 | app.get('/egg1', controller.template.eggController_1.hello); 6 | }; 7 | -------------------------------------------------------------------------------- /benchmark/http/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | keys: 'tegg_benchmark', 5 | }; 6 | -------------------------------------------------------------------------------- /benchmark/http/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | tegg: { 5 | enable: true, 6 | package: '@eggjs/tegg-plugin', 7 | }, 8 | teggController: { 9 | enable: true, 10 | package: '@eggjs/tegg-controller-plugin', 11 | }, 12 | teggConfig: { 13 | enable: true, 14 | package: '@eggjs/tegg-config', 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /benchmark/http/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@eggjs/tsconfig" 3 | } 4 | -------------------------------------------------------------------------------- /core/ajv-decorator/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/ajv-decorator` 2 | 3 | ## Usage 4 | 5 | Please read [@eggjs/tegg-ajv-plugin](../../plugin/ajv-plugin) 6 | -------------------------------------------------------------------------------- /core/ajv-decorator/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@sinclair/typebox'; 2 | export * from './src/enum/TransformEnum'; 3 | export * from './src/error/AjvInvalidParamError'; 4 | export * from './src/type/Ajv'; 5 | -------------------------------------------------------------------------------- /core/ajv-decorator/src/type/Ajv.ts: -------------------------------------------------------------------------------- 1 | import type { Schema } from 'ajv/dist/2019'; 2 | 3 | export interface Ajv { 4 | validate(schema: Schema, data: unknown): void; 5 | } 6 | -------------------------------------------------------------------------------- /core/ajv-decorator/test/TransformEnum.test.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import { TransformEnum } from '..'; 3 | 4 | describe('core/ajv-decorator/test/TransformEnum.test.ts', () => { 5 | it('should get TransformEnum', () => { 6 | assert.equal(TransformEnum.trim, 'trim'); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /core/ajv-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/ajv-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/aop-decorator/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/aop-decorator` 2 | 3 | # Usage 4 | 5 | Please read [@eggjs/tegg-aop-plugin](../../plugin/aop/README.md) 6 | -------------------------------------------------------------------------------- /core/aop-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/aop-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/aop-runtime/README.md: -------------------------------------------------------------------------------- 1 | # `aop-runtime` 2 | 3 | ## Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/aop-runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/EggPrototypeCrossCutHook'; 2 | export * from './src/EggObjectAopHook'; 3 | export * from './src/LoadUnitAopHook'; 4 | 5 | export * from './src/CrossCutGraphHook'; 6 | export * from './src/PointCutGraphHook'; 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/modules/constructor_inject_aop/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module", 3 | "eggModule": { 4 | "name": "aopModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/modules/hello_cross_cut/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-cross-cut", 3 | "eggModule": { 4 | "name": "helloCrossCut" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/modules/hello_point_cut/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-point-cut", 3 | "eggModule": { 4 | "name": "helloPointCut" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/modules/hello_succeed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module", 3 | "eggModule": { 4 | "name": "aopModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/modules/should_throw/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "throw-aop-module", 3 | "eggModule": { 4 | "name": "throwAopModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/a/A.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto } from '@eggjs/core-decorator'; 2 | import { Base } from '../c/Base'; 3 | 4 | @ContextProto() 5 | export class A extends Base { 6 | id = 233; 7 | 8 | async hello(name: string) { 9 | return `hello A ${name}`; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module-a", 3 | "eggModule": { 4 | "name": "aopModuleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/b/B.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto } from '@eggjs/core-decorator'; 2 | import { Base } from '../c/Base'; 3 | 4 | @ContextProto() 5 | export class B extends Base { 6 | id = 233; 7 | 8 | async hello(name: string) { 9 | return `hello B ${name}`; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module-b", 3 | "eggModule": { 4 | "name": "aopModuleB" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/c/Base.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto } from '@eggjs/core-decorator'; 2 | 3 | @ContextProto() 4 | export class Base { 5 | id = 233; 6 | 7 | async hello(name: string) { 8 | return `hello base ${name}`; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module-c", 3 | "eggModule": { 4 | "name": "aopModuleC" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/test/fixtures/mutli/cross/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-point-cut", 3 | "eggModule": { 4 | "name": "helloPointCut" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/aop-runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/aop-runtime/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/background-task/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/BackgroundTaskHelper'; 2 | -------------------------------------------------------------------------------- /core/background-task/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/background-task/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/common-util/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/common-util` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/common-util/src/FSUtil.ts: -------------------------------------------------------------------------------- 1 | import { promises as fs } from 'fs'; 2 | 3 | export class FSUtil { 4 | static async fileExists(filePath: string): Promise { 5 | try { 6 | await fs.access(filePath); 7 | } catch (_) { 8 | return false; 9 | } 10 | return true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/common-util/src/MapUtil.ts: -------------------------------------------------------------------------------- 1 | export class MapUtil { 2 | static getOrStore(map: Map, key: K, value: V): V { 3 | if (!map.has(key)) { 4 | map.set(key, value); 5 | } 6 | return map.get(key)!; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /core/common-util/src/ModuleConfigs.ts: -------------------------------------------------------------------------------- 1 | import type { ModuleConfig, ModuleConfigHolder } from '@eggjs/tegg-types'; 2 | 3 | export class ModuleConfigs { 4 | constructor(readonly inner: Record) { 5 | } 6 | 7 | get(moduleName: string): ModuleConfig | undefined { 8 | return this.inner[moduleName]?.config; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/common-util/src/NameUtil.ts: -------------------------------------------------------------------------------- 1 | export class NameUtil { 2 | static getClassName(constructor: Function) { 3 | return constructor.name[0].toLowerCase() + constructor.name.substring(1); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /core/common-util/src/ProxyUtil.ts: -------------------------------------------------------------------------------- 1 | export class ProxyUtil { 2 | static safeProxy(obj: T, getter: (obj: T, p: PropertyKey) => any) { 3 | return new Proxy(obj, { 4 | get(target: T, p: PropertyKey): any { 5 | if (Object.prototype[p]) { 6 | return target[p]; 7 | } 8 | return getter(target, p); 9 | }, 10 | }); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/common-util/src/StreamUtil.ts: -------------------------------------------------------------------------------- 1 | import { Stream } from 'node:stream'; 2 | 3 | export class StreamUtil { 4 | static isStream(obj: any): boolean { 5 | return obj instanceof Stream; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/common-util/test/NameUtil.test.ts: -------------------------------------------------------------------------------- 1 | import assert from 'node:assert'; 2 | import { NameUtil } from '..'; 3 | 4 | describe('test/NameUtil.test.ts', () => { 5 | it('should work', () => { 6 | class Hello {} 7 | const name = NameUtil.getClassName(Hello); 8 | assert(name === 'hello'); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-json/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-json/app/module-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-b", 3 | "eggModule": { 4 | "name": "moduleB" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-json/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "path": "../app/module-a" }, 3 | { "path": "../app/module-b" } 4 | ] 5 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-pkg-json/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "package": "module-a" } 3 | ] 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-pkg-json/node_modules/module-a/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = {}; 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-pkg-json/node_modules/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "main": "index.js", 4 | "eggModule": { 5 | "name": "moduleA" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-module-pkg-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-modules/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/.sff/.other/module-d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-d", 3 | "eggModule": { 4 | "name": "moduleD" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/.sff/module-c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-c", 3 | "eggModule": { 4 | "name": "moduleC" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/app/module-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-b", 3 | "eggModule": { 4 | "name": "moduleB" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/app/module-b/test/fixtures/module-e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-e", 3 | "eggModule": { 4 | "name": "moduleE" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/node_modules/module-b/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = {}; 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/node_modules/module-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-b", 3 | "main": "index.js", 4 | "eggModule": { 5 | "name": "moduleB" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json-duplicated/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "dependencies": { 4 | "module-b": "^1.0.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/.sff/.other/module-d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-d", 3 | "eggModule": { 4 | "name": "moduleD" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/.sff/module-c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-c", 3 | "eggModule": { 4 | "name": "moduleC" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/app/module-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-b", 3 | "eggModule": { 4 | "name": "moduleB" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/app/module-b/test/fixtures/module-e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-e", 3 | "eggModule": { 4 | "name": "moduleE" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/node_modules/dep/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = {}; 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/node_modules/dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep", 3 | "main": "index.js" 4 | } 5 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/node_modules/module-c/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = {}; 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/node_modules/module-c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-c", 3 | "main": "index.js", 4 | "eggModule": { 5 | "name": "moduleC" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-no-module-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "dependencies": { 4 | "module-c": "^1.0.0", 5 | "dep": "^1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-symlink/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/apps/app-with-symlink/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-with-symlink" 3 | } 4 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/modules/dev-module-config/module.dev.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | port: 11306 3 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/modules/dev-module-config/module.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | host: 127.0.0.1 3 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/modules/foo-yaml/module.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | host: 127.0.0.1 3 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/foo/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eggjs/tegg/62d94c77e6f9ce765ff4ab315d4fe0f9ca3d79bd/core/common-util/test/fixtures/monorepo/foo/.gitkeep -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/node_modules/a: -------------------------------------------------------------------------------- 1 | ../packages/a -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/a/node_modules/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "c" 4 | }, 5 | "dependencies": {}, 6 | "name": "c", 7 | "author": "" 8 | } -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "a" 4 | }, 5 | "dependencies": { 6 | "c": "*" 7 | }, 8 | "name": "b", 9 | "author": "" 10 | } -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "b" 4 | }, 5 | "dependencies": { 6 | "a": "*" 7 | }, 8 | "name": "b", 9 | "author": "" 10 | } 11 | -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/d/node_modules/e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "e" 4 | }, 5 | "name": "e", 6 | "exports": { 7 | "./package.json": "./package.json" 8 | }, 9 | "author": "" 10 | } -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/d/node_modules/f/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "f" 4 | }, 5 | "name": "f", 6 | "exports": { 7 | "./index.js": "./index.js" 8 | }, 9 | "author": "" 10 | } -------------------------------------------------------------------------------- /core/common-util/test/fixtures/monorepo/packages/d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggModule": { 3 | "name": "d" 4 | }, 5 | "dependencies": { 6 | "e": "*", 7 | "f": "*" 8 | }, 9 | "name": "d", 10 | "author": "" 11 | } -------------------------------------------------------------------------------- /core/common-util/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/common-util/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/controller-decorator/README.json: -------------------------------------------------------------------------------- 1 | # @eggjs/controller-decorator 2 | 3 | # Usage 4 | 5 | Please read [@eggjs/tegg-controller-plugin](../../plugin/controller/README.md) 6 | -------------------------------------------------------------------------------- /core/controller-decorator/src/model/HTTPCookies.ts: -------------------------------------------------------------------------------- 1 | import { Cookies } from '@eggjs/cookies'; 2 | export class HTTPCookies extends Cookies {} 3 | -------------------------------------------------------------------------------- /core/controller-decorator/src/model/HTTPRequest.ts: -------------------------------------------------------------------------------- 1 | import undici from 'undici'; 2 | // https://github.com/nodejs/undici/blob/main/index.js#L118 3 | // 只有 nodejs >= 16 才支持 Request 4 | export class HTTPRequest extends (undici.Request || Object) {} 5 | -------------------------------------------------------------------------------- /core/controller-decorator/src/model/HTTPResponse.ts: -------------------------------------------------------------------------------- 1 | import undici from 'undici'; 2 | // https://github.com/nodejs/undici/blob/main/index.js#L118 3 | // 只有 nodejs >= 16 才支持 Request 4 | export class HTTPResponse extends (undici.Response || Object) {} 5 | -------------------------------------------------------------------------------- /core/controller-decorator/src/model/index.ts: -------------------------------------------------------------------------------- 1 | export * from './HTTPMethodMeta'; 2 | export * from './HTTPControllerMeta'; 3 | export * from './HTTPRequest'; 4 | export * from './HTTPResponse'; 5 | export * from './HTTPCookies'; 6 | export * from './MCPControllerMeta'; 7 | export * from './MCPPromptMeta'; 8 | export * from './MCPResourceMeta'; 9 | export * from './MCPToolMeta'; 10 | -------------------------------------------------------------------------------- /core/controller-decorator/test/fixtures/ContextController.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '../../src/decorator/Context'; 2 | 3 | export class ContextController { 4 | async hello(@Context() ctx: object) { 5 | console.log('ctx:', ctx); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/controller-decorator/test/fixtures/HostController.ts: -------------------------------------------------------------------------------- 1 | import { Host } from '../../src/decorator/http/Host'; 2 | 3 | @Host('foo.eggjs.com') 4 | export class HostController { 5 | async hello(): Promise { 6 | return; 7 | } 8 | 9 | @Host('bar.eggjs.com') 10 | async bar(): Promise { 11 | return; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /core/controller-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/controller-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/core-decorator/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/core-decorator` 2 | 3 | ## Usage 4 | 5 | Please read [@eggjs/tegg-plugin](../../plugin/tegg) 6 | -------------------------------------------------------------------------------- /core/core-decorator/test/fixtures/decators/ContextCache.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel } from '@eggjs/tegg-types'; 2 | import { ContextProto } from '../../..'; 3 | import { ICache } from './ICache'; 4 | 5 | @ContextProto({ 6 | name: 'cache', 7 | accessLevel: AccessLevel.PUBLIC, 8 | }) 9 | export default class ContextCache implements ICache { 10 | } 11 | -------------------------------------------------------------------------------- /core/core-decorator/test/fixtures/decators/ICache.ts: -------------------------------------------------------------------------------- 1 | export interface ICache { 2 | } 3 | -------------------------------------------------------------------------------- /core/core-decorator/test/fixtures/decators/OtherService.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto } from '../../..'; 2 | 3 | @ContextProto() 4 | export class TestService { 5 | sayHi() { 6 | console.info('hi'); 7 | } 8 | } 9 | 10 | @ContextProto({ name: 'abcabc' }) 11 | export class TestService2 { 12 | sayHi() { 13 | console.info('hi'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/core-decorator/test/fixtures/decators/SingletonCache.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel } from '@eggjs/tegg-types'; 2 | import { SingletonProto } from '../../..'; 3 | import { ICache } from './ICache'; 4 | 5 | @SingletonProto({ 6 | name: 'cache', 7 | accessLevel: AccessLevel.PUBLIC, 8 | }) 9 | export default class SingletonCache implements ICache { 10 | } 11 | -------------------------------------------------------------------------------- /core/core-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/core-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dal-decorator/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/dal-decorator` 2 | 3 | ## Usage 4 | 5 | Please read [@eggjs/tegg-dal-plugin](../../plugin/dal-plugin) 6 | -------------------------------------------------------------------------------- /core/dal-decorator/src/decorator/Index.ts: -------------------------------------------------------------------------------- 1 | import type { EggProtoImplClass, IndexParams } from '@eggjs/tegg-types'; 2 | import { IndexInfoUtil } from '../util/IndexInfoUtil'; 3 | 4 | export function Index(params: IndexParams) { 5 | return function(constructor: EggProtoImplClass) { 6 | IndexInfoUtil.addIndex(constructor, params); 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /core/dal-decorator/src/type/MySql.ts: -------------------------------------------------------------------------------- 1 | export { InsertResult, UpdateResult, DeleteResult } from '@eggjs/rds'; 2 | -------------------------------------------------------------------------------- /core/dal-decorator/test/fixtures/modules/dal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dal-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dal-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dal-runtime/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/dal-runtime` 2 | 3 | ## Usage 4 | 5 | Please read [@eggjs/tegg-dal-plugin](../../plugin/dal-plugin) 6 | -------------------------------------------------------------------------------- /core/dal-runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/SqlGenerator'; 2 | export * from './src/CodeGenerator'; 3 | export { TableSqlMap } from './src/TableSqlMap'; 4 | export * from './src/SqlMapLoader'; 5 | 6 | export * from './src/DataSource'; 7 | export * from './src/MySqlDataSource'; 8 | export * from './src/TableModelInstanceBuilder'; 9 | export * from './src/DatabaseForker'; 10 | export * from './src/DaoLoader'; 11 | -------------------------------------------------------------------------------- /core/dal-runtime/test/SqlUtil.test.ts: -------------------------------------------------------------------------------- 1 | import { SqlUtil } from '../src/SqlUtil'; 2 | import assert from 'node:assert/strict'; 3 | 4 | it('should preserve SQL hint and remove normal comments', () => { 5 | const sql = 'SELECT /*+ INDEX(a) */ * FROM table /* this is a comment */ WHERE id = 1'; 6 | const result = SqlUtil.minify(sql); 7 | assert.strictEqual(result, 'SELECT /*+ INDEX(a) */ * FROM table WHERE id = 1'); 8 | }); 9 | -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/dal/dal/extension/FooExtension.ts: -------------------------------------------------------------------------------- 1 | import { SqlMap, SqlType } from '@eggjs/dal-decorator'; 2 | 3 | export default { 4 | findAll: { 5 | type: SqlType.SELECT, 6 | sql: 'SELECT {{ allColumns}} from egg_foo;' 7 | }, 8 | } as Record; 9 | -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/dal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/MultiPrimaryKey.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS multi_primary_key_table ( 2 | id_1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'the primary key', 3 | id_2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'the primary key', 4 | name VARCHAR(100) NOT NULL UNIQUE KEY 5 | ) COMMENT='multi primary key table'; -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/generate_codes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/generate_codes_not_overwrite_dao/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dal-runtime/test/fixtures/modules/generate_codes_to_src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dal-runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./", 6 | "target": "ES2020" 7 | }, 8 | "exclude": [ 9 | "dist", 10 | "node_modules", 11 | "test" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /core/dal-runtime/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./", 6 | "target": "ES2020" 7 | }, 8 | "exclude": [ 9 | "dist", 10 | "node_modules", 11 | "test" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/README.md: -------------------------------------------------------------------------------- 1 | # `dyniamic-inject-runtime` 2 | 3 | ## Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/EggObjectFactory'; 2 | 3 | import './src/EggObjectFactoryPrototype'; 4 | import './src/EggObjectFactoryObject'; 5 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/test/fixtures/modules/dynamic-inject-module/AbstractContextHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractContextHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/test/fixtures/modules/dynamic-inject-module/AbstractSingletonHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSingletonHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/test/fixtures/modules/dynamic-inject-module/FooType.ts: -------------------------------------------------------------------------------- 1 | export enum ContextHelloType { 2 | FOO = 'FOO', 3 | BAR = 'BAR', 4 | } 5 | 6 | export enum SingletonHelloType { 7 | FOO = 'FOO', 8 | BAR = 'BAR', 9 | } 10 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/test/fixtures/modules/dynamic-inject-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dynamic-inject-module", 3 | "eggModule": { 4 | "name": "dynamicInjectModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dynamic-inject-runtime/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dynamic-inject/README.md: -------------------------------------------------------------------------------- 1 | # `dynamic-inject` 2 | 3 | ## Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/dynamic-inject/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-types/dynamic-inject'; 2 | export * from './src/QualifierImplUtil'; 3 | export * from './src/QualifierImplDecoratorUtil'; 4 | -------------------------------------------------------------------------------- /core/dynamic-inject/test/fixtures/modules/base/AbstractContextHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractContextHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /core/dynamic-inject/test/fixtures/modules/base/FooType.ts: -------------------------------------------------------------------------------- 1 | export enum ContextHelloType { 2 | FOO = 'FOO', 3 | BAR = 'BAR', 4 | } 5 | -------------------------------------------------------------------------------- /core/dynamic-inject/test/fixtures/modules/wrong-enum-module/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "./dist", 9 | "node_modules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/dynamic-inject/test/fixtures/modules/wrong-extends-module/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "./dist", 9 | "node_modules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/dynamic-inject/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/dynamic-inject/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/eventbus-decorator/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/EventBus'; 2 | export * from './src/Event'; 3 | export * from './src/EventInfoUtil'; 4 | export * from './src/EventContext'; 5 | 6 | // trick for use declaration 7 | export interface Events { 8 | } 9 | -------------------------------------------------------------------------------- /core/eventbus-decorator/src/type.d.ts: -------------------------------------------------------------------------------- 1 | // https://www.typescriptlang.org/docs/handbook/declaration-merging.html 2 | // use declaration merging to allow user define self events 3 | declare module '@eggjs/tegg' { 4 | export interface Events { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/eventbus-decorator/test/fixtures/empty-handle.ts: -------------------------------------------------------------------------------- 1 | export class EmptyHandler{} 2 | -------------------------------------------------------------------------------- /core/eventbus-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/eventbus-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/eventbus-runtime/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/eventbus-runtime` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/eventbus-runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/SingletonEventBus'; 2 | export * from './src/EventHandlerFactory'; 3 | export * from './src/EventContextFactory'; 4 | -------------------------------------------------------------------------------- /core/eventbus-runtime/test/fixtures/modules/event/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-event", 3 | "eggModule": { 4 | "name": "mockEvent" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/eventbus-runtime/test/fixtures/modules/mock-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-module", 3 | "eggModule": { 4 | "name": "mock" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/eventbus-runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/eventbus-runtime/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/lifecycle/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-lifecycle` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/lifecycle/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-types/lifecycle'; 2 | export * from './src/LifycycleUtil'; 3 | export * from './src/IdenticalObject'; 4 | export * from './src/decorator'; 5 | -------------------------------------------------------------------------------- /core/lifecycle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/lifecycle/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/loader/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-loader` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/loader/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/LoaderFactory'; 2 | export * from './src/LoaderUtil'; 3 | 4 | import './src/impl/ModuleLoader'; 5 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/loader-failed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-for-loader/SprintRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class SprintRepo { 5 | async save() { 6 | return Promise.resolve(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-for-loader/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class UserRepo { 5 | } 6 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-for-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-extra/.dist/ThrowError.ts: -------------------------------------------------------------------------------- 1 | throw new Error('should not load me'); 2 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-extra/AppRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | interface App { 4 | name: string; 5 | } 6 | 7 | @Prototype() 8 | export default class AppRepo { 9 | async findAppByName(): Promise { 10 | return { 11 | name: 'hello', 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-extra/extra/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class UserRepo { 5 | } 6 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-extra/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-test/.gitignore: -------------------------------------------------------------------------------- 1 | !coverage -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-test/AppRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | interface App { 4 | name: string; 5 | } 6 | 7 | @Prototype() 8 | export default class AppRepo { 9 | async findAppByName(): Promise { 10 | return { 11 | name: 'hello', 12 | }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-test/coverage/fixtures/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class UserRepo { 5 | } 6 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/loader/test/fixtures/modules/module-with-test/test/fixtures/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class UserRepo { 5 | } 6 | -------------------------------------------------------------------------------- /core/loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/loader/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/metadata/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-metadata` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/metadata/src/model/EggPrototype.ts: -------------------------------------------------------------------------------- 1 | import { LifecycleUtil } from '@eggjs/tegg-lifecycle'; 2 | import type { EggPrototype, EggPrototypeLifecycleContext } from '@eggjs/tegg-types'; 3 | 4 | export const EggPrototypeLifecycleUtil = new LifecycleUtil(); 5 | -------------------------------------------------------------------------------- /core/metadata/src/model/LoadUnit.ts: -------------------------------------------------------------------------------- 1 | import { LifecycleUtil } from '@eggjs/tegg-lifecycle'; 2 | import type { LoadUnit, LoadUnitLifecycleContext } from '@eggjs/tegg-types'; 3 | 4 | export const LoadUnitLifecycleUtil = new LifecycleUtil(); 5 | -------------------------------------------------------------------------------- /core/metadata/src/model/graph/ProtoSelector.ts: -------------------------------------------------------------------------------- 1 | import { QualifierInfo } from '@eggjs/tegg-types'; 2 | 3 | export interface ProtoSelectorContext { 4 | name: PropertyKey; 5 | qualifiers: QualifierInfo[]; 6 | moduleName: string; 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/root/Root.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto, Inject } from '@eggjs/core-decorator'; 2 | import { UsedProto } from '../used/Used'; 3 | 4 | @SingletonProto() 5 | export class RootProto { 6 | @Inject() usedProto: UsedProto; 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/root/RootConstructor.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto, Inject } from '@eggjs/core-decorator'; 2 | import { UsedProto } from '../used/Used'; 3 | 4 | @SingletonProto() 5 | export class RootConstructorProto { 6 | constructor(@Inject() readonly usedProto: UsedProto) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/root/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "eggModule": { 4 | "name": "root" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/unused/Unused.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto } from '@eggjs/core-decorator'; 2 | 3 | @SingletonProto() 4 | export class UnusedProto { 5 | } 6 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/unused/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unused", 3 | "eggModule": { 4 | "name": "unused" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/used/Used.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/core-decorator'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export class UsedProto { 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-graph-modules/used/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "used", 3 | "eggModule": { 4 | "name": "used" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app/App.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/core-decorator'; 2 | import { BizManager, BizManagerQualifier } from '../bar/BizManager'; 3 | 4 | @SingletonProto() 5 | export class App { 6 | @Inject() 7 | @BizManagerQualifier('foo') 8 | bizManager: BizManager; 9 | } 10 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app/module.yml: -------------------------------------------------------------------------------- 1 | BizManager: 2 | clients: 3 | foo: 4 | secret: '1' 5 | bar: 6 | secret: '2' 7 | 8 | secret: 9 | keys: 10 | - '1' 11 | - '2' 12 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "eggModule": { 4 | "name": "app" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app2/App.ts: -------------------------------------------------------------------------------- 1 | import { Inject, ModuleQualifier, SingletonProto } from '@eggjs/core-decorator'; 2 | import { Secret, SecretQualifier } from '../foo/Secret'; 3 | 4 | @SingletonProto() 5 | export class App2 { 6 | @Inject() 7 | @ModuleQualifier('app2') 8 | @SecretQualifier('1') 9 | secret: Secret; 10 | } 11 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app2/module.yml: -------------------------------------------------------------------------------- 1 | secret: 2 | keys: 3 | - '1' 4 | - '2' 5 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/app2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app2", 3 | "eggModule": { 4 | "name": "app2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/bar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bar", 3 | "eggModule": { 4 | "name": "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/app/modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/app-multi-inject-multi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-multi-inject-multi" 3 | } 4 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/extends-constructor-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/extends-module/Base.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto, Inject } from '@eggjs/core-decorator'; 2 | 3 | @ContextProto() 4 | export class Logger { 5 | } 6 | 7 | @ContextProto() 8 | export class Base { 9 | @Inject() 10 | logger: Logger; 11 | } 12 | 13 | @ContextProto() 14 | export class Foo extends Base { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/extends-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/incompatible-proto-inject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "incompatible-proto-inject", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/incompatible-proto-inject/test.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto, Inject, SingletonProto } from '@eggjs/core-decorator'; 2 | 3 | @ContextProto() 4 | export class Logger { 5 | } 6 | 7 | @SingletonProto() 8 | export class Base { 9 | @Inject() 10 | logger: Logger; 11 | } 12 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalid-multimodule/invalidService.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, AccessLevel } from '@eggjs/core-decorator'; 2 | 3 | @Prototype({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export default class InvalidateService { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalid-multimodule/invalidService2.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, AccessLevel } from '@eggjs/core-decorator'; 2 | 3 | @Prototype({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export default class InvalidateService { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalid-multimodule/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleInvalidateService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalid-multimodule/test.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, Inject } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class testService { 5 | @Inject() 6 | invalidateService: any; 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalidate-module/InvalidateService.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, Inject } from '@eggjs/core-decorator'; 2 | 3 | interface PersistenceService { 4 | } 5 | 6 | @Prototype() 7 | export default class InvalidateService { 8 | @Inject() 9 | persistenceService: PersistenceService; 10 | } 11 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/invalidate-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleInvalidateService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/load-unit/AppRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | 4 | interface App { 5 | name: string; 6 | } 7 | 8 | @Prototype() 9 | export default class AppRepo { 10 | async findAppByName(): Promise { 11 | return { 12 | name: 'hello', 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/load-unit/SprintRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class SprintRepo { 5 | async save() { 6 | return Promise.resolve(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/load-unit/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype } from '@eggjs/core-decorator'; 2 | 3 | @Prototype() 4 | export default class UserRepo { 5 | } 6 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/load-unit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/multi-callback-instance-module/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | logger: 3 | - foo 4 | - bar 5 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/multi-callback-instance-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-callback-instance-module", 3 | "eggModule": { 4 | "name": "multiCallbackInstanceModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/multi-instance-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-instance-module", 3 | "eggModule": { 4 | "name": "multiInstanceModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/optional-inject-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "optional-inject-service", 3 | "eggModule": { 4 | "name": "optionalInjectService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/recursive-load-unit/SprintRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, Inject } from '@eggjs/core-decorator'; 2 | import UserRepo from './UserRepo'; 3 | 4 | @Prototype() 5 | export default class SprintRepo { 6 | @Inject() 7 | userRepo: UserRepo; 8 | 9 | async save() { 10 | return Promise.resolve(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/recursive-load-unit/UserRepo.ts: -------------------------------------------------------------------------------- 1 | import { Prototype, Inject } from '@eggjs/core-decorator'; 2 | import AppRepo from './AppRepo'; 3 | 4 | @Prototype() 5 | export default class UserRepo { 6 | @Inject() 7 | appRepo: AppRepo; 8 | } 9 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/recursive-load-unit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/same-name-object/AppCache.ts: -------------------------------------------------------------------------------- 1 | export interface AppCache { 2 | getCount(): number; 3 | } 4 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/same-name-object/ContextAppCache.ts: -------------------------------------------------------------------------------- 1 | import { ContextProto } from '@eggjs/core-decorator'; 2 | 3 | @ContextProto() 4 | export default class AppCache { 5 | count = 0; 6 | 7 | async getCount(): Promise { 8 | return this.count++; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/same-name-object/SingletonAppCache.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto } from '@eggjs/core-decorator'; 2 | 3 | @SingletonProto() 4 | export default class AppCache { 5 | count = 0; 6 | 7 | async getCount(): Promise { 8 | return this.count++; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/metadata/test/fixtures/modules/same-name-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "same-name-object", 3 | "eggModule": { 4 | "name": "samename" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/metadata/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/metadata/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/orm-decorator/src/decorator/DataSource.ts: -------------------------------------------------------------------------------- 1 | import type { EggProtoImplClass } from '@eggjs/tegg-types'; 2 | import { ModelInfoUtil } from '../util/ModelInfoUtil'; 3 | 4 | export function DataSource(dataSource: string) { 5 | return function(clazz: EggProtoImplClass) { 6 | ModelInfoUtil.setDataSource(dataSource, clazz); 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /core/orm-decorator/src/decorator/Index.ts: -------------------------------------------------------------------------------- 1 | import type { EggProtoImplClass, IndexOptions } from '@eggjs/tegg-types'; 2 | import { ModelInfoUtil } from '../util/ModelInfoUtil'; 3 | 4 | export function Index(fields: string[], params?: IndexOptions) { 5 | return function(clazz: EggProtoImplClass) { 6 | ModelInfoUtil.addModelIndex(fields, params, clazz); 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /core/orm-decorator/test/fixtures/AttributeModel.ts: -------------------------------------------------------------------------------- 1 | import { Model } from '../../src/decorator/Model'; 2 | import { Attribute } from '../../src/decorator/Attribute'; 3 | 4 | @Model() 5 | export class AttributeModel { 6 | @Attribute('varchar', { 7 | name: 'foo_field', 8 | allowNull: false, 9 | autoIncrement: false, 10 | primary: true, 11 | unique: true, 12 | }) 13 | foo: string; 14 | } 15 | -------------------------------------------------------------------------------- /core/orm-decorator/test/fixtures/DefaultAttributeModel.ts: -------------------------------------------------------------------------------- 1 | import { Model } from '../../src/decorator/Model'; 2 | import { Attribute } from '../../src/decorator/Attribute'; 3 | 4 | @Model() 5 | export class DefaultAttributeModel { 6 | @Attribute('varchar') 7 | foo: string; 8 | } 9 | -------------------------------------------------------------------------------- /core/orm-decorator/test/fixtures/DefaultIndexModel.ts: -------------------------------------------------------------------------------- 1 | import { Model } from '../../src/decorator/Model'; 2 | import { Attribute } from '../../src/decorator/Attribute'; 3 | import { Index } from '../../src/decorator/Index'; 4 | 5 | @Model() 6 | @Index([ 'foo' ]) 7 | export class DefaultIndexModel { 8 | @Attribute('varchar') 9 | foo: string; 10 | } 11 | -------------------------------------------------------------------------------- /core/orm-decorator/test/fixtures/IndexModel.ts: -------------------------------------------------------------------------------- 1 | import { Model } from '../../src/decorator/Model'; 2 | import { Attribute } from '../../src/decorator/Attribute'; 3 | import { Index } from '../../src/decorator/Index'; 4 | 5 | @Model() 6 | @Index([ 'foo' ], { 7 | primary: true, 8 | unique: true, 9 | name: 'idx_foo_name', 10 | }) 11 | export class IndexModel { 12 | @Attribute('varchar') 13 | foo: string; 14 | } 15 | -------------------------------------------------------------------------------- /core/orm-decorator/test/fixtures/InvalidateIndexModel.ts: -------------------------------------------------------------------------------- 1 | import { Model } from '../../src/decorator/Model'; 2 | import { Attribute } from '../../src/decorator/Attribute'; 3 | import { Index } from '../../src/decorator/Index'; 4 | 5 | @Model() 6 | @Index([ 'not_exist_field' ]) 7 | export class InvalidateIndexModel { 8 | @Attribute('varchar') 9 | foo: string; 10 | } 11 | -------------------------------------------------------------------------------- /core/orm-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/orm-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/runtime/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-runtime` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /core/runtime/src/model/EggContext.ts: -------------------------------------------------------------------------------- 1 | import type { EggRuntimeContext, EggContextLifecycleContext } from '@eggjs/tegg-types'; 2 | import { LifecycleUtil } from '@eggjs/tegg-lifecycle'; 3 | 4 | export const EggContextLifecycleUtil = new LifecycleUtil(); 5 | -------------------------------------------------------------------------------- /core/runtime/src/model/EggObject.ts: -------------------------------------------------------------------------------- 1 | import { LifecycleUtil } from '@eggjs/tegg-lifecycle'; 2 | import type { EggObject, EggObjectLifeCycleContext } from '@eggjs/tegg-types'; 3 | 4 | export const EggObjectLifecycleUtil = new LifecycleUtil(); 5 | -------------------------------------------------------------------------------- /core/runtime/src/model/LoadUnitInstance.ts: -------------------------------------------------------------------------------- 1 | import type { LoadUnitInstance, LoadUnitInstanceLifecycleContext } from '@eggjs/tegg-types'; 2 | import { LifecycleUtil } from '@eggjs/tegg-lifecycle'; 3 | 4 | export const LoadUnitInstanceLifecycleUtil = new LifecycleUtil(); 5 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/extends-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/init-type-qualifier-module/Cache.ts: -------------------------------------------------------------------------------- 1 | export interface CacheValue { 2 | from: string; 3 | val: string | undefined; 4 | } 5 | 6 | export interface ICache { 7 | get(key: string): CacheValue; 8 | set(key: string, val: string); 9 | } 10 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/init-type-qualifier-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "init-type-qualifier-module" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/inject-constructor-context-to-singleton/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/inject-context-to-singleton/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/lifecycle-hook/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "extendsModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/module-for-load-unit-instance/AppCache.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto } from '@eggjs/core-decorator'; 2 | 3 | @SingletonProto() 4 | export default class AppCache { 5 | count = 0; 6 | 7 | async getCount(): Promise { 8 | return this.count++; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/module-for-load-unit-instance/TempObj.ts: -------------------------------------------------------------------------------- 1 | import { ObjectInitType } from '@eggjs/tegg-types'; 2 | import { Prototype } from '@eggjs/core-decorator'; 3 | 4 | @Prototype({ 5 | initType: ObjectInitType.ALWAYS_NEW, 6 | }) 7 | export default class TempObj { 8 | count = 0; 9 | 10 | async getCount(): Promise { 11 | return this.count++; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/module-for-load-unit-instance/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-app-repo", 3 | "eggModule": { 4 | "name": "app-repo" 5 | }, 6 | "main": "index.js" 7 | } 8 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/multi-instance-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-instance-module", 3 | "eggModule": { 4 | "name": "multiInstanceModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/multi-module/multi-module-common/model/App.ts: -------------------------------------------------------------------------------- 1 | export default class App { 2 | name: string; 3 | desc: string; 4 | } 5 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/multi-module/multi-module-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-common", 3 | "eggModule": { 4 | "name": "multi-module-common" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/multi-module/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multi-module-repo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/test/fixtures/modules/multi-module/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /core/runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/runtime/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/schedule-decorator/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-types/schedule'; 2 | export * from './src/model/ScheduleMetadata'; 3 | export * from './src/util/ScheduleInfoUtil'; 4 | export * from './src/util/ScheduleMetadataUtil'; 5 | export * from './src/decorator/Schedule'; 6 | export * from './src/builder/ScheduleMetaBuilder'; 7 | -------------------------------------------------------------------------------- /core/schedule-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/schedule-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/standalone-decorator/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/standalone-decorator` 2 | 3 | ## Usage 4 | 5 | Please read [@eggjs/tegg-standalone](../../standalone/standalone) 6 | -------------------------------------------------------------------------------- /core/standalone-decorator/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/typing'; 2 | export * from './src/util/StandaloneUtil'; 3 | export * from './src/decorator/Runner'; 4 | -------------------------------------------------------------------------------- /core/standalone-decorator/src/decorator/Runner.ts: -------------------------------------------------------------------------------- 1 | import { MainRunnerClass } from '../typing'; 2 | import { StandaloneUtil } from '../util/StandaloneUtil'; 3 | 4 | export function Runner() { 5 | return function(clazz: MainRunnerClass) { 6 | StandaloneUtil.setMainRunner(clazz as unknown as MainRunnerClass); 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /core/standalone-decorator/src/typing.ts: -------------------------------------------------------------------------------- 1 | export interface MainRunner { 2 | main(): Promise; 3 | } 4 | 5 | export type MainRunnerClass = new() => MainRunner; 6 | -------------------------------------------------------------------------------- /core/standalone-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/standalone-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/tegg/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg` 2 | 3 | ## Install 4 | ```sh 5 | npm i @eggjs/tegg @eggjs/tegg-plugin 6 | ``` 7 | 8 | ## Usage 9 | 10 | Check out our documentation [here](https://github.com/eggjs/tegg#readme). 11 | -------------------------------------------------------------------------------- /core/tegg/ajv.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/ajv-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/aop.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/aop-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/dal.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/dal-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/helper.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-runtime'; 2 | export * from '@eggjs/tegg-loader'; 3 | export * from '@eggjs/tegg-metadata'; 4 | export * from '@eggjs/tegg-common-util'; 5 | -------------------------------------------------------------------------------- /core/tegg/orm.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-orm-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/schedule.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-schedule-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/standalone.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/standalone-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/transaction.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-transaction-decorator'; 2 | -------------------------------------------------------------------------------- /core/tegg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "dist", 8 | "node_modules", 9 | "test" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/tegg/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "dist", 8 | "node_modules", 9 | "test" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/test-util/index.ts: -------------------------------------------------------------------------------- 1 | export * from './LoaderUtil'; 2 | export * from './TestLoader'; 3 | export * from './EggTestContext'; 4 | export * from './CoreTestHelper'; 5 | -------------------------------------------------------------------------------- /core/test-util/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/test-util/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/transaction-decorator/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@eggjs/tegg-types/transaction'; 2 | export * from './src/decorator/Transactional'; 3 | export * from './src/builder/TransactionMetaBuilder'; 4 | export * from './src/util/TransactionMetadataUtil'; 5 | -------------------------------------------------------------------------------- /core/transaction-decorator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/transaction-decorator/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /core/types/aop/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Advice'; 2 | export * from './Aspect'; 3 | export * from './Crosscut'; 4 | export * from './Pointcut'; 5 | -------------------------------------------------------------------------------- /core/types/common/Graph.ts: -------------------------------------------------------------------------------- 1 | export interface GraphNodeObj { 2 | readonly id: string; 3 | } 4 | -------------------------------------------------------------------------------- /core/types/common/Logger.ts: -------------------------------------------------------------------------------- 1 | export interface Logger { 2 | debug(message?: any, ...optionalParams: any[]): void; 3 | log(message?: any, ...optionalParams: any[]): void; 4 | info(message?: any, ...optionalParams: any[]): void; 5 | warn(message?: any, ...optionalParams: any[]): void; 6 | error(message?: any, ...optionalParams: any[]): void; 7 | } 8 | -------------------------------------------------------------------------------- /core/types/common/RuntimeConfig.ts: -------------------------------------------------------------------------------- 1 | export type EnvType = 'local' | 'unittest' | 'prod' | string; 2 | 3 | export interface RuntimeConfig { 4 | /** 5 | * Application name 6 | */ 7 | name: string; 8 | 9 | /** 10 | * Application environment 11 | */ 12 | env: EnvType; 13 | 14 | /** 15 | * Application directory 16 | */ 17 | baseDir: string; 18 | } 19 | -------------------------------------------------------------------------------- /core/types/common/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Graph'; 2 | export * from './ModuleConfig'; 3 | export * from './RuntimeConfig'; 4 | export * from './Logger'; 5 | -------------------------------------------------------------------------------- /core/types/controller-decorator/HTTPController.ts: -------------------------------------------------------------------------------- 1 | export interface HTTPControllerParams { 2 | protoName?: string; 3 | controllerName?: string; 4 | path?: string; 5 | timeout?: number; 6 | } 7 | -------------------------------------------------------------------------------- /core/types/controller-decorator/HTTPMethod.ts: -------------------------------------------------------------------------------- 1 | import { HTTPMethodEnum } from './model/types'; 2 | 3 | export interface HTTPMethodParams { 4 | method: HTTPMethodEnum; 5 | path: string; 6 | priority?: number; 7 | timeout?: number; 8 | } 9 | -------------------------------------------------------------------------------- /core/types/controller-decorator/HTTPParam.ts: -------------------------------------------------------------------------------- 1 | export interface HTTPQueryParams { 2 | name?: string; 3 | } 4 | 5 | export interface HTTPQueriesParams { 6 | name?: string; 7 | } 8 | 9 | export interface HTTPParamParams { 10 | name?: string; 11 | } 12 | -------------------------------------------------------------------------------- /core/types/controller-decorator/MCPController.ts: -------------------------------------------------------------------------------- 1 | export interface MCPControllerParams { 2 | protoName?: string; 3 | controllerName?: string; 4 | name?: string; 5 | version?: string; 6 | } 7 | -------------------------------------------------------------------------------- /core/types/controller-decorator/builder.ts: -------------------------------------------------------------------------------- 1 | import { EggProtoImplClass } from '../core-decorator'; 2 | import { ControllerMetadata } from './model/ControllerMetadata'; 3 | 4 | export interface ControllerMetaBuilder { 5 | build(): ControllerMetadata | undefined; 6 | } 7 | 8 | export type ControllerMetaBuilderCreator = (clazz: EggProtoImplClass) => ControllerMetaBuilder; 9 | -------------------------------------------------------------------------------- /core/types/controller-decorator/model/MethodMeta.ts: -------------------------------------------------------------------------------- 1 | import { MiddlewareFunc } from './types'; 2 | 3 | export interface MethodMeta { 4 | readonly name: string; 5 | readonly middlewares: readonly MiddlewareFunc[]; 6 | readonly contextParamIndex: number | undefined; 7 | } 8 | -------------------------------------------------------------------------------- /core/types/core-decorator/ContextProto.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel } from './enum/AccessLevel'; 2 | 3 | export interface ContextProtoParams { 4 | name?: string; 5 | accessLevel?: AccessLevel; 6 | protoImplType?: string; 7 | } 8 | -------------------------------------------------------------------------------- /core/types/core-decorator/Inject.ts: -------------------------------------------------------------------------------- 1 | export interface InjectParams { 2 | // obj instance name, default is property name 3 | name?: string; 4 | // optional inject, default is false which means it will throw error when there is no relative object 5 | optional?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /core/types/core-decorator/Metadata.ts: -------------------------------------------------------------------------------- 1 | export type MetaDataKey = symbol | string; 2 | -------------------------------------------------------------------------------- /core/types/core-decorator/Prototype.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel } from './enum/AccessLevel'; 2 | import { ObjectInitTypeLike } from './enum/ObjectInitType'; 3 | 4 | export interface PrototypeParams { 5 | name?: string; 6 | initType?: ObjectInitTypeLike; 7 | accessLevel?: AccessLevel; 8 | protoImplType?: string; 9 | } 10 | 11 | export const DEFAULT_PROTO_IMPL_TYPE = 'DEFAULT'; 12 | -------------------------------------------------------------------------------- /core/types/core-decorator/SingletonProto.ts: -------------------------------------------------------------------------------- 1 | import type { AccessLevel } from './enum/AccessLevel'; 2 | 3 | export interface SingletonProtoParams { 4 | name?: string; 5 | accessLevel?: AccessLevel; 6 | protoImplType?: string; 7 | } 8 | -------------------------------------------------------------------------------- /core/types/core-decorator/enum/AccessLevel.ts: -------------------------------------------------------------------------------- 1 | export enum AccessLevel { 2 | // only access from self load unit 3 | PRIVATE = 'PRIVATE', 4 | // can access from parent load unit 5 | PUBLIC = 'PUBLIC', 6 | } 7 | -------------------------------------------------------------------------------- /core/types/core-decorator/enum/EggType.ts: -------------------------------------------------------------------------------- 1 | export enum EggType { 2 | APP = 'APP', 3 | CONTEXT = 'CONTEXT', 4 | } 5 | -------------------------------------------------------------------------------- /core/types/core-decorator/enum/InjectType.ts: -------------------------------------------------------------------------------- 1 | export enum InjectType { 2 | PROPERTY = 'PROPERTY', 3 | CONSTRUCTOR = 'CONSTRUCTOR', 4 | } 5 | -------------------------------------------------------------------------------- /core/types/core-decorator/enum/MultiInstanceType.ts: -------------------------------------------------------------------------------- 1 | export enum MultiInstanceType { 2 | STATIC = 'STATIC', 3 | DYNAMIC = 'DYNAMIC', 4 | } 5 | -------------------------------------------------------------------------------- /core/types/core-decorator/model/InjectObjectInfo.ts: -------------------------------------------------------------------------------- 1 | export type EggObjectName = PropertyKey; 2 | 3 | export interface InjectObjectInfo { 4 | /** 5 | * property name obj inject to 6 | */ 7 | refName: PropertyKey; 8 | /** 9 | * obj's name will be injected 10 | */ 11 | objName: EggObjectName; 12 | /** 13 | * optional inject 14 | */ 15 | optional?: boolean; 16 | } 17 | -------------------------------------------------------------------------------- /core/types/dal/decorator/DataSourceQualifier.ts: -------------------------------------------------------------------------------- 1 | export const DataSourceQualifierAttribute = Symbol('Qualifier.DataSource'); 2 | export const DataSourceInjectName = 'dataSource'; 3 | -------------------------------------------------------------------------------- /core/types/dal/decorator/Index.ts: -------------------------------------------------------------------------------- 1 | import type { IndexStoreType } from '../enum/IndexStoreType'; 2 | import type { IndexType } from '../enum/IndexType'; 3 | 4 | export interface IndexParams { 5 | keys: string[]; 6 | name?: string; 7 | type?: IndexType, 8 | storeType?: IndexStoreType; 9 | comment?: string; 10 | engineAttribute?: string; 11 | secondaryEngineAttribute?: string; 12 | parser?: string; 13 | } 14 | -------------------------------------------------------------------------------- /core/types/dal/enum/ColumnFormat.ts: -------------------------------------------------------------------------------- 1 | export enum ColumnFormat { 2 | FIXED = 'FIXED', 3 | DYNAMIC = 'DYNAMIC', 4 | DEFAULT = 'DEFAULT', 5 | } 6 | -------------------------------------------------------------------------------- /core/types/dal/enum/CompressionType.ts: -------------------------------------------------------------------------------- 1 | export enum CompressionType { 2 | ZLIB = 'ZLIB', 3 | LZ4 = 'LZ4', 4 | NONE = 'NONE', 5 | } 6 | -------------------------------------------------------------------------------- /core/types/dal/enum/IndexStoreType.ts: -------------------------------------------------------------------------------- 1 | export enum IndexStoreType { 2 | BTREE = 'BTREE', 3 | HASH = 'HASH', 4 | } 5 | -------------------------------------------------------------------------------- /core/types/dal/enum/IndexType.ts: -------------------------------------------------------------------------------- 1 | export enum IndexType { 2 | PRIMARY = 'PRIMARY', 3 | UNIQUE = 'UNIQUE', 4 | INDEX = 'INDEX', 5 | FULLTEXT = 'FULLTEXT', 6 | SPATIAL = 'SPATIAL', 7 | } 8 | -------------------------------------------------------------------------------- /core/types/dal/enum/InsertMethod.ts: -------------------------------------------------------------------------------- 1 | export enum InsertMethod { 2 | NO = 'NO', 3 | FIRST = 'FIRST', 4 | LAST = 'LAST', 5 | } 6 | -------------------------------------------------------------------------------- /core/types/dal/enum/RowFormat.ts: -------------------------------------------------------------------------------- 1 | export enum RowFormat { 2 | DEFAULT = 'DEFAULT', 3 | DYNAMIC = 'DYNAMIC', 4 | FIXED = 'FIXED', 5 | COMPRESSED = 'COMPRESSED', 6 | REDUNDANT = 'REDUNDANT', 7 | COMPACT = 'COMPACT', 8 | } 9 | -------------------------------------------------------------------------------- /core/types/dal/enum/SqlType.ts: -------------------------------------------------------------------------------- 1 | export enum SqlType { 2 | BLOCK = 'BLOCK', 3 | INSERT = 'INSERT', 4 | SELECT = 'SELECT', 5 | UPDATE = 'UPDATE', 6 | DELETE = 'DELETE', 7 | } 8 | -------------------------------------------------------------------------------- /core/types/dal/enum/Templates.ts: -------------------------------------------------------------------------------- 1 | export enum Templates { 2 | BASE_DAO = 'base_dao', 3 | DAO = 'dao', 4 | EXTENSION = 'extension', 5 | } 6 | -------------------------------------------------------------------------------- /core/types/dal/type/BaseDao.ts: -------------------------------------------------------------------------------- 1 | import { EggProtoImplClass } from '../../core-decorator'; 2 | import { SqlMap } from './SqlMap'; 3 | 4 | 5 | export interface BaseDaoType { 6 | new(...args: any[]): object; 7 | clazzModel: EggProtoImplClass; 8 | clazzExtension: Record; 9 | // todo: typed structure 10 | tableStature: object; 11 | tableSql: string; 12 | } 13 | -------------------------------------------------------------------------------- /core/types/dal/type/CodeGenerator.ts: -------------------------------------------------------------------------------- 1 | export interface CodeGeneratorOptions { 2 | moduleDir: string; 3 | moduleName: string; 4 | teggPkg?: string; 5 | dalPkg?: string; 6 | } 7 | -------------------------------------------------------------------------------- /core/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './aop'; 2 | export * from './common'; 3 | export * from './controller-decorator'; 4 | export * from './core-decorator'; 5 | export * from './dal'; 6 | export * from './dynamic-inject'; 7 | export * from './lifecycle'; 8 | export * from './metadata'; 9 | export * from './orm'; 10 | export * from './runtime'; 11 | export * from './schedule'; 12 | export * from './transaction'; 13 | -------------------------------------------------------------------------------- /core/types/lifecycle/IdenticalObject.ts: -------------------------------------------------------------------------------- 1 | export type Id = string; 2 | 3 | export interface IdenticalObject { 4 | id: Id; 5 | } 6 | -------------------------------------------------------------------------------- /core/types/lifecycle/index.ts: -------------------------------------------------------------------------------- 1 | export * from './EggObjectLifecycle'; 2 | export * from './IdenticalObject'; 3 | export * from './LifecycleHook'; 4 | 5 | -------------------------------------------------------------------------------- /core/types/metadata/enum/ProtoDescriptorType.ts: -------------------------------------------------------------------------------- 1 | export enum ProtoDescriptorType { 2 | CLASS = 'CLASS', 3 | } 4 | -------------------------------------------------------------------------------- /core/types/metadata/errors.ts: -------------------------------------------------------------------------------- 1 | export enum ErrorCodes { 2 | EGG_PROTO_NOT_FOUND = 'EGG_PROTO_NOT_FOUND', 3 | MULTI_PROTO_FOUND = 'MULTI_PROTO_FOUND', 4 | INCOMPATIBLE_PROTO_INJECT = 'INCOMPATIBLE_PROTO_INJECT', 5 | } 6 | -------------------------------------------------------------------------------- /core/types/metadata/index.ts: -------------------------------------------------------------------------------- 1 | export * from './model/ProtoDescriptor'; 2 | export * from './model/EggPrototype'; 3 | export * from './model/Loader'; 4 | export * from './model/LoadUnit'; 5 | export * from './errors'; 6 | -------------------------------------------------------------------------------- /core/types/metadata/model/Loader.ts: -------------------------------------------------------------------------------- 1 | import { EggProtoImplClass } from '../../core-decorator'; 2 | 3 | /** 4 | * Loader to load class list in module 5 | */ 6 | export interface Loader { 7 | load(): EggProtoImplClass[]; 8 | // TODO impl loadProto 9 | // loadProto(): ProtoDescriptor[]; 10 | } 11 | -------------------------------------------------------------------------------- /core/types/runtime/index.ts: -------------------------------------------------------------------------------- 1 | export * from './model/EggContainer'; 2 | export * from './model/EggContext'; 3 | export * from './model/EggObject'; 4 | export * from './model/LoadUnitInstance'; 5 | export * from './Factory'; 6 | -------------------------------------------------------------------------------- /core/types/runtime/model/EggContext.ts: -------------------------------------------------------------------------------- 1 | import { EggContainer } from './EggContainer'; 2 | 3 | export interface EggContextLifecycleContext { 4 | } 5 | 6 | export interface EggRuntimeContext extends EggContainer { 7 | // ctx get/set method 8 | get(key: string | symbol): any | undefined; 9 | set(key: string | symbol, val: any); 10 | } 11 | -------------------------------------------------------------------------------- /core/types/runtime/model/LoadUnitInstance.ts: -------------------------------------------------------------------------------- 1 | import { LoadUnit } from '../../metadata'; 2 | import { EggContainer } from './EggContainer'; 3 | 4 | export interface LoadUnitInstanceLifecycleContext { 5 | loadUnit: LoadUnit; 6 | } 7 | 8 | export interface LoadUnitInstance extends EggContainer { 9 | readonly name: string; 10 | readonly loadUnit: LoadUnit; 11 | } 12 | -------------------------------------------------------------------------------- /core/types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "dist", 8 | "node_modules", 9 | "test" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /core/types/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "dist", 8 | "node_modules", 9 | "test" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "useWorkspaces": true, 3 | "version": "3.57.9", 4 | "npmClientArgs": [ 5 | "--package-lock=false" 6 | ], 7 | "lerna": "1.6.4" 8 | } 9 | -------------------------------------------------------------------------------- /plugin/ajv/test/fixtures/apps/ajv-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | const config = { 3 | keys: 'test key', 4 | security: { 5 | csrf: { 6 | ignoreJSON: false, 7 | }, 8 | }, 9 | }; 10 | return config; 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/ajv/test/fixtures/apps/ajv-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/demo" 4 | }, { 5 | "package": "../../../../" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/module.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eggjs/tegg/62d94c77e6f9ce765ff4ab315d4fe0f9ca3d79bd/plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/module.yml -------------------------------------------------------------------------------- /plugin/ajv/test/fixtures/apps/ajv-app/modules/demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo", 3 | "eggModule": { 4 | "name": "demo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/ajv/test/fixtures/apps/ajv-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ajv-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/ajv/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /plugin/ajv/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/ajv/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import '@eggjs/tegg-plugin'; 3 | import '@eggjs/tegg-config'; 4 | import '@eggjs/tegg-controller-plugin'; 5 | -------------------------------------------------------------------------------- /plugin/aop/test/fixtures/apps/aop-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/aop', app.controller.app.aop); 5 | app.router.get('/singletonAop', app.controller.app.contextAdviceWithSingleton); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/aop/test/fixtures/apps/aop-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/aop-module" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /plugin/aop/test/fixtures/apps/aop-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tegg = { 4 | package: '@eggjs/tegg-plugin', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/aop/test/fixtures/apps/aop-app/modules/aop-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module", 3 | "eggModule": { 4 | "name": "aopModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/aop/test/fixtures/apps/aop-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/aop/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/aop/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/aop/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import '@eggjs/tegg-plugin'; 3 | -------------------------------------------------------------------------------- /plugin/common/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/egg-module-common` 2 | 3 | # Usage 4 | 5 | This is an internal tegg library, you probably shouldn't use it directly. 6 | -------------------------------------------------------------------------------- /plugin/common/index.ts: -------------------------------------------------------------------------------- 1 | export const TEGG_CONTEXT = Symbol.for('context#teggContext'); 2 | export const EGG_CONTEXT = Symbol.for('context#eggContext'); 3 | export const ROOT_PROTO = Symbol.for('context#rootProto'); 4 | -------------------------------------------------------------------------------- /plugin/common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/common/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/config/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-config` 2 | 3 | Egg plugin to load module config(module.yml/module.json) 4 | 5 | # Usage 6 | 7 | This is an internal tegg library, you probably shouldn't use it directly. 8 | -------------------------------------------------------------------------------- /plugin/config/agent.ts: -------------------------------------------------------------------------------- 1 | import TeggConfigAppHook from './app'; 2 | 3 | export default TeggConfigAppHook; 4 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/app-with-modules/app/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/app-with-modules/config/config.default.ts: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return { 3 | tegg: { 4 | readModuleOptions: { 5 | extraFilePattern: [ '!**/dist' ], 6 | }, 7 | }, 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/app-with-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/duplicate-optional-module/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.watcher = false; 9 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/duplicate-optional-module/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "dependencies": { 4 | "used": "*", 5 | "unused": "*" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/duplicate-optional-module/node_modules/unused/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unused", 3 | "eggModule": { 4 | "name": "unused" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/duplicate-optional-module/node_modules/used/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "used", 3 | "eggModule": { 4 | "name": "used" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/config/test/fixtures/apps/duplicate-optional-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app", 3 | "egg": { 4 | "framework": "foo" 5 | }, 6 | "dependencies": { 7 | "used": "*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plugin/config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/config/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/controller/lib/ControllerRegister.ts: -------------------------------------------------------------------------------- 1 | import { LoadUnit } from '@eggjs/tegg-metadata'; 2 | import { RootProtoManager } from './RootProtoManager'; 3 | 4 | export interface ControllerRegister { 5 | register(rootProtoManager: RootProtoManager, loadUnit?: LoadUnit): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/lib/errors.ts: -------------------------------------------------------------------------------- 1 | import { TeggError } from '@eggjs/tegg-metadata'; 2 | 3 | enum ErrorCodes { 4 | ROUTER_CONFLICT = 'ROUTER_CONFLICT' 5 | } 6 | 7 | /** 路由冲突错误 */ 8 | export class RouterConflictError extends TeggError { 9 | constructor(msg: string) { 10 | super(msg, ErrorCodes.ROUTER_CONFLICT); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/acl-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/acl-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tegg = { 4 | package: '@eggjs/tegg-plugin', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/acl-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "acl-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/app/controller/ViewController.ts: -------------------------------------------------------------------------------- 1 | import { 2 | HTTPController, 3 | HTTPMethod, 4 | HTTPMethodEnum, 5 | } from '@eggjs/tegg'; 6 | 7 | @HTTPController() 8 | export class ViewController { 9 | 10 | @HTTPMethod({ 11 | method: HTTPMethodEnum.GET, 12 | path: '/*', 13 | }) 14 | async get() { 15 | return 'hello, view'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/app/middleware/call_module.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | export async function callModuleCtx(ctx: Context, next: Next) { 5 | await (ctx.module as any).multiModuleService.appService.findApp('foo'); 6 | await next(); 7 | } 8 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/app/middleware/count_mw.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | let index = 0; 5 | 6 | export async function countMw(ctx: Context, next: Next) { 7 | await next(); 8 | if (ctx.body) ctx.body.count = index++; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/app/middleware/log_mw.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | export function logMwFactory(log: string) { 5 | return async function logMw(ctx: Context, next: Next) { 6 | await next(); 7 | ctx.body.log = log; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-common" 4 | }, 5 | { 6 | "path": "../modules/multi-module-repo" 7 | }, 8 | { 9 | "path": "../modules/multi-module-service" 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/modules/multi-module-common/model/App.ts: -------------------------------------------------------------------------------- 1 | export default class App { 2 | name: string; 3 | desc: string; 4 | } 5 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/modules/multi-module-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-common", 3 | "eggModule": { 4 | "name": "multi-module-common" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/modules/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multi-module-repo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/modules/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/controller-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/duplicate-controller-name-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/duplicate-controller-name-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/duplicate-proto-name-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/duplicate-proto-name-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/duplicate-proto-name-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/host-controller-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | 15 | exports.teggConfig = { 16 | package: '@eggjs/tegg-config', 17 | enable: true, 18 | }; 19 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/host-controller-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/host-controller-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-conflict-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-conflict-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-conflict-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/app/middleware/call_module.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | export async function callModuleCtx(ctx: Context, next: Next) { 5 | await (ctx.module as any).multiModuleService.appService.findApp('foo'); 6 | await next(); 7 | } 8 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/app/middleware/count_mw.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | let index = 0; 5 | 6 | export async function countMw(ctx: Context, next: Next) { 7 | await next(); 8 | if (ctx.body) ctx.body.count = index++; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/app/middleware/log_mw.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { Next } from '@eggjs/tegg'; 3 | 4 | export function logMwFactory(log: string) { 5 | return async function logMw(ctx: Context, next: Next) { 6 | await next(); 7 | ctx.body.log = log; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/config/module.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/http-inject-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-inject-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/mcp-app/hook-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@eggjs/hook-plugin", 3 | "eggPlugin": { 4 | "name": "hookPlugin" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/mcp-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mcp-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/app/controller/AppController2.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from 'egg'; 2 | 3 | export default class AppController2 extends Controller { 4 | async foo() { 5 | const traceId = await this.ctx.tracer.traceId; 6 | const id = this.ctx.params.id; 7 | this.ctx.body = { 8 | traceId, 9 | app: 'mock-app:' + id, 10 | }; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | export default function(app: Application) { 4 | app.get('/apps2/:id', app.controller.appController2.foo); 5 | } 6 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | }, 10 | }, 11 | controller: { 12 | supportParams: true, 13 | }, 14 | }; 15 | return config; 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/http-module" 4 | }, 5 | { 6 | "path": "../modules/foo-module" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/modules/foo-module/AppService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, ContextProto } from '@eggjs/tegg'; 2 | 3 | // No one deps it 4 | // It should not be construct 5 | @ContextProto({ 6 | accessLevel: AccessLevel.PUBLIC, 7 | }) 8 | export class AppService { 9 | constructor() { 10 | (global as any).constructAppService = true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/modules/foo-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo-module", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/modules/http-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-module", 3 | "eggModule": { 4 | "name": "http-module" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/module-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/proto-poisoning/config/config.default.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | const config = { 3 | keys: 'test key', 4 | security: { 5 | csrf: { 6 | ignoreJSON: false, 7 | }, 8 | }, 9 | bodyParser: { 10 | onProtoPoisoning: 'remove', 11 | }, 12 | }; 13 | return config; 14 | }; 15 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/proto-poisoning/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.tracer = { 2 | package: 'egg-tracer', 3 | enable: true, 4 | }; 5 | 6 | exports.tegg = { 7 | package: '@eggjs/tegg-plugin', 8 | enable: true, 9 | }; 10 | 11 | exports.teggConfig = { 12 | package: '@eggjs/tegg-config', 13 | enable: true, 14 | }; 15 | -------------------------------------------------------------------------------- /plugin/controller/test/fixtures/apps/proto-poisoning/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "proto-poisoning" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/controller/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/controller/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/dal/test/fixtures/apps/dal-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | }, 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/dal/test/fixtures/apps/dal-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/dal" 4 | }, { 5 | "package": "../../../../" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /plugin/dal/test/fixtures/apps/dal-app/modules/dal/module.yml: -------------------------------------------------------------------------------- 1 | dataSource: 2 | foo: 3 | connectionLimit: 100 4 | database: 'test_dal_plugin' 5 | host: '127.0.0.1' 6 | user: root 7 | port: 3306 8 | timezone: '+08:00' 9 | forkDb: true 10 | -------------------------------------------------------------------------------- /plugin/dal/test/fixtures/apps/dal-app/modules/dal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/dal/test/fixtures/apps/dal-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/dal/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /plugin/dal/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/dal/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import '@eggjs/tegg-plugin'; 3 | import '@eggjs/tegg-config'; 4 | -------------------------------------------------------------------------------- /plugin/eventbus/app/extend/context.ts: -------------------------------------------------------------------------------- 1 | import { Context } from 'egg'; 2 | import { EggContextEventBus } from '../../lib/EggContextEventBus'; 3 | 4 | const EVENT_BUS = Symbol.for('context#eventBus'); 5 | 6 | export default { 7 | get eventBus() { 8 | if (!this[EVENT_BUS]) { 9 | this[EVENT_BUS] = new EggContextEventBus(this as unknown as Context); 10 | } 11 | return this[EVENT_BUS]; 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/app/event-module/HelloLogger.ts: -------------------------------------------------------------------------------- 1 | import { Event } from '@eggjs/tegg'; 2 | 3 | @Event('helloEgg') 4 | export class HelloLogger { 5 | handle(msg: string) { 6 | console.log('hello, ', msg); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/app/event-module/MultiEventHandler.ts: -------------------------------------------------------------------------------- 1 | import { Event, EventContext, IEventContext } from '@eggjs/tegg'; 2 | @Event('helloEgg') 3 | @Event('hiEgg') 4 | export class MultiEventHandler { 5 | handle(@EventContext()ctx: IEventContext, msg: string) { 6 | console.log('How are you', msg, ctx); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/app/event-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-common", 3 | "eggModule": { 4 | "name": "multi-module-common" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | ignoreJSON: false, 9 | } 10 | }, 11 | }; 12 | return config; 13 | }; 14 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/eventbus/test/fixtures/apps/event-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "event-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/eventbus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/eventbus/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/README.md: -------------------------------------------------------------------------------- 1 | # @eggjs/mcp-Proxy 2 | 3 | ## Usage 4 | 5 | ```js 6 | // plugin.js 7 | export.mcpProxy = { 8 | enable: true, 9 | package: '@eggjs/mcp-Proxy', 10 | }; 11 | ``` 12 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/agent.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | export default class AppHook { 4 | private readonly agent: Application; 5 | 6 | constructor(agent: Application) { 7 | this.agent = agent; 8 | } 9 | 10 | async didLoad() { 11 | if (this.agent.mcpProxy) { 12 | await (this.agent.mcpProxy as any)?.ready(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/config/config.default.ts: -------------------------------------------------------------------------------- 1 | export default () => { 2 | 3 | const config = { 4 | mcp: { 5 | proxyPort: 17031, 6 | }, 7 | }; 8 | 9 | return config; 10 | }; 11 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/test/fixtures/apps/mcp-proxy/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.all('/stream', app.controller.app.allStream); 5 | app.router.get('/init', app.controller.app.init); 6 | app.router.post('/message', app.controller.app.message); 7 | }; 8 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/test/fixtures/apps/mcp-proxy/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function() { 4 | const config = { 5 | keys: 'test key', 6 | security: { 7 | csrf: { 8 | enable: false, 9 | }, 10 | }, 11 | bodyParser: { 12 | enable: false, 13 | }, 14 | }; 15 | return config; 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/test/fixtures/apps/mcp-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/types.ts: -------------------------------------------------------------------------------- 1 | export enum MCPProtocols { 2 | STDIO = 'STDIO', 3 | SSE = 'SSE', 4 | STREAM = 'STREAM', 5 | } 6 | -------------------------------------------------------------------------------- /plugin/mcp-proxy/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import '@eggjs/tegg-plugin'; 3 | import { MCPProxyApiClient } from '../index'; 4 | 5 | export { MCPProtocols } from '../types' 6 | 7 | declare module 'egg' { 8 | export interface MCPProxyApp { 9 | mcpProxy: MCPProxyApiClient; 10 | } 11 | 12 | export interface Application extends MCPProxyApp { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plugin/orm/README.md: -------------------------------------------------------------------------------- 1 | # @eggjs/tegg-orm-plugin 2 | 3 | 使用注解的方式来开发 egg 中的 orm 4 | 5 | ## Install 6 | 7 | ```shell 8 | npm i --save @eggjs/tegg-orm-plugin 9 | ``` 10 | 11 | 12 | ## Config 13 | 14 | ```js 15 | // config/plugin.js 16 | exports.teggOrm = { 17 | package: '@eggjs/tegg-orm-plugin', 18 | enable: true, 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /plugin/orm/test/fixtures/apps/orm-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/orm-module" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /plugin/orm/test/fixtures/apps/orm-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.tegg = { 9 | package: '@eggjs/tegg-plugin', 10 | enable: true, 11 | }; 12 | 13 | exports.teggConfig = { 14 | package: '@eggjs/tegg-config', 15 | enable: true, 16 | }; 17 | -------------------------------------------------------------------------------- /plugin/orm/test/fixtures/apps/orm-app/modules/orm-module/model/App.ts: -------------------------------------------------------------------------------- 1 | import { Attribute, Model } from '@eggjs/tegg-orm-decorator'; 2 | import { DataTypes, Bone } from 'leoric'; 3 | 4 | @Model({ 5 | dataSource: 'test', 6 | }) 7 | export class App extends Bone { 8 | @Attribute(DataTypes.STRING) 9 | name: string; 10 | @Attribute(DataTypes.STRING) 11 | desc: string; 12 | } 13 | -------------------------------------------------------------------------------- /plugin/orm/test/fixtures/apps/orm-app/modules/orm-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "orm-module", 3 | "eggModule": { 4 | "name": "ormModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/orm/test/fixtures/apps/orm-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "controller-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/orm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/orm/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/schedule/README.md: -------------------------------------------------------------------------------- 1 | # @eggjs/tegg-schedule-plugin 2 | 3 | 使用注解的方式来开发 egg 中的 schedule 4 | 5 | ## Install 6 | 7 | ```shell 8 | npm i --save @eggjs/tegg-schedule-plugin 9 | ``` 10 | 11 | 12 | ## Config 13 | 14 | ```js 15 | // config/plugin.js 16 | exports.teggSchedule = { 17 | package: '@eggjs/tegg-schedule-plugin', 18 | enable: true, 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /plugin/schedule/test/fixtures/schedule-app/app/subscriber/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "subscriber", 3 | "eggModule": { 4 | "name": "subscriber" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/schedule/test/fixtures/schedule-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../app/subscriber" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /plugin/schedule/test/fixtures/schedule-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | exports.tegg = { 6 | package: '@eggjs/tegg-plugin', 7 | enable: true, 8 | }; 9 | 10 | exports.teggConfig = { 11 | package: '@eggjs/tegg-config', 12 | enable: true, 13 | }; 14 | 15 | exports.teggSchedule = { 16 | path: path.join(__dirname, '../../../..'), 17 | enable: true, 18 | }; 19 | -------------------------------------------------------------------------------- /plugin/schedule/test/fixtures/schedule-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "schedule-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/schedule/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/schedule/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /plugin/schedule/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import '@eggjs/tegg-plugin'; 3 | -------------------------------------------------------------------------------- /plugin/tegg/README.md: -------------------------------------------------------------------------------- 1 | # `@eggjs/tegg-plugin` 2 | 3 | ## Usage 4 | 5 | Please read [../../README.md](../..) 6 | -------------------------------------------------------------------------------- /plugin/tegg/app/middleware/tegg_ctx_lifecycle_middleware.ts: -------------------------------------------------------------------------------- 1 | import ctxLifecycleMiddleware from '../../lib/ctx_lifecycle_middleware'; 2 | 3 | export default function() { 4 | return ctxLifecycleMiddleware; 5 | } 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/app/controller/app.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from 'egg'; 2 | 3 | export default class App extends Controller { 4 | async invokeFoo() { 5 | const ret = await this.ctx.app.module.moduleMain.mainService.invokeFoo(); 6 | this.ctx.body = { 7 | ret, 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/invokeFoo', app.controller.app.invokeFoo); 5 | }; 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/module-a" 4 | }, 5 | { 6 | "path": "../modules/module-main" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/modules/module-a/BarService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export default class BarService { 7 | 8 | public moduleABarServiceMethod() { 9 | return 'moduleA-BarService-Method'; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/modules/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "moduleA" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/modules/module-main/BarService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PRIVATE, 5 | }) 6 | export default class BarService { 7 | 8 | public moduleMainBarServiceMethod() { 9 | return 'moduleMain-BarService-Method'; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/modules/module-main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-main", 3 | "eggModule": { 4 | "name": "moduleMain" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/access-level-check/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import MainService from '../../modules/module-main/MainService'; 3 | 4 | declare module 'egg' { 5 | export interface EggModule { 6 | moduleMain: { 7 | mainService: MainService; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app/App.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/core-decorator'; 2 | import { BizManager, BizManagerQualifier } from '../bar/BizManager'; 3 | 4 | @SingletonProto() 5 | export class App { 6 | @Inject() 7 | @BizManagerQualifier('foo') 8 | bizManager: BizManager; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app/module.yml: -------------------------------------------------------------------------------- 1 | BizManager: 2 | clients: 3 | foo: {} 4 | bar: {} 5 | 6 | secret: 7 | keys: 8 | - '1' 9 | - '2' 10 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "eggModule": { 4 | "name": "app" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app2/App.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/core-decorator'; 2 | import { Secret, SecretQualifier } from '../foo/Secret'; 3 | 4 | @SingletonProto() 5 | export class App2 { 6 | @Inject() 7 | @SecretQualifier('app2') 8 | secret: Secret; 9 | } 10 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app2/module.yml: -------------------------------------------------------------------------------- 1 | secret: 2 | keys: 3 | - '1' 4 | - '2' 5 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/app2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app2", 3 | "eggModule": { 4 | "name": "app2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/bar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bar", 3 | "eggModule": { 4 | "name": "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/app/modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | module.exports = function(appInfo) { 6 | const config = { 7 | keys: 'test key', 8 | security: { 9 | csrf: { 10 | ignoreJSON: false, 11 | }, 12 | }, 13 | }; 14 | return config; 15 | }; 16 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-multi-inject-multi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-multi-inject-multi" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/app/controller/app.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from 'egg'; 2 | 3 | export default class App extends Controller { 4 | async baseDir() { 5 | const baseDir = await this.ctx.app.module.config.configService.getBaseDir(); 6 | this.ctx.body = { 7 | baseDir, 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/app/extend/application.unittest.ts: -------------------------------------------------------------------------------- 1 | import { MockApplication } from 'egg-mock'; 2 | 3 | export default { 4 | mockUser(this: MockApplication) { 5 | this.mockContext({ 6 | user: { 7 | userName: 'mock_user', 8 | }, 9 | }); 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/app/extend/context.ts: -------------------------------------------------------------------------------- 1 | const COUNTER = Symbol('Context#counter'); 2 | 3 | export default { 4 | get counter() { 5 | if (!this[COUNTER]) { 6 | this[COUNTER] = 0; 7 | } 8 | return this[COUNTER]++; 9 | }, 10 | 11 | get user() { 12 | return {}; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/config', app.controller.app.baseDir); 5 | }; 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/app/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import ConfigService from '../../modules/multi-module-service/ConfigService'; 3 | 4 | declare module 'egg' { 5 | export interface EggModule { 6 | config: { 7 | configService: ConfigService; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/modules/config-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "config-module", 3 | "eggModule": { 4 | "name": "config" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/app-with-no-module-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/background', app.controller.app.background); 5 | app.router.get('/backgroudTimeout', app.controller.app.backgroudTimeout); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-background" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/modules/multi-module-background/CountService.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto() 4 | export class CountService { 5 | count = 0; 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/modules/multi-module-background/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backgroundModule", 3 | "eggModule": { 4 | "name": "backgroundModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/background-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/app/controller/app.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from 'egg'; 2 | 3 | export default class App extends Controller { 4 | async baseDir() { 5 | this.ctx.body = { 6 | foo: this.app.module.constructorSimple.foo.foo, 7 | bar: this.app.module.constructorSimple.foo.bar, 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/app/extend/application.unittest.ts: -------------------------------------------------------------------------------- 1 | import { MockApplication } from 'egg-mock'; 2 | 3 | export default { 4 | mockUser(this: MockApplication) { 5 | this.mockContext({ 6 | user: { 7 | userName: 'mock_user', 8 | }, 9 | }); 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/app/extend/context.ts: -------------------------------------------------------------------------------- 1 | const COUNTER = Symbol('Context#counter'); 2 | 3 | export default { 4 | get counter() { 5 | if (!this[COUNTER]) { 6 | this[COUNTER] = 0; 7 | } 8 | return this[COUNTER]++; 9 | }, 10 | 11 | get user() { 12 | return {}; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/config', app.controller.app.baseDir); 5 | }; 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/app/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import { Foo } from '../../modules/module-with-config/foo'; 3 | import { Bar } from '../../modules/module-with-overwrite-config/bar'; 4 | 5 | declare module 'egg' { 6 | export interface EggModule { 7 | constructorSimple: { 8 | foo: Foo; 9 | }, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/modules/module-with-config/module.unittest.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | bar: 'foo' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/modules/module-with-config/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/modules/module-with-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "constructorSimple", 3 | "eggModule": { 4 | "name": "constructorSimple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/constructor-module-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/dynamicInject', app.controller.app.dynamicInject); 5 | app.router.get('/singletonDynamicInject', app.controller.app.singletonDynamicInject); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/dynamic-inject-module" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/modules/dynamic-inject-module/AbstractContextHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractContextHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/modules/dynamic-inject-module/AbstractSingletonHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSingletonHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/modules/dynamic-inject-module/FooType.ts: -------------------------------------------------------------------------------- 1 | export enum ContextHelloType { 2 | FOO = 'FOO', 3 | BAR = 'BAR', 4 | } 5 | 6 | export enum SingletonHelloType { 7 | FOO = 'FOO', 8 | BAR = 'BAR', 9 | } 10 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/modules/dynamic-inject-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dynamic-inject-module", 3 | "eggModule": { 4 | "name": "dynamicInjectModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/dynamic-inject-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/app/extend/application.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | get appDefineObject() { 3 | return { 4 | from: 'app', 5 | }; 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/app/extend/application.unittest.ts: -------------------------------------------------------------------------------- 1 | import { MockApplication } from 'egg-mock'; 2 | 3 | export default { 4 | mockUser(this: MockApplication) { 5 | this.mockContext({ 6 | user: { 7 | userName: 'mock_user', 8 | }, 9 | }); 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/apps', app.controller.app.find); 5 | app.router.get('/apps2', app.controller.app.find2); 6 | app.router.post('/apps', app.controller.app.save); 7 | }; 8 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-repo" 4 | }, 5 | { 6 | "path": "../modules/multi-module-service" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/modules/multi-module-common/model/App.ts: -------------------------------------------------------------------------------- 1 | export default class App { 2 | name: string; 3 | desc: string; 4 | } 5 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/modules/multi-module-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-common", 3 | "eggModule": { 4 | "name": "multi-module-common" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/modules/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multiModuleRepo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/modules/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/egg-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/app/extend/application.unittest.ts: -------------------------------------------------------------------------------- 1 | import { MockApplication } from 'egg-mock'; 2 | 3 | export default { 4 | mockUser(this: MockApplication) { 5 | this.mockContext({ 6 | user: { 7 | userName: 'mock_user', 8 | }, 9 | }); 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/app/extend/context.ts: -------------------------------------------------------------------------------- 1 | const COUNTER = Symbol('Context#counter'); 2 | 3 | export default { 4 | get counter() { 5 | if (!this[COUNTER]) { 6 | this[COUNTER] = 0; 7 | } 8 | return this[COUNTER]++; 9 | }, 10 | 11 | get user() { 12 | return {}; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/config', app.controller.app.baseDir); 5 | app.router.get('/overwrite_config', app.controller.app.overwriteConfig); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/app/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | import { Foo } from '../../modules/module-with-config/foo'; 3 | import { Bar } from '../../modules/module-with-overwrite-config/bar'; 4 | 5 | declare module 'egg' { 6 | export interface EggModule { 7 | simple: { 8 | foo: Foo; 9 | }, 10 | overwrite: { 11 | bar: Bar; 12 | }, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-config/module.unittest.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | bar: 'foo' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-config/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-overwrite-config/module.unittest.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | bar: 'foo' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-overwrite-config/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/modules/module-with-overwrite-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "overwrite", 3 | "eggModule": { 4 | "name": "overwrite" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/inject-module-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/invalid-inject/app/modules/module-a/BarService.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto, Inject } from '@eggjs/tegg'; 2 | 3 | @SingletonProto() 4 | export class BarService { 5 | @Inject() 6 | doesNotExist: object; 7 | 8 | bar() { 9 | console.log(this.doesNotExist); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/invalid-inject/app/modules/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/invalid-inject/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/invalid-inject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-inject/app/modules/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-inject/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-inject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/app/modules/root/Root.ts: -------------------------------------------------------------------------------- 1 | import { SingletonProto, Inject } from '@eggjs/core-decorator'; 2 | import { UsedProto } from 'used/Used'; 3 | 4 | @SingletonProto() 5 | export class RootProto { 6 | @Inject() usedProto: UsedProto; 7 | } 8 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/app/modules/root/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "eggModule": { 4 | "name": "root" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "dependencies": { 4 | "used": "*", 5 | "unused": "*" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/node_modules/unused/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unused", 3 | "eggModule": { 4 | "name": "unused" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/node_modules/used/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "used", 3 | "eggModule": { 4 | "name": "used" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/optional-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app", 3 | "egg": { 4 | "framework": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/plugin-module/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.eggFooPlugin = { 14 | package: 'foo-plugin', 15 | enable: true, 16 | }; 17 | 18 | exports.watcher = false; 19 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/plugin-module/node_modules/foo-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-foo-plugin", 3 | "eggPlugin": { 4 | "name": "eggFooPlugin" 5 | }, 6 | "eggModule": { 7 | "name": "eggFooPlugin" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/plugin-module/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "dependencies": { 4 | "foo-plugin": "*" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/plugin-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app", 3 | "egg": { 4 | "framework": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/apps', app.controller.app.find); 5 | app.router.post('/apps', app.controller.app.save); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-repo" 4 | }, 5 | { 6 | "path": "../modules/multi-module-service" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/modules/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multi-module-repo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/modules/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/recursive-module-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/app/modules/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/app/modules/module-bar/FooService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export class FooService { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/app/modules/module-bar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-bar", 3 | "eggModule": { 4 | "name": "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/app/modules/module-foo/FooService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export class FooService { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/app/modules/module-foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-foo", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-protos/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-bar/BarService1.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/tegg'; 2 | import { FooService } from '../module-foo/FooService'; 3 | 4 | @SingletonProto() 5 | export class BarService1 { 6 | @Inject() 7 | fooService: FooService; 8 | 9 | type() { 10 | return this.fooService.type; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-bar/BarService2.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/tegg'; 2 | import { FooService } from './FooService'; 3 | 4 | @SingletonProto() 5 | export class BarService2 { 6 | @Inject() 7 | fooService: FooService; 8 | 9 | type() { 10 | return this.fooService.type; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-bar/FooService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, ContextProto } from '@eggjs/tegg'; 2 | 3 | @ContextProto({ accessLevel: AccessLevel.PUBLIC }) 4 | export class FooService { 5 | type = 'context'; 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-bar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-a", 3 | "eggModule": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-foo/FooService.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ accessLevel: AccessLevel.PUBLIC }) 4 | export class FooService { 5 | type = 'singleton'; 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/app/modules/module-foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module-foo", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/same-name-singleton-and-context-proto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-service" 4 | }, 5 | { 6 | "path": "../modules/multi-module-repo" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | exports.watcher = false; 14 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/modules/multi-module-repo/AppRepo.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export default class AppRepo { 7 | 8 | public async findApp(): Promise> { 9 | return {}; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/modules/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multi-module-repo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/modules/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/schedule-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/app/router.ts: -------------------------------------------------------------------------------- 1 | import { Application } from 'egg'; 2 | 3 | module.exports = (app: Application) => { 4 | app.router.get('/apps', app.controller.app.find); 5 | app.router.post('/apps', app.controller.app.save); 6 | }; 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/config/module.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "../modules/multi-module-service" 4 | }, 5 | { 6 | "path": "../modules/multi-module-repo" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.tracer = { 4 | package: 'egg-tracer', 5 | enable: true, 6 | }; 7 | 8 | exports.teggConfig = { 9 | package: '@eggjs/tegg-config', 10 | enable: true, 11 | }; 12 | 13 | 14 | exports.watcher = false; 15 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/modules/multi-module-repo/AppRepo.ts: -------------------------------------------------------------------------------- 1 | import { AccessLevel, SingletonProto } from '@eggjs/tegg'; 2 | 3 | @SingletonProto({ 4 | accessLevel: AccessLevel.PUBLIC, 5 | }) 6 | export default class AppRepo { 7 | 8 | public async findApp(): Promise> { 9 | return {}; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/modules/multi-module-repo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-repo", 3 | "eggModule": { 4 | "name": "multi-module-repo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/modules/multi-module-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-module-service", 3 | "eggModule": { 4 | "name": "multiModuleService" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plugin/tegg/test/fixtures/apps/wrong-order-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /plugin/tegg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /plugin/tegg/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "test" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /standalone/standalone/index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/EggModuleLoader'; 2 | export * from './src/Runner'; 3 | export * from './src/main'; 4 | export * from './src/StandaloneInnerObjectProto'; 5 | export * from './src/StandaloneContext'; 6 | export * from './src/StandaloneInnerObject'; 7 | -------------------------------------------------------------------------------- /standalone/standalone/src/ModuleConfig.ts: -------------------------------------------------------------------------------- 1 | import 'egg'; 2 | 3 | // for declare merging 4 | declare module 'egg' { 5 | export interface ModuleConfig { 6 | // ... 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /standalone/standalone/src/StandaloneContext.ts: -------------------------------------------------------------------------------- 1 | import { AbstractEggContext } from '@eggjs/tegg-runtime'; 2 | import { IdenticalUtil } from '@eggjs/tegg-lifecycle'; 3 | 4 | export class StandaloneContext extends AbstractEggContext { 5 | id: string; 6 | 7 | constructor() { 8 | super(); 9 | this.id = IdenticalUtil.createContextId(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /standalone/standalone/src/StandaloneContextImpl.ts: -------------------------------------------------------------------------------- 1 | import { AbstractEggContext } from '@eggjs/tegg-runtime'; 2 | import { IdenticalUtil } from '@eggjs/tegg'; 3 | 4 | export class StandaloneContextImpl extends AbstractEggContext { 5 | readonly id: string; 6 | 7 | constructor() { 8 | super(); 9 | this.id = IdenticalUtil.createContextId(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/ajv-module-pass/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/ajv-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/aop-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aop-module", 3 | "eggModule": { 4 | "name": "aopModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/custom-context/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "innerobject", 3 | "eggModule": { 4 | "name": "innerobject" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-module/module.yml: -------------------------------------------------------------------------------- 1 | dataSource: 2 | foo: 3 | connectionLimit: 100 4 | database: 'test_dal_standalone' 5 | host: '127.0.0.1' 6 | user: root 7 | port: 3306 8 | timezone: '+08:00' 9 | forkDb: true 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | }, 6 | "dependencies": { 7 | "@eggjs/tegg-dal-plugin": "*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-module/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "skipLibCheck": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-transaction-module/module.yml: -------------------------------------------------------------------------------- 1 | dataSource: 2 | foo: 3 | connectionLimit: 100 4 | database: 'test_dal_standalone' 5 | host: '127.0.0.1' 6 | user: root 7 | port: 3306 8 | timezone: '+08:00' 9 | forkDb: true 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-transaction-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dal", 3 | "eggModule": { 4 | "name": "dal" 5 | }, 6 | "dependencies": { 7 | "@eggjs/tegg-dal-plugin": "*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dal-transaction-module/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "skipLibCheck": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dependency/node_modules/dependency-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dependency-1", 3 | "eggModule": { 4 | "name": "dependency-1" 5 | }, 6 | "dependencies": { 7 | "dependency-2": "*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dependency/node_modules/dependency-2/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dependency/node_modules/dependency-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dependency-2", 3 | "eggModule": { 4 | "name": "dependency2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dependency/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "entry", 3 | "eggModule": { 4 | "name": "entry" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dynamic-inject-module/AbstractContextHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractContextHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dynamic-inject-module/AbstractSingletonHello.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSingletonHello { 2 | abstract hello(): string; 3 | } 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dynamic-inject-module/FooType.ts: -------------------------------------------------------------------------------- 1 | export enum ContextHelloType { 2 | FOO = 'FOO', 3 | BAR = 'BAR', 4 | } 5 | 6 | export enum SingletonHelloType { 7 | FOO = 'FOO', 8 | BAR = 'BAR', 9 | } 10 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/dynamic-inject-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dynamic-inject-module", 3 | "eggModule": { 4 | "name": "dynamicInjectModule" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/inner-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "innerobject", 3 | "eggModule": { 4 | "name": "innerobject" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/invalid-inject/foo.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/tegg'; 2 | import { MainRunner, Runner } from '@eggjs/tegg/standalone'; 3 | 4 | @Runner() 5 | @SingletonProto() 6 | export class Foo implements MainRunner { 7 | @Inject() 8 | doesNotExist?: object; 9 | 10 | async main(): Promise { 11 | return !!this.doesNotExist; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/invalid-inject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "invalid-inject", 3 | "eggModule": { 4 | "name": "invalidInject" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/lifecycle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lifecycle", 3 | "eggModule": { 4 | "name": "lifecycle" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-config/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-empty-config/module.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eggjs/tegg/62d94c77e6f9ce765ff4ab315d4fe0f9ca3d79bd/standalone/standalone/test/fixtures/module-with-empty-config/module.yml -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-empty-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-empty-default-config/module.dev.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'foo' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-empty-default-config/module.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eggjs/tegg/62d94c77e6f9ce765ff4ab315d4fe0f9ca3d79bd/standalone/standalone/test/fixtures/module-with-empty-default-config/module.yml -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-empty-default-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-env-config/module.dev.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'foo' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-env-config/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/module-with-env-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-callback-instance-module/biz/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | logger: 3 | - fooBiz 4 | - barBiz 5 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-callback-instance-module/biz/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-callback-instance-module-biz", 3 | "eggModule": { 4 | "name": "multiCallbackInstanceModuleBiz" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-callback-instance-module/logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-callback-instance-module-logger", 3 | "eggModule": { 4 | "name": "multiCallbackInstanceModuleLogger" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-callback-instance-module/main/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | logger: 3 | - foo 4 | - bar 5 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-callback-instance-module/main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-callback-instance-module-main", 3 | "eggModule": { 4 | "name": "multiCallbackInstanceModuleMain" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-modules/bar/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | bar: 'bar' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-modules/bar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bar", 3 | "eggModule": { 4 | "name": "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-modules/foo/module.yml: -------------------------------------------------------------------------------- 1 | features: 2 | dynamic: 3 | foo: 'bar' 4 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/multi-modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "eggModule": { 4 | "name": "foo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/optional-inject/bar.ts: -------------------------------------------------------------------------------- 1 | import { Inject, SingletonProto } from '@eggjs/tegg'; 2 | import { InjectOptional } from '@eggjs/core-decorator'; 3 | 4 | @SingletonProto() 5 | export class Bar { 6 | constructor( 7 | @InjectOptional() readonly hello?: object, 8 | @Inject({ optional: true }) readonly world?: object, 9 | ) {} 10 | } 11 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/optional-inject/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "optional-inject", 3 | "eggModule": { 4 | "name": "optionalInject" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/runtime-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "runtime-config", 3 | "eggModule": { 4 | "name": "runtime-config" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/test/fixtures/simple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "eggModule": { 4 | "name": "simple" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /standalone/standalone/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /standalone/standalone/tsconfig.pub.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "baseUrl": "./" 6 | }, 7 | "exclude": [ 8 | "dist", 9 | "node_modules", 10 | "test" 11 | ] 12 | } 13 | --------------------------------------------------------------------------------