├── .dockerignore ├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature.md │ └── feature_request.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── Plugins ├── RawCMS.Plugins.ApiGateway │ ├── ApiGatewayPlugin.cs │ ├── Classes │ │ ├── ApiGatewayConfig.cs │ │ ├── Balancer │ │ │ ├── BalancerDispatcher.cs │ │ │ ├── Handles │ │ │ │ ├── HandlerProtocolType.cs │ │ │ │ ├── HttpRawHandler.cs │ │ │ │ └── SocketRawHandler.cs │ │ │ └── Policy │ │ │ │ ├── BalancerPolicy.cs │ │ │ │ ├── RequestCount.cs │ │ │ │ └── RoundRobin.cs │ │ └── Settings │ │ │ ├── BalancerData.cs │ │ │ ├── BalancerOption.cs │ │ │ ├── CacheOption.cs │ │ │ ├── LoggingOption.cs │ │ │ ├── Node.cs │ │ │ └── ProxyOption.cs │ ├── Interfaces │ │ ├── GatewayMiddleware.cs │ │ └── RawHandler.cs │ ├── Middleware │ │ ├── BalancerMiddleware.cs │ │ ├── LoggingMiddleware.cs │ │ └── ProxyMiddleware.cs │ └── RawCMS.Plugins.ApiGateway.csproj ├── RawCMS.Plugins.Core │ ├── AuthPlugin.cs │ ├── Configuration │ │ ├── AuthConfig.cs │ │ ├── ConfigurationOptions.cs │ │ ├── ExternalProvider.cs │ │ └── RawCMSProvider.cs │ ├── Controllers │ │ ├── CRUDController.cs │ │ ├── JsLambdaController.cs │ │ ├── LambdaController.cs │ │ └── admin │ │ │ ├── AdminController.cs │ │ │ ├── ConfigController.cs │ │ │ ├── EnumController.cs │ │ │ └── MetadataController.cs │ ├── CorePlugin.cs │ ├── Data │ │ ├── UserPostSaveLambda.cs │ │ └── UserPresaveLambda.cs │ ├── Extensions │ │ ├── IdentityServerExtensions.cs │ │ └── JwtExstension.cs │ ├── ExternalAuthConfig │ │ └── JwtRegistration.cs │ ├── Handlers │ │ └── RawLocalAccessTokenValidationHandler.cs │ ├── Lambdas │ │ ├── CRUDSecurity │ │ │ ├── DeleteSecurity.cs │ │ │ ├── GenericSecurity.cs │ │ │ ├── ReadSecurity.cs │ │ │ └── WriteSecurity.cs │ │ └── UserInfoLambda.cs │ ├── Model │ │ ├── CollectionSecurityInfo.cs │ │ ├── FieldClientValidation.cs │ │ ├── FieldInfo.cs │ │ ├── IdentityRole.cs │ │ ├── IdentityUser.cs │ │ └── RestMessage.cs │ ├── RawCMS.Plugins.Core.csproj │ ├── SecurityHeadersAttribute.cs │ ├── Stores │ │ ├── RawRoleStore.cs │ │ └── RawUserStore.cs │ └── UserCheckLambda.cs ├── RawCMS.Plugins.FullText │ ├── Controllers │ │ └── FullTextController.cs │ ├── Core │ │ ├── ElasticFullTextService.cs │ │ ├── FullTextService.cs │ │ └── FullTextUtilityService.cs │ ├── FullTextConfig.cs │ ├── FullTextPlugin.cs │ ├── Lambdas │ │ ├── FullTextFilter.cs │ │ └── FullTextLambda.cs │ └── RawCMS.Plugins.FullText.csproj ├── RawCMS.Plugins.GraphQL │ ├── Classes │ │ ├── GraphQLQuery.cs │ │ ├── GraphQLRequest.cs │ │ ├── GraphQLSchema.cs │ │ ├── GraphQLService.cs │ │ ├── GraphQLSettings.cs │ │ └── GraphQLUserContext.cs │ ├── Controllers │ │ └── GraphQLController.cs │ ├── GraphQLPlugin.cs │ ├── RawCMS.Plugins.GraphQL.csproj │ └── Types │ │ ├── JObjectFieldResolver.cs │ │ ├── JObjectRawType.cs │ │ └── NameFieldResolver.cs └── RawCMS.Plugins.KeyStore │ ├── Controllers │ └── KeyStoreController.cs │ ├── KeyStorePlugin.cs │ ├── KeyStoreService.cs │ ├── Model │ └── KeyStoreInsertModel.cs │ └── RawCMS.Plugins.KeyStore.csproj ├── README.md ├── RawCMS.Client ├── BLL │ ├── CommandLineParser │ │ ├── ClientOptions.cs │ │ ├── DeleteOptions.cs │ │ ├── InsertOptions.cs │ │ ├── ListOptions.cs │ │ ├── LoginOptions.cs │ │ ├── PatchOptions.cs │ │ └── ReplaceOptions.cs │ ├── Core │ │ └── App.cs │ ├── Interfaces │ │ ├── IClientConfigService.cs │ │ ├── IConfigService.cs │ │ ├── ILoggerService.cs │ │ ├── IRawCmsService.cs │ │ └── ITokenService.cs │ ├── Model │ │ ├── BaseRequest.cs │ │ ├── ConfigFile.cs │ │ ├── CreateRequest.cs │ │ ├── ExceptionToken.cs │ │ ├── ListRequest.cs │ │ └── TokenResponse.cs │ └── Services │ │ ├── ClientConfigService.cs │ │ ├── ConfigService.cs │ │ ├── LoggerService.cs │ │ ├── RawCmsService.cs │ │ └── TokenService.cs ├── Program.cs ├── RawCMS.Client.csproj ├── appsettings.json └── nlog.config ├── RawCMS.Library ├── Core │ ├── AppEngine.cs │ ├── Attributes │ │ ├── ParameterValidator.cs │ │ ├── RawAuthentication.cs │ │ └── SendStatusCode.cs │ ├── Enum │ │ ├── DataOperation.cs │ │ └── PipelineStage.cs │ ├── Error.cs │ ├── Exceptions │ │ ├── ExceptionWithErrors.cs │ │ └── ValidationException.cs │ ├── Extension │ │ ├── Middleware.cs │ │ ├── MiddlewarePriority.cs │ │ └── Plugin.cs │ ├── Helpers │ │ ├── ApplicationLogger.cs │ │ ├── AssemblyHelper.cs │ │ ├── ReflectionHelper.cs │ │ └── ServiceCollectionExtensions.cs │ ├── Interfaces │ │ ├── IConfigurableMiddleware.cs │ │ └── IConfigurablePlugin.cs │ └── NullSafeDict.cs ├── DataModel │ ├── DataQuery.cs │ ├── Item.cs │ ├── ItemList.cs │ └── MongoSettings.cs ├── JavascriptClient │ ├── JavascriptRestClient.cs │ ├── JavascriptRestClientRequest.cs │ └── RestMessage.cs ├── Lambdas │ ├── AlterQueryLambda.cs │ ├── AuditLambda.cs │ ├── CollectionValidationLambda.cs │ ├── DataEnrichment.cs │ ├── DataProcessLambda.cs │ ├── EntityValidation.cs │ ├── HttpLambda.cs │ ├── JSLambdas │ │ ├── JSPostDeleteLambda.cs │ │ ├── JSPostSaveLambda.cs │ │ ├── JSPreDeleteLambda.cs │ │ └── JSPreSaveLambda.cs │ ├── JsDispatcher.cs │ ├── Lambda.cs │ ├── RelationEnrichment.cs │ ├── RestLambda.cs │ ├── SchemaDeleteLambda.cs │ ├── SchemaValidationLambda.cs │ └── SchemaWriteLambda.cs ├── RawCMS.Library.csproj ├── Schema │ ├── CollectionSchema.cs │ ├── Field.cs │ ├── FieldGraphType.cs │ ├── FieldType.cs │ ├── FieldTypeValidator.cs │ ├── FieldTypes │ │ ├── BoolFieldType.cs │ │ ├── DateTimeFieldType.cs │ │ ├── EntitiesListType.cs │ │ ├── FieldListType.cs │ │ ├── IntFieldType.cs │ │ ├── ListType.cs │ │ ├── NumberFieldType.cs │ │ ├── RelationFieldType.cs │ │ └── TextFieldType.cs │ └── Validation │ │ ├── BaseJavascriptValidator.cs │ │ ├── BoolValidation.cs │ │ ├── DateTimeValidation.cs │ │ ├── EntitiesListValidation.cs │ │ ├── FieldsListValidation.cs │ │ ├── IntValidation.cs │ │ ├── ListValidation.cs │ │ ├── NumberValidation.cs │ │ ├── RelationValidator.cs │ │ └── TextValidation.cs └── Service │ ├── CRUDService.cs │ ├── EntityService.cs │ ├── MongoService.cs │ ├── RelationInfo.cs │ └── RelationInfoService.cs ├── RawCMS.Test ├── CRUDTest.cs ├── ElasticFullText.cs └── RawCMS.Test.csproj ├── RawCMS.sln ├── RawCMS.sln.licenseheader ├── RawCMS ├── .dockerignore ├── Dockerfile ├── Lambdas │ ├── AuditLambda.cs │ └── Rest │ │ └── DummyRest.cs ├── Pages │ ├── Index.cshtml │ └── Index.cshtml.cs ├── Program.cs ├── RawCMS.csproj ├── Startup.cs ├── appsettings.Development.json ├── appsettings.Docker.json ├── appsettings.json ├── conf │ ├── NLog.Development.config │ ├── NLog.Docker.config │ └── NLog.Production.config ├── tempkey.rsa └── wwwroot │ ├── index.html │ └── logo.png ├── asset ├── docimages │ ├── WithRawCMS.png │ ├── Without.png │ ├── architecture.png │ ├── custom endpoint.png │ ├── data-entry.png │ ├── entity-definition.png │ ├── hook.png │ ├── json-portable.png │ ├── projectsettings.png │ ├── runsettings.png │ └── search.png ├── logo_horizzontal.png ├── logo_vertical.png └── wantsyou.jpg ├── docker ├── Dockerfile-api ├── Dockerfile-standalone ├── Dockerfile-ui ├── Readme.md ├── config │ ├── api │ │ └── buildscript.sh │ ├── mongo │ │ ├── dev-user.js │ │ └── init-mongo.sh │ ├── standalone │ │ ├── bootstrap.sh │ │ └── env.json │ └── ui │ │ ├── bootstrap.sh │ │ └── nginx.conf ├── data │ └── database │ │ └── seed │ │ └── _configuration.json ├── demo │ ├── api │ │ └── Dockerfile │ └── ui │ │ └── Dockerfile ├── docker-compose-app.yml ├── docker-compose-prod.yml └── docker-compose.yml ├── docs ├── APITest.md ├── Authentication.md ├── BackgroundJobs.md ├── Client.md ├── Configurable-Plugins.md ├── Custom-Field-Validation.md ├── Custom-Validation.md ├── Data-Schema.md ├── Data-process-Lambda.md ├── Define-net-lambda.md ├── Deploy.md ├── Docker.md ├── Dynamic-Crud-Controller.md ├── Dynamic-Lambda-Controller.md ├── Frontend-Lambda-Examples.md ├── FullText.md ├── Gateway-Plugin.md ├── GraphQL.md ├── Plugin.md ├── RawCMS.postman_collection.json ├── Relation.md ├── Setup-Dev.md ├── TestBook.md ├── Troubleshooting.md ├── Tutorial.md ├── WebApp-Dev-Home.md ├── assets │ ├── auth0-new-api.png │ ├── auth0-new-application.png │ └── jsLambdas.png └── index.md ├── local.bat ├── mkdocs.yml └── raw-cms-app ├── .prettierignore ├── .prettierrc.json ├── .vscode └── settings.json ├── package-lock.json ├── package.json ├── scripts └── build.js └── src ├── app ├── app.js ├── app.tpl.html └── events.js ├── browserconfig.xml ├── config ├── console.js ├── i18n.js ├── raw-cms.js ├── router.js ├── vue-chartjs.js ├── vuelidate.js ├── vuetify.js └── vuex.js ├── env └── env.json ├── favicons ├── android-icon-144x144.png ├── android-icon-192x192.png ├── android-icon-36x36.png ├── android-icon-48x48.png ├── android-icon-72x72.png ├── android-icon-96x96.png ├── apple-icon-114x114.png ├── apple-icon-120x120.png ├── apple-icon-144x144.png ├── apple-icon-152x152.png ├── apple-icon-180x180.png ├── apple-icon-57x57.png ├── apple-icon-60x60.png ├── apple-icon-72x72.png ├── apple-icon-76x76.png ├── apple-icon-precomposed.png ├── apple-icon.png ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.ico ├── ms-icon-144x144.png ├── ms-icon-150x150.png ├── ms-icon-310x310.png └── ms-icon-70x70.png ├── index.html ├── main.js ├── manifest.json ├── modules ├── core │ ├── api │ │ └── api-client.js │ ├── assets │ │ ├── i18n │ │ │ └── i18n.en.json │ │ ├── left-menu-bg.jpg │ │ ├── rawlogo.png │ │ └── rawlogo_small.png │ ├── components │ │ ├── collection-item-details │ │ │ ├── collection-item-details.js │ │ │ └── collection-item-details.tpl.html │ │ ├── collection-table │ │ │ ├── collection-table.js │ │ │ └── collection-table.tpl.html │ │ ├── collections-list │ │ │ ├── collections-list.js │ │ │ └── collections-list.tpl.html │ │ ├── config-edit-dialog │ │ │ └── config-edit-dialog.js │ │ ├── configuration-details │ │ │ ├── configuration-details.js │ │ │ └── configuration-details.tpl.html │ │ ├── configuration-list │ │ │ ├── configuration-list.js │ │ │ └── configuration-list.tpl.html │ │ ├── dashboard │ │ │ ├── dashboard.js │ │ │ └── dashboard.tpl.html │ │ ├── entities-list │ │ │ ├── entities-list.js │ │ │ └── entities-list.tpl.html │ │ ├── entity-details │ │ │ ├── entity-details.css │ │ │ ├── entity-details.js │ │ │ └── entity-details.tpl.html │ │ ├── field-edit │ │ │ ├── field-edit.js │ │ │ └── field-edit.tpl.html │ │ ├── lambda-details │ │ │ ├── lambda-details.js │ │ │ └── lambda-details.tpl.html │ │ ├── lambdas-list │ │ │ ├── lambdas-list.js │ │ │ └── lambdas-list.tpl.html │ │ ├── left-menu │ │ │ ├── left-menu.css │ │ │ ├── left-menu.js │ │ │ └── left-menu.tpl.html │ │ ├── top-bar │ │ │ ├── top-bar.js │ │ │ └── top-bar.tpl.html │ │ ├── user-avatar │ │ │ ├── user-avatar.js │ │ │ └── user-avatar.tpl.html │ │ ├── user-details │ │ │ ├── user-details.js │ │ │ └── user-details.tpl.html │ │ └── users-list │ │ │ ├── users-list.js │ │ │ └── users-list.tpl.html │ ├── config.js │ ├── events.js │ ├── services │ │ ├── configuration.service.js │ │ ├── dashboard.service.js │ │ ├── entities-schema.service.js │ │ ├── lambdas.service.js │ │ ├── login.service.js │ │ ├── metadata.service.js │ │ ├── snackbar.service.js │ │ ├── user-info.service.js │ │ ├── users.service.js │ │ └── validation.service.js │ ├── utils │ │ └── metadata.utils.js │ └── views │ │ ├── about-view │ │ ├── about-view.js │ │ └── about-view.tpl.html │ │ ├── collection-item-details-view │ │ ├── collection-item-details-view.js │ │ └── collection-item-details-view.tpl.html │ │ ├── collection-table-view │ │ ├── collection-table-view.js │ │ └── collection-table-view.tpl.html │ │ ├── collections-list-view │ │ ├── collections-list-view.js │ │ └── collections-list-view.tpl.html │ │ ├── collections-view │ │ ├── collections-view.js │ │ └── collections-view.tpl.html │ │ ├── configuration-details-view │ │ ├── configuration-details-view.js │ │ └── configuration-details-view.tpl.html │ │ ├── configuration-list-view │ │ ├── configuration-list-view.js │ │ └── configuration-list-view.tpl.html │ │ ├── configuration-view │ │ ├── configuration-view.js │ │ └── configuration-view.tpl.html │ │ ├── entities-list-view │ │ ├── entities-list-view.js │ │ └── entities-list-view.tpl.html │ │ ├── entities-view │ │ ├── entities-view.js │ │ └── entities-view.tpl.html │ │ ├── entity-details-view │ │ ├── entity-details-view.js │ │ └── entity-details-view.tpl.html │ │ ├── graphql-view │ │ ├── graphql-view.js │ │ └── graphql-view.tpl.html │ │ ├── home-view │ │ ├── home-view.js │ │ └── home-view.tpl.html │ │ ├── lambda-details-view │ │ ├── lambda-details-view.js │ │ └── lambda-details-view.tpl.html │ │ ├── lambdas-list-view │ │ ├── lambdas-list-view.js │ │ └── lambdas-list-view.tpl.html │ │ ├── lambdas-view │ │ ├── lambdas-view.js │ │ └── lambdas-view.tpl.html │ │ ├── login-view │ │ ├── login-view.js │ │ └── login-view.tpl.html │ │ ├── sandbox │ │ └── formly-test │ │ │ ├── formly-test.js │ │ │ └── formly-test.tpl.html │ │ ├── user-details-view │ │ ├── user-details-view.js │ │ └── user-details-view.tpl.html │ │ ├── users-list-view │ │ ├── users-list-view.js │ │ └── users-list-view.tpl.html │ │ └── users-view │ │ ├── users-view.js │ │ └── users-view.tpl.html ├── formly-material │ ├── assets │ │ └── i18n │ │ │ └── i18n.en.json │ ├── components │ │ ├── base-field │ │ │ └── base-field.js │ │ ├── base-list-field │ │ │ ├── base-list-field.js │ │ │ └── base-list-field.tpl.html │ │ ├── bool-field │ │ │ ├── bool-field.js │ │ │ └── bool-field.tpl.html │ │ ├── date-field │ │ │ ├── date-field.js │ │ │ └── date-field.tpl.html │ │ ├── entities-list-field │ │ │ └── entities-list-field.js │ │ ├── fields-list-field │ │ │ └── fields-list-field.js │ │ ├── int-field │ │ │ └── int-field.js │ │ ├── list-field │ │ │ └── list-field.js │ │ ├── number-field │ │ │ ├── number-field.js │ │ │ └── number-field.tpl.html │ │ ├── relation-field │ │ │ ├── relation-field.js │ │ │ └── relation-field.tpl.html │ │ └── text-field │ │ │ ├── text-field.js │ │ │ └── text-field.tpl.html │ └── config.js └── shared │ ├── components │ ├── charts │ │ ├── charts.utils.js │ │ └── simple-pie-chart │ │ │ └── simple-pie-chart.js │ ├── data-table │ │ ├── data-table.css │ │ ├── data-table.js │ │ └── data-table.tpl.html │ ├── detail-edit │ │ ├── detail-edit.js │ │ └── detail-edit.tpl.html │ └── list │ │ ├── list.css │ │ ├── list.js │ │ └── list.tpl.html │ └── services │ ├── base-api-service.js │ ├── base-crud-service.js │ └── crud-service.js ├── styles.css └── utils ├── immutable.utils.js ├── inheritance.utils.js ├── object.utils.js ├── random.utils.js ├── spinners.js ├── string.utils.js └── time.utils.js /.dockerignore: -------------------------------------------------------------------------------- 1 | bin\ 2 | obj\ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2020 2 | *.sh text eol=lf 3 | *.yml text eol=lf 4 | *.yaml text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature 3 | about: Feature template for developers team 4 | 5 | --- 6 | 7 | ## User story 8 | write here what this feature do and how it will work from a functional point of view (aka business analisys) 9 | 10 | ## task 11 | write here how to implement the feature. use checklist to divide the whole work in smaller parts 12 | 13 | ## acceptance criteria 14 | what functional and technical requirement must be respected to consider the feature woking (even if program works). 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Pull request content 2 | - [ ] ENANCHEMENT 3 | - [ ] BUGFIX 4 | 5 | **Related task:** 6 | 7 | Describe here thecnical detail omitted on task 8 | 9 | ## Notes for admin 10 | What the pull request admin must know before review it 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Classes/Balancer/BalancerDispatcher.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | using RawCMS.Plugins.ApiGateway.Classes.Balancer.Policy; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | 14 | namespace RawCMS.Plugins.ApiGateway.Classes.Balancer 15 | { 16 | public class BalancerDispatcher 17 | { 18 | private List policies { get; set; } 19 | 20 | public BalancerDispatcher(IEnumerable policies) 21 | { 22 | this.policies = policies.ToList(); 23 | } 24 | 25 | public BalancerPolicy GetActiveBalancerPolicy(HttpContext context) 26 | { 27 | return policies.Where(x => x.IsEnable(context)).FirstOrDefault(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Classes/Balancer/Handles/HandlerProtocolType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.ApiGateway.Classes.Balancer.Handles 10 | { 11 | public enum HandlerProtocolType 12 | { 13 | Http, 14 | Socket 15 | } 16 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Classes/Settings/BalancerData.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Plugins.ApiGateway.Classes.Settings 12 | { 13 | public class BalancerData 14 | { 15 | public Dictionary Scores { get; set; } = new Dictionary(); 16 | public long LastServed { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Classes/Settings/LoggingOption.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.ApiGateway.Classes.Settings 10 | { 11 | public class LoggingOption 12 | { 13 | public bool Enable { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Classes/Settings/Node.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.ApiGateway.Classes.Settings 10 | { 11 | public class Node 12 | { 13 | /// 14 | /// Terget Host value 15 | /// 16 | public string Host { get; set; } 17 | 18 | /// 19 | /// Target Port value 20 | /// 21 | public int Port { get; set; } 22 | 23 | /// 24 | /// Target scheme value 25 | /// 26 | public string Scheme { get; set; } 27 | 28 | /// 29 | /// Enable target node 30 | /// 31 | public bool Enable { get; set; } 32 | 33 | public Node() 34 | { 35 | Enable = true; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.ApiGateway/Interfaces/GatewayMiddleware.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | using Microsoft.Extensions.Logging; 11 | using RawCMS.Library.Core.Extension; 12 | using RawCMS.Plugins.ApiGateway.Classes; 13 | using System.Collections.Generic; 14 | 15 | namespace RawCMS.Plugins.ApiGateway.Interfaces 16 | { 17 | public abstract class GatewayMiddleware : Middleware 18 | { 19 | internal IEnumerable handlers { get; set; } 20 | 21 | public GatewayMiddleware(RequestDelegate requestDelegate, ILogger logger, ApiGatewayConfig config, IEnumerable handlers) : 22 | base(requestDelegate, logger, config) 23 | { 24 | this.handlers = handlers; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Configuration/ConfigurationOptions.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.Configuration 10 | { 11 | public class ConfigurationOptions 12 | { 13 | public string MongoConnection { get; set; } 14 | public string MongoDatabaseName { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Configuration/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.Configuration 10 | { 11 | public enum OAuthMode 12 | { 13 | JWT, 14 | Introspection 15 | } 16 | 17 | public class ExternalProvider 18 | { 19 | public OAuthMode Mode { get; set; } 20 | public string SchemaName { get; set; } 21 | public string Authority { get; set; } 22 | public string Audience { get; set; } 23 | public string UserInfoEndpoint { get; set; } 24 | public string RoleClaimType { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Configuration/RawCMSProvider.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.Configuration 10 | { 11 | public class RawCMSProvider 12 | { 13 | public string Authority { get; set; } 14 | public string ClientId { get; set; } 15 | public string ClientSecret { get; set; } 16 | public string ApiResource { get; set; } 17 | 18 | public string AdminApiKey { get; set; } 19 | public string ApiKey { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Controllers/admin/AdminController.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Authorization; 10 | using Microsoft.AspNetCore.Mvc; 11 | using RawCMS.Library.Core; 12 | using RawCMS.Library.Core.Attributes; 13 | using RawCMS.Library.Service; 14 | 15 | namespace RawCMS.Plugins.Core.Controllers.Controllers.admin 16 | { 17 | //[Authorize(AuthenticationSchemes = "Bearer")] 18 | //[Authorize(Roles = "Admin", AuthenticationSchemes = "Bearer,ApiKey")] 19 | [Authorize(Roles = "Admin")] 20 | [Route("system/[controller]")] 21 | [ParameterValidator("collection", "_(.*)", false)] 22 | public class AdminController : CRUDController 23 | { 24 | public AdminController(AppEngine manager, CRUDService service) : base(manager, service) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Controllers/admin/ConfigController.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Authorization; 10 | using Microsoft.AspNetCore.Mvc; 11 | using RawCMS.Library.Core.Attributes; 12 | 13 | namespace RawCMS.Plugins.Core.Controllers.Controllers.admin 14 | { 15 | [AllowAnonymous] 16 | [RawAuthentication] 17 | [Route("system/[controller]")] 18 | public class ConfigController : Controller 19 | { 20 | } 21 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Extensions/IdentityServerExtensions.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using IdentityServer4.Services; 10 | using Microsoft.Extensions.DependencyInjection; 11 | using RawCMS.Plugins.Core.Stores; 12 | 13 | namespace RawCMS.Plugins.Core.Extensions 14 | { 15 | public static class IdentityServerExtensions 16 | { 17 | public static IIdentityServerBuilder AddProfileServiceCustom(this IIdentityServerBuilder builder) 18 | { 19 | builder.Services.AddTransient(); 20 | 21 | return builder; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/ExternalAuthConfig/JwtRegistration.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.ExternalAuthConfig 10 | { 11 | public class JwtRegistration 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Model/CollectionSecurityInfo.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Plugins.Core.Model 12 | { 13 | public class CollectionSecurityInfo 14 | { 15 | public Dictionary> AllowedRoleMap { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.Model 10 | { 11 | public class FieldClientValidation 12 | { 13 | public string Name { get; set; } 14 | public string Function { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Model/FieldInfo.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Schema; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Plugins.Core.Model 13 | { 14 | public class FieldInfo 15 | { 16 | public FieldType Type { get; set; } 17 | public List Validations { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Model/IdentityRole.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.Core.Model 10 | { 11 | public class IdentityRole 12 | { 13 | public string RoleId { get; set; } 14 | public string Description { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/Model/RestMessage.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Plugins.Core.Model 13 | { 14 | public enum RestStatus 15 | { 16 | OK, 17 | KO, 18 | CompletedWithErrors 19 | } 20 | 21 | public class RestMessage 22 | { 23 | public List Errors { get; set; } = new List(); 24 | public List Warnings { get; set; } = new List(); 25 | public List Infos { get; set; } = new List(); 26 | 27 | public RestStatus Status { get; set; } 28 | 29 | public T Data { get; set; } 30 | 31 | public RestMessage(T item) 32 | { 33 | Data = item; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.Core/UserCheckLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using RawCMS.Library.Lambdas; 11 | 12 | namespace RawCMS.Plugins.Core 13 | { 14 | public class UserCheckLambda : RestLambda 15 | { 16 | public override string Description => ""; 17 | public override string Name => "UserCheckLambda"; 18 | 19 | public override JObject Rest(JObject input) 20 | { 21 | return null; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.FullText/FullTextConfig.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.FullText 10 | { 11 | public enum Engine 12 | { 13 | Elastic 14 | } 15 | 16 | public class FullTextConfig 17 | { 18 | public string Url { get; set; } = ("http://localhost:9300"); 19 | public Engine Engine { get; set; } = Engine.Elastic; 20 | } 21 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.FullText/Lambdas/FullTextFilter.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Plugins.FullText.Lambdas 12 | { 13 | public class FullTextFilter 14 | { 15 | public string CollectionName { get; set; } 16 | public List IncludedField { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/Classes/GraphQLRequest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | 11 | namespace RawCMS.Plugins.GraphQL.Classes 12 | { 13 | public class GraphQLRequest 14 | { 15 | public string OperationName { get; set; } 16 | public string Query { get; set; } 17 | public JObject Variables { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/Classes/GraphQLSchema.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | using SchemaQL = GraphQL.Types.Schema; 11 | 12 | namespace RawCMS.Plugins.GraphQL.Classes 13 | { 14 | public class GraphQLSchema : SchemaQL 15 | { 16 | public GraphQLSchema(IServiceProvider serviceProvider, GraphQLQuery graphQLQuery) : base(serviceProvider) 17 | { 18 | Query = graphQLQuery; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/Classes/GraphQLService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.Extensions.Logging; 10 | using RawCMS.Library.Core; 11 | using RawCMS.Library.Service; 12 | 13 | namespace RawCMS.Plugins.GraphQL.Classes 14 | { 15 | public class GraphQLService 16 | { 17 | private ILogger logger; 18 | public CRUDService CrudService { get; private set; } 19 | 20 | private AppEngine appEngine; 21 | 22 | public GraphQLSettings Settings { get; private set; } 23 | 24 | public GraphQLService(AppEngine appEngine, GraphQLSettings settings, CRUDService service, ILogger logger) 25 | { 26 | this.Settings = settings; 27 | this.appEngine = appEngine; 28 | this.CrudService = service; 29 | this.logger = logger; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/Classes/GraphQLSettings.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | using System; 11 | 12 | namespace RawCMS.Plugins.GraphQL.Classes 13 | { 14 | public class GraphQLSettings 15 | { 16 | public GraphQLSettings() 17 | { 18 | Path = "/api/graphql"; 19 | EnableMetrics = false; 20 | GraphiQLPath = "/graphql"; 21 | } 22 | 23 | public string Path { get; set; } 24 | 25 | public string GraphiQLPath { get; set; } 26 | 27 | public Func BuildUserContext { get; set; } 28 | 29 | public bool EnableMetrics { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/Classes/GraphQLUserContext.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Security.Claims; 10 | 11 | namespace RawCMS.Plugins.GraphQL.Classes 12 | { 13 | public class GraphQLUserContext 14 | { 15 | public ClaimsPrincipal User { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.GraphQL/RawCMS.Plugins.GraphQL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | true 6 | 7 | 8 | 9 | ..\..\RawCMS\Plugins\RawCMS.Plugins.GraphQL 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.KeyStore/KeyStoreService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Plugins.KeyStore.Model; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Plugins.KeyStore 13 | { 14 | public class KeyStoreService 15 | { 16 | private static readonly Dictionary db = new Dictionary(); 17 | 18 | public object Get(string key) 19 | { 20 | return db[key]; 21 | } 22 | 23 | internal void Set(KeyStoreInsertModel insert) 24 | { 25 | db[insert.Key] = insert.Value; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Plugins/RawCMS.Plugins.KeyStore/Model/KeyStoreInsertModel.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Plugins.KeyStore.Model 10 | { 11 | public class KeyStoreInsertModel 12 | { 13 | public string Value { get; set; } 14 | public string Key { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/CommandLineParser/ClientOptions.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using CommandLine; 10 | 11 | namespace RawCMS.Client.BLL.CommandLineParser 12 | { 13 | [Verb("client", HelpText = "Set client configuration. Type client form more help.")] 14 | public class ClientOptions 15 | { 16 | //[Option('s', "syncronize", Required = false, HelpText = "File path to synchronize the db.")] 17 | //public string SincronizationFile { get; set; } 18 | 19 | //[Option('r',"purge", Default = false, HelpText = "Remove data during syncronization. Only with syncronization (-s)")] 20 | //public bool RemoveData { get; set; } 21 | 22 | //[Option('d', "data", Required = false, HelpText = "file path contains data. using with create, update")] 23 | //public string DataFile { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Interfaces/IClientConfigService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Client.BLL.Interfaces 10 | { 11 | public interface IClientConfigService 12 | { 13 | T GetValue(string key); 14 | } 15 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Interfaces/IConfigService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Client.BLL.Model; 10 | 11 | namespace RawCMS.Client.BLL.Interfaces 12 | { 13 | public interface IConfigService 14 | { 15 | ConfigFile Load(); 16 | 17 | ConfigFile Save(string filePath); 18 | } 19 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Interfaces/IRawCmsService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Client.BLL.Model; 10 | using RestSharp; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Client.BLL.Interfaces 14 | { 15 | public interface IRawCmsService 16 | { 17 | IRestResponse GetData(ListRequest req); 18 | 19 | IRestResponse CreateElement(CreateRequest req); 20 | 21 | void ElaborateQueue(Dictionary> listFile, ConfigFile config, bool pretty); 22 | 23 | int CheckJSON(string filePath); 24 | 25 | void ProcessDirectory(bool recursive, Dictionary> fileList, string targetDirectory, string collection = null); 26 | 27 | string FixUrl(string serverUrl); 28 | 29 | bool Ping(string url); 30 | } 31 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Interfaces/ITokenService.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Client.BLL.CommandLineParser; 10 | 11 | namespace RawCMS.Client.BLL.Interfaces 12 | { 13 | public interface ITokenService 14 | { 15 | string GetToken(LoginOptions opts); 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Model/BaseRequest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Client.BLL.Model 10 | { 11 | public class BaseRequest 12 | { 13 | public string Token { get; set; } 14 | public string Collection { get; set; } 15 | public string RawQuery { get; set; } 16 | public string Url { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Model/CreateRequest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Client.BLL.Model 10 | { 11 | public class CreateRequest : BaseRequest 12 | { 13 | public string Data { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Model/ExceptionToken.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | 11 | namespace RawCMS.Client.BLL.Model 12 | { 13 | public class ExceptionToken : Exception 14 | { 15 | public string Code { get; set; } 16 | public string OriginalCode { get; set; } 17 | public string Message { get; set; } 18 | 19 | public ExceptionToken(string Code, string message) : this(Code, message, null) 20 | { 21 | this.Code = Code; 22 | Message = message; 23 | } 24 | 25 | public ExceptionToken(string Code, string message, Exception inner) : base(message, inner) 26 | { 27 | this.Code = OriginalCode = Code; 28 | Message = message; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Model/ListRequest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Client.BLL.Model 10 | { 11 | public class ListRequest : BaseRequest 12 | { 13 | public int PageNumber { get; set; } 14 | public int PageSize { get; set; } 15 | public string Id { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Client/BLL/Model/TokenResponse.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Client.BLL.Model 10 | { 11 | public class TokenResponse 12 | { 13 | public string access_token { get; set; } 14 | public int expires_in { get; set; } 15 | public string token_type { get; set; } 16 | 17 | public string error { get; set; } 18 | public string error_description { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /RawCMS.Client/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "BaseUrl": "http://localhost:49439", 3 | "ConfigFile": "RawCMS.{0}.config" 4 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Attributes/RawAuthentication.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Authorization; 10 | 11 | namespace RawCMS.Library.Core.Attributes 12 | { 13 | public class RawAuthenticationAttribute : AuthorizeAttribute 14 | { 15 | //TODO: a che serve? 16 | public RawAuthenticationAttribute() 17 | { 18 | AuthenticationSchemes = "Bearer"; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Attributes/SendStatusCode.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Mvc; 10 | using System.Net; 11 | 12 | namespace RawCMS.Library.Core.Attributes 13 | { 14 | public class SendStatusCode : ActionResult 15 | { 16 | private HttpStatusCode _code { get; set; } 17 | 18 | public SendStatusCode(HttpStatusCode code) 19 | { 20 | _code = code; 21 | } 22 | 23 | public override void ExecuteResult(ActionContext context) 24 | { 25 | context.HttpContext.Response.StatusCode = (int)_code; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Enum/DataOperation.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Core.Enum 10 | { 11 | public enum DataOperation 12 | { 13 | Read, 14 | Write, 15 | Delete 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Enum/PipelineStage.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Core.Enum 10 | { 11 | public enum PipelineStage 12 | { 13 | ValidatioOperation = 0x0, 14 | PreOperation = 0x1, 15 | PostOperation = 0x2, 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Error.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Core 10 | { 11 | public class Error 12 | { 13 | public string Code { get; set; } 14 | public string Title { get; set; } 15 | public string Description { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Exceptions/ExceptionWithErrors.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Library.Core.Exceptions 13 | { 14 | public class ExceptionWithErrors : Exception 15 | { 16 | public List Errors { get; set; } = new List(); 17 | public List Warnings { get; set; } = new List(); 18 | public List Infos { get; set; } = new List(); 19 | 20 | public ExceptionWithErrors() 21 | { 22 | } 23 | 24 | public ExceptionWithErrors(List Errors) : this(Errors, null) 25 | { 26 | } 27 | 28 | public ExceptionWithErrors(List Errors, Exception source) : base("", source) 29 | { 30 | this.Errors = Errors; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Exceptions/ValidationException.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Library.Core.Exceptions 13 | { 14 | public class ValidationException : ExceptionWithErrors 15 | { 16 | public ValidationException(List errors, Exception source) : base(errors, source) 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Extension/Middleware.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | using Microsoft.Extensions.Logging; 11 | using RawCMS.Library.Core.Interfaces; 12 | using System.Threading.Tasks; 13 | 14 | namespace RawCMS.Library.Core.Extension 15 | { 16 | public abstract class Middleware : IConfigurableMiddleware 17 | { 18 | public RequestDelegate next { get; private set; } 19 | public ILogger logger { get; private set; } 20 | public T pluginConfig { get; private set; } 21 | 22 | public Middleware(RequestDelegate requestDelegate, ILogger logger, T config) 23 | { 24 | this.next = requestDelegate; 25 | this.logger = logger; 26 | this.pluginConfig = config; 27 | } 28 | 29 | public abstract string Name { get; } 30 | 31 | public abstract string Description { get; } 32 | 33 | public abstract Task InvokeAsync(HttpContext context); 34 | } 35 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Extension/MiddlewarePriority.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | 11 | namespace RawCMS.Library.Core.Extension 12 | { 13 | public class MiddlewarePriorityAttribute : Attribute 14 | { 15 | public int Order { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Helpers/AssemblyHelper.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Reflection; 12 | 13 | namespace RawCMS.Library.Core.Helpers 14 | { 15 | public class AssemblyHelper 16 | { 17 | public static List GetAllAssembly() 18 | { 19 | List allAssembly = new List(); 20 | allAssembly.AddRange(AppDomain.CurrentDomain.GetAssemblies()); 21 | allAssembly.Add(Assembly.GetExecutingAssembly()); 22 | allAssembly.Add(Assembly.GetEntryAssembly()); 23 | return allAssembly; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Interfaces/IConfigurableMiddleware.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | using System.Threading.Tasks; 11 | 12 | namespace RawCMS.Library.Core.Interfaces 13 | { 14 | public interface IConfigurableMiddleware 15 | { 16 | string Name { get; } 17 | 18 | string Description { get; } 19 | 20 | Task InvokeAsync(HttpContext context); 21 | } 22 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/Interfaces/IConfigurablePlugin.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Core.Interfaces 10 | { 11 | public interface IConfigurablePlugin 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /RawCMS.Library/Core/NullSafeDict.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Library.Core 12 | { 13 | public class NullSafeDict : Dictionary where TValue : class 14 | { 15 | public new TValue this[TKey key] 16 | { 17 | get 18 | { 19 | if (!ContainsKey(key)) 20 | { 21 | return null; 22 | } 23 | else 24 | { 25 | return base[key]; 26 | } 27 | } 28 | set 29 | { 30 | if (!ContainsKey(key)) 31 | { 32 | Add(key, value); 33 | } 34 | else 35 | { 36 | base[key] = value; 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /RawCMS.Library/DataModel/DataQuery.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Library.DataModel 12 | { 13 | public class SortOption 14 | { 15 | public string Field { get; set; } 16 | public bool Ascending { get; set; } 17 | } 18 | 19 | public class DataQuery 20 | { 21 | public string RawQuery { get; set; } 22 | public int PageNumber { get; set; } 23 | public int PageSize { get; set; } 24 | public List Sort { get; set; } 25 | public List Expando { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /RawCMS.Library/DataModel/Item.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using MongoDB.Bson; 10 | 11 | namespace RawCMS.Library.DataModel 12 | { 13 | public class Item : BsonDocument 14 | { 15 | public Item() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /RawCMS.Library/DataModel/ItemList.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | 11 | namespace RawCMS.Library.DataModel 12 | { 13 | public class ItemList 14 | { 15 | public JArray Items { get; set; } = new JArray(); 16 | public int TotalCount { get; set; } 17 | public int PageNumber { get; set; } 18 | public int PageSize { get; set; } 19 | 20 | public ItemList(JArray items, int totalCount, int pageNumber, int pageSize) 21 | { 22 | Items = items; 23 | TotalCount = totalCount; 24 | PageNumber = pageNumber; 25 | PageSize = pageSize; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/JavascriptClient/JavascriptRestClientRequest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using System.Collections.Generic; 10 | 11 | namespace RawCMS.Library.JavascriptClient 12 | { 13 | public class JavascriptRestClientRequest 14 | { 15 | public string Url { get; set; } 16 | public Dictionary Header { get; set; } 17 | public Dictionary QueryParams { get; set; } 18 | public string Method { get; set; } 19 | public string Body { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/JavascriptClient/RestMessage.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Library.JavascriptClient 13 | { 14 | public enum RestStatus 15 | { 16 | OK, 17 | KO, 18 | CompletedWithErrors 19 | } 20 | 21 | public class JavascriptRestClientMessage 22 | { 23 | public List Errors { get; set; } = new List(); 24 | public List Warnings { get; set; } = new List(); 25 | public List Infos { get; set; } = new List(); 26 | 27 | public RestStatus Status { get; set; } 28 | 29 | public T Data { get; set; } 30 | 31 | public JavascriptRestClientMessage(T item) 32 | { 33 | Data = item; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/AlterQueryLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using MongoDB.Bson; 10 | using MongoDB.Driver; 11 | 12 | namespace RawCMS.Library.Lambdas 13 | { 14 | public abstract class AlterQueryLambda : Lambda 15 | { 16 | public abstract void Alter(string collection, FilterDefinition query); 17 | } 18 | 19 | public abstract class CollectionAlterQueryLambda : Lambda 20 | { 21 | public abstract string Collection { get; set; } 22 | 23 | public abstract void Alter(FilterDefinition query); 24 | } 25 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/AuditLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using System; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Library.Lambdas 14 | { 15 | public class AuditLambda : PreSaveLambda 16 | { 17 | public override string Name => "AuditLambda"; 18 | 19 | public override string Description => "Add audit settings"; 20 | 21 | public override void Execute(string collection, ref JObject Item, ref Dictionary dataContext) 22 | { 23 | if (!Item.ContainsKey("_id") || string.IsNullOrEmpty(Item["_id"].ToString())) 24 | { 25 | Item["_createdon"] = DateTime.Now; 26 | } 27 | 28 | Item["_modifiedon"] = DateTime.Now; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/CollectionValidationLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using RawCMS.Library.Core; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Library.Lambdas 14 | { 15 | public abstract class CollectionValidationLambda : Lambda 16 | { 17 | public abstract string[] TargetCollections { get; } 18 | 19 | public abstract List Validate(JObject item); 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/HttpLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Http; 10 | 11 | namespace RawCMS.Library.Lambdas 12 | { 13 | public abstract class HttpLambda : Lambda 14 | { 15 | public abstract object Execute(HttpContext request); 16 | } 17 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/JSLambdas/JSPostDeleteLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core.Enum; 10 | using RawCMS.Library.Service; 11 | 12 | namespace RawCMS.Library.Lambdas.JSLambdas 13 | { 14 | public class JSPostDeleteLambda : JsDispatcher 15 | { 16 | public override PipelineStage Stage => PipelineStage.PostOperation; 17 | 18 | public override DataOperation Operation => DataOperation.Delete; 19 | 20 | public override string Name => "JSPostDeleteLambda"; 21 | 22 | public override string Description => "JSPostDeleteLambda"; 23 | 24 | public JSPostDeleteLambda(EntityService entityService, CRUDService crudService) : base(entityService, crudService) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/JSLambdas/JSPostSaveLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core.Enum; 10 | using RawCMS.Library.Service; 11 | 12 | namespace RawCMS.Library.Lambdas.JSLambdas 13 | { 14 | public class JSPostSaveLambda : JsDispatcher 15 | { 16 | public override PipelineStage Stage => PipelineStage.PostOperation; 17 | 18 | public override DataOperation Operation => DataOperation.Write; 19 | 20 | public override string Name => "JSPostSaveLambda"; 21 | 22 | public override string Description => "JSPostSaveLambda"; 23 | 24 | public JSPostSaveLambda(EntityService entityService, CRUDService crudService) : base(entityService, crudService) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/JSLambdas/JSPreDeleteLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core.Enum; 10 | using RawCMS.Library.Service; 11 | 12 | namespace RawCMS.Library.Lambdas.JSLambdas 13 | { 14 | public class JSPreDeleteLambda : JsDispatcher 15 | { 16 | public override PipelineStage Stage => PipelineStage.PreOperation; 17 | 18 | public override DataOperation Operation => DataOperation.Delete; 19 | 20 | public override string Name => "JSPreDeleteLambda"; 21 | 22 | public override string Description => "JSPreDeleteLambda"; 23 | 24 | public JSPreDeleteLambda(EntityService entityService, CRUDService crudService) : base(entityService, crudService) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/JSLambdas/JSPreSaveLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using RawCMS.Library.Core.Enum; 10 | using RawCMS.Library.Service; 11 | 12 | namespace RawCMS.Library.Lambdas.JSLambdas 13 | { 14 | public class JSPreSaveLambda : JsDispatcher 15 | { 16 | public override PipelineStage Stage => PipelineStage.PreOperation; 17 | 18 | public override DataOperation Operation => DataOperation.Write; 19 | 20 | public override string Name => "JSPreSaveLambda"; 21 | 22 | public override string Description => "JSPreSaveLambda"; 23 | 24 | public JSPreSaveLambda(EntityService entityService, CRUDService crudService) : base(entityService, crudService) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/Lambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Lambdas 10 | { 11 | public abstract class Lambda 12 | { 13 | public abstract string Name { get; } 14 | public abstract string Description { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /RawCMS.Library/Lambdas/SchemaValidationLambda.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using RawCMS.Library.Core; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Library.Lambdas 14 | { 15 | public abstract class SchemaValidationLambda : Lambda 16 | { 17 | public abstract List Validate(JObject input, string collection); 18 | } 19 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/Field.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | 11 | namespace RawCMS.Library.Schema 12 | { 13 | public class Field 14 | { 15 | public string Name { get; set; } 16 | 17 | public bool Required { get; set; } 18 | 19 | public string Type { get; set; } 20 | 21 | public JObject Options { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json; 10 | using Newtonsoft.Json.Converters; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Library.Schema 14 | { 15 | public class OptionParameter 16 | { 17 | public string Type { get; set; } 18 | public string Name { get; set; } 19 | public string Description { get; set; } 20 | } 21 | 22 | public abstract class FieldType 23 | { 24 | public abstract string TypeName { get; } 25 | 26 | [JsonConverter(typeof(StringEnumConverter))] 27 | public abstract FieldGraphType GraphType { get; } 28 | 29 | public virtual List OptionParameter { get; set; } = new List(); 30 | } 31 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypeValidator.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using RawCMS.Library.Core; 11 | using System.Collections.Generic; 12 | 13 | namespace RawCMS.Library.Schema 14 | { 15 | public abstract class FieldTypeValidator 16 | { 17 | public abstract string Type { get; } 18 | 19 | public abstract List Validate(JObject input, Field field); 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/BoolFieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class BoolFieldType : FieldType 12 | { 13 | public override string TypeName => "bool"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.Boolean; 16 | 17 | public BoolFieldType() 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/DateTimeFieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class DateTimeFieldType : FieldType 12 | { 13 | public override string TypeName => "date"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.Date; 16 | 17 | public DateTimeFieldType() 18 | { 19 | OptionParameter.Add(new OptionParameter() 20 | { 21 | Name = "max", 22 | Type = "date" 23 | }); 24 | 25 | OptionParameter.Add(new OptionParameter() 26 | { 27 | Name = "min", 28 | Type = "date" 29 | }); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/EntitiesListType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class EntitiesListType : FieldType 12 | { 13 | public override string TypeName => "entities-list"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.String; 16 | 17 | public EntitiesListType() 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/FieldListType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class FieldListType : FieldType 12 | { 13 | public override string TypeName => "fields-list"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.String; 16 | 17 | public FieldListType() 18 | { 19 | // 20 | OptionParameter.Add(new OptionParameter() 21 | { 22 | Name = "Collection", 23 | Type = "text", 24 | Description = "Collection name" 25 | }); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/IntFieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class IntFieldType : FieldType 12 | { 13 | public override string TypeName => "int"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.Int; 16 | 17 | public IntFieldType() 18 | { 19 | OptionParameter.Add(new OptionParameter() 20 | { 21 | Name = "max", 22 | Type = "int" 23 | }); 24 | 25 | OptionParameter.Add(new OptionParameter() 26 | { 27 | Name = "min", 28 | Type = "int" 29 | }); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/NumberFieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class NumberFieldType : FieldType 12 | { 13 | public override string TypeName => "number"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.Decimal; 16 | 17 | public NumberFieldType() 18 | { 19 | OptionParameter.Add(new OptionParameter() 20 | { 21 | Name = "max", 22 | Type = "number" 23 | }); 24 | 25 | OptionParameter.Add(new OptionParameter() 26 | { 27 | Name = "min", 28 | Type = "number" 29 | }); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/FieldTypes/TextFieldType.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.FieldTypes 10 | { 11 | public class TextFieldType : FieldType 12 | { 13 | public override string TypeName => "text"; 14 | 15 | public override FieldGraphType GraphType => FieldGraphType.String; 16 | 17 | public TextFieldType() 18 | { 19 | OptionParameter.Add(new OptionParameter() 20 | { 21 | Name = "regexp", 22 | Type = "text" 23 | }); 24 | 25 | OptionParameter.Add(new OptionParameter() 26 | { 27 | Name = "maxlength", 28 | Type = "int" 29 | }); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/Validation/BoolValidation.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.Validation 10 | { 11 | public class BoolValidation : BaseJavascriptValidator 12 | { 13 | public override string Type => "bool"; 14 | 15 | public override string Javascript 16 | { 17 | get 18 | { 19 | return @" 20 | const innerValidation = function() { 21 | if (value === null || value === undefined) { 22 | return; 23 | } 24 | 25 | return JSON.stringify(errors); 26 | }; 27 | 28 | var backendResult = innerValidation(); 29 | "; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/Validation/EntitiesListValidation.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.Validation 10 | { 11 | public class EntitiesListValidation : BaseJavascriptValidator 12 | { 13 | public override string Type => "entities-list"; 14 | 15 | public override string Javascript 16 | { 17 | get 18 | { 19 | return @" 20 | const innerValidation = function() { 21 | if (value === null || value === undefined) { 22 | return; 23 | } 24 | 25 | // code starts here 26 | 27 | return JSON.stringify(errors); 28 | }; 29 | 30 | var backendResult = innerValidation(); 31 | "; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /RawCMS.Library/Schema/Validation/FieldsListValidation.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | namespace RawCMS.Library.Schema.Validation 10 | { 11 | public class FieldsListValidation : BaseJavascriptValidator 12 | { 13 | public override string Type => "fields-list"; 14 | 15 | public override string Javascript 16 | { 17 | get 18 | { 19 | return @" 20 | const innerValidation = function() { 21 | if (value === null || value === undefined) { 22 | return; 23 | } 24 | 25 | // code starts here 26 | 27 | return JSON.stringify(errors); 28 | }; 29 | 30 | var backendResult = innerValidation(); 31 | "; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /RawCMS.Library/Service/RelationInfo.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using MongoDB.Bson; 10 | using System.Collections.Generic; 11 | 12 | namespace RawCMS.Library.Service 13 | { 14 | public class RelationInfo 15 | { 16 | public bool IsMultiple { get; set; } 17 | public string LookupCollection { get; set; } 18 | public List Values { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /RawCMS.Test/CRUDTest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Xunit; 10 | 11 | namespace RawCMS.Test 12 | { 13 | public class CRUDTest 14 | { 15 | [Fact] 16 | public void CRUD() 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /RawCMS.Test/RawCMS.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | false 6 | latest 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /RawCMS/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !obj/Docker/publish/* 3 | !obj/Docker/empty/ 4 | -------------------------------------------------------------------------------- /RawCMS/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/aspnetcore:2.0 2 | ARG source 3 | WORKDIR /app 4 | EXPOSE 80 5 | COPY ${source:-obj/Docker/publish} . 6 | ENTRYPOINT ["dotnet", "RawCMS.dll"] 7 | -------------------------------------------------------------------------------- /RawCMS/Lambdas/AuditLambda.cs: -------------------------------------------------------------------------------- 1 | using RawCMS.Library.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using Newtonsoft.Json.Linq; 6 | 7 | namespace RawCMS.Library.Lambdas 8 | { 9 | public class AuditLambda2 : PreSaveLambda 10 | { 11 | public override string Name => "AuditLambda"; 12 | 13 | public override string Description => "Add audit settings"; 14 | 15 | public override void Execute(string collection, JObject Item) 16 | { 17 | if (!Item.ContainsKey("_id") || string.IsNullOrEmpty(Item["_id"].ToString())) 18 | { 19 | Item["_createdon"] = DateTime.Now; 20 | } 21 | 22 | Item["_modifiedon"] = DateTime.Now; 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RawCMS/Lambdas/Rest/DummyRest.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Newtonsoft.Json.Linq; 10 | using RawCMS.Library.Lambdas; 11 | using System; 12 | 13 | namespace RawCMS.Lambdas.Rest 14 | { 15 | public class DummyRest : RestLambda 16 | { 17 | public override string Name => "DummyRest"; 18 | 19 | public override string Description => "I'm a dumb dummy request"; 20 | 21 | public override JObject Rest(JObject input) 22 | { 23 | JObject result = new JObject() 24 | { 25 | { "input",input}, 26 | { "now",DateTime.Now}, 27 | }; 28 | 29 | return result; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /RawCMS/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // Copyright (c) 2019 RawCMS project (https://github.com/arduosoft/RawCMS) 4 | // RawCMS project is released under GPL3 terms, see LICENSE file on repository root at https://github.com/arduosoft/RawCMS . 5 | // 6 | // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' 7 | // true 8 | //****************************************************************************** 9 | using Microsoft.AspNetCore.Mvc.RazorPages; 10 | 11 | namespace RawCMS 12 | { 13 | public class IndexModel : PageModel 14 | { 15 | public void OnGet() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /RawCMS/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "nativeDebugging": true, 3 | "Logging": { 4 | "IncludeScopes": false, 5 | "LogLevel": { 6 | "Default": "Debug", 7 | "System": "Information", 8 | "Microsoft": "Information" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /RawCMS/appsettings.Docker.json: -------------------------------------------------------------------------------- 1 | { 2 | "nativeDebugging": true, 3 | "Logging": { 4 | "IncludeScopes": false, 5 | "LogLevel": { 6 | "Default": "Debug", 7 | "System": "Information", 8 | "Microsoft": "Information" 9 | } 10 | }, 11 | "PluginPath": "/app/Plugins", 12 | "MongoSettings": { 13 | "ConnectionString": "mongodb://localhost:27017/rawCms" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /RawCMS/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | }, 8 | 9 | "PluginPath": "../../../Plugins", 10 | "MongoSettings": { 11 | "ConnectionString": "mongodb://localhost:28017/rawCms" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RawCMS/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 

