├── .gitattributes ├── .gitignore ├── .prettierignore ├── .prettierrc.js ├── LICENSE ├── README.md ├── admin.png ├── apps ├── admin │ ├── .eslintrc │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── settings.json │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── README_en-US.md │ ├── config-overrides.js │ ├── docs │ │ ├── build.md │ │ ├── columns.md │ │ ├── components.md │ │ ├── config.md │ │ ├── faqs.md │ │ ├── index.md │ │ ├── mock.md │ │ ├── modelEnhance.md │ │ ├── pageHelper.md │ │ └── start.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── manifest.json │ │ └── polyfill │ │ │ └── ie10.js │ ├── src │ │ ├── __mocks__ │ │ │ ├── charts.js │ │ │ ├── crud.js │ │ │ ├── datatable.js │ │ │ ├── demo.js │ │ │ ├── form.js │ │ │ ├── index.js │ │ │ ├── tree.js │ │ │ └── user.js │ │ ├── assets │ │ │ ├── fonts │ │ │ │ ├── icomoon │ │ │ │ │ ├── icomoon.eot │ │ │ │ │ ├── icomoon.svg │ │ │ │ │ ├── icomoon.ttf │ │ │ │ │ └── icomoon.woff │ │ │ │ └── readme.md │ │ │ ├── images │ │ │ │ ├── avatar.jpg │ │ │ │ ├── bg.jpg │ │ │ │ ├── logo-r.png │ │ │ │ ├── logo.png │ │ │ │ ├── logo1.png │ │ │ │ ├── nodata.svg │ │ │ │ ├── pattern.png │ │ │ │ ├── topbar-bg.jpg │ │ │ │ └── topbar-bg2.jpg │ │ │ └── styles │ │ │ │ ├── animate.css │ │ │ │ ├── iconfont.less │ │ │ │ └── index.less │ │ ├── components │ │ │ ├── BannerMng │ │ │ │ ├── BannerMng.js │ │ │ │ ├── Form.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── BaseComponent │ │ │ │ ├── BaseEventComponent.js │ │ │ │ └── index.js │ │ │ ├── Button │ │ │ │ ├── Button.js │ │ │ │ ├── Ripple.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ ├── index.less │ │ │ │ │ └── ripple.less │ │ │ ├── CSSAnimate │ │ │ │ └── index.js │ │ │ ├── Charts │ │ │ │ ├── ECharts │ │ │ │ │ ├── EC.js │ │ │ │ │ └── index.js │ │ │ │ └── G2 │ │ │ │ │ ├── G2.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Clock │ │ │ │ ├── Clock.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── DataTable │ │ │ │ ├── DataTable.js │ │ │ │ ├── Editable.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Drag │ │ │ │ ├── Drag.js │ │ │ │ ├── index.js │ │ │ │ └── test.js │ │ │ ├── Editor │ │ │ │ ├── Editor.js │ │ │ │ ├── config.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Form │ │ │ │ ├── Form.js │ │ │ │ ├── index.js │ │ │ │ ├── model │ │ │ │ │ ├── autocomplete.js │ │ │ │ │ ├── cascade.js │ │ │ │ │ ├── checkbox.js │ │ │ │ │ ├── custom.js │ │ │ │ │ ├── date.js │ │ │ │ │ ├── editor.js │ │ │ │ │ ├── input.js │ │ │ │ │ ├── number.js │ │ │ │ │ ├── password.js │ │ │ │ │ ├── radio.js │ │ │ │ │ ├── select.js │ │ │ │ │ ├── table.js │ │ │ │ │ ├── transfer.js │ │ │ │ │ ├── transfertree.js │ │ │ │ │ ├── treeselect.js │ │ │ │ │ └── upload.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Icon │ │ │ │ ├── Icon.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── LazyLoad │ │ │ │ ├── LazyLoad.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Loading │ │ │ │ ├── PageLoading.js │ │ │ │ └── PageLoading.less │ │ │ ├── Mask │ │ │ │ ├── index.js │ │ │ │ ├── style │ │ │ │ │ └── index.less │ │ │ │ └── util.js │ │ │ ├── Modal │ │ │ │ ├── ModalForm.js │ │ │ │ ├── ModalSystem.js │ │ │ │ ├── ModalTable.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── NavBar │ │ │ │ ├── NavBar.js │ │ │ │ ├── SearchBox.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ ├── index.less │ │ │ │ │ └── searchbox.less │ │ │ ├── Notification │ │ │ │ ├── Notification.js │ │ │ │ ├── antdNotice.js │ │ │ │ ├── antdNotice.less │ │ │ │ ├── index.js │ │ │ │ ├── normal.js │ │ │ │ └── normal.less │ │ │ ├── Pages │ │ │ │ ├── 403.js │ │ │ │ ├── 404.js │ │ │ │ ├── 500.js │ │ │ │ ├── Coming.js │ │ │ │ ├── Result.js │ │ │ │ ├── ScreenLock.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ ├── 403.less │ │ │ │ │ ├── 404.less │ │ │ │ │ ├── 500.less │ │ │ │ │ ├── coming.less │ │ │ │ │ ├── images │ │ │ │ │ ├── balk.png │ │ │ │ │ ├── error.gif │ │ │ │ │ ├── error403.svg │ │ │ │ │ ├── saw.png │ │ │ │ │ └── workers.png │ │ │ │ │ ├── index.less │ │ │ │ │ ├── result.less │ │ │ │ │ └── screenLock.less │ │ │ ├── Panel │ │ │ │ ├── Panel.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── PatternLock │ │ │ │ ├── PatternLock.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Portal │ │ │ │ └── index.js │ │ │ ├── Print │ │ │ │ ├── Print.js │ │ │ │ └── index.js │ │ │ ├── SearchBar │ │ │ │ ├── SearchBar.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── SideBar │ │ │ │ ├── LeftSideBar.js │ │ │ │ ├── RightSideBar.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ ├── darkgrey.less │ │ │ │ │ └── index.less │ │ │ ├── SideLayout │ │ │ │ ├── SideLayout.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── SkinToolbox │ │ │ │ ├── LayoutBox.js │ │ │ │ ├── NavBarBox.js │ │ │ │ ├── SideBarBox.js │ │ │ │ ├── SkinToolbox.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Toolbar │ │ │ │ ├── Toolbar.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── TopBar │ │ │ │ ├── TopBar.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── TransferTree │ │ │ │ ├── List.js │ │ │ │ ├── ListTree.js │ │ │ │ ├── Search.js │ │ │ │ ├── TransferTree.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── Upload │ │ │ │ ├── Upload.js │ │ │ │ └── index.js │ │ │ ├── Video │ │ │ │ ├── Video.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ ├── WaterFall │ │ │ │ ├── WaterFall.js │ │ │ │ ├── index.js │ │ │ │ └── style │ │ │ │ │ └── index.less │ │ │ └── index.js │ │ ├── config.js │ │ ├── decorator │ │ │ ├── breadcrumb.js │ │ │ ├── coming.js │ │ │ ├── index.js │ │ │ └── resizeMe.js │ │ ├── index.js │ │ ├── layouts │ │ │ ├── BasicLayout.js │ │ │ ├── CardLayout.js │ │ │ ├── TabsLayout.js │ │ │ ├── UserLayout.js │ │ │ └── styles │ │ │ │ ├── basic.less │ │ │ │ ├── card.less │ │ │ │ ├── tabs.less │ │ │ │ └── user.less │ │ ├── models │ │ │ └── global.js │ │ ├── routes │ │ │ ├── Blank │ │ │ │ ├── components │ │ │ │ │ ├── index.js │ │ │ │ │ ├── index.less │ │ │ │ │ └── index.module.less │ │ │ │ ├── index.js │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ ├── Business │ │ │ │ └── CRUD │ │ │ │ │ ├── components │ │ │ │ │ ├── columns.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.less │ │ │ │ │ ├── index.js │ │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ │ ├── routers │ │ │ │ │ └── Detail │ │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── model │ │ │ │ │ │ └── index.js │ │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ ├── Dashboard │ │ │ │ ├── components │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.less │ │ │ │ ├── index.js │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ ├── Login │ │ │ │ ├── components │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.less │ │ │ │ ├── index.js │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ ├── Pages │ │ │ │ ├── 403.js │ │ │ │ ├── 404.js │ │ │ │ └── 500.js │ │ │ ├── Register │ │ │ │ ├── components │ │ │ │ │ ├── Success.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.less │ │ │ │ ├── index.js │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ ├── UI │ │ │ │ ├── Alerts │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── Button │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ └── index.js │ │ │ │ ├── CSSAnimate │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ └── index.js │ │ │ │ ├── Editor │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── Icon │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ └── index.js │ │ │ │ └── Mask │ │ │ │ │ ├── components │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ ├── Widgets │ │ │ │ ├── Banner │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── BaseComponent │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── Charts │ │ │ │ │ ├── EC │ │ │ │ │ │ ├── components │ │ │ │ │ │ │ ├── Bar.js │ │ │ │ │ │ │ ├── Gauge.js │ │ │ │ │ │ │ ├── Line.js │ │ │ │ │ │ │ ├── Map.js │ │ │ │ │ │ │ ├── Pie.js │ │ │ │ │ │ │ ├── Radar.js │ │ │ │ │ │ │ ├── Scatter.js │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── G2 │ │ │ │ │ │ ├── components │ │ │ │ │ │ │ ├── Bar.js │ │ │ │ │ │ │ ├── Gauge.js │ │ │ │ │ │ │ ├── Line.js │ │ │ │ │ │ │ ├── Map.js │ │ │ │ │ │ │ ├── Pie.js │ │ │ │ │ │ │ ├── Pie2.js │ │ │ │ │ │ │ ├── Radar.js │ │ │ │ │ │ │ ├── Scatter.js │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── data │ │ │ │ │ │ │ ├── earthquake.json │ │ │ │ │ │ │ └── world.geo.json │ │ │ │ │ │ └── index.js │ │ │ │ │ └── components │ │ │ │ │ │ ├── SideLayout.js │ │ │ │ │ │ └── index.less │ │ │ │ ├── Column │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── Coming │ │ │ │ │ └── index.js │ │ │ │ ├── DataTable │ │ │ │ │ ├── components │ │ │ │ │ │ ├── columns.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ ├── index.js │ │ │ │ │ ├── model │ │ │ │ │ │ └── index.js │ │ │ │ │ └── service │ │ │ │ │ │ └── index.js │ │ │ │ ├── Form │ │ │ │ │ ├── components │ │ │ │ │ │ ├── columns.js │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── model │ │ │ │ │ │ └── index.js │ │ │ │ ├── Gallery │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ └── index.js │ │ │ │ ├── LevelRoute │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ ├── index.js │ │ │ │ │ ├── model │ │ │ │ │ │ └── index.js │ │ │ │ │ └── routes │ │ │ │ │ │ └── SubRoute │ │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── model │ │ │ │ │ │ └── index.js │ │ │ │ ├── Print │ │ │ │ │ ├── components │ │ │ │ │ │ ├── Dynamic.js │ │ │ │ │ │ ├── Report.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── report.less │ │ │ │ │ └── index.js │ │ │ │ ├── Result │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── ScreenLock │ │ │ │ │ └── index.js │ │ │ │ ├── SearchBar │ │ │ │ │ ├── components │ │ │ │ │ │ ├── columns.js │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── Toolbar │ │ │ │ │ ├── components │ │ │ │ │ │ ├── columns.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── index.less │ │ │ │ │ ├── index.js │ │ │ │ │ ├── model │ │ │ │ │ │ └── index.js │ │ │ │ │ └── service │ │ │ │ │ │ └── index.js │ │ │ │ └── TransferTree │ │ │ │ │ ├── components │ │ │ │ │ └── index.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── model │ │ │ │ │ └── index.js │ │ │ │ │ └── service │ │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── serviceWorker.js │ │ ├── setupProxy.js │ │ └── utils │ │ │ ├── core.js │ │ │ ├── enquireScreen.js │ │ │ ├── modelEnhance.js │ │ │ ├── packMock.js │ │ │ └── pageHelper │ │ │ ├── PageInfo.js │ │ │ └── index.js │ ├── templates │ │ └── routes │ │ │ ├── Blank │ │ │ ├── components │ │ │ │ ├── index.js │ │ │ │ └── index.less │ │ │ ├── index.js │ │ │ ├── model │ │ │ │ └── index.js │ │ │ └── service │ │ │ │ └── index.js │ │ │ └── CRUD │ │ │ ├── components │ │ │ ├── columns.js │ │ │ ├── index.js │ │ │ └── index.less │ │ │ ├── index.js │ │ │ ├── model │ │ │ └── index.js │ │ │ └── service │ │ │ └── index.js │ └── yarn.lock ├── applet │ ├── .github │ │ └── workflows │ │ │ └── mirror.yml │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── src │ │ ├── app.config.js │ │ ├── app.css │ │ ├── app.js │ │ └── pages │ │ │ └── index │ │ │ ├── index.js │ │ │ └── index.module.css │ └── yarn.lock └── service │ ├── .gitignore │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ ├── app.controller.spec.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── app.service.ts │ ├── bll │ │ ├── bll.module.ts │ │ ├── index.ts │ │ └── user │ │ │ ├── controllers │ │ │ ├── admin.controller.ts │ │ │ ├── index.ts │ │ │ └── user.controller.ts │ │ │ ├── index.ts │ │ │ ├── models │ │ │ ├── admin.model.ts │ │ │ ├── base-user.model.ts │ │ │ ├── index.ts │ │ │ └── user.model.ts │ │ │ ├── notifiables │ │ │ ├── index.ts │ │ │ └── user.notifiable.ts │ │ │ ├── repositories │ │ │ ├── admin.repository.ts │ │ │ ├── base-user.repository.ts │ │ │ ├── index.ts │ │ │ └── user.repository.ts │ │ │ ├── seeders │ │ │ ├── admin.seeder.ts │ │ │ └── index.ts │ │ │ ├── services │ │ │ ├── admin.service.ts │ │ │ ├── base-user.service.ts │ │ │ ├── index.ts │ │ │ └── user.service.ts │ │ │ └── user.module.ts │ ├── cli │ │ ├── cli.module.ts │ │ ├── commands │ │ │ ├── index.ts │ │ │ └── mongo.command.ts │ │ └── index.ts │ ├── common │ │ ├── common.module.ts │ │ ├── constants.ts │ │ ├── core │ │ │ ├── core.constants.ts │ │ │ ├── core.controllers.ts │ │ │ ├── core.decorators.ts │ │ │ ├── core.enums.ts │ │ │ ├── core.explorer.ts │ │ │ ├── core.injectable.ts │ │ │ ├── core.interfaces.ts │ │ │ ├── core.module.ts │ │ │ ├── core.repositories.ts │ │ │ ├── core.schemas.ts │ │ │ ├── core.services.ts │ │ │ └── index.ts │ │ ├── decorators.ts │ │ ├── index.ts │ │ └── providers.ts │ ├── config │ │ ├── app.ts │ │ ├── cache.ts │ │ ├── crypt.ts │ │ ├── logger.ts │ │ └── mongo.ts │ ├── console.ts │ ├── env │ │ ├── .env │ │ ├── .env.development │ │ └── .gitignore │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── docker-compose.yml ├── docs ├── .gitignore ├── README.md ├── blog │ └── 2019-12-18-nodejs-01.md ├── docs │ ├── introduction.md │ ├── module.md │ └── modules │ │ ├── config.md │ │ ├── core.md │ │ ├── event-bus.md │ │ ├── logger.md │ │ ├── mailer.md │ │ ├── rule-engine.md │ │ └── workflow.md ├── docusaurus.config.js ├── package.json ├── sidebars.js ├── src │ ├── css │ │ └── custom.css │ └── pages │ │ ├── index.js │ │ └── styles.module.css ├── static │ └── img │ │ ├── favicon.ico │ │ ├── logo-h.png │ │ ├── logo.png │ │ ├── logo.svg │ │ ├── undraw_operating.svg │ │ ├── undraw_programming.svg │ │ └── undraw_testing.svg └── yarn.lock ├── examples ├── 01-config │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ ├── config │ │ │ └── app.ts │ │ ├── env │ │ │ ├── .env.development │ │ │ ├── .env.production │ │ │ └── .env.test │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── 02-logger │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── 03-mailer │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ ├── welcome.html │ └── yarn.lock ├── 04-event-bus │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ ├── app.subscriber.ts │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── 05-rule-engine │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ │ ├── app.controller.spec.ts │ │ ├── app.controller.ts │ │ ├── app.module.ts │ │ ├── app.service.ts │ │ ├── app.subscriber.ts │ │ └── main.ts │ ├── test │ │ ├── app.e2e-spec.ts │ │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock └── 06-workflow │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── nest-cli.json │ ├── package.json │ ├── src │ ├── app.controller.spec.ts │ ├── app.controller.ts │ ├── app.module.ts │ ├── app.service.ts │ └── main.ts │ ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── arena │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── arena.constants.ts │ │ ├── arena.interfaces.ts │ │ ├── arena.module.ts │ │ ├── arena.service.ts │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── bullring │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── bootstrap.spec.ts │ │ ├── bull │ │ │ ├── bull.constants.ts │ │ │ ├── bull.interfaces.ts │ │ │ ├── bull.service.ts │ │ │ ├── controllers │ │ │ │ ├── index.ts │ │ │ │ └── queue.controller.ts │ │ │ ├── dtos │ │ │ │ ├── clean-job.dto.ts │ │ │ │ ├── get-jobs.dto.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── config │ ├── .gitignore │ ├── package.json │ ├── src │ │ ├── LICENSE │ │ ├── config.constants.ts │ │ ├── config.helper.ts │ │ ├── config.module.spec.ts │ │ ├── config.module.ts │ │ ├── config.service.spec.ts │ │ ├── config.service.ts │ │ ├── config │ │ │ └── app.ts │ │ ├── decorators │ │ │ ├── config-param.ts │ │ │ ├── configurable.ts │ │ │ ├── index.ts │ │ │ └── proxy.ts │ │ ├── env │ │ │ ├── .env.development │ │ │ ├── .env.production │ │ │ └── .env.test │ │ ├── index.ts │ │ └── utils.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── console │ ├── .gitignore │ ├── LICENSE │ ├── dist │ │ ├── console.constants.d.ts │ │ ├── console.constants.js │ │ ├── console.constants.js.map │ │ ├── console.decorators.d.ts │ │ ├── console.decorators.js │ │ ├── console.decorators.js.map │ │ ├── console.interfaces.d.ts │ │ ├── console.interfaces.js │ │ ├── console.interfaces.js.map │ │ ├── console.module.d.ts │ │ ├── console.module.js │ │ ├── console.module.js.map │ │ ├── console.providers.d.ts │ │ ├── console.providers.js │ │ ├── console.providers.js.map │ │ ├── console.service.d.ts │ │ ├── console.service.js │ │ ├── console.service.js.map │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── index.js.map │ │ └── test │ │ │ ├── command.d.ts │ │ │ ├── command.js │ │ │ ├── command.js.map │ │ │ ├── console.d.ts │ │ │ ├── console.js │ │ │ ├── console.js.map │ │ │ ├── module.d.ts │ │ │ ├── module.js │ │ │ └── module.js.map │ ├── package.json │ ├── src │ │ ├── console.constants.ts │ │ ├── console.decorators.ts │ │ ├── console.interfaces.ts │ │ ├── console.module.spec.ts │ │ ├── console.module.ts │ │ ├── console.providers.ts │ │ ├── console.service.ts │ │ ├── index.ts │ │ └── test │ │ │ ├── command.ts │ │ │ ├── console.ts │ │ │ └── module.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── core │ ├── .gitignore │ ├── LICENSE │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── interfaces │ │ │ ├── cache.interface.ts │ │ │ ├── config.interface.ts │ │ │ ├── event.interface.ts │ │ │ ├── index.ts │ │ │ ├── logger.interface.ts │ │ │ ├── notification.interface.ts │ │ │ └── task-queue.interface.ts │ │ ├── traits │ │ │ ├── frequencies.trait.spec.ts │ │ │ ├── frequencies.trait.ts │ │ │ ├── index.ts │ │ │ ├── trait.spec.ts │ │ │ └── trait.ts │ │ └── utils │ │ │ ├── compose.spec.ts │ │ │ ├── compose.ts │ │ │ ├── index.ts │ │ │ └── metadata-explorer.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── crypt │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── crypt.constants.ts │ │ ├── crypt.interfaces.ts │ │ ├── crypt.module.spec.ts │ │ ├── crypt.module.ts │ │ ├── crypt.service.spec.ts │ │ ├── crypt.service.ts │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── event-bus │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── event-bus.constants.ts │ │ ├── event-bus.decorators.ts │ │ ├── event-bus.explorer.ts │ │ ├── event-bus.interfaces.ts │ │ ├── event-bus.module.ts │ │ ├── event-bus.service.spec.ts │ │ ├── event-bus.service.ts │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── logger │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── logger.constants.ts │ │ ├── logger.decorators.ts │ │ ├── logger.enums.ts │ │ ├── logger.interfaces.ts │ │ ├── logger.module.spec.ts │ │ ├── logger.module.ts │ │ └── logger.service.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── mailer │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── adapters │ │ │ ├── art.adapter.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── mailer.constants.ts │ │ ├── mailer.decorators.ts │ │ ├── mailer.interfaces.ts │ │ ├── mailer.module.spec.ts │ │ ├── mailer.module.ts │ │ ├── mailer.service.spec.ts │ │ └── mailer.service.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ ├── welcome.html │ └── yarn.lock ├── mongo-seeder │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── seeder.constants.ts │ │ ├── seeder.decorators.ts │ │ ├── seeder.interfaces.ts │ │ ├── seeder.module.ts │ │ └── seeder.service.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── notification │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── notification.constants.ts │ │ ├── notification.decorators.ts │ │ ├── notification.interfaces.ts │ │ ├── notification.module.ts │ │ ├── notification.service.spec.ts │ │ └── notification.service.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── rule-engine │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── core │ │ │ ├── index.ts │ │ │ ├── rule-builder.spec.ts │ │ │ ├── rule-builder.ts │ │ │ ├── rule-engine.spec.ts │ │ │ ├── rule-engine.ts │ │ │ ├── rule.spec.ts │ │ │ └── rule.ts │ │ ├── index.ts │ │ ├── interfaces │ │ │ ├── index.ts │ │ │ └── rule.interface.ts │ │ ├── rule-engine.constants.ts │ │ ├── rule-engine.decorators.ts │ │ ├── rule-engine.interfaces.ts │ │ ├── rule-engine.module.ts │ │ ├── rule-engine.service.spec.ts │ │ ├── rule-engine.service.ts │ │ └── types │ │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── task-queue │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── verification │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── verification.spec.ts │ │ └── verification.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock └── workflow │ ├── .gitignore │ ├── LICENSE │ ├── package.json │ ├── src │ ├── core │ │ ├── abstract-workflow.ts │ │ ├── index.ts │ │ ├── task-result.ts │ │ ├── workflow-engine.spec.ts │ │ └── workflow-engine.ts │ ├── flows │ │ ├── conditional.flow.spec.ts │ │ ├── conditional.flow.ts │ │ ├── index.ts │ │ ├── parallel.flow.spec.ts │ │ ├── parallel.flow.ts │ │ ├── race.flow.spec.ts │ │ ├── race.flow.ts │ │ ├── repeat.flow.spec.ts │ │ ├── repeat.flow.ts │ │ ├── sequential.flow.spec.ts │ │ └── sequential.flow.ts │ ├── index.ts │ ├── predicates │ │ ├── frequencies.predicate.ts │ │ ├── index.ts │ │ └── task-predicate.ts │ ├── tasks │ │ ├── index.ts │ │ └── no-op.task.ts │ ├── workflow.constants.ts │ ├── workflow.decorators.ts │ ├── workflow.enums.ts │ ├── workflow.interfaces.ts │ ├── workflow.module.ts │ ├── workflow.service.spec.ts │ └── workflow.service.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── renovate.json ├── scripts └── docker-entrypoint-initdb.d │ └── init.js ├── tsconfig.json └── yarn.lock /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-language=TypeScript -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ -------------------------------------------------------------------------------- /admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/admin.png -------------------------------------------------------------------------------- /apps/admin/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "react-app", 3 | "parserOptions": { 4 | "ecmaFeatures": { 5 | "legacyDecorators": true 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/admin/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /apps/admin/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "chrome", 6 | "request": "launch", 7 | "name": "启动 Chrome 并打开 localhost", 8 | "url": "http://localhost:3000", 9 | "webRoot": "${workspaceFolder}" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /apps/admin/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // 将设置放入此文件中以覆盖默认值和用户设置。 2 | { 3 | "editor.tabSize": 2, 4 | "editor.renderIndentGuides": true, 5 | "eslint.enable": true, 6 | "prettier.singleQuote": true, 7 | "javascript.implicitProjectConfig.experimentalDecorators": true, 8 | } -------------------------------------------------------------------------------- /apps/admin/docs/components.md: -------------------------------------------------------------------------------- 1 | # Components 自带组件 2 | 3 | to be continued -------------------------------------------------------------------------------- /apps/admin/docs/index.md: -------------------------------------------------------------------------------- 1 | - [如何开始](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/start.md) 2 | - [全局配置](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/config.md) 3 | - [modelEnhance用法](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/modelEnhance.md) 4 | - [pageHelper用法](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/pageHelper.md) 5 | - [组件](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/components.md) 6 | - [接口数据模拟](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/mock.md) 7 | - [打包](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/build.md) 8 | - [FAQs](https://github.com/LANIF-UI/dva-boot-admin/blob/master/docs/faqs.md) -------------------------------------------------------------------------------- /apps/admin/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/public/favicon.ico -------------------------------------------------------------------------------- /apps/admin/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /apps/admin/src/__mocks__/form.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 表单form示例中的模拟数据 3 | */ 4 | export default ({ fetchMock, delay, mock, toSuccess, toError }) => { 5 | // 模拟自动完成反回的数据 6 | return { 7 | '/api/form/autoComplete': options => { 8 | const body = JSON.parse(options.body); 9 | const userName = body; 10 | 11 | return toSuccess( 12 | mock({ 13 | 'list|3-10': [{ 14 | 'id': '@id', 15 | 'name': userName + '@cword("零一二三四五六七八九十", 1, 2)', // 张三,赵四 16 | 'age|1-100': 100, // 100以内随机整数 17 | 'birthday': '@date("yyyy-MM-dd")', // 日期 18 | 'city': '@city(true)', // 中国城市 19 | 'phone': /^1[385][1-9]\d{8}/, // 手机号 20 | 'content': '@csentence', 21 | }] 22 | }), 23 | 400 24 | ); 25 | } 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /apps/admin/src/__mocks__/index.js: -------------------------------------------------------------------------------- 1 | // http://www.wheresrhys.co.uk/fetch-mock/api 2 | import packMock from '@/utils/packMock'; 3 | import user from './user'; 4 | import crud from './crud'; 5 | import tree from './tree'; 6 | import datatable from './datatable'; 7 | import charts from './charts'; 8 | import formData from './form'; 9 | /** 10 | * 加载mock文件 11 | * packMock(mock1[,mock2]) 12 | */ 13 | packMock( 14 | user, 15 | crud, 16 | tree, 17 | datatable, 18 | charts, 19 | formData, 20 | ); -------------------------------------------------------------------------------- /apps/admin/src/assets/fonts/icomoon/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/fonts/icomoon/icomoon.eot -------------------------------------------------------------------------------- /apps/admin/src/assets/fonts/icomoon/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/fonts/icomoon/icomoon.ttf -------------------------------------------------------------------------------- /apps/admin/src/assets/fonts/icomoon/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/fonts/icomoon/icomoon.woff -------------------------------------------------------------------------------- /apps/admin/src/assets/fonts/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/fonts/readme.md -------------------------------------------------------------------------------- /apps/admin/src/assets/images/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/avatar.jpg -------------------------------------------------------------------------------- /apps/admin/src/assets/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/bg.jpg -------------------------------------------------------------------------------- /apps/admin/src/assets/images/logo-r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/logo-r.png -------------------------------------------------------------------------------- /apps/admin/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/logo.png -------------------------------------------------------------------------------- /apps/admin/src/assets/images/logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/logo1.png -------------------------------------------------------------------------------- /apps/admin/src/assets/images/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/pattern.png -------------------------------------------------------------------------------- /apps/admin/src/assets/images/topbar-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/topbar-bg.jpg -------------------------------------------------------------------------------- /apps/admin/src/assets/images/topbar-bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/assets/images/topbar-bg2.jpg -------------------------------------------------------------------------------- /apps/admin/src/assets/styles/animate.css: -------------------------------------------------------------------------------- 1 | /* Animate.css Helpers */ 2 | .sparkline-delay { 3 | position: absolute; 4 | bottom: 0; 5 | width: 40px; 6 | height: 35px; 7 | line-height: 24px; 8 | } 9 | .animated.animated-delay { 10 | animation-delay: .6s !important; 11 | } 12 | .animated.animated-short { 13 | animation-duration: 0.6s !important; 14 | } 15 | .animated.animated-shorter { 16 | animation-duration: 0.3s !important; 17 | } 18 | .animated.animated-long { 19 | animation-duration: 1.4s !important; 20 | } 21 | .animated.animated-longer { 22 | animation-duration: 2s !important; 23 | } -------------------------------------------------------------------------------- /apps/admin/src/components/BannerMng/index.js: -------------------------------------------------------------------------------- 1 | import BannerMng from './BannerMng'; 2 | 3 | export default BannerMng; -------------------------------------------------------------------------------- /apps/admin/src/components/BaseComponent/BaseEventComponent.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import BaseComponent from './index'; 3 | 4 | /** 5 | * 带基本事件支持的组件基类 6 | */ 7 | class BaseEventComponent extends BaseComponent { 8 | render() { 9 | return
; 10 | } 11 | } 12 | 13 | export default BaseEventComponent; 14 | -------------------------------------------------------------------------------- /apps/admin/src/components/Button/index.js: -------------------------------------------------------------------------------- 1 | import Button from './Button'; 2 | import Ripple from './Ripple'; 3 | 4 | Button.Ripple = Ripple; 5 | export default Button; -------------------------------------------------------------------------------- /apps/admin/src/components/Button/style/index.less: -------------------------------------------------------------------------------- 1 | .antui-button-tooltip { 2 | padding-bottom: 2px; 3 | .ant-tooltip-arrow { 4 | display: none; 5 | } 6 | } -------------------------------------------------------------------------------- /apps/admin/src/components/Charts/ECharts/index.js: -------------------------------------------------------------------------------- 1 | // 引入全部echarts包,若想按需加载则直接引EC.js 2 | import 'echarts'; 3 | import EC, { echarts } from './EC'; 4 | 5 | export { echarts }; 6 | export default EC; 7 | -------------------------------------------------------------------------------- /apps/admin/src/components/Charts/G2/index.js: -------------------------------------------------------------------------------- 1 | // 全局 G2 设置 2 | import { track, setTheme } from 'bizcharts'; 3 | import G2 from './G2'; 4 | 5 | const config = { 6 | defaultColor: '#1089ff', 7 | shape: { 8 | interval: { 9 | fillOpacity: 1 10 | } 11 | } 12 | }; 13 | 14 | track(false); 15 | setTheme(config); 16 | export default G2; 17 | -------------------------------------------------------------------------------- /apps/admin/src/components/Charts/G2/style/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Charts/G2/style/index.less -------------------------------------------------------------------------------- /apps/admin/src/components/Clock/index.js: -------------------------------------------------------------------------------- 1 | import Clock from './Clock'; 2 | 3 | export default Clock; -------------------------------------------------------------------------------- /apps/admin/src/components/Clock/style/index.less: -------------------------------------------------------------------------------- 1 | @import "~antd/lib/style/themes/default.less"; 2 | 3 | .antui-clock { 4 | > .date { 5 | font-size: 20px; 6 | letter-spacing: 0.3px; 7 | text-align: right; 8 | } 9 | > ul { 10 | text-align: right; 11 | list-style: none; 12 | margin: 0; 13 | padding: 0; 14 | > li { 15 | display: inline; 16 | font-family: Roboto; 17 | font-size: 60px; 18 | font-weight: 900; 19 | &.point { 20 | padding: 0 4px; 21 | animation: 1s ease 0s normal none infinite flash; 22 | position: relative; 23 | top: -5px; 24 | } 25 | } 26 | } 27 | } 28 | 29 | @keyframes flash{ 30 | 0% {opacity:1.0;} 31 | 50% {opacity:0; } 32 | 100% {opacity:1.0;} 33 | } -------------------------------------------------------------------------------- /apps/admin/src/components/DataTable/index.js: -------------------------------------------------------------------------------- 1 | import DataTable, { Tip, Oper, Paging } from './DataTable'; 2 | import { Editable, EditableOper } from './Editable'; 3 | export { Tip, Oper, Paging, Editable, EditableOper }; 4 | export default DataTable; 5 | -------------------------------------------------------------------------------- /apps/admin/src/components/Drag/index.js: -------------------------------------------------------------------------------- 1 | import Drag from './Drag'; 2 | 3 | export default Drag; -------------------------------------------------------------------------------- /apps/admin/src/components/Editor/index.js: -------------------------------------------------------------------------------- 1 | import Editor from './Editor'; 2 | 3 | export default Editor; -------------------------------------------------------------------------------- /apps/admin/src/components/Editor/style/index.less: -------------------------------------------------------------------------------- 1 | .antui-editor { 2 | .w-e-toolbar { 3 | flex-wrap: wrap; 4 | .w-e-menu { 5 | &:hover { 6 | z-index: 10002 !important; 7 | } 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /apps/admin/src/components/Form/index.js: -------------------------------------------------------------------------------- 1 | import Form from './Form'; 2 | 3 | export default Form; -------------------------------------------------------------------------------- /apps/admin/src/components/Form/model/custom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 自定义表单元件, 3 | * 在column中如果需要用form控制 4 | * 5 | return form.getFieldDecorator('xxx')( 6 | // ... 7 | ); 8 | */ 9 | export default ({form, render, record, ...otherProps}) => { 10 | return render(record, form, otherProps); 11 | }; -------------------------------------------------------------------------------- /apps/admin/src/components/Icon/index.js: -------------------------------------------------------------------------------- 1 | import Icon from './Icon'; 2 | 3 | export default Icon; -------------------------------------------------------------------------------- /apps/admin/src/components/Icon/style/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Icon/style/index.less -------------------------------------------------------------------------------- /apps/admin/src/components/LazyLoad/index.js: -------------------------------------------------------------------------------- 1 | import LazyLoad from './LazyLoad'; 2 | 3 | export default LazyLoad; -------------------------------------------------------------------------------- /apps/admin/src/components/Loading/PageLoading.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './PageLoading.less' 3 | 4 | /** 5 | * 加载效果示例 6 | */ 7 | export default ({loading, style = 'style1'}) => 8 | loading ?
: null; -------------------------------------------------------------------------------- /apps/admin/src/components/Mask/style/index.less: -------------------------------------------------------------------------------- 1 | @import "~antd/lib/style/themes/default.less"; 2 | // mask 3 | .basic-mask { 4 | z-index: 9998; 5 | display: none; 6 | position: fixed; 7 | left: 0; 8 | right: 0; 9 | top: 0; 10 | bottom: 0; 11 | background: rgba(0, 0, 0, 0.6); 12 | .basic-mask-close { 13 | cursor: pointer; 14 | position: absolute; 15 | right: 12px; 16 | top: 12px; 17 | font-size: 3rem; 18 | color: #bdbdbd; 19 | transition: color .3s; 20 | &:hover { 21 | color: #ddd; 22 | } 23 | &:active { 24 | color: #bdbdbd; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /apps/admin/src/components/Mask/util.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Mask/util.js -------------------------------------------------------------------------------- /apps/admin/src/components/Modal/ModalSystem.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Modal/ModalSystem.js -------------------------------------------------------------------------------- /apps/admin/src/components/Modal/index.js: -------------------------------------------------------------------------------- 1 | import ModalForm from './ModalForm'; 2 | import ModalTable from './ModalTable'; 3 | 4 | export { 5 | ModalForm, 6 | ModalTable 7 | } -------------------------------------------------------------------------------- /apps/admin/src/components/NavBar/index.js: -------------------------------------------------------------------------------- 1 | import NavBar from './NavBar'; 2 | 3 | export default NavBar; -------------------------------------------------------------------------------- /apps/admin/src/components/Notification/Notification.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 通知接口,需要子类实现 3 | */ 4 | export default class Notification { 5 | static success(config) {/* 成功 */} 6 | 7 | static error(config) {/* 失败 */} 8 | 9 | static info(config) {/* 信息 */} 10 | 11 | static warning(config) {/* 警告 */} 12 | 13 | static warn(config) {/* 警告 */} 14 | 15 | static close(key) {/* 关闭 */} 16 | 17 | static destroy() {/* 销毁 */} 18 | } 19 | -------------------------------------------------------------------------------- /apps/admin/src/components/Notification/index.js: -------------------------------------------------------------------------------- 1 | import normal from './normal'; 2 | import antdNotice from './antdNotice'; 3 | 4 | export { 5 | normal, antdNotice 6 | }; 7 | -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/index.js: -------------------------------------------------------------------------------- 1 | import './style/index.less'; 2 | import Coming from './Coming'; 3 | import ScreenLock from './ScreenLock'; 4 | import P403 from './403'; 5 | import P404 from './404'; 6 | import P500 from './500'; 7 | import Result from './Result'; 8 | 9 | export { Coming, ScreenLock, Result, P403, P404, P500 }; 10 | 11 | export default { 12 | Coming, 13 | ScreenLock, 14 | P403, 15 | P404, 16 | P500, 17 | Result 18 | }; 19 | -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/403.less: -------------------------------------------------------------------------------- 1 | .page403 { 2 | background: #fff; 3 | .ant-layout-content { 4 | overflow: hidden !important; 5 | } 6 | .error-block { 7 | margin: 50px 8 | } 9 | .center-block { 10 | margin: 0 100px; 11 | .error-title { 12 | font-size: 60px; 13 | font-weight: 800; 14 | color: #444; 15 | margin-bottom: 10px; 16 | } 17 | .error-subtitle { 18 | font-weight: 400; 19 | font-size: 32px; 20 | color: #444; 21 | margin-bottom: 80px; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/500.less: -------------------------------------------------------------------------------- 1 | .page500 { 2 | background: #fff; 3 | .ant-layout-content { 4 | overflow: hidden !important; 5 | } 6 | .error-block { 7 | margin: 50px 8 | } 9 | .center-block { 10 | margin: 0 100px; 11 | .error-title { 12 | font-size: 60px; 13 | font-weight: 800; 14 | color: #444; 15 | margin-bottom: 10px; 16 | } 17 | .error-subtitle { 18 | font-weight: 400; 19 | font-size: 32px; 20 | color: #444; 21 | margin-bottom: 80px; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/images/balk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Pages/style/images/balk.png -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/images/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Pages/style/images/error.gif -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/images/saw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Pages/style/images/saw.png -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/images/workers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Pages/style/images/workers.png -------------------------------------------------------------------------------- /apps/admin/src/components/Pages/style/index.less: -------------------------------------------------------------------------------- 1 | @import "~antd/lib/style/themes/default.less"; 2 | @import './screenLock.less'; 3 | @import './coming.less'; 4 | @import './403.less'; 5 | @import './404.less'; 6 | @import './500.less'; 7 | @import './result.less'; 8 | 9 | .backhome { 10 | position: absolute; 11 | border: 1px solid #89949b; 12 | border-radius: 50%; 13 | width: 40px; 14 | height: 40px; 15 | line-height: 0px; 16 | color: #89949b; 17 | top: 20px; 18 | font-size: 48px; 19 | left: 20px; 20 | overflow: hidden; 21 | &:hover { 22 | color: @primary-color; 23 | border-color: @primary-color; 24 | background: #fff; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /apps/admin/src/components/Panel/index.js: -------------------------------------------------------------------------------- 1 | import Panel from './Panel'; 2 | 3 | export default Panel; -------------------------------------------------------------------------------- /apps/admin/src/components/Print/index.js: -------------------------------------------------------------------------------- 1 | import Print from './Print'; 2 | 3 | export default Print; -------------------------------------------------------------------------------- /apps/admin/src/components/SearchBar/index.js: -------------------------------------------------------------------------------- 1 | import SearchBar from './SearchBar'; 2 | 3 | export default SearchBar; -------------------------------------------------------------------------------- /apps/admin/src/components/SideBar/index.js: -------------------------------------------------------------------------------- 1 | import LeftSideBar from './LeftSideBar'; 2 | import RightSideBar from './RightSideBar'; 3 | 4 | export default { 5 | LeftSideBar, 6 | RightSideBar 7 | } 8 | 9 | export { 10 | LeftSideBar, 11 | RightSideBar 12 | } -------------------------------------------------------------------------------- /apps/admin/src/components/SideLayout/index.js: -------------------------------------------------------------------------------- 1 | import SideLayout from './SideLayout'; 2 | 3 | export default SideLayout; -------------------------------------------------------------------------------- /apps/admin/src/components/SkinToolbox/LayoutBox.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Checkbox } from 'antd'; 3 | const CheckGroup = Checkbox.Group; 4 | 5 | /** 6 | * 几种常用布局 7 | */ 8 | export default ({ theme, onChange }) => ( 9 | 10 | 11 | 固定头部 12 | 13 | 14 | 固定边栏 15 | 16 | 17 | 标签模式 18 | 19 | 20 | 固定面包屑 21 | 22 | 23 | 隐藏面包屑 24 | 25 | 26 | ); 27 | -------------------------------------------------------------------------------- /apps/admin/src/components/SkinToolbox/SideBarBox.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Radio, Tag } from 'antd'; 3 | const RadioGroup = Radio.Group; 4 | 5 | export default ({ theme, onChange }) => ( 6 | 10 | 11 | 深灰 12 | 13 | 14 | 浅灰 15 | 16 | 17 | Antd深蓝 18 | 19 | 20 | 21 | Antd亮白 22 | 23 | 24 | 25 | ) -------------------------------------------------------------------------------- /apps/admin/src/components/SkinToolbox/index.js: -------------------------------------------------------------------------------- 1 | import SkinToolbox from './SkinToolbox'; 2 | 3 | export default SkinToolbox; -------------------------------------------------------------------------------- /apps/admin/src/components/Toolbar/index.js: -------------------------------------------------------------------------------- 1 | import Toolbar from './Toolbar'; 2 | 3 | export default Toolbar; -------------------------------------------------------------------------------- /apps/admin/src/components/TopBar/index.js: -------------------------------------------------------------------------------- 1 | import TopBar from './TopBar'; 2 | 3 | export default TopBar; -------------------------------------------------------------------------------- /apps/admin/src/components/TransferTree/index.js: -------------------------------------------------------------------------------- 1 | import TransferTree from './TransferTree'; 2 | 3 | export default TransferTree; -------------------------------------------------------------------------------- /apps/admin/src/components/Upload/index.js: -------------------------------------------------------------------------------- 1 | import Upload from './Upload'; 2 | 3 | export default Upload; -------------------------------------------------------------------------------- /apps/admin/src/components/Video/Video.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import './style/index.less'; 3 | 4 | /** 5 | * 视频播放组件 6 | */ 7 | class Video extends Component { 8 | static defaultProps = { 9 | prefixCls: 'antui-video' 10 | }; 11 | 12 | render() { 13 | return ( 14 |
15 | 16 |
17 | ); 18 | } 19 | } 20 | 21 | export default Video; -------------------------------------------------------------------------------- /apps/admin/src/components/Video/index.js: -------------------------------------------------------------------------------- 1 | import Video from './Video'; 2 | 3 | export default Video; -------------------------------------------------------------------------------- /apps/admin/src/components/Video/style/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/components/Video/style/index.less -------------------------------------------------------------------------------- /apps/admin/src/components/WaterFall/index.js: -------------------------------------------------------------------------------- 1 | import WaterFall from './WaterFall'; 2 | 3 | export default WaterFall; -------------------------------------------------------------------------------- /apps/admin/src/components/WaterFall/style/index.less: -------------------------------------------------------------------------------- 1 | .antui-waterfall { 2 | .antui-waterfall-item { 3 | &:hover { 4 | z-index: 1; 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /apps/admin/src/components/index.js: -------------------------------------------------------------------------------- 1 | // 2 | // import PageLoading from './Loading/PageLoading'; 3 | // import Notification from './Notification'; 4 | // import TransferTree from './TransferTree'; 5 | // import Panel from './Panel'; 6 | 7 | // export { 8 | // PageLoading, 9 | // Notification, 10 | // TransferTree, 11 | // Panel, 12 | // } -------------------------------------------------------------------------------- /apps/admin/src/decorator/breadcrumb.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | /** 4 | * 在一个类上增加这个装饰器,可以改变页面的面包屑 5 | * @param {*} options 6 | */ 7 | const breadcrumb = options => WrappedComponent => { 8 | return WrappedComponent; 9 | }; 10 | 11 | export default breadcrumb; 12 | -------------------------------------------------------------------------------- /apps/admin/src/decorator/coming.js: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import Coming from '../components/Pages/Coming'; 3 | 4 | /** 5 | * 在一个类上增加这个装饰器,表示这个类是一个未完成的功能, 6 | * 将会展示成一个即装到来的友好页面,可以设置倒计时时间 7 | * @param {*} options Coming 组件选项 8 | */ 9 | const coming = options => WrappedComponent => { 10 | return class extends PureComponent { 11 | render() { 12 | return ( 13 | 14 | 15 | 16 | ); 17 | } 18 | }; 19 | }; 20 | 21 | export default coming; 22 | -------------------------------------------------------------------------------- /apps/admin/src/decorator/index.js: -------------------------------------------------------------------------------- 1 | import coming from './coming'; 2 | 3 | export { coming }; 4 | -------------------------------------------------------------------------------- /apps/admin/src/layouts/UserLayout.js: -------------------------------------------------------------------------------- 1 | import './styles/user.less'; 2 | import React from 'react'; 3 | import { connect } from 'dva'; 4 | import { Layout } from 'antd'; 5 | import { Switch } from 'dva/router'; 6 | const { Content } = Layout; 7 | 8 | @connect() 9 | export default class UserLayout extends React.PureComponent { 10 | render() { 11 | const {routerData} = this.props; 12 | const {childRoutes} = routerData; 13 | 14 | return ( 15 | 16 | 17 | {childRoutes} 18 | 19 | 20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /apps/admin/src/layouts/styles/user.less: -------------------------------------------------------------------------------- 1 | .user-layout { 2 | &.fixed.ant-layout, 3 | &.fixed .full-layout.ant-layout { 4 | position: absolute !important; 5 | top: 0; 6 | left: 0; 7 | right: 0; 8 | bottom: 0; 9 | .ant-layout-sider > .ant-layout-sider-children { 10 | overflow-y: auto; 11 | overflow-x: hidden; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/components/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { connect } from 'dva'; 3 | import { Layout } from 'antd'; 4 | import BaseComponent from 'components/BaseComponent'; 5 | import style from './index.module.less'; 6 | const { Content } = Layout; 7 | 8 | @connect() 9 | export default class extends BaseComponent { 10 | render() { 11 | return ( 12 | 13 | 空白页 14 | 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/components/index.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Blank/components/index.less -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/components/index.module.less: -------------------------------------------------------------------------------- 1 | /* less-modules */ 2 | .className { 3 | color: red; 4 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/blank', 5 | title: '空白页', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'blank', 5 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Blank/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Blank/service/index.js -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/components/index.less: -------------------------------------------------------------------------------- 1 | .crud-page { 2 | } 3 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/index.js: -------------------------------------------------------------------------------- 1 | import {dynamicWrapper, createRoute} from '@/utils/core'; 2 | 3 | const routesConfig = (app) => ({ 4 | path: '/crud', 5 | title: 'CRUD示例', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')), 7 | exact: true 8 | }); 9 | 10 | export default (app) => createRoute(app, routesConfig); 11 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/routers/Detail/components/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { connect } from 'dva'; 3 | import { Layout } from 'antd'; 4 | import BaseComponent from 'components/BaseComponent'; 5 | const { Content } = Layout; 6 | 7 | @connect() 8 | export default class extends BaseComponent { 9 | render() { 10 | return ( 11 | 12 | 详情页 13 | 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/routers/Detail/index.js: -------------------------------------------------------------------------------- 1 | import {dynamicWrapper, createRoute} from '@/utils/core'; 2 | 3 | const routesConfig = (app) => ({ 4 | path: '/crud/detail', 5 | title: 'CRUD示例-详情页路由', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default (app) => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/routers/Detail/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'crudDetail', 5 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Business/CRUD/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Business/CRUD/service/index.js -------------------------------------------------------------------------------- /apps/admin/src/routes/Dashboard/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/dashboard', 5 | title: '仪表盘', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Dashboard/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Dashboard/service/index.js -------------------------------------------------------------------------------- /apps/admin/src/routes/Login/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = (app) => ({ 4 | path: '/sign/login', 5 | title: 'Login', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default (app) => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Login/service/index.js: -------------------------------------------------------------------------------- 1 | import $$ from 'cmn-utils'; 2 | 3 | export async function login(payload) { 4 | return $$.post('/user/login', payload); 5 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Pages/403.js: -------------------------------------------------------------------------------- 1 | import { createRoute } from '@/utils/core'; 2 | import { P403 } from 'components/Pages'; 3 | 4 | const routesConfig = app => ({ 5 | path: '/403', 6 | title: '403', 7 | component: P403 8 | }); 9 | 10 | export default app => createRoute(app, routesConfig); 11 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Pages/404.js: -------------------------------------------------------------------------------- 1 | import { createRoute } from '@/utils/core'; 2 | import { P404 } from 'components/Pages'; 3 | 4 | const routesConfig = (app) => ({ 5 | title: '页面没有找到', 6 | component: P404, 7 | }); 8 | 9 | export default (app) => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Pages/500.js: -------------------------------------------------------------------------------- 1 | import { createRoute } from '@/utils/core'; 2 | import { P500 } from 'components/Pages'; 3 | 4 | const routesConfig = app => ({ 5 | path: '/500', 6 | title: '500', 7 | component: P500 8 | }); 9 | 10 | export default app => createRoute(app, routesConfig); 11 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Register/components/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/lib/style/themes/default.less'; 2 | 3 | .register-page { 4 | .register-form-button { 5 | width: 100%; 6 | } 7 | .getCaptcha { 8 | width: 100%; 9 | } 10 | } 11 | 12 | .progress-pass.ant-progress { 13 | .ant-progress-bg { 14 | background-color: @warning-color; 15 | } 16 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Register/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = (app) => ({ 4 | path: '/sign/register', 5 | title: 'Register', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')), 7 | }); 8 | 9 | export default (app) => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Register/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | import { register } from '../service'; 3 | 4 | export default modelEnhance({ 5 | namespace: 'register', 6 | 7 | state: { 8 | status: undefined, 9 | }, 10 | 11 | effects: { 12 | *submit({ payload }, { call, put }) { 13 | console.log(payload) 14 | const response = yield call(register, payload); 15 | yield put({ 16 | type: 'registerHandle', 17 | payload: response, 18 | }); 19 | }, 20 | }, 21 | 22 | reducers: { 23 | registerHandle(state, { payload }) { 24 | return { 25 | ...state, 26 | status: payload.status, 27 | }; 28 | }, 29 | }, 30 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Register/service/index.js: -------------------------------------------------------------------------------- 1 | import $$ from 'cmn-utils'; 2 | 3 | export async function register(payload) { 4 | return $$.post('/user/register', payload); 5 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Alerts/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/alerts', 5 | title: 'Alerts page', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Button/components/index.less: -------------------------------------------------------------------------------- 1 | .button-page { 2 | button, 3 | .ripple-btn { 4 | margin: 8px; 5 | } 6 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Button/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/button', 5 | title: '按钮', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/CSSAnimate/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/animations', 5 | title: '动画', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Editor/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/editor', 5 | title: '富文本', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Icon/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/icons', 5 | title: '图标', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/UI/Mask/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/mask', 5 | title: '遮罩', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Banner/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/banner', 5 | title: 'Banner 管理', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/BaseComponent/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/baseComponent', 5 | title: '组件父类', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Charts/EC/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/charts/ec', 5 | title: 'ECharts', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Charts/G2/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/charts/g2', 5 | title: 'G2', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Column/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/column', 5 | title: 'Columns', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Coming/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { createRoute } from '@/utils/core'; 3 | import { Coming } from 'components/Pages'; 4 | 5 | const routesConfig = app => ({ 6 | path: '/coming', 7 | title: 'Coming Soon', 8 | component: () => ( 9 | 13 | ) 14 | }); 15 | 16 | export default app => createRoute(app, routesConfig); 17 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/DataTable/components/index.less: -------------------------------------------------------------------------------- 1 | .datatable-page { 2 | .footer { 3 | text-align: center; 4 | background: #e9e9e9; 5 | padding: 14px; 6 | } 7 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/DataTable/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/datatable', 5 | title: '数据表格', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/DataTable/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | import PageHelper from '@/utils/pageHelper'; 3 | 4 | export default modelEnhance({ 5 | namespace: 'datatable', 6 | 7 | state: { 8 | pageData: PageHelper.create(), 9 | pageDataSort: PageHelper.create(), 10 | deptTreeData: [], 11 | dataList: { 12 | list: [] 13 | }, 14 | } 15 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/DataTable/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Widgets/DataTable/service/index.js -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Form/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/form', 5 | title: '表单', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Form/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'form', 5 | 6 | state: { 7 | treeData: [], 8 | }, 9 | 10 | subscriptions: { 11 | setup({ dispatch, history }) { 12 | history.listen(({ pathname }) => { 13 | if (pathname === '/form') { 14 | dispatch({ 15 | type: '@request', 16 | afterResponse: resp => resp.data, 17 | payload: { 18 | valueField: 'treeData', 19 | url: '/tree/getAsyncTreeSelect', 20 | } 21 | }); 22 | } 23 | }); 24 | } 25 | }, 26 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Gallery/components/index.less: -------------------------------------------------------------------------------- 1 | .gallery-page { 2 | .antui-waterfall { 3 | margin: 16px auto 0; 4 | } 5 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Gallery/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/gallery', 5 | title: '画廊', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/components/index.less: -------------------------------------------------------------------------------- 1 | @import '~antd/lib/style/themes/default.less'; 2 | 3 | .level-route-page { 4 | .ant-layout-header { 5 | padding: 10px; 6 | background: #fff9c4; 7 | 8 | .sub-route-link { 9 | color: @primary-color; 10 | margin-right: 8px; 11 | &:hover { 12 | color: @primary-6; 13 | } 14 | &:active { 15 | color: @primary-4; 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | import SubRoute from './routes/SubRoute'; 3 | 4 | const routesConfig = (app) => ({ 5 | path: '/level-route', 6 | title: '一级路由', 7 | component: dynamicWrapper(app, [import('./model')], () => import('./components')), 8 | childRoutes: [ 9 | SubRoute(app), 10 | ] 11 | }); 12 | 13 | export default (app) => createRoute(app, routesConfig); 14 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'level1', 5 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/routes/SubRoute/components/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { connect } from 'dva'; 3 | import { Layout } from 'antd'; 4 | import BaseComponent from 'components/BaseComponent'; 5 | import './index.less'; 6 | const { Content } = Layout; 7 | 8 | @connect() 9 | export default class extends BaseComponent { 10 | render() { 11 | return ( 12 | 13 | 14 |

二级路由

15 |
16 |
17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/routes/SubRoute/components/index.less: -------------------------------------------------------------------------------- 1 | .level2-route-page { 2 | background: #fffde7; 3 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/routes/SubRoute/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = (app) => ({ 4 | path: '/level-route/sub-route', 5 | title: '二级路由', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')), 7 | }); 8 | 9 | export default (app) => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/LevelRoute/routes/SubRoute/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'subRoute', 5 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Print/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/print', 5 | title: '打印', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Result/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/result', 5 | title: '结果页', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/ScreenLock/index.js: -------------------------------------------------------------------------------- 1 | import { createRoute } from '@/utils/core'; 2 | import { ScreenLock } from 'components/Pages'; 3 | 4 | const routesConfig = app => ({ 5 | path: '/lock', 6 | title: '锁屏', 7 | component: ScreenLock 8 | }); 9 | 10 | export default app => createRoute(app, routesConfig); 11 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/SearchBar/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/searchBar', 5 | title: '搜索条', 6 | component: dynamicWrapper(app, [], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Toolbar/components/columns.js: -------------------------------------------------------------------------------- 1 | export default (self) => [ 2 | { 3 | title: '姓名', 4 | name: 'name', 5 | searchItem: { 6 | group: '1', 7 | }, 8 | }, 9 | { 10 | title: '角色', 11 | name: 'role', 12 | dict: [ 13 | {code: '1', codeName: '管理员'}, 14 | {code: '2', codeName: '编辑'}, 15 | {code: '3', codeName: '游客'}, 16 | ], 17 | searchItem: { 18 | type: 'select', 19 | group: '1', 20 | } 21 | }, 22 | { 23 | title: '生日', 24 | name: 'birthday', 25 | searchItem: { 26 | type: 'date', 27 | width: 120, 28 | } 29 | } 30 | ]; -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Toolbar/components/index.less: -------------------------------------------------------------------------------- 1 | .toolbar-page { 2 | .antui-panel-body { 3 | background: #eee; 4 | } 5 | .toolbar-demo { 6 | background: #fff; 7 | border: 1px solid #e0e0e0; 8 | } 9 | } -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Toolbar/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/toolbar', 5 | title: '工具条', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Toolbar/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'toolbar', 5 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/Toolbar/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Widgets/Toolbar/service/index.js -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/TransferTree/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '/transferTree', 5 | title: '穿梭树', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/TransferTree/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: 'transferTree', 5 | 6 | state: { 7 | dataSource: [], 8 | asyncDataSource: [], 9 | }, 10 | 11 | subscriptions: { 12 | setup({ dispatch, history }) { 13 | history.listen(({ pathname }) => { 14 | if (pathname === '/transferTree') { 15 | dispatch({ 16 | type: '@request', 17 | afterResponse: resp => resp.data, 18 | payload: [{ 19 | valueField: 'dataSource', 20 | url: '/tree/getData', 21 | }, { 22 | valueField: 'asyncDataSource', 23 | url: '/tree/getAsyncData', 24 | }] 25 | }); 26 | } 27 | }); 28 | } 29 | }, 30 | }); -------------------------------------------------------------------------------- /apps/admin/src/routes/Widgets/TransferTree/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/src/routes/Widgets/TransferTree/service/index.js -------------------------------------------------------------------------------- /apps/admin/templates/routes/Blank/components/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { connect } from 'dva'; 3 | import { Layout } from 'antd'; 4 | import BaseComponent from 'components/BaseComponent'; 5 | import './index.less'; 6 | const { Content } = Layout; 7 | 8 | @connect() 9 | export default class extends BaseComponent { 10 | render() { 11 | return ( 12 | 13 | Route created success, happy work! 14 | 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/Blank/components/index.less: -------------------------------------------------------------------------------- 1 | // 页面样式 2 | .<%=namespace %>-page { 3 | } 4 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/Blank/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '<%=route %>', 5 | title: '<%=title %>', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/Blank/model/index.js: -------------------------------------------------------------------------------- 1 | import modelEnhance from '@/utils/modelEnhance'; 2 | 3 | export default modelEnhance({ 4 | namespace: '<%=namespace %>', 5 | 6 | state: {}, 7 | 8 | subscriptions: {}, 9 | 10 | effects: {}, 11 | 12 | reducers: {} 13 | }); 14 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/Blank/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/templates/routes/Blank/service/index.js -------------------------------------------------------------------------------- /apps/admin/templates/routes/CRUD/components/columns.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import DataTable from 'components/DataTable'; 3 | import Icon from 'components/Icon'; 4 | import Button from 'components/Button'; 5 | 6 | export default (self) => [ 7 | { 8 | title: '操作', 9 | tableItem: { 10 | width: 180, 11 | render: (text, record) => ( 12 | 13 | 16 | 19 | 20 | ) 21 | } 22 | } 23 | ]; 24 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/CRUD/components/index.less: -------------------------------------------------------------------------------- 1 | // 页面样式 2 | .<%=namespace %>-page { 3 | } 4 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/CRUD/index.js: -------------------------------------------------------------------------------- 1 | import { dynamicWrapper, createRoute } from '@/utils/core'; 2 | 3 | const routesConfig = app => ({ 4 | path: '<%=route %>', 5 | title: '<%=title %>', 6 | component: dynamicWrapper(app, [import('./model')], () => import('./components')) 7 | }); 8 | 9 | export default app => createRoute(app, routesConfig); 10 | -------------------------------------------------------------------------------- /apps/admin/templates/routes/CRUD/service/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/apps/admin/templates/routes/CRUD/service/index.js -------------------------------------------------------------------------------- /apps/applet/.github/workflows/mirror.yml: -------------------------------------------------------------------------------- 1 | name: Mirror 2 | 3 | on: [push] 4 | 5 | jobs: 6 | to_gitee: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v1 10 | - uses: pixta-dev/repository-mirroring-action@v1 11 | with: 12 | target_repo_url: 13 | git@gitee.com:remaxjs/template-wechat.git 14 | ssh_private_key: 15 | ${{ secrets.GITEE_SSH_PRIVATE_KEY }} 16 | -------------------------------------------------------------------------------- /apps/applet/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | yarn-error.log 4 | yarn.lock 5 | -------------------------------------------------------------------------------- /apps/applet/README.md: -------------------------------------------------------------------------------- 1 | # Remax Wechat Template 2 | 3 | 使用 Remax 开发微信小程序的模板。 4 | 5 | 通过该模板创建一个新项目: 6 | 7 | ```bash 8 | $ npx degit remaxjs/template-wechat my-app 9 | $ cd my-app 10 | ``` 11 | 12 | ## 开始开发 13 | 14 | 安装依赖 15 | 16 | ```bash 17 | $ npm install 18 | ``` 19 | 20 | 开始构建 21 | 22 | ```bash 23 | $ npm run dev 24 | ``` 25 | 26 | 使用微信小程序开发者工具打开项目下的 `dist` 目录。 27 | 28 | ## 发布 29 | 30 | ```bash 31 | $ npm run build 32 | ``` 33 | 34 | 使用微信小程序开发者工具上传版本。 35 | -------------------------------------------------------------------------------- /apps/applet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remax-template", 3 | "private": true, 4 | "version": "1.0.0", 5 | "description": "Starter template for Remax apps", 6 | "main": "index.js", 7 | "keywords": [], 8 | "author": "Caihuanyu ", 9 | "license": "MIT", 10 | "scripts": { 11 | "start": "remax build -t wechat -w", 12 | "clean": "rimraf dist", 13 | "prebuild": "npm run clean", 14 | "build": "NODE_ENV=production remax build -t wechat" 15 | }, 16 | "dependencies": { 17 | "clsx": "^1.0.4", 18 | "react": "^16.8.6", 19 | "remax": "^1.1.0", 20 | "remax-cli": "^1.1.0", 21 | "rimraf": "^2.6.3" 22 | }, 23 | "devDependencies": { 24 | "chokidar": "^2.1.8" 25 | } 26 | } -------------------------------------------------------------------------------- /apps/applet/src/app.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: ['pages/index/index'], 3 | window: { 4 | navigationBarTitleText: 'Remax', 5 | navigationBarBackgroundColor: '#282c34' 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /apps/applet/src/app.css: -------------------------------------------------------------------------------- 1 | page { 2 | background-color: #282c34; 3 | } -------------------------------------------------------------------------------- /apps/applet/src/app.js: -------------------------------------------------------------------------------- 1 | import './app.css'; 2 | 3 | const App = props => props.children; 4 | 5 | export default App; 6 | -------------------------------------------------------------------------------- /apps/applet/src/pages/index/index.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { View, Text, Image } from 'remax/wechat'; 3 | import styles from './index.module.css'; 4 | 5 | export default () => { 6 | return ( 7 | 8 | 9 | logo 14 | 15 | Remax 16 | 17 | 18 | 19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /apps/applet/src/pages/index/index.module.css: -------------------------------------------------------------------------------- 1 | .app { 2 | text-align: center; 3 | padding: 0 24px; 4 | } 5 | 6 | .logo { 7 | animation: logo-spin infinite 20s linear; 8 | height: 240px; 9 | width: 240px; 10 | pointer-events: none; 11 | } 12 | 13 | .text { 14 | margin-top: 64px; 15 | } 16 | 17 | .header { 18 | padding-top: 30%; 19 | background-color: #282c34; 20 | font-size: 40px; 21 | color: white; 22 | } 23 | 24 | @keyframes logo-spin { 25 | from { 26 | transform: rotate(0deg); 27 | } 28 | to { 29 | transform: rotate(360deg); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apps/service/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json -------------------------------------------------------------------------------- /apps/service/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /apps/service/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService] 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /apps/service/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /apps/service/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | import { BllModule } from './bll'; 5 | import { CliModule } from './cli'; 6 | import { CommonModule } from './common'; 7 | 8 | @Module({ 9 | imports: [CommonModule, CliModule, BllModule], 10 | controllers: [AppController], 11 | providers: [AppService] 12 | }) 13 | export class AppModule {} 14 | -------------------------------------------------------------------------------- /apps/service/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import {} from '@nestify/config'; 2 | import { IConfigService, ILoggerService } from '@nestify/core'; 3 | import { Injectable } from '@nestjs/common'; 4 | import { InjectConfig, InjectLogger } from './common'; 5 | 6 | @Injectable() 7 | export class AppService { 8 | @InjectConfig() 9 | private readonly config: IConfigService; 10 | 11 | @InjectLogger() 12 | private readonly logger: ILoggerService; 13 | 14 | getHello(): string { 15 | this.logger.info('Hello World!', this.config.get('app.port')); 16 | 17 | return 'Hello World!'; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apps/service/src/bll/bll.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { UserModule } from './user'; 3 | 4 | @Module({ 5 | imports: [UserModule] 6 | }) 7 | export class BllModule {} 8 | -------------------------------------------------------------------------------- /apps/service/src/bll/index.ts: -------------------------------------------------------------------------------- 1 | export * from './bll.module'; 2 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/controllers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './admin.controller'; 2 | export * from './user.controller'; 3 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/index.ts: -------------------------------------------------------------------------------- 1 | export * from './models'; 2 | export * from './repositories'; 3 | export * from './services'; 4 | export * from './user.module'; 5 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/models/admin.model.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from '../../../common/core'; 2 | import { BaseUserModel, BaseUserSchema } from './base-user.model'; 3 | 4 | export interface Admin extends BaseUserModel {} 5 | 6 | const schema = BaseSchema({ 7 | ...BaseUserSchema 8 | }); 9 | 10 | export const AdminModelName = 'Admin'; 11 | export const AdminModel = { 12 | name: AdminModelName, 13 | schema 14 | }; 15 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/models/base-user.model.ts: -------------------------------------------------------------------------------- 1 | import { IModel } from '../../../common/core'; 2 | 3 | export const BaseUserSchema = { 4 | account: { 5 | type: String, 6 | index: true, 7 | unique: true, 8 | required: true, 9 | trim: true 10 | }, 11 | password: { type: String, required: true, trim: true }, 12 | nickname: { type: String, trim: true }, 13 | avatar: { type: String, trim: true } 14 | }; 15 | 16 | export interface BaseUserModel extends IModel { 17 | readonly account: string; 18 | readonly password: string; 19 | readonly nickname: string; 20 | readonly avatar: string; 21 | } 22 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/models/index.ts: -------------------------------------------------------------------------------- 1 | export * from './admin.model'; 2 | export * from './base-user.model'; 3 | export * from './user.model'; 4 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/models/user.model.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from '../../../common/core'; 2 | import { BaseUserModel, BaseUserSchema } from './base-user.model'; 3 | 4 | export interface User extends BaseUserModel {} 5 | 6 | const schema = BaseSchema({ 7 | ...BaseUserSchema 8 | }); 9 | 10 | export const UserModelName = 'User'; 11 | export const UserModel = { 12 | name: UserModelName, 13 | schema 14 | }; 15 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/notifiables/index.ts: -------------------------------------------------------------------------------- 1 | export * from './user.notifiable'; 2 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/notifiables/user.notifiable.ts: -------------------------------------------------------------------------------- 1 | import { Action, Notifiable } from '@nestify/notification'; 2 | 3 | @Notifiable('user') 4 | export class UserNotifiable { 5 | @Action('register-sms') 6 | async register(registerDto) { 7 | console.log('user-register-sms', registerDto); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/repositories/admin.repository.ts: -------------------------------------------------------------------------------- 1 | import { InjectModel } from '@nestjs/mongoose'; 2 | import { Model } from 'mongoose'; 3 | import { Repository } from '../../../common/core'; 4 | import { Admin, AdminModelName } from '../models'; 5 | import { BaseUserRepository } from './base-user.repository'; 6 | 7 | @Repository() 8 | export class AdminRepository extends BaseUserRepository { 9 | constructor( 10 | @InjectModel(AdminModelName) 11 | protected readonly model: Model 12 | ) { 13 | super(model); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/repositories/base-user.repository.ts: -------------------------------------------------------------------------------- 1 | import { Model } from 'mongoose'; 2 | import { BaseRepository } from '../../../common/core'; 3 | import { BaseUserModel } from '../models'; 4 | 5 | export abstract class BaseUserRepository extends BaseRepository { 6 | constructor(protected readonly model: Model) { 7 | super(model); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/repositories/index.ts: -------------------------------------------------------------------------------- 1 | export * from './admin.repository'; 2 | export * from './base-user.repository'; 3 | export * from './user.repository'; 4 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/repositories/user.repository.ts: -------------------------------------------------------------------------------- 1 | import { InjectModel } from '@nestjs/mongoose'; 2 | import { Model } from 'mongoose'; 3 | import { Repository } from '../../../common/core'; 4 | import { User, UserModelName } from '../models'; 5 | import { BaseUserRepository } from './base-user.repository'; 6 | 7 | @Repository() 8 | export class UserRepository extends BaseUserRepository { 9 | constructor( 10 | @InjectModel(UserModelName) 11 | protected readonly model: Model 12 | ) { 13 | super(model); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/seeders/admin.seeder.ts: -------------------------------------------------------------------------------- 1 | import { ISeeder, Seeder } from '@nestify/mongo-seeder'; 2 | import * as faker from 'faker'; 3 | import { AdminModelName } from '../models'; 4 | import { AdminService } from '../services'; 5 | 6 | @Seeder() 7 | export class AdminSeeder implements ISeeder { 8 | public modelName: string = AdminModelName; 9 | public sort: number = 1; 10 | 11 | constructor(private readonly service: AdminService) {} 12 | 13 | async seed() { 14 | await this.service.create({ 15 | account: 'admin', 16 | password: await this.service.encrypt('12345678'), 17 | nickname: faker.internet.userName(), 18 | avatar: faker.internet.avatar() 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/seeders/index.ts: -------------------------------------------------------------------------------- 1 | export * from './admin.seeder'; 2 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/services/admin.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { Admin } from '../models'; 3 | import { AdminRepository } from '../repositories'; 4 | import { BaseUserService } from './base-user.service'; 5 | 6 | @Injectable() 7 | export class AdminService extends BaseUserService { 8 | constructor(protected readonly repository: AdminRepository) { 9 | super(repository); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/services/base-user.service.ts: -------------------------------------------------------------------------------- 1 | import { CryptService } from '@nestify/crypt'; 2 | import { InjectCrypt } from '../../../common'; 3 | import { BaseService } from '../../../common/core'; 4 | import { BaseUserModel } from '../models'; 5 | import { BaseUserRepository } from '../repositories'; 6 | 7 | export abstract class BaseUserService extends BaseService { 8 | @InjectCrypt() 9 | protected readonly crypt: CryptService; 10 | 11 | constructor(protected readonly repository: BaseUserRepository) { 12 | super(repository); 13 | } 14 | 15 | async encrypt(str: string): Promise { 16 | return await this.crypt.encrypt(str); 17 | } 18 | 19 | async compare(str: string, hash: string): Promise { 20 | return await this.crypt.compare(str, hash); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/services/index.ts: -------------------------------------------------------------------------------- 1 | export * from './admin.service'; 2 | export * from './base-user.service'; 3 | export * from './user.service'; 4 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { User } from '../models'; 3 | import { UserRepository } from '../repositories'; 4 | import { BaseUserService } from './base-user.service'; 5 | 6 | @Injectable() 7 | export class UserService extends BaseUserService { 8 | constructor(protected readonly repository: UserRepository) { 9 | super(repository); 10 | } 11 | 12 | async sendRegisterSmsCode(registerDto) { 13 | registerDto.code = '1234'; 14 | return await this.notification.notify({ type: 'user', action: 'register-sms', context: registerDto }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apps/service/src/bll/user/user.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { MongooseModule } from '@nestjs/mongoose'; 3 | import { AdminController, UserController } from './controllers'; 4 | import { AdminModel, UserModel } from './models'; 5 | import { UserNotifiable } from './notifiables'; 6 | import { AdminRepository, UserRepository } from './repositories'; 7 | import { AdminSeeder } from './seeders'; 8 | import { AdminService, UserService } from './services'; 9 | 10 | @Module({ 11 | imports: [MongooseModule.forFeature([UserModel, AdminModel])], 12 | controllers: [UserController, AdminController], 13 | providers: [UserRepository, UserService, AdminRepository, AdminService, UserNotifiable, AdminSeeder], 14 | exports: [UserRepository, UserService, AdminRepository, AdminService, UserNotifiable, AdminSeeder] 15 | }) 16 | export class UserModule {} 17 | -------------------------------------------------------------------------------- /apps/service/src/cli/cli.module.ts: -------------------------------------------------------------------------------- 1 | import { ConsoleModule } from '@nestify/console'; 2 | import { SeederModule } from '@nestify/mongo-seeder'; 3 | import { Module } from '@nestjs/common'; 4 | import { MongoCommand } from './commands'; 5 | 6 | @Module({ 7 | imports: [ConsoleModule, SeederModule], 8 | providers: [MongoCommand] 9 | }) 10 | export class CliModule {} 11 | -------------------------------------------------------------------------------- /apps/service/src/cli/commands/index.ts: -------------------------------------------------------------------------------- 1 | export * from './mongo.command'; 2 | -------------------------------------------------------------------------------- /apps/service/src/cli/index.ts: -------------------------------------------------------------------------------- 1 | export * from './cli.module'; 2 | -------------------------------------------------------------------------------- /apps/service/src/common/constants.ts: -------------------------------------------------------------------------------- 1 | export const CONFIG_SERVICE = Symbol('CONFIG_SERVICE'); 2 | export const CACHE_SERVICE = Symbol('CACHE_SERVICE'); 3 | export const LOGGER_SERVICE = Symbol('LOGGER_SERVICE'); 4 | export const EVENT_PUBLISHER = Symbol('EVENT_PUBLISHER'); 5 | export const CRYPT_SERVICE = Symbol('CRYPT_SERVICE'); 6 | export const NOTIFICATION_SERVICE = Symbol('NOTIFICATION_SERVICE'); 7 | -------------------------------------------------------------------------------- /apps/service/src/common/core/core.constants.ts: -------------------------------------------------------------------------------- 1 | export const REPOSITORY = Symbol('REPOSITORY'); 2 | export const REPOSITORY_LISTENER = Symbol('REPOSITORY_LISTENER'); 3 | -------------------------------------------------------------------------------- /apps/service/src/common/core/core.enums.ts: -------------------------------------------------------------------------------- 1 | export enum RepositoryEvents { 2 | BEFORE_LOAD = 'before_load', 3 | AFTER_LOAD = 'after_load', 4 | BEFORE_CREATE = 'befor_create', 5 | AFTER_CREATE = 'after_create', 6 | BEFORE_UPDATE = 'before_update', 7 | AFTER_UPDATE = 'after_update', 8 | BEFORE_REMOVE = 'before_remove', 9 | AFTER_REMOVE = 'after_remove' 10 | } 11 | -------------------------------------------------------------------------------- /apps/service/src/common/core/core.injectable.ts: -------------------------------------------------------------------------------- 1 | import { ICacheService, IConfigService, IEventPublisher, ILoggerService, INotification } from '@nestify/core'; 2 | import { InjectCache, InjectConfig, InjectEventPublisher, InjectLogger, InjectNotification } from '../decorators'; 3 | 4 | export abstract class BaseInjectable { 5 | @InjectConfig() 6 | protected readonly config: IConfigService; 7 | 8 | @InjectCache() 9 | protected readonly cache: ICacheService; 10 | 11 | @InjectLogger() 12 | protected readonly logger: ILoggerService; 13 | 14 | @InjectEventPublisher() 15 | protected readonly event: IEventPublisher; 16 | 17 | @InjectNotification() 18 | protected readonly notification: INotification; 19 | } 20 | -------------------------------------------------------------------------------- /apps/service/src/common/core/core.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { CoreExplorer } from './core.explorer'; 3 | 4 | @Module({ 5 | providers: [CoreExplorer] 6 | }) 7 | export class CoreModule {} 8 | -------------------------------------------------------------------------------- /apps/service/src/common/core/core.schemas.ts: -------------------------------------------------------------------------------- 1 | import { Schema, SchemaDefinition, SchemaOptions } from 'mongoose'; 2 | 3 | const baseDefinition = { 4 | isDeleted: { type: Boolean, required: true, default: false }, 5 | createAt: { type: Date, required: true, default: Date.now }, 6 | updateAt: { type: Date, required: true, default: Date.now } 7 | }; 8 | 9 | export const BaseSchema = (definition: SchemaDefinition, options?: SchemaOptions) => { 10 | const baseSchema = new Schema( 11 | { 12 | ...baseDefinition, 13 | ...definition 14 | }, 15 | options 16 | ); 17 | 18 | baseSchema.virtual('id').get(function() { 19 | return this._id; 20 | }); 21 | 22 | return baseSchema; 23 | }; 24 | -------------------------------------------------------------------------------- /apps/service/src/common/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core.controllers'; 2 | export * from './core.decorators'; 3 | export * from './core.enums'; 4 | export * from './core.interfaces'; 5 | export * from './core.module'; 6 | export * from './core.repositories'; 7 | export * from './core.schemas'; 8 | export * from './core.services'; 9 | -------------------------------------------------------------------------------- /apps/service/src/common/decorators.ts: -------------------------------------------------------------------------------- 1 | import { CACHE_MANAGER, Inject } from '@nestjs/common'; 2 | import { CONFIG_SERVICE, CRYPT_SERVICE, EVENT_PUBLISHER, LOGGER_SERVICE, NOTIFICATION_SERVICE } from './constants'; 3 | 4 | export const InjectConfig = () => Inject(CONFIG_SERVICE); 5 | export const InjectCache = () => Inject(CACHE_MANAGER); 6 | export const InjectCrypt = () => Inject(CRYPT_SERVICE); 7 | export const InjectLogger = () => Inject(LOGGER_SERVICE); 8 | export const InjectEventPublisher = () => Inject(EVENT_PUBLISHER); 9 | export const InjectNotification = () => Inject(NOTIFICATION_SERVICE); 10 | -------------------------------------------------------------------------------- /apps/service/src/common/index.ts: -------------------------------------------------------------------------------- 1 | export * from './common.module'; 2 | export * from './constants'; 3 | export * from './decorators'; 4 | export * from './providers'; 5 | -------------------------------------------------------------------------------- /apps/service/src/config/app.ts: -------------------------------------------------------------------------------- 1 | import { env } from '@nestify/config'; 2 | 3 | export default { 4 | env: env('NODE_ENV'), 5 | port: env('PORT'), 6 | prefix: 'api', 7 | salt: env('SALT'), 8 | isDev() { 9 | const env = this.get('app.env'); 10 | return env === 'development'; 11 | }, 12 | cors: { origin: '*' } 13 | }; 14 | -------------------------------------------------------------------------------- /apps/service/src/config/cache.ts: -------------------------------------------------------------------------------- 1 | import { env } from '@nestify/config'; 2 | import * as redisStore from 'cache-manager-ioredis'; 3 | 4 | export default { 5 | store: redisStore, 6 | host: env('REDIS_HOST'), 7 | port: env('REDIS_PORT'), 8 | ttl: 10 * 60 9 | }; 10 | -------------------------------------------------------------------------------- /apps/service/src/config/crypt.ts: -------------------------------------------------------------------------------- 1 | import { env } from '@nestify/config'; 2 | 3 | export default { 4 | salt: env('SALT') 5 | }; 6 | -------------------------------------------------------------------------------- /apps/service/src/config/logger.ts: -------------------------------------------------------------------------------- 1 | import { LoggerLevel, LoggerService } from '@nestify/logger'; 2 | import { transports } from 'winston'; 3 | 4 | export default { 5 | level: LoggerLevel.SILLY, 6 | format: LoggerService.createFormat(), 7 | transports: [new transports.Console()] 8 | }; 9 | -------------------------------------------------------------------------------- /apps/service/src/config/mongo.ts: -------------------------------------------------------------------------------- 1 | import { env } from '@nestify/config'; 2 | 3 | export default { 4 | connection: { 5 | uri: env('MONGO_URI'), 6 | dbName: env('MONGO_DB_NAME'), 7 | user: env('MONGO_USER'), 8 | pass: env('MONGO_PASS'), 9 | useNewUrlParser: true, 10 | useUnifiedTopology: true, 11 | useFindAndModify: false, 12 | useCreateIndex: true 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /apps/service/src/console.ts: -------------------------------------------------------------------------------- 1 | import { ConsoleModule } from '@nestify/console'; 2 | import { AppModule } from './app.module'; 3 | 4 | ConsoleModule.bootstrap({ module: AppModule }) 5 | .then(({ app, boot }) => { 6 | boot(); 7 | }) 8 | .catch((err) => console.error(err)); 9 | -------------------------------------------------------------------------------- /apps/service/src/env/.env: -------------------------------------------------------------------------------- 1 | # This file is the environment variable template file 2 | # Please create an environment variable file named in the format of .env.{NODE_ENV} 3 | 4 | NODE_ENV=development 5 | PORT=8888 6 | SALT=nestify 7 | 8 | REDIS_HOST=127.0.0.1 9 | REDIS_PORT=63790 10 | 11 | MONGO_URI=mongodb://127.0.0.1:27017 12 | MONGO_DB_NAME=nestify 13 | MONGO_USER=root 14 | MONGO_PASS=12345678 -------------------------------------------------------------------------------- /apps/service/src/env/.env.development: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | PORT=8888 3 | SALT=nestify 4 | 5 | REDIS_HOST=127.0.0.1 6 | REDIS_PORT=63790 7 | 8 | MONGO_URI=mongodb://127.0.0.1:27017 9 | MONGO_DB_NAME=nestify 10 | MONGO_USER=root 11 | MONGO_PASS=12345678 -------------------------------------------------------------------------------- /apps/service/src/env/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.env 3 | !.env.development 4 | !.gitignore -------------------------------------------------------------------------------- /apps/service/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule] 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /apps/service/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /apps/service/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /apps/service/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /apps/service/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | 3 | services: 4 | redis: 5 | container_name: nestify_redis 6 | image: 'redis:5.0.6' 7 | restart: always 8 | ports: 9 | - '63790:6379' 10 | networks: 11 | - app 12 | mongo: 13 | container_name: nestify_mongo 14 | image: 'mongo:4.2' 15 | restart: always 16 | environment: 17 | MONGO_INITDB_DATABASE: nestify 18 | MONGO_INITDB_ROOT_USERNAME: root 19 | MONGO_INITDB_ROOT_PASSWORD: 12345678 20 | volumes: 21 | - ./.docker/mongodb-data:/data/db 22 | - ./scripts/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/ 23 | ports: 24 | - '27017:27017' 25 | networks: 26 | - app 27 | networks: 28 | app: -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | # production 5 | /build 6 | 7 | # generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using Docusaurus 2, a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ yarn 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ yarn start 15 | ``` 16 | 17 | This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ### Deployment 28 | 29 | ``` 30 | $ GIT_USER= USE_SSH=1 yarn deploy 31 | ``` 32 | 33 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 34 | -------------------------------------------------------------------------------- /docs/blog/2019-12-18-nodejs-01.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: nodejs-01 3 | title: 在安装了 Node.js 之后,我怎么开始呢? 4 | author: Roy Lin 5 | authorURL: https://github.com/ZhiXiao-Lin 6 | --- 7 | 8 | 一旦你已经安装了 Node,让我们尝试构建第一个 Web 服务器。 请创建一个“app.js”文件,黏贴以下代码: 9 | 10 | ``` javascript 11 | const http = require('http'); 12 | 13 | const hostname = '127.0.0.1'; 14 | const port = 3000; 15 | 16 | const server = http.createServer((req, res) => { 17 | res.statusCode = 200; 18 | res.setHeader('Content-Type', 'text/plain'); 19 | res.end('Hello World\n'); 20 | }); 21 | 22 | server.listen(port, hostname, () => { 23 | console.log(`Server running at http://${hostname}:${port}/`); 24 | }); 25 | ``` 26 | 然后使用 node app.js 运行程序,访问 [http://localhost:3000](http://localhost:3000),你就会看到一个消息,写着“Hello World”。 27 | -------------------------------------------------------------------------------- /docs/docs/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 简介 3 | hide_title: true 4 | sidebar_label: 简介 5 | --- 6 | 7 | # Nestify 是什么? 8 | 9 | ![avatar](/img/logo.svg) 10 | 11 | 一个基于 Nest.js 的企业级 web 全栈框架 12 | 13 | 特征: 14 | * 统一的模块注册接口 15 | * 完整的单元测试 16 | * 清晰的使用文档 17 | * 符合社区最佳实践 18 | * 永久开源免费 19 | 20 | ## 联系作者 21 | 22 | GitHub: [https://github.com/ZhiXiao-Lin/](https://github.com/ZhiXiao-Lin/) 23 | 24 | Gmail: [linzhixiao1996@gmail.com](mailto://linzhixiao1996@gmail.com) 25 | 26 | Wechat: lzx19960425 27 | 28 | Telegram: Nestify 29 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "docusaurus start --hot-only", 7 | "build": "docusaurus build", 8 | "swizzle": "docusaurus swizzle", 9 | "deploy": "docusaurus deploy" 10 | }, 11 | "dependencies": { 12 | "@docusaurus/core": "2.0.0-alpha.37", 13 | "@docusaurus/preset-classic": "2.0.0-alpha.37", 14 | "classnames": "2.2.6", 15 | "react": "16.12.0", 16 | "react-dom": "16.12.0" 17 | }, 18 | "browserslist": { 19 | "production": [ 20 | ">0.2%", 21 | "not dead", 22 | "not op_mini all" 23 | ], 24 | "development": [ 25 | "last 1 chrome version", 26 | "last 1 firefox version", 27 | "last 1 safari version" 28 | ] 29 | } 30 | } -------------------------------------------------------------------------------- /docs/sidebars.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | docs: { 3 | 起步: ['introduction', 'module'], 4 | 模块: [ 5 | 'modules/core', 6 | 'modules/config', 7 | 'modules/logger', 8 | 'modules/mailer', 9 | 'modules/event-bus', 10 | 'modules/rule-engine', 11 | 'modules/workflow' 12 | ] 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /docs/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/docs/static/img/favicon.ico -------------------------------------------------------------------------------- /docs/static/img/logo-h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/docs/static/img/logo-h.png -------------------------------------------------------------------------------- /docs/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/docs/static/img/logo.png -------------------------------------------------------------------------------- /examples/01-config/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /examples/01-config/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/01-config/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/01-config/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/01-config/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/01-config/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { ConfigModule } from '@nestify/config'; 2 | import { Module } from '@nestjs/common'; 3 | import * as path from 'path'; 4 | import { AppController } from './app.controller'; 5 | import { AppService } from './app.service'; 6 | 7 | @Module({ 8 | imports: [ 9 | ConfigModule.register( 10 | path.resolve(__dirname, 'config', '**/!(*.d).{ts,js}'), 11 | ), 12 | ], 13 | controllers: [AppController], 14 | providers: [AppService], 15 | }) 16 | export class AppModule {} 17 | -------------------------------------------------------------------------------- /examples/01-config/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return 'Hello World!'; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/01-config/src/config/app.ts: -------------------------------------------------------------------------------- 1 | import { env } from '@nestify/config'; 2 | 3 | export default { 4 | env: env('NODE_ENV'), 5 | port: env('PORT'), 6 | }; 7 | -------------------------------------------------------------------------------- /examples/01-config/src/env/.env.development: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=development 3 | PORT=8888 -------------------------------------------------------------------------------- /examples/01-config/src/env/.env.production: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=production 3 | NODE_PORT=9999 -------------------------------------------------------------------------------- /examples/01-config/src/env/.env.test: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=development 3 | PORT=7777 -------------------------------------------------------------------------------- /examples/01-config/src/main.ts: -------------------------------------------------------------------------------- 1 | import { ConfigModule, ConfigService } from '@nestify/config'; 2 | import { Logger } from '@nestjs/common'; 3 | import { NestFactory } from '@nestjs/core'; 4 | import { AppModule } from './app.module'; 5 | 6 | async function bootstrap() { 7 | ConfigModule.initEnvironment(process.cwd() + '/src/env'); 8 | 9 | const app = await NestFactory.create(AppModule); 10 | const config: ConfigService = app.get(ConfigService); 11 | 12 | await app.listen(config.get('app.port'), () => { 13 | Logger.log(`env port: ${process.env.PORT}`); 14 | Logger.log(`config port: ${config.get('app.port')}`); 15 | }); 16 | } 17 | bootstrap(); 18 | -------------------------------------------------------------------------------- /examples/01-config/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/01-config/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/01-config/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/01-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/01-config/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /examples/02-logger/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /examples/02-logger/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/02-logger/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/02-logger/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/02-logger/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/02-logger/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { LoggerModule } from '@nestify/logger'; 2 | import { Module } from '@nestjs/common'; 3 | import { transports } from 'winston'; 4 | import { AppController } from './app.controller'; 5 | import { AppService } from './app.service'; 6 | 7 | @Module({ 8 | imports: [ 9 | LoggerModule.register({ 10 | transports: [new transports.Console()], 11 | }), 12 | ], 13 | controllers: [AppController], 14 | providers: [AppService], 15 | }) 16 | export class AppModule {} 17 | -------------------------------------------------------------------------------- /examples/02-logger/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectLogger } from '@nestify/logger'; 3 | import { Logger } from 'winston'; 4 | 5 | @Injectable() 6 | export class AppService { 7 | constructor( 8 | @InjectLogger() 9 | public readonly logger: Logger, 10 | ) {} 11 | 12 | getHello(): string { 13 | this.logger.info('Hello World'); 14 | return 'Hello World!'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/02-logger/src/main.ts: -------------------------------------------------------------------------------- 1 | import { LOGGER_MODULE_PROVIDER } from '@nestify/logger'; 2 | import { NestFactory } from '@nestjs/core'; 3 | import { AppModule } from './app.module'; 4 | 5 | async function bootstrap() { 6 | const app = await NestFactory.create(AppModule); 7 | 8 | const logger = app.get(LOGGER_MODULE_PROVIDER); 9 | 10 | const res = await app.listenAsync(3000); 11 | 12 | logger.info('logger'); 13 | logger.info(res); 14 | } 15 | bootstrap(); 16 | -------------------------------------------------------------------------------- /examples/02-logger/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/02-logger/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/02-logger/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/02-logger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/02-logger/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /examples/03-mailer/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json 35 | 36 | .env -------------------------------------------------------------------------------- /examples/03-mailer/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/03-mailer/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/03-mailer/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/03-mailer/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/03-mailer/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return 'Hello World!'; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/03-mailer/src/main.ts: -------------------------------------------------------------------------------- 1 | import { MailerService } from '@nestify/mailer'; 2 | import { NestFactory } from '@nestjs/core'; 3 | import { AppModule } from './app.module'; 4 | 5 | async function bootstrap() { 6 | const app = await NestFactory.create(AppModule); 7 | 8 | const mailer = app.get(MailerService); 9 | 10 | await app.listenAsync(3000); 11 | 12 | console.log( 13 | await mailer.send({ 14 | from: '1002591652@qq.com', 15 | to: 'linzhixiao1996@gmail.com', // list of receivers 16 | subject: 'This is a test mail', // Subject line 17 | template: process.cwd() + '/welcome.html', 18 | context: { 19 | value: 'nest mailer', 20 | }, 21 | }), 22 | ); 23 | } 24 | bootstrap(); 25 | -------------------------------------------------------------------------------- /examples/03-mailer/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/03-mailer/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/03-mailer/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/03-mailer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/03-mailer/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /examples/03-mailer/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 |

Welcome {{value}} 66661222

13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/04-event-bus/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /examples/04-event-bus/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/04-event-bus/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | async getHello() { 10 | return await this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { EventBusModule } from '@nestify/event-bus'; 2 | import { Module, Global } from '@nestjs/common'; 3 | import { AppController } from './app.controller'; 4 | import { AppService } from './app.service'; 5 | import { AppSubscriber } from './app.subscriber'; 6 | 7 | @Global() 8 | @Module({ 9 | imports: [ 10 | EventBusModule.registerAsync({ 11 | useFactory: async () => { 12 | return {}; 13 | }, 14 | }), 15 | ], 16 | controllers: [AppController], 17 | providers: [AppService, AppSubscriber], 18 | }) 19 | export class AppModule {} 20 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { EventBusService } from '@nestify/event-bus'; 3 | 4 | @Injectable() 5 | export class AppService { 6 | constructor(private readonly event: EventBusService) {} 7 | 8 | async getHello() { 9 | const msg = 'Hello World!'; 10 | const result = await this.event.emit('newRequest', msg); 11 | console.log(result); 12 | 13 | return msg; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/app.subscriber.ts: -------------------------------------------------------------------------------- 1 | import { Subscriber, Listener } from '@nestify/event-bus'; 2 | 3 | @Subscriber() 4 | export class AppSubscriber { 5 | @Listener({ event: 'newRequest' }) 6 | async newRequest(eventData: any) { 7 | console.log(eventData); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/04-event-bus/src/main.ts: -------------------------------------------------------------------------------- 1 | import { NestFactory } from '@nestjs/core'; 2 | import { AppModule } from './app.module'; 3 | 4 | async function bootstrap() { 5 | const app = await NestFactory.create(AppModule); 6 | await app.listen(3000); 7 | } 8 | bootstrap(); 9 | -------------------------------------------------------------------------------- /examples/04-event-bus/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/04-event-bus/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/04-event-bus/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/04-event-bus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/04-event-bus/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /examples/05-rule-engine/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /examples/05-rule-engine/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/05-rule-engine/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/05-rule-engine/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/05-rule-engine/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/05-rule-engine/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { EventBusModule } from '@nestify/event-bus'; 2 | import { RuleEngineModule } from '@nestify/rule-engine'; 3 | import { Module } from '@nestjs/common'; 4 | import { EventEmitter } from 'events'; 5 | import { AppController } from './app.controller'; 6 | import { AppService } from './app.service'; 7 | import { AppSubscriber } from './app.subscriber'; 8 | 9 | const event = new EventEmitter(); 10 | @Module({ 11 | imports: [ 12 | EventBusModule.register({ event }), 13 | RuleEngineModule.register({ 14 | event, 15 | eventPrefix: 'rule', 16 | }), 17 | ], 18 | controllers: [AppController], 19 | providers: [AppService, AppSubscriber], 20 | }) 21 | export class AppModule {} 22 | -------------------------------------------------------------------------------- /examples/05-rule-engine/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return 'Hello World!'; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/05-rule-engine/src/app.subscriber.ts: -------------------------------------------------------------------------------- 1 | import { Subscriber, Listener } from '@nestify/event-bus'; 2 | 3 | @Subscriber() 4 | export class AppSubscriber { 5 | @Listener({ event: 'rule:before' }) 6 | async before(rules, facts) { 7 | console.log('rule:before --->', rules, facts); 8 | } 9 | 10 | @Listener({ event: 'rule:test:beforeEvaluate' }) 11 | async beforeEvaluate(rules, facts) { 12 | console.log('rule:test:beforeEvaluate --->', rules, facts); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/05-rule-engine/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/05-rule-engine/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/05-rule-engine/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/05-rule-engine/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/05-rule-engine/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /examples/06-workflow/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # OS 14 | .DS_Store 15 | 16 | # Tests 17 | /coverage 18 | /.nyc_output 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json -------------------------------------------------------------------------------- /examples/06-workflow/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /examples/06-workflow/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": "@nestjs/schematics", 3 | "sourceRoot": "src" 4 | } 5 | -------------------------------------------------------------------------------- /examples/06-workflow/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AppController } from './app.controller'; 3 | import { AppService } from './app.service'; 4 | 5 | describe('AppController', () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe('Hello World!'); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/06-workflow/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | import { AppService } from './app.service'; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/06-workflow/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { WorkFlowModule } from '@nestify/workflow'; 2 | import { Module } from '@nestjs/common'; 3 | import { EventEmitter } from 'events'; 4 | import { AppController } from './app.controller'; 5 | import { AppService } from './app.service'; 6 | 7 | @Module({ 8 | imports: [ 9 | WorkFlowModule.register({ 10 | event: new EventEmitter(), 11 | eventPrefix: 'workflow', 12 | }), 13 | ], 14 | controllers: [AppController], 15 | providers: [AppService], 16 | }) 17 | export class AppModule {} 18 | -------------------------------------------------------------------------------- /examples/06-workflow/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return 'Hello World!'; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/06-workflow/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import * as request from 'supertest'; 3 | import { AppModule } from './../src/app.module'; 4 | 5 | describe('AppController (e2e)', () => { 6 | let app; 7 | 8 | beforeEach(async () => { 9 | const moduleFixture: TestingModule = await Test.createTestingModule({ 10 | imports: [AppModule], 11 | }).compile(); 12 | 13 | app = moduleFixture.createNestApplication(); 14 | await app.init(); 15 | }); 16 | 17 | it('/ (GET)', () => { 18 | return request(app.getHttpServer()) 19 | .get('/') 20 | .expect(200) 21 | .expect('Hello World!'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /examples/06-workflow/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/06-workflow/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/06-workflow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": ["node_modules", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /examples/06-workflow/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "version": "0.3.28" 6 | } 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nestify", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "repository": "git@github.com:ZhiXiao-Lin/nestify.git", 6 | "author": "roylin <1002591652@qq.com>", 7 | "license": "MIT", 8 | "scripts": { 9 | "lerna": "lerna-wizard", 10 | "update": "lernaupdate", 11 | "format": "prettier --write \"apps/**/*.ts\" \"packages/**/*.ts\" \"examples/**/*.ts\"" 12 | }, 13 | "devDependencies": { 14 | "cz-conventional-changelog": "3.0.2", 15 | "husky": "^3.1.0", 16 | "lerna": "3.19.0", 17 | "lerna-update-wizard": "0.17.5", 18 | "lerna-wizard": "1.1.1", 19 | "prettier": "1.19.1", 20 | "typescript": "3.7.2" 21 | }, 22 | "config": { 23 | "commitizen": { 24 | "path": "./node_modules/cz-conventional-changelog" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /packages/arena/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/arena/src/arena.constants.ts: -------------------------------------------------------------------------------- 1 | export const ARENA_OPTIONS = Symbol('ARENA_OPTIONS'); 2 | -------------------------------------------------------------------------------- /packages/arena/src/arena.service.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable, OnModuleInit } from '@nestjs/common'; 2 | import { HttpAdapterHost } from '@nestjs/core'; 3 | import * as Arena from 'bull-arena'; 4 | import { ARENA_OPTIONS } from './arena.constants'; 5 | import { ArenaModuleOptions } from './arena.interfaces'; 6 | 7 | @Injectable() 8 | export class ArenaService implements OnModuleInit { 9 | constructor( 10 | @Inject(ARENA_OPTIONS) 11 | private readonly options: ArenaModuleOptions, 12 | private readonly adapterHost: HttpAdapterHost 13 | ) {} 14 | 15 | async onModuleInit() { 16 | if (this.adapterHost.httpAdapter) { 17 | this.adapterHost.httpAdapter.getInstance().use(Arena({ queues: this.options.queues }, this.options.listenOptions)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/arena/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './arena.constants'; 2 | export * from './arena.module'; 3 | export * from './arena.service'; 4 | -------------------------------------------------------------------------------- /packages/arena/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/arena/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/arena/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/bullring/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/bullring/src/bull/bull.constants.ts: -------------------------------------------------------------------------------- 1 | export const BULL_OPTIONS = Symbol('BULL_OPTIONS'); 2 | -------------------------------------------------------------------------------- /packages/bullring/src/bull/bull.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 2 | import { QueueOptions } from 'bull'; 3 | 4 | interface MiddlewareListenOptions { 5 | port?: number; 6 | host?: string; 7 | basePath?: string; 8 | } 9 | 10 | export interface BullQueueOptions { 11 | name: string; 12 | options: QueueOptions; 13 | } 14 | 15 | export interface BullModuleOptions { 16 | queues: Array; 17 | listenOptions: MiddlewareListenOptions; 18 | } 19 | 20 | export interface BullModuleAsyncOptions extends Pick { 21 | useFactory: (...args: any[]) => Promise | BullModuleOptions; 22 | inject?: any[]; 23 | } 24 | -------------------------------------------------------------------------------- /packages/bullring/src/bull/controllers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './queue.controller'; 2 | -------------------------------------------------------------------------------- /packages/bullring/src/bull/dtos/clean-job.dto.ts: -------------------------------------------------------------------------------- 1 | import { JobStatusClean } from 'bull'; 2 | 3 | export class CleanJobDto { 4 | grace: number; 5 | status?: JobStatusClean; 6 | limit?: number; 7 | } 8 | -------------------------------------------------------------------------------- /packages/bullring/src/bull/dtos/get-jobs.dto.ts: -------------------------------------------------------------------------------- 1 | import { JobStatus } from 'bull'; 2 | 3 | export class GetJobsDto { 4 | status: JobStatus[]; 5 | start?: number; 6 | end?: number; 7 | asc?: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /packages/bullring/src/bull/dtos/index.ts: -------------------------------------------------------------------------------- 1 | export * from './clean-job.dto'; 2 | export * from './get-jobs.dto'; 3 | -------------------------------------------------------------------------------- /packages/bullring/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './bull'; 2 | -------------------------------------------------------------------------------- /packages/bullring/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bullring/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/bullring/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/config/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/config/src/config.constants.ts: -------------------------------------------------------------------------------- 1 | export const CONFIG_PARAM = Symbol('CONFIG_PARAM'); 2 | export const CONFIG_PARAMS = Symbol('CONFIG_PARAMS'); 3 | export const CONFIG_CONFIGURABLE = Symbol('CONFIG_CONFIGURABLE'); 4 | -------------------------------------------------------------------------------- /packages/config/src/config.helper.ts: -------------------------------------------------------------------------------- 1 | export const env = (key: string): string => process.env[key]; 2 | -------------------------------------------------------------------------------- /packages/config/src/config/app.ts: -------------------------------------------------------------------------------- 1 | import { env } from '../index'; 2 | 3 | export default { 4 | env: env('NODE_ENV'), 5 | port: env('PORT') 6 | }; 7 | -------------------------------------------------------------------------------- /packages/config/src/decorators/config-param.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { CONFIG_PARAMS } from '../config.constants'; 3 | 4 | export const ConfigParam = (configKey: string, fallback: any | undefined = undefined): ParameterDecorator => ( 5 | target, 6 | propertyKey, 7 | parameterIndex 8 | ) => { 9 | // Pull existing parameters for this method or create an empty array 10 | const existingParameters: any[] = Reflect.getMetadata(CONFIG_PARAMS, target, propertyKey) || []; 11 | // Add this parameter 12 | existingParameters.push({ parameterIndex, propertyKey, configKey, fallback }); 13 | // Update the required parameters for this method 14 | Reflect.defineMetadata(CONFIG_PARAMS, existingParameters, target, propertyKey); 15 | return target; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/config/src/decorators/index.ts: -------------------------------------------------------------------------------- 1 | export * from './config-param'; 2 | export * from './configurable'; 3 | -------------------------------------------------------------------------------- /packages/config/src/env/.env.development: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=development 3 | PORT=8888 -------------------------------------------------------------------------------- /packages/config/src/env/.env.production: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=production 3 | NODE_PORT=9999 -------------------------------------------------------------------------------- /packages/config/src/env/.env.test: -------------------------------------------------------------------------------- 1 | # app 2 | NODE_ENV=development 3 | PORT=7777 -------------------------------------------------------------------------------- /packages/config/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './config.constants'; 2 | export * from './config.helper'; 3 | export * from './config.module'; 4 | export * from './config.service'; 5 | -------------------------------------------------------------------------------- /packages/config/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/config/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/console/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/console/dist/console.constants.d.ts: -------------------------------------------------------------------------------- 1 | export declare const CONSOLE_COMMANDER_PROVIDER: unique symbol; 2 | -------------------------------------------------------------------------------- /packages/console/dist/console.constants.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.CONSOLE_COMMANDER_PROVIDER = Symbol('CONSOLE_COMMANDER_PROVIDER'); 4 | //# sourceMappingURL=console.constants.js.map -------------------------------------------------------------------------------- /packages/console/dist/console.constants.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"console.constants.js","sourceRoot":"","sources":["../src/console.constants.ts"],"names":[],"mappings":";;AAAa,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC"} -------------------------------------------------------------------------------- /packages/console/dist/console.decorators.d.ts: -------------------------------------------------------------------------------- 1 | export declare const InjectCommander: () => ParameterDecorator; 2 | -------------------------------------------------------------------------------- /packages/console/dist/console.decorators.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const common_1 = require("@nestjs/common"); 4 | const console_constants_1 = require("./console.constants"); 5 | exports.InjectCommander = () => common_1.Inject(console_constants_1.CONSOLE_COMMANDER_PROVIDER); 6 | //# sourceMappingURL=console.decorators.js.map -------------------------------------------------------------------------------- /packages/console/dist/console.decorators.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"console.decorators.js","sourceRoot":"","sources":["../src/console.decorators.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,2DAAiE;AAEpD,QAAA,eAAe,GAAG,GAAuB,EAAE,CAAC,eAAM,CAAC,8CAA0B,CAAC,CAAC"} -------------------------------------------------------------------------------- /packages/console/dist/console.interfaces.d.ts: -------------------------------------------------------------------------------- 1 | import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface'; 2 | import { ConsoleService } from './console.service'; 3 | export interface BootstrapConsoleOptions { 4 | module: any; 5 | contextOptions?: NestApplicationContextOptions; 6 | service?: { 7 | new (...args: any[]): ConsoleService; 8 | }; 9 | withContainer?: boolean; 10 | } 11 | -------------------------------------------------------------------------------- /packages/console/dist/console.interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=console.interfaces.js.map -------------------------------------------------------------------------------- /packages/console/dist/console.interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"console.interfaces.js","sourceRoot":"","sources":["../src/console.interfaces.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /packages/console/dist/console.module.d.ts: -------------------------------------------------------------------------------- 1 | import { BootstrapConsoleOptions } from './console.interfaces'; 2 | export declare class ConsoleModule { 3 | static bootstrap(options: BootstrapConsoleOptions): Promise<{ 4 | app: import("@nestjs/common").INestApplicationContext; 5 | boot(argv?: string[]): any; 6 | }>; 7 | static createAppContext(options: BootstrapConsoleOptions): Promise; 8 | } 9 | -------------------------------------------------------------------------------- /packages/console/dist/console.providers.d.ts: -------------------------------------------------------------------------------- 1 | export declare const CommanderProvider: { 2 | provide: symbol; 3 | useValue: import("commander").Command; 4 | }; 5 | -------------------------------------------------------------------------------- /packages/console/dist/console.providers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const commander_1 = require("commander"); 4 | const console_constants_1 = require("./console.constants"); 5 | exports.CommanderProvider = { 6 | provide: console_constants_1.CONSOLE_COMMANDER_PROVIDER, 7 | useValue: new commander_1.Command() 8 | }; 9 | //# sourceMappingURL=console.providers.js.map -------------------------------------------------------------------------------- /packages/console/dist/console.providers.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"console.providers.js","sourceRoot":"","sources":["../src/console.providers.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,2DAAiE;AAEpD,QAAA,iBAAiB,GAAG;IAC7B,OAAO,EAAE,8CAA0B;IACnC,QAAQ,EAAE,IAAI,mBAAO,EAAE;CAC1B,CAAC"} -------------------------------------------------------------------------------- /packages/console/dist/console.service.d.ts: -------------------------------------------------------------------------------- 1 | import { Command as Cli } from 'commander'; 2 | import * as ora from 'ora'; 3 | import * as inquirer from 'inquirer'; 4 | export declare class ConsoleService { 5 | private readonly cli; 6 | constructor(cli: Cli); 7 | static createSpinner(text?: string): ora.Ora; 8 | static createInquirer(): inquirer.Inquirer; 9 | getCli(): Cli; 10 | init(argv: string[]): any; 11 | exit(): void; 12 | } 13 | -------------------------------------------------------------------------------- /packages/console/dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './console.constants'; 2 | export * from './console.decorators'; 3 | export * from './console.interfaces'; 4 | export * from './console.module'; 5 | export * from './console.service'; 6 | -------------------------------------------------------------------------------- /packages/console/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function __export(m) { 3 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 4 | } 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | __export(require("./console.constants")); 7 | __export(require("./console.decorators")); 8 | __export(require("./console.module")); 9 | __export(require("./console.service")); 10 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /packages/console/dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,0CAAqC;AAErC,sCAAiC;AACjC,uCAAkC"} -------------------------------------------------------------------------------- /packages/console/dist/test/command.d.ts: -------------------------------------------------------------------------------- 1 | import { ConsoleService } from '../console.service'; 2 | export declare class Command { 3 | private readonly cli; 4 | constructor(cli: ConsoleService); 5 | list(directory: string): Promise; 6 | rm(dir: string, cmdObj: any): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /packages/console/dist/test/console.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /packages/console/dist/test/console.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const console_module_1 = require("../console.module"); 4 | const module_1 = require("./module"); 5 | console_module_1.ConsoleModule.bootstrap({ module: module_1.ConsoleModuleTest }) 6 | .then(({ app, boot }) => { 7 | boot(); 8 | }) 9 | .catch((err) => console.error(err)); 10 | //# sourceMappingURL=console.js.map -------------------------------------------------------------------------------- /packages/console/dist/test/console.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/test/console.ts"],"names":[],"mappings":";;AAAA,sDAAkD;AAClD,qCAA6C;AAE7C,8BAAa,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,0BAAiB,EAAE,CAAC;KACjD,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;IACpB,IAAI,EAAE,CAAC;AACX,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /packages/console/dist/test/module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ConsoleModuleTest { 2 | } 3 | -------------------------------------------------------------------------------- /packages/console/dist/test/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/test/module.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,sDAAkD;AAClD,uCAAoC;AAMpC,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAJ7B,eAAM,CAAC;QACJ,OAAO,EAAE,CAAC,8BAAa,CAAC;QACxB,SAAS,EAAE,CAAC,iBAAO,CAAC;KACvB,CAAC;GACW,iBAAiB,CAAG;AAApB,8CAAiB"} -------------------------------------------------------------------------------- /packages/console/src/console.constants.ts: -------------------------------------------------------------------------------- 1 | export const CONSOLE_COMMANDER_PROVIDER = Symbol('CONSOLE_COMMANDER_PROVIDER'); 2 | -------------------------------------------------------------------------------- /packages/console/src/console.decorators.ts: -------------------------------------------------------------------------------- 1 | import { Inject } from '@nestjs/common'; 2 | import { CONSOLE_COMMANDER_PROVIDER } from './console.constants'; 3 | 4 | export const InjectCommander = (): ParameterDecorator => Inject(CONSOLE_COMMANDER_PROVIDER); 5 | -------------------------------------------------------------------------------- /packages/console/src/console.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface'; 2 | import { ConsoleService } from './console.service'; 3 | 4 | export interface BootstrapConsoleOptions { 5 | module: any; 6 | contextOptions?: NestApplicationContextOptions; 7 | service?: { new (...args: any[]): ConsoleService }; 8 | withContainer?: boolean; 9 | } 10 | -------------------------------------------------------------------------------- /packages/console/src/console.providers.ts: -------------------------------------------------------------------------------- 1 | import { Command } from 'commander'; 2 | import { CONSOLE_COMMANDER_PROVIDER } from './console.constants'; 3 | 4 | export const CommanderProvider = { 5 | provide: CONSOLE_COMMANDER_PROVIDER, 6 | useValue: new Command() 7 | }; 8 | -------------------------------------------------------------------------------- /packages/console/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './console.constants'; 2 | export * from './console.decorators'; 3 | export * from './console.interfaces'; 4 | export * from './console.module'; 5 | export * from './console.service'; 6 | -------------------------------------------------------------------------------- /packages/console/src/test/console.ts: -------------------------------------------------------------------------------- 1 | import { ConsoleModule } from '../console.module'; 2 | import { ConsoleModuleTest } from './module'; 3 | 4 | ConsoleModule.bootstrap({ module: ConsoleModuleTest }) 5 | .then(({ app, boot }) => { 6 | boot(); 7 | }) 8 | .catch((err) => console.error(err)); 9 | -------------------------------------------------------------------------------- /packages/console/src/test/module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { ConsoleModule } from '../console.module'; 3 | import { Command } from './command'; 4 | 5 | @Module({ 6 | imports: [ConsoleModule], 7 | providers: [Command] 8 | }) 9 | export class ConsoleModuleTest {} 10 | -------------------------------------------------------------------------------- /packages/console/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/console/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/console/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/core/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './traits'; 2 | export * from './utils'; 3 | export * from './interfaces'; 4 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/config.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IConfigService { 2 | get(param: string | string[], value?: any): any; 3 | has(param: string | string[]): boolean; 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/event.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IEventPublisher { 2 | publish(eventName: string | symbol, data?: any): boolean; 3 | subscribe(eventName: string | symbol, callback: (...args: any[]) => Promise): any; 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from './cache.interface'; 2 | export * from './config.interface'; 3 | export * from './event.interface'; 4 | export * from './logger.interface'; 5 | export * from './notification.interface'; 6 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/logger.interface.ts: -------------------------------------------------------------------------------- 1 | export interface ILoggerService { 2 | error(...messages: any[]): any; 3 | warn(...messages: any[]): any; 4 | info(...messages: any[]): any; 5 | verbose(...messages: any[]): any; 6 | debug(...messages: any[]): any; 7 | silly(...messages: any[]): any; 8 | } 9 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/notification.interface.ts: -------------------------------------------------------------------------------- 1 | export interface INotificationMessage { 2 | readonly type: string; 3 | readonly action: string; 4 | readonly context?: any; 5 | } 6 | 7 | export interface INotification { 8 | notify(message: INotificationMessage): Promise; 9 | } 10 | -------------------------------------------------------------------------------- /packages/core/src/interfaces/task-queue.interface.ts: -------------------------------------------------------------------------------- 1 | import { Queue } from 'bull'; 2 | 3 | export interface ITaskQueue extends Queue {} 4 | -------------------------------------------------------------------------------- /packages/core/src/traits/index.ts: -------------------------------------------------------------------------------- 1 | export * from './trait'; 2 | export * from './frequencies.trait'; 3 | -------------------------------------------------------------------------------- /packages/core/src/traits/trait.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_FILTER = /(prototype|name|constructor|length)/; 2 | 3 | export abstract class Trait {} 4 | 5 | export function UseTraits(...traits: Trait[]) { 6 | return (target) => traits.forEach((trait) => copyProperties(target.prototype, (trait as any).prototype)); 7 | } 8 | 9 | export function copyProperties(target: T1, source: T2, filters = [DEFAULT_FILTER]) { 10 | Object.getOwnPropertyNames(source) 11 | .filter((key) => filters.every((f) => !f.test(key)) && typeof target[key] === 'undefined') 12 | .forEach((key) => { 13 | const desc = Object.getOwnPropertyDescriptor(source, key); 14 | Object.defineProperty(target, key, desc!); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /packages/core/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './compose'; 2 | export * from './metadata-explorer'; 3 | -------------------------------------------------------------------------------- /packages/core/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/core/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/crypt/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/crypt/src/crypt.constants.ts: -------------------------------------------------------------------------------- 1 | export const CRYPT_MODULE_OPTIONS = Symbol('CRYPT_MODULE_OPTIONS'); 2 | -------------------------------------------------------------------------------- /packages/crypt/src/crypt.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 2 | 3 | export type CryptModuleOptions = { 4 | salt: string; 5 | }; 6 | 7 | export interface CryptModuleAsyncOptions extends Pick { 8 | useFactory: (...args: any[]) => Promise | CryptModuleOptions; 9 | inject?: any[]; 10 | } 11 | -------------------------------------------------------------------------------- /packages/crypt/src/crypt.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { CryptService } from './crypt.service'; 2 | 3 | describe('Crypt Service', () => { 4 | let service: CryptService; 5 | 6 | beforeEach(async () => { 7 | service = new CryptService({ salt: 'test' }); 8 | }); 9 | 10 | it('Encryption should succeed', async () => { 11 | const hash = await service.encrypt('test'); 12 | 13 | expect(hash).toBeDefined(); 14 | expect(hash.length).toEqual(60); 15 | }); 16 | 17 | it('Hash comparison should be correct', async () => { 18 | const a = await service.compare('test', '$2a$10$WUKKFxmTVo5KNBza./N1MOZ.gK27qX.t46/hh2fhWFJ.o9zGCurwm'); 19 | const b = await service.compare('test', '$2a$10$m/n/4OXtGOOym/S/bFf1gup2zBkZlff7oI1e8CQDXC9VQNonv8ery'); 20 | 21 | expect(a && b).toEqual(true); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/crypt/src/crypt.service.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable } from '@nestjs/common'; 2 | import * as bcrypt from 'bcryptjs'; 3 | import { CRYPT_MODULE_OPTIONS } from './crypt.constants'; 4 | import { CryptModuleOptions } from './crypt.interfaces'; 5 | 6 | @Injectable() 7 | export class CryptService { 8 | constructor( 9 | @Inject(CRYPT_MODULE_OPTIONS) 10 | private readonly options: CryptModuleOptions 11 | ) {} 12 | 13 | async encrypt(str: string): Promise { 14 | return await bcrypt.hash(str + this.options.salt, await bcrypt.genSalt()); 15 | } 16 | 17 | async compare(str: string, hash: string): Promise { 18 | return await bcrypt.compare(str + this.options.salt, hash); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/crypt/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './crypt.constants'; 2 | export * from './crypt.interfaces'; 3 | export * from './crypt.module'; 4 | export * from './crypt.service'; 5 | -------------------------------------------------------------------------------- /packages/crypt/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/crypt/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/crypt/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/event-bus/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/event-bus/src/event-bus.constants.ts: -------------------------------------------------------------------------------- 1 | export const EVENT_BUS_OPTIONS = Symbol('EVENT_BUS_OPTIONS'); 2 | export const EVENT_BUS_SUBSCRIBER = Symbol('EVENT_BUS_SUBSCRIBER'); 3 | export const EVENT_BUS_LISTENER = Symbol('EVENT_BUS_LISTENER'); 4 | export const EVENT_BUS_ERROR = Symbol('EVENT_BUS_ERROR'); 5 | -------------------------------------------------------------------------------- /packages/event-bus/src/event-bus.decorators.ts: -------------------------------------------------------------------------------- 1 | import { SetMetadata, Inject } from '@nestjs/common'; 2 | import { EVENT_BUS_LISTENER, EVENT_BUS_SUBSCRIBER, EVENT_BUS_OPTIONS } from './event-bus.constants'; 3 | import { ListenerDecoratorOptions, SubscriberDecoratorOptions } from './event-bus.interfaces'; 4 | 5 | export const Subscriber = (options: SubscriberDecoratorOptions = {}): ClassDecorator => SetMetadata(EVENT_BUS_SUBSCRIBER, options); 6 | 7 | export const Listener = (options: ListenerDecoratorOptions): MethodDecorator => SetMetadata(EVENT_BUS_LISTENER, options || {}); 8 | 9 | export const InjectEventBusModuleOptions = (): ParameterDecorator => Inject(EVENT_BUS_OPTIONS); 10 | -------------------------------------------------------------------------------- /packages/event-bus/src/event-bus.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 2 | import { EventEmitter } from 'events'; 3 | 4 | export interface SubscriberDecoratorOptions {} 5 | 6 | export interface ListenerDecoratorOptions { 7 | event: string | symbol; 8 | } 9 | 10 | export type Callback = (...args: any[]) => Promise; 11 | 12 | export interface EventBusModuleOptions { 13 | event?: EventEmitter; 14 | } 15 | 16 | export interface EventBusModuleAsyncOptions extends Pick { 17 | useFactory: (...args: any[]) => Promise | EventBusModuleOptions; 18 | inject?: any[]; 19 | } 20 | -------------------------------------------------------------------------------- /packages/event-bus/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './event-bus.constants'; 2 | export * from './event-bus.decorators'; 3 | export * from './event-bus.interfaces'; 4 | export * from './event-bus.module'; 5 | export * from './event-bus.service'; 6 | -------------------------------------------------------------------------------- /packages/event-bus/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/event-bus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/event-bus/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/logger/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/logger/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './logger.constants'; 2 | export * from './logger.decorators'; 3 | export * from './logger.enums'; 4 | export * from './logger.interfaces'; 5 | export * from './logger.module'; 6 | export * from './logger.service'; 7 | -------------------------------------------------------------------------------- /packages/logger/src/logger.constants.ts: -------------------------------------------------------------------------------- 1 | export const LOGGER_MODULE_OPTIONS = Symbol('LOGGER_MODULE_OPTIONS'); 2 | export const LOGGER_MODULE_PROVIDER = Symbol('LOGGER_MODULE_PROVIDER'); 3 | -------------------------------------------------------------------------------- /packages/logger/src/logger.decorators.ts: -------------------------------------------------------------------------------- 1 | import { Inject } from '@nestjs/common'; 2 | import { LOGGER_MODULE_PROVIDER } from './logger.constants'; 3 | 4 | export const InjectLoggerProvider = () => Inject(LOGGER_MODULE_PROVIDER); 5 | -------------------------------------------------------------------------------- /packages/logger/src/logger.enums.ts: -------------------------------------------------------------------------------- 1 | export enum LoggerLevel { 2 | ERROR = 'error', 3 | WARN = 'warn', 4 | INFO = 'info', 5 | VERBOSE = 'verbose', 6 | DEBUG = 'debug', 7 | SILLY = 'silly' 8 | } 9 | -------------------------------------------------------------------------------- /packages/logger/src/logger.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 2 | import { LoggerOptions } from 'winston'; 3 | 4 | export type LoggerModuleOptions = LoggerOptions; 5 | 6 | export interface LoggerModuleAsyncOptions extends Pick { 7 | useFactory: (...args: any[]) => Promise | LoggerModuleOptions; 8 | inject?: any[]; 9 | } 10 | -------------------------------------------------------------------------------- /packages/logger/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/logger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/logger/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/mailer/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules 3 | 4 | .env -------------------------------------------------------------------------------- /packages/mailer/src/adapters/index.ts: -------------------------------------------------------------------------------- 1 | export * from './art.adapter'; 2 | -------------------------------------------------------------------------------- /packages/mailer/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './adapters'; 2 | export * from './mailer.constants'; 3 | export * from './mailer.decorators'; 4 | export * from './mailer.interfaces'; 5 | export * from './mailer.module'; 6 | export * from './mailer.service'; 7 | -------------------------------------------------------------------------------- /packages/mailer/src/mailer.constants.ts: -------------------------------------------------------------------------------- 1 | export const MAILER_TRANSPORTER = Symbol('MAILER_TRANSPORTER'); 2 | export const MAILER_MODULE_OPTIONS = Symbol('MAILER_MODULE_OPTIONS'); 3 | -------------------------------------------------------------------------------- /packages/mailer/src/mailer.decorators.ts: -------------------------------------------------------------------------------- 1 | import { Inject } from '@nestjs/common'; 2 | import { MAILER_MODULE_OPTIONS, MAILER_TRANSPORTER } from './mailer.constants'; 3 | 4 | export const InjectMailerModuleOptions = (): ParameterDecorator => Inject(MAILER_MODULE_OPTIONS); 5 | export const InjectMailerTransporter = (): ParameterDecorator => Inject(MAILER_TRANSPORTER); 6 | -------------------------------------------------------------------------------- /packages/mailer/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/mailer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/mailer/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/mailer/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 |

Welcome {{value}} 66661222

13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/mongo-seeder/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/mongo-seeder/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './seeder.decorators'; 2 | export * from './seeder.interfaces'; 3 | export * from './seeder.module'; 4 | export * from './seeder.service'; 5 | -------------------------------------------------------------------------------- /packages/mongo-seeder/src/seeder.constants.ts: -------------------------------------------------------------------------------- 1 | export const SEEDER = Symbol('SEEDER'); 2 | -------------------------------------------------------------------------------- /packages/mongo-seeder/src/seeder.decorators.ts: -------------------------------------------------------------------------------- 1 | import { SCOPE_OPTIONS_METADATA } from '@nestjs/common/constants'; 2 | import { SEEDER } from './seeder.constants'; 3 | import { SeederDecorator } from './seeder.interfaces'; 4 | 5 | export const Seeder = (options: SeederDecorator = {}) => { 6 | return (target: object) => { 7 | Reflect.defineMetadata(SCOPE_OPTIONS_METADATA, options.injectableOptions, target); 8 | Reflect.defineMetadata(SEEDER, options, target); 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/mongo-seeder/src/seeder.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { InjectableOptions } from '@nestjs/common'; 2 | 3 | export interface SeederDecorator { 4 | injectableOptions?: InjectableOptions; 5 | } 6 | 7 | export interface ISeeder { 8 | modelName: string; 9 | sort: number; 10 | seed(): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /packages/mongo-seeder/src/seeder.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { SeederService } from './seeder.service'; 3 | 4 | @Module({ 5 | providers: [SeederService], 6 | exports: [SeederService] 7 | }) 8 | export class SeederModule {} 9 | -------------------------------------------------------------------------------- /packages/mongo-seeder/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/mongo-seeder/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/mongo-seeder/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/notification/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/notification/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './notification.constants'; 2 | export * from './notification.decorators'; 3 | export * from './notification.module'; 4 | export * from './notification.service'; 5 | -------------------------------------------------------------------------------- /packages/notification/src/notification.constants.ts: -------------------------------------------------------------------------------- 1 | export const NOTIFICATION_OPTIONS = Symbol('NOTIFICATION_OPTIONS'); 2 | export const NOTIFICATION_NOTIFIABLE = Symbol('NOTIFICATION_NOTIFIABLE'); 3 | export const NOTIFICATION_ACTION = Symbol('NOTIFICATION_ACTION'); 4 | -------------------------------------------------------------------------------- /packages/notification/src/notification.decorators.ts: -------------------------------------------------------------------------------- 1 | import { SetMetadata } from '@nestjs/common'; 2 | import { NOTIFICATION_ACTION, NOTIFICATION_NOTIFIABLE } from './notification.constants'; 3 | 4 | export const Notifiable = (type: string): ClassDecorator => SetMetadata(NOTIFICATION_NOTIFIABLE, type); 5 | 6 | export const Action = (name: string): MethodDecorator => SetMetadata(NOTIFICATION_ACTION, name); 7 | -------------------------------------------------------------------------------- /packages/notification/src/notification.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { ModuleMetadata } from '@nestjs/common/interfaces'; 2 | import { EventEmitter } from 'events'; 3 | 4 | export interface NotificationModuleOptions { 5 | event: EventEmitter; 6 | } 7 | 8 | export interface NotificationModuleAsyncOptions extends Pick { 9 | useFactory: (...args: any[]) => Promise | NotificationModuleOptions; 10 | inject?: any[]; 11 | } 12 | -------------------------------------------------------------------------------- /packages/notification/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/notification/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/notification/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/rule-engine/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/rule-engine/src/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rule'; 2 | export * from './rule-builder'; 3 | export * from './rule-engine'; 4 | -------------------------------------------------------------------------------- /packages/rule-engine/src/core/rule.spec.ts: -------------------------------------------------------------------------------- 1 | import { Fact } from '../types'; 2 | import { DefaultRule } from './rule'; 3 | 4 | describe('Rule', () => { 5 | let rule: DefaultRule; 6 | 7 | beforeAll(async () => { 8 | const condition = async (facts: Fact) => { 9 | return 'test' === facts['value']; 10 | }; 11 | 12 | const action = async (facts: Fact) => { 13 | console.log('action', facts); 14 | }; 15 | 16 | rule = new DefaultRule(condition, [action], 'test rule', 'A test rule', 1); 17 | }); 18 | 19 | it('evaluate should correctly', async () => { 20 | expect(await rule.evaluate({ value: 'test' })).toEqual(true); 21 | }); 22 | 23 | it('execute should correctly', async () => { 24 | expect(await rule.execute({ value: 'test' })).toBeUndefined(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/rule-engine/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rule-engine.constants'; 2 | export * from './rule-engine.decorators'; 3 | export * from './rule-engine.interfaces'; 4 | export * from './rule-engine.module'; 5 | export * from './rule-engine.service'; 6 | export * from './types'; 7 | export * from './core'; 8 | -------------------------------------------------------------------------------- /packages/rule-engine/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rule.interface'; 2 | -------------------------------------------------------------------------------- /packages/rule-engine/src/interfaces/rule.interface.ts: -------------------------------------------------------------------------------- 1 | import { Fact } from '../types'; 2 | 3 | export interface IRule { 4 | _name: string; 5 | _description: string; 6 | _priority: number; 7 | 8 | evaluate(facts: Fact): Promise; 9 | execute(facts: Fact): Promise; 10 | } 11 | -------------------------------------------------------------------------------- /packages/rule-engine/src/rule-engine.constants.ts: -------------------------------------------------------------------------------- 1 | export const RULE_ENGINE_OPTIONS = Symbol('RULE_ENGINE_OPTIONS'); 2 | export const RULE_ENGINE_RULE = Symbol('RULE_ENGINE_RULE'); 3 | export const RULE_ENGINE_CONDITION = Symbol('RULE_ENGINE_CONDITION'); 4 | export const RULE_ENGINE_ACTION = Symbol('RULE_ENGINE_ACTION'); 5 | 6 | export const RULE_CONSTANTS = { 7 | NAME: 'rule', 8 | DESCRIPTION: 'description', 9 | PRIORITY: Number.MAX_VALUE - 1 10 | }; 11 | -------------------------------------------------------------------------------- /packages/rule-engine/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export type Fact = { [name: string]: any }; 2 | 3 | export type ICondition = (facts: Fact) => Promise; 4 | 5 | export type IAction = (facts: Fact) => Promise; 6 | -------------------------------------------------------------------------------- /packages/rule-engine/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/rule-engine/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/rule-engine/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/task-queue/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/task-queue/src/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZhiXiao-Lin/nestify/e95da18be87582cdb78a13e995a04de414cdcdd1/packages/task-queue/src/index.ts -------------------------------------------------------------------------------- /packages/task-queue/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/task-queue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/task-queue/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/verification/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/verification/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './verification'; 2 | -------------------------------------------------------------------------------- /packages/verification/src/verification.spec.ts: -------------------------------------------------------------------------------- 1 | import { Verification } from './verification'; 2 | 3 | describe('Verification', () => { 4 | it('A string of the specified length should bereturned', async () => { 5 | const text = Verification.text(5); 6 | 7 | expect(text).toBeDefined(); 8 | expect(text.length).toEqual(5); 9 | }); 10 | 11 | it('A numeric string of the specified length should be returned', async () => { 12 | const numStr = Verification.number(5); 13 | 14 | expect(numStr).toBeDefined(); 15 | expect(numStr.length).toEqual(5); 16 | expect(numStr.split('').filter((s) => Verification.numbers.includes(s)).length).toEqual(5); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/verification/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/verification/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/verification/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /packages/workflow/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules -------------------------------------------------------------------------------- /packages/workflow/src/core/abstract-workflow.ts: -------------------------------------------------------------------------------- 1 | import { Logger, LoggerService } from '@nestjs/common'; 2 | import { ITaskResult, IWorkFlow } from '../workflow.interfaces'; 3 | 4 | export abstract class AbstractWorkFlow implements IWorkFlow { 5 | constructor(private readonly name: string, protected logger?: LoggerService) { 6 | if (!logger) { 7 | this.logger = new Logger('WorkFlow'); 8 | } 9 | } 10 | 11 | public get Name(): string { 12 | return this.name; 13 | } 14 | 15 | public async call(): Promise { 16 | return null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/workflow/src/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from './abstract-workflow'; 2 | export * from '../predicates/task-predicate'; 3 | export * from './task-result'; 4 | export * from './workflow-engine'; 5 | -------------------------------------------------------------------------------- /packages/workflow/src/core/task-result.ts: -------------------------------------------------------------------------------- 1 | import { ITaskResult } from '../workflow.interfaces'; 2 | import { TaskStatus } from '../workflow.enums'; 3 | 4 | export class TaskResult implements ITaskResult { 5 | private status: TaskStatus; 6 | 7 | constructor(status: TaskStatus) { 8 | this.status = status; 9 | } 10 | 11 | public getStatus(): TaskStatus { 12 | return this.status; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/workflow/src/flows/index.ts: -------------------------------------------------------------------------------- 1 | export * from './conditional.flow'; 2 | export * from './parallel.flow'; 3 | export * from './race.flow'; 4 | export * from './repeat.flow'; 5 | export * from './sequential.flow'; 6 | -------------------------------------------------------------------------------- /packages/workflow/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core'; 2 | export * from './flows'; 3 | export * from './predicates'; 4 | export * from './tasks'; 5 | export * from './workflow.constants'; 6 | export * from './workflow.decorators'; 7 | export * from './workflow.enums'; 8 | export * from './workflow.interfaces'; 9 | export * from './workflow.module'; 10 | export * from './workflow.service'; 11 | -------------------------------------------------------------------------------- /packages/workflow/src/predicates/frequencies.predicate.ts: -------------------------------------------------------------------------------- 1 | import { TaskPredicate } from '../core'; 2 | import { ITaskResult } from '../workflow.interfaces'; 3 | 4 | export class FrequenciesPredicate extends TaskPredicate { 5 | private readonly _total: number; 6 | private _counter: number = 0; 7 | 8 | constructor(total: number) { 9 | super(); 10 | this._total = total; 11 | } 12 | 13 | public async apply(result: ITaskResult): Promise { 14 | return this._total > this._counter++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/workflow/src/predicates/index.ts: -------------------------------------------------------------------------------- 1 | export * from './frequencies.predicate'; 2 | -------------------------------------------------------------------------------- /packages/workflow/src/tasks/index.ts: -------------------------------------------------------------------------------- 1 | export * from './no-op.task'; 2 | -------------------------------------------------------------------------------- /packages/workflow/src/tasks/no-op.task.ts: -------------------------------------------------------------------------------- 1 | import * as UUID from 'uuid'; 2 | import { TaskResult } from '../core/task-result'; 3 | import { TaskStatus } from '../workflow.enums'; 4 | import { ITask } from '../workflow.interfaces'; 5 | 6 | export class NoOpTask implements ITask { 7 | private readonly _name: string = UUID.v4(); 8 | 9 | constructor(name?: string) { 10 | if (!!name) { 11 | this._name = name; 12 | } 13 | } 14 | 15 | public get Name() { 16 | return this._name; 17 | } 18 | 19 | public async call() { 20 | return new TaskResult(TaskStatus.COMPLETED); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/workflow/src/workflow.constants.ts: -------------------------------------------------------------------------------- 1 | export const WORK_FLOW_EVENT_PREFIX = 'workflow'; 2 | export const WORK_FLOW_OPTIONS = Symbol('WORK_FLOW_OPTIONS'); 3 | -------------------------------------------------------------------------------- /packages/workflow/src/workflow.decorators.ts: -------------------------------------------------------------------------------- 1 | import { Inject } from '@nestjs/common'; 2 | import { WORK_FLOW_OPTIONS } from './workflow.constants'; 3 | 4 | export const InjectWorkFlowModuleOptions = (): ParameterDecorator => Inject(WORK_FLOW_OPTIONS); 5 | -------------------------------------------------------------------------------- /packages/workflow/src/workflow.enums.ts: -------------------------------------------------------------------------------- 1 | export enum TaskStatus { 2 | FAILED, 3 | COMPLETED 4 | } 5 | -------------------------------------------------------------------------------- /packages/workflow/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/workflow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } -------------------------------------------------------------------------------- /packages/workflow/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": { 7 | "no-unused-expression": true 8 | }, 9 | "rules": { 10 | "quotemark": [ 11 | true, 12 | "single" 13 | ], 14 | "member-access": [ 15 | false 16 | ], 17 | "ordered-imports": [ 18 | false 19 | ], 20 | "max-line-length": [ 21 | true, 22 | 150 23 | ], 24 | "member-ordering": [ 25 | false 26 | ], 27 | "interface-name": [ 28 | false 29 | ], 30 | "arrow-parens": false, 31 | "object-literal-sort-keys": false 32 | }, 33 | "rulesDirectory": [] 34 | } -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /scripts/docker-entrypoint-initdb.d/init.js: -------------------------------------------------------------------------------- 1 | print("=== Initializing ==="); 2 | 3 | db.createUser( 4 | { 5 | user: "nestify", 6 | pwd: "12345678", 7 | roles: [{ role: "readWrite", db: "nestify" }] 8 | } 9 | ); 10 | 11 | print("=== Initialized ==="); 12 | 13 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "target": "es2017", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "baseUrl": "./", 12 | "incremental": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | "dist" 17 | ] 18 | } --------------------------------------------------------------------------------