@gadmin2n/schematics 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/collection.json +122 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/lib/application/application.factory.d.ts +3 -0
- package/dist/lib/application/application.factory.js +92 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/.dockerignore +33 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/Dockerfile +14 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/Jenkinsfile +44 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/build.sh +18 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/.types.d.ts +143 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/sample.prisma +65 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Game.ts +58 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Log.ts +56 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Role.ts +58 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Source.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/Tasklog.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/_common.ts +16 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/readme.md +49 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.env +20 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.eslintrc.js +25 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/.prettierrc +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/README.md +71 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/config/ac.config.ts +24 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/config/index.ts +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/gadmin-cli.json +17 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/package.json +106 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/prisma/.generator.prisma +32 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/games.ts +71 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/index.ts +27 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/roles.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.spec.ts +22 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.controller.ts +52 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.module.ts +75 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.service.ts +50 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/auth.guard.ts +108 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/roles.guard.ts +47 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/utils.ts +54 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/woaAuth.ts +82 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/yufuid.ts +160 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/main.ts +119 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/index.ts +3 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/test/app.e2e-spec.ts +24 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/test/jest-e2e.json +9 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.build.json +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.json +21 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/README.MD +48 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/craco.config.js +27 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +81 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/favicon.ico +0 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/en.svg +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/images/flags/zh_CN.svg +11 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/index.html +53 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/locales/en/common.json +128 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/locales/zh_CN/common.json +130 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/App.tsx +185 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/auditLogProvider.ts +87 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/authProvider.ts +124 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/BulkActions.tsx +236 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/ListPageHeader.tsx +56 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/RowActions.tsx +292 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/SearchBar.tsx +294 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.css +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/VanillaJSONEditor/index.js +53 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/AgentContext.tsx +201 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/AgentPanel.tsx +497 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/ElementInspector.tsx +282 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/agentAttributes.ts +61 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/index.ts +18 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/inspectorActions.ts +111 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/promptGenerator.ts +75 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/skills.ts +464 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/eventList/index.tsx +62 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/index.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logButton/index.tsx +96 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/logList/index.tsx +73 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/components/modalDiffViewer/index.tsx +104 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/auditLog/index.tsx +2 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/business/index.tsx +65 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/color-mode/index.tsx +60 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/index.ts +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/header/index.tsx +130 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/index.ts +2 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/sider.tsx +218 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/styles.ts +10 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/offLayoutArea/index.tsx +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/form.tsx +419 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/index.tsx +3 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/list.tsx +465 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/login.ts +124 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/show.tsx +182 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/helpers/utils.ts +76 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/index.ts +7 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/types.ts +138 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchDelete.ts +191 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperations.ts +152 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchOperationsCore.ts +193 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useBatchUpdate.ts +182 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useListPageState.ts +303 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useRowSelection.ts +38 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/i18n.ts +19 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/index.tsx +28 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/meta.json +4 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/react-app-env.d.ts +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/reportWebVitals.ts +15 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/setupTests.ts +5 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/styles/antd.less +79 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/tsconfig.json +27 -0
- package/dist/lib/application/schema.json +99 -0
- package/dist/lib/class/class.factory.d.ts +3 -0
- package/dist/lib/class/class.factory.js +42 -0
- package/dist/lib/class/files/js/__name__.js +1 -0
- package/dist/lib/class/files/js/__name__.spec.js +7 -0
- package/dist/lib/class/files/ts/__name__.spec.ts +7 -0
- package/dist/lib/class/files/ts/__name__.ts +1 -0
- package/dist/lib/class/schema.json +45 -0
- package/dist/lib/client-app/angular/angular.factory.d.ts +3 -0
- package/dist/lib/client-app/angular/angular.factory.js +98 -0
- package/dist/lib/client-app/angular/files/angular.constants.ts +4 -0
- package/dist/lib/client-app/angular/files/angular.module.ts +41 -0
- package/dist/lib/client-app/angular/files/angular.providers.ts +27 -0
- package/dist/lib/client-app/angular/files/angular.utils.ts +19 -0
- package/dist/lib/client-app/angular/files/interfaces/angular-options.interface.ts +87 -0
- package/dist/lib/client-app/angular/files/loaders/abstract.loader.ts +16 -0
- package/dist/lib/client-app/angular/files/loaders/express.loader.ts +25 -0
- package/dist/lib/client-app/angular/files/loaders/fastify.loader.ts +34 -0
- package/dist/lib/client-app/angular/files/loaders/noop.loader.ts +12 -0
- package/dist/lib/client-app/angular/schema.json +24 -0
- package/dist/lib/configuration/configuration.factory.d.ts +3 -0
- package/dist/lib/configuration/configuration.factory.js +24 -0
- package/dist/lib/configuration/files/js/nest-cli.json +6 -0
- package/dist/lib/configuration/files/ts/nest-cli.json +5 -0
- package/dist/lib/controller/controller.factory.d.ts +3 -0
- package/dist/lib/controller/controller.factory.js +118 -0
- package/dist/lib/controller/files/js/__name__.controller.js +4 -0
- package/dist/lib/controller/files/js/__name__.controller.spec.js +18 -0
- package/dist/lib/controller/files/ts/__name__.controller.spec.ts +18 -0
- package/dist/lib/controller/files/ts/__name__.controller.ts +137 -0
- package/dist/lib/controller/schema.json +51 -0
- package/dist/lib/decorator/decorator.factory.d.ts +3 -0
- package/dist/lib/decorator/decorator.factory.js +33 -0
- package/dist/lib/decorator/files/js/__name__.decorator.js +3 -0
- package/dist/lib/decorator/files/ts/__name__.decorator.ts +3 -0
- package/dist/lib/decorator/schema.json +36 -0
- package/dist/lib/defaults.d.ts +16 -0
- package/dist/lib/defaults.js +19 -0
- package/dist/lib/filter/files/js/__name__.filter.js +6 -0
- package/dist/lib/filter/files/js/__name__.filter.spec.js +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.spec.ts +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.ts +6 -0
- package/dist/lib/filter/filter.factory.d.ts +3 -0
- package/dist/lib/filter/filter.factory.js +34 -0
- package/dist/lib/filter/schema.json +41 -0
- package/dist/lib/gateway/files/js/__name__.gateway.js +9 -0
- package/dist/lib/gateway/files/js/__name__.gateway.spec.js +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.spec.ts +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.ts +9 -0
- package/dist/lib/gateway/gateway.factory.d.ts +3 -0
- package/dist/lib/gateway/gateway.factory.js +62 -0
- package/dist/lib/gateway/schema.json +41 -0
- package/dist/lib/guard/files/js/__name__.guard.js +8 -0
- package/dist/lib/guard/files/js/__name__.guard.spec.js +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.spec.ts +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.ts +11 -0
- package/dist/lib/guard/guard.factory.d.ts +3 -0
- package/dist/lib/guard/guard.factory.js +34 -0
- package/dist/lib/guard/schema.json +41 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.js +8 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.spec.js +7 -0
- package/dist/lib/interceptor/files/ts/default/__name__.interceptor.spec.ts +7 -0
- package/dist/lib/interceptor/files/ts/default/__name__.interceptor.ts +9 -0
- package/dist/lib/interceptor/files/ts/generated/__name__.interceptor.spec.ts +7 -0
- package/dist/lib/interceptor/files/ts/generated/__name__.interceptor.ts +13 -0
- package/dist/lib/interceptor/interceptor.factory.d.ts +3 -0
- package/dist/lib/interceptor/interceptor.factory.js +116 -0
- package/dist/lib/interceptor/schema.json +50 -0
- package/dist/lib/interface/files/__name__.interface.ts +1 -0
- package/dist/lib/interface/interface.factory.d.ts +3 -0
- package/dist/lib/interface/interface.factory.js +32 -0
- package/dist/lib/interface/schema.json +32 -0
- package/dist/lib/library/files/js/.babelrc +4 -0
- package/dist/lib/library/files/js/jsconfig.json +9 -0
- package/dist/lib/library/files/js/src/__name__.module.js +8 -0
- package/dist/lib/library/files/js/src/__name__.service.js +4 -0
- package/dist/lib/library/files/js/src/__name__.service.spec.js +18 -0
- package/dist/lib/library/files/js/src/index.js +2 -0
- package/dist/lib/library/files/ts/src/__name__.module.ts +8 -0
- package/dist/lib/library/files/ts/src/__name__.service.spec.ts +18 -0
- package/dist/lib/library/files/ts/src/__name__.service.ts +4 -0
- package/dist/lib/library/files/ts/src/index.ts +2 -0
- package/dist/lib/library/files/ts/tsconfig.lib.json +9 -0
- package/dist/lib/library/library.factory.d.ts +3 -0
- package/dist/lib/library/library.factory.js +190 -0
- package/dist/lib/library/schema.json +37 -0
- package/dist/lib/middleware/files/js/__name__.middleware.js +8 -0
- package/dist/lib/middleware/files/js/__name__.middleware.spec.js +7 -0
- package/dist/lib/middleware/files/ts/__name__.middleware.spec.ts +7 -0
- package/dist/lib/middleware/files/ts/__name__.middleware.ts +8 -0
- package/dist/lib/middleware/middleware.factory.d.ts +3 -0
- package/dist/lib/middleware/middleware.factory.js +34 -0
- package/dist/lib/middleware/schema.json +41 -0
- package/dist/lib/module/files/js/__name__.module.js +4 -0
- package/dist/lib/module/files/ts/__name__.module.ts +4 -0
- package/dist/lib/module/module.factory.d.ts +3 -0
- package/dist/lib/module/module.factory.js +58 -0
- package/dist/lib/module/schema.json +46 -0
- package/dist/lib/pipe/files/js/__name__.pipe.js +8 -0
- package/dist/lib/pipe/files/js/__name__.pipe.spec.js +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.spec.ts +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.ts +8 -0
- package/dist/lib/pipe/pipe.factory.d.ts +3 -0
- package/dist/lib/pipe/pipe.factory.js +34 -0
- package/dist/lib/pipe/schema.json +41 -0
- package/dist/lib/prisma-resource/files/ts/__name__.controller.spec.ts +20 -0
- package/dist/lib/prisma-resource/files/ts/__name__.controller.ts +63 -0
- package/dist/lib/prisma-resource/files/ts/__name__.module.ts +9 -0
- package/dist/lib/prisma-resource/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/prisma-resource/files/ts/__name__.service.ts +28 -0
- package/dist/lib/prisma-resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/dist/lib/prisma-resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/dist/lib/prisma-resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/dist/lib/prisma-resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/dist/lib/prisma-resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/dist/lib/prisma-resource/prisma-resource.factory.d.ts +3 -0
- package/dist/lib/prisma-resource/prisma-resource.factory.js +131 -0
- package/dist/lib/prisma-resource/schema.json +91 -0
- package/dist/lib/provider/files/js/__name__.js +4 -0
- package/dist/lib/provider/files/js/__name__.spec.js +18 -0
- package/dist/lib/provider/files/ts/__name__.spec.ts +18 -0
- package/dist/lib/provider/files/ts/__name__.ts +4 -0
- package/dist/lib/provider/provider.factory.d.ts +3 -0
- package/dist/lib/provider/provider.factory.js +67 -0
- package/dist/lib/provider/schema.json +45 -0
- package/dist/lib/resolver/files/js/__name__.resolver.js +4 -0
- package/dist/lib/resolver/files/js/__name__.resolver.spec.js +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.spec.ts +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.ts +4 -0
- package/dist/lib/resolver/resolver.factory.d.ts +3 -0
- package/dist/lib/resolver/resolver.factory.js +62 -0
- package/dist/lib/resolver/schema.json +41 -0
- package/dist/lib/resource/files/ts/__name__.controller.spec.ts +20 -0
- package/dist/lib/resource/files/ts/__name__.controller.ts +63 -0
- package/dist/lib/resource/files/ts/__name__.gateway.spec.ts +19 -0
- package/dist/lib/resource/files/ts/__name__.gateway.ts +34 -0
- package/dist/lib/resource/files/ts/__name__.graphql +24 -0
- package/dist/lib/resource/files/ts/__name__.module.ts +9 -0
- package/dist/lib/resource/files/ts/__name__.resolver.spec.ts +19 -0
- package/dist/lib/resource/files/ts/__name__.resolver.ts +60 -0
- package/dist/lib/resource/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/resource/files/ts/__name__.service.ts +28 -0
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.dto.ts +1 -0
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.input.ts +7 -0
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.dto.ts +6 -0
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.input.ts +13 -0
- package/dist/lib/resource/files/ts/entities/__name@singular@ent__.ts +7 -0
- package/dist/lib/resource/resource.factory.d.ts +3 -0
- package/dist/lib/resource/resource.factory.js +131 -0
- package/dist/lib/resource/schema.json +90 -0
- package/dist/lib/service/files/js/__name__.service.js +4 -0
- package/dist/lib/service/files/js/__name__.service.spec.js +18 -0
- package/dist/lib/service/files/ts/__name__.service.spec.ts +18 -0
- package/dist/lib/service/files/ts/__name__.service.ts +4 -0
- package/dist/lib/service/schema.json +41 -0
- package/dist/lib/service/service.factory.d.ts +3 -0
- package/dist/lib/service/service.factory.js +63 -0
- package/dist/lib/sub-app/files/js/.babelrc +4 -0
- package/dist/lib/sub-app/files/js/index.js +2 -0
- package/dist/lib/sub-app/files/js/jsconfig.json +10 -0
- package/dist/lib/sub-app/files/js/src/app.controller.js +15 -0
- package/dist/lib/sub-app/files/js/src/app.controller.spec.js +22 -0
- package/dist/lib/sub-app/files/js/src/app.module.js +10 -0
- package/dist/lib/sub-app/files/js/src/app.service.js +8 -0
- package/dist/lib/sub-app/files/js/src/main.js +8 -0
- package/dist/lib/sub-app/files/js/test/app.e2e-spec.js +23 -0
- package/dist/lib/sub-app/files/js/test/jest-e2e.json +5 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.spec.ts +22 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.ts +12 -0
- package/dist/lib/sub-app/files/ts/src/__name__.module.ts +10 -0
- package/dist/lib/sub-app/files/ts/src/__name__.service.ts +8 -0
- package/dist/lib/sub-app/files/ts/src/main.ts +8 -0
- package/dist/lib/sub-app/files/ts/test/app.e2e-spec.ts +24 -0
- package/dist/lib/sub-app/files/ts/test/jest-e2e.json +9 -0
- package/dist/lib/sub-app/files/ts/tsconfig.app.json +9 -0
- package/dist/lib/sub-app/schema.json +32 -0
- package/dist/lib/sub-app/sub-app.factory.d.ts +3 -0
- package/dist/lib/sub-app/sub-app.factory.js +245 -0
- package/dist/lib/sub-app/workspace/js/.babelrc +4 -0
- package/dist/lib/sub-app/workspace/js/index.js +2 -0
- package/dist/lib/sub-app/workspace/js/jsconfig.json +10 -0
- package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +9 -0
- package/dist/utils/change.d.ts +46 -0
- package/dist/utils/change.js +95 -0
- package/dist/utils/dependencies.utils.d.ts +15 -0
- package/dist/utils/dependencies.utils.js +42 -0
- package/dist/utils/export-from.declarator.d.ts +10 -0
- package/dist/utils/export-from.declarator.js +39 -0
- package/dist/utils/formatting.d.ts +1 -0
- package/dist/utils/formatting.js +12 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/json-file.util.d.ts +15 -0
- package/dist/utils/json-file.util.js +68 -0
- package/dist/utils/metadata.manager.d.ts +13 -0
- package/dist/utils/metadata.manager.js +162 -0
- package/dist/utils/module-import.declarator.d.ts +10 -0
- package/dist/utils/module-import.declarator.js +39 -0
- package/dist/utils/module-metadata.declarator.d.ts +4 -0
- package/dist/utils/module-metadata.declarator.js +12 -0
- package/dist/utils/module.declarator.d.ts +23 -0
- package/dist/utils/module.declarator.js +32 -0
- package/dist/utils/module.finder.d.ts +13 -0
- package/dist/utils/module.finder.js +24 -0
- package/dist/utils/name.parser.d.ts +12 -0
- package/dist/utils/name.parser.js +17 -0
- package/dist/utils/path.solver.d.ts +4 -0
- package/dist/utils/path.solver.js +14 -0
- package/dist/utils/source-root.helpers.d.ts +8 -0
- package/dist/utils/source-root.helpers.js +35 -0
- package/package.json +99 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pages": {
|
|
3
|
+
"login": {
|
|
4
|
+
"title": "Sign in to your account",
|
|
5
|
+
"signin": "Sign in",
|
|
6
|
+
"signup": "Sign up",
|
|
7
|
+
"divider": "or",
|
|
8
|
+
"fields": {
|
|
9
|
+
"email": "Email",
|
|
10
|
+
"password": "Password"
|
|
11
|
+
},
|
|
12
|
+
"errors": {
|
|
13
|
+
"validEmail": "Invalid email address"
|
|
14
|
+
},
|
|
15
|
+
"buttons": {
|
|
16
|
+
"submit": "Login",
|
|
17
|
+
"forgotPassword": "Forgot password?",
|
|
18
|
+
"noAccount": "Don’t have an account?",
|
|
19
|
+
"rememberMe": "Remember me"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"forgotPassword": {
|
|
23
|
+
"title": "Forgot your password?",
|
|
24
|
+
"fields": {
|
|
25
|
+
"email": "Email"
|
|
26
|
+
},
|
|
27
|
+
"errors": {
|
|
28
|
+
"validEmail": "Invalid email address"
|
|
29
|
+
},
|
|
30
|
+
"buttons": {
|
|
31
|
+
"submit": "Send reset instructions"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"register": {
|
|
35
|
+
"title": "Sign up for your account",
|
|
36
|
+
"fields": {
|
|
37
|
+
"email": "Email",
|
|
38
|
+
"password": "Password"
|
|
39
|
+
},
|
|
40
|
+
"errors": {
|
|
41
|
+
"validEmail": "Invalid email address"
|
|
42
|
+
},
|
|
43
|
+
"buttons": {
|
|
44
|
+
"submit": "Register",
|
|
45
|
+
"haveAccount": "Have an account?"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"updatePassword": {
|
|
49
|
+
"title": "Update password",
|
|
50
|
+
"fields": {
|
|
51
|
+
"password": "New Password",
|
|
52
|
+
"confirmPassword": "Confirm new password"
|
|
53
|
+
},
|
|
54
|
+
"errors": {
|
|
55
|
+
"confirmPasswordNotMatch": "Passwords do not match"
|
|
56
|
+
},
|
|
57
|
+
"buttons": {
|
|
58
|
+
"submit": "Update"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"error": {
|
|
62
|
+
"info": "You may have forgotten to add the {{action}} component to {{resource}} resource.",
|
|
63
|
+
"404": "Sorry, the page you visited does not exist.",
|
|
64
|
+
"resource404": "Are you sure you have created the {{resource}} resource.",
|
|
65
|
+
"backHome": "Back Home"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"actions": {
|
|
69
|
+
"list": "List",
|
|
70
|
+
"create": "Create",
|
|
71
|
+
"edit": "Edit",
|
|
72
|
+
"show": "Show"
|
|
73
|
+
},
|
|
74
|
+
"buttons": {
|
|
75
|
+
"create": "Create",
|
|
76
|
+
"save": "Save",
|
|
77
|
+
"logout": "Logout",
|
|
78
|
+
"delete": "Delete",
|
|
79
|
+
"edit": "Edit",
|
|
80
|
+
"sure": "Ok",
|
|
81
|
+
"cancel": "Cancel",
|
|
82
|
+
"confirm": "Are you sure?",
|
|
83
|
+
"filter": "Filter",
|
|
84
|
+
"clear": "Clear",
|
|
85
|
+
"refresh": "Refresh",
|
|
86
|
+
"show": "Show",
|
|
87
|
+
"undo": "Undo",
|
|
88
|
+
"import": "Import",
|
|
89
|
+
"export": "Export",
|
|
90
|
+
"clone": "Clone",
|
|
91
|
+
"notAccessTitle": "You don't have permission to access"
|
|
92
|
+
},
|
|
93
|
+
"warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.",
|
|
94
|
+
"notifications": {
|
|
95
|
+
"success": "Successful",
|
|
96
|
+
"error": "Error (status code: {{statusCode}})",
|
|
97
|
+
"undoable": "You have {{seconds}} seconds to undo",
|
|
98
|
+
"createSuccess": "Successfully created {{resource}}",
|
|
99
|
+
"createError": "There was an error creating {{resource}} (status code: {{statusCode}})",
|
|
100
|
+
"deleteSuccess": "Successfully deleted {{resource}}",
|
|
101
|
+
"deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})",
|
|
102
|
+
"editSuccess": "Successfully edited {{resource}}",
|
|
103
|
+
"editError": "Error when editing {{resource}} (status code: {{statusCode}})",
|
|
104
|
+
"importProgress": "Importing: {{processed}}/{{total}}"
|
|
105
|
+
},
|
|
106
|
+
"loading": "Loading",
|
|
107
|
+
"tags": {
|
|
108
|
+
"clone": "Clone"
|
|
109
|
+
},
|
|
110
|
+
"dashboard": {
|
|
111
|
+
"title": "Dashboard"
|
|
112
|
+
},
|
|
113
|
+
"resources": {
|
|
114
|
+
"log": {
|
|
115
|
+
"fields":{
|
|
116
|
+
"timestamp": "OperateTime"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"table": {
|
|
121
|
+
"actions": "Actions",
|
|
122
|
+
"detail": "Detail",
|
|
123
|
+
"more": "More"
|
|
124
|
+
},
|
|
125
|
+
"form": {
|
|
126
|
+
"uploadPlaceholder": "Drag & drop a file in this area"
|
|
127
|
+
}
|
|
128
|
+
}
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/public/locales/zh_CN/common.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pages": {
|
|
3
|
+
"login": {
|
|
4
|
+
"title": "Sign in to your account",
|
|
5
|
+
"signin": "Sign in",
|
|
6
|
+
"signup": "Sign up",
|
|
7
|
+
"divider": "or",
|
|
8
|
+
"fields": {
|
|
9
|
+
"email": "Email",
|
|
10
|
+
"password": "Password"
|
|
11
|
+
},
|
|
12
|
+
"errors": {
|
|
13
|
+
"validEmail": "Invalid email address"
|
|
14
|
+
},
|
|
15
|
+
"buttons": {
|
|
16
|
+
"submit": "Login",
|
|
17
|
+
"forgotPassword": "Forgot password?",
|
|
18
|
+
"noAccount": "Don’t have an account?",
|
|
19
|
+
"rememberMe": "Remember me"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"forgotPassword": {
|
|
23
|
+
"title": "Forgot your password?",
|
|
24
|
+
"fields": {
|
|
25
|
+
"email": "Email"
|
|
26
|
+
},
|
|
27
|
+
"errors": {
|
|
28
|
+
"validEmail": "Invalid email address"
|
|
29
|
+
},
|
|
30
|
+
"buttons": {
|
|
31
|
+
"submit": "Send reset instructions"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"register": {
|
|
35
|
+
"title": "Sign up for your account",
|
|
36
|
+
"fields": {
|
|
37
|
+
"email": "Email",
|
|
38
|
+
"password": "Password"
|
|
39
|
+
},
|
|
40
|
+
"errors": {
|
|
41
|
+
"validEmail": "Invalid email address"
|
|
42
|
+
},
|
|
43
|
+
"buttons": {
|
|
44
|
+
"submit": "Register",
|
|
45
|
+
"haveAccount": "Have an account?"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"updatePassword": {
|
|
49
|
+
"title": "Update password",
|
|
50
|
+
"fields": {
|
|
51
|
+
"password": "New Password",
|
|
52
|
+
"confirmPassword": "Confirm new password"
|
|
53
|
+
},
|
|
54
|
+
"errors": {
|
|
55
|
+
"confirmPasswordNotMatch": "Passwords do not match"
|
|
56
|
+
},
|
|
57
|
+
"buttons": {
|
|
58
|
+
"submit": "Update"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"error": {
|
|
62
|
+
"info": "You may have forgotten to add the {{action}} component to {{resource}} resource.",
|
|
63
|
+
"404": "Sorry, the page you visited does not exist.",
|
|
64
|
+
"resource404": "Are you sure you have created the {{resource}} resource.",
|
|
65
|
+
"backHome": "Back Home"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"actions": {
|
|
69
|
+
"list": "List",
|
|
70
|
+
"create": "Create",
|
|
71
|
+
"edit": "编辑",
|
|
72
|
+
"show": "Show"
|
|
73
|
+
},
|
|
74
|
+
"buttons": {
|
|
75
|
+
"create": "新增",
|
|
76
|
+
"save": "保存",
|
|
77
|
+
"logout": "登出",
|
|
78
|
+
"delete": "删除",
|
|
79
|
+
"edit": "编辑",
|
|
80
|
+
"sure": "确定",
|
|
81
|
+
"cancel": "取消",
|
|
82
|
+
"confirm": "确定执行该操作?",
|
|
83
|
+
"filter": "查询",
|
|
84
|
+
"clear": "Clear",
|
|
85
|
+
"refresh": "刷新",
|
|
86
|
+
"show": "详情",
|
|
87
|
+
"undo": "Undo",
|
|
88
|
+
"import": "导入",
|
|
89
|
+
"export": "导出",
|
|
90
|
+
"clone": "复制",
|
|
91
|
+
"notAccessTitle": "You don't have permission to access"
|
|
92
|
+
},
|
|
93
|
+
"warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.",
|
|
94
|
+
"notifications": {
|
|
95
|
+
"success": "Successful",
|
|
96
|
+
"error": "Error (status code: {{statusCode}})",
|
|
97
|
+
"undoable": "You have {{seconds}} seconds to undo",
|
|
98
|
+
"createSuccess": "Successfully created {{resource}}",
|
|
99
|
+
"createError": "There was an error creating {{resource}} (status code: {{statusCode}})",
|
|
100
|
+
"deleteSuccess": "Successfully deleted {{resource}}",
|
|
101
|
+
"deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})",
|
|
102
|
+
"editSuccess": "Successfully edited {{resource}}",
|
|
103
|
+
"editError": "Error when editing {{resource}} (status code: {{statusCode}})",
|
|
104
|
+
"importProgress": "Importing: {{processed}}/{{total}}"
|
|
105
|
+
},
|
|
106
|
+
"loading": "Loading",
|
|
107
|
+
"tags": {
|
|
108
|
+
"clone": "Clone"
|
|
109
|
+
},
|
|
110
|
+
"dashboard": {
|
|
111
|
+
"title": "Dashboard"
|
|
112
|
+
},
|
|
113
|
+
"resources": {
|
|
114
|
+
"log": {
|
|
115
|
+
"fields":{
|
|
116
|
+
"timestamp": "OperateTime"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"table": {
|
|
121
|
+
"actions": "操作",
|
|
122
|
+
"detail": "详情",
|
|
123
|
+
"more": "更多",
|
|
124
|
+
"selected": "选中的",
|
|
125
|
+
"items": "项"
|
|
126
|
+
},
|
|
127
|
+
"form": {
|
|
128
|
+
"uploadPlaceholder": "Drag & drop a file in this area"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Refine, ResourceProps } from "@refinedev/core";
|
|
3
|
+
import {
|
|
4
|
+
notificationProvider,
|
|
5
|
+
ErrorComponent,
|
|
6
|
+
ThemedLayoutV2,
|
|
7
|
+
} from "@refinedev/antd";
|
|
8
|
+
import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar";
|
|
9
|
+
import routerProvider, {
|
|
10
|
+
NavigateToResource,
|
|
11
|
+
UnsavedChangesNotifier,
|
|
12
|
+
} from "@refinedev/react-router-v6";
|
|
13
|
+
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";
|
|
14
|
+
import { useTranslation } from "react-i18next";
|
|
15
|
+
import resources from "generated/resources";
|
|
16
|
+
import { OffLayoutArea } from "components/offLayoutArea";
|
|
17
|
+
import { Header } from "components/layout";
|
|
18
|
+
import { CustomSider } from "./components/layout";
|
|
19
|
+
import { ColorModeContextProvider } from "components/contexts/color-mode";
|
|
20
|
+
import { BusinessContextProvider } from "components/contexts/business";
|
|
21
|
+
import { authProvider } from "authProvider";
|
|
22
|
+
import produce from "immer";
|
|
23
|
+
import Index from "pages/index";
|
|
24
|
+
import "@refinedev/antd/dist/reset.css";
|
|
25
|
+
import { auditLogProvider } from "auditLogProvider";
|
|
26
|
+
import {
|
|
27
|
+
DashboardOutlined,
|
|
28
|
+
SettingOutlined,
|
|
29
|
+
} from "@ant-design/icons";
|
|
30
|
+
import { gadminCrudProvider as dataProvider } from "./helpers/login";
|
|
31
|
+
|
|
32
|
+
const SYSTEM_MENU_NAME = "system";
|
|
33
|
+
const newResources: ResourceProps[] = produce(resources, (draft) => {
|
|
34
|
+
draft.forEach((resource) => {
|
|
35
|
+
if (
|
|
36
|
+
resource.meta &&
|
|
37
|
+
["game", "studio", "role", "log"].includes(resource.name)
|
|
38
|
+
) {
|
|
39
|
+
resource.meta.parent = SYSTEM_MENU_NAME;
|
|
40
|
+
resource.list = `/${SYSTEM_MENU_NAME}${resource.list}`;
|
|
41
|
+
resource.create = `/${SYSTEM_MENU_NAME}${resource.create}`;
|
|
42
|
+
resource.edit = `/${SYSTEM_MENU_NAME}${resource.edit}`;
|
|
43
|
+
resource.clone = `/${SYSTEM_MENU_NAME}${resource.clone}`;
|
|
44
|
+
resource.show = `/${SYSTEM_MENU_NAME}${resource.show}`;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
draft.splice(0, 0, {
|
|
48
|
+
name: "index",
|
|
49
|
+
list: "/index",
|
|
50
|
+
meta: { icon: <DashboardOutlined /> },
|
|
51
|
+
});
|
|
52
|
+
draft.push({
|
|
53
|
+
name: SYSTEM_MENU_NAME,
|
|
54
|
+
list: `/${SYSTEM_MENU_NAME}`,
|
|
55
|
+
meta: { icon: <SettingOutlined /> },
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
function App() {
|
|
60
|
+
const { t, i18n } = useTranslation();
|
|
61
|
+
|
|
62
|
+
const i18nProvider = {
|
|
63
|
+
translate: (key: string, defaultMessage?: string) => t(key, defaultMessage),
|
|
64
|
+
changeLocale: (lang: string) => i18n.changeLanguage(lang),
|
|
65
|
+
getLocale: () => i18n.language,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<BrowserRouter>
|
|
70
|
+
<RefineKbarProvider>
|
|
71
|
+
<BusinessContextProvider>
|
|
72
|
+
<ColorModeContextProvider>
|
|
73
|
+
<Refine
|
|
74
|
+
resources={newResources}
|
|
75
|
+
notificationProvider={notificationProvider}
|
|
76
|
+
routerProvider={routerProvider}
|
|
77
|
+
i18nProvider={i18nProvider}
|
|
78
|
+
authProvider={authProvider}
|
|
79
|
+
auditLogProvider={auditLogProvider(dataProvider)}
|
|
80
|
+
dataProvider={{
|
|
81
|
+
default: dataProvider,
|
|
82
|
+
}}
|
|
83
|
+
options={{
|
|
84
|
+
syncWithLocation: true,
|
|
85
|
+
warnWhenUnsavedChanges: true,
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<Routes>
|
|
89
|
+
<Route
|
|
90
|
+
path="/"
|
|
91
|
+
element={
|
|
92
|
+
<ThemedLayoutV2
|
|
93
|
+
Sider={CustomSider}
|
|
94
|
+
Title={() => null}
|
|
95
|
+
Header={Header}
|
|
96
|
+
OffLayoutArea={OffLayoutArea}
|
|
97
|
+
>
|
|
98
|
+
<Outlet />
|
|
99
|
+
</ThemedLayoutV2>
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
<Route
|
|
103
|
+
index
|
|
104
|
+
element={<NavigateToResource resource="index" />}
|
|
105
|
+
/>
|
|
106
|
+
<Route path="index" element={<Index />} />
|
|
107
|
+
{newResources
|
|
108
|
+
.filter((resource) => !resource?.meta?.parent)
|
|
109
|
+
.map((resource) => {
|
|
110
|
+
const {
|
|
111
|
+
list: List,
|
|
112
|
+
create: Create,
|
|
113
|
+
edit: Edit,
|
|
114
|
+
show: Show,
|
|
115
|
+
} = resource?.meta?.components || {};
|
|
116
|
+
return (
|
|
117
|
+
<Route
|
|
118
|
+
key={`/${resource.name}`}
|
|
119
|
+
path={`/${resource.name}`}
|
|
120
|
+
>
|
|
121
|
+
{List ? <Route index element={<List />} /> : null}
|
|
122
|
+
{Create ? (
|
|
123
|
+
<Route path="create" element={<Create />} />
|
|
124
|
+
) : null}
|
|
125
|
+
{Edit ? (
|
|
126
|
+
<Route path="edit/:id" element={<Edit />} />
|
|
127
|
+
) : null}
|
|
128
|
+
{Show ? (
|
|
129
|
+
<Route path="show/:id" element={<Show />} />
|
|
130
|
+
) : null}
|
|
131
|
+
{Edit ? (
|
|
132
|
+
<Route path="clone/:id" element={<Edit />} />
|
|
133
|
+
) : null}
|
|
134
|
+
</Route>
|
|
135
|
+
);
|
|
136
|
+
})}
|
|
137
|
+
{[SYSTEM_MENU_NAME].map((name) => (
|
|
138
|
+
<Route path={name}>
|
|
139
|
+
{newResources
|
|
140
|
+
.filter((resource) => resource?.meta?.parent === name)
|
|
141
|
+
.map((resource) => {
|
|
142
|
+
const {
|
|
143
|
+
list: List,
|
|
144
|
+
create: Create,
|
|
145
|
+
edit: Edit,
|
|
146
|
+
show: Show,
|
|
147
|
+
} = resource?.meta?.components || {};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Route
|
|
151
|
+
key={`${resource.name}`}
|
|
152
|
+
path={`${resource.name}`}
|
|
153
|
+
>
|
|
154
|
+
{List ? <Route index element={<List />} /> : null}
|
|
155
|
+
{Create ? (
|
|
156
|
+
<Route path="create" element={<Create />} />
|
|
157
|
+
) : null}
|
|
158
|
+
{Edit ? (
|
|
159
|
+
<Route path="edit/:id" element={<Edit />} />
|
|
160
|
+
) : null}
|
|
161
|
+
{Show ? (
|
|
162
|
+
<Route path="show/:id" element={<Show />} />
|
|
163
|
+
) : null}
|
|
164
|
+
{Edit ? (
|
|
165
|
+
<Route path="clone/:id" element={<Edit />} />
|
|
166
|
+
) : null}
|
|
167
|
+
</Route>
|
|
168
|
+
);
|
|
169
|
+
})}
|
|
170
|
+
</Route>
|
|
171
|
+
))}
|
|
172
|
+
<Route path="*" element={<ErrorComponent />} />
|
|
173
|
+
</Route>
|
|
174
|
+
</Routes>
|
|
175
|
+
<RefineKbar />
|
|
176
|
+
<UnsavedChangesNotifier />
|
|
177
|
+
</Refine>
|
|
178
|
+
</ColorModeContextProvider>
|
|
179
|
+
</BusinessContextProvider>
|
|
180
|
+
</RefineKbarProvider>
|
|
181
|
+
</BrowserRouter>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export default App;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AuditLogProvider } from "@refinedev/core";
|
|
2
|
+
import {
|
|
3
|
+
IDataContextProvider,
|
|
4
|
+
IDataMultipleContextProvider,
|
|
5
|
+
} from "@refinedev/core/dist/interfaces";
|
|
6
|
+
|
|
7
|
+
export function auditLogProvider(
|
|
8
|
+
dataProvider: IDataContextProvider | IDataMultipleContextProvider
|
|
9
|
+
): AuditLogProvider {
|
|
10
|
+
return {
|
|
11
|
+
get: async ({ resource, meta, }) => {
|
|
12
|
+
const { data } = await dataProvider.getList({
|
|
13
|
+
resource: "log",
|
|
14
|
+
filters: [
|
|
15
|
+
{
|
|
16
|
+
field: "resource",
|
|
17
|
+
operator: "eq",
|
|
18
|
+
value: resource,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
field: "resourceId",
|
|
22
|
+
operator: "eq",
|
|
23
|
+
value: String(meta?.id),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return data;
|
|
29
|
+
},
|
|
30
|
+
create: (params) => {
|
|
31
|
+
if (params?.meta?.ids) {
|
|
32
|
+
if (
|
|
33
|
+
["updateMany", "createMany"].includes(params.action) &&
|
|
34
|
+
params.data.length === params?.meta?.ids.length
|
|
35
|
+
) {
|
|
36
|
+
return dataProvider.createMany({
|
|
37
|
+
resource: "log",
|
|
38
|
+
variables: params.data.map((item: any, index: number) => ({
|
|
39
|
+
action: params.action,
|
|
40
|
+
resource: params.resource,
|
|
41
|
+
resourceId: String(params.meta.ids[index]),
|
|
42
|
+
data: JSON.stringify(item),
|
|
43
|
+
previousData: Array.isArray(params.previousData)
|
|
44
|
+
? JSON.stringify(params.previousData[index])
|
|
45
|
+
: JSON.stringify(params.previousData),
|
|
46
|
+
authorName: params?.author?.name || "",
|
|
47
|
+
authorId: String(params?.author?.id) || "",
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
return dataProvider.createMany({
|
|
52
|
+
resource: "log",
|
|
53
|
+
variables: params.meta.ids.map((id: any) => ({
|
|
54
|
+
action: params.action,
|
|
55
|
+
resource: params.resource,
|
|
56
|
+
resourceId: String(id),
|
|
57
|
+
data: "{}",
|
|
58
|
+
previousData: "{}",
|
|
59
|
+
authorName: params?.author?.name || "",
|
|
60
|
+
authorId: String(params?.author?.id) || "",
|
|
61
|
+
})),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return dataProvider.create({
|
|
66
|
+
resource: "log",
|
|
67
|
+
variables: {
|
|
68
|
+
action: params.action,
|
|
69
|
+
resource: params.resource,
|
|
70
|
+
resourceId: params.meta.id || "",
|
|
71
|
+
data: JSON.stringify(params.data),
|
|
72
|
+
previousData: JSON.stringify(params.previousData),
|
|
73
|
+
authorName: params?.author?.name || "",
|
|
74
|
+
authorId: String(params?.author?.id) || "",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
update: async ({ id, name }) => {
|
|
79
|
+
const { data } = await dataProvider.update({
|
|
80
|
+
resource: "log",
|
|
81
|
+
id,
|
|
82
|
+
variables: { name },
|
|
83
|
+
});
|
|
84
|
+
return data;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { AuthBindings } from '@refinedev/core';
|
|
2
|
+
import { getApiUrl } from 'helpers/utils';
|
|
3
|
+
import { requestHeaders } from 'helpers/login';
|
|
4
|
+
import memoize from 'lodash.memoize';
|
|
5
|
+
|
|
6
|
+
const getUserInfoOnce = memoize(async () => {
|
|
7
|
+
const res = await fetch(`${getApiUrl()}/userinfo`, { headers: requestHeaders() });
|
|
8
|
+
const user = await res.json();
|
|
9
|
+
return user;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const authProvider: AuthBindings = {
|
|
13
|
+
login: async ({ providerName, email }) => {
|
|
14
|
+
if (providerName === 'google') {
|
|
15
|
+
window.location.href = 'https://accounts.google.com/o/oauth2/v2/auth';
|
|
16
|
+
return {
|
|
17
|
+
success: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (providerName === 'github') {
|
|
22
|
+
window.location.href = 'https://github.com/login/oauth/authorize';
|
|
23
|
+
return {
|
|
24
|
+
success: true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (email) {
|
|
29
|
+
localStorage.setItem('email', email);
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
redirectTo: '/',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
error: {
|
|
39
|
+
message: 'Login failed',
|
|
40
|
+
name: 'Invalid email or password',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
register: async ({ email, password }) => {
|
|
45
|
+
if (email && password) {
|
|
46
|
+
return {
|
|
47
|
+
success: true,
|
|
48
|
+
redirectTo: '/',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: {
|
|
54
|
+
message: 'Register failed',
|
|
55
|
+
name: 'Invalid email or password',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
updatePassword: async ({ password }) => {
|
|
60
|
+
if (password) {
|
|
61
|
+
//we can update password here
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
redirectTo: '/login',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: {
|
|
70
|
+
message: 'Update password failed',
|
|
71
|
+
name: 'Invalid password',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
forgotPassword: async ({ email }) => {
|
|
76
|
+
if (email) {
|
|
77
|
+
//we can send email with forgot password link here
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
redirectTo: '/login',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: {
|
|
86
|
+
message: 'Forgot password failed',
|
|
87
|
+
name: 'Invalid email',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
logout: async () => {
|
|
92
|
+
localStorage.removeItem('email');
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
redirectTo: '/',
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
onError: async (error) => {
|
|
99
|
+
console.error(error);
|
|
100
|
+
return { error };
|
|
101
|
+
},
|
|
102
|
+
check: async () => {
|
|
103
|
+
return localStorage.getItem('email')
|
|
104
|
+
? { authenticated: true }
|
|
105
|
+
: {
|
|
106
|
+
authenticated: false,
|
|
107
|
+
redirectTo: '/login',
|
|
108
|
+
error: {
|
|
109
|
+
message: 'Check failed',
|
|
110
|
+
name: 'Not authenticated',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
getPermissions: async () => ['admin'],
|
|
115
|
+
getIdentity: async () => {
|
|
116
|
+
const user = await getUserInfoOnce();
|
|
117
|
+
return {
|
|
118
|
+
id: user.userid,
|
|
119
|
+
name: user.username,
|
|
120
|
+
avatar: `https://dayu.woa.com/avatars/${user.username}/avatar.jpg`,
|
|
121
|
+
...user,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
};
|