Hello

2 | 3 | Swagger documentation -------------------------------------------------------------------------------- /RawCMS/wwwroot/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/RawCMS/wwwroot/logo.png -------------------------------------------------------------------------------- /asset/docimages/WithRawCMS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/WithRawCMS.png -------------------------------------------------------------------------------- /asset/docimages/Without.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/Without.png -------------------------------------------------------------------------------- /asset/docimages/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/architecture.png -------------------------------------------------------------------------------- /asset/docimages/custom endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/custom endpoint.png -------------------------------------------------------------------------------- /asset/docimages/data-entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/data-entry.png -------------------------------------------------------------------------------- /asset/docimages/entity-definition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/entity-definition.png -------------------------------------------------------------------------------- /asset/docimages/hook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/hook.png -------------------------------------------------------------------------------- /asset/docimages/json-portable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/json-portable.png -------------------------------------------------------------------------------- /asset/docimages/projectsettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/projectsettings.png -------------------------------------------------------------------------------- /asset/docimages/runsettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/runsettings.png -------------------------------------------------------------------------------- /asset/docimages/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/docimages/search.png -------------------------------------------------------------------------------- /asset/logo_horizzontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/logo_horizzontal.png -------------------------------------------------------------------------------- /asset/logo_vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/logo_vertical.png -------------------------------------------------------------------------------- /asset/wantsyou.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/asset/wantsyou.jpg -------------------------------------------------------------------------------- /docker/Dockerfile-api: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base 2 | WORKDIR /app 3 | 4 | 5 | FROM microsoft/dotnet:2.1-sdk AS build 6 | WORKDIR /src 7 | COPY ./docker/config/api/buildscript.sh ./build.sh 8 | COPY . . 9 | 10 | RUN chmod +x ./build.sh && ./build.sh 11 | 12 | 13 | FROM base AS final 14 | WORKDIR /app 15 | COPY --from=build /dist . 16 | ENTRYPOINT ["dotnet", "RawCMS.dll"] 17 | -------------------------------------------------------------------------------- /docker/Dockerfile-standalone: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.1-aspnetcore-runtime-alpine AS base 2 | RUN apk add --no-cache bash 3 | WORKDIR /app 4 | EXPOSE 80 5 | EXPOSE 443 6 | 7 | FROM microsoft/dotnet:2.1-sdk AS build 8 | WORKDIR /src 9 | #backend 10 | COPY ./docker/config/api/buildscript.sh ./build.sh 11 | COPY . . 12 | #frontend 13 | COPY ./raw-cms-app/src /dist/wwwroot/ 14 | COPY ./docker/config/standalone/env.json /dist/wwwroot/env/env.json 15 | COPY ./docker/config/standalone/bootstrap.sh /dist/bootstrap.sh 16 | 17 | 18 | RUN tr -d '\r' < ./build.sh > ./build.sh &&\ 19 | tr -d '\r' < /dist/bootstrap.sh > /dist/bootstrap.sh &&\ 20 | chmod +x ./build.sh &&\ 21 | chmod +x /dist/bootstrap.sh &&\ 22 | ./build.sh 23 | 24 | 25 | 26 | 27 | 28 | 29 | FROM base AS final 30 | WORKDIR /app 31 | COPY --from=build /dist . 32 | ENV BASE_URL=/ 33 | 34 | RUN ls /app -l 35 | 36 | CMD ["/bin/bash", "-c", " /app/bootstrap.sh && dotnet /app/RawCMS.dll"] 37 | -------------------------------------------------------------------------------- /docker/Dockerfile-ui: -------------------------------------------------------------------------------- 1 | FROM nginx:alpine 2 | 3 | #!/bin/sh 4 | 5 | COPY ./docker/config/ui/nginx.conf /etc/nginx/nginx.conf 6 | COPY ./docker/config/ui/bootstrap.sh /bootstrap.sh 7 | 8 | ## Remove default nginx index page 9 | RUN rm -rf /usr/share/nginx/html/* 10 | 11 | # Copy from the stahg 1 12 | COPY ./raw-cms-app/src /usr/share/nginx/html 13 | 14 | # Add bash 15 | RUN apk add --no-cache bash 16 | 17 | CMD ["/bin/bash", "-c", " chmod 777 /bootstrap.sh && /bootstrap.sh && nginx -g \"daemon off;\""] -------------------------------------------------------------------------------- /docker/Readme.md: -------------------------------------------------------------------------------- 1 | # docker conventions 2 | 3 | ports are +1000 i.e. elastic is on 9300 instead of 9200 4 | 5 | ## files 6 | 7 | - dockerfiles 8 | - config 9 | - machine name 10 | - files to be burn\used 11 | - data 12 | - machine 13 | - volumes mount for data 14 | 15 | # start for dev 16 | 17 | docker-compose up 18 | 19 | #start prod in dev 20 | 21 | docker-compose -f docker-compose.yml -f ./docker-compose-app.yml up 22 | 23 | # trick 24 | 25 | docker-compose build images only if are not present. to rebuild force it by docker-compose -f ./docker-compose-app.yml build 26 | 27 | # manual deploy 28 | 29 | from here 30 | ` 31 | docker build -t arduosoft/rawcms-api-preview -f ./Dockerfile-api ../ 32 | docker push arduosoft/rawcms-api-preview 33 | 34 | docker build -t arduosoft/rawcms-ui-preview -f ./Dockerfile-ui ../ 35 | docker push arduosoft/rawcms-ui-preview 36 | ` 37 | -------------------------------------------------------------------------------- /docker/config/api/buildscript.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | dotnet restore 4 | dotnet build RawCMS.sln --verbosity minimal 5 | dotnet publish RawCMS/RawCMS.csproj --output /dist &&\ 6 | rm -rf RawCMS/Plugins/ 7 | 8 | 9 | ls -1 Plugins/*/*.csproj | while read folder; do 10 | 11 | 12 | 13 | IFS='/' # hyphen (-) is set as delimiter 14 | read -ra parts <<<$folder # str is read into an array as tokens separated by IFS 15 | IFS=' ' # reset to default value after usage 16 | 17 | echo "building $folder and plugin ${parts[1]}" 18 | dotnet publish $folder --output /plugins/${parts[1]}/ 19 | done 20 | 21 | ls /plugins -lh 22 | 23 | rm -rf /dist/Plugins 24 | mkdir /dist/Plugins 25 | cp -r /plugins/* /dist/Plugins 26 | 27 | echo "build output" 28 | ls /dist -lhs 29 | echo "docker settings" 30 | cat /dist/appsettings.Docker.json 31 | echo "plugins" 32 | ls /dist/Plugins -lhs 33 | echo "plugin content" 34 | ls -1 /dist/Plugins | while read folder; do 35 | echo "building $folder" 36 | ls /dist/Plugins/$folder -lhs 37 | done -------------------------------------------------------------------------------- /docker/config/mongo/dev-user.js: -------------------------------------------------------------------------------- 1 | db.auth("root", "password"); 2 | 3 | db = db.getSiblingDB("admin"); 4 | 5 | db.createUser({ 6 | user: "dev", 7 | pwd: "password", 8 | roles: [ 9 | { 10 | role: "readWrite", 11 | db: "rawcms" 12 | } 13 | ] 14 | }); 15 | -------------------------------------------------------------------------------- /docker/config/mongo/init-mongo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "restoring data" 3 | cd /docker-entrypoint-initdb.d/seed/ 4 | 5 | ls -1 *.json | sed 's/.json$//' | while read col; do 6 | echo "restoring $col" 7 | mongoimport -d rawcms -c $col --type json --jsonArray < $col.json; 8 | done 9 | 10 | echo "data restored" 11 | 12 | # echo "create $MONGO_INITDB_USERNAME user on $MONGO_INITDB_DATABASE" 13 | 14 | # mongo -- "$MONGO_INITDB_DATABASE" < " 27 | sed -i -e "s||$GA|g" /usr/share/nginx/html/index.html 28 | 29 | fi -------------------------------------------------------------------------------- /docker/config/ui/nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes 4; 2 | 3 | events { worker_connections 1024; } 4 | 5 | http { 6 | server { 7 | listen 80; 8 | root /usr/share/nginx/html; 9 | include /etc/nginx/mime.types; 10 | 11 | location / { 12 | try_files $uri /index.html; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /docker/demo/api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base 2 | WORKDIR /app 3 | EXPOSE 80 4 | EXPOSE 443 5 | 6 | FROM microsoft/dotnet:2.1-sdk AS build 7 | WORKDIR /src 8 | COPY ./docker/config/api/buildscript.sh ./build.sh 9 | COPY . . 10 | 11 | RUN chmod +x ./build.sh && ./build.sh 12 | 13 | 14 | FROM base AS final 15 | WORKDIR /app 16 | COPY --from=build /dist . 17 | ENTRYPOINT ["dotnet", "RawCMS.dll"] 18 | -------------------------------------------------------------------------------- /docker/demo/ui/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:alpine 2 | 3 | #!/bin/sh 4 | 5 | COPY ./docker/config/ui/nginx.conf /etc/nginx/nginx.conf 6 | COPY ./docker/config/ui/bootstrap.sh /bootstrap.sh 7 | 8 | ## Remove default nginx index page 9 | RUN rm -rf /usr/share/nginx/html/* 10 | 11 | # Copy from the stahg 1 12 | COPY ./raw-cms-app/src /usr/share/nginx/html 13 | 14 | # Add bash 15 | RUN apk add --no-cache bash 16 | 17 | EXPOSE 80 18 | EXPOSE 4200 80 19 | 20 | CMD ["/bin/bash", "-c", " sudo /bootstrap.sh && sudo nginx -g \"daemon off;\""] 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /docker/docker-compose-app.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | rawcms-standalone: 4 | build: 5 | dockerfile: ./docker/Dockerfile-standalone 6 | context: ../ 7 | ports: 8 | - "7580:80" 9 | - "7543:443" 10 | environment: 11 | - MongoSettings__ConnectionString=mongodb://dev:password@mongo:27017/rawcms?authSource=admin 12 | - PORT=80 13 | - ASPNETCORE_ENVIRONMENT=Docker 14 | - CLIENT_ID=raw.client 15 | - CLIENT_SECRET=raw.secret 16 | - BASE_URL=/ 17 | rawcms-api: 18 | build: 19 | dockerfile: ./docker/Dockerfile-api 20 | context: ../ 21 | ports: 22 | - "6580:80" 23 | - "6543:443" 24 | environment: 25 | - MongoSettings__ConnectionString=mongodb://dev:password@mongo:27017/rawcms?authSource=admin 26 | - PORT=80 27 | - ASPNETCORE_ENVIRONMENT=Docker 28 | rawcms-ui: 29 | build: 30 | dockerfile: ./docker/Dockerfile-ui 31 | context: ../ 32 | environment: 33 | - BASE_URL=http://localhost:6580 34 | - CLIENT_ID=raw.client 35 | - CLIENT_SECRET=raw.secret 36 | ports: 37 | - "5580:80" 38 | - "5543:443" 39 | -------------------------------------------------------------------------------- /docker/docker-compose-prod.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | rawcms-api: 4 | image: arduosoft/rawcms-api-preview 5 | ports: 6 | - "3580:80" 7 | - "3543:443" 8 | environment: 9 | - MongoSettings__ConnectionString=mongodb://root:password@mongo:27017/rawcms?authSource=admin 10 | - PORT=80 11 | - ASPNETCORE_ENVIRONMENT=Docker 12 | rawcms-ui: 13 | image: arduosoft/rawcms-ui-preview 14 | environment: 15 | - BASE_URL=http://localhost:3580 16 | - CLIENT_ID=raw.client 17 | - CLIENT_SECRET=raw.secret 18 | ports: 19 | - "3680:80" 20 | - "3643:443" 21 | mongo: 22 | image: mongo 23 | environment: 24 | - MONGO_INITDB_ROOT_USERNAME=root 25 | - MONGO_INITDB_ROOT_PASSWORD=password 26 | - MONGO_INITDB_DATABASE=rawcms 27 | ports: 28 | - 38017:27017 29 | elasticsearch: 30 | image: elasticsearch:7.4.0 31 | environment: 32 | - discovery.type=single-node 33 | - http.cors.enabled=true 34 | - http.cors.allow-credentials=true 35 | - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization 36 | - http.cors.allow-origin=/https?:\/\/localhost(:[0-9]+)?/ 37 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 38 | ulimits: 39 | memlock: 40 | soft: -1 41 | hard: -1 42 | ports: 43 | - 4200:9200 44 | -------------------------------------------------------------------------------- /docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | mongo: 4 | image: mongo 5 | # environment: 6 | # - MONGO_INITDB_ROOT_USERNAME=root 7 | # - MONGO_INITDB_ROOT_PASSWORD=password 8 | # # - MONGO_INITDB_DATABASE=rawcms 9 | # - MONGO_INITDB_USERNAME=dev 10 | # - MONGO_INITDB_PASSWORD=password 11 | ports: 12 | - 28017:27017 13 | volumes: 14 | - ./data/database/seed/:/docker-entrypoint-initdb.d/seed/:ro 15 | - ./config/mongo/init-mongo.sh:/docker-entrypoint-initdb.d/1init-mongo.sh:ro 16 | - ./config/mongo/dev-user.js:/docker-entrypoint-initdb.d/0dev-user.js:ro 17 | elasticsearchtest: 18 | image: elasticsearch:7.4.0 19 | environment: 20 | - discovery.type=single-node 21 | - http.cors.enabled=true 22 | - http.cors.allow-credentials=true 23 | - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization 24 | - http.cors.allow-origin=/https?:\/\/localhost(:[0-9]+)?/ 25 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 26 | ulimits: 27 | memlock: 28 | soft: -1 29 | hard: -1 30 | ports: 31 | - 9300:9200 32 | -------------------------------------------------------------------------------- /docs/APITest.md: -------------------------------------------------------------------------------- 1 | # API Test 2 | 3 | Test of API are implementend in the postman collection. Each request comes with the test script. What you need to do is run the test suite manually as follows: 4 | 5 | 1. Open Postman Runner from file menu 6 | 2. Select the collection 7 | 3. Start 8 | 9 | The first request gets the token using bob's credential, and this user is part of the data seed. 10 | 11 | Tests are processed in the sequential order, so POST request has to be done BEFORE GET if you want to save data then check otherwise its OK 12 | 13 | ## d 14 | -------------------------------------------------------------------------------- /docs/BackgroundJobs.md: -------------------------------------------------------------------------------- 1 | 2 | # Background Jobs 3 | It is possible to schedule background jobs inside the application. This job can be done in two ways. 4 | 5 | 1. C# code using the plugin 6 | 2. JS code using UI 7 | 8 | ## C# code using the plugin 9 | Inside your plugin you have to implement a Lamba with background job role. Here a sample: 10 | 11 | ```cs 12 | public class PingJob : BackgroundJobInstance 13 | 14 | { 15 | public override string CronExpression => Hangfire.Cron.Minutely(); 16 | 17 | public override string Name => "Ping Every minute"; 18 | 19 | public override string Description => "Ping Every minute"; 20 | 21 | protected ILogger logger; 22 | 23 | public PingJob(ILogger logger) 24 | { 25 | this.logger = logger; 26 | } 27 | 28 | public override void Execute(JObject data) 29 | { 30 | this.logger.LogInformation($"Job triggered, with data {data}"); 31 | } 32 | } 33 | ``` 34 | 35 | ## JS code using UI 36 | 37 | This feature is in progess. It will be possible to add a schedulation to a js lambda from the user interface. -------------------------------------------------------------------------------- /docs/Client.md: -------------------------------------------------------------------------------- 1 | ## RawCms command line tool. 2 | 3 | verbs: 4 | 5 | login 6 | insert 7 | delete 8 | replace 9 | patch 10 | list 11 | 12 | Each verbs has some options: 13 | ... 14 | 15 | 16 | Sample command: 17 | 18 | List some collection data 19 | list -c uno -v -p 20 | 21 | with pagination: 22 | list -c uno -v -p -n 3 -s 10 23 | 24 | 25 | Get configuration for current user (token) 26 | login -u bob -p XYZ -i raw.client -t raw.secret -s http://localhost:49439 27 | 28 | Insert data from file 29 | insert -c test -f c:\temp\test.json 30 | 31 | Insert data from folder 32 | insert -c test -d datalocal -r -p -v 33 | -------------------------------------------------------------------------------- /docs/Configurable-Plugins.md: -------------------------------------------------------------------------------- 1 | # Configurable Plugin 2 | Each plugin can be configurable. Configurable plugins get configuration from the database. 3 | User will edit configuration throught UI or db directly. 4 | 5 | To enable configuration for a plugin, you must inherit `IConfigurablePlugin`. 6 | 7 | This will let you: 8 | 9 | - define default configuration (persisted at first usage): RawCMS will create a new instance of the configuration class and this will be stored to the db. Just fill the default values using default property values or costructors. 10 | - get condfiguration from database: after the configuration is stored to database the first time, this will be reloaded. If you change it manually, after an application restart the value will be used. 11 | 12 | Configuration is provided during startup so application must be restarted to reload (atm). 13 | 14 | -------------------------------------------------------------------------------- /docs/Custom-Field-Validation.md: -------------------------------------------------------------------------------- 1 | To manage *Entity Validation* there are many FieldValidator used to check if a field value is valid for such schema definition. 2 | 3 | Standard validator are shipped with RawCMS: 4 | 5 | * Number 6 | * Integer 7 | * DateTime 8 | * Text 9 | 10 | you can add your own type, by just implementing the below class: 11 | 12 | ```cs 13 | public class MyTypeValidator: FieldTypeValidator 14 | { 15 | public string Type =>"MyTypeValidator"; 16 | public List Validate(JObject input, Field field) 17 | { 18 | // DO CHECK HERE 19 | } 20 | } 21 | ``` 22 | 23 | the value of *Type* should match with the field type in schema validation. 24 | -------------------------------------------------------------------------------- /docs/Custom-Validation.md: -------------------------------------------------------------------------------- 1 | SchemaValidationLambda is the base type to hook validation. In the save pipeline validation is triggered so all derived class will be used to manage data validation. 2 | 3 | Basic implementation: 4 | ```cs 5 | public class MySchemaValidationLambda: SchemaValidationLambda 6 | { 7 | public abstract List Validate(JObject input, string collection) 8 | { 9 | //check for data and return errors. 10 | } 11 | } 12 | 13 | ``` 14 | 15 | ### Entity Validation 16 | RawCMS already ships a validator that analyzes schemas and reports errors. This is the "EntityValidation". 17 | 18 | EntityValidation reads json settings in _schema collection and validate data. 19 | 20 | This lets you manage most common validation issues (field required, format validation, lenght, regexp) without writing code, and just with the configuration. 21 | -------------------------------------------------------------------------------- /docs/Define-net-lambda.md: -------------------------------------------------------------------------------- 1 | To create a Lambda just implement a class. Class derived from Lambda will be activated and added to lambda bucket. 2 | 3 | This example shows how to implemeent a simple REST Lambda 4 | 5 | ```cs 6 | public class DummyRest : RestLambda 7 | { 8 | public override string Name => "DummyRest"; 9 | public override string Description => "I'm a dumb dummy request"; 10 | public override JObject Rest(JObject input) 11 | { 12 | var result = new JObject(); 13 | result["input"] = input; 14 | result["now"] = DateTime.Now; 15 | return result; 16 | } 17 | } 18 | ``` 19 | 20 | This can be reached at /api/lambda/dummyrest with body: 21 | ```json 22 | { 23 | "textfield":"text to get back", 24 | } 25 | ``` 26 | and will return 27 | 28 | ```json 29 | { 30 | "input": 31 | { 32 | "textfield":"text to get back", 33 | }, 34 | "now":"20108-05-05 22:22:22" 35 | } 36 | ``` 37 | 38 | -------------------------------------------------------------------------------- /docs/Docker.md: -------------------------------------------------------------------------------- 1 | ## Docker publish 2 | 3 | publish on dist filder. This step produces binaries that will be published as artifact into docker images. 4 | 5 | ``` 6 | dotnet publish RawCMS\RawCMS.csproj -o ../dist 7 | ``` 8 | 9 | Build the image. This can be done as usual. This is part of the release on docker hub. 10 | ``` 11 | docker build -t rawcms . 12 | ``` 13 | 14 | # Run locally on dokcer 15 | 16 | To run the single container just use docker run. This requires all env parameters to have been passed as command line argument or env file. 17 | 18 | ``` 19 | docker run rawcms -p 80:8081 20 | ``` 21 | 22 | Run via docker compose. This is easy using docker-compose.yml into project root. running 23 | 24 | ``` 25 | local.bat 26 | ``` 27 | will start a volatile enviroment with mongodb+ rawcms (available on http://localhost:54321) 28 | 29 | 30 | # Dockerhub deployment 31 | 32 | Through appeveyour project is compiled and deployed after a success pull request on master branch. 33 | -------------------------------------------------------------------------------- /docs/Dynamic-Crud-Controller.md: -------------------------------------------------------------------------------- 1 | CRUD Controller offers capability to save structured or non structured data based on mondodb collections. 2 | 3 | ### Operations 4 | 5 | | Method | Operation | URL | 6 | | ------------- | ------------- | ------------- | 7 | | GET | retrieve data | /api/CRUD/**entityname**/ | 8 | | GET | retrieve data a single element | /api/CRUD/**entityname**/**{id}** | 9 | | POST | Insert new item (no update) | /api/CRUD/**entityname**/ | 10 | | PUT | replace an element. Upsert mode. | /api/CRUD/**entityname**/**{id}** | 11 | | PATCH | patch an element, only changed field are updated | /api/CRUD/**entityname**/**{id}** | 12 | | DELETE | remove element | /api/CRUD/**entityname**/**{id}** | 13 | 14 | 15 | ### POST,PUT,PATCH Request 16 | 17 | `json 18 | { 19 | "field":"value", 20 | "field2":value, 21 | } 22 | ` 23 | ### DELETE 24 | No payload needed (id is from URL) 25 | 26 | ### GET (single element) 27 | no payload required 28 | 29 | ### GET (search and list elements) 30 | ?rawQuery=*optional_json_query*&pageNumber=1&pageSize=20 31 | -------------------------------------------------------------------------------- /docs/Dynamic-Lambda-Controller.md: -------------------------------------------------------------------------------- 1 | Lambda controller exposes HttpLambda or RestLambda to callers. 2 | 3 | ### How to invoke lambda 4 | 5 | api/lambda/**lambdaname** 6 | 7 | Lambda must be invoked in POST. 8 | 9 | ```json 10 | { 11 | ** your custom json, everything can be intepreted by your lambda ** 12 | } 13 | ``` 14 | -------------------------------------------------------------------------------- /docs/FullText.md: -------------------------------------------------------------------------------- 1 | # Full Text Plugin 2 | 3 | This plugin enables full text capability. 4 | 5 | By default a controller with basic full text feautures is added after installation (index creation, document CRUD on indexes, full text search). 6 | 7 | This module can be used to store document, log collecting or indexing data. See example below for more info. 8 | 9 | ## Document crud 10 | See postman for api reference. Implemented APIs: 11 | - create index 12 | - add or update document 13 | - delete 14 | - search fulltext 15 | 16 | ## Log collecting 17 | Add a document on an index called logs. 18 | 19 | ## Indexing data 20 | Indexing data is out of the box. just add to the schema configuration what follows: 21 | 22 | ```json 23 | { 24 | ... 25 | 26 | "FullTextPlugin" : { 27 | "IncludedField" : [ 28 | "Field1", 29 | "Field2" 30 | ], 31 | "CollectionName" : "Items" 32 | } 33 | 34 | } 35 | 36 | ``` 37 | 38 | 39 | ## Configuration 40 | 41 | ``` 42 | { 43 | "_id" : ObjectId("5db08f4a0337645f8853f848"), 44 | "plugin_name" : "RawCMS.Plugins.FullText.FullTextPlugin", 45 | "data" : { 46 | "Url" : "http://localhost:9300", 47 | "Engine" : 0 48 | } 49 | } 50 | 51 | ``` 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/assets/auth0-new-api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/docs/assets/auth0-new-api.png -------------------------------------------------------------------------------- /docs/assets/auth0-new-application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/docs/assets/auth0-new-application.png -------------------------------------------------------------------------------- /docs/assets/jsLambdas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/docs/assets/jsLambdas.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | Welcome to the RawCMS wiki! 2 | 3 | ### Install 4 | 5 | 6 | You can deploy it using many options. Rawcms is dockerized from the development stage so modern hostings are fully supported. 7 | 8 | 1. *Docker Compose* using the provided docke-compose file 9 | 2. *Kubernetes* using the provided docker images 10 | 3. *Heroku* using the provided images 11 | 4. *Virtual machines* using the packges provided and deployed manually to the server 12 | 13 | [Just follow the guide to have it working in 5 minutes](Deploy) and watch [video tutorials](Tutorial) for a quickstart. 14 | 15 | ### Customize 16 | 17 | - [Define Schema for collection](Data-Schema) 18 | - [Create a Lambda](Define-net-lambda) 19 | - [Data Process Lambda](Data-process-Lambda) 20 | - [Validation](Custom-Validation) 21 | - [Create Custom Field Validator](Custom-Field-Validation) 22 | - [Make Plugin configurable](Configurable-Plugins) 23 | - [Authentication](Authentication) 24 | - [Docker](Docker) 25 | - [Relations](Relation) 26 | 27 | ### Plugins 28 | 29 | - [GraphQL](GraphQL) 30 | - [Full Text](FullText) 31 | - [Gateway](Gateway-Plugin) 32 | 33 | ### Frontend User 34 | 35 | - [CRUD service](Dynamic-Crud-Controller) 36 | - [Lambdas](Dynamic-Lambda-Controller) 37 | 38 | ### Developer 39 | 40 | - [Test Book](TestBook) 41 | - [Postman Tests](RawCMS.postman_collection.json) 42 | - [WebApp developer info](WebApp-Dev-Home) 43 | - [Api Test](APITest) 44 | - [Setup for development](Setup-Dev) 45 | - [Troubleshooting](Troubleshooting) 46 | -------------------------------------------------------------------------------- /local.bat: -------------------------------------------------------------------------------- 1 | dotnet publish RawCMS\RawCMS.csproj -o ../dist 2 | docker-compose up --build -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | theme: readthedocs 2 | site_name: RawCMS 3 | -------------------------------------------------------------------------------- /raw-cms-app/.prettierignore: -------------------------------------------------------------------------------- 1 | package.json 2 | package-lock.json 3 | -------------------------------------------------------------------------------- /raw-cms-app/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": true, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /raw-cms-app/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.organizeImports": true 4 | }, 5 | "editor.formatOnSave": true, 6 | "editor.rulers": [100], 7 | "files.exclude": { 8 | "**/dist": true 9 | }, 10 | "html.format.wrapAttributes": "auto", 11 | "html.format.wrapLineLength": 120, 12 | "[json]": { 13 | "editor.defaultFormatter": "esbenp.prettier-vscode" 14 | }, 15 | "[javascript]": { 16 | "editor.defaultFormatter": "esbenp.prettier-vscode" 17 | }, 18 | "[html]": { 19 | "editor.defaultFormatter": "esbenp.prettier-vscode" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /raw-cms-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "raw-cms-app", 3 | "version": "0.0.1", 4 | "description": "Web app/GUI for Raw CMS.", 5 | "scripts": { 6 | "build": "node scripts/build.js", 7 | "serve": "servor src index.html 8000 5000", 8 | "prettier": "prettier --write \"src/**/*.{css,js,json,html}\"" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "husky": { 13 | "hooks": { 14 | "pre-commit": "pretty-quick --staged" 15 | } 16 | }, 17 | "devDependencies": { 18 | "cpx": "^1.5.0", 19 | "husky": "^3.0.9", 20 | "prettier": "^1.18.2", 21 | "pretty-quick": "^2.0.0", 22 | "servor": "^2.2.1" 23 | }, 24 | "dependencies": { 25 | "monaco": "^1.201704190613.0", 26 | "monaco-editor": "^0.18.1", 27 | "vue": "^2.6.10" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /raw-cms-app/scripts/build.js: -------------------------------------------------------------------------------- 1 | // const fs = require('fs') 2 | const cpx = require('cpx') 3 | 4 | cpx.copySync('./src/**/*', './dist') -------------------------------------------------------------------------------- /raw-cms-app/src/app/app.js: -------------------------------------------------------------------------------- 1 | import { RawCMS } from '../config/raw-cms.js'; 2 | import { vuexStore } from '../config/vuex.js'; 3 | import { evtSnackbarMessage } from './events.js'; 4 | 5 | const _App = Vue.component('rawcms-app', (resolve, reject) => { 6 | RawCMS.loadComponentTpl('/app/app.tpl.html').then(tpl => { 7 | resolve({ 8 | components: { 9 | 'rawcms-top-bar': async (res, rej) => { 10 | const cmp = await import('/modules/core/components/top-bar/top-bar.js'); 11 | await cmp.default(res, rej); 12 | }, 13 | 'rawcms-left-menu': async (res, rej) => { 14 | const cmp = await import('/modules/core/components/left-menu/left-menu.js'); 15 | await cmp.default(res, rej); 16 | }, 17 | }, 18 | computed: { 19 | showMenus() { 20 | return vuexStore.state.core.isLoggedIn; 21 | }, 22 | }, 23 | data: function() { 24 | return { 25 | showSnackbar: false, 26 | snackbarConfig: {}, 27 | }; 28 | }, 29 | methods: { 30 | closeSnackbar: function() { 31 | this.showSnackbar = false; 32 | }, 33 | }, 34 | mounted: function() { 35 | RawCMS.eventBus.$on(evtSnackbarMessage, snackbarConfig => { 36 | this.snackbarConfig = Object.assign({ message: '' }, snackbarConfig); 37 | this.showSnackbar = true; 38 | }); 39 | }, 40 | template: tpl, 41 | }); 42 | }); 43 | }); 44 | 45 | export const App = _App; 46 | export default _App; 47 | -------------------------------------------------------------------------------- /raw-cms-app/src/app/app.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ snackbarConfig.message }} 9 | 10 | mdi-close 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /raw-cms-app/src/app/events.js: -------------------------------------------------------------------------------- 1 | export const evtSnackbarMessage = 'rawcms_snackbar-message'; 2 | -------------------------------------------------------------------------------- /raw-cms-app/src/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | #ffffff 9 | 10 | 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/console.js: -------------------------------------------------------------------------------- 1 | let _oldConsoleError = null; 2 | 3 | const _ignoredMessages = ["TypeError: Cannot read property 'clientHeight' of undefined"]; 4 | 5 | const _tweakConsole = function() { 6 | _oldConsoleError = window.console.error; 7 | window.console.error = function() { 8 | const msg = arguments[0]; 9 | 10 | if (!msg || typeof msg !== 'string') { 11 | _oldConsoleError(...arguments); 12 | } 13 | 14 | if (_ignoredMessages.includes(msg)) { 15 | return; 16 | } 17 | 18 | _oldConsoleError(...arguments); 19 | }; 20 | }; 21 | 22 | export const tweakConsole = _tweakConsole; 23 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/i18n.js: -------------------------------------------------------------------------------- 1 | const _i18n = new VueI18n({ 2 | locale: 'en', 3 | fallbackLocale: 'en', 4 | messages: { en: {} }, 5 | }); 6 | 7 | class I18nHelper { 8 | filesLoaded = []; 9 | 10 | load(lang, path) { 11 | if (this.filesLoaded.includes(path)) { 12 | return Promise.resolve(); 13 | } 14 | 15 | return axios({ 16 | url: path, 17 | method: 'get', 18 | }).then(x => { 19 | this.filesLoaded.push(path); 20 | const messages = x.data; 21 | _i18n.mergeLocaleMessage(lang, messages); 22 | return; 23 | }); 24 | } 25 | 26 | setLang(lang) { 27 | _i18n.locale = lang; 28 | axios.defaults.headers.common['Accept-Language'] = lang; 29 | document.querySelector('html').setAttribute('lang', lang); 30 | } 31 | } 32 | 33 | export const i18nHelper = new I18nHelper(); 34 | export const i18n = _i18n; 35 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/raw-cms.js: -------------------------------------------------------------------------------- 1 | class RawCms { 2 | plugins = {}; 3 | utils = {}; 4 | 5 | vuexStore; 6 | env = {}; 7 | 8 | eventBus = new Vue(); 9 | 10 | loadComponentTpl = path => { 11 | return axios.get(path).then(x => { 12 | return x.data; 13 | }); 14 | }; 15 | } 16 | 17 | const _rawCms = new RawCms(); 18 | 19 | window.RawCMS = _rawCms; 20 | export const RawCMS = _rawCms; 21 | export default _rawCms; 22 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/vue-chartjs.js: -------------------------------------------------------------------------------- 1 | const _vueChartJs = window.VueChartJs; 2 | 3 | export const vueChartJs = _vueChartJs; 4 | export const mixins = _vueChartJs.mixins; 5 | export const Pie = _vueChartJs.Pie; 6 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/vuelidate.js: -------------------------------------------------------------------------------- 1 | const _vuelidate = window.vuelidate; 2 | const _vuelidateValidators = window.validators; 3 | 4 | export const vuelidate = _vuelidate; 5 | export const vuelidateValidators = _vuelidateValidators; 6 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/vuetify.js: -------------------------------------------------------------------------------- 1 | import colors from 'https://cdn.jsdelivr.net/npm/vuetify@2.1.9/lib/util/colors.min.js'; 2 | 3 | const _vuetify = new Vuetify({ 4 | theme: { 5 | themes: { 6 | light: { 7 | primary: colors.indigo.darken4, 8 | secondary: colors.cyan.base, 9 | tabHeader: colors.blue.lighten2, 10 | }, 11 | }, 12 | }, 13 | }); 14 | 15 | export const vuetify = _vuetify; 16 | export const vuetifyColors = colors; 17 | -------------------------------------------------------------------------------- /raw-cms-app/src/config/vuex.js: -------------------------------------------------------------------------------- 1 | const _vuexStore = new Vuex.Store(); 2 | 3 | export const vuexStore = _vuexStore; 4 | export default vuexStore; 5 | -------------------------------------------------------------------------------- /raw-cms-app/src/env/env.json: -------------------------------------------------------------------------------- 1 | { 2 | "api": { 3 | "baseUrl": "http://localhost:28436" 4 | }, 5 | "login": { 6 | "grant_type": "password", 7 | "scope": "openid", 8 | "client_id": "raw.client", 9 | "client_secret": "raw.secret" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-144x144.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-192x192.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-36x36.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-48x48.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-72x72.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/android-icon-96x96.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-114x114.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-120x120.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-144x144.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-152x152.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-180x180.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-57x57.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-60x60.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-72x72.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-76x76.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon-precomposed.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/apple-icon.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/favicon-16x16.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/favicon-32x32.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/favicon-96x96.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/favicon.ico -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/ms-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/ms-icon-144x144.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/ms-icon-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/ms-icon-150x150.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/ms-icon-310x310.png -------------------------------------------------------------------------------- /raw-cms-app/src/favicons/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/favicons/ms-icon-70x70.png -------------------------------------------------------------------------------- /raw-cms-app/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RawCms", 3 | "icons": [ 4 | { 5 | "src": "/favicons/android-icon-36x36.png", 6 | "sizes": "36x36", 7 | "type": "image/png", 8 | "density": "0.75" 9 | }, 10 | { 11 | "src": "/favicons/android-icon-48x48.png", 12 | "sizes": "48x48", 13 | "type": "image/png", 14 | "density": "1.0" 15 | }, 16 | { 17 | "src": "/favicons/android-icon-72x72.png", 18 | "sizes": "72x72", 19 | "type": "image/png", 20 | "density": "1.5" 21 | }, 22 | { 23 | "src": "/favicons/android-icon-96x96.png", 24 | "sizes": "96x96", 25 | "type": "image/png", 26 | "density": "2.0" 27 | }, 28 | { 29 | "src": "/favicons/android-icon-144x144.png", 30 | "sizes": "144x144", 31 | "type": "image/png", 32 | "density": "3.0" 33 | }, 34 | { 35 | "src": "/favicons/android-icon-192x192.png", 36 | "sizes": "192x192", 37 | "type": "image/png", 38 | "density": "4.0" 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/api/api-client.js: -------------------------------------------------------------------------------- 1 | import { RawCMS } from '../../../config/raw-cms.js'; 2 | import { optionalChain } from '../../../utils/object.utils.js'; 3 | import { loginService } from '../services/login.service.js'; 4 | 5 | const _apiClient = axios.create({ 6 | baseURL: `${RawCMS.env.api.baseUrl}`, 7 | }); 8 | 9 | _apiClient.interceptors.request.use(request => { 10 | if (loginService.isLoggedIn) { 11 | request.headers.common['Authorization'] = `Bearer ${loginService.auth.access_token}`; 12 | } 13 | return request; 14 | }); 15 | 16 | _apiClient.interceptors.response.use( 17 | response => response, 18 | error => { 19 | const isUnauthorized = optionalChain(() => error.response.status, { fallbackValue: 0 }) === 401; 20 | if (isUnauthorized) { 21 | loginService.logout(); 22 | } else { 23 | Promise.reject(error); 24 | } 25 | } 26 | ); 27 | 28 | export const apiClient = _apiClient; 29 | export default apiClient; 30 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/assets/left-menu-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/modules/core/assets/left-menu-bg.jpg -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/assets/rawlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/modules/core/assets/rawlogo.png -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/assets/rawlogo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduosoft/RawCMS/f7d41237073e164900d3bb429614fe5e56f24a2f/raw-cms-app/src/modules/core/assets/rawlogo_small.png -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/collection-item-details/collection-item-details.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 26 | 27 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/collection-table/collection-table.tpl.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/collections-list/collections-list.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/config-edit-dialog/config-edit-dialog.js: -------------------------------------------------------------------------------- 1 | import { EditDialogDef } from '../edit-dialog/edit-dialog.js'; 2 | 3 | const _ConfigEditDialog = async (res, rej) => { 4 | const cmpDef = await EditDialogDef(); 5 | 6 | res({ 7 | props: { 8 | activeEntity: Object, 9 | }, 10 | data: function() { 11 | return { 12 | data: { code: '' }, 13 | }; 14 | }, 15 | methods: { 16 | amdRequire: require, 17 | }, 18 | mixins: [cmpDef], 19 | }); 20 | }; 21 | 22 | export const ConfigEditDialog = _ConfigEditDialog; 23 | export default _ConfigEditDialog; 24 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/configuration-details/configuration-details.js: -------------------------------------------------------------------------------- 1 | import { RawCmsDetailEditDef } from '../../../shared/components/detail-edit/detail-edit.js'; 2 | import { configurationService } from '../../services/configuration.service.js'; 3 | 4 | const _ConfigurationDetailsWrapperDef = async () => { 5 | const rawCmsDetailEditDef = await RawCmsDetailEditDef(); 6 | 7 | return { 8 | data: function() { 9 | return { 10 | apiService: configurationService, 11 | }; 12 | }, 13 | extends: rawCmsDetailEditDef, 14 | }; 15 | }; 16 | 17 | const _ConfigurationDetailsDef = async () => { 18 | const detailWrapperDef = await _ConfigurationDetailsWrapperDef(); 19 | const tpl = await RawCMS.loadComponentTpl( 20 | '/modules/core/components/configuration-details/configuration-details.tpl.html' 21 | ); 22 | 23 | return { 24 | components: { 25 | DetailWrapper: detailWrapperDef, 26 | }, 27 | props: detailWrapperDef.extends.props, 28 | template: tpl, 29 | }; 30 | }; 31 | 32 | const _ConfigurationDetails = async (res, rej) => { 33 | const cmpDef = _ConfigurationDetailsDef(); 34 | res(cmpDef); 35 | }; 36 | 37 | export const ConfigurationDetailsDef = _ConfigurationDetailsDef; 38 | export const ConfigurationDetails = _ConfigurationDetails; 39 | export default _ConfigurationDetails; 40 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/configuration-details/configuration-details.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/configuration-list/configuration-list.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/dashboard/dashboard.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ $t('core.home.totalRecordsText') }} 6 | 7 | 8 | {{ totalRecordsNum }} 9 | 10 | 11 | 12 | 13 | {{ $t('core.home.entitiesNumText') }} 14 | 15 | 16 | {{ optionalChain(() => this.info.entitiesNum) }} 17 | 18 | 19 | 20 | 21 | 22 | 23 | {{ $t('core.home.recordsQuotaText') }} 24 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/entities-list/entities-list.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/entity-details/entity-details.css: -------------------------------------------------------------------------------- 1 | .rawcms-entity-details .v-list-item .v-list-item__icon.show-on-hover { 2 | opacity: 0; 3 | } 4 | 5 | .rawcms-entity-details .v-list-item:hover .v-list-item__icon.show-on-hover { 6 | opacity: 1; 7 | } 8 | 9 | .rawcms-entity-details .v-list-item .v-list-item__icon.show-on-hover.force-show { 10 | opacity: 1; 11 | } 12 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/lambdas-list/lambdas-list.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/left-menu/left-menu.css: -------------------------------------------------------------------------------- 1 | .rawcms-left_menu .v-list-item.router-link-active::before { 2 | opacity: 0.04; 3 | } 4 | 5 | .rawcms-left_menu .user-menu-active { 6 | color: white !important; 7 | } 8 | 9 | /* User Menu Animation */ 10 | .user-menu-tr-enter, 11 | .user-menu-tr-leave { 12 | transform-origin: top; 13 | overflow: hidden; 14 | } 15 | 16 | .user-menu-tr-enter-active { 17 | animation: user-menu-slide 0.3s; 18 | } 19 | 20 | .user-menu-tr-leave-active { 21 | animation: user-menu-slide 0.3s reverse; 22 | } 23 | 24 | @keyframes user-menu-slide { 25 | 0% { 26 | transform: scaleY(0); 27 | padding: 0 0; 28 | max-height: 0; 29 | } 30 | 100% { 31 | transform: scaleY(1); 32 | padding: 8px 0; 33 | max-height: 64px; 34 | } 35 | } 36 | 37 | /* User Menu Divider Animation */ 38 | .user-menu-divider-tr-enter-active { 39 | animation: user-menu-divider-fade 0.3s; 40 | } 41 | 42 | .user-menu-divider-tr-leave-active { 43 | animation: user-menu-divider-fade 0.3s reverse; 44 | } 45 | 46 | @keyframes user-menu-divider-fade { 47 | 0% { 48 | opacity: 0; 49 | } 50 | 100% { 51 | opacity: 1; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/top-bar/top-bar.js: -------------------------------------------------------------------------------- 1 | import { RawCMS } from '../../../../config/raw-cms.js'; 2 | import { vuexStore } from '../../../../config/vuex.js'; 3 | import { optionalChain } from '../../../../utils/object.utils.js'; 4 | import { evtToggleDrawer } from '../../events.js'; 5 | import { UserAvatarDef } from '../user-avatar/user-avatar.js'; 6 | 7 | const _TopBar = async (resolve, reject) => { 8 | const tpl = await RawCMS.loadComponentTpl('/modules/core/components/top-bar/top-bar.tpl.html'); 9 | const avatarDef = await UserAvatarDef(); 10 | 11 | resolve({ 12 | components: { 13 | UserAvatar: avatarDef, 14 | }, 15 | computed: { 16 | avatarInitials: function() { 17 | const userInfo = vuexStore.state.core.userInfo; 18 | return optionalChain(() => userInfo.UserName.substr(0, 1).toUpperCase()); 19 | }, 20 | username: function() { 21 | return vuexStore.state.core.userInfo.UserName; 22 | }, 23 | Title: function() { 24 | return vuexStore.state.core.topBarTitle; 25 | }, 26 | }, 27 | methods: { 28 | toggleDrawer: function() { 29 | RawCMS.eventBus.$emit(evtToggleDrawer); 30 | }, 31 | }, 32 | template: tpl, 33 | }); 34 | }; 35 | 36 | export const TopBar = _TopBar; 37 | export default _TopBar; 38 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/top-bar/top-bar.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ Title }} 5 | 6 | 7 | 8 |
9 | 10 | RawCMS Logo 11 | 12 |
13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/user-avatar/user-avatar.js: -------------------------------------------------------------------------------- 1 | import { RawCMS } from '../../../../config/raw-cms.js'; 2 | import { vuexStore } from '../../../../config/vuex.js'; 3 | import { optionalChain } from '../../../../utils/object.utils.js'; 4 | 5 | const _UserAvatarDef = async () => { 6 | const tpl = await RawCMS.loadComponentTpl( 7 | '/modules/core/components/user-avatar/user-avatar.tpl.html' 8 | ); 9 | 10 | return { 11 | computed: { 12 | avatarInitials: function() { 13 | const userInfo = vuexStore.state.core.userInfo; 14 | return optionalChain(() => userInfo.UserName.substr(0, 1).toUpperCase()); 15 | }, 16 | }, 17 | props: { 18 | color: String, 19 | size: Number, 20 | dark: Boolean, 21 | }, 22 | template: tpl, 23 | }; 24 | }; 25 | 26 | const _UserAvatar = async (res, rej) => { 27 | const cmpDef = _UserAvatarDef(); 28 | res(cmpDef); 29 | }; 30 | 31 | export const UserAvatarDef = _UserAvatarDef; 32 | export const UserAvatar = _UserAvatar; 33 | export default _UserAvatar; 34 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/user-avatar/user-avatar.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ avatarInitials }} 4 | 5 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/user-details/user-details.js: -------------------------------------------------------------------------------- 1 | import { RawCmsDetailEditDef } from '../../../shared/components/detail-edit/detail-edit.js'; 2 | import { userService } from '../../services/users.service.js'; 3 | 4 | const _UserDetailsWrapperDef = async () => { 5 | const rawCmsDetailEditDef = await RawCmsDetailEditDef(); 6 | 7 | return { 8 | data: function() { 9 | return { 10 | apiService: userService, 11 | }; 12 | }, 13 | extends: rawCmsDetailEditDef, 14 | }; 15 | }; 16 | 17 | const _UserDetailsDef = async () => { 18 | const detailWrapperDef = await _UserDetailsWrapperDef(); 19 | const tpl = await RawCMS.loadComponentTpl( 20 | '/modules/core/components/user-details/user-details.tpl.html' 21 | ); 22 | 23 | return { 24 | components: { 25 | DetailWrapper: detailWrapperDef, 26 | }, 27 | props: detailWrapperDef.extends.props, 28 | template: tpl, 29 | }; 30 | }; 31 | 32 | const _UserDetails = async (res, rej) => { 33 | const cmpDef = _UserDetailsDef(); 34 | res(cmpDef); 35 | }; 36 | 37 | export const UserDetailsDef = _UserDetailsDef; 38 | export const UserDetails = _UserDetails; 39 | export default _UserDetails; 40 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/user-details/user-details.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/components/users-list/users-list.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/events.js: -------------------------------------------------------------------------------- 1 | export const evtToggleDrawer = 'rawcms_toggle-drawer'; 2 | export const evtLogin = 'rawcms_login'; 3 | export const evtLogout = 'rawcms_logout'; 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/configuration.service.js: -------------------------------------------------------------------------------- 1 | import { BaseCrudService } from '../../shared/services/base-crud-service.js'; 2 | 3 | class ConfigurationService extends BaseCrudService { 4 | constructor() { 5 | super({ basePath: '/system/admin/_configuration' }); 6 | } 7 | } 8 | 9 | export const configurationService = new ConfigurationService(); 10 | export default configurationService; 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/dashboard.service.js: -------------------------------------------------------------------------------- 1 | import { sleep } from '../../../utils/time.utils.js'; 2 | import { BaseApiService } from '../../shared/services/base-api-service.js'; 3 | 4 | class DashboardService extends BaseApiService { 5 | constructor() { 6 | super(); 7 | } 8 | 9 | async getDashboardInfo() { 10 | // FIXME: For now we use mock data 11 | 12 | await sleep(5000); 13 | 14 | const quota = { 15 | TEST: Math.floor(Math.random() * 100), 16 | Items1: Math.floor(Math.random() * 100), 17 | Items2: Math.floor(Math.random() * 100), 18 | Items3: Math.floor(Math.random() * 100), 19 | Items4: Math.floor(Math.random() * 100), 20 | Items5: Math.floor(Math.random() * 100), 21 | Items6: Math.floor(Math.random() * 100), 22 | }; 23 | return { 24 | recordQuotas: quota, 25 | entitiesNum: Object.keys(quota).length, 26 | lastWeekCallsNum: Math.floor(Math.random() * 500), 27 | }; 28 | } 29 | } 30 | 31 | export const dashboardService = new DashboardService(); 32 | export default dashboardService; 33 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/entities-schema.service.js: -------------------------------------------------------------------------------- 1 | import { BaseCrudService } from '../../shared/services/base-crud-service.js'; 2 | 3 | class EntitiesSchemaService extends BaseCrudService { 4 | constructor() { 5 | super({ basePath: '/system/admin/_schema' }); 6 | } 7 | 8 | async getByName(collectionName) { 9 | const res = await this.getPage({ 10 | size: 1, 11 | rawQuery: { CollectionName: collectionName }, 12 | }); 13 | return res.items[0]; 14 | } 15 | } 16 | 17 | export const entitiesSchemaService = new EntitiesSchemaService(); 18 | export default entitiesSchemaService; 19 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/lambdas.service.js: -------------------------------------------------------------------------------- 1 | import { BaseCrudService } from '../../shared/services/base-crud-service.js'; 2 | 3 | class LambdasService extends BaseCrudService { 4 | constructor() { 5 | super({ basePath: '/system/admin/_js' }); 6 | } 7 | } 8 | 9 | export const lambdasService = new LambdasService(); 10 | export default lambdasService; 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/snackbar.service.js: -------------------------------------------------------------------------------- 1 | import { evtSnackbarMessage } from '../../../app/events.js'; 2 | import { RawCMS } from '../../../config/raw-cms.js'; 3 | 4 | class SnackbarService { 5 | _eventBus; 6 | 7 | constructor() { 8 | this._eventBus = RawCMS.eventBus; 9 | } 10 | 11 | showMessage(snackbarConfig) { 12 | this._eventBus.$emit(evtSnackbarMessage, snackbarConfig); 13 | } 14 | } 15 | 16 | export const snackbarService = new SnackbarService(); 17 | export default snackbarService; 18 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/user-info.service.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '../api/api-client.js'; 2 | import { snackbarService } from '../services/snackbar.service.js'; 3 | 4 | class UserInfoService { 5 | async getUserInfo() { 6 | try { 7 | const res = await apiClient.get(`/connect/userinfo`); 8 | return res.data; 9 | } catch (e) { 10 | snackbarService.showMessage({ 11 | color: 'error', 12 | message: e, 13 | }); 14 | } 15 | } 16 | } 17 | 18 | export const userInfoService = new UserInfoService(); 19 | export default userInfoService; 20 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/services/users.service.js: -------------------------------------------------------------------------------- 1 | import { BaseCrudService } from '../../shared/services/base-crud-service.js'; 2 | 3 | class UserService extends BaseCrudService { 4 | constructor() { 5 | super({ basePath: '/system/admin/_users' }); 6 | } 7 | } 8 | 9 | export const userService = new UserService(); 10 | export default userService; 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/utils/metadata.utils.js: -------------------------------------------------------------------------------- 1 | const _getFieldSearchPayload = (value, fieldType) => { 2 | switch (fieldType) { 3 | case 'number': 4 | case 'int': 5 | return Number(value); 6 | 7 | case 'text': 8 | return { $regex: `.*${value}.*` }; 9 | 10 | case 'bool': 11 | case 'regexp': 12 | case 'date': 13 | case 'list': 14 | case 'relation': 15 | case 'entities-list': 16 | case 'fields-list': 17 | default: 18 | return undefined; 19 | } 20 | }; 21 | 22 | export const getFieldSearchPayload = _getFieldSearchPayload; 23 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/about-view/about-view.js: -------------------------------------------------------------------------------- 1 | const _AboutView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl('/modules/core/views/about-view/about-view.tpl.html'); 3 | 4 | res({ 5 | template: tpl, 6 | }); 7 | }; 8 | 9 | export const AboutView = _AboutView; 10 | export default _AboutView; 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/about-view/about-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collection-item-details-view/collection-item-details-view.js: -------------------------------------------------------------------------------- 1 | import { CollectionItemDetailsDef } from '../../components/collection-item-details/collection-item-details.js'; 2 | 3 | const _CollectionItemDetailsView = async (res, rej) => { 4 | const tpl = await RawCMS.loadComponentTpl( 5 | '/modules/core/views/collection-item-details-view/collection-item-details-view.tpl.html' 6 | ); 7 | const collectionItemDetails = await CollectionItemDetailsDef(); 8 | 9 | res({ 10 | components: { 11 | CollectionItemDetails: collectionItemDetails, 12 | }, 13 | computed: { 14 | collectionName: function() { 15 | return this.$route.params.collName; 16 | }, 17 | }, 18 | template: tpl, 19 | }); 20 | }; 21 | 22 | export const CollectionItemDetailsView = _CollectionItemDetailsView; 23 | export default _CollectionItemDetailsView; 24 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collection-item-details-view/collection-item-details-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collection-table-view/collection-table-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ $t('core.collections.detail.filter') }} 6 | 7 | 8 | 16 | 17 | 18 | {{ $t('core.collections.detail.filter') }} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | mdi-plus 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collections-list-view/collections-list-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { CollectionsListDef } from '../../components/collections-list/collections-list.js'; 3 | 4 | const _CollectionsListView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl( 6 | '/modules/core/views/collections-list-view/collections-list-view.tpl.html' 7 | ); 8 | const collectionsList = await CollectionsListDef(); 9 | 10 | res({ 11 | components: { 12 | CollectionsList: collectionsList, 13 | }, 14 | mounted() { 15 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.collections.title')); 16 | }, 17 | methods: {}, 18 | template: tpl, 19 | }); 20 | }; 21 | 22 | export const CollectionsListView = _CollectionsListView; 23 | export default _CollectionsListView; 24 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collections-list-view/collections-list-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collections-view/collections-view.js: -------------------------------------------------------------------------------- 1 | const _CollectionsView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl( 3 | '/modules/core/views/collections-view/collections-view.tpl.html' 4 | ); 5 | 6 | res({ 7 | template: tpl, 8 | }); 9 | }; 10 | 11 | export const CollectionsView = _CollectionsView; 12 | export default _CollectionsView; 13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/collections-view/collections-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/configuration-details-view/configuration-details-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/configuration-list-view/configuration-list-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { ConfigurationListDef } from '../../components/configuration-list/configuration-list.js'; 3 | 4 | const _ConfigurationListView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl( 6 | '/modules/core/views/configuration-list-view/configuration-list-view.tpl.html' 7 | ); 8 | const list = await ConfigurationListDef(); 9 | 10 | res({ 11 | components: { 12 | ConfigurationList: list, 13 | }, 14 | mounted() { 15 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.configuration.title')); 16 | }, 17 | methods: { 18 | goToCreateView: function() { 19 | this.$router.push({ name: 'configuration-details', params: { id: 'new' } }); 20 | }, 21 | }, 22 | template: tpl, 23 | }); 24 | }; 25 | 26 | export const ConfigurationListView = _ConfigurationListView; 27 | export default _ConfigurationListView; 28 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/configuration-list-view/configuration-list-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | mdi-plus 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/configuration-view/configuration-view.js: -------------------------------------------------------------------------------- 1 | const _ConfigurationView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl( 3 | '/modules/core/views/configuration-view/configuration-view.tpl.html' 4 | ); 5 | 6 | res({ 7 | template: tpl, 8 | }); 9 | }; 10 | 11 | export const ConfigurationView = _ConfigurationView; 12 | export default _ConfigurationView; 13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/configuration-view/configuration-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/entities-list-view/entities-list-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { EntitiesListDef } from '../../components/entities-list/entities-list.js'; 3 | 4 | const _EntitiesListView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl( 6 | '/modules/core/views/entities-list-view/entities-list-view.tpl.html' 7 | ); 8 | const entitiesList = await EntitiesListDef(); 9 | 10 | res({ 11 | components: { 12 | EntitiesList: entitiesList, 13 | }, 14 | mounted() { 15 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.entities.title')); 16 | }, 17 | methods: { 18 | goToCreateView: function() { 19 | this.$router.push({ name: 'entity-details', params: { id: 'new' } }); 20 | }, 21 | }, 22 | template: tpl, 23 | }); 24 | }; 25 | 26 | export const EntitiesListView = _EntitiesListView; 27 | export default _EntitiesListView; 28 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/entities-list-view/entities-list-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | mdi-plus 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/entities-view/entities-view.js: -------------------------------------------------------------------------------- 1 | const _EntitiesView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl( 3 | '/modules/core/views/entities-view/entities-view.tpl.html' 4 | ); 5 | 6 | res({ 7 | template: tpl, 8 | }); 9 | }; 10 | 11 | export const EntitiesView = _EntitiesView; 12 | export default _EntitiesView; 13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/entities-view/entities-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/entity-details-view/entity-details-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/graphql-view/graphql-view.js: -------------------------------------------------------------------------------- 1 | import { RawCMS } from '/config/raw-cms.js'; 2 | const _GraphQLView = async (res, rej) => { 3 | const tpl = await RawCMS.loadComponentTpl( 4 | '/modules/core/views/graphql-view/graphql-view.tpl.html' 5 | ); 6 | 7 | res({ 8 | data: function() { 9 | return { 10 | graphiql: `${RawCMS.env.api.baseUrl}/graphql/`, 11 | }; 12 | }, 13 | template: tpl, 14 | }); 15 | }; 16 | 17 | export const GraphQLView = _GraphQLView; 18 | export default _GraphQLView; 19 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/graphql-view/graphql-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/home-view/home-view.js: -------------------------------------------------------------------------------- 1 | import { vuexStore } from '../../../../config/vuex.js'; 2 | import { DashboardDef } from '../../components/dashboard/dashboard.js'; 3 | 4 | const _HomeView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl('/modules/core/views/home-view/home-view.tpl.html'); 6 | const dashboardDef = await DashboardDef(); 7 | 8 | res({ 9 | components: { 10 | Dashboard: dashboardDef, 11 | }, 12 | mounted() { 13 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.home.title')); 14 | }, 15 | template: tpl, 16 | }); 17 | }; 18 | 19 | export const HomeView = _HomeView; 20 | export default _HomeView; 21 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/home-view/home-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ $t('core.home.welcomeText') }} 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambda-details-view/lambda-details-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { optionalChain } from '../../../../utils/object.utils.js'; 3 | import { rawCmsDetailEditEvents } from '../../../shared/components/detail-edit/detail-edit.js'; 4 | import { LambdaDetailsDef } from '../../components/lambda-details/lambda-details.js'; 5 | 6 | const _LambdaDetailsView = async (res, rej) => { 7 | const tpl = await RawCMS.loadComponentTpl( 8 | '/modules/core/views/lambda-details-view/lambda-details-view.tpl.html' 9 | ); 10 | const editor = await LambdaDetailsDef(); 11 | 12 | res({ 13 | components: { 14 | LambdaDetails: editor, 15 | }, 16 | created: function() { 17 | RawCMS.eventBus.$once(rawCmsDetailEditEvents.loaded, ev => { 18 | this.updateTitle({ 19 | isNew: ev.isNew, 20 | name: optionalChain(() => ev.value.Name, { fallbackValue: '' }), 21 | }); 22 | }); 23 | }, 24 | methods: { 25 | updateTitle: function({ isNew, name }) { 26 | let title = isNew 27 | ? this.$t('core.lambdas.details.newTitle') 28 | : this.$t('core.lambdas.details.updateTitle', { name: name }); 29 | 30 | vuexStore.dispatch('core/updateTopBarTitle', title); 31 | }, 32 | }, 33 | template: tpl, 34 | }); 35 | }; 36 | 37 | export const LambdaDetailsView = _LambdaDetailsView; 38 | export default _LambdaDetailsView; 39 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambda-details-view/lambda-details-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambdas-list-view/lambdas-list-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { LambdasListDef } from '../../components/lambdas-list/lambdas-list.js'; 3 | 4 | const _LambdasListView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl( 6 | '/modules/core/views/lambdas-list-view/lambdas-list-view.tpl.html' 7 | ); 8 | const list = await LambdasListDef(); 9 | 10 | res({ 11 | components: { 12 | LambdasList: list, 13 | }, 14 | mounted() { 15 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.lambdas.title')); 16 | }, 17 | methods: { 18 | goToCreateView: function() { 19 | this.$router.push({ name: 'lambda-details', params: { id: 'new' } }); 20 | }, 21 | }, 22 | template: tpl, 23 | }); 24 | }; 25 | 26 | export const LambdasListView = _LambdasListView; 27 | export default _LambdasListView; 28 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambdas-list-view/lambdas-list-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | mdi-plus 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambdas-view/lambdas-view.js: -------------------------------------------------------------------------------- 1 | const _LambdasView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl( 3 | '/modules/core/views/lambdas-view/lambdas-view.tpl.html' 4 | ); 5 | 6 | res({ 7 | template: tpl, 8 | }); 9 | }; 10 | 11 | export const LambdasView = _LambdasView; 12 | export default _LambdasView; 13 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/lambdas-view/lambdas-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/sandbox/formly-test/formly-test.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/user-details-view/user-details-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { optionalChain } from '../../../../utils/object.utils.js'; 3 | import { rawCmsDetailEditEvents } from '../../../shared/components/detail-edit/detail-edit.js'; 4 | import { UserDetailsDef } from '../../components/user-details/user-details.js'; 5 | 6 | const _UserDetailsView = async (res, rej) => { 7 | const tpl = await RawCMS.loadComponentTpl( 8 | '/modules/core/views/user-details-view/user-details-view.tpl.html' 9 | ); 10 | const details = await UserDetailsDef(); 11 | 12 | res({ 13 | components: { 14 | UserDetails: details, 15 | }, 16 | created: function() { 17 | RawCMS.eventBus.$once(rawCmsDetailEditEvents.loaded, ev => { 18 | this.updateTitle({ 19 | isNew: ev.isNew, 20 | name: optionalChain(() => ev.value.UserName, { fallbackValue: '' }), 21 | }); 22 | }); 23 | }, 24 | methods: { 25 | updateTitle: function({ isNew, name }) { 26 | const title = isNew 27 | ? this.$t('core.users.detail.newTitle') 28 | : this.$t('core.users.detail.updateTitle', { name: name }); 29 | 30 | vuexStore.dispatch('core/updateTopBarTitle', title); 31 | }, 32 | }, 33 | template: tpl, 34 | }); 35 | }; 36 | 37 | export const UserDetailsView = _UserDetailsView; 38 | export default _UserDetailsView; 39 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/user-details-view/user-details-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/users-list-view/users-list-view.js: -------------------------------------------------------------------------------- 1 | import vuexStore from '../../../../config/vuex.js'; 2 | import { UsersListDef } from '../../components/users-list/users-list.js'; 3 | 4 | const _UsersListView = async (res, rej) => { 5 | const tpl = await RawCMS.loadComponentTpl( 6 | '/modules/core/views/users-list-view/users-list-view.tpl.html' 7 | ); 8 | const list = await UsersListDef(); 9 | 10 | res({ 11 | components: { 12 | UsersList: list, 13 | }, 14 | mounted() { 15 | vuexStore.dispatch('core/updateTopBarTitle', this.$t('core.users.title')); 16 | }, 17 | methods: { 18 | goToCreateView: function() { 19 | this.$router.push({ name: 'user-details', params: { id: 'new' } }); 20 | }, 21 | }, 22 | template: tpl, 23 | }); 24 | }; 25 | 26 | export const UsersListView = _UsersListView; 27 | export default _UsersListView; 28 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/users-list-view/users-list-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | mdi-plus 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/users-view/users-view.js: -------------------------------------------------------------------------------- 1 | const _UsersListView = async (res, rej) => { 2 | const tpl = await RawCMS.loadComponentTpl('/modules/core/views/users-view/users-view.tpl.html'); 3 | 4 | res({ 5 | template: tpl, 6 | }); 7 | }; 8 | 9 | export const UsersListView = _UsersListView; 10 | export default _UsersListView; 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/core/views/users-view/users-view.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/assets/i18n/i18n.en.json: -------------------------------------------------------------------------------- 1 | { 2 | "formly": { 3 | "clearBtn": "Clear", 4 | "validation": { 5 | "required": "This field is required" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/base-list-field/base-list-field.tpl.html: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 43 | 44 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/bool-field/bool-field.js: -------------------------------------------------------------------------------- 1 | import { BaseField } from '../base-field/base-field.js'; 2 | 3 | const _BoolField = async (res, rej) => { 4 | const tpl = await RawCMS.loadComponentTpl( 5 | '/modules/formly-material/components/bool-field/bool-field.tpl.html' 6 | ); 7 | 8 | res({ 9 | data: function() { 10 | return { 11 | listeners: { 12 | blur: this.onBlur, 13 | focus: this.onFocus, 14 | // click: this.onClick, NOTE: This is handled by Vuetify 15 | change: this.onChange, 16 | input: this.onInput, 17 | keyup: this.onKeyup, 18 | keydown: this.onKeydown, 19 | }, 20 | }; 21 | }, 22 | mixins: [BaseField], 23 | template: tpl, 24 | }); 25 | }; 26 | 27 | export const BoolField = _BoolField; 28 | export default _BoolField; 29 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/bool-field/bool-field.tpl.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/date-field/date-field.tpl.html: -------------------------------------------------------------------------------- 1 | 8 | 19 | 20 | 21 | 22 | mdi-close 23 | {{ $t('formly.clearBtn') }} 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/entities-list-field/entities-list-field.js: -------------------------------------------------------------------------------- 1 | import { vuexStore } from '../../../../config/vuex.js'; 2 | import { nameOf } from '../../../../utils/object.utils.js'; 3 | import { entitiesSchemaService } from '../../../core/services/entities-schema.service.js'; 4 | import { BaseField } from '../base-field/base-field.js'; 5 | import { BaseListFieldDef } from '../base-list-field/base-list-field.js'; 6 | 7 | const _EntitiesListField = async (res, rej) => { 8 | const baseDef = await BaseListFieldDef(); 9 | 10 | res({ 11 | extends: baseDef, 12 | methods: { 13 | onChange: function(_e) { 14 | BaseField.methods.onChange.call(this); 15 | this.updateRelationMetadata(); 16 | }, 17 | updateRelationMetadata: function() { 18 | vuexStore.dispatch('core/updateRelationMetadata', { collectionName: this.value }); 19 | }, 20 | }, 21 | mounted: async function() { 22 | const entities = await entitiesSchemaService.getAll(); 23 | this.$set(this, nameOf(() => this.items), entities.map(x => x.CollectionName)); 24 | this.updateRelationMetadata(); 25 | }, 26 | }); 27 | }; 28 | 29 | export const EntitiesListField = _EntitiesListField; 30 | export default _EntitiesListField; 31 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/int-field/int-field.js: -------------------------------------------------------------------------------- 1 | import { NumberFieldDef } from '../number-field/number-field.js'; 2 | 3 | const _IntFieldDef = async () => { 4 | const baseDef = await NumberFieldDef(); 5 | 6 | return { 7 | extends: baseDef, 8 | props: { 9 | step: { 10 | default: 1, 11 | }, 12 | }, 13 | }; 14 | }; 15 | 16 | const _IntField = async (res, rej) => { 17 | const cmpDef = await _IntFieldDef(); 18 | res(cmpDef); 19 | }; 20 | 21 | export const IntFieldDef = _IntFieldDef; 22 | export const IntField = _IntField; 23 | export default _IntField; 24 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/list-field/list-field.js: -------------------------------------------------------------------------------- 1 | import { nameOf, optionalChain } from '../../../../utils/object.utils.js'; 2 | import { BaseListFieldDef } from '../base-list-field/base-list-field.js'; 3 | 4 | const _ListField = async (res, rej) => { 5 | const baseDef = await BaseListFieldDef(); 6 | 7 | res({ 8 | mounted: function() { 9 | const strVal = optionalChain(() => this.field._meta_.options.values); 10 | 11 | if (strVal === undefined) { 12 | this.$set(this, nameOf(() => this.items), []); 13 | return; 14 | } 15 | 16 | this.$set(this, nameOf(() => this.items), strVal.split('|').map(x => x.trim())); 17 | }, 18 | extends: baseDef, 19 | }); 20 | }; 21 | 22 | export const ListField = _ListField; 23 | export default _ListField; 24 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/number-field/number-field.js: -------------------------------------------------------------------------------- 1 | import { BaseField } from '../base-field/base-field.js'; 2 | 3 | const _NumberFieldDef = async () => { 4 | const tpl = await RawCMS.loadComponentTpl( 5 | '/modules/formly-material/components/number-field/number-field.tpl.html' 6 | ); 7 | 8 | return { 9 | methods: { 10 | preProcessValueForSet: function(val) { 11 | return val === undefined || val === '' ? undefined : new Number(val); 12 | }, 13 | }, 14 | mixins: [BaseField], 15 | props: { 16 | step: { 17 | default: 'any', 18 | }, 19 | }, 20 | template: tpl, 21 | }; 22 | }; 23 | 24 | const _NumberField = async (res, rej) => { 25 | const cmpDef = await _NumberFieldDef(); 26 | res(cmpDef); 27 | }; 28 | 29 | export const NumberFieldDef = _NumberFieldDef; 30 | export const NumberField = _NumberField; 31 | export default _NumberField; 32 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/number-field/number-field.tpl.html: -------------------------------------------------------------------------------- 1 |
2 | 13 |
14 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/relation-field/relation-field.tpl.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/text-field/text-field.js: -------------------------------------------------------------------------------- 1 | import { BaseField } from '../base-field/base-field.js'; 2 | 3 | const _TextField = async (res, rej) => { 4 | const tpl = await RawCMS.loadComponentTpl( 5 | '/modules/formly-material/components/text-field/text-field.tpl.html' 6 | ); 7 | 8 | res({ 9 | mixins: [BaseField], 10 | template: tpl, 11 | }); 12 | }; 13 | 14 | export const TextField = _TextField; 15 | export default _TextField; 16 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/components/text-field/text-field.tpl.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/formly-material/config.js: -------------------------------------------------------------------------------- 1 | import { BoolField } from './components/bool-field/bool-field.js'; 2 | import { DateField } from './components/date-field/date-field.js'; 3 | import { EntitiesListField } from './components/entities-list-field/entities-list-field.js'; 4 | import { FieldsListField } from './components/fields-list-field/fields-list-field.js'; 5 | import { IntField } from './components/int-field/int-field.js'; 6 | import { ListField } from './components/list-field/list-field.js'; 7 | import { NumberField } from './components/number-field/number-field.js'; 8 | import { RelationField } from './components/relation-field/relation-field.js'; 9 | import { TextField } from './components/text-field/text-field.js'; 10 | 11 | const _configFormlyMaterialModule = function() { 12 | // Bool 13 | Vue.$formly.addType('bool', BoolField); 14 | // Strings 15 | Vue.$formly.addType('regexp', TextField); 16 | Vue.$formly.addType('text', TextField); 17 | // Numbers 18 | Vue.$formly.addType('number', NumberField); 19 | Vue.$formly.addType('int', IntField); 20 | // Date/Time 21 | Vue.$formly.addType('date', DateField); 22 | // List 23 | Vue.$formly.addType('list', ListField); 24 | // Relations 25 | Vue.$formly.addType('relation', RelationField); 26 | Vue.$formly.addType('entities-list', EntitiesListField); 27 | Vue.$formly.addType('fields-list', FieldsListField); 28 | }; 29 | 30 | export const configFormlyMaterialModule = _configFormlyMaterialModule; 31 | export default _configFormlyMaterialModule; 32 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/shared/components/charts/charts.utils.js: -------------------------------------------------------------------------------- 1 | import { vuetifyColors } from '../../../../config/vuetify.js'; 2 | import { optionalChain } from '../../../../utils/object.utils.js'; 3 | 4 | const _transparentize = function(color, opacity) { 5 | const alpha = opacity === undefined ? 0.5 : 1 - opacity; 6 | return Color(color) 7 | .alpha(alpha) 8 | .rgbString(); 9 | }; 10 | 11 | const _colorize = function(value, { range = [0, 100], lowerIsBetter = false } = {}) { 12 | const min = optionalChain(() => range[0], 0); 13 | const max = optionalChain(() => range[1], 100); 14 | let colors = [vuetifyColors.red.darken4, vuetifyColors.orange.base, vuetifyColors.green.base]; 15 | if (lowerIsBetter) { 16 | colors = colors.reverse(); 17 | } 18 | const colorMap = d3.piecewise(d3.interpolate, colors); 19 | const interpolationValue = (value - min) / (max - min); 20 | 21 | const c = colorMap(interpolationValue); 22 | return c; 23 | }; 24 | 25 | export const colorize = _colorize; 26 | export const transparentize = _transparentize; 27 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/shared/components/data-table/data-table.css: -------------------------------------------------------------------------------- 1 | .rawcms-data-table tr { 2 | cursor: pointer; 3 | } 4 | 5 | .rawcms-data-table tr th:last-child, 6 | .rawcms-data-table tr td:last-child { 7 | width: 1%; 8 | white-space: nowrap; 9 | 10 | border-spacing: 5px; 11 | border-left-color: rgba(0, 0, 0, 0.12); 12 | border-left-style: solid; 13 | border-left-width: 1px; 14 | } 15 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/shared/components/list/list.css: -------------------------------------------------------------------------------- 1 | .rawcms-list .v-list-item .v-list-item__icon { 2 | opacity: 0; 3 | } 4 | 5 | .rawcms-list .v-list-item:hover .v-list-item__icon { 6 | opacity: 1; 7 | } 8 | 9 | .rawcms-list .v-list-item .v-list-item__icon.force-show { 10 | opacity: 1; 11 | } 12 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/shared/services/base-api-service.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '../../core/api/api-client.js'; 2 | 3 | export class BaseApiService { 4 | _apiClient; 5 | 6 | constructor() { 7 | this._apiClient = apiClient; 8 | } 9 | 10 | _checkGenericError(axiosRes) { 11 | if (axiosRes.status !== 200) { 12 | return false; 13 | } 14 | 15 | if (axiosRes.data && axiosRes.data.status && axiosRes.data.status != 'OK') { 16 | return false; 17 | } 18 | 19 | if (axiosRes.data && axiosRes.data.errors && axiosRes.data.errors.lenght > 0) { 20 | return false; 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /raw-cms-app/src/modules/shared/services/crud-service.js: -------------------------------------------------------------------------------- 1 | export class ICrudService { 2 | constructor() {} 3 | 4 | async getAll() { 5 | throw new Error(`Please Provide an implementation for ${this.getAll.name}`); 6 | } 7 | 8 | async getPage({ page = 1, size = 20, rawQuery = undefined } = {}) { 9 | throw new Error(`Please Provide an implementation for ${this.getPage.name}`); 10 | } 11 | 12 | async getById() { 13 | throw new Error(`Please Provide an implementation for ${this.getById.name}`); 14 | } 15 | 16 | async create(obj) { 17 | throw new Error(`Please Provide an implementation for ${this.create.name}`); 18 | } 19 | 20 | async update(obj) { 21 | throw new Error(`Please Provide an implementation for ${this.update.name}`); 22 | } 23 | 24 | async delete(id) { 25 | throw new Error(`Please Provide an implementation for ${this.delete.name}`); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /raw-cms-app/src/styles.css: -------------------------------------------------------------------------------- 1 | fieldset { 2 | border: none; 3 | width: 100%; 4 | } 5 | 6 | .fill-container-chart { 7 | width: 100%; 8 | height: 100%; 9 | position: relative; 10 | } 11 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/immutable.utils.js: -------------------------------------------------------------------------------- 1 | const _addOrReplace = ({ array, element, findFn }) => { 2 | const arrayCopy = [...array]; 3 | const index = arrayCopy.findIndex(findFn); 4 | 5 | if (index >= 0) { 6 | arrayCopy[index] = element; 7 | } else { 8 | arrayCopy.push(element); 9 | } 10 | 11 | return arrayCopy; 12 | }; 13 | 14 | export const addOrReplace = _addOrReplace; 15 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/inheritance.utils.js: -------------------------------------------------------------------------------- 1 | const _mix = (baseClass, ...mixins) => { 2 | class base extends baseClass { 3 | constructor(...args) { 4 | super(...args); 5 | mixins.forEach(mixin => { 6 | copyProps(this, new mixin()); 7 | }); 8 | } 9 | } 10 | 11 | // this function copies all properties and symbols, filtering out some special ones 12 | const copyProps = (target, source) => { 13 | Object.getOwnPropertyNames(source) 14 | .concat(Object.getOwnPropertySymbols(source)) 15 | .forEach(prop => { 16 | if ( 17 | !prop.match( 18 | /^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/ 19 | ) 20 | ) 21 | Object.defineProperty(target, prop, Object.getOwnPropertyDescriptor(source, prop)); 22 | }); 23 | }; 24 | 25 | // outside contructor() to allow aggregation(A,B,C).staticFunction() to be called etc. 26 | mixins.forEach(mixin => { 27 | copyProps(base.prototype, mixin.prototype); 28 | copyProps(base, mixin); 29 | }); 30 | return base; 31 | }; 32 | 33 | export const mix = _mix; 34 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/object.utils.js: -------------------------------------------------------------------------------- 1 | const _optionalChain = ( 2 | expression, 3 | { fallbackValue = undefined, replaceLastUndefined = true } = {} 4 | ) => { 5 | let val; 6 | 7 | try { 8 | val = expression(); 9 | } catch { 10 | return fallbackValue; 11 | } 12 | 13 | return val === undefined && replaceLastUndefined ? fallbackValue : val; 14 | }; 15 | 16 | const _deepClone = obj => { 17 | return JSON.parse(JSON.stringify(obj)); 18 | }; 19 | 20 | const _nameOf = expr => { 21 | if (!expr || typeof expr !== 'function') { 22 | throw new Error('`expr` should be an arrow function!'); 23 | } 24 | 25 | const indexOfArrow = expr => expr.indexOf('=>'); 26 | 27 | if (indexOfArrow < 0) { 28 | throw new Error('Unable to find `=>` in expr`. Have you used an arrow function?'); 29 | } 30 | 31 | const segments = expr 32 | .toString() 33 | .slice(indexOfArrow) 34 | .trim() 35 | .split('.'); 36 | return segments[segments.length - 1]; 37 | }; 38 | 39 | export const optionalChain = _optionalChain; 40 | export const deepClone = _deepClone; 41 | export const nameOf = _nameOf; 42 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/random.utils.js: -------------------------------------------------------------------------------- 1 | const _randomString = ( 2 | length, 3 | { alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' } = {} 4 | ) => { 5 | const arr = []; 6 | for (let i = 0; i < length; i++) { 7 | arr.push(alphabet[Math.floor(Math.random() * alphabet.length)]); 8 | } 9 | 10 | return arr.join(''); 11 | }; 12 | 13 | export const randomString = _randomString; 14 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/spinners.js: -------------------------------------------------------------------------------- 1 | const _epicSpinners = window['epic-spinners']; 2 | 3 | export const epicSpinners = _epicSpinners; 4 | export default epicSpinners; 5 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/string.utils.js: -------------------------------------------------------------------------------- 1 | const _toFirstUpperCase = function(str) { 2 | if (typeof str !== 'string') { 3 | throw new Error('You should pass a string!'); 4 | } 5 | 6 | if (!str) { 7 | return str; 8 | } 9 | 10 | return str.substr(0, 1).toUpperCase() + str.substr(1); 11 | }; 12 | 13 | export const toFirstUpperCase = _toFirstUpperCase; 14 | -------------------------------------------------------------------------------- /raw-cms-app/src/utils/time.utils.js: -------------------------------------------------------------------------------- 1 | export function delay({ millis, value }) { 2 | return new Promise(function(resolve) { 3 | setTimeout(() => { 4 | resolve.bind(null, value)(); 5 | }, millis); 6 | }); 7 | } 8 | 9 | export function sleep(millis) { 10 | return delay({ millis, value: true }); 11 | } 12 | 13 | export function debounce(func, wait) { 14 | let timeout; 15 | 16 | return function() { 17 | const context = this; 18 | const args = arguments; 19 | clearTimeout(timeout); 20 | timeout = setTimeout(function() { 21 | func.apply(context, args); 22 | }, wait); 23 | }; 24 | } 25 | --------------------------------------------------------------------------------