From 82e9803ca8844f87e257b614425287b9046f87a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 20 Nov 2019 14:31:12 +0300 Subject: [PATCH 01/52] Add models to the API definition --- .../Tab/AbpTabLinkTagHelperService.cs | 4 +- .../AspNetCoreApiDescriptionModelProvider.cs | 72 ++++++++++++++++++- .../Volo.Abp.Core/System/AbpTypeExtensions.cs | 21 +++--- .../Volo/Abp/Reflection/TypeHelper.cs | 44 ++++++++++++ .../Volo/Abp/Threading/AsyncHelper.cs | 7 +- .../DynamicProxying/ApiDescriptionFinder.cs | 2 +- .../ApplicationApiDescriptionModel.cs | 6 +- .../Modeling/ControllerApiDescriptionModel.cs | 4 +- .../ControllerInterfaceApiDescriptionModel.cs | 2 +- .../MethodParameterApiDescriptionModel.cs | 2 +- .../Modeling/ParameterApiDescriptionModel.cs | 2 +- .../Modeling/PropertyApiDescriptionModel.cs | 23 ++++++ .../ReturnValueApiDescriptionModel.cs | 2 +- .../Http/Modeling/TypeApiDescriptionModel.cs | 54 ++++++++++++++ .../JQuery/JQueryProxyScriptGenerator.cs | 2 +- 15 files changed, 225 insertions(+), 22 deletions(-) create mode 100644 framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs create mode 100644 framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs index ba5e3e811a..54a29bf691 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { public class AbpTabLinkTagHelperService : AbpTagHelperService { - public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetPlaceholderForNameIfNotProvided(); @@ -18,6 +18,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab tabHeaderItems.Add(new TabItem(tabHeader, "", false, TagHelper.Name, TagHelper.ParentDropdownName, false)); output.SuppressOutput(); + + return Task.CompletedTask; } protected virtual string GetTabHeaderItem(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index d9cb936326..696860734f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; +using System.Threading.Tasks; using JetBrains.Annotations; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; @@ -16,6 +17,8 @@ using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.Utils; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Modeling; +using Volo.Abp.Reflection; +using Volo.Abp.Threading; namespace Volo.Abp.AspNetCore.Mvc { @@ -61,12 +64,12 @@ namespace Volo.Abp.AspNetCore.Mvc return model; } - private void AddApiDescriptionToModel(ApiDescription apiDescription, ApplicationApiDescriptionModel model) + private void AddApiDescriptionToModel(ApiDescription apiDescription, ApplicationApiDescriptionModel applicationModel) { var controllerType = apiDescription.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(); var setting = FindSetting(controllerType); - var moduleModel = model.GetOrAddModule(GetRootPath(controllerType, setting)); + var moduleModel = applicationModel.GetOrAddModule(GetRootPath(controllerType, setting)); var controllerModel = moduleModel.GetOrAddController(controllerType.FullName, CalculateControllerName(controllerType, setting), controllerType, _modelOptions.IgnoredInterfaces); @@ -80,6 +83,7 @@ namespace Volo.Abp.AspNetCore.Mvc } Logger.LogDebug($"ActionApiDescriptionModel.Create: {controllerModel.ControllerName}.{uniqueMethodName}"); + var actionModel = controllerModel.AddAction(uniqueMethodName, ActionApiDescriptionModel.Create( uniqueMethodName, method, @@ -88,6 +92,8 @@ namespace Volo.Abp.AspNetCore.Mvc GetSupportedVersions(controllerType, method, setting) )); + AddCustomTypesToModel(applicationModel, method); + AddParameterDescriptionsToModel(actionModel, method, apiDescription); } @@ -149,6 +155,68 @@ namespace Volo.Abp.AspNetCore.Mvc return supportedVersions.Select(v => v.ToString()).Distinct().ToList(); } + private void AddCustomTypesToModel(ApplicationApiDescriptionModel applicationModel, MethodInfo method) + { + foreach (var parameterInfo in method.GetParameters()) + { + AddCustomTypesToModel(applicationModel, parameterInfo.ParameterType); + } + + AddCustomTypesToModel(applicationModel, method.ReturnType); + } + + private static void AddCustomTypesToModel(ApplicationApiDescriptionModel applicationModel, [CanBeNull] Type type) + { + if (type == null) + { + return; + } + + type = AsyncHelper.UnwrapTask(type); + + if (type == typeof(object) || + type == typeof(void) || + type == typeof(Enum) || + type == typeof(ValueType) || + TypeHelper.IsPrimitiveExtended(type)) + { + return; + } + + if (TypeHelper.IsEnumerable(type, out var itemType)) + { + AddCustomTypesToModel(applicationModel, itemType); + return; + } + + if (TypeHelper.IsDictionary(type, out var keyType, out var valueType)) + { + AddCustomTypesToModel(applicationModel, keyType); + AddCustomTypesToModel(applicationModel, valueType); + return; + } + + /* TODO: Add interfaces + */ + + var typeAsString = type.FullName; + + if (applicationModel.Types.ContainsKey(typeAsString)) + { + return; + } + + var typeModel = TypeApiDescriptionModel.Create(type); + applicationModel.Types[typeAsString] = typeModel; + + AddCustomTypesToModel(applicationModel, type.BaseType); + + foreach (var propertyInfo in type.GetProperties()) + { + AddCustomTypesToModel(applicationModel, propertyInfo.PropertyType); + } + } + private void AddParameterDescriptionsToModel(ActionApiDescriptionModel actionModel, MethodInfo method, ApiDescription apiDescription) { if (!apiDescription.ParameterDescriptions.Any()) diff --git a/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs index a930096404..fe23c77530 100644 --- a/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs @@ -1,15 +1,11 @@ using System.Collections.Generic; using JetBrains.Annotations; +using Volo.Abp; namespace System { public static class AbpTypeExtensions { - public static string GetFullNameWithAssemblyName(this Type type) - { - return type.FullName + ", " + type.Assembly.GetName().Name; - } - /// /// Determines whether an instance of this type can be assigned to /// an instance of the . @@ -17,8 +13,10 @@ namespace System /// Internally uses . /// /// Target type (as reverse). - public static bool IsAssignableTo(this Type type) + public static bool IsAssignableTo([NotNull] this Type type) { + Check.NotNull(type, nameof(type)); + return type.IsAssignableTo(typeof(TTarget)); } @@ -30,8 +28,11 @@ namespace System /// /// this type /// Target type - public static bool IsAssignableTo(this Type type, Type targetType) + public static bool IsAssignableTo([NotNull] this Type type, [NotNull] Type targetType) { + Check.NotNull(type, nameof(type)); + Check.NotNull(targetType, nameof(targetType)); + return targetType.IsAssignableFrom(type); } @@ -40,8 +41,10 @@ namespace System /// /// The type to get its base classes. /// True, to include the standard type in the returned array. - public static Type[] GetBaseClasses(this Type type, bool includeObject = true) + public static Type[] GetBaseClasses([NotNull] this Type type, bool includeObject = true) { + Check.NotNull(type, nameof(type)); + var types = new List(); AddTypeAndBaseTypesRecursively(types, type.BaseType, includeObject); return types.ToArray(); @@ -52,6 +55,8 @@ namespace System [CanBeNull] Type type, bool includeObject) { + Check.NotNull(types, nameof(types)); + if (type == null) { return; diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs index a708ecc10d..cab8c41b2c 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs @@ -1,4 +1,7 @@ using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Reflection; @@ -54,6 +57,47 @@ namespace Volo.Abp.Reflection return t; } + public static bool IsEnumerable(Type type, out Type itemType) + { + var enumerableTypes = ReflectionHelper.GetImplementedGenericTypes(type, typeof(IEnumerable<>)); + if (enumerableTypes.Count == 1) + { + itemType = enumerableTypes[0].GenericTypeArguments[0]; + return true; + } + + if (typeof(IEnumerable).IsAssignableFrom(type)) + { + itemType = typeof(object); + return true; + } + + itemType = null; + return false; + } + + public static bool IsDictionary(Type type, out Type keyType, out Type valueType) + { + var enumerableTypes = ReflectionHelper.GetImplementedGenericTypes(type, typeof(IDictionary<,>)); + if (enumerableTypes.Count == 1) + { + keyType = enumerableTypes[0].GenericTypeArguments[0]; + valueType = enumerableTypes[0].GenericTypeArguments[2]; + return true; + } + + if (typeof(IDictionary).IsAssignableFrom(type)) + { + keyType = typeof(object); + valueType = typeof(object); + return true; + } + + keyType = null; + valueType = null; + return false; + } + private static bool IsPrimitiveExtendedInternal(Type type, bool includeEnums) { if (type.IsPrimitive) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncHelper.cs index dc678b8fd4..65e411d038 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncHelper.cs @@ -27,6 +27,11 @@ namespace Volo.Abp.Threading return type == typeof(Task) || (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>)); } + public static bool IsTaskOfT([NotNull] this Type type) + { + return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>); + } + /// /// Returns void if given type is Task. /// Return T, if given type is Task{T}. @@ -41,7 +46,7 @@ namespace Volo.Abp.Threading return typeof(void); } - if (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>)) + if (type.IsTaskOfT()) { return type.GenericTypeArguments[0]; } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 9b9c8e804c..fe6192fd85 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -57,7 +57,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying for (int i = 0; i < methodParameters.Length; i++) { - if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.GetFullNameWithAssemblyName()) + if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.FullName) { found = false; break; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs index a7def10625..fad94b3745 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs @@ -10,6 +10,8 @@ namespace Volo.Abp.Http.Modeling { public IDictionary Modules { get; set; } + public IDictionary Types { get; set; } + private ApplicationApiDescriptionModel() { @@ -19,8 +21,8 @@ namespace Volo.Abp.Http.Modeling { return new ApplicationApiDescriptionModel { - //TODO: Why ConcurrentDictionary? - Modules = new ConcurrentDictionary() + Modules = new ConcurrentDictionary(), //TODO: Why ConcurrentDictionary? + Types = new Dictionary() }; } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs index 2bd9a301ab..dfad32f621 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.Http.Modeling return new ControllerApiDescriptionModel { ControllerName = controllerName, - TypeAsString = type.GetFullNameWithAssemblyName(), + TypeAsString = type.FullName, Actions = new Dictionary(), Interfaces = type .GetInterfaces() @@ -71,7 +71,7 @@ namespace Volo.Abp.Http.Modeling public bool Implements(Type interfaceType) { - return Interfaces.Any(i => i.TypeAsString == interfaceType.GetFullNameWithAssemblyName()); + return Interfaces.Any(i => i.TypeAsString == interfaceType.FullName); } public override string ToString() diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs index 3605cf675b..3868ec94f9 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Http.Modeling { return new ControllerInterfaceApiDescriptionModel { - TypeAsString = type.GetFullNameWithAssemblyName() + TypeAsString = type.FullName }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs index 61ffc516f6..fdc50090d2 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Http.Modeling return new MethodParameterApiDescriptionModel { Name = parameterInfo.Name, - TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(), + TypeAsString = parameterInfo.ParameterType.FullName, IsOptional = parameterInfo.IsOptional, DefaultValue = parameterInfo.HasDefaultValue ? parameterInfo.DefaultValue : null }; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs index d1de33258f..e05e36aec3 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Http.Modeling { Name = name, NameOnMethod = nameOnMethod, - TypeAsString = type?.GetFullNameWithAssemblyName(), + TypeAsString = type?.FullName, IsOptional = isOptional, DefaultValue = defaultValue, ConstraintTypes = constraintTypes, diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs new file mode 100644 index 0000000000..ee39f54687 --- /dev/null +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Reflection; + +namespace Volo.Abp.Http.Modeling +{ + [Serializable] + public class PropertyApiDescriptionModel + { + public string Name { get; set; } + + public string TypeAsString { get; set; } + + //TODO: Validation rules for this property + public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo) + { + return new PropertyApiDescriptionModel + { + Name = propertyInfo.Name, + TypeAsString = propertyInfo.PropertyType.FullName + }; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs index 001bd1b9c9..78bd5982fe 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Http.Modeling { return new ReturnValueApiDescriptionModel { - TypeAsString = AsyncHelper.UnwrapTask(type).GetFullNameWithAssemblyName() + TypeAsString = AsyncHelper.UnwrapTask(type).FullName }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs new file mode 100644 index 0000000000..65f7a61b27 --- /dev/null +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs @@ -0,0 +1,54 @@ +using System; +using System.Linq; + +namespace Volo.Abp.Http.Modeling +{ + [Serializable] + public class TypeApiDescriptionModel + { + public string BaseTypeAsString { get; set; } + + public bool IsEnum { get; set; } + + public string[] EnumNames { get; set; } + + public object[] EnumValues { get; set; } + + public PropertyApiDescriptionModel[] Properties { get; set; } + + private TypeApiDescriptionModel() + { + + } + + public static TypeApiDescriptionModel Create(Type type) + { + var baseType = type.BaseType; + if (baseType == typeof(object)) + { + baseType = null; + } + + var typeModel = new TypeApiDescriptionModel + { + IsEnum = type.IsEnum, + BaseTypeAsString = baseType?.FullName + }; + + if (typeModel.IsEnum) + { + typeModel.EnumNames = type.GetEnumNames(); + typeModel.EnumValues = type.GetEnumValues().Cast().ToArray(); + } + else + { + typeModel.Properties = type + .GetProperties() + .Select(PropertyApiDescriptionModel.Create) + .ToArray(); + } + + return typeModel; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs index 169e9b8764..4cf80f7ed8 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs @@ -125,7 +125,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery script.AppendLine(" url: abp.appPath + '" + ProxyScriptingHelper.GenerateUrlWithParameters(action) + "',"); script.Append(" type: '" + httpMethod + "'"); - if (action.ReturnValue.TypeAsString == typeof(void).GetFullNameWithAssemblyName()) + if (action.ReturnValue.TypeAsString == typeof(void).FullName) { script.AppendLine(","); script.Append(" dataType: null"); From 224494d0aa0a47612b6d98d1ff884bd8011274b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 20 Nov 2019 16:22:51 +0300 Subject: [PATCH 02/52] Revised api description model. --- .../AbpApiDefinitionController.cs | 4 +- .../AspNetCoreApiDescriptionModelProvider.cs | 21 ++- .../DynamicProxying/ApiDescriptionFinder.cs | 2 +- ...pplicationApiDescriptionModelRequestDto.cs | 7 + .../Modeling/ControllerApiDescriptionModel.cs | 8 +- .../ControllerInterfaceApiDescriptionModel.cs | 4 +- .../Modeling/IApiDescriptionModelProvider.cs | 2 +- .../MethodParameterApiDescriptionModel.cs | 7 +- .../Abp/Http/Modeling/ModelingTypeHelper.cs | 127 ++++++++++++++++++ .../Modeling/ParameterApiDescriptionModel.cs | 7 +- .../Modeling/PropertyApiDescriptionModel.cs | 7 +- .../ReturnValueApiDescriptionModel.cs | 9 +- .../Http/Modeling/TypeApiDescriptionModel.cs | 4 +- .../JQuery/JQueryProxyScriptGenerator.cs | 4 +- .../Http/ProxyScripting/ProxyScriptManager.cs | 2 +- 15 files changed, 185 insertions(+), 30 deletions(-) create mode 100644 framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModelRequestDto.cs create mode 100644 framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModelingTypeHelper.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController.cs index ae72975486..e1c2d1f859 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController.cs @@ -14,9 +14,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring } [HttpGet] - public ApplicationApiDescriptionModel Get() + public ApplicationApiDescriptionModel Get(ApplicationApiDescriptionModelRequestDto model) { - return _modelProvider.CreateApiModel(); + return _modelProvider.CreateApiModel(model); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index 696860734f..f7b7d6fcae 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Volo.Abp.Application.Services; +using Volo.Abp.AspNetCore.Mvc.ApiExploring; using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.Utils; using Volo.Abp.DependencyInjection; @@ -42,7 +43,7 @@ namespace Volo.Abp.AspNetCore.Mvc Logger = NullLogger.Instance; } - public ApplicationApiDescriptionModel CreateApiModel() + public ApplicationApiDescriptionModel CreateApiModel(ApplicationApiDescriptionModelRequestDto input) { //TODO: Can cache the model? @@ -57,14 +58,17 @@ namespace Volo.Abp.AspNetCore.Mvc continue; } - AddApiDescriptionToModel(apiDescription, model); + AddApiDescriptionToModel(apiDescription, model, input); } } return model; } - private void AddApiDescriptionToModel(ApiDescription apiDescription, ApplicationApiDescriptionModel applicationModel) + private void AddApiDescriptionToModel( + ApiDescription apiDescription, + ApplicationApiDescriptionModel applicationModel, + ApplicationApiDescriptionModelRequestDto input) { var controllerType = apiDescription.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(); var setting = FindSetting(controllerType); @@ -92,7 +96,10 @@ namespace Volo.Abp.AspNetCore.Mvc GetSupportedVersions(controllerType, method, setting) )); - AddCustomTypesToModel(applicationModel, method); + if (input.IncludeTypes) + { + AddCustomTypesToModel(applicationModel, method); + } AddParameterDescriptionsToModel(actionModel, method, apiDescription); } @@ -199,15 +206,15 @@ namespace Volo.Abp.AspNetCore.Mvc /* TODO: Add interfaces */ - var typeAsString = type.FullName; + var typeName = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(type); - if (applicationModel.Types.ContainsKey(typeAsString)) + if (applicationModel.Types.ContainsKey(typeName)) { return; } var typeModel = TypeApiDescriptionModel.Create(type); - applicationModel.Types[typeAsString] = typeModel; + applicationModel.Types[typeName] = typeModel; AddCustomTypesToModel(applicationModel, type.BaseType); diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index fe6192fd85..4ed9b41e10 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -57,7 +57,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying for (int i = 0; i < methodParameters.Length; i++) { - if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.FullName) + if (action.ParametersOnMethod[i].Type != ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(methodParameters[i].ParameterType)) { found = false; break; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModelRequestDto.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModelRequestDto.cs new file mode 100644 index 0000000000..bb50fc0d96 --- /dev/null +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModelRequestDto.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Http.Modeling +{ + public class ApplicationApiDescriptionModelRequestDto + { + public bool IncludeTypes { get; set; } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs index dfad32f621..db5a5eb37a 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Http.Modeling { public string ControllerName { get; set; } - public string TypeAsString { get; set; } + public string Type { get; set; } public List Interfaces { get; set; } @@ -26,7 +26,7 @@ namespace Volo.Abp.Http.Modeling return new ControllerApiDescriptionModel { ControllerName = controllerName, - TypeAsString = type.FullName, + Type = type.FullName, Actions = new Dictionary(), Interfaces = type .GetInterfaces() @@ -52,7 +52,7 @@ namespace Volo.Abp.Http.Modeling { var subModel = new ControllerApiDescriptionModel { - TypeAsString = TypeAsString, + Type = Type, Interfaces = Interfaces, ControllerName = ControllerName, Actions = new Dictionary() @@ -71,7 +71,7 @@ namespace Volo.Abp.Http.Modeling public bool Implements(Type interfaceType) { - return Interfaces.Any(i => i.TypeAsString == interfaceType.FullName); + return Interfaces.Any(i => i.Type == interfaceType.FullName); } public override string ToString() diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs index 3868ec94f9..04b5ea1bc9 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Http.Modeling [Serializable] public class ControllerInterfaceApiDescriptionModel { - public string TypeAsString { get; set; } + public string Type { get; set; } private ControllerInterfaceApiDescriptionModel() { @@ -16,7 +16,7 @@ namespace Volo.Abp.Http.Modeling { return new ControllerInterfaceApiDescriptionModel { - TypeAsString = type.FullName + Type = type.FullName }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/IApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/IApiDescriptionModelProvider.cs index 800dc504db..6f8803ddb6 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/IApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/IApiDescriptionModelProvider.cs @@ -2,6 +2,6 @@ namespace Volo.Abp.Http.Modeling { public interface IApiDescriptionModelProvider { - ApplicationApiDescriptionModel CreateApiModel(); + ApplicationApiDescriptionModel CreateApiModel(ApplicationApiDescriptionModelRequestDto input); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs index fdc50090d2..47145adaaf 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs @@ -8,7 +8,9 @@ namespace Volo.Abp.Http.Modeling { public string Name { get; set; } - public string TypeAsString { get; set; } + public string Type { get; set; } + + public string TypeSimple { get; set; } public bool IsOptional { get; set; } @@ -24,7 +26,8 @@ namespace Volo.Abp.Http.Modeling return new MethodParameterApiDescriptionModel { Name = parameterInfo.Name, - TypeAsString = parameterInfo.ParameterType.FullName, + Type = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType), + TypeSimple = ModelingTypeHelper.GetSimplifiedName(parameterInfo.ParameterType), IsOptional = parameterInfo.IsOptional, DefaultValue = parameterInfo.HasDefaultValue ? parameterInfo.DefaultValue : null }; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModelingTypeHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModelingTypeHelper.cs new file mode 100644 index 0000000000..2d4b2bac85 --- /dev/null +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModelingTypeHelper.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; + +namespace Volo.Abp.Http.Modeling +{ + public static class ModelingTypeHelper + { + public static string GetFullNameHandlingNullableAndGenerics([NotNull] Type type) + { + Check.NotNull(type, nameof(type)); + + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return type.GenericTypeArguments[0].FullName + "?"; + } + + if (type.IsGenericType) + { + var genericType = type.GetGenericTypeDefinition(); + return $"{genericType.FullName.Left(genericType.FullName.IndexOf('`'))}<{type.GenericTypeArguments.Select(GetFullNameHandlingNullableAndGenerics).JoinAsString(",")}>"; + } + + return type.FullName; + } + + public static string GetSimplifiedName([NotNull] Type type) + { + Check.NotNull(type, nameof(type)); + + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return GetSimplifiedName(type.GenericTypeArguments[0]) + "?"; + } + + if (type.IsGenericType) + { + var genericType = type.GetGenericTypeDefinition(); + return $"{genericType.FullName.Left(genericType.FullName.IndexOf('`'))}<{type.GenericTypeArguments.Select(GetSimplifiedName).JoinAsString(",")}>"; + } + + if (type == typeof(string)) + { + return "string"; + } + else if (type == typeof(int)) + { + return "number"; + } + else if (type == typeof(long)) + { + return "number"; + } + else if (type == typeof(bool)) + { + return "boolean"; + } + else if (type == typeof(char)) + { + return "string"; + } + else if (type == typeof(double)) + { + return "number"; + } + else if (type == typeof(float)) + { + return "number"; + } + else if (type == typeof(decimal)) + { + return "number"; + } + else if (type == typeof(DateTime)) + { + return "string"; + } + else if (type == typeof(DateTimeOffset)) + { + return "string"; + } + else if (type == typeof(TimeSpan)) + { + return "string"; + } + else if (type == typeof(Guid)) + { + return "string"; + } + else if (type == typeof(byte)) + { + return "number"; + } + else if (type == typeof(sbyte)) + { + return "number"; + } + else if (type == typeof(short)) + { + return "number"; + } + else if (type == typeof(ushort)) + { + return "number"; + } + else if (type == typeof(uint)) + { + return "number"; + } + else if (type == typeof(ulong)) + { + return "number"; + } + else if (type == typeof(IntPtr)) + { + return "number"; + } + else if (type == typeof(UIntPtr)) + { + return "number"; + } + + return type.FullName; + } + } +} diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs index e05e36aec3..c984de48de 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs @@ -9,7 +9,9 @@ namespace Volo.Abp.Http.Modeling public string Name { get; set; } - public string TypeAsString { get; set; } + public string Type { get; set; } + + public string TypeSimple { get; set; } public bool IsOptional { get; set; } @@ -30,7 +32,8 @@ namespace Volo.Abp.Http.Modeling { Name = name, NameOnMethod = nameOnMethod, - TypeAsString = type?.FullName, + Type = type != null ? ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(type) : null, + TypeSimple = type != null ? ModelingTypeHelper.GetSimplifiedName(type) : null, IsOptional = isOptional, DefaultValue = defaultValue, ConstraintTypes = constraintTypes, diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index ee39f54687..8c6ea9e678 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -8,7 +8,9 @@ namespace Volo.Abp.Http.Modeling { public string Name { get; set; } - public string TypeAsString { get; set; } + public string Type { get; set; } + + public string TypeSimple { get; set; } //TODO: Validation rules for this property public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo) @@ -16,7 +18,8 @@ namespace Volo.Abp.Http.Modeling return new PropertyApiDescriptionModel { Name = propertyInfo.Name, - TypeAsString = propertyInfo.PropertyType.FullName + Type = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(propertyInfo.PropertyType), + TypeSimple = ModelingTypeHelper.GetSimplifiedName(propertyInfo.PropertyType) }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs index 78bd5982fe..d6532be6d4 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs @@ -6,7 +6,9 @@ namespace Volo.Abp.Http.Modeling [Serializable] public class ReturnValueApiDescriptionModel { - public string TypeAsString { get; set; } + public string Type { get; set; } + + public string TypeSimple { get; set; } private ReturnValueApiDescriptionModel() { @@ -15,9 +17,12 @@ namespace Volo.Abp.Http.Modeling public static ReturnValueApiDescriptionModel Create(Type type) { + var unwrappedType = AsyncHelper.UnwrapTask(type); + return new ReturnValueApiDescriptionModel { - TypeAsString = AsyncHelper.UnwrapTask(type).FullName + Type = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(unwrappedType), + TypeSimple = ModelingTypeHelper.GetSimplifiedName(unwrappedType) }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs index 65f7a61b27..fcc4b034ea 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.Http.Modeling [Serializable] public class TypeApiDescriptionModel { - public string BaseTypeAsString { get; set; } + public string BaseType { get; set; } public bool IsEnum { get; set; } @@ -32,7 +32,7 @@ namespace Volo.Abp.Http.Modeling var typeModel = new TypeApiDescriptionModel { IsEnum = type.IsEnum, - BaseTypeAsString = baseType?.FullName + BaseType = baseType != null ? ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(baseType) : null }; if (typeModel.IsEnum) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs index 4cf80f7ed8..fd9a79c006 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery private static void AddControllerScript(StringBuilder script, ControllerApiDescriptionModel controller) { - var controllerName = GetNormalizedTypeName(controller.TypeAsString); + var controllerName = GetNormalizedTypeName(controller.Type); script.AppendLine($" // controller {controllerName}"); script.AppendLine(); @@ -125,7 +125,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery script.AppendLine(" url: abp.appPath + '" + ProxyScriptingHelper.GenerateUrlWithParameters(action) + "',"); script.Append(" type: '" + httpMethod + "'"); - if (action.ReturnValue.TypeAsString == typeof(void).FullName) + if (action.ReturnValue.Type == typeof(void).FullName) { script.AppendLine(","); script.Append(" dataType: null"); diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs index 1b89de2b3a..68ef7aee5d 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptManager.cs @@ -48,7 +48,7 @@ namespace Volo.Abp.Http.ProxyScripting private string CreateScript(ProxyScriptingModel scriptingModel) { - var apiModel = _modelProvider.CreateApiModel(); + var apiModel = _modelProvider.CreateApiModel(new ApplicationApiDescriptionModelRequestDto {IncludeTypes = false}); if (scriptingModel.IsPartialRequest()) { From d8bd4783c00f9a0cf7c14e0e06bf75ee79259ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 20 Nov 2019 16:52:34 +0300 Subject: [PATCH 03/52] Handle arrays and dictionaries for type models. --- .../Volo/Abp/Reflection/TypeHelper.cs | 8 ++++++- .../Modeling/PropertyApiDescriptionModel.cs | 24 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs index cab8c41b2c..a9f21c5a0d 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs @@ -57,8 +57,14 @@ namespace Volo.Abp.Reflection return t; } - public static bool IsEnumerable(Type type, out Type itemType) + public static bool IsEnumerable(Type type, out Type itemType, bool includePrimitives = true) { + if (!includePrimitives && IsPrimitiveExtended(type)) + { + itemType = null; + return false; + } + var enumerableTypes = ReflectionHelper.GetImplementedGenericTypes(type, typeof(IEnumerable<>)); if (enumerableTypes.Count == 1) { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index 8c6ea9e678..ca8af7f22a 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -1,5 +1,6 @@ using System; using System.Reflection; +using Volo.Abp.Reflection; namespace Volo.Abp.Http.Modeling { @@ -15,11 +16,30 @@ namespace Volo.Abp.Http.Modeling //TODO: Validation rules for this property public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo) { + string typeName; + string simpleTypeName; + + if (TypeHelper.IsEnumerable(propertyInfo.PropertyType, out var itemType, includePrimitives: false)) + { + typeName = $"[{ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(itemType)}]"; + simpleTypeName = $"[{ModelingTypeHelper.GetSimplifiedName(itemType)}]"; + } + else if (TypeHelper.IsDictionary(propertyInfo.PropertyType, out var keyType, out var valueType)) + { + typeName = $"{{{ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(keyType)}:{ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(valueType)}}}"; + simpleTypeName = $"{{{ModelingTypeHelper.GetSimplifiedName(keyType)}:{ModelingTypeHelper.GetSimplifiedName(valueType)}}}"; + } + else + { + typeName = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(propertyInfo.PropertyType); + simpleTypeName = ModelingTypeHelper.GetSimplifiedName(propertyInfo.PropertyType); + } + return new PropertyApiDescriptionModel { Name = propertyInfo.Name, - Type = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(propertyInfo.PropertyType), - TypeSimple = ModelingTypeHelper.GetSimplifiedName(propertyInfo.PropertyType) + Type = typeName, + TypeSimple = simpleTypeName }; } } From 236e489070db95fe8bbe1392dcb09c0932b9ec21 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 20 Nov 2019 17:21:14 +0300 Subject: [PATCH 04/52] feat(client-generator): add request template generator --- .../templates/angular/service-templates.ts | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/npm/packs/client-generator/src/templates/angular/service-templates.ts b/npm/packs/client-generator/src/templates/angular/service-templates.ts index 818c2186df..91e68a9a65 100644 --- a/npm/packs/client-generator/src/templates/angular/service-templates.ts +++ b/npm/packs/client-generator/src/templates/angular/service-templates.ts @@ -1,5 +1,7 @@ import changeCase from 'change-case'; import { replacer } from '../../utils/replacer'; +import { Argument } from '../../utils/generators'; +import snq from 'snq'; export namespace ServiceTemplates { export function classTemplate(name: string, content: string) { @@ -16,19 +18,24 @@ export class ${changeCase.pascalCase(name)}Service { }`; } - export function getMethodTemplate( - name: string, - url: string, - args: string = '', - params: string[] = [], - queryParams?: object, - ) { + export function getMethodTemplate(name: string, url: string, args: string = '', queryParams?: boolean) { return ` - ${changeCase.camelCase(replacer(name))}(${args}): Observable { - return this.restService.request({ - method: 'GET', - url: '/${url}${params.length ? '/' + params.join('/') : ''}', - }); + ${changeCase.camelCase(replacer(name))}(${args}${queryParams ? ', queryParams: any' : ''}): Observable { + ${requestTemplate('GET', url, false, !!queryParams)} }`; } + + export function requestTemplate(method: string, url: string, body?: boolean, queryParams?: boolean) { + const reg = /(?<=\{)(.*)(?=\})/g; + + (url.match(reg) || []).forEach(matched => { + const index = url.indexOf(`{${matched}}`); + url = url.slice(0, index) + '$' + url.slice(index); + }); + + return `return this.restService.request({ + method: '${method}', + url: \`/${url}\`,${queryParams ? 'params: queryParams,' : ''}${body ? 'body,' : ''} + });`; + } } From 3616120cd9efa5472a6b19df0009d8f3cfc491a3 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 20 Nov 2019 17:21:42 +0300 Subject: [PATCH 05/52] feat(client-generator): add parameter parser --- .../lib/dist/edition.service.d.ts | 9 + .../lib/dist/edition.service.js | 39 + .../lib/dist/tenant.service.d.ts | 9 + .../lib/dist/tenant.service.js | 39 + .../client-generator/lib/src/angular.d.ts | 2 + npm/packs/client-generator/lib/src/angular.js | 81 + npm/packs/client-generator/lib/src/cli.d.ts | 1 + npm/packs/client-generator/lib/src/cli.js | 113 + npm/packs/client-generator/lib/src/index.d.ts | 2 + npm/packs/client-generator/lib/src/index.js | 24 + .../templates/angular/service-templates.d.ts | 6 + .../templates/angular/service-templates.js | 31 + .../lib/src/types/api-defination.d.ts | 52 + .../lib/src/types/api-defination.js | 2 + .../client-generator/lib/src/utils/axios.d.ts | 1 + .../client-generator/lib/src/utils/axios.js | 2128 +++++++++++++++++ .../lib/src/utils/generators.d.ts | 9 + .../lib/src/utils/generators.js | 26 + .../lib/src/utils/prompt.d.ts | 2 + .../client-generator/lib/src/utils/prompt.js | 56 + .../lib/src/utils/replacer.d.ts | 1 + .../lib/src/utils/replacer.js | 6 + npm/packs/client-generator/package.json | 3 +- npm/packs/client-generator/src/angular.ts | 6 +- npm/packs/client-generator/src/cli.ts | 5 +- .../client-generator/src/utils/generators.ts | 19 +- npm/packs/client-generator/yarn.lock | 5 + 27 files changed, 2670 insertions(+), 7 deletions(-) create mode 100644 npm/packs/client-generator/lib/dist/edition.service.d.ts create mode 100644 npm/packs/client-generator/lib/dist/edition.service.js create mode 100644 npm/packs/client-generator/lib/dist/tenant.service.d.ts create mode 100644 npm/packs/client-generator/lib/dist/tenant.service.js create mode 100644 npm/packs/client-generator/lib/src/angular.d.ts create mode 100644 npm/packs/client-generator/lib/src/angular.js create mode 100644 npm/packs/client-generator/lib/src/cli.d.ts create mode 100644 npm/packs/client-generator/lib/src/cli.js create mode 100644 npm/packs/client-generator/lib/src/index.d.ts create mode 100644 npm/packs/client-generator/lib/src/index.js create mode 100644 npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts create mode 100644 npm/packs/client-generator/lib/src/templates/angular/service-templates.js create mode 100644 npm/packs/client-generator/lib/src/types/api-defination.d.ts create mode 100644 npm/packs/client-generator/lib/src/types/api-defination.js create mode 100644 npm/packs/client-generator/lib/src/utils/axios.d.ts create mode 100644 npm/packs/client-generator/lib/src/utils/axios.js create mode 100644 npm/packs/client-generator/lib/src/utils/generators.d.ts create mode 100644 npm/packs/client-generator/lib/src/utils/generators.js create mode 100644 npm/packs/client-generator/lib/src/utils/prompt.d.ts create mode 100644 npm/packs/client-generator/lib/src/utils/prompt.js create mode 100644 npm/packs/client-generator/lib/src/utils/replacer.d.ts create mode 100644 npm/packs/client-generator/lib/src/utils/replacer.js diff --git a/npm/packs/client-generator/lib/dist/edition.service.d.ts b/npm/packs/client-generator/lib/dist/edition.service.d.ts new file mode 100644 index 0000000000..46b04c5470 --- /dev/null +++ b/npm/packs/client-generator/lib/dist/edition.service.d.ts @@ -0,0 +1,9 @@ +import { RestService } from '@abp/ng.core'; +import { Observable } from 'rxjs'; +export declare class EditionService { + private restService; + constructor(restService: RestService); + get(id: string): Observable; + getList(): Observable; + getUsageStatistics(): Observable; +} diff --git a/npm/packs/client-generator/lib/dist/edition.service.js b/npm/packs/client-generator/lib/dist/edition.service.js new file mode 100644 index 0000000000..80e3c4c43e --- /dev/null +++ b/npm/packs/client-generator/lib/dist/edition.service.js @@ -0,0 +1,39 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var core_1 = require("@angular/core"); +var EditionService = /** @class */ (function () { + function EditionService(restService) { + this.restService = restService; + } + EditionService.prototype.get = function (id) { + return this.restService.request({ + method: 'GET', + url: "/api/saas/editions/" + id, + }); + }; + EditionService.prototype.getList = function () { + return this.restService.request({ + method: 'GET', + url: "/api/saas/editions", + }); + }; + EditionService.prototype.getUsageStatistics = function () { + return this.restService.request({ + method: 'GET', + url: "/api/saas/editions/statistics/usage-statistic", + }); + }; + EditionService = __decorate([ + core_1.Injectable({ + providedIn: 'root', + }) + ], EditionService); + return EditionService; +}()); +exports.EditionService = EditionService; diff --git a/npm/packs/client-generator/lib/dist/tenant.service.d.ts b/npm/packs/client-generator/lib/dist/tenant.service.d.ts new file mode 100644 index 0000000000..080122bbf7 --- /dev/null +++ b/npm/packs/client-generator/lib/dist/tenant.service.d.ts @@ -0,0 +1,9 @@ +import { RestService } from '@abp/ng.core'; +import { Observable } from 'rxjs'; +export declare class TenantService { + private restService; + constructor(restService: RestService); + get(id: string): Observable; + getList(): Observable; + getDefaultConnectionString(id: string): Observable; +} diff --git a/npm/packs/client-generator/lib/dist/tenant.service.js b/npm/packs/client-generator/lib/dist/tenant.service.js new file mode 100644 index 0000000000..31edbd99cd --- /dev/null +++ b/npm/packs/client-generator/lib/dist/tenant.service.js @@ -0,0 +1,39 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var core_1 = require("@angular/core"); +var TenantService = /** @class */ (function () { + function TenantService(restService) { + this.restService = restService; + } + TenantService.prototype.get = function (id) { + return this.restService.request({ + method: 'GET', + url: "/api/saas/tenants/" + id, + }); + }; + TenantService.prototype.getList = function () { + return this.restService.request({ + method: 'GET', + url: "/api/saas/tenants", + }); + }; + TenantService.prototype.getDefaultConnectionString = function (id) { + return this.restService.request({ + method: 'GET', + url: "/api/saas/tenants/" + id + "/default-connection-string", + }); + }; + TenantService = __decorate([ + core_1.Injectable({ + providedIn: 'root', + }) + ], TenantService); + return TenantService; +}()); +exports.TenantService = TenantService; diff --git a/npm/packs/client-generator/lib/src/angular.d.ts b/npm/packs/client-generator/lib/src/angular.d.ts new file mode 100644 index 0000000000..e49d42ec6a --- /dev/null +++ b/npm/packs/client-generator/lib/src/angular.d.ts @@ -0,0 +1,2 @@ +import { APIDefination } from './types/api-defination'; +export declare function angular(data: APIDefination.Response, selectedModules: string[]): Promise; diff --git a/npm/packs/client-generator/lib/src/angular.js b/npm/packs/client-generator/lib/src/angular.js new file mode 100644 index 0000000000..ceff31fd14 --- /dev/null +++ b/npm/packs/client-generator/lib/src/angular.js @@ -0,0 +1,81 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var service_templates_1 = require("./templates/angular/service-templates"); +var change_case_1 = __importDefault(require("change-case")); +var fs_extra_1 = __importDefault(require("fs-extra")); +var generators_1 = require("./utils/generators"); +function angular(data, selectedModules) { + return __awaiter(this, void 0, void 0, function () { + var _this = this; + return __generator(this, function (_a) { + selectedModules.forEach(function (module) { return __awaiter(_this, void 0, void 0, function () { + var element; + return __generator(this, function (_a) { + element = data.modules[module]; + (Object.keys(element.controllers) || []).forEach(function (key) { + var controller = element.controllers[key]; + var actions = element.controllers[key].actions; + var actionKeys = Object.keys(actions); + var contents = []; + actionKeys.forEach(function (key) { + var element = actions[key]; + console.log(element); + var parameters = generators_1.parseParameters(element.parameters); + switch (element.httpMethod) { + case 'GET': + contents.push(service_templates_1.ServiceTemplates.getMethodTemplate(element.name, element.url, generators_1.generateArgs(parameters), parameters)); + break; + default: + break; + } + }); + var service = service_templates_1.ServiceTemplates.classTemplate(controller.controllerName, contents.join('\n')); + fs_extra_1.default.writeFileSync("dist/" + change_case_1.default.kebabCase(controller.controllerName) + ".service.ts", service); + }); + return [2 /*return*/]; + }); + }); }); + return [2 /*return*/]; + }); + }); +} +exports.angular = angular; diff --git a/npm/packs/client-generator/lib/src/cli.d.ts b/npm/packs/client-generator/lib/src/cli.d.ts new file mode 100644 index 0000000000..21620dda81 --- /dev/null +++ b/npm/packs/client-generator/lib/src/cli.d.ts @@ -0,0 +1 @@ +export declare function cli(program: any): Promise; diff --git a/npm/packs/client-generator/lib/src/cli.js b/npm/packs/client-generator/lib/src/cli.js new file mode 100644 index 0000000000..ca0381e84a --- /dev/null +++ b/npm/packs/client-generator/lib/src/cli.js @@ -0,0 +1,113 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var prompt_1 = require("./utils/prompt"); +var axios_1 = require("./utils/axios"); +var ora = require("ora"); +var angular_1 = require("./angular"); +var chalk_1 = __importDefault(require("chalk")); +function cli(program) { + return __awaiter(this, void 0, void 0, function () { + var _a, loading, data, apiUrl, error_1, selection, modules, _b; + var _this = this; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + if (!(program.ui !== 'angular')) return [3 /*break*/, 2]; + _a = program; + return [4 /*yield*/, prompt_1.uiSelection(['Angular'])]; + case 1: + _a.ui = (_c.sent()).toLowerCase(); + _c.label = 2; + case 2: + loading = ora('Waiting for the API response... \n'); + loading.start(); + data = {}; + apiUrl = 'https://localhost:44305/api/abp/api-definition'; + _c.label = 3; + case 3: + _c.trys.push([3, 5, , 6]); + return [4 /*yield*/, axios_1.axiosInstance.get(apiUrl)]; + case 4: + data = (_c.sent()).data; + return [3 /*break*/, 6]; + case 5: + error_1 = _c.sent(); + console.log(chalk_1.default.red('An error occurred when fetching the ' + apiUrl)); + process.exit(1); + return [3 /*break*/, 6]; + case 6: + console.log(data); + loading.stop(); + selection = function (modules) { return __awaiter(_this, void 0, void 0, function () { + var selectedModules; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, prompt_1.moduleSelection(modules)]; + case 1: + selectedModules = (_a.sent()); + if (!!selectedModules.length) return [3 /*break*/, 3]; + console.log(chalk_1.default.red('Please select module(s)')); + return [4 /*yield*/, selection(modules)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: return [2 /*return*/, selectedModules]; + } + }); + }); }; + modules = ['saas']; + _b = program.ui; + switch (_b) { + case 'angular': return [3 /*break*/, 7]; + } + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, angular_1.angular(data, modules)]; + case 8: + _c.sent(); + return [3 /*break*/, 10]; + case 9: + process.exit(1); + _c.label = 10; + case 10: return [2 /*return*/]; + } + }); + }); +} +exports.cli = cli; diff --git a/npm/packs/client-generator/lib/src/index.d.ts b/npm/packs/client-generator/lib/src/index.d.ts new file mode 100644 index 0000000000..b7988016da --- /dev/null +++ b/npm/packs/client-generator/lib/src/index.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/npm/packs/client-generator/lib/src/index.js b/npm/packs/client-generator/lib/src/index.js new file mode 100644 index 0000000000..a65786ccf2 --- /dev/null +++ b/npm/packs/client-generator/lib/src/index.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var chalk_1 = __importDefault(require("chalk")); +var commander_1 = __importDefault(require("commander")); +var cli_1 = require("./cli"); +var clear = require('clear'); +var figlet = require('figlet'); +clear(); +console.log(chalk_1.default.red(figlet.textSync('ABP', { horizontalLayout: 'full' }))); +commander_1.default + .version('0.0.1') + .description('ABP Client Generator') + .option('-u, --ui ', 'UI option (Angular)') + .parse(process.argv); +if (!process.argv.slice(2).length || !commander_1.default.ui || typeof commander_1.default.ui !== 'string') { + commander_1.default.outputHelp(); + process.exit(1); +} +commander_1.default.ui = commander_1.default.ui.toLowerCase(); +cli_1.cli(commander_1.default); diff --git a/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts b/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts new file mode 100644 index 0000000000..06ffd82595 --- /dev/null +++ b/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts @@ -0,0 +1,6 @@ +import { Argument } from '../../utils/generators'; +export declare namespace ServiceTemplates { + function classTemplate(name: string, content: string): string; + function getMethodTemplate(name: string, url: string, args?: string, params?: Argument[], queryParams?: object): string; + function requestTemplate(method: string, url: string, params?: Argument[], body?: boolean, queryParams?: boolean): string; +} diff --git a/npm/packs/client-generator/lib/src/templates/angular/service-templates.js b/npm/packs/client-generator/lib/src/templates/angular/service-templates.js new file mode 100644 index 0000000000..fb3e0bd6e5 --- /dev/null +++ b/npm/packs/client-generator/lib/src/templates/angular/service-templates.js @@ -0,0 +1,31 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var change_case_1 = __importDefault(require("change-case")); +var replacer_1 = require("../../utils/replacer"); +var ServiceTemplates; +(function (ServiceTemplates) { + function classTemplate(name, content) { + return "import { RestService } from '@abp/ng.core';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class " + change_case_1.default.pascalCase(name) + "Service {\n constructor(private restService: RestService) {}\n " + content + "\n}"; + } + ServiceTemplates.classTemplate = classTemplate; + function getMethodTemplate(name, url, args, params, queryParams) { + if (args === void 0) { args = ''; } + if (params === void 0) { params = []; } + return "\n " + change_case_1.default.camelCase(replacer_1.replacer(name)) + "(" + args + "): Observable {\n " + requestTemplate('GET', url, params, false, !!queryParams) + "\n }"; + } + ServiceTemplates.getMethodTemplate = getMethodTemplate; + function requestTemplate(method, url, params, body, queryParams) { + if (params === void 0) { params = []; } + params.forEach(function (param) { + var index = url.indexOf("{" + param.key + "}"); + if (index > -1) { + url = url.slice(0, index) + '$' + url.slice(index); + } + }); + return "return this.restService.request({\n method: '" + method + "',\n url: `/" + url + "`," + (queryParams ? 'params: queryParams,' : '') + (body ? 'body,' : '') + "\n });"; + } + ServiceTemplates.requestTemplate = requestTemplate; +})(ServiceTemplates = exports.ServiceTemplates || (exports.ServiceTemplates = {})); diff --git a/npm/packs/client-generator/lib/src/types/api-defination.d.ts b/npm/packs/client-generator/lib/src/types/api-defination.d.ts new file mode 100644 index 0000000000..9806a1011b --- /dev/null +++ b/npm/packs/client-generator/lib/src/types/api-defination.d.ts @@ -0,0 +1,52 @@ +export declare namespace APIDefination { + interface Response { + modules: Modules; + } + interface Modules { + [key: string]: Module; + } + interface Module { + rootPath: string; + controllers: { + [key: string]: Controller; + }; + } + interface Controller { + controllerName: string; + interfaces: { + typeAsString: string; + }[]; + typeAsString: string; + actions: { + [key: string]: Action; + }; + } + interface Action { + uniqueName: string; + name: string; + httpMethod: string; + url: string; + supportedVersions: any[]; + parametersOnMethod: ParametersOnMethod[]; + parameters: Parameter[]; + returnValue: ReturnValue; + } + interface Parameter { + nameOnMethod: string; + name: string; + typeAsString: string; + isOptional: boolean; + defaultValue: null; + constraintTypes: null; + bindingSourceId: string; + } + interface ParametersOnMethod { + name: string; + typeAsString: string; + isOptional: boolean; + defaultValue: null; + } + interface ReturnValue { + typeAsString: string; + } +} diff --git a/npm/packs/client-generator/lib/src/types/api-defination.js b/npm/packs/client-generator/lib/src/types/api-defination.js new file mode 100644 index 0000000000..c8ad2e549b --- /dev/null +++ b/npm/packs/client-generator/lib/src/types/api-defination.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/npm/packs/client-generator/lib/src/utils/axios.d.ts b/npm/packs/client-generator/lib/src/utils/axios.d.ts new file mode 100644 index 0000000000..205420f0e2 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/axios.d.ts @@ -0,0 +1 @@ +export declare const axiosInstance: import("axios").AxiosInstance; diff --git a/npm/packs/client-generator/lib/src/utils/axios.js b/npm/packs/client-generator/lib/src/utils/axios.js new file mode 100644 index 0000000000..cd25695c85 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/axios.js @@ -0,0 +1,2128 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var axios_1 = __importDefault(require("axios")); +var https = require("https"); +var httpsAgent = new https.Agent({ + rejectUnauthorized: false, +}); +exports.axiosInstance = axios_1.default.create({ httpsAgent: httpsAgent }); +exports.axiosInstance.interceptors.request.use(function (config) { + if (config.method !== 'OPTIONS') { + if (!config.headers['content-type']) { + config.headers['accept'] = 'application/json'; + } + } + return config; +}, function (error) { + // Do something with request error + return Promise.reject(error); +}); +// axiosInstance.get = (...ar) => new Promise(resolve => { +// setTimeout(() => { +// resolve({ +// "modules": { +// "Account": { +// "rootPath": "Account", +// "controllers": { +// "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController": { +// "controllerName": "Account", +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController, Volo.Abp.Account.Web", +// "interfaces": [], +// "actions": { +// "LoginByLogin": { +// "uniqueName": "LoginByLogin", +// "name": "Login", +// "httpMethod": "POST", +// "url": "api/account/login", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "login", +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "login", +// "name": "login", +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult, Volo.Abp.Account.Web" +// } +// }, +// "CheckPasswordByLogin": { +// "uniqueName": "CheckPasswordByLogin", +// "name": "CheckPassword", +// "httpMethod": "POST", +// "url": "api/account/checkPassword", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "login", +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "login", +// "name": "login", +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult, Volo.Abp.Account.Web" +// } +// } +// } +// } +// } +// }, +// "app": { +// "rootPath": "app", +// "controllers": { +// "Acme.AngSecTest.Controllers.TestController": { +// "controllerName": "Test", +// "typeAsString": "Acme.AngSecTest.Controllers.TestController, Acme.AngSecTest.HttpApi", +// "interfaces": [], +// "actions": { +// "GetAsync": { +// "uniqueName": "GetAsync", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/test", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "System.Collections.Generic.List`1[[Acme.AngSecTest.Models.Test.TestModel, Acme.AngSecTest.HttpApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib" +// } +// } +// } +// }, +// "Acme.AngSecTest.Controllers.Automobiles.carController": { +// "controllerName": "car", +// "typeAsString": "Acme.AngSecTest.Controllers.Automobiles.carController, Acme.AngSecTest.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Acme.AngSecTest.Automobiles.IcarAppService, Acme.AngSecTest.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsyncById": { +// "uniqueName": "GetAsyncById", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// }, +// "GetListAsyncByInput": { +// "uniqueName": "GetListAsyncByInput", +// "name": "GetListAsync", +// "httpMethod": "GET", +// "url": "api/car", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.GetcarsInput, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "FilterText", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Name", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "YearMin", +// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "YearMax", +// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "ProductionDateMin", +// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "ProductionDateMax", +// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "IsStillGoing", +// "typeAsString": "System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Sorting", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "SkipCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "MaxResultCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "CreateAsyncByInput": { +// "uniqueName": "CreateAsyncByInput", +// "name": "CreateAsync", +// "httpMethod": "POST", +// "url": "api/car", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// }, +// "UpdateAsyncByIdAndInput": { +// "uniqueName": "UpdateAsyncByIdAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// }, +// "DeleteAsyncById": { +// "uniqueName": "DeleteAsyncById", +// "name": "DeleteAsync", +// "httpMethod": "DELETE", +// "url": "api/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// }, +// "Acme.AngSecTest.AppServices.Automobiles.carAppService": { +// "controllerName": "car", +// "typeAsString": "Acme.AngSecTest.AppServices.Automobiles.carAppService, Acme.AngSecTest.Application", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Validation.IValidationEnabled, Volo.Abp.Validation" +// }, +// { +// "typeAsString": "Volo.Abp.Auditing.IAuditingEnabled, Volo.Abp.Auditing" +// }, +// { +// "typeAsString": "Acme.AngSecTest.Automobiles.IcarAppService, Acme.AngSecTest.Application.Contracts" +// } +// ], +// "actions": { +// "GetListAsyncByInput": { +// "uniqueName": "GetListAsyncByInput", +// "name": "GetListAsync", +// "httpMethod": "GET", +// "url": "api/app/car", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.GetcarsInput, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "FilterText", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Name", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "YearMin", +// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "YearMax", +// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "ProductionDateMin", +// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "ProductionDateMax", +// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "IsStillGoing", +// "typeAsString": "System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Sorting", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "SkipCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "MaxResultCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "GetAsyncById": { +// "uniqueName": "GetAsyncById", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/app/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// }, +// "DeleteAsyncById": { +// "uniqueName": "DeleteAsyncById", +// "name": "DeleteAsync", +// "httpMethod": "DELETE", +// "url": "api/app/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// }, +// "CreateAsyncByInput": { +// "uniqueName": "CreateAsyncByInput", +// "name": "CreateAsync", +// "httpMethod": "POST", +// "url": "api/app/car", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// }, +// "UpdateAsyncByIdAndInput": { +// "uniqueName": "UpdateAsyncByIdAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/app/car/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" +// } +// } +// } +// }, +// "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { +// "controllerName": "AbpApplicationConfiguration", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController, Volo.Abp.AspNetCore.Mvc", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService, Volo.Abp.AspNetCore.Mvc.Contracts" +// } +// ], +// "actions": { +// "GetAsync": { +// "uniqueName": "GetAsync", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/abp/application-configuration", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto, Volo.Abp.AspNetCore.Mvc.Contracts" +// } +// } +// } +// }, +// "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { +// "controllerName": "AbpApiDefinition", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController, Volo.Abp.AspNetCore.Mvc", +// "interfaces": [], +// "actions": { +// "Get": { +// "uniqueName": "Get", +// "name": "Get", +// "httpMethod": "GET", +// "url": "api/abp/api-definition", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, Volo.Abp.Http" +// } +// } +// } +// }, +// "Pages.Abp.MultiTenancy.AbpTenantController": { +// "controllerName": "AbpTenant", +// "typeAsString": "Pages.Abp.MultiTenancy.AbpTenantController, Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService, Volo.Abp.AspNetCore.Mvc.Contracts" +// } +// ], +// "actions": { +// "FindTenantByNameAsyncByName": { +// "uniqueName": "FindTenantByNameAsyncByName", +// "name": "FindTenantByNameAsync", +// "httpMethod": "GET", +// "url": "api/abp/multi-tenancy/find-tenant/{name}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "name", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "name", +// "name": "name", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto, Volo.Abp.AspNetCore.Mvc.Contracts" +// } +// }, +// "FindTenantByIdAsyncById": { +// "uniqueName": "FindTenantByIdAsyncById", +// "name": "FindTenantByIdAsync", +// "httpMethod": "GET", +// "url": "api/abp/multi-tenancy/tenants/by-id/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto, Volo.Abp.AspNetCore.Mvc.Contracts" +// } +// } +// } +// } +// } +// }, +// "account": { +// "rootPath": "account", +// "controllers": { +// "Volo.Abp.Account.AccountController": { +// "controllerName": "Account", +// "typeAsString": "Volo.Abp.Account.AccountController, Volo.Abp.Account.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Account.IAccountAppService, Volo.Abp.Account.Application.Contracts" +// } +// ], +// "actions": { +// "RegisterAsyncByInput": { +// "uniqueName": "RegisterAsyncByInput", +// "name": "RegisterAsync", +// "httpMethod": "POST", +// "url": "api/account/register", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// } +// } +// } +// } +// }, +// "abp": { +// "rootPath": "abp", +// "controllers": { +// "Volo.Abp.FeatureManagement.FeaturesController": { +// "controllerName": "Features", +// "typeAsString": "Volo.Abp.FeatureManagement.FeaturesController, Volo.Abp.FeatureManagement.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.FeatureManagement.IFeatureAppService, Volo.Abp.FeatureManagement.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsyncByProviderNameAndProviderKey": { +// "uniqueName": "GetAsyncByProviderNameAndProviderKey", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/abp/features", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "providerName", +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "providerKey", +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.FeatureManagement.FeatureListDto, Volo.Abp.FeatureManagement.Application.Contracts" +// } +// }, +// "UpdateAsyncByProviderNameAndProviderKeyAndInput": { +// "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/abp/features", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "providerName", +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "providerKey", +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// }, +// "Volo.Abp.PermissionManagement.PermissionsController": { +// "controllerName": "Permissions", +// "typeAsString": "Volo.Abp.PermissionManagement.PermissionsController, Volo.Abp.PermissionManagement.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.PermissionManagement.IPermissionAppService, Volo.Abp.PermissionManagement.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsyncByProviderNameAndProviderKey": { +// "uniqueName": "GetAsyncByProviderNameAndProviderKey", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/abp/permissions", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "providerName", +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "providerKey", +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.PermissionManagement.GetPermissionListResultDto, Volo.Abp.PermissionManagement.Application.Contracts" +// } +// }, +// "UpdateAsyncByProviderNameAndProviderKeyAndInput": { +// "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/abp/permissions", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "providerName", +// "name": "providerName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "providerKey", +// "name": "providerKey", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// } +// } +// }, +// "multi-tenancy": { +// "rootPath": "multi-tenancy", +// "controllers": { +// "Volo.Abp.TenantManagement.TenantController": { +// "controllerName": "Tenant", +// "typeAsString": "Volo.Abp.TenantManagement.TenantController, Volo.Abp.TenantManagement.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.TenantManagement.ITenantAppService, Volo.Abp.TenantManagement.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsyncById": { +// "uniqueName": "GetAsyncById", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/multi-tenancy/tenants/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" +// } +// }, +// "GetListAsyncByInput": { +// "uniqueName": "GetListAsyncByInput", +// "name": "GetListAsync", +// "httpMethod": "GET", +// "url": "api/multi-tenancy/tenants", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.TenantManagement.GetTenantsInput, Volo.Abp.TenantManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "Filter", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Sorting", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "SkipCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "MaxResultCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "CreateAsyncByInput": { +// "uniqueName": "CreateAsyncByInput", +// "name": "CreateAsync", +// "httpMethod": "POST", +// "url": "api/multi-tenancy/tenants", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" +// } +// }, +// "UpdateAsyncByIdAndInput": { +// "uniqueName": "UpdateAsyncByIdAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/multi-tenancy/tenants/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" +// } +// }, +// "DeleteAsyncById": { +// "uniqueName": "DeleteAsyncById", +// "name": "DeleteAsync", +// "httpMethod": "DELETE", +// "url": "api/multi-tenancy/tenants/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// }, +// "GetDefaultConnectionStringAsyncById": { +// "uniqueName": "GetDefaultConnectionStringAsyncById", +// "name": "GetDefaultConnectionStringAsync", +// "httpMethod": "GET", +// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.String, System.Private.CoreLib" +// } +// }, +// "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString": { +// "uniqueName": "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString", +// "name": "UpdateDefaultConnectionStringAsync", +// "httpMethod": "PUT", +// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "defaultConnectionString", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "defaultConnectionString", +// "name": "defaultConnectionString", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// }, +// "DeleteDefaultConnectionStringAsyncById": { +// "uniqueName": "DeleteDefaultConnectionStringAsyncById", +// "name": "DeleteDefaultConnectionStringAsync", +// "httpMethod": "DELETE", +// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// } +// } +// }, +// "identity": { +// "rootPath": "identity", +// "controllers": { +// "Volo.Abp.Identity.IdentityRoleController": { +// "controllerName": "IdentityRole", +// "typeAsString": "Volo.Abp.Identity.IdentityRoleController, Volo.Abp.Identity.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Identity.IIdentityRoleAppService, Volo.Abp.Identity.Application.Contracts" +// } +// ], +// "actions": { +// "GetListAsync": { +// "uniqueName": "GetListAsync", +// "name": "GetListAsync", +// "httpMethod": "GET", +// "url": "api/identity/roles", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.ListResultDto`1[[Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "GetAsyncById": { +// "uniqueName": "GetAsyncById", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/identity/roles/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "CreateAsyncByInput": { +// "uniqueName": "CreateAsyncByInput", +// "name": "CreateAsync", +// "httpMethod": "POST", +// "url": "api/identity/roles", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityRoleCreateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityRoleCreateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "UpdateAsyncByIdAndInput": { +// "uniqueName": "UpdateAsyncByIdAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/identity/roles/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityRoleUpdateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityRoleUpdateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "DeleteAsyncById": { +// "uniqueName": "DeleteAsyncById", +// "name": "DeleteAsync", +// "httpMethod": "DELETE", +// "url": "api/identity/roles/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// }, +// "Volo.Abp.Identity.IdentityUserController": { +// "controllerName": "IdentityUser", +// "typeAsString": "Volo.Abp.Identity.IdentityUserController, Volo.Abp.Identity.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Identity.IIdentityUserAppService, Volo.Abp.Identity.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsyncById": { +// "uniqueName": "GetAsyncById", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "GetListAsyncByInput": { +// "uniqueName": "GetListAsyncByInput", +// "name": "GetListAsync", +// "httpMethod": "GET", +// "url": "api/identity/users", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.GetIdentityUsersInput, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "Filter", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "Sorting", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "SkipCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "input", +// "name": "MaxResultCount", +// "typeAsString": "System.Int32, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "CreateAsyncByInput": { +// "uniqueName": "CreateAsyncByInput", +// "name": "CreateAsync", +// "httpMethod": "POST", +// "url": "api/identity/users", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserCreateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserCreateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "UpdateAsyncByIdAndInput": { +// "uniqueName": "UpdateAsyncByIdAndInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/identity/users/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "DeleteAsyncById": { +// "uniqueName": "DeleteAsyncById", +// "name": "DeleteAsync", +// "httpMethod": "DELETE", +// "url": "api/identity/users/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// }, +// "GetRolesAsyncById": { +// "uniqueName": "GetRolesAsyncById", +// "name": "GetRolesAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/{id}/roles", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Application.Dtos.ListResultDto`1[[Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" +// } +// }, +// "UpdateRolesAsyncByIdAndInput": { +// "uniqueName": "UpdateRolesAsyncByIdAndInput", +// "name": "UpdateRolesAsync", +// "httpMethod": "PUT", +// "url": "api/identity/users/{id}/roles", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateRolesDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// }, +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateRolesDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// }, +// "FindByUsernameAsyncByUsername": { +// "uniqueName": "FindByUsernameAsyncByUsername", +// "name": "FindByUsernameAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/by-username/{userName}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "username", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "username", +// "name": "username", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "FindByEmailAsyncByEmail": { +// "uniqueName": "FindByEmailAsyncByEmail", +// "name": "FindByEmailAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/by-email/{email}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "email", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "email", +// "name": "email", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" +// } +// } +// } +// }, +// "Volo.Abp.Identity.IdentityUserLookupController": { +// "controllerName": "IdentityUserLookup", +// "typeAsString": "Volo.Abp.Identity.IdentityUserLookupController, Volo.Abp.Identity.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Identity.IIdentityUserLookupAppService, Volo.Abp.Identity.Application.Contracts" +// } +// ], +// "actions": { +// "FindByIdAsyncById": { +// "uniqueName": "FindByIdAsyncById", +// "name": "FindByIdAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/lookup/{id}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "id", +// "name": "id", +// "typeAsString": "System.Guid, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Users.UserData, Volo.Abp.Users.Abstractions" +// } +// }, +// "FindByUserNameAsyncByUserName": { +// "uniqueName": "FindByUserNameAsyncByUserName", +// "name": "FindByUserNameAsync", +// "httpMethod": "GET", +// "url": "api/identity/users/lookup/by-username/{userName}", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "userName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "userName", +// "name": "userName", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": [], +// "bindingSourceId": "Path" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Users.UserData, Volo.Abp.Users.Abstractions" +// } +// } +// } +// }, +// "Volo.Abp.Identity.ProfileController": { +// "controllerName": "Profile", +// "typeAsString": "Volo.Abp.Identity.ProfileController, Volo.Abp.Identity.HttpApi", +// "interfaces": [ +// { +// "typeAsString": "Volo.Abp.Identity.IProfileAppService, Volo.Abp.Identity.Application.Contracts" +// } +// ], +// "actions": { +// "GetAsync": { +// "uniqueName": "GetAsync", +// "name": "GetAsync", +// "httpMethod": "GET", +// "url": "api/identity/my-profile", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.ProfileDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "UpdateAsyncByInput": { +// "uniqueName": "UpdateAsyncByInput", +// "name": "UpdateAsync", +// "httpMethod": "PUT", +// "url": "api/identity/my-profile", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "Volo.Abp.Identity.ProfileDto, Volo.Abp.Identity.Application.Contracts" +// } +// }, +// "ChangePasswordAsyncByInput": { +// "uniqueName": "ChangePasswordAsyncByInput", +// "name": "ChangePasswordAsync", +// "httpMethod": "POST", +// "url": "api/identity/my-profile/change-password", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "input", +// "name": "input", +// "typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "Body" +// } +// ], +// "returnValue": { +// "typeAsString": "System.Void, System.Private.CoreLib" +// } +// } +// } +// } +// } +// }, +// "Abp": { +// "rootPath": "Abp", +// "controllers": { +// "Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController": { +// "controllerName": "AbpServiceProxyScript", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController, Volo.Abp.AspNetCore.Mvc", +// "interfaces": [], +// "actions": { +// "GetAllByModel": { +// "uniqueName": "GetAllByModel", +// "name": "GetAll", +// "httpMethod": "GET", +// "url": "Abp/ServiceProxyScript", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "model", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ProxyScripting.ServiceProxyGenerationModel, Volo.Abp.AspNetCore.Mvc", +// "isOptional": false, +// "defaultValue": null +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "model", +// "name": "Type", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "model", +// "name": "UseCache", +// "typeAsString": "System.Boolean, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "model", +// "name": "Modules", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "model", +// "name": "Controllers", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "model", +// "name": "Actions", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "System.String, System.Private.CoreLib" +// } +// } +// } +// }, +// "Volo.Abp.AspNetCore.Mvc.Localization.AbpLanguagesController": { +// "controllerName": "AbpLanguages", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.Localization.AbpLanguagesController, Volo.Abp.AspNetCore.Mvc", +// "interfaces": [], +// "actions": { +// "SwitchByCultureAndUiCultureAndReturnUrl": { +// "uniqueName": "SwitchByCultureAndUiCultureAndReturnUrl", +// "name": "Switch", +// "httpMethod": "GET", +// "url": "Abp/Languages/Switch", +// "supportedVersions": [], +// "parametersOnMethod": [ +// { +// "name": "culture", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null +// }, +// { +// "name": "uiCulture", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": true, +// "defaultValue": "" +// }, +// { +// "name": "returnUrl", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": true, +// "defaultValue": "" +// } +// ], +// "parameters": [ +// { +// "nameOnMethod": "culture", +// "name": "culture", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "uiCulture", +// "name": "uiCulture", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// }, +// { +// "nameOnMethod": "returnUrl", +// "name": "returnUrl", +// "typeAsString": "System.String, System.Private.CoreLib", +// "isOptional": false, +// "defaultValue": null, +// "constraintTypes": null, +// "bindingSourceId": "ModelBinding" +// } +// ], +// "returnValue": { +// "typeAsString": "Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Abstractions" +// } +// } +// } +// }, +// "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController": { +// "controllerName": "AbpApplicationConfigurationScript", +// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController, Volo.Abp.AspNetCore.Mvc", +// "interfaces": [], +// "actions": { +// "Get": { +// "uniqueName": "Get", +// "name": "Get", +// "httpMethod": "GET", +// "url": "Abp/ApplicationConfigurationScript", +// "supportedVersions": [], +// "parametersOnMethod": [], +// "parameters": [], +// "returnValue": { +// "typeAsString": "System.String, System.Private.CoreLib" +// } +// } +// } +// } +// } +// } +// } +// } as any) +// }, 0); +// }) diff --git a/npm/packs/client-generator/lib/src/utils/generators.d.ts b/npm/packs/client-generator/lib/src/utils/generators.d.ts new file mode 100644 index 0000000000..c7683c551a --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/generators.d.ts @@ -0,0 +1,9 @@ +import { APIDefination } from '../types/api-defination'; +export interface Argument { + key: string; + type: string; + isOptional?: boolean; +} +export declare function generateArgs(args: Argument[]): string; +export declare function parseParameters(parameters: APIDefination.Parameter[]): Argument[]; +export declare function findType(typeAsString: string): string; diff --git a/npm/packs/client-generator/lib/src/utils/generators.js b/npm/packs/client-generator/lib/src/utils/generators.js new file mode 100644 index 0000000000..265da85f6c --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/generators.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function generateArgs(args) { + return args.reduce(function (acc, val) { + var arg = "" + val.key + (val.isOptional ? '?' : '') + ": " + val.type; + if (acc) + return acc + ", " + arg; + else + return arg; + }, ''); +} +exports.generateArgs = generateArgs; +function parseParameters(parameters) { + return parameters + .filter(function (param) { return param.bindingSourceId === 'Path'; }) + .map(function (param) { + return { key: param.name, type: findType(param.typeAsString), isOptional: param.isOptional }; + }); +} +exports.parseParameters = parseParameters; +function findType(typeAsString) { + if (typeAsString.indexOf('Guid') > -1) + return 'string'; + return 'any'; +} +exports.findType = findType; diff --git a/npm/packs/client-generator/lib/src/utils/prompt.d.ts b/npm/packs/client-generator/lib/src/utils/prompt.d.ts new file mode 100644 index 0000000000..0cde4f1437 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/prompt.d.ts @@ -0,0 +1,2 @@ +export declare const uiSelection: (uiArray: string[]) => Promise; +export declare const moduleSelection: (modules: string[]) => Promise; diff --git a/npm/packs/client-generator/lib/src/utils/prompt.js b/npm/packs/client-generator/lib/src/utils/prompt.js new file mode 100644 index 0000000000..943edd5255 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/prompt.js @@ -0,0 +1,56 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var inquirer_1 = __importDefault(require("inquirer")); +exports.uiSelection = function (uiArray) { return __awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, inquirer_1.default + .prompt({ type: 'list', name: 'Please select an UI', choices: uiArray }) + .then(function (res) { return res['Please select an UI']; })]; + }); +}); }; +exports.moduleSelection = function (modules) { return __awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, inquirer_1.default + .prompt({ type: 'checkbox', name: 'Please select module(s)', choices: modules }) + .then(function (res) { return res['Please select module(s)']; })]; + }); +}); }; diff --git a/npm/packs/client-generator/lib/src/utils/replacer.d.ts b/npm/packs/client-generator/lib/src/utils/replacer.d.ts new file mode 100644 index 0000000000..b313838517 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/replacer.d.ts @@ -0,0 +1 @@ +export declare function replacer(text: string): string; diff --git a/npm/packs/client-generator/lib/src/utils/replacer.js b/npm/packs/client-generator/lib/src/utils/replacer.js new file mode 100644 index 0000000000..2f72a88387 --- /dev/null +++ b/npm/packs/client-generator/lib/src/utils/replacer.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function replacer(text) { + return text.replace(/Async/, ''); +} +exports.replacer = replacer; diff --git a/npm/packs/client-generator/package.json b/npm/packs/client-generator/package.json index 1caf2b449d..17b3ba52ba 100644 --- a/npm/packs/client-generator/package.json +++ b/npm/packs/client-generator/package.json @@ -26,7 +26,8 @@ "fs-extra": "^8.1.0", "inquirer": "^7.0.0", "ora": "^4.0.3", - "path": "^0.12.7" + "path": "^0.12.7", + "snq": "^1.0.3" }, "devDependencies": { "@types/fs-extra": "^8.0.1", diff --git a/npm/packs/client-generator/src/angular.ts b/npm/packs/client-generator/src/angular.ts index b2a8d61b48..0abcd3e195 100644 --- a/npm/packs/client-generator/src/angular.ts +++ b/npm/packs/client-generator/src/angular.ts @@ -1,7 +1,8 @@ import { APIDefination } from './types/api-defination'; import { ServiceTemplates } from './templates/angular/service-templates'; -import changeCase from 'change-case'; +import changeCase, { param } from 'change-case'; import fse from 'fs-extra'; +import { generateArgs, parseParameters } from './utils/generators'; export async function angular(data: APIDefination.Response, selectedModules: string[]) { selectedModules.forEach(async module => { @@ -18,9 +19,10 @@ export async function angular(data: APIDefination.Response, selectedModules: str const element = actions[key]; console.log(element); + const parameters = parseParameters(element.parameters); switch (element.httpMethod) { case 'GET': - contents.push(ServiceTemplates.getMethodTemplate(element.name, element.url)); + contents.push(ServiceTemplates.getMethodTemplate(element.name, element.url, generateArgs(parameters))); break; default: diff --git a/npm/packs/client-generator/src/cli.ts b/npm/packs/client-generator/src/cli.ts index 5b93e134d1..7291c9f0af 100644 --- a/npm/packs/client-generator/src/cli.ts +++ b/npm/packs/client-generator/src/cli.ts @@ -12,10 +12,11 @@ export async function cli(program: any) { const loading = ora('Waiting for the API response... \n'); loading.start(); let data = {} as APIDefination.Response; + const apiUrl = 'https://localhost:44305/api/abp/api-definition'; try { - data = (await axiosInstance.get('https://localhost:44305/api/abp/api-definition')).data; + data = (await axiosInstance.get(apiUrl)).data; } catch (error) { - console.error(error); + console.log(chalk.red('An error occurred when fetching the ' + apiUrl)); process.exit(1); } console.log(data); diff --git a/npm/packs/client-generator/src/utils/generators.ts b/npm/packs/client-generator/src/utils/generators.ts index 9d1c172f1e..1f6557fba1 100644 --- a/npm/packs/client-generator/src/utils/generators.ts +++ b/npm/packs/client-generator/src/utils/generators.ts @@ -1,13 +1,28 @@ -export interface GenerateArgsParam { +import { APIDefination } from '../types/api-defination'; + +export interface Argument { key: string; type: string; isOptional?: boolean; } -export function generateArgs(args: GenerateArgsParam[]): string { +export function generateArgs(args: Argument[]): string { return args.reduce((acc, val) => { const arg = `${val.key}${val.isOptional ? '?' : ''}: ${val.type}`; if (acc) return `${acc}, ${arg}`; else return arg; }, ''); } + +export function parseParameters(parameters: APIDefination.Parameter[]): Argument[] { + return parameters + .filter(param => param.bindingSourceId === 'Path') + .map(param => { + return { key: param.name, type: findType(param.typeAsString), isOptional: param.isOptional }; + }); +} + +export function findType(typeAsString: string): string { + if (typeAsString.indexOf('Guid') > -1) return 'string'; + return 'any'; +} diff --git a/npm/packs/client-generator/yarn.lock b/npm/packs/client-generator/yarn.lock index 020da8e630..9cf2900808 100644 --- a/npm/packs/client-generator/yarn.lock +++ b/npm/packs/client-generator/yarn.lock @@ -1594,6 +1594,11 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" +snq@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/snq/-/snq-1.0.3.tgz#f9661d10eebb224c52fc3c50106445c268618168" + integrity sha512-bXcxd1ppFnSNYKq84HyOYuYtbMHCFTZvuPSNCn/80yx9+DLkU/hLqjqCRKRHSDISrL1T/lWGXJyQxWS8TnutFA== + source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" From e792914de0d82f25a7559de6b6426026b03645d2 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 5 Dec 2019 10:55:19 +0300 Subject: [PATCH 06/52] feat(core): add application dtos --- .../packages/core/src/lib/models/dtos.ts | 124 ++++++++++++++++++ .../packages/core/src/lib/models/index.ts | 1 + 2 files changed, 125 insertions(+) create mode 100644 npm/ng-packs/packages/core/src/lib/models/dtos.ts diff --git a/npm/ng-packs/packages/core/src/lib/models/dtos.ts b/npm/ng-packs/packages/core/src/lib/models/dtos.ts new file mode 100644 index 0000000000..21bf136aa5 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/models/dtos.ts @@ -0,0 +1,124 @@ +export class ListResultDto { + items?: T[]; + + constructor(initialValues: Partial> = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class PagedResultDto extends ListResultDto { + totalCount?: number; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class LimitedResultRequestDto { + maxResultCount = 10; + + constructor(initialValues: Partial = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class PagedResultRequestDto extends LimitedResultRequestDto { + skipCount?: number; + + constructor(initialValues: Partial = {}) { + super(initialValues); + } +} + +export class PagedAndSortedResultRequestDto extends PagedResultRequestDto { + sorting?: string; + + constructor(initialValues: Partial = {}) { + super(initialValues); + } +} + +export class EntityDto { + id?: TKey; + + constructor(initialValues: Partial> = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class CreationAuditedEntityDto extends EntityDto { + creationTime?: string | Date; + creatorId?: string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class CreationAuditedEntityWithUserDto< + TUserDto, + TPrimaryKey = string +> extends CreationAuditedEntityDto { + creator?: TUserDto; + + constructor( + initialValues: Partial> = {}, + ) { + super(initialValues); + } +} + +export class AuditedEntityDto extends CreationAuditedEntityDto { + lastModificationTime?: string | Date; + lastModifierId?: string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class AuditedEntityWithUserDto extends AuditedEntityDto< + TPrimaryKey +> { + creator?: TUserDto; + lastModifier?: TUserDto; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class FullAuditedEntityDto extends AuditedEntityDto { + isDeleted?: boolean; + deleterId?: string; + deletionTime?: Date | string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class FullAuditedEntityWithUserDto< + TUserDto, + TPrimaryKey = string +> extends FullAuditedEntityDto { + creator?: TUserDto; + lastModifier?: TUserDto; + deleter?: TUserDto; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/models/index.ts b/npm/ng-packs/packages/core/src/lib/models/index.ts index 63302c9ab8..e27f9359e3 100644 --- a/npm/ng-packs/packages/core/src/lib/models/index.ts +++ b/npm/ng-packs/packages/core/src/lib/models/index.ts @@ -1,6 +1,7 @@ export * from './application-configuration'; export * from './common'; export * from './config'; +export * from './dtos'; export * from './rest'; export * from './session'; export * from './profile'; From 14008e69de218468ee6724a84e419e5a55af77a4 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 5 Dec 2019 10:55:19 +0300 Subject: [PATCH 07/52] feat(core): add application dtos #2222 --- .../packages/core/src/lib/models/dtos.ts | 124 ++++++++++++++++++ .../packages/core/src/lib/models/index.ts | 1 + 2 files changed, 125 insertions(+) create mode 100644 npm/ng-packs/packages/core/src/lib/models/dtos.ts diff --git a/npm/ng-packs/packages/core/src/lib/models/dtos.ts b/npm/ng-packs/packages/core/src/lib/models/dtos.ts new file mode 100644 index 0000000000..21bf136aa5 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/models/dtos.ts @@ -0,0 +1,124 @@ +export class ListResultDto { + items?: T[]; + + constructor(initialValues: Partial> = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class PagedResultDto extends ListResultDto { + totalCount?: number; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class LimitedResultRequestDto { + maxResultCount = 10; + + constructor(initialValues: Partial = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class PagedResultRequestDto extends LimitedResultRequestDto { + skipCount?: number; + + constructor(initialValues: Partial = {}) { + super(initialValues); + } +} + +export class PagedAndSortedResultRequestDto extends PagedResultRequestDto { + sorting?: string; + + constructor(initialValues: Partial = {}) { + super(initialValues); + } +} + +export class EntityDto { + id?: TKey; + + constructor(initialValues: Partial> = {}) { + for (const key in initialValues) { + if (initialValues.hasOwnProperty(key)) { + this[key] = initialValues[key]; + } + } + } +} + +export class CreationAuditedEntityDto extends EntityDto { + creationTime?: string | Date; + creatorId?: string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class CreationAuditedEntityWithUserDto< + TUserDto, + TPrimaryKey = string +> extends CreationAuditedEntityDto { + creator?: TUserDto; + + constructor( + initialValues: Partial> = {}, + ) { + super(initialValues); + } +} + +export class AuditedEntityDto extends CreationAuditedEntityDto { + lastModificationTime?: string | Date; + lastModifierId?: string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class AuditedEntityWithUserDto extends AuditedEntityDto< + TPrimaryKey +> { + creator?: TUserDto; + lastModifier?: TUserDto; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class FullAuditedEntityDto extends AuditedEntityDto { + isDeleted?: boolean; + deleterId?: string; + deletionTime?: Date | string; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} + +export class FullAuditedEntityWithUserDto< + TUserDto, + TPrimaryKey = string +> extends FullAuditedEntityDto { + creator?: TUserDto; + lastModifier?: TUserDto; + deleter?: TUserDto; + + constructor(initialValues: Partial> = {}) { + super(initialValues); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/models/index.ts b/npm/ng-packs/packages/core/src/lib/models/index.ts index 63302c9ab8..e27f9359e3 100644 --- a/npm/ng-packs/packages/core/src/lib/models/index.ts +++ b/npm/ng-packs/packages/core/src/lib/models/index.ts @@ -1,6 +1,7 @@ export * from './application-configuration'; export * from './common'; export * from './config'; +export * from './dtos'; export * from './rest'; export * from './session'; export * from './profile'; From 32a232890412c0f9b777cd2aee4a70f47df67cab Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Mon, 6 Jan 2020 11:06:53 +0300 Subject: [PATCH 08/52] generete proxy command added for abp cli (not ready) --- .../Volo/Abp/Cli/AbpCliCoreModule.cs | 1 + .../Abp/Cli/Commands/GenerateProxyCommand.cs | 393 ++++++++++++++++++ .../Properties/launchSettings.json | 8 + .../src/Volo.Abp.Cli/Volo.Abp.Cli.csproj | 1 + 4 files changed, 403 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs create mode 100644 framework/src/Volo.Abp.Cli/Properties/launchSettings.json diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs index a616d29409..97b57a0436 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs @@ -33,6 +33,7 @@ namespace Volo.Abp.Cli options.Commands["add-module"] = typeof(AddModuleCommand); options.Commands["login"] = typeof(LoginCommand); options.Commands["logout"] = typeof(LogoutCommand); + options.Commands["generate-proxy"] = typeof(GenerateProxyCommand); }); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs new file mode 100644 index 0000000000..368295b4c5 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -0,0 +1,393 @@ +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using ICSharpCode.SharpZipLib.Core; +using ICSharpCode.SharpZipLib.Zip; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectBuilding; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.Cli.Utils; +using Volo.Abp.DependencyInjection; +using Microsoft.CSharp; +using System.Collections.Generic; +using System.Linq; + +namespace Volo.Abp.Cli.Commands +{ + public class GenerateProxyCommand : IConsoleCommand, ITransientDependency + { + public ILogger Logger { get; set; } + + protected TemplateProjectBuilder TemplateProjectBuilder { get; } + + public GenerateProxyCommand(TemplateProjectBuilder templateProjectBuilder) + { + TemplateProjectBuilder = templateProjectBuilder; + + Logger = NullLogger.Instance; + } + + public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + { + try + { + var apiUrl = commandLineArgs.Options.GetOrNull(Options.ApiUrl.Short, Options.ApiUrl.Long); + var uiFramework = commandLineArgs.Options.GetOrNull(Options.UiFramework.Short, Options.UiFramework.Long); + + //WebClient client = new WebClient(); + //string json = client.DownloadString(apiUrl); + StreamReader sr = File.OpenText("api-definition.json"); + string json = sr.ReadToEnd(); + + Logger.LogInformation("Downloading api definition..."); + Logger.LogInformation("Api Url: " + apiUrl); + + JObject data = JObject.Parse(json); + + string rootPath = (string)data["modules"]["app"]["rootPath"]; + + System.IO.Directory.CreateDirectory(string.Format("src/app/{0}/shared/models", rootPath)); + System.IO.Directory.CreateDirectory(string.Format("src/app/{0}/shared/services", rootPath)); + + var serviceIndexList = new List(); + + foreach (var module in data["modules"]) + { + foreach (var item in module.First["controllers"]) + { + var controller = item.First; + + var controllerName = (string)controller["controllerName"]; + var controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + + StringBuilder serviceFileText = new StringBuilder(); + + serviceFileText.AppendLine("firstTypeList"); + serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); + serviceFileText.AppendLine("import { Observable } from 'rxjs';"); + serviceFileText.AppendLine("secondTypeList"); + serviceFileText.AppendLine(""); + serviceFileText.AppendLine("@Injectable()"); + serviceFileText.AppendLine(string.Format("export class {0}Service ", controllerName) + "{"); + serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); + serviceFileText.AppendLine(""); + + var firstTypeList = new List(); + var secondTypeList = new List(); + + foreach (var controllerItem in controller["actions"]) + { + var action = controllerItem.First; + var actionName = (string)action["name"]; + + actionName = (char.ToLower(actionName[0]) + actionName.Substring(1)).Replace("Async", "").Replace("Controller", ""); + + var returnValueType = (string)action["returnValue"]["type"]; + + var parameters = action["parameters"]; + StringBuilder parametersText = new StringBuilder(); + var parametersIndex = 0; + var bodyExtra = ""; + var modelBindingExtra = ""; + var modelBindingExtraList = new List(); + + foreach (var parameter in parameters) + { + parametersIndex++; + + if (parametersIndex > 1) + parametersText.Append(", "); + + var bindingSourceId = (string)parameter["bindingSourceId"]; + bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); + + if (bindingSourceId == "body") + { + bodyExtra = ", body"; + var typeArray = ((string)parameter["type"]).Split("."); + var type = typeArray[typeArray.Length - 1]; + + parametersText.Append(bindingSourceId + ": " + type); + secondTypeList.Add(type); + } + else if (bindingSourceId == "path") + { + parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); + } + else if (bindingSourceId == "modelBinding") + { + var typeSimple = ""; + var type = ""; + + var parameterNameOnMethod = (string)parameter["nameOnMethod"]; + + var parametersOnMethod = action["parametersOnMethod"]; + foreach (var parameterOnMethod in parametersOnMethod) + { + var parametersOnMethodName = (string)parameterOnMethod["name"]; + if (parametersOnMethodName == parameterNameOnMethod) + { + typeSimple = (string)parameterOnMethod["typeSimple"]; + + var typeArray = ((string)parameterOnMethod["type"]).Split("."); + type = typeArray[typeArray.Length - 1]; + } + } + + if (typeSimple == "string" || typeSimple == "boolean" || typeSimple == "number") + { + parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); + modelBindingExtraList.Add((string)parameter["name"]); + } + else + { + parametersText.Append(string.Format("params = {{}} as {0}", type)); + modelBindingExtra = ", params"; + secondTypeList.Add(type); + break; + } + } + } + + if (returnValueType != null) + { + if (returnValueType.IndexOf('<') > -1) + { + var firstTypeArray = returnValueType.Split("<")[0].Split("."); + var firstType = firstTypeArray[firstTypeArray.Length - 1]; + + var secondTypeArray = returnValueType.Split("<")[1].Split("."); + var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); + + serviceFileText.AppendLine(string.Format(" {0}({1}): Observable<{2}<{3}>> {{", actionName, parametersText.ToString(), firstType, secondType)); + + firstTypeList.Add(firstType); + secondTypeList.Add(secondType); + } + else + { + var typeArray = returnValueType.Split("."); + var type = typeArray[typeArray.Length - 1].TrimEnd('>'); + + if (type == "Void") + type = "void"; + + serviceFileText.AppendLine(string.Format(" {0}({1}): Observable<{2}> {{", actionName, parametersText.ToString(), type)); + secondTypeList.Add(type); + } + } + + if (modelBindingExtraList != null && modelBindingExtraList.Count > 0) + { + modelBindingExtra = ", params: { " + String.Join(", ", modelBindingExtraList.ToArray()) + " }"; + } + + var url = ((string)action["url"]).Replace("/{", "/${"); + var httpMethod = (string)action["httpMethod"]; + serviceFileText.AppendLine(string.Format(" return this.restService.request({{ url: '/{0}', method: '{1}'{2}{3} }});", url, httpMethod, bodyExtra, modelBindingExtra)); + + serviceFileText.AppendLine(" }"); + } + + serviceFileText.AppendLine("}"); + + if (firstTypeList != null && firstTypeList.Count > 0) + { + var firstTypeListDistinct = ", " + String.Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("firstTypeList", string.Format("import {{ RestService {0}}} from '@abp/ng.core';", firstTypeListDistinct)); + } + else + { + serviceFileText.Replace("firstTypeList", ""); + } + + if (secondTypeList != null && secondTypeList.Count > 0) + { + var secondTypeListDistinct = String.Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("secondTypeList", string.Format("import {{{0}}} from '../models';", secondTypeListDistinct)); + } + else + { + serviceFileText.Replace("secondTypeList", ""); + } + + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/{1}", rootPath, controllerServiceName), serviceFileText.ToString()); + + serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); + } + } + + StringBuilder serviceIndexFileText = new StringBuilder(); + + foreach (var serviceIndexItem in serviceIndexList) + { + serviceIndexFileText.AppendLine(string.Format("export * from './{0}';", serviceIndexItem)); + } + + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/index.ts", rootPath), serviceIndexFileText.ToString()); + + var modelIndexList = new List(); + + foreach (var type in data["types"]) + { + var typeFullName = ((JProperty)type.First.Parent).Name; + + var typeNameSplit = typeFullName.Split("."); + var typeName = typeNameSplit[typeNameSplit.Length - 1]; + + var typeModelName = typeName.Replace("<","").Replace(">", "").PascalToKebabCase() + ".ts"; + + StringBuilder modelFileText = new StringBuilder(); + + + var baseType = (string)type.First["baseType"]; + var extends = ""; + + if (!string.IsNullOrWhiteSpace(baseType)) + { + var baseTypeSplit = baseType.Split("."); + var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1]; + var baseTypeKebabCase = baseTypeName.PascalToKebabCase(); + + modelFileText.AppendLine(string.Format("import {{ {0} }} from '@abp/ng.core';", baseTypeName, baseTypeKebabCase)); + extends = "extends " + baseTypeName; + } + + modelFileText.AppendLine(string.Format("export class {0} {1} {{", typeName, extends)); + + foreach (var property in type.First["properties"]) + { + var propertyName = (string)property["name"]; + propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); + + var typeSimple = (string)property["typeSimple"]; + + modelFileText.AppendLine(string.Format(" {0}: {1};", propertyName, typeSimple)); + } + + modelFileText.AppendLine(""); + + modelFileText.AppendLine(string.Format(" constructor(initialValues: Partial<{0}> = {{}}) {{", typeName)); + + if (!string.IsNullOrWhiteSpace(baseType)) + { + modelFileText.AppendLine(" super(initialValues);"); + } + else + { + modelFileText.AppendLine(" if (initialValues) {"); + modelFileText.AppendLine(" for (const key in initialValues) {"); + modelFileText.AppendLine(" if (initialValues.hasOwnProperty(key)) {"); + modelFileText.AppendLine(" this[key] = initialValues[key];"); + + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); + } + + modelFileText.AppendLine("}"); + + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName), modelFileText.ToString()); + + modelIndexList.Add(typeModelName.Replace(".ts", "")); + } + + StringBuilder modelIndexFileText = new StringBuilder(); + + foreach (var modelIndexItem in modelIndexList) + { + modelIndexFileText.AppendLine(string.Format("export * from './{0}';", modelIndexItem)); + } + + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/index.ts", rootPath), modelIndexFileText.ToString()); + } + catch (Exception ex) + { + throw; + } + } + + public string GetUsageInfo() + { + var sb = new StringBuilder(); + + sb.AppendLine(""); + sb.AppendLine("Usage:"); + sb.AppendLine(""); + sb.AppendLine(" abp generate-proxy --apiUrl [options]"); + sb.AppendLine(""); + sb.AppendLine("Options:"); + sb.AppendLine(""); + sb.AppendLine("-u|--ui (default: angular)"); + sb.AppendLine(""); + sb.AppendLine("Examples:"); + sb.AppendLine(""); + sb.AppendLine(" abp new --apiUrl https://www.abp.io/api/abp/api-definition?types=true"); + sb.AppendLine(""); + sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); + + return sb.ToString(); + } + + public string GetShortDescription() + { + return "Generates a ..."; + } + + private UiFramework GetUiFramework(CommandLineArgs commandLineArgs) + { + var optionValue = commandLineArgs.Options.GetOrNull(Options.UiFramework.Short, Options.UiFramework.Long); + switch (optionValue) + { + case "none": + return UiFramework.None; + case "mvc": + return UiFramework.Mvc; + case "angular": + return UiFramework.Angular; + default: + return UiFramework.NotSpecified; + } + } + + public static class Options + { + public static class ApiUrl + { + public const string Short = "au"; + public const string Long = "apiUrl"; + } + + public static class UiFramework + { + public const string Short = "u"; + public const string Long = "ui"; + } + } + } + + public static class StringExtensions + { + public static string PascalToKebabCase(this string value) + { + if (string.IsNullOrEmpty(value)) + return value; + + return Regex.Replace( + value, + "(? + From 6ec6a7bb0b7416fe1c9542a3fc8f116d08714ff6 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Thu, 9 Jan 2020 10:41:58 +0300 Subject: [PATCH 09/52] Update generate proxy command --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 310 ++++++++++++------ 1 file changed, 205 insertions(+), 105 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index 368295b4c5..deb4df21af 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -49,43 +49,66 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Downloading api definition..."); Logger.LogInformation("Api Url: " + apiUrl); - JObject data = JObject.Parse(json); - - string rootPath = (string)data["modules"]["app"]["rootPath"]; - - System.IO.Directory.CreateDirectory(string.Format("src/app/{0}/shared/models", rootPath)); - System.IO.Directory.CreateDirectory(string.Format("src/app/{0}/shared/services", rootPath)); + JObject data = JObject.Parse(json); var serviceIndexList = new List(); + var modelIndexList = new List(); + + var moduleList = new Dictionary(); foreach (var module in data["modules"]) { - foreach (var item in module.First["controllers"]) + string rootPath = ((string)module.First["rootPath"]).ToLower(); + + if (moduleList.Any(p => p.Key == rootPath)) { - var controller = item.First; + var value = moduleList[rootPath]; - var controllerName = (string)controller["controllerName"]; - var controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + moduleList[rootPath] = value.TrimEnd('}') + "," + module.First["controllers"].ToString().TrimStart('{'); + } + else { + moduleList.Add(rootPath, module.First["controllers"].ToString()); + } + } + + + foreach (var module in moduleList) + { + JObject moduleValue = JObject.Parse(module.Value); - StringBuilder serviceFileText = new StringBuilder(); + string rootPath = module.Key; + var controllerName = ""; + var controllerServiceName = ""; - serviceFileText.AppendLine("firstTypeList"); - serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); - serviceFileText.AppendLine("import { Observable } from 'rxjs';"); - serviceFileText.AppendLine("secondTypeList"); - serviceFileText.AppendLine(""); - serviceFileText.AppendLine("@Injectable()"); - serviceFileText.AppendLine(string.Format("export class {0}Service ", controllerName) + "{"); - serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); - serviceFileText.AppendLine(""); + Directory.CreateDirectory(string.Format("src/app/{0}/shared/models", rootPath)); + Directory.CreateDirectory(string.Format("src/app/{0}/shared/services", rootPath)); - var firstTypeList = new List(); - var secondTypeList = new List(); + StringBuilder serviceFileText = new StringBuilder(); - foreach (var controllerItem in controller["actions"]) + serviceFileText.AppendLine("firstTypeList"); + serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); + serviceFileText.AppendLine("import { Observable } from 'rxjs';"); + serviceFileText.AppendLine("secondTypeList"); + serviceFileText.AppendLine(""); + serviceFileText.AppendLine("@Injectable()"); + serviceFileText.AppendLine(string.Format("export class {0}Service ", "[ControllerName]") + "{"); + serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); + serviceFileText.AppendLine(""); + + var firstTypeList = new List(); + var secondTypeList = new List(); + + foreach (var item in moduleValue.Root.ToList()) + { + var controller = item.First; + + controllerName = (string)controller["controllerName"]; + controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + + foreach (var actionItem in controller["actions"]) { - var action = controllerItem.First; - var actionName = (string)action["name"]; + var action = actionItem.First; + var actionName = (string)action["uniqueName"]; actionName = (char.ToLower(actionName[0]) + actionName.Substring(1)).Replace("Async", "").Replace("Controller", ""); @@ -182,6 +205,12 @@ namespace Volo.Abp.Cli.Commands serviceFileText.AppendLine(string.Format(" {0}({1}): Observable<{2}> {{", actionName, parametersText.ToString(), type)); secondTypeList.Add(type); } + + var modelIndex = CreateType(data, returnValueType, rootPath); + + if (!string.IsNullOrWhiteSpace(modelIndex)) + modelIndexList.Add(modelIndex); + } if (modelBindingExtraList != null && modelBindingExtraList.Count > 0) @@ -194,125 +223,196 @@ namespace Volo.Abp.Cli.Commands serviceFileText.AppendLine(string.Format(" return this.restService.request({{ url: '/{0}', method: '{1}'{2}{3} }});", url, httpMethod, bodyExtra, modelBindingExtra)); serviceFileText.AppendLine(" }"); - } + } - serviceFileText.AppendLine("}"); + serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); + } - if (firstTypeList != null && firstTypeList.Count > 0) - { - var firstTypeListDistinct = ", " + String.Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("firstTypeList", string.Format("import {{ RestService {0}}} from '@abp/ng.core';", firstTypeListDistinct)); - } - else - { - serviceFileText.Replace("firstTypeList", ""); - } + if (firstTypeList != null && firstTypeList.Count > 0) + { + var firstTypeListDistinct = ", " + String.Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("firstTypeList", string.Format("import {{ RestService {0}}} from '@abp/ng.core';", firstTypeListDistinct)); + } + else + { + serviceFileText.Replace("firstTypeList", ""); + } - if (secondTypeList != null && secondTypeList.Count > 0) - { - var secondTypeListDistinct = String.Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("secondTypeList", string.Format("import {{{0}}} from '../models';", secondTypeListDistinct)); - } - else - { - serviceFileText.Replace("secondTypeList", ""); - } + if (secondTypeList != null && secondTypeList.Count > 0) + { + var secondTypeListDistinct = String.Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("secondTypeList", string.Format("import {{{0}}} from '../models';", secondTypeListDistinct)); + } + else + { + serviceFileText.Replace("secondTypeList", ""); + } - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/{1}", rootPath, controllerServiceName), serviceFileText.ToString()); + serviceFileText.AppendLine("}"); - serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); - } + serviceFileText.Replace("[ControllerName]", controllerName); + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/{1}", rootPath, controllerServiceName), serviceFileText.ToString()); } - StringBuilder serviceIndexFileText = new StringBuilder(); + //StringBuilder serviceIndexFileText = new StringBuilder(); - foreach (var serviceIndexItem in serviceIndexList) - { - serviceIndexFileText.AppendLine(string.Format("export * from './{0}';", serviceIndexItem)); - } + //foreach (var serviceIndexItem in serviceIndexList) + //{ + // serviceIndexFileText.AppendLine(string.Format("export * from './{0}';", serviceIndexItem)); + //} - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/index.ts", rootPath), serviceIndexFileText.ToString()); + //System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/index.ts", rootPath), serviceIndexFileText.ToString()); - var modelIndexList = new List(); + //StringBuilder modelIndexFileText = new StringBuilder(); - foreach (var type in data["types"]) - { - var typeFullName = ((JProperty)type.First.Parent).Name; + //foreach (var modelIndexItem in modelIndexList) + //{ + // modelIndexFileText.AppendLine(string.Format("export * from './{0}';", modelIndexItem)); + //} + + //System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/index.ts", rootPath), modelIndexFileText.ToString()); + } + catch (Exception ex) + { + throw; + } + } - var typeNameSplit = typeFullName.Split("."); - var typeName = typeNameSplit[typeNameSplit.Length - 1]; + private string CreateType(JObject data, string returnValueType, string rootPath) + { + var type = data["types"][returnValueType]; - var typeModelName = typeName.Replace("<","").Replace(">", "").PascalToKebabCase() + ".ts"; + if (returnValueType.StartsWith("Volo.Abp.Application.Dtos") + || returnValueType.StartsWith("System.Collections") + || returnValueType == "System.String" + || returnValueType == "System.Void" + || returnValueType.Contains("IActionResult") + || returnValueType.Contains("IStringValueType") + || returnValueType.Contains("IValueValidator") + ) + return null; - StringBuilder modelFileText = new StringBuilder(); + var typeNameSplit = returnValueType.Split("."); + var typeName = typeNameSplit[typeNameSplit.Length - 1]; + var typeModelName = typeName.Replace("<", "").Replace(">", "").PascalToKebabCase() + ".ts"; - var baseType = (string)type.First["baseType"]; - var extends = ""; + var path = string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName); + if (File.Exists(path)) + return null; - if (!string.IsNullOrWhiteSpace(baseType)) - { - var baseTypeSplit = baseType.Split("."); - var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1]; - var baseTypeKebabCase = baseTypeName.PascalToKebabCase(); - modelFileText.AppendLine(string.Format("import {{ {0} }} from '@abp/ng.core';", baseTypeName, baseTypeKebabCase)); - extends = "extends " + baseTypeName; - } + StringBuilder modelFileText = new StringBuilder(); - modelFileText.AppendLine(string.Format("export class {0} {1} {{", typeName, extends)); - foreach (var property in type.First["properties"]) - { - var propertyName = (string)property["name"]; - propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); + var baseType = (string)type["baseType"]; + var extends = ""; - var typeSimple = (string)property["typeSimple"]; + if (!string.IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") + { + var baseTypeSplit = baseType.Split("."); + var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1].Replace("<", "").Replace(">", ""); + var baseTypeKebabCase = "./" + baseTypeName.PascalToKebabCase(); - modelFileText.AppendLine(string.Format(" {0}: {1};", propertyName, typeSimple)); - } + if (baseType.Contains("Volo.Abp.Application.Dtos.EntityDto")) + baseTypeKebabCase = "@abp/ng.core"; - modelFileText.AppendLine(""); + if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) + baseTypeName = "string"; - modelFileText.AppendLine(string.Format(" constructor(initialValues: Partial<{0}> = {{}}) {{", typeName)); + modelFileText.AppendLine(string.Format("import {{ {0} }} from '{1}';", baseTypeName, baseTypeKebabCase)); + extends = "extends " + baseTypeName; + } + + if (baseType == "System.Enum" && (string)type.First["isEnum"] == "True") + { + modelFileText.AppendLine(string.Format("export enum {0} {{", typeName)); + + var enumDictionary = new Dictionary(); + + var enumNameList = type.First["enumNames"].ToArray(); + var enumValueList = type.First["enumValues"].ToArray(); - if (!string.IsNullOrWhiteSpace(baseType)) + for (int i = 0; i < enumNameList.Length; i++) + { + modelFileText.AppendLine(string.Format("{0} = {1},", enumNameList[i], enumValueList[i])); + } + + modelFileText.AppendLine("}"); + } + else + { + modelFileText.AppendLine(string.Format("export class {0} {1} {{", typeName, extends)); + + foreach (var property in type["properties"]) + { + var propertyName = (string)property["name"]; + propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); + + var typeSimple = (string)property["typeSimple"]; + + if (typeSimple.IndexOf("[") > -1 && typeSimple.IndexOf("]") > -1) + typeSimple = typeSimple.Replace("[", "").Replace("]", "") + "[]"; + + if (typeSimple.StartsWith("Volo.Abp")) { - modelFileText.AppendLine(" super(initialValues);"); + var typeSimpleSplit = typeSimple.Split("."); + typeSimple = typeSimpleSplit[typeSimpleSplit.Length - 1]; } - else + + if (typeSimple.StartsWith("System.Object")) { - modelFileText.AppendLine(" if (initialValues) {"); - modelFileText.AppendLine(" for (const key in initialValues) {"); - modelFileText.AppendLine(" if (initialValues.hasOwnProperty(key)) {"); - modelFileText.AppendLine(" this[key] = initialValues[key];"); - - modelFileText.AppendLine(" }"); - modelFileText.AppendLine(" }"); - modelFileText.AppendLine(" }"); - modelFileText.AppendLine(" }"); + typeSimple = typeSimple.Replace("System.Object", "object"); } - modelFileText.AppendLine("}"); + if (typeSimple.Contains("?")) + { + typeSimple = typeSimple.Replace("?", ""); + propertyName += "?"; + } - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName), modelFileText.ToString()); + if (typeSimple != "boolean" + && typeSimple != "string" + && typeSimple != "number" + && typeSimple != "boolean[]" + && typeSimple != "string[]" + && typeSimple != "number[]" + ) + { + typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); + } - modelIndexList.Add(typeModelName.Replace(".ts", "")); + modelFileText.AppendLine(string.Format(" {0}: {1};", propertyName, typeSimple)); } - StringBuilder modelIndexFileText = new StringBuilder(); + modelFileText.AppendLine(""); + + modelFileText.AppendLine(string.Format(" constructor(initialValues: Partial<{0}> = {{}}) {{", typeName)); - foreach (var modelIndexItem in modelIndexList) + if (!string.IsNullOrWhiteSpace(baseType)) { - modelIndexFileText.AppendLine(string.Format("export * from './{0}';", modelIndexItem)); + modelFileText.AppendLine(" super(initialValues);"); + modelFileText.AppendLine(" }"); + } + else + { + modelFileText.AppendLine(" if (initialValues) {"); + modelFileText.AppendLine(" for (const key in initialValues) {"); + modelFileText.AppendLine(" if (initialValues.hasOwnProperty(key)) {"); + modelFileText.AppendLine(" this[key] = initialValues[key];"); + + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); + modelFileText.AppendLine(" }"); } - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/index.ts", rootPath), modelIndexFileText.ToString()); - } - catch (Exception ex) - { - throw; + modelFileText.AppendLine("}"); } + + System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName), modelFileText.ToString()); + + return typeModelName.Replace(".ts", ""); } public string GetUsageInfo() From c7e575c689354445be8fc9eda3db7c011229dd07 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Mon, 13 Jan 2020 10:41:32 +0300 Subject: [PATCH 10/52] Generate proxy command refactor --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 408 +++++++++--------- 1 file changed, 214 insertions(+), 194 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index deb4df21af..61cd20b0be 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -18,6 +18,7 @@ using Volo.Abp.DependencyInjection; using Microsoft.CSharp; using System.Collections.Generic; using System.Linq; +using static System.String; namespace Volo.Abp.Cli.Commands { @@ -36,246 +37,259 @@ namespace Volo.Abp.Cli.Commands public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { - try - { - var apiUrl = commandLineArgs.Options.GetOrNull(Options.ApiUrl.Short, Options.ApiUrl.Long); - var uiFramework = commandLineArgs.Options.GetOrNull(Options.UiFramework.Short, Options.UiFramework.Long); - - //WebClient client = new WebClient(); - //string json = client.DownloadString(apiUrl); - StreamReader sr = File.OpenText("api-definition.json"); - string json = sr.ReadToEnd(); + var apiUrl = commandLineArgs.Options.GetOrNull(Options.ApiUrl.Short, Options.ApiUrl.Long); + var uiFramework = GetUiFramework(commandLineArgs); - Logger.LogInformation("Downloading api definition..."); - Logger.LogInformation("Api Url: " + apiUrl); + //WebClient client = new WebClient(); + //string json = client.DownloadString(apiUrl); + var sr = File.OpenText("api-definition.json"); + var json = sr.ReadToEnd(); - JObject data = JObject.Parse(json); + Logger.LogInformation("Downloading api definition..."); + Logger.LogInformation("Api Url: " + apiUrl); - var serviceIndexList = new List(); - var modelIndexList = new List(); + var data = JObject.Parse(json); - var moduleList = new Dictionary(); + Logger.LogInformation("Modules are combining"); + var moduleList = GetCombinedModules(data); + + Logger.LogInformation("Modules and types are creating"); - foreach (var module in data["modules"]) - { - string rootPath = ((string)module.First["rootPath"]).ToLower(); + var serviceIndexList = new List(); + var modelIndexList = new List(); + + foreach (var module in moduleList) + { + var moduleValue = JObject.Parse(module.Value); - if (moduleList.Any(p => p.Key == rootPath)) - { - var value = moduleList[rootPath]; + var rootPath = module.Key; + var controllerName = ""; + var controllerServiceName = ""; - moduleList[rootPath] = value.TrimEnd('}') + "," + module.First["controllers"].ToString().TrimStart('{'); - } - else { - moduleList.Add(rootPath, module.First["controllers"].ToString()); - } - } + Logger.LogInformation($"{rootPath} directory is creating"); + Directory.CreateDirectory($"src/app/{rootPath}/shared/models"); + Directory.CreateDirectory($"src/app/{rootPath}/shared/services"); - foreach (var module in moduleList) - { - JObject moduleValue = JObject.Parse(module.Value); + var serviceFileText = new StringBuilder(); - string rootPath = module.Key; - var controllerName = ""; - var controllerServiceName = ""; + serviceFileText.AppendLine("[firstTypeList]"); + serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); + serviceFileText.AppendLine("import { Observable } from 'rxjs';"); + serviceFileText.AppendLine("[secondTypeList]"); + serviceFileText.AppendLine(""); + serviceFileText.AppendLine("@Injectable()"); + serviceFileText.AppendLine("export class [controllerName]Service {"); + serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); + serviceFileText.AppendLine(""); - Directory.CreateDirectory(string.Format("src/app/{0}/shared/models", rootPath)); - Directory.CreateDirectory(string.Format("src/app/{0}/shared/services", rootPath)); + var firstTypeList = new List(); + var secondTypeList = new List(); - StringBuilder serviceFileText = new StringBuilder(); + foreach (var controller in moduleValue.Root.ToList().Select(item => item.First)) + { + controllerName = (string)controller["controllerName"]; + controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; - serviceFileText.AppendLine("firstTypeList"); - serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); - serviceFileText.AppendLine("import { Observable } from 'rxjs';"); - serviceFileText.AppendLine("secondTypeList"); - serviceFileText.AppendLine(""); - serviceFileText.AppendLine("@Injectable()"); - serviceFileText.AppendLine(string.Format("export class {0}Service ", "[ControllerName]") + "{"); - serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); - serviceFileText.AppendLine(""); + foreach (var actionItem in controller["actions"]) + { + var action = actionItem.First; + var actionName = (string)action["uniqueName"]; - var firstTypeList = new List(); - var secondTypeList = new List(); + actionName = (char.ToLower(actionName[0]) + actionName.Substring(1)).Replace("Async", "").Replace("Controller", ""); - foreach (var item in moduleValue.Root.ToList()) - { - var controller = item.First; + var returnValueType = (string)action["returnValue"]["type"]; - controllerName = (string)controller["controllerName"]; - controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + var parameters = action["parameters"]; + var parametersText = new StringBuilder(); + var parametersIndex = 0; + var bodyExtra = ""; + var modelBindingExtra = ""; + var modelBindingExtraList = new List(); - foreach (var actionItem in controller["actions"]) + foreach (var parameter in parameters) { - var action = actionItem.First; - var actionName = (string)action["uniqueName"]; - - actionName = (char.ToLower(actionName[0]) + actionName.Substring(1)).Replace("Async", "").Replace("Controller", ""); + parametersIndex++; - var returnValueType = (string)action["returnValue"]["type"]; + if (parametersIndex > 1) + { + parametersText.Append(", "); + } - var parameters = action["parameters"]; - StringBuilder parametersText = new StringBuilder(); - var parametersIndex = 0; - var bodyExtra = ""; - var modelBindingExtra = ""; - var modelBindingExtraList = new List(); + var bindingSourceId = (string)parameter["bindingSourceId"]; + bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); - foreach (var parameter in parameters) + if (bindingSourceId == "body") { - parametersIndex++; + bodyExtra = ", body"; + var typeArray = ((string)parameter["type"]).Split("."); + var type = typeArray[typeArray.Length - 1]; - if (parametersIndex > 1) - parametersText.Append(", "); + parametersText.Append(bindingSourceId + ": " + type); + secondTypeList.Add(type); + } + else if (bindingSourceId == "path") + { + parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); + } + else if (bindingSourceId == "modelBinding") + { + var typeSimple = ""; + var type = ""; - var bindingSourceId = (string)parameter["bindingSourceId"]; - bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); + var parameterNameOnMethod = (string)parameter["nameOnMethod"]; - if (bindingSourceId == "body") + var parametersOnMethod = action["parametersOnMethod"]; + foreach (var parameterOnMethod in parametersOnMethod) { - bodyExtra = ", body"; - var typeArray = ((string)parameter["type"]).Split("."); - var type = typeArray[typeArray.Length - 1]; + var parametersOnMethodName = (string)parameterOnMethod["name"]; + if (parametersOnMethodName == parameterNameOnMethod) + { + typeSimple = (string)parameterOnMethod["typeSimple"]; - parametersText.Append(bindingSourceId + ": " + type); - secondTypeList.Add(type); + var typeArray = ((string)parameterOnMethod["type"]).Split("."); + type = typeArray[typeArray.Length - 1]; + } } - else if (bindingSourceId == "path") + + if (typeSimple == "string" || typeSimple == "boolean" || typeSimple == "number") { parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); + modelBindingExtraList.Add((string)parameter["name"]); } - else if (bindingSourceId == "modelBinding") + else { - var typeSimple = ""; - var type = ""; - - var parameterNameOnMethod = (string)parameter["nameOnMethod"]; - - var parametersOnMethod = action["parametersOnMethod"]; - foreach (var parameterOnMethod in parametersOnMethod) - { - var parametersOnMethodName = (string)parameterOnMethod["name"]; - if (parametersOnMethodName == parameterNameOnMethod) - { - typeSimple = (string)parameterOnMethod["typeSimple"]; - - var typeArray = ((string)parameterOnMethod["type"]).Split("."); - type = typeArray[typeArray.Length - 1]; - } - } - - if (typeSimple == "string" || typeSimple == "boolean" || typeSimple == "number") - { - parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); - modelBindingExtraList.Add((string)parameter["name"]); - } - else - { - parametersText.Append(string.Format("params = {{}} as {0}", type)); - modelBindingExtra = ", params"; - secondTypeList.Add(type); - break; - } + parametersText.Append($"params = {{}} as {type}"); + modelBindingExtra = ", params"; + secondTypeList.Add(type); + break; } } + } - if (returnValueType != null) + if (returnValueType != null) + { + if (returnValueType.IndexOf('<') > -1) { - if (returnValueType.IndexOf('<') > -1) - { - var firstTypeArray = returnValueType.Split("<")[0].Split("."); - var firstType = firstTypeArray[firstTypeArray.Length - 1]; - - var secondTypeArray = returnValueType.Split("<")[1].Split("."); - var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); + var firstTypeArray = returnValueType.Split("<")[0].Split("."); + var firstType = firstTypeArray[firstTypeArray.Length - 1]; - serviceFileText.AppendLine(string.Format(" {0}({1}): Observable<{2}<{3}>> {{", actionName, parametersText.ToString(), firstType, secondType)); + var secondTypeArray = returnValueType.Split("<")[1].Split("."); + var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); - firstTypeList.Add(firstType); - secondTypeList.Add(secondType); - } - else - { - var typeArray = returnValueType.Split("."); - var type = typeArray[typeArray.Length - 1].TrimEnd('>'); + serviceFileText.AppendLine( + $" {actionName}({parametersText}): Observable<{firstType}<{secondType}>> {{"); - if (type == "Void") - type = "void"; + firstTypeList.Add(firstType); + secondTypeList.Add(secondType); + } + else + { + var typeArray = returnValueType.Split("."); + var type = typeArray[typeArray.Length - 1].TrimEnd('>'); - serviceFileText.AppendLine(string.Format(" {0}({1}): Observable<{2}> {{", actionName, parametersText.ToString(), type)); - secondTypeList.Add(type); + if (type == "Void") + { + type = "void"; } - var modelIndex = CreateType(data, returnValueType, rootPath); - - if (!string.IsNullOrWhiteSpace(modelIndex)) - modelIndexList.Add(modelIndex); + serviceFileText.AppendLine( + $" {actionName}({parametersText}): Observable<{type}> {{"); + secondTypeList.Add(type); } - if (modelBindingExtraList != null && modelBindingExtraList.Count > 0) + var modelIndex = CreateType(data, returnValueType, rootPath); + + if (!IsNullOrWhiteSpace(modelIndex)) { - modelBindingExtra = ", params: { " + String.Join(", ", modelBindingExtraList.ToArray()) + " }"; + modelIndexList.Add(modelIndex); } + } - var url = ((string)action["url"]).Replace("/{", "/${"); - var httpMethod = (string)action["httpMethod"]; - serviceFileText.AppendLine(string.Format(" return this.restService.request({{ url: '/{0}', method: '{1}'{2}{3} }});", url, httpMethod, bodyExtra, modelBindingExtra)); - - serviceFileText.AppendLine(" }"); - } - - serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); - } + if (modelBindingExtraList != null && modelBindingExtraList.Count > 0) + { + modelBindingExtra = ", params: { " + Join(", ", modelBindingExtraList.ToArray()) + " }"; + } - if (firstTypeList != null && firstTypeList.Count > 0) - { - var firstTypeListDistinct = ", " + String.Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("firstTypeList", string.Format("import {{ RestService {0}}} from '@abp/ng.core';", firstTypeListDistinct)); - } - else - { - serviceFileText.Replace("firstTypeList", ""); - } + var url = ((string)action["url"]).Replace("/{", "/${"); + var httpMethod = (string)action["httpMethod"]; + serviceFileText.AppendLine( + $" return this.restService.request({{ url: '/{url}', method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});"); - if (secondTypeList != null && secondTypeList.Count > 0) - { - var secondTypeListDistinct = String.Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("secondTypeList", string.Format("import {{{0}}} from '../models';", secondTypeListDistinct)); - } - else - { - serviceFileText.Replace("secondTypeList", ""); + serviceFileText.AppendLine(" }"); } - serviceFileText.AppendLine("}"); + serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); + } + + if (firstTypeList != null && firstTypeList.Count > 0) + { + var firstTypeListDistinct = ", " + Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("[firstTypeList]", + $"import {{ RestService {firstTypeListDistinct}}} from '@abp/ng.core';"); + } + else + { + serviceFileText.Replace("[firstTypeList]", ""); + } - serviceFileText.Replace("[ControllerName]", controllerName); - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/{1}", rootPath, controllerServiceName), serviceFileText.ToString()); + if (secondTypeList != null && secondTypeList.Count > 0) + { + var secondTypeListDistinct = Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("[secondTypeList]", + $"import {{{secondTypeListDistinct}}} from '../models';"); } + else + { + serviceFileText.Replace("[secondTypeList]", ""); + } - //StringBuilder serviceIndexFileText = new StringBuilder(); + serviceFileText.AppendLine("}"); - //foreach (var serviceIndexItem in serviceIndexList) - //{ - // serviceIndexFileText.AppendLine(string.Format("export * from './{0}';", serviceIndexItem)); - //} + serviceFileText.Replace("[controllerName]", controllerName); + File.WriteAllText($"src/app/{rootPath}/shared/services/{controllerServiceName}", serviceFileText.ToString()); - //System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/services/index.ts", rootPath), serviceIndexFileText.ToString()); + var serviceIndexFileText = new StringBuilder(); - //StringBuilder modelIndexFileText = new StringBuilder(); + foreach (var serviceIndexItem in serviceIndexList) + { + serviceIndexFileText.AppendLine($"export * from './{serviceIndexItem}';"); + } + + File.WriteAllText($"src/app/{rootPath}/shared/services/index.ts", serviceIndexFileText.ToString()); - //foreach (var modelIndexItem in modelIndexList) - //{ - // modelIndexFileText.AppendLine(string.Format("export * from './{0}';", modelIndexItem)); - //} + var modelIndexFileText = new StringBuilder(); + + foreach (var modelIndexItem in modelIndexList) + { + modelIndexFileText.AppendLine($"export * from './{modelIndexItem}';"); + } - //System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/index.ts", rootPath), modelIndexFileText.ToString()); + File.WriteAllText($"src/app/{rootPath}/shared/models/index.ts", modelIndexFileText.ToString()); } - catch (Exception ex) + } + + private Dictionary GetCombinedModules(JToken data) + { + var moduleList = new Dictionary(); + foreach (var module in data["modules"]) { - throw; + var rootPath = ((string)module.First["rootPath"]).ToLower(); + + if (moduleList.Any(p => p.Key == rootPath)) + { + var value = moduleList[rootPath]; + + moduleList[rootPath] = value.TrimEnd('}') + "," + module.First["controllers"].ToString().TrimStart('{'); + } + else + { + moduleList.Add(rootPath, module.First["controllers"].ToString()); + } } + + return moduleList; } private string CreateType(JObject data, string returnValueType, string rootPath) @@ -290,59 +304,63 @@ namespace Volo.Abp.Cli.Commands || returnValueType.Contains("IStringValueType") || returnValueType.Contains("IValueValidator") ) + { return null; + } var typeNameSplit = returnValueType.Split("."); var typeName = typeNameSplit[typeNameSplit.Length - 1]; var typeModelName = typeName.Replace("<", "").Replace(">", "").PascalToKebabCase() + ".ts"; - var path = string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName); + var path = $"src/app/{rootPath}/shared/models/{typeModelName}"; if (File.Exists(path)) + { return null; + } - - StringBuilder modelFileText = new StringBuilder(); - + var modelFileText = new StringBuilder(); var baseType = (string)type["baseType"]; var extends = ""; - if (!string.IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") + if (!IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") { var baseTypeSplit = baseType.Split("."); var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1].Replace("<", "").Replace(">", ""); var baseTypeKebabCase = "./" + baseTypeName.PascalToKebabCase(); if (baseType.Contains("Volo.Abp.Application.Dtos.EntityDto")) + { baseTypeKebabCase = "@abp/ng.core"; + } if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) + { baseTypeName = "string"; + } - modelFileText.AppendLine(string.Format("import {{ {0} }} from '{1}';", baseTypeName, baseTypeKebabCase)); + modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); extends = "extends " + baseTypeName; } if (baseType == "System.Enum" && (string)type.First["isEnum"] == "True") { - modelFileText.AppendLine(string.Format("export enum {0} {{", typeName)); - - var enumDictionary = new Dictionary(); + modelFileText.AppendLine($"export enum {typeName} {{"); var enumNameList = type.First["enumNames"].ToArray(); var enumValueList = type.First["enumValues"].ToArray(); - for (int i = 0; i < enumNameList.Length; i++) + for (var i = 0; i < enumNameList.Length; i++) { - modelFileText.AppendLine(string.Format("{0} = {1},", enumNameList[i], enumValueList[i])); + modelFileText.AppendLine($"{enumNameList[i]} = {enumValueList[i]},"); } modelFileText.AppendLine("}"); } else { - modelFileText.AppendLine(string.Format("export class {0} {1} {{", typeName, extends)); + modelFileText.AppendLine($"export class {typeName} {extends} {{"); foreach (var property in type["properties"]) { @@ -352,7 +370,9 @@ namespace Volo.Abp.Cli.Commands var typeSimple = (string)property["typeSimple"]; if (typeSimple.IndexOf("[") > -1 && typeSimple.IndexOf("]") > -1) + { typeSimple = typeSimple.Replace("[", "").Replace("]", "") + "[]"; + } if (typeSimple.StartsWith("Volo.Abp")) { @@ -382,14 +402,14 @@ namespace Volo.Abp.Cli.Commands typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); } - modelFileText.AppendLine(string.Format(" {0}: {1};", propertyName, typeSimple)); + modelFileText.AppendLine($" {propertyName}: {typeSimple};"); } modelFileText.AppendLine(""); - modelFileText.AppendLine(string.Format(" constructor(initialValues: Partial<{0}> = {{}}) {{", typeName)); + modelFileText.AppendLine($" constructor(initialValues: Partial<{typeName}> = {{}}) {{"); - if (!string.IsNullOrWhiteSpace(baseType)) + if (!IsNullOrWhiteSpace(baseType)) { modelFileText.AppendLine(" super(initialValues);"); modelFileText.AppendLine(" }"); @@ -410,7 +430,7 @@ namespace Volo.Abp.Cli.Commands modelFileText.AppendLine("}"); } - System.IO.File.WriteAllText(string.Format("src/app/{0}/shared/models/{1}", rootPath, typeModelName), modelFileText.ToString()); + File.WriteAllText($"src/app/{rootPath}/shared/models/{typeModelName}", modelFileText.ToString()); return typeModelName.Replace(".ts", ""); } @@ -478,7 +498,7 @@ namespace Volo.Abp.Cli.Commands { public static string PascalToKebabCase(this string value) { - if (string.IsNullOrEmpty(value)) + if (IsNullOrEmpty(value)) return value; return Regex.Replace( From 88df0a3e37cdb6d4beba2cdc6def6ebfc3782b74 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Mon, 13 Jan 2020 15:16:46 +0300 Subject: [PATCH 11/52] Generate proxy command bug fix --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index 61cd20b0be..5c113a2a74 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -53,43 +53,41 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Modules are combining"); var moduleList = GetCombinedModules(data); - Logger.LogInformation("Modules and types are creating"); - - var serviceIndexList = new List(); - var modelIndexList = new List(); + Logger.LogInformation("Modules and types are creating"); foreach (var module in moduleList) { var moduleValue = JObject.Parse(module.Value); var rootPath = module.Key; - var controllerName = ""; - var controllerServiceName = ""; Logger.LogInformation($"{rootPath} directory is creating"); Directory.CreateDirectory($"src/app/{rootPath}/shared/models"); Directory.CreateDirectory($"src/app/{rootPath}/shared/services"); - var serviceFileText = new StringBuilder(); - - serviceFileText.AppendLine("[firstTypeList]"); - serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); - serviceFileText.AppendLine("import { Observable } from 'rxjs';"); - serviceFileText.AppendLine("[secondTypeList]"); - serviceFileText.AppendLine(""); - serviceFileText.AppendLine("@Injectable()"); - serviceFileText.AppendLine("export class [controllerName]Service {"); - serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); - serviceFileText.AppendLine(""); - - var firstTypeList = new List(); - var secondTypeList = new List(); + var serviceIndexList = new List(); + var modelIndexList = new List(); foreach (var controller in moduleValue.Root.ToList().Select(item => item.First)) { - controllerName = (string)controller["controllerName"]; - controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + var serviceFileText = new StringBuilder(); + + serviceFileText.AppendLine("[firstTypeList]"); + serviceFileText.AppendLine("import { Injectable } from '@angular/core';"); + serviceFileText.AppendLine("import { Observable } from 'rxjs';"); + serviceFileText.AppendLine("[secondTypeList]"); + serviceFileText.AppendLine(""); + serviceFileText.AppendLine("@Injectable()"); + serviceFileText.AppendLine("export class [controllerName]Service {"); + serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); + serviceFileText.AppendLine(""); + + var firstTypeList = new List(); + var secondTypeList = new List(); + + var controllerName = (string)controller["controllerName"]; + var controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; foreach (var actionItem in controller["actions"]) { @@ -221,38 +219,38 @@ namespace Volo.Abp.Cli.Commands } serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); - } - if (firstTypeList != null && firstTypeList.Count > 0) - { - var firstTypeListDistinct = ", " + Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("[firstTypeList]", - $"import {{ RestService {firstTypeListDistinct}}} from '@abp/ng.core';"); - } - else - { - serviceFileText.Replace("[firstTypeList]", ""); - } + if (firstTypeList != null && firstTypeList.Count > 0) + { + var firstTypeListDistinct = ", " + Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("[firstTypeList]", + $"import {{ RestService {firstTypeListDistinct}}} from '@abp/ng.core';"); + } + else + { + serviceFileText.Replace("[firstTypeList]", ""); + } - if (secondTypeList != null && secondTypeList.Count > 0) - { - var secondTypeListDistinct = Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); - serviceFileText.Replace("[secondTypeList]", - $"import {{{secondTypeListDistinct}}} from '../models';"); - } - else - { - serviceFileText.Replace("[secondTypeList]", ""); - } + if (secondTypeList != null && secondTypeList.Count > 0) + { + var secondTypeListDistinct = Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); + serviceFileText.Replace("[secondTypeList]", + $"import {{{secondTypeListDistinct}}} from '../models';"); + } + else + { + serviceFileText.Replace("[secondTypeList]", ""); + } - serviceFileText.AppendLine("}"); + serviceFileText.AppendLine("}"); - serviceFileText.Replace("[controllerName]", controllerName); - File.WriteAllText($"src/app/{rootPath}/shared/services/{controllerServiceName}", serviceFileText.ToString()); + serviceFileText.Replace("[controllerName]", controllerName); + File.WriteAllText($"src/app/{rootPath}/shared/services/{controllerServiceName}", serviceFileText.ToString()); + } var serviceIndexFileText = new StringBuilder(); - foreach (var serviceIndexItem in serviceIndexList) + foreach (var serviceIndexItem in serviceIndexList.Distinct()) { serviceIndexFileText.AppendLine($"export * from './{serviceIndexItem}';"); } @@ -261,7 +259,7 @@ namespace Volo.Abp.Cli.Commands var modelIndexFileText = new StringBuilder(); - foreach (var modelIndexItem in modelIndexList) + foreach (var modelIndexItem in modelIndexList.Distinct()) { modelIndexFileText.AppendLine($"export * from './{modelIndexItem}';"); } From f87e96ed75386c54cd84f9da7d4d68352567052e Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Thu, 16 Jan 2020 11:46:17 +0300 Subject: [PATCH 12/52] generate proxy command clean up --- .../Volo/Abp/Cli/Commands/GenerateProxyCommand.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index 5c113a2a74..00980e6ac6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -1,21 +1,15 @@ using System; using System.IO; -using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; -using ICSharpCode.SharpZipLib.Core; -using ICSharpCode.SharpZipLib.Zip; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Volo.Abp.Cli.Args; using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding.Building; -using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; -using Microsoft.CSharp; using System.Collections.Generic; using System.Linq; using static System.String; @@ -497,7 +491,9 @@ namespace Volo.Abp.Cli.Commands public static string PascalToKebabCase(this string value) { if (IsNullOrEmpty(value)) + { return value; + } return Regex.Replace( value, From 387142a8752e20d771ac25346d37b8931d91c800 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Fri, 17 Jan 2020 17:05:35 +0300 Subject: [PATCH 13/52] GPC recursive create type & code cleanup --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 243 +++++++++++++----- 1 file changed, 181 insertions(+), 62 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index 00980e6ac6..877f2786ce 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -11,8 +11,7 @@ using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.DependencyInjection; using System.Collections.Generic; -using System.Linq; -using static System.String; +using System.Linq; namespace Volo.Abp.Cli.Commands { @@ -32,7 +31,7 @@ namespace Volo.Abp.Cli.Commands public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { var apiUrl = commandLineArgs.Options.GetOrNull(Options.ApiUrl.Short, Options.ApiUrl.Long); - var uiFramework = GetUiFramework(commandLineArgs); + var uiFramework = GetUiFramework(commandLineArgs); //WebClient client = new WebClient(); //string json = client.DownloadString(apiUrl); @@ -42,16 +41,16 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Downloading api definition..."); Logger.LogInformation("Api Url: " + apiUrl); - var data = JObject.Parse(json); + var data = JObject.Parse(json); - Logger.LogInformation("Modules are combining"); + Logger.LogInformation("Modules are combining"); var moduleList = GetCombinedModules(data); - - Logger.LogInformation("Modules and types are creating"); - + + Logger.LogInformation("Modules and types are creating"); + foreach (var module in moduleList) { - var moduleValue = JObject.Parse(module.Value); + var moduleValue = JObject.Parse(module.Value); var rootPath = module.Key; @@ -78,10 +77,10 @@ namespace Volo.Abp.Cli.Commands serviceFileText.AppendLine(""); var firstTypeList = new List(); - var secondTypeList = new List(); + var secondTypeList = new List(); var controllerName = (string)controller["controllerName"]; - var controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; + var controllerServiceName = controllerName.PascalToKebabCase() + ".service.ts"; foreach (var actionItem in controller["actions"]) { @@ -98,37 +97,39 @@ namespace Volo.Abp.Cli.Commands var bodyExtra = ""; var modelBindingExtra = ""; var modelBindingExtraList = new List(); + var parameterModel = new List(); - foreach (var parameter in parameters) + foreach (var parameter in parameters.OrderBy(p => p["bindingSourceId"])) { - parametersIndex++; + var bindingSourceId = (string)parameter["bindingSourceId"]; + bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); + + var name = (string)parameter["name"]; + var typeSimple = (string)parameter["typeSimple"]; + var typeArray = ((string)parameter["type"]).Split("."); + var type = typeArray[typeArray.Length - 1]; + var isOptional = (bool)parameter["isOptional"]; + var defaultValue = (string)parameter["defaultValue"]; - if (parametersIndex > 1) + + var modelIndex = CreateType(data, (string)parameter["type"], rootPath, modelIndexList); + + if (!string.IsNullOrWhiteSpace(modelIndex)) { - parametersText.Append(", "); + modelIndexList.Add(modelIndex); } - var bindingSourceId = (string)parameter["bindingSourceId"]; - bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); - if (bindingSourceId == "body") { bodyExtra = ", body"; - var typeArray = ((string)parameter["type"]).Split("."); - var type = typeArray[typeArray.Length - 1]; - - parametersText.Append(bindingSourceId + ": " + type); - secondTypeList.Add(type); + parameterModel = AddParameter(bindingSourceId, type, isOptional, defaultValue, bindingSourceId, parameterModel); } else if (bindingSourceId == "path") { - parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); + parameterModel = AddParameter(name, typeSimple, isOptional, defaultValue, bindingSourceId, parameterModel); } else if (bindingSourceId == "modelBinding") { - var typeSimple = ""; - var type = ""; - var parameterNameOnMethod = (string)parameter["nameOnMethod"]; var parametersOnMethod = action["parametersOnMethod"]; @@ -138,18 +139,26 @@ namespace Volo.Abp.Cli.Commands if (parametersOnMethodName == parameterNameOnMethod) { typeSimple = (string)parameterOnMethod["typeSimple"]; - - var typeArray = ((string)parameterOnMethod["type"]).Split("."); + typeArray = ((string)parameterOnMethod["type"]).Split("."); type = typeArray[typeArray.Length - 1]; + isOptional = (bool)parameterOnMethod["isOptional"]; + defaultValue = (string)parameterOnMethod["defaultValue"]; + + if (typeSimple == "string" || typeSimple == "boolean" || typeSimple == "number") + { + parameterModel = AddParameter(name, typeSimple, isOptional, defaultValue, bindingSourceId, parameterModel); + } + + modelIndex = CreateType(data, (string)parameterOnMethod["type"], rootPath, modelIndexList); + + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + modelIndexList.Add(modelIndex); + } } } - if (typeSimple == "string" || typeSimple == "boolean" || typeSimple == "number") - { - parametersText.Append((string)parameter["name"] + ": " + (string)parameter["typeSimple"]); - modelBindingExtraList.Add((string)parameter["name"]); - } - else + if (typeSimple != "string" && typeSimple != "boolean" && typeSimple != "number") { parametersText.Append($"params = {{}} as {type}"); modelBindingExtra = ", params"; @@ -159,6 +168,30 @@ namespace Volo.Abp.Cli.Commands } } + if (parameterModel != null && parameterModel.Count > 0) + { + foreach (var parameterItem in parameterModel.OrderBy(p => p.DisplayOrder)) + { + parametersIndex++; + + if (parametersIndex > 1) + { + parametersText.Append(", "); + } + + parametersText.Append(parameterItem.Name + (parameterItem.IsOptional ? "?" : "") + ": " + parameterItem.Type + (parameterItem.Value != null ? (" = " + (string.IsNullOrWhiteSpace(parameterItem.Value) ? "''" : parameterItem.Value)) : "")); + + if (parameterItem.BindingSourceId == "modelBinding") + { + modelBindingExtraList.Add(parameterItem.Name); + } + else if (parameterItem.BindingSourceId == "body") + { + secondTypeList.Add(parameterItem.Type); + } + } + } + if (returnValueType != null) { if (returnValueType.IndexOf('<') > -1) @@ -170,9 +203,14 @@ namespace Volo.Abp.Cli.Commands var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); serviceFileText.AppendLine( - $" {actionName}({parametersText}): Observable<{firstType}<{secondType}>> {{"); + firstType == "List" + ? $" {actionName}({parametersText}): Observable<{secondType}[]> {{" + : $" {actionName}({parametersText}): Observable<{firstType}<{secondType}>> {{"); - firstTypeList.Add(firstType); + if (firstType != "List") + { + firstTypeList.Add(firstType); + } secondTypeList.Add(secondType); } else @@ -180,20 +218,26 @@ namespace Volo.Abp.Cli.Commands var typeArray = returnValueType.Split("."); var type = typeArray[typeArray.Length - 1].TrimEnd('>'); - if (type == "Void") + type = type switch { - type = "void"; - } + "Void" => "void", + "String" => "string", + "IActionResult" => "void", + _ => type + }; serviceFileText.AppendLine( $" {actionName}({parametersText}): Observable<{type}> {{"); - secondTypeList.Add(type); + if (type != "void" && type != "string") + { + secondTypeList.Add(type); + } } - var modelIndex = CreateType(data, returnValueType, rootPath); + var modelIndex = CreateType(data, returnValueType, rootPath, modelIndexList); - if (!IsNullOrWhiteSpace(modelIndex)) + if (!string.IsNullOrWhiteSpace(modelIndex)) { modelIndexList.Add(modelIndex); } @@ -201,33 +245,38 @@ namespace Volo.Abp.Cli.Commands if (modelBindingExtraList != null && modelBindingExtraList.Count > 0) { - modelBindingExtra = ", params: { " + Join(", ", modelBindingExtraList.ToArray()) + " }"; + modelBindingExtra = ", params: { " + string.Join(", ", modelBindingExtraList.ToArray()) + " }"; } var url = ((string)action["url"]).Replace("/{", "/${"); var httpMethod = (string)action["httpMethod"]; + serviceFileText.AppendLine( - $" return this.restService.request({{ url: '/{url}', method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});"); + url.Contains("${") + ? $" return this.restService.request({{ url: `/{url}`, method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});" + : $" return this.restService.request({{ url: '/{url}', method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});"); + serviceFileText.AppendLine(" }"); - } + } serviceIndexList.Add(controllerServiceName.Replace(".ts", "")); if (firstTypeList != null && firstTypeList.Count > 0) { - var firstTypeListDistinct = ", " + Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); + var firstTypeListDistinct = ", " + string.Join(", ", firstTypeList.Where(p => p != "void").Distinct().ToArray()); serviceFileText.Replace("[firstTypeList]", $"import {{ RestService {firstTypeListDistinct}}} from '@abp/ng.core';"); } else { - serviceFileText.Replace("[firstTypeList]", ""); + serviceFileText.Replace("[firstTypeList]", + $"import {{ RestService }} from '@abp/ng.core';"); } if (secondTypeList != null && secondTypeList.Count > 0) { - var secondTypeListDistinct = Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); + var secondTypeListDistinct = string.Join(", ", secondTypeList.Where(p => p != "void").Distinct().ToArray()); serviceFileText.Replace("[secondTypeList]", $"import {{{secondTypeListDistinct}}} from '../models';"); } @@ -240,7 +289,7 @@ namespace Volo.Abp.Cli.Commands serviceFileText.Replace("[controllerName]", controllerName); File.WriteAllText($"src/app/{rootPath}/shared/services/{controllerServiceName}", serviceFileText.ToString()); - } + } var serviceIndexFileText = new StringBuilder(); @@ -284,10 +333,15 @@ namespace Volo.Abp.Cli.Commands return moduleList; } - private string CreateType(JObject data, string returnValueType, string rootPath) - { + private static string CreateType(JObject data, string returnValueType, string rootPath, List modelIndexList) + { var type = data["types"][returnValueType]; + if (type == null) + { + return null; + } + if (returnValueType.StartsWith("Volo.Abp.Application.Dtos") || returnValueType.StartsWith("System.Collections") || returnValueType == "System.String" @@ -311,20 +365,24 @@ namespace Volo.Abp.Cli.Commands return null; } - var modelFileText = new StringBuilder(); + var modelFileText = new StringBuilder(); var baseType = (string)type["baseType"]; var extends = ""; + var customBaseTypeName = ""; - if (!IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") + if (!string.IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") { var baseTypeSplit = baseType.Split("."); var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1].Replace("<", "").Replace(">", ""); var baseTypeKebabCase = "./" + baseTypeName.PascalToKebabCase(); - if (baseType.Contains("Volo.Abp.Application.Dtos.EntityDto")) + if (baseType.Contains("Volo.Abp.Application.Dtos")) { baseTypeKebabCase = "@abp/ng.core"; + + baseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Split("<")[0].TrimStart('.'); + customBaseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Replace("System.Guid", "string").TrimStart('.'); } if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) @@ -333,25 +391,26 @@ namespace Volo.Abp.Cli.Commands } modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); - extends = "extends " + baseTypeName; + extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName); } - if (baseType == "System.Enum" && (string)type.First["isEnum"] == "True") + if (baseType == "System.Enum" && (bool)type["isEnum"]) { modelFileText.AppendLine($"export enum {typeName} {{"); - var enumNameList = type.First["enumNames"].ToArray(); - var enumValueList = type.First["enumValues"].ToArray(); + var enumNameList = type["enumNames"].ToArray(); + var enumValueList = type["enumValues"].ToArray(); for (var i = 0; i < enumNameList.Length; i++) { - modelFileText.AppendLine($"{enumNameList[i]} = {enumValueList[i]},"); + modelFileText.AppendLine($" {enumNameList[i]} = {enumValueList[i]},"); } modelFileText.AppendLine("}"); } else { + modelFileText.AppendLine(""); modelFileText.AppendLine($"export class {typeName} {extends} {{"); foreach (var property in type["properties"]) @@ -359,6 +418,18 @@ namespace Volo.Abp.Cli.Commands var propertyName = (string)property["name"]; propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); + var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList); + + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + var propertyTypeSplit = ((string)property["type"]).Split("."); + var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1]; + modelFileText.Insert(0,""); + modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); + modelFileText.Insert(0, ""); + modelIndexList.Add(modelIndex); + } + var typeSimple = (string)property["typeSimple"]; if (typeSimple.IndexOf("[") > -1 && typeSimple.IndexOf("]") > -1) @@ -401,7 +472,7 @@ namespace Volo.Abp.Cli.Commands modelFileText.AppendLine($" constructor(initialValues: Partial<{typeName}> = {{}}) {{"); - if (!IsNullOrWhiteSpace(baseType)) + if (!string.IsNullOrWhiteSpace(baseType)) { modelFileText.AppendLine(" super(initialValues);"); modelFileText.AppendLine(" }"); @@ -427,6 +498,44 @@ namespace Volo.Abp.Cli.Commands return typeModelName.Replace(".ts", ""); } + private static List AddParameter(string parameterName, string type, bool parameterIsOptional, string parameterDefaultValue, string bindingSourceId, List parameterModel) + { + if (parameterDefaultValue != "null") + { + parameterModel.Add(new ParameterModel + { + DisplayOrder = 3, + Name = parameterName, + Type = type, + Value = parameterDefaultValue, + BindingSourceId = bindingSourceId + }); + } + else if (parameterDefaultValue == "null" && parameterIsOptional) + { + parameterModel.Add(new ParameterModel + { + DisplayOrder = 2, + Name = parameterName, + IsOptional = true, + Type = type, + BindingSourceId = bindingSourceId + }); + } + else + { + parameterModel.Add(new ParameterModel + { + DisplayOrder = 1, + Name = parameterName, + Type = type, + BindingSourceId = bindingSourceId + }); + } + + return parameterModel; + } + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -490,7 +599,7 @@ namespace Volo.Abp.Cli.Commands { public static string PascalToKebabCase(this string value) { - if (IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { return value; } @@ -504,4 +613,14 @@ namespace Volo.Abp.Cli.Commands .ToLower(); } } + + public class ParameterModel + { + public int DisplayOrder { get; set; } + public string Name { get; set; } + public string Value { get; set; } + public string Type { get; set; } + public bool IsOptional { get; set; } + public string BindingSourceId { get; set; } + } } \ No newline at end of file From 746deb05b2c62345eb9d86de9d5b44965a150b63 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Wed, 12 Feb 2020 13:25:29 +0300 Subject: [PATCH 14/52] GenerateProxyCommand create type bug fix --- .../Volo/Abp/Cli/Commands/GenerateProxyCommand.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index 877f2786ce..e16f2c6c64 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -334,7 +334,7 @@ namespace Volo.Abp.Cli.Commands } private static string CreateType(JObject data, string returnValueType, string rootPath, List modelIndexList) - { + { var type = data["types"][returnValueType]; if (type == null) @@ -388,10 +388,16 @@ namespace Volo.Abp.Cli.Commands if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) { baseTypeName = "string"; - } + } modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName); + + var modelIndex = CreateType(data, baseType, rootPath, modelIndexList); + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + modelIndexList.Add(modelIndex); + } } if (baseType == "System.Enum" && (bool)type["isEnum"]) @@ -421,11 +427,11 @@ namespace Volo.Abp.Cli.Commands var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList); if (!string.IsNullOrWhiteSpace(modelIndex)) - { + { var propertyTypeSplit = ((string)property["type"]).Split("."); var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1]; modelFileText.Insert(0,""); - modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); + modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); modelFileText.Insert(0, ""); modelIndexList.Add(modelIndex); } From 5d567e02a62234ff82872be7a418d4c7a7a64a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 7 Mar 2020 08:30:17 +0300 Subject: [PATCH 15/52] Increment version to 2.2.1. --- common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.props b/common.props index 6f12895d7c..96415d3e4c 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 2.2.0 + 2.2.1 $(NoWarn);CS1591 https://abp.io/assets/abp_nupkg.png https://abp.io From e87ae5a2d574a51844cc7b2ca7c83b8dee5ba4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 9 Mar 2020 10:20:55 +0300 Subject: [PATCH 16/52] Add Volo.Abp.Quartz to nuget package list --- nupkg/common.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index af62eb56ed..ea84e52b28 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -92,6 +92,7 @@ $projects = ( "framework/src/Volo.Abp.MultiTenancy", "framework/src/Volo.Abp.Minify", "framework/src/Volo.Abp.ObjectMapping", + "framework/src/Volo.Abp.Quartz", "framework/src/Volo.Abp.RabbitMQ", "framework/src/Volo.Abp.Security", "framework/src/Volo.Abp.Serialization", From d19171d7bd9500934bcdad2761c9403ec2df4ba3 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Tue, 17 Mar 2020 12:08:46 +0300 Subject: [PATCH 17/52] types' basetype properties removed --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 167 ++++++++++++------ .../Properties/launchSettings.json | 5 +- .../Volo.Abp.Core/System/AbpTypeExtensions.cs | 5 + .../MethodParameterApiDescriptionModel.cs | 9 +- 4 files changed, 128 insertions(+), 58 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index e16f2c6c64..b792e591c6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -11,12 +11,14 @@ using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.DependencyInjection; using System.Collections.Generic; -using System.Linq; +using System.Linq; +using System.Net; namespace Volo.Abp.Cli.Commands { public class GenerateProxyCommand : IConsoleCommand, ITransientDependency { + public static Dictionary> propertyList = new Dictionary>(); public ILogger Logger { get; set; } protected TemplateProjectBuilder TemplateProjectBuilder { get; } @@ -30,13 +32,34 @@ namespace Volo.Abp.Cli.Commands public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { + var angularPath = $"angular.json"; + if (!File.Exists(angularPath)) + { + throw new CliUsageException( + "angular.json file not found. You must run this command in angular folder." + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); + } + + var module = commandLineArgs.Options.GetOrNull(Options.Module.Short, Options.Module.Long); + module = module == null ? "app" : module.ToLower(); + var apiUrl = commandLineArgs.Options.GetOrNull(Options.ApiUrl.Short, Options.ApiUrl.Long); + if (string.IsNullOrWhiteSpace(apiUrl)) + { + var environmentJson = File.ReadAllText("src/environments/environment.ts").Split("export const environment = ")[1].Replace(";", " "); + var environment = JObject.Parse(environmentJson); + apiUrl = environment["apis"]["default"]["url"].ToString(); + } + apiUrl += "/api/abp/api-definition?IncludeTypes=true"; + var uiFramework = GetUiFramework(commandLineArgs); - //WebClient client = new WebClient(); - //string json = client.DownloadString(apiUrl); - var sr = File.OpenText("api-definition.json"); - var json = sr.ReadToEnd(); + WebClient client = new WebClient(); + string json = client.DownloadString(apiUrl); + //var sr = File.OpenText("api-definition.json"); + //var json = sr.ReadToEnd(); Logger.LogInformation("Downloading api definition..."); Logger.LogInformation("Api Url: " + apiUrl); @@ -44,15 +67,24 @@ namespace Volo.Abp.Cli.Commands var data = JObject.Parse(json); Logger.LogInformation("Modules are combining"); - var moduleList = GetCombinedModules(data); + var moduleList = GetCombinedModules(data, module); + + if (moduleList.Count < 1) + { + throw new CliUsageException( + "Module can not find!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); + } Logger.LogInformation("Modules and types are creating"); - foreach (var module in moduleList) + foreach (var moduleItem in moduleList) { - var moduleValue = JObject.Parse(module.Value); + var moduleValue = JObject.Parse(moduleItem.Value); - var rootPath = module.Key; + var rootPath = moduleItem.Key; Logger.LogInformation($"{rootPath} directory is creating"); @@ -111,7 +143,6 @@ namespace Volo.Abp.Cli.Commands var isOptional = (bool)parameter["isOptional"]; var defaultValue = (string)parameter["defaultValue"]; - var modelIndex = CreateType(data, (string)parameter["type"], rootPath, modelIndexList); if (!string.IsNullOrWhiteSpace(modelIndex)) @@ -311,30 +342,36 @@ namespace Volo.Abp.Cli.Commands } } - private Dictionary GetCombinedModules(JToken data) + private Dictionary GetCombinedModules(JToken data, string module) { var moduleList = new Dictionary(); - foreach (var module in data["modules"]) + + foreach (var moduleItem in data["modules"]) { - var rootPath = ((string)module.First["rootPath"]).ToLower(); + var rootPath = ((string)moduleItem.First["rootPath"]).ToLower(); if (moduleList.Any(p => p.Key == rootPath)) { var value = moduleList[rootPath]; - moduleList[rootPath] = value.TrimEnd('}') + "," + module.First["controllers"].ToString().TrimStart('{'); + moduleList[rootPath] = value.TrimEnd('}') + "," + moduleItem.First["controllers"].ToString().TrimStart('{'); } else { - moduleList.Add(rootPath, module.First["controllers"].ToString()); + moduleList.Add(rootPath, moduleItem.First["controllers"].ToString()); } } + if (module != "all") + { + moduleList = moduleList.Where(p => p.Key.ToLower() == module).ToDictionary(p => p.Key, s => s.Value); + } + return moduleList; } private static string CreateType(JObject data, string returnValueType, string rootPath, List modelIndexList) - { + { var type = data["types"][returnValueType]; if (type == null) @@ -357,46 +394,46 @@ namespace Volo.Abp.Cli.Commands var typeNameSplit = returnValueType.Split("."); var typeName = typeNameSplit[typeNameSplit.Length - 1]; - var typeModelName = typeName.Replace("<", "").Replace(">", "").PascalToKebabCase() + ".ts"; + var typeModelName = typeName.Replace("<", "").Replace(">", "").PascalToKebabCase() + ".ts"; - var path = $"src/app/{rootPath}/shared/models/{typeModelName}"; - if (File.Exists(path)) - { - return null; - } + var path = $"src/app/{rootPath}/shared/models/{typeModelName}"; var modelFileText = new StringBuilder(); var baseType = (string)type["baseType"]; var extends = ""; var customBaseTypeName = ""; + var baseTypeName = ""; - if (!string.IsNullOrWhiteSpace(baseType) && baseType != "System.Enum") + if (!string.IsNullOrWhiteSpace(baseType)) { var baseTypeSplit = baseType.Split("."); - var baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1].Replace("<", "").Replace(">", ""); + baseTypeName = baseTypeSplit[baseTypeSplit.Length - 1].Replace("<", "").Replace(">", ""); var baseTypeKebabCase = "./" + baseTypeName.PascalToKebabCase(); - if (baseType.Contains("Volo.Abp.Application.Dtos")) + if (baseType != "System.Enum") { - baseTypeKebabCase = "@abp/ng.core"; + if (baseType.Contains("Volo.Abp.Application.Dtos")) + { + baseTypeKebabCase = "@abp/ng.core"; - baseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Split("<")[0].TrimStart('.'); - customBaseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Replace("System.Guid", "string").TrimStart('.'); - } + baseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Split("<")[0].TrimStart('.'); + customBaseTypeName = baseType.Split("Volo.Abp.Application.Dtos")[1].Replace("System.Guid", "string").TrimStart('.'); + } - if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) - { - baseTypeName = "string"; - } + if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) + { + baseTypeName = "string"; + } - modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); - extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName); + modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); + extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName); - var modelIndex = CreateType(data, baseType, rootPath, modelIndexList); - if (!string.IsNullOrWhiteSpace(modelIndex)) - { - modelIndexList.Add(modelIndex); + var modelIndex = CreateType(data, baseType, rootPath, modelIndexList); + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + modelIndexList.Add(modelIndex); + } } } @@ -422,21 +459,14 @@ namespace Volo.Abp.Cli.Commands foreach (var property in type["properties"]) { var propertyName = (string)property["name"]; - propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); - - var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList); - - if (!string.IsNullOrWhiteSpace(modelIndex)) + if (propertyName == "RoleNames") { - var propertyTypeSplit = ((string)property["type"]).Split("."); - var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1]; - modelFileText.Insert(0,""); - modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); - modelFileText.Insert(0, ""); - modelIndexList.Add(modelIndex); + } + propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); + var typeSimple = (string)property["typeSimple"]; - var typeSimple = (string)property["typeSimple"]; + var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList); if (typeSimple.IndexOf("[") > -1 && typeSimple.IndexOf("]") > -1) { @@ -471,6 +501,32 @@ namespace Volo.Abp.Cli.Commands typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); } + if (propertyList.Any(p => p.Key == baseTypeName && p.Value.Any(q => q.Key == propertyName && q.Value == typeSimple))) + { + continue; + } + + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + var propertyTypeSplit = ((string)property["type"]).Split("."); + var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1]; + modelFileText.Insert(0, ""); + modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); + modelFileText.Insert(0, ""); + modelIndexList.Add(modelIndex); + } + + if (propertyList.Any(p => p.Key == typeName && !p.Value.Any(q => q.Key == propertyName))) + { + propertyList[typeName].Add(propertyName, typeSimple); + } + else if (!propertyList.Any(p => p.Key == typeName)) + { + var newProperty = new Dictionary(); + newProperty.Add(propertyName, typeSimple); + propertyList.Add(typeName, newProperty); + } + modelFileText.AppendLine($" {propertyName}: {typeSimple};"); } @@ -554,10 +610,11 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("Options:"); sb.AppendLine(""); sb.AppendLine("-u|--ui (default: angular)"); + sb.AppendLine("-m|--module (default: app)"); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); - sb.AppendLine(" abp new --apiUrl https://www.abp.io/api/abp/api-definition?types=true"); + sb.AppendLine(" abp new --apiUrl https://www.abp.io"); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -587,6 +644,12 @@ namespace Volo.Abp.Cli.Commands public static class Options { + public static class Module + { + public const string Short = "m"; + public const string Long = "module"; + } + public static class ApiUrl { public const string Short = "au"; diff --git a/framework/src/Volo.Abp.Cli/Properties/launchSettings.json b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json index 4182e562b2..b089ad5d59 100644 --- a/framework/src/Volo.Abp.Cli/Properties/launchSettings.json +++ b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json @@ -1,9 +1,8 @@ { "profiles": { - "Volo.Abp.Cli": { + "Volo.Abp.Cli": { "commandName": "Project", - "commandLineArgs": "generate-proxy --apiUrl https://www.abp.io/api/abp/api-definition?types=true -u angular" - "commandName": "Project" + "commandLineArgs": "generate-proxy -u angular -m all" } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs index fe23c77530..e7c600eff6 100644 --- a/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpTypeExtensions.cs @@ -6,6 +6,11 @@ namespace System { public static class AbpTypeExtensions { + public static string GetFullNameWithAssemblyName(this Type type) + { + return type.FullName + ", " + type.Assembly.GetName().Name; + } + /// /// Determines whether an instance of this type can be assigned to /// an instance of the . diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs index 47145adaaf..4199e29ec0 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs @@ -8,6 +8,8 @@ namespace Volo.Abp.Http.Modeling { public string Name { get; set; } + public string TypeAsString { get; set; } + public string Type { get; set; } public string TypeSimple { get; set; } @@ -18,7 +20,7 @@ namespace Volo.Abp.Http.Modeling private MethodParameterApiDescriptionModel() { - + } public static MethodParameterApiDescriptionModel Create(ParameterInfo parameterInfo) @@ -26,8 +28,9 @@ namespace Volo.Abp.Http.Modeling return new MethodParameterApiDescriptionModel { Name = parameterInfo.Name, - Type = ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType), - TypeSimple = ModelingTypeHelper.GetSimplifiedName(parameterInfo.ParameterType), + TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(), + Type = parameterInfo.ParameterType != null ? ModelingTypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType) : null, + TypeSimple = parameterInfo.ParameterType != null ? ModelingTypeHelper.GetSimplifiedName(parameterInfo.ParameterType) : null, IsOptional = parameterInfo.IsOptional, DefaultValue = parameterInfo.HasDefaultValue ? parameterInfo.DefaultValue : null }; From 774e8cf9e223aec6e9f861918a1541cbeebdaaba Mon Sep 17 00:00:00 2001 From: Mehmet Erim <34455572+mehmet-erim@users.noreply.github.com> Date: Wed, 18 Mar 2020 11:07:14 +0300 Subject: [PATCH 18/52] Update index.ts --- npm/ng-packs/packages/core/src/lib/models/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/index.ts b/npm/ng-packs/packages/core/src/lib/models/index.ts index e33f5d52dd..4d4ed321c4 100644 --- a/npm/ng-packs/packages/core/src/lib/models/index.ts +++ b/npm/ng-packs/packages/core/src/lib/models/index.ts @@ -1,6 +1,7 @@ export * from './application-configuration'; export * from './common'; -export * from './config'; +export * from './config'; +export * from './dtos'; export * from './profile'; export * from './replaceable-components'; export * from './rest'; From 91a169bd3f969e755b8a3446a44e6f6cf234520a Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Wed, 18 Mar 2020 11:11:03 +0300 Subject: [PATCH 19/52] generate proxy bug fixes --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index b792e591c6..b5c6ab1bf2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -103,7 +103,7 @@ namespace Volo.Abp.Cli.Commands serviceFileText.AppendLine("import { Observable } from 'rxjs';"); serviceFileText.AppendLine("[secondTypeList]"); serviceFileText.AppendLine(""); - serviceFileText.AppendLine("@Injectable()"); + serviceFileText.AppendLine("@Injectable({providedIn: 'root'})"); serviceFileText.AppendLine("export class [controllerName]Service {"); serviceFileText.AppendLine(" constructor(private restService: RestService) {}"); serviceFileText.AppendLine(""); @@ -193,7 +193,13 @@ namespace Volo.Abp.Cli.Commands { parametersText.Append($"params = {{}} as {type}"); modelBindingExtra = ", params"; - secondTypeList.Add(type); + if (!string.IsNullOrWhiteSpace(modelIndex)) + { + secondTypeList.Add(type); + } + else { + firstTypeList.Add(type); + } break; } } @@ -254,6 +260,7 @@ namespace Volo.Abp.Cli.Commands "Void" => "void", "String" => "string", "IActionResult" => "void", + "ActionResult" => "void", _ => type }; @@ -279,7 +286,7 @@ namespace Volo.Abp.Cli.Commands modelBindingExtra = ", params: { " + string.Join(", ", modelBindingExtraList.ToArray()) + " }"; } - var url = ((string)action["url"]).Replace("/{", "/${"); + var url = (((string)action["url"]).Replace("/{", "/${")).ToLower(); var httpMethod = (string)action["httpMethod"]; serviceFileText.AppendLine( @@ -384,6 +391,7 @@ namespace Volo.Abp.Cli.Commands || returnValueType == "System.String" || returnValueType == "System.Void" || returnValueType.Contains("IActionResult") + || returnValueType.Contains("ActionResult") || returnValueType.Contains("IStringValueType") || returnValueType.Contains("IValueValidator") ) @@ -459,10 +467,6 @@ namespace Volo.Abp.Cli.Commands foreach (var property in type["properties"]) { var propertyName = (string)property["name"]; - if (propertyName == "RoleNames") - { - - } propertyName = (char.ToLower(propertyName[0]) + propertyName.Substring(1)); var typeSimple = (string)property["typeSimple"]; @@ -498,7 +502,12 @@ namespace Volo.Abp.Cli.Commands && typeSimple != "number[]" ) { - typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); + var typeSimpleModelName = typeSimple.PascalToKebabCase() + ".ts"; + var modelPath = $"src/app/{rootPath}/shared/models/{typeSimpleModelName}"; + if (!File.Exists(modelPath)) + { + typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); + } } if (propertyList.Any(p => p.Key == baseTypeName && p.Value.Any(q => q.Key == propertyName && q.Value == typeSimple))) From 93ac20d4f7ddd219b64cb294eb8aff41f95d2a74 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Wed, 18 Mar 2020 12:27:10 +0300 Subject: [PATCH 20/52] Generate proxy command cli descriptions updated --- .../Volo/Abp/Cli/Commands/GenerateProxyCommand.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index b5c6ab1bf2..efde5b1074 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -614,16 +614,17 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("Usage:"); sb.AppendLine(""); - sb.AppendLine(" abp generate-proxy --apiUrl [options]"); + sb.AppendLine(" abp generate-proxy [options]"); sb.AppendLine(""); sb.AppendLine("Options:"); sb.AppendLine(""); + sb.AppendLine("-a|--apiUrl (default: environment.ts>apis>default>url)"); sb.AppendLine("-u|--ui (default: angular)"); sb.AppendLine("-m|--module (default: app)"); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); - sb.AppendLine(" abp new --apiUrl https://www.abp.io"); + sb.AppendLine(" abp generate-proxy --apiUrl https://www.volosoft.com"); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -632,7 +633,7 @@ namespace Volo.Abp.Cli.Commands public string GetShortDescription() { - return "Generates a ..."; + return "Generates typescript service proxies and DTOs"; } private UiFramework GetUiFramework(CommandLineArgs commandLineArgs) @@ -647,7 +648,7 @@ namespace Volo.Abp.Cli.Commands case "angular": return UiFramework.Angular; default: - return UiFramework.NotSpecified; + return UiFramework.Angular; } } @@ -661,7 +662,7 @@ namespace Volo.Abp.Cli.Commands public static class ApiUrl { - public const string Short = "au"; + public const string Short = "a"; public const string Long = "apiUrl"; } From 9dcf495c38c1b8d0aee56e6c6745a0a6de51d347 Mon Sep 17 00:00:00 2001 From: Arkat Erol Date: Wed, 18 Mar 2020 17:23:05 +0300 Subject: [PATCH 21/52] generate proxy bug fixes --- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 46 +++++++++++++++---- .../Properties/launchSettings.json | 3 +- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs index efde5b1074..17fe2d3781 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -121,7 +121,7 @@ namespace Volo.Abp.Cli.Commands actionName = (char.ToLower(actionName[0]) + actionName.Substring(1)).Replace("Async", "").Replace("Controller", ""); - var returnValueType = (string)action["returnValue"]["type"]; + var returnValueType = (string)action["returnValue"]["type"]; var parameters = action["parameters"]; var parametersText = new StringBuilder(); @@ -136,10 +136,10 @@ namespace Volo.Abp.Cli.Commands var bindingSourceId = (string)parameter["bindingSourceId"]; bindingSourceId = char.ToLower(bindingSourceId[0]) + bindingSourceId.Substring(1); - var name = (string)parameter["name"]; + var name = (string)parameter["name"]; var typeSimple = (string)parameter["typeSimple"]; var typeArray = ((string)parameter["type"]).Split("."); - var type = typeArray[typeArray.Length - 1]; + var type = (typeArray[typeArray.Length - 1]).TrimEnd('>'); var isOptional = (bool)parameter["isOptional"]; var defaultValue = (string)parameter["defaultValue"]; @@ -209,6 +209,13 @@ namespace Volo.Abp.Cli.Commands { foreach (var parameterItem in parameterModel.OrderBy(p => p.DisplayOrder)) { + var parameterItemModelName = parameterItem.Type.PascalToKebabCase() + ".ts"; + var parameterItemModelPath = $"src/app/{rootPath}/shared/models/{parameterItemModelName}"; + if (parameterItem.BindingSourceId == "body" && !File.Exists(parameterItemModelPath)) + { + parameterItem.Type = "any"; + } + parametersIndex++; if (parametersIndex > 1) @@ -222,7 +229,7 @@ namespace Volo.Abp.Cli.Commands { modelBindingExtraList.Add(parameterItem.Name); } - else if (parameterItem.BindingSourceId == "body") + else if (parameterItem.BindingSourceId == "body" && File.Exists(parameterItemModelPath)) { secondTypeList.Add(parameterItem.Type); } @@ -237,7 +244,14 @@ namespace Volo.Abp.Cli.Commands var firstType = firstTypeArray[firstTypeArray.Length - 1]; var secondTypeArray = returnValueType.Split("<")[1].Split("."); - var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); + var secondType = secondTypeArray[secondTypeArray.Length - 1].TrimEnd('>'); + + var secondTypeModelName = secondType.PascalToKebabCase() + ".ts"; + var secondTypeModelPath = $"src/app/{rootPath}/shared/models/{secondTypeModelName}"; + if (firstType == "List" && !File.Exists(secondTypeModelPath)) + { + secondType = "any"; + } serviceFileText.AppendLine( firstType == "List" @@ -248,7 +262,11 @@ namespace Volo.Abp.Cli.Commands { firstTypeList.Add(firstType); } - secondTypeList.Add(secondType); + + if (secondType != "any") + { + secondTypeList.Add(secondType); + } } else { @@ -286,7 +304,7 @@ namespace Volo.Abp.Cli.Commands modelBindingExtra = ", params: { " + string.Join(", ", modelBindingExtraList.ToArray()) + " }"; } - var url = (((string)action["url"]).Replace("/{", "/${")).ToLower(); + var url = ((string)action["url"]).Replace("/{", "/${"); var httpMethod = (string)action["httpMethod"]; serviceFileText.AppendLine( @@ -347,6 +365,8 @@ namespace Volo.Abp.Cli.Commands File.WriteAllText($"src/app/{rootPath}/shared/models/index.ts", modelIndexFileText.ToString()); } + + Logger.LogInformation("Completed!"); } private Dictionary GetCombinedModules(JToken data, string module) @@ -378,7 +398,7 @@ namespace Volo.Abp.Cli.Commands } private static string CreateType(JObject data, string returnValueType, string rootPath, List modelIndexList) - { + { var type = data["types"][returnValueType]; if (type == null) @@ -390,6 +410,7 @@ namespace Volo.Abp.Cli.Commands || returnValueType.StartsWith("System.Collections") || returnValueType == "System.String" || returnValueType == "System.Void" + || returnValueType.Contains("System.Net.HttpStatusCode?") || returnValueType.Contains("IActionResult") || returnValueType.Contains("ActionResult") || returnValueType.Contains("IStringValueType") @@ -402,7 +423,12 @@ namespace Volo.Abp.Cli.Commands var typeNameSplit = returnValueType.Split("."); var typeName = typeNameSplit[typeNameSplit.Length - 1]; - var typeModelName = typeName.Replace("<", "").Replace(">", "").PascalToKebabCase() + ".ts"; + if (typeName.Contains("HttpStatusCode")) + { + + } + + var typeModelName = typeName.Replace("<", "").Replace(">", "").Replace("?","").PascalToKebabCase() + ".ts"; var path = $"src/app/{rootPath}/shared/models/{typeModelName}"; @@ -503,7 +529,7 @@ namespace Volo.Abp.Cli.Commands ) { var typeSimpleModelName = typeSimple.PascalToKebabCase() + ".ts"; - var modelPath = $"src/app/{rootPath}/shared/models/{typeSimpleModelName}"; + var modelPath = $"src/app/{rootPath}/shared/models/{typeSimpleModelName}"; if (!File.Exists(modelPath)) { typeSimple = "any" + (typeSimple.Contains("[]") ? "[]" : ""); diff --git a/framework/src/Volo.Abp.Cli/Properties/launchSettings.json b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json index b089ad5d59..e7f99eea04 100644 --- a/framework/src/Volo.Abp.Cli/Properties/launchSettings.json +++ b/framework/src/Volo.Abp.Cli/Properties/launchSettings.json @@ -1,8 +1,7 @@ { "profiles": { "Volo.Abp.Cli": { - "commandName": "Project", - "commandLineArgs": "generate-proxy -u angular -m all" + "commandName": "Project" } } } \ No newline at end of file From 38059f2c358b8ae435dce04782a67705b638088f Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 18 Mar 2020 17:27:44 +0300 Subject: [PATCH 22/52] Update CmdHelper.cs --- .../Volo/Abp/Cli/Utils/CmdHelper.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs index eaaa0d442b..d969b60575 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs @@ -27,19 +27,14 @@ namespace Volo.Abp.Cli.Utils } } - public static string RunCmdAndGetOutput(string command) - { - return RunCmdAndGetOutput(command, out int _); - } - public static string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful) { - var output = RunCmdAndGetOutput(command, out int exitCode); - isExitCodeSuccessful = exitCode == SuccessfulExitCode; + var output = RunCmdAndGetOutput(command); + isExitCodeSuccessful = true; return output; } - public static string RunCmdAndGetOutput(string command, out int exitCode) + public static string RunCmdAndGetOutput(string command) { string output; @@ -65,7 +60,6 @@ namespace Volo.Abp.Cli.Utils } } - exitCode = process.ExitCode; } return output.Trim(); From 75c74f32c64d1bd4cf58a09f7c56c53264ccd733 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 18 Mar 2020 17:52:44 +0300 Subject: [PATCH 23/52] Add waitforexit (for MAC issues) --- framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs index eaaa0d442b..07052a8f48 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs @@ -65,6 +65,8 @@ namespace Volo.Abp.Cli.Utils } } + process.WaitForExit(); + exitCode = process.ExitCode; } From d7c369fe9e64d61009584bffae25918a7d2be2e2 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 18 Mar 2020 18:04:59 +0300 Subject: [PATCH 24/52] Revert "Update CmdHelper.cs" This reverts commit 38059f2c358b8ae435dce04782a67705b638088f. --- .../Volo/Abp/Cli/Utils/CmdHelper.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs index d969b60575..eaaa0d442b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs @@ -27,14 +27,19 @@ namespace Volo.Abp.Cli.Utils } } + public static string RunCmdAndGetOutput(string command) + { + return RunCmdAndGetOutput(command, out int _); + } + public static string RunCmdAndGetOutput(string command, out bool isExitCodeSuccessful) { - var output = RunCmdAndGetOutput(command); - isExitCodeSuccessful = true; + var output = RunCmdAndGetOutput(command, out int exitCode); + isExitCodeSuccessful = exitCode == SuccessfulExitCode; return output; } - public static string RunCmdAndGetOutput(string command) + public static string RunCmdAndGetOutput(string command, out int exitCode) { string output; @@ -60,6 +65,7 @@ namespace Volo.Abp.Cli.Utils } } + exitCode = process.ExitCode; } return output.Trim(); From fab5dddac03b5f22c757a0ab7631e824acd883e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 18 Mar 2020 18:17:43 +0300 Subject: [PATCH 25/52] Resolved #3189: /api/test API should be removed --- .../Controllers/TestController.cs | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Controllers/TestController.cs diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Controllers/TestController.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Controllers/TestController.cs deleted file mode 100644 index 449beaf29c..0000000000 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Controllers/TestController.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using MyCompanyName.MyProjectName.Models.Test; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace MyCompanyName.MyProjectName.Controllers -{ - [Route("api/test")] - public class TestController : MyProjectNameController - { - public TestController() - { - - } - - [HttpGet] - [Route("")] - public async Task> GetAsync() - { - return new List - { - new TestModel {Name = "John", BirthDate = new DateTime(1942, 11, 18)}, - new TestModel {Name = "Adams", BirthDate = new DateTime(1997, 05, 24)} - }; - } - } -} From dbd5b9868b7653d059188fa5bceb11122835aba5 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 18 Mar 2020 18:52:11 +0300 Subject: [PATCH 26/52] chore: remove unneccessary files --- .../lib/dist/edition.service.d.ts | 9 - .../lib/dist/edition.service.js | 39 - .../lib/dist/tenant.service.d.ts | 9 - .../lib/dist/tenant.service.js | 39 - .../client-generator/lib/src/angular.d.ts | 2 - npm/packs/client-generator/lib/src/angular.js | 81 - npm/packs/client-generator/lib/src/cli.d.ts | 1 - npm/packs/client-generator/lib/src/cli.js | 113 - npm/packs/client-generator/lib/src/index.d.ts | 2 - npm/packs/client-generator/lib/src/index.js | 24 - .../templates/angular/service-templates.d.ts | 6 - .../templates/angular/service-templates.js | 31 - .../lib/src/types/api-defination.d.ts | 52 - .../lib/src/types/api-defination.js | 2 - .../client-generator/lib/src/utils/axios.d.ts | 1 - .../client-generator/lib/src/utils/axios.js | 2128 ----------------- .../lib/src/utils/generators.d.ts | 9 - .../lib/src/utils/generators.js | 26 - .../lib/src/utils/prompt.d.ts | 2 - .../client-generator/lib/src/utils/prompt.js | 56 - .../lib/src/utils/replacer.d.ts | 1 - .../lib/src/utils/replacer.js | 6 - 22 files changed, 2639 deletions(-) delete mode 100644 npm/packs/client-generator/lib/dist/edition.service.d.ts delete mode 100644 npm/packs/client-generator/lib/dist/edition.service.js delete mode 100644 npm/packs/client-generator/lib/dist/tenant.service.d.ts delete mode 100644 npm/packs/client-generator/lib/dist/tenant.service.js delete mode 100644 npm/packs/client-generator/lib/src/angular.d.ts delete mode 100644 npm/packs/client-generator/lib/src/angular.js delete mode 100644 npm/packs/client-generator/lib/src/cli.d.ts delete mode 100644 npm/packs/client-generator/lib/src/cli.js delete mode 100644 npm/packs/client-generator/lib/src/index.d.ts delete mode 100644 npm/packs/client-generator/lib/src/index.js delete mode 100644 npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts delete mode 100644 npm/packs/client-generator/lib/src/templates/angular/service-templates.js delete mode 100644 npm/packs/client-generator/lib/src/types/api-defination.d.ts delete mode 100644 npm/packs/client-generator/lib/src/types/api-defination.js delete mode 100644 npm/packs/client-generator/lib/src/utils/axios.d.ts delete mode 100644 npm/packs/client-generator/lib/src/utils/axios.js delete mode 100644 npm/packs/client-generator/lib/src/utils/generators.d.ts delete mode 100644 npm/packs/client-generator/lib/src/utils/generators.js delete mode 100644 npm/packs/client-generator/lib/src/utils/prompt.d.ts delete mode 100644 npm/packs/client-generator/lib/src/utils/prompt.js delete mode 100644 npm/packs/client-generator/lib/src/utils/replacer.d.ts delete mode 100644 npm/packs/client-generator/lib/src/utils/replacer.js diff --git a/npm/packs/client-generator/lib/dist/edition.service.d.ts b/npm/packs/client-generator/lib/dist/edition.service.d.ts deleted file mode 100644 index 46b04c5470..0000000000 --- a/npm/packs/client-generator/lib/dist/edition.service.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { RestService } from '@abp/ng.core'; -import { Observable } from 'rxjs'; -export declare class EditionService { - private restService; - constructor(restService: RestService); - get(id: string): Observable; - getList(): Observable; - getUsageStatistics(): Observable; -} diff --git a/npm/packs/client-generator/lib/dist/edition.service.js b/npm/packs/client-generator/lib/dist/edition.service.js deleted file mode 100644 index 80e3c4c43e..0000000000 --- a/npm/packs/client-generator/lib/dist/edition.service.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var core_1 = require("@angular/core"); -var EditionService = /** @class */ (function () { - function EditionService(restService) { - this.restService = restService; - } - EditionService.prototype.get = function (id) { - return this.restService.request({ - method: 'GET', - url: "/api/saas/editions/" + id, - }); - }; - EditionService.prototype.getList = function () { - return this.restService.request({ - method: 'GET', - url: "/api/saas/editions", - }); - }; - EditionService.prototype.getUsageStatistics = function () { - return this.restService.request({ - method: 'GET', - url: "/api/saas/editions/statistics/usage-statistic", - }); - }; - EditionService = __decorate([ - core_1.Injectable({ - providedIn: 'root', - }) - ], EditionService); - return EditionService; -}()); -exports.EditionService = EditionService; diff --git a/npm/packs/client-generator/lib/dist/tenant.service.d.ts b/npm/packs/client-generator/lib/dist/tenant.service.d.ts deleted file mode 100644 index 080122bbf7..0000000000 --- a/npm/packs/client-generator/lib/dist/tenant.service.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { RestService } from '@abp/ng.core'; -import { Observable } from 'rxjs'; -export declare class TenantService { - private restService; - constructor(restService: RestService); - get(id: string): Observable; - getList(): Observable; - getDefaultConnectionString(id: string): Observable; -} diff --git a/npm/packs/client-generator/lib/dist/tenant.service.js b/npm/packs/client-generator/lib/dist/tenant.service.js deleted file mode 100644 index 31edbd99cd..0000000000 --- a/npm/packs/client-generator/lib/dist/tenant.service.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var core_1 = require("@angular/core"); -var TenantService = /** @class */ (function () { - function TenantService(restService) { - this.restService = restService; - } - TenantService.prototype.get = function (id) { - return this.restService.request({ - method: 'GET', - url: "/api/saas/tenants/" + id, - }); - }; - TenantService.prototype.getList = function () { - return this.restService.request({ - method: 'GET', - url: "/api/saas/tenants", - }); - }; - TenantService.prototype.getDefaultConnectionString = function (id) { - return this.restService.request({ - method: 'GET', - url: "/api/saas/tenants/" + id + "/default-connection-string", - }); - }; - TenantService = __decorate([ - core_1.Injectable({ - providedIn: 'root', - }) - ], TenantService); - return TenantService; -}()); -exports.TenantService = TenantService; diff --git a/npm/packs/client-generator/lib/src/angular.d.ts b/npm/packs/client-generator/lib/src/angular.d.ts deleted file mode 100644 index e49d42ec6a..0000000000 --- a/npm/packs/client-generator/lib/src/angular.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { APIDefination } from './types/api-defination'; -export declare function angular(data: APIDefination.Response, selectedModules: string[]): Promise; diff --git a/npm/packs/client-generator/lib/src/angular.js b/npm/packs/client-generator/lib/src/angular.js deleted file mode 100644 index ceff31fd14..0000000000 --- a/npm/packs/client-generator/lib/src/angular.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var service_templates_1 = require("./templates/angular/service-templates"); -var change_case_1 = __importDefault(require("change-case")); -var fs_extra_1 = __importDefault(require("fs-extra")); -var generators_1 = require("./utils/generators"); -function angular(data, selectedModules) { - return __awaiter(this, void 0, void 0, function () { - var _this = this; - return __generator(this, function (_a) { - selectedModules.forEach(function (module) { return __awaiter(_this, void 0, void 0, function () { - var element; - return __generator(this, function (_a) { - element = data.modules[module]; - (Object.keys(element.controllers) || []).forEach(function (key) { - var controller = element.controllers[key]; - var actions = element.controllers[key].actions; - var actionKeys = Object.keys(actions); - var contents = []; - actionKeys.forEach(function (key) { - var element = actions[key]; - console.log(element); - var parameters = generators_1.parseParameters(element.parameters); - switch (element.httpMethod) { - case 'GET': - contents.push(service_templates_1.ServiceTemplates.getMethodTemplate(element.name, element.url, generators_1.generateArgs(parameters), parameters)); - break; - default: - break; - } - }); - var service = service_templates_1.ServiceTemplates.classTemplate(controller.controllerName, contents.join('\n')); - fs_extra_1.default.writeFileSync("dist/" + change_case_1.default.kebabCase(controller.controllerName) + ".service.ts", service); - }); - return [2 /*return*/]; - }); - }); }); - return [2 /*return*/]; - }); - }); -} -exports.angular = angular; diff --git a/npm/packs/client-generator/lib/src/cli.d.ts b/npm/packs/client-generator/lib/src/cli.d.ts deleted file mode 100644 index 21620dda81..0000000000 --- a/npm/packs/client-generator/lib/src/cli.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function cli(program: any): Promise; diff --git a/npm/packs/client-generator/lib/src/cli.js b/npm/packs/client-generator/lib/src/cli.js deleted file mode 100644 index ca0381e84a..0000000000 --- a/npm/packs/client-generator/lib/src/cli.js +++ /dev/null @@ -1,113 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var prompt_1 = require("./utils/prompt"); -var axios_1 = require("./utils/axios"); -var ora = require("ora"); -var angular_1 = require("./angular"); -var chalk_1 = __importDefault(require("chalk")); -function cli(program) { - return __awaiter(this, void 0, void 0, function () { - var _a, loading, data, apiUrl, error_1, selection, modules, _b; - var _this = this; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - if (!(program.ui !== 'angular')) return [3 /*break*/, 2]; - _a = program; - return [4 /*yield*/, prompt_1.uiSelection(['Angular'])]; - case 1: - _a.ui = (_c.sent()).toLowerCase(); - _c.label = 2; - case 2: - loading = ora('Waiting for the API response... \n'); - loading.start(); - data = {}; - apiUrl = 'https://localhost:44305/api/abp/api-definition'; - _c.label = 3; - case 3: - _c.trys.push([3, 5, , 6]); - return [4 /*yield*/, axios_1.axiosInstance.get(apiUrl)]; - case 4: - data = (_c.sent()).data; - return [3 /*break*/, 6]; - case 5: - error_1 = _c.sent(); - console.log(chalk_1.default.red('An error occurred when fetching the ' + apiUrl)); - process.exit(1); - return [3 /*break*/, 6]; - case 6: - console.log(data); - loading.stop(); - selection = function (modules) { return __awaiter(_this, void 0, void 0, function () { - var selectedModules; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, prompt_1.moduleSelection(modules)]; - case 1: - selectedModules = (_a.sent()); - if (!!selectedModules.length) return [3 /*break*/, 3]; - console.log(chalk_1.default.red('Please select module(s)')); - return [4 /*yield*/, selection(modules)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: return [2 /*return*/, selectedModules]; - } - }); - }); }; - modules = ['saas']; - _b = program.ui; - switch (_b) { - case 'angular': return [3 /*break*/, 7]; - } - return [3 /*break*/, 9]; - case 7: return [4 /*yield*/, angular_1.angular(data, modules)]; - case 8: - _c.sent(); - return [3 /*break*/, 10]; - case 9: - process.exit(1); - _c.label = 10; - case 10: return [2 /*return*/]; - } - }); - }); -} -exports.cli = cli; diff --git a/npm/packs/client-generator/lib/src/index.d.ts b/npm/packs/client-generator/lib/src/index.d.ts deleted file mode 100644 index b7988016da..0000000000 --- a/npm/packs/client-generator/lib/src/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -export {}; diff --git a/npm/packs/client-generator/lib/src/index.js b/npm/packs/client-generator/lib/src/index.js deleted file mode 100644 index a65786ccf2..0000000000 --- a/npm/packs/client-generator/lib/src/index.js +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var chalk_1 = __importDefault(require("chalk")); -var commander_1 = __importDefault(require("commander")); -var cli_1 = require("./cli"); -var clear = require('clear'); -var figlet = require('figlet'); -clear(); -console.log(chalk_1.default.red(figlet.textSync('ABP', { horizontalLayout: 'full' }))); -commander_1.default - .version('0.0.1') - .description('ABP Client Generator') - .option('-u, --ui ', 'UI option (Angular)') - .parse(process.argv); -if (!process.argv.slice(2).length || !commander_1.default.ui || typeof commander_1.default.ui !== 'string') { - commander_1.default.outputHelp(); - process.exit(1); -} -commander_1.default.ui = commander_1.default.ui.toLowerCase(); -cli_1.cli(commander_1.default); diff --git a/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts b/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts deleted file mode 100644 index 06ffd82595..0000000000 --- a/npm/packs/client-generator/lib/src/templates/angular/service-templates.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Argument } from '../../utils/generators'; -export declare namespace ServiceTemplates { - function classTemplate(name: string, content: string): string; - function getMethodTemplate(name: string, url: string, args?: string, params?: Argument[], queryParams?: object): string; - function requestTemplate(method: string, url: string, params?: Argument[], body?: boolean, queryParams?: boolean): string; -} diff --git a/npm/packs/client-generator/lib/src/templates/angular/service-templates.js b/npm/packs/client-generator/lib/src/templates/angular/service-templates.js deleted file mode 100644 index fb3e0bd6e5..0000000000 --- a/npm/packs/client-generator/lib/src/templates/angular/service-templates.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var change_case_1 = __importDefault(require("change-case")); -var replacer_1 = require("../../utils/replacer"); -var ServiceTemplates; -(function (ServiceTemplates) { - function classTemplate(name, content) { - return "import { RestService } from '@abp/ng.core';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class " + change_case_1.default.pascalCase(name) + "Service {\n constructor(private restService: RestService) {}\n " + content + "\n}"; - } - ServiceTemplates.classTemplate = classTemplate; - function getMethodTemplate(name, url, args, params, queryParams) { - if (args === void 0) { args = ''; } - if (params === void 0) { params = []; } - return "\n " + change_case_1.default.camelCase(replacer_1.replacer(name)) + "(" + args + "): Observable {\n " + requestTemplate('GET', url, params, false, !!queryParams) + "\n }"; - } - ServiceTemplates.getMethodTemplate = getMethodTemplate; - function requestTemplate(method, url, params, body, queryParams) { - if (params === void 0) { params = []; } - params.forEach(function (param) { - var index = url.indexOf("{" + param.key + "}"); - if (index > -1) { - url = url.slice(0, index) + '$' + url.slice(index); - } - }); - return "return this.restService.request({\n method: '" + method + "',\n url: `/" + url + "`," + (queryParams ? 'params: queryParams,' : '') + (body ? 'body,' : '') + "\n });"; - } - ServiceTemplates.requestTemplate = requestTemplate; -})(ServiceTemplates = exports.ServiceTemplates || (exports.ServiceTemplates = {})); diff --git a/npm/packs/client-generator/lib/src/types/api-defination.d.ts b/npm/packs/client-generator/lib/src/types/api-defination.d.ts deleted file mode 100644 index 9806a1011b..0000000000 --- a/npm/packs/client-generator/lib/src/types/api-defination.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export declare namespace APIDefination { - interface Response { - modules: Modules; - } - interface Modules { - [key: string]: Module; - } - interface Module { - rootPath: string; - controllers: { - [key: string]: Controller; - }; - } - interface Controller { - controllerName: string; - interfaces: { - typeAsString: string; - }[]; - typeAsString: string; - actions: { - [key: string]: Action; - }; - } - interface Action { - uniqueName: string; - name: string; - httpMethod: string; - url: string; - supportedVersions: any[]; - parametersOnMethod: ParametersOnMethod[]; - parameters: Parameter[]; - returnValue: ReturnValue; - } - interface Parameter { - nameOnMethod: string; - name: string; - typeAsString: string; - isOptional: boolean; - defaultValue: null; - constraintTypes: null; - bindingSourceId: string; - } - interface ParametersOnMethod { - name: string; - typeAsString: string; - isOptional: boolean; - defaultValue: null; - } - interface ReturnValue { - typeAsString: string; - } -} diff --git a/npm/packs/client-generator/lib/src/types/api-defination.js b/npm/packs/client-generator/lib/src/types/api-defination.js deleted file mode 100644 index c8ad2e549b..0000000000 --- a/npm/packs/client-generator/lib/src/types/api-defination.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/npm/packs/client-generator/lib/src/utils/axios.d.ts b/npm/packs/client-generator/lib/src/utils/axios.d.ts deleted file mode 100644 index 205420f0e2..0000000000 --- a/npm/packs/client-generator/lib/src/utils/axios.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const axiosInstance: import("axios").AxiosInstance; diff --git a/npm/packs/client-generator/lib/src/utils/axios.js b/npm/packs/client-generator/lib/src/utils/axios.js deleted file mode 100644 index cd25695c85..0000000000 --- a/npm/packs/client-generator/lib/src/utils/axios.js +++ /dev/null @@ -1,2128 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var axios_1 = __importDefault(require("axios")); -var https = require("https"); -var httpsAgent = new https.Agent({ - rejectUnauthorized: false, -}); -exports.axiosInstance = axios_1.default.create({ httpsAgent: httpsAgent }); -exports.axiosInstance.interceptors.request.use(function (config) { - if (config.method !== 'OPTIONS') { - if (!config.headers['content-type']) { - config.headers['accept'] = 'application/json'; - } - } - return config; -}, function (error) { - // Do something with request error - return Promise.reject(error); -}); -// axiosInstance.get = (...ar) => new Promise(resolve => { -// setTimeout(() => { -// resolve({ -// "modules": { -// "Account": { -// "rootPath": "Account", -// "controllers": { -// "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController": { -// "controllerName": "Account", -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController, Volo.Abp.Account.Web", -// "interfaces": [], -// "actions": { -// "LoginByLogin": { -// "uniqueName": "LoginByLogin", -// "name": "Login", -// "httpMethod": "POST", -// "url": "api/account/login", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "login", -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "login", -// "name": "login", -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult, Volo.Abp.Account.Web" -// } -// }, -// "CheckPasswordByLogin": { -// "uniqueName": "CheckPasswordByLogin", -// "name": "CheckPassword", -// "httpMethod": "POST", -// "url": "api/account/checkPassword", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "login", -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "login", -// "name": "login", -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo, Volo.Abp.Account.Web", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Account.Web.Areas.Account.Controllers.Models.AbpLoginResult, Volo.Abp.Account.Web" -// } -// } -// } -// } -// } -// }, -// "app": { -// "rootPath": "app", -// "controllers": { -// "Acme.AngSecTest.Controllers.TestController": { -// "controllerName": "Test", -// "typeAsString": "Acme.AngSecTest.Controllers.TestController, Acme.AngSecTest.HttpApi", -// "interfaces": [], -// "actions": { -// "GetAsync": { -// "uniqueName": "GetAsync", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/test", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "System.Collections.Generic.List`1[[Acme.AngSecTest.Models.Test.TestModel, Acme.AngSecTest.HttpApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib" -// } -// } -// } -// }, -// "Acme.AngSecTest.Controllers.Automobiles.carController": { -// "controllerName": "car", -// "typeAsString": "Acme.AngSecTest.Controllers.Automobiles.carController, Acme.AngSecTest.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Acme.AngSecTest.Automobiles.IcarAppService, Acme.AngSecTest.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsyncById": { -// "uniqueName": "GetAsyncById", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// }, -// "GetListAsyncByInput": { -// "uniqueName": "GetListAsyncByInput", -// "name": "GetListAsync", -// "httpMethod": "GET", -// "url": "api/car", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.GetcarsInput, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "FilterText", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Name", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "YearMin", -// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "YearMax", -// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "ProductionDateMin", -// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "ProductionDateMax", -// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "IsStillGoing", -// "typeAsString": "System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Sorting", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "SkipCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "MaxResultCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "CreateAsyncByInput": { -// "uniqueName": "CreateAsyncByInput", -// "name": "CreateAsync", -// "httpMethod": "POST", -// "url": "api/car", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// }, -// "UpdateAsyncByIdAndInput": { -// "uniqueName": "UpdateAsyncByIdAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// }, -// "DeleteAsyncById": { -// "uniqueName": "DeleteAsyncById", -// "name": "DeleteAsync", -// "httpMethod": "DELETE", -// "url": "api/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// }, -// "Acme.AngSecTest.AppServices.Automobiles.carAppService": { -// "controllerName": "car", -// "typeAsString": "Acme.AngSecTest.AppServices.Automobiles.carAppService, Acme.AngSecTest.Application", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Validation.IValidationEnabled, Volo.Abp.Validation" -// }, -// { -// "typeAsString": "Volo.Abp.Auditing.IAuditingEnabled, Volo.Abp.Auditing" -// }, -// { -// "typeAsString": "Acme.AngSecTest.Automobiles.IcarAppService, Acme.AngSecTest.Application.Contracts" -// } -// ], -// "actions": { -// "GetListAsyncByInput": { -// "uniqueName": "GetListAsyncByInput", -// "name": "GetListAsync", -// "httpMethod": "GET", -// "url": "api/app/car", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.GetcarsInput, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "FilterText", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Name", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "YearMin", -// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "YearMax", -// "typeAsString": "System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "ProductionDateMin", -// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "ProductionDateMax", -// "typeAsString": "System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "IsStillGoing", -// "typeAsString": "System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Sorting", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "SkipCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "MaxResultCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "GetAsyncById": { -// "uniqueName": "GetAsyncById", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/app/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// }, -// "DeleteAsyncById": { -// "uniqueName": "DeleteAsyncById", -// "name": "DeleteAsync", -// "httpMethod": "DELETE", -// "url": "api/app/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// }, -// "CreateAsyncByInput": { -// "uniqueName": "CreateAsyncByInput", -// "name": "CreateAsync", -// "httpMethod": "POST", -// "url": "api/app/car", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carCreateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// }, -// "UpdateAsyncByIdAndInput": { -// "uniqueName": "UpdateAsyncByIdAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/app/car/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Acme.AngSecTest.Automobiles.carUpdateDto, Acme.AngSecTest.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Acme.AngSecTest.Automobiles.carDto, Acme.AngSecTest.Application.Contracts" -// } -// } -// } -// }, -// "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { -// "controllerName": "AbpApplicationConfiguration", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController, Volo.Abp.AspNetCore.Mvc", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService, Volo.Abp.AspNetCore.Mvc.Contracts" -// } -// ], -// "actions": { -// "GetAsync": { -// "uniqueName": "GetAsync", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/abp/application-configuration", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto, Volo.Abp.AspNetCore.Mvc.Contracts" -// } -// } -// } -// }, -// "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { -// "controllerName": "AbpApiDefinition", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController, Volo.Abp.AspNetCore.Mvc", -// "interfaces": [], -// "actions": { -// "Get": { -// "uniqueName": "Get", -// "name": "Get", -// "httpMethod": "GET", -// "url": "api/abp/api-definition", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, Volo.Abp.Http" -// } -// } -// } -// }, -// "Pages.Abp.MultiTenancy.AbpTenantController": { -// "controllerName": "AbpTenant", -// "typeAsString": "Pages.Abp.MultiTenancy.AbpTenantController, Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService, Volo.Abp.AspNetCore.Mvc.Contracts" -// } -// ], -// "actions": { -// "FindTenantByNameAsyncByName": { -// "uniqueName": "FindTenantByNameAsyncByName", -// "name": "FindTenantByNameAsync", -// "httpMethod": "GET", -// "url": "api/abp/multi-tenancy/find-tenant/{name}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "name", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "name", -// "name": "name", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto, Volo.Abp.AspNetCore.Mvc.Contracts" -// } -// }, -// "FindTenantByIdAsyncById": { -// "uniqueName": "FindTenantByIdAsyncById", -// "name": "FindTenantByIdAsync", -// "httpMethod": "GET", -// "url": "api/abp/multi-tenancy/tenants/by-id/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.FindTenantResultDto, Volo.Abp.AspNetCore.Mvc.Contracts" -// } -// } -// } -// } -// } -// }, -// "account": { -// "rootPath": "account", -// "controllers": { -// "Volo.Abp.Account.AccountController": { -// "controllerName": "Account", -// "typeAsString": "Volo.Abp.Account.AccountController, Volo.Abp.Account.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Account.IAccountAppService, Volo.Abp.Account.Application.Contracts" -// } -// ], -// "actions": { -// "RegisterAsyncByInput": { -// "uniqueName": "RegisterAsyncByInput", -// "name": "RegisterAsync", -// "httpMethod": "POST", -// "url": "api/account/register", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Account.RegisterDto, Volo.Abp.Account.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// } -// } -// } -// } -// }, -// "abp": { -// "rootPath": "abp", -// "controllers": { -// "Volo.Abp.FeatureManagement.FeaturesController": { -// "controllerName": "Features", -// "typeAsString": "Volo.Abp.FeatureManagement.FeaturesController, Volo.Abp.FeatureManagement.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.FeatureManagement.IFeatureAppService, Volo.Abp.FeatureManagement.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsyncByProviderNameAndProviderKey": { -// "uniqueName": "GetAsyncByProviderNameAndProviderKey", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/abp/features", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "providerName", -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "providerKey", -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.FeatureManagement.FeatureListDto, Volo.Abp.FeatureManagement.Application.Contracts" -// } -// }, -// "UpdateAsyncByProviderNameAndProviderKeyAndInput": { -// "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/abp/features", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "providerName", -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "providerKey", -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.FeatureManagement.UpdateFeaturesDto, Volo.Abp.FeatureManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// }, -// "Volo.Abp.PermissionManagement.PermissionsController": { -// "controllerName": "Permissions", -// "typeAsString": "Volo.Abp.PermissionManagement.PermissionsController, Volo.Abp.PermissionManagement.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.PermissionManagement.IPermissionAppService, Volo.Abp.PermissionManagement.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsyncByProviderNameAndProviderKey": { -// "uniqueName": "GetAsyncByProviderNameAndProviderKey", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/abp/permissions", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "providerName", -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "providerKey", -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.PermissionManagement.GetPermissionListResultDto, Volo.Abp.PermissionManagement.Application.Contracts" -// } -// }, -// "UpdateAsyncByProviderNameAndProviderKeyAndInput": { -// "uniqueName": "UpdateAsyncByProviderNameAndProviderKeyAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/abp/permissions", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "providerName", -// "name": "providerName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "providerKey", -// "name": "providerKey", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.PermissionManagement.UpdatePermissionsDto, Volo.Abp.PermissionManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// } -// } -// }, -// "multi-tenancy": { -// "rootPath": "multi-tenancy", -// "controllers": { -// "Volo.Abp.TenantManagement.TenantController": { -// "controllerName": "Tenant", -// "typeAsString": "Volo.Abp.TenantManagement.TenantController, Volo.Abp.TenantManagement.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.TenantManagement.ITenantAppService, Volo.Abp.TenantManagement.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsyncById": { -// "uniqueName": "GetAsyncById", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/multi-tenancy/tenants/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" -// } -// }, -// "GetListAsyncByInput": { -// "uniqueName": "GetListAsyncByInput", -// "name": "GetListAsync", -// "httpMethod": "GET", -// "url": "api/multi-tenancy/tenants", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.TenantManagement.GetTenantsInput, Volo.Abp.TenantManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "Filter", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Sorting", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "SkipCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "MaxResultCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "CreateAsyncByInput": { -// "uniqueName": "CreateAsyncByInput", -// "name": "CreateAsync", -// "httpMethod": "POST", -// "url": "api/multi-tenancy/tenants", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.TenantManagement.TenantCreateDto, Volo.Abp.TenantManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" -// } -// }, -// "UpdateAsyncByIdAndInput": { -// "uniqueName": "UpdateAsyncByIdAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/multi-tenancy/tenants/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.TenantManagement.TenantUpdateDto, Volo.Abp.TenantManagement.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.TenantManagement.TenantDto, Volo.Abp.TenantManagement.Application.Contracts" -// } -// }, -// "DeleteAsyncById": { -// "uniqueName": "DeleteAsyncById", -// "name": "DeleteAsync", -// "httpMethod": "DELETE", -// "url": "api/multi-tenancy/tenants/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// }, -// "GetDefaultConnectionStringAsyncById": { -// "uniqueName": "GetDefaultConnectionStringAsyncById", -// "name": "GetDefaultConnectionStringAsync", -// "httpMethod": "GET", -// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.String, System.Private.CoreLib" -// } -// }, -// "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString": { -// "uniqueName": "UpdateDefaultConnectionStringAsyncByIdAndDefaultConnectionString", -// "name": "UpdateDefaultConnectionStringAsync", -// "httpMethod": "PUT", -// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "defaultConnectionString", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "defaultConnectionString", -// "name": "defaultConnectionString", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// }, -// "DeleteDefaultConnectionStringAsyncById": { -// "uniqueName": "DeleteDefaultConnectionStringAsyncById", -// "name": "DeleteDefaultConnectionStringAsync", -// "httpMethod": "DELETE", -// "url": "api/multi-tenancy/tenants/{id}/default-connection-string", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// } -// } -// }, -// "identity": { -// "rootPath": "identity", -// "controllers": { -// "Volo.Abp.Identity.IdentityRoleController": { -// "controllerName": "IdentityRole", -// "typeAsString": "Volo.Abp.Identity.IdentityRoleController, Volo.Abp.Identity.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Identity.IIdentityRoleAppService, Volo.Abp.Identity.Application.Contracts" -// } -// ], -// "actions": { -// "GetListAsync": { -// "uniqueName": "GetListAsync", -// "name": "GetListAsync", -// "httpMethod": "GET", -// "url": "api/identity/roles", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.ListResultDto`1[[Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "GetAsyncById": { -// "uniqueName": "GetAsyncById", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/identity/roles/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "CreateAsyncByInput": { -// "uniqueName": "CreateAsyncByInput", -// "name": "CreateAsync", -// "httpMethod": "POST", -// "url": "api/identity/roles", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityRoleCreateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityRoleCreateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "UpdateAsyncByIdAndInput": { -// "uniqueName": "UpdateAsyncByIdAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/identity/roles/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityRoleUpdateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityRoleUpdateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "DeleteAsyncById": { -// "uniqueName": "DeleteAsyncById", -// "name": "DeleteAsync", -// "httpMethod": "DELETE", -// "url": "api/identity/roles/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// }, -// "Volo.Abp.Identity.IdentityUserController": { -// "controllerName": "IdentityUser", -// "typeAsString": "Volo.Abp.Identity.IdentityUserController, Volo.Abp.Identity.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Identity.IIdentityUserAppService, Volo.Abp.Identity.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsyncById": { -// "uniqueName": "GetAsyncById", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "GetListAsyncByInput": { -// "uniqueName": "GetListAsyncByInput", -// "name": "GetListAsync", -// "httpMethod": "GET", -// "url": "api/identity/users", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.GetIdentityUsersInput, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "Filter", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "Sorting", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "SkipCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "input", -// "name": "MaxResultCount", -// "typeAsString": "System.Int32, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "CreateAsyncByInput": { -// "uniqueName": "CreateAsyncByInput", -// "name": "CreateAsync", -// "httpMethod": "POST", -// "url": "api/identity/users", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserCreateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserCreateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "UpdateAsyncByIdAndInput": { -// "uniqueName": "UpdateAsyncByIdAndInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/identity/users/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "DeleteAsyncById": { -// "uniqueName": "DeleteAsyncById", -// "name": "DeleteAsync", -// "httpMethod": "DELETE", -// "url": "api/identity/users/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// }, -// "GetRolesAsyncById": { -// "uniqueName": "GetRolesAsyncById", -// "name": "GetRolesAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/{id}/roles", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Application.Dtos.ListResultDto`1[[Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Application.Contracts, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts" -// } -// }, -// "UpdateRolesAsyncByIdAndInput": { -// "uniqueName": "UpdateRolesAsyncByIdAndInput", -// "name": "UpdateRolesAsync", -// "httpMethod": "PUT", -// "url": "api/identity/users/{id}/roles", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateRolesDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// }, -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.IdentityUserUpdateRolesDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// }, -// "FindByUsernameAsyncByUsername": { -// "uniqueName": "FindByUsernameAsyncByUsername", -// "name": "FindByUsernameAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/by-username/{userName}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "username", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "username", -// "name": "username", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "FindByEmailAsyncByEmail": { -// "uniqueName": "FindByEmailAsyncByEmail", -// "name": "FindByEmailAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/by-email/{email}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "email", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "email", -// "name": "email", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Application.Contracts" -// } -// } -// } -// }, -// "Volo.Abp.Identity.IdentityUserLookupController": { -// "controllerName": "IdentityUserLookup", -// "typeAsString": "Volo.Abp.Identity.IdentityUserLookupController, Volo.Abp.Identity.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Identity.IIdentityUserLookupAppService, Volo.Abp.Identity.Application.Contracts" -// } -// ], -// "actions": { -// "FindByIdAsyncById": { -// "uniqueName": "FindByIdAsyncById", -// "name": "FindByIdAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/lookup/{id}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "id", -// "name": "id", -// "typeAsString": "System.Guid, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Users.UserData, Volo.Abp.Users.Abstractions" -// } -// }, -// "FindByUserNameAsyncByUserName": { -// "uniqueName": "FindByUserNameAsyncByUserName", -// "name": "FindByUserNameAsync", -// "httpMethod": "GET", -// "url": "api/identity/users/lookup/by-username/{userName}", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "userName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "userName", -// "name": "userName", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": [], -// "bindingSourceId": "Path" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Users.UserData, Volo.Abp.Users.Abstractions" -// } -// } -// } -// }, -// "Volo.Abp.Identity.ProfileController": { -// "controllerName": "Profile", -// "typeAsString": "Volo.Abp.Identity.ProfileController, Volo.Abp.Identity.HttpApi", -// "interfaces": [ -// { -// "typeAsString": "Volo.Abp.Identity.IProfileAppService, Volo.Abp.Identity.Application.Contracts" -// } -// ], -// "actions": { -// "GetAsync": { -// "uniqueName": "GetAsync", -// "name": "GetAsync", -// "httpMethod": "GET", -// "url": "api/identity/my-profile", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.ProfileDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "UpdateAsyncByInput": { -// "uniqueName": "UpdateAsyncByInput", -// "name": "UpdateAsync", -// "httpMethod": "PUT", -// "url": "api/identity/my-profile", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "Volo.Abp.Identity.ProfileDto, Volo.Abp.Identity.Application.Contracts" -// } -// }, -// "ChangePasswordAsyncByInput": { -// "uniqueName": "ChangePasswordAsyncByInput", -// "name": "ChangePasswordAsync", -// "httpMethod": "POST", -// "url": "api/identity/my-profile/change-password", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "input", -// "name": "input", -// "typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "Body" -// } -// ], -// "returnValue": { -// "typeAsString": "System.Void, System.Private.CoreLib" -// } -// } -// } -// } -// } -// }, -// "Abp": { -// "rootPath": "Abp", -// "controllers": { -// "Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController": { -// "controllerName": "AbpServiceProxyScript", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController, Volo.Abp.AspNetCore.Mvc", -// "interfaces": [], -// "actions": { -// "GetAllByModel": { -// "uniqueName": "GetAllByModel", -// "name": "GetAll", -// "httpMethod": "GET", -// "url": "Abp/ServiceProxyScript", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "model", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ProxyScripting.ServiceProxyGenerationModel, Volo.Abp.AspNetCore.Mvc", -// "isOptional": false, -// "defaultValue": null -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "model", -// "name": "Type", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "model", -// "name": "UseCache", -// "typeAsString": "System.Boolean, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "model", -// "name": "Modules", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "model", -// "name": "Controllers", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "model", -// "name": "Actions", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "System.String, System.Private.CoreLib" -// } -// } -// } -// }, -// "Volo.Abp.AspNetCore.Mvc.Localization.AbpLanguagesController": { -// "controllerName": "AbpLanguages", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.Localization.AbpLanguagesController, Volo.Abp.AspNetCore.Mvc", -// "interfaces": [], -// "actions": { -// "SwitchByCultureAndUiCultureAndReturnUrl": { -// "uniqueName": "SwitchByCultureAndUiCultureAndReturnUrl", -// "name": "Switch", -// "httpMethod": "GET", -// "url": "Abp/Languages/Switch", -// "supportedVersions": [], -// "parametersOnMethod": [ -// { -// "name": "culture", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null -// }, -// { -// "name": "uiCulture", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": true, -// "defaultValue": "" -// }, -// { -// "name": "returnUrl", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": true, -// "defaultValue": "" -// } -// ], -// "parameters": [ -// { -// "nameOnMethod": "culture", -// "name": "culture", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "uiCulture", -// "name": "uiCulture", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// }, -// { -// "nameOnMethod": "returnUrl", -// "name": "returnUrl", -// "typeAsString": "System.String, System.Private.CoreLib", -// "isOptional": false, -// "defaultValue": null, -// "constraintTypes": null, -// "bindingSourceId": "ModelBinding" -// } -// ], -// "returnValue": { -// "typeAsString": "Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Abstractions" -// } -// } -// } -// }, -// "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController": { -// "controllerName": "AbpApplicationConfigurationScript", -// "typeAsString": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController, Volo.Abp.AspNetCore.Mvc", -// "interfaces": [], -// "actions": { -// "Get": { -// "uniqueName": "Get", -// "name": "Get", -// "httpMethod": "GET", -// "url": "Abp/ApplicationConfigurationScript", -// "supportedVersions": [], -// "parametersOnMethod": [], -// "parameters": [], -// "returnValue": { -// "typeAsString": "System.String, System.Private.CoreLib" -// } -// } -// } -// } -// } -// } -// } -// } as any) -// }, 0); -// }) diff --git a/npm/packs/client-generator/lib/src/utils/generators.d.ts b/npm/packs/client-generator/lib/src/utils/generators.d.ts deleted file mode 100644 index c7683c551a..0000000000 --- a/npm/packs/client-generator/lib/src/utils/generators.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { APIDefination } from '../types/api-defination'; -export interface Argument { - key: string; - type: string; - isOptional?: boolean; -} -export declare function generateArgs(args: Argument[]): string; -export declare function parseParameters(parameters: APIDefination.Parameter[]): Argument[]; -export declare function findType(typeAsString: string): string; diff --git a/npm/packs/client-generator/lib/src/utils/generators.js b/npm/packs/client-generator/lib/src/utils/generators.js deleted file mode 100644 index 265da85f6c..0000000000 --- a/npm/packs/client-generator/lib/src/utils/generators.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function generateArgs(args) { - return args.reduce(function (acc, val) { - var arg = "" + val.key + (val.isOptional ? '?' : '') + ": " + val.type; - if (acc) - return acc + ", " + arg; - else - return arg; - }, ''); -} -exports.generateArgs = generateArgs; -function parseParameters(parameters) { - return parameters - .filter(function (param) { return param.bindingSourceId === 'Path'; }) - .map(function (param) { - return { key: param.name, type: findType(param.typeAsString), isOptional: param.isOptional }; - }); -} -exports.parseParameters = parseParameters; -function findType(typeAsString) { - if (typeAsString.indexOf('Guid') > -1) - return 'string'; - return 'any'; -} -exports.findType = findType; diff --git a/npm/packs/client-generator/lib/src/utils/prompt.d.ts b/npm/packs/client-generator/lib/src/utils/prompt.d.ts deleted file mode 100644 index 0cde4f1437..0000000000 --- a/npm/packs/client-generator/lib/src/utils/prompt.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const uiSelection: (uiArray: string[]) => Promise; -export declare const moduleSelection: (modules: string[]) => Promise; diff --git a/npm/packs/client-generator/lib/src/utils/prompt.js b/npm/packs/client-generator/lib/src/utils/prompt.js deleted file mode 100644 index 943edd5255..0000000000 --- a/npm/packs/client-generator/lib/src/utils/prompt.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var inquirer_1 = __importDefault(require("inquirer")); -exports.uiSelection = function (uiArray) { return __awaiter(void 0, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/, inquirer_1.default - .prompt({ type: 'list', name: 'Please select an UI', choices: uiArray }) - .then(function (res) { return res['Please select an UI']; })]; - }); -}); }; -exports.moduleSelection = function (modules) { return __awaiter(void 0, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/, inquirer_1.default - .prompt({ type: 'checkbox', name: 'Please select module(s)', choices: modules }) - .then(function (res) { return res['Please select module(s)']; })]; - }); -}); }; diff --git a/npm/packs/client-generator/lib/src/utils/replacer.d.ts b/npm/packs/client-generator/lib/src/utils/replacer.d.ts deleted file mode 100644 index b313838517..0000000000 --- a/npm/packs/client-generator/lib/src/utils/replacer.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function replacer(text: string): string; diff --git a/npm/packs/client-generator/lib/src/utils/replacer.js b/npm/packs/client-generator/lib/src/utils/replacer.js deleted file mode 100644 index 2f72a88387..0000000000 --- a/npm/packs/client-generator/lib/src/utils/replacer.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function replacer(text) { - return text.replace(/Async/, ''); -} -exports.replacer = replacer; From 6d16655c23f4f7da2efa41c95daeb8dcc9e40d9e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 18 Mar 2020 19:39:11 +0300 Subject: [PATCH 27/52] Fix: CLI update command replaces first character of NPM version with ^ resolves https://github.com/volosoft/volo/issues/1497 --- .../Abp/Cli/ProjectModification/NpmPackagesUpdater.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 91eaec48e7..263e94c377 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -99,26 +99,21 @@ namespace Volo.Abp.Cli.ProjectModification protected virtual async Task TryUpdatePackage(string file, JProperty package, bool includePreviews = false, bool switchToStable = false) { - var updated = false; var currentVersion = (string)package.Value; var version = await GetLatestVersion(package, currentVersion, includePreviews, switchToStable); - var versionWithPrefix = $"^{version}"; + var versionWithPrefix = $"~{version}"; if (versionWithPrefix == currentVersion) { return false; } - else - { - updated = true; - } package.Value.Replace(versionWithPrefix); Logger.LogInformation($"Updated {package.Name} to {version} in {file.Replace(Directory.GetCurrentDirectory(), "")}."); - return updated; + return true; } protected virtual async Task GetLatestVersion(JProperty package, string currentVersion, From b6f114353d0634d55ffaafd96c78222c0898ca42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 18 Mar 2020 19:47:59 +0300 Subject: [PATCH 28/52] Added test --- .../ApiExploring/AbpApiDefinitionController_Tests.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs index 44b206e462..8dbbf3eac2 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using Shouldly; using Volo.Abp.Http.Modeling; using Xunit; @@ -12,6 +13,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring { var model = await GetResponseAsObjectAsync("/api/abp/api-definition"); model.ShouldNotBeNull(); + model.Types.IsNullOrEmpty().ShouldBeTrue(); + } + + [Fact] + public async Task GetAsync_IncludeTypes() + { + var model = await GetResponseAsObjectAsync("/api/abp/api-definition?includeTypes=true"); + model.ShouldNotBeNull(); + model.Types.IsNullOrEmpty().ShouldBeFalse(); } } } From 793a600981b0448bd50b9488da4311df2a3f2ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 18 Mar 2020 20:02:30 +0300 Subject: [PATCH 29/52] Fix TypeHelper.IsDictionary and add tests. --- .../Volo/Abp/Reflection/TypeHelper.cs | 14 +++++--- .../Volo/Abp/Reflection/TypeHelper_Tests.cs | 35 ++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs index a9f21c5a0d..b62f21f124 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs @@ -84,11 +84,16 @@ namespace Volo.Abp.Reflection public static bool IsDictionary(Type type, out Type keyType, out Type valueType) { - var enumerableTypes = ReflectionHelper.GetImplementedGenericTypes(type, typeof(IDictionary<,>)); - if (enumerableTypes.Count == 1) + var dictionaryTypes = ReflectionHelper + .GetImplementedGenericTypes( + type, + typeof(IDictionary<,>) + ); + + if (dictionaryTypes.Count == 1) { - keyType = enumerableTypes[0].GenericTypeArguments[0]; - valueType = enumerableTypes[0].GenericTypeArguments[2]; + keyType = dictionaryTypes[0].GenericTypeArguments[0]; + valueType = dictionaryTypes[0].GenericTypeArguments[1]; return true; } @@ -101,6 +106,7 @@ namespace Volo.Abp.Reflection keyType = null; valueType = null; + return false; } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs index 0fc11addae..59378708b1 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using Shouldly; using Xunit; @@ -16,5 +15,39 @@ namespace Volo.Abp.Reflection guidType.ShouldBe(typeof(Guid)); } + + [Fact] + public void IsDictionary() + { + //Dictionary + TypeHelper.IsDictionary( + typeof(Dictionary), + out var keyType, + out var valueType + ).ShouldBeTrue(); + keyType.ShouldBe(typeof(string)); + valueType.ShouldBe(typeof(int)); + + //MyDictionary + TypeHelper.IsDictionary( + typeof(MyDictionary), + out keyType, + out valueType + ).ShouldBeTrue(); + keyType.ShouldBe(typeof(bool)); + valueType.ShouldBe(typeof(TypeHelper_Tests)); + + //TypeHelper_Tests + TypeHelper.IsDictionary( + typeof(TypeHelper_Tests), + out keyType, + out valueType + ).ShouldBeFalse(); + } + + public class MyDictionary : Dictionary + { + + } } } From a628e177a5f8da3f6879c66e471cb3aea46fc198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 18 Mar 2020 20:13:19 +0300 Subject: [PATCH 30/52] Add test for TypeHelper and improve ReflectionHelper --- .../Volo/Abp/Reflection/ReflectionHelper.cs | 4 ++-- .../Volo/Abp/Reflection/TypeHelper_Tests.cs | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs index b314ca6b84..8d6e6a42cf 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs @@ -53,14 +53,14 @@ namespace Volo.Abp.Reflection if (givenTypeInfo.IsGenericType && givenType.GetGenericTypeDefinition() == genericType) { - result.Add(givenType); + result.AddIfNotContains(givenType); } foreach (var interfaceType in givenTypeInfo.GetInterfaces()) { if (interfaceType.GetTypeInfo().IsGenericType && interfaceType.GetGenericTypeDefinition() == genericType) { - result.Add(interfaceType); + result.AddIfNotContains(interfaceType); } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs index 59378708b1..e289779d2c 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs @@ -16,6 +16,27 @@ namespace Volo.Abp.Reflection guidType.ShouldBe(typeof(Guid)); } + [Fact] + public void IsEnumerable() + { + TypeHelper.IsEnumerable( + typeof(IEnumerable), + out var itemType + ).ShouldBeTrue(); + itemType.ShouldBe(typeof(string)); + + TypeHelper.IsEnumerable( + typeof(List), + out itemType + ).ShouldBeTrue(); + itemType.ShouldBe(typeof(TypeHelper_Tests)); + + TypeHelper.IsEnumerable( + typeof(TypeHelper_Tests), + out itemType + ).ShouldBeFalse(); + } + [Fact] public void IsDictionary() { From 5c2f8432e3891d3fc4fd1d3b66d31d18da978a71 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 18 Mar 2020 20:59:32 +0300 Subject: [PATCH 31/52] feat(tenant-management): add admin password and email fields to new tenant form --- .../components/tenants/tenants.component.html | 20 ++++++++++++++++ .../components/tenants/tenants.component.ts | 15 +++++++++++- .../src/lib/models/tenant-management.ts | 5 +++- .../lib/services/tenant-management.service.ts | 24 ++++++++++--------- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html index a0fccaf9d3..2b0276ede8 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html @@ -140,6 +140,26 @@ +
+ + +
+
+ + +
diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts index fa400d06f9..788953096f 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts @@ -60,6 +60,10 @@ export class TenantsComponent implements OnInit { sortKey = ''; + get hasSelectedTenant(): boolean { + return Boolean(this.selected.id); + } + get useSharedDatabase(): boolean { return this.defaultConnectionStringForm.get('useSharedDatabase').value; } @@ -115,9 +119,18 @@ export class TenantsComponent implements OnInit { } private createTenantForm() { - this.tenantForm = this.fb.group({ + const tenantForm = this.fb.group({ name: [this.selected.name || '', [Validators.required, Validators.maxLength(256)]], + adminEmailAddress: [null, [Validators.required, Validators.maxLength(256), Validators.email]], + adminPassword: [null, [Validators.required]], }); + + if (this.hasSelectedTenant) { + tenantForm.removeControl('adminEmailAddress'); + tenantForm.removeControl('adminPassword'); + } + + this.tenantForm = tenantForm; } private createDefaultConnectionStringForm() { diff --git a/npm/ng-packs/packages/tenant-management/src/lib/models/tenant-management.ts b/npm/ng-packs/packages/tenant-management/src/lib/models/tenant-management.ts index 40a9c06d11..b7659e2a95 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/models/tenant-management.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/models/tenant-management.ts @@ -14,11 +14,14 @@ export namespace TenantManagement { } export interface AddRequest { + adminEmailAddress: string; + adminPassword: string; name: string; } - export interface UpdateRequest extends AddRequest { + export interface UpdateRequest { id: string; + name: string; } export interface DefaultConnectionStringRequest { diff --git a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management.service.ts b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management.service.ts index bb043377e6..27ee26b7ed 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management.service.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management.service.ts @@ -4,7 +4,7 @@ import { RestService, Rest, ABP } from '@abp/ng.core'; import { TenantManagement } from '../models/tenant-management'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class TenantManagementService { constructor(private rest: RestService) {} @@ -13,7 +13,7 @@ export class TenantManagementService { const request: Rest.Request = { method: 'GET', url: '/api/multi-tenancy/tenants', - params + params, }; return this.rest.request(request); @@ -22,7 +22,7 @@ export class TenantManagementService { getTenantById(id: string): Observable { const request: Rest.Request = { method: 'GET', - url: `/api/multi-tenancy/tenants/${id}` + url: `/api/multi-tenancy/tenants/${id}`, }; return this.rest.request(request); @@ -31,7 +31,7 @@ export class TenantManagementService { deleteTenant(id: string): Observable { const request: Rest.Request = { method: 'DELETE', - url: `/api/multi-tenancy/tenants/${id}` + url: `/api/multi-tenancy/tenants/${id}`, }; return this.rest.request(request); @@ -41,7 +41,7 @@ export class TenantManagementService { const request: Rest.Request = { method: 'POST', url: '/api/multi-tenancy/tenants', - body + body, }; return this.rest.request(request); @@ -54,10 +54,10 @@ export class TenantManagementService { const request: Rest.Request = { method: 'PUT', url, - body + body, }; - return this.rest.request(request); + return this.rest.request(request); } getDefaultConnectionString(id: string): Observable { @@ -66,18 +66,20 @@ export class TenantManagementService { const request: Rest.Request = { method: 'GET', responseType: Rest.ResponseType.Text, - url + url, }; return this.rest.request(request); } - updateDefaultConnectionString(payload: TenantManagement.DefaultConnectionStringRequest): Observable { + updateDefaultConnectionString( + payload: TenantManagement.DefaultConnectionStringRequest, + ): Observable { const url = `/api/multi-tenancy/tenants/${payload.id}/default-connection-string`; const request: Rest.Request = { method: 'PUT', url, - params: { defaultConnectionString: payload.defaultConnectionString } + params: { defaultConnectionString: payload.defaultConnectionString }, }; return this.rest.request(request); } @@ -87,7 +89,7 @@ export class TenantManagementService { const request: Rest.Request = { method: 'DELETE', - url + url, }; return this.rest.request(request); } From 2db56d592f319e27640e275a88c95dd79b316f65 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 18 Mar 2020 21:27:34 +0300 Subject: [PATCH 32/52] feat(rn): add admin email and password fields to create tenant form --- templates/app/react-native/package.json | 2 +- .../CreateUpdateTenantForm.js | 64 ++++++++++++++++++- templates/app/react-native/yarn.lock | 51 +++++++-------- 3 files changed, 86 insertions(+), 31 deletions(-) diff --git a/templates/app/react-native/package.json b/templates/app/react-native/package.json index 09f9159570..14e799b900 100644 --- a/templates/app/react-native/package.json +++ b/templates/app/react-native/package.json @@ -24,7 +24,7 @@ "formik": "^2.1.2", "i18n-js": "^3.5.1", "lodash": "^4.17.15", - "native-base": "^2.13.8", + "native-base": "2.13.8", "prop-types": "^15.7.2", "react": "~16.9.0", "react-dom": "~16.9.0", diff --git a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js index ff5801f914..0a1c05771b 100644 --- a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js +++ b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js @@ -1,8 +1,8 @@ import { Formik } from 'formik'; import i18n from 'i18n-js'; -import { Container, Content, Input, InputGroup, Label } from 'native-base'; +import { Container, Content, Input, InputGroup, Label, Item, Icon } from 'native-base'; import PropTypes from 'prop-types'; -import React, { useRef } from 'react'; +import React, { useRef, useState } from 'react'; import { StyleSheet } from 'react-native'; import * as Yup from 'yup'; import FormButtons from '../../components/FormButtons/FormButtons'; @@ -15,7 +15,10 @@ const validations = { function CreateUpdateTenantForm({ editingTenant = {}, submit, remove }) { const tenantNameRef = useRef(); + const adminEmailRef = useRef(); + const adminPasswordRef = useRef(); + const [showAdminPassword, setShowAdminPassword] = useState(false); const hasRemovePermission = usePermission('AbpTenantManagement.Tenants.Delete'); const onSubmit = values => { @@ -25,11 +28,25 @@ function CreateUpdateTenantForm({ editingTenant = {}, submit, remove }) { }); }; + const adminEmailAddressValidation = Yup.lazy(() => + Yup.string() + .required('AbpAccount::ThisFieldIsRequired.') + .email('AbpAccount::ThisFieldIsNotAValidEmailAddress.'), + ); + + const adminPasswordValidation = Yup.lazy(() => + Yup.string().required('AbpAccount::ThisFieldIsRequired.'), + ); + return ( + !editingTenant.id ? adminEmailRef.current._root.focus() : null + } + returnKeyType={!editingTenant.id ? 'next' : 'done'} onChangeText={handleChange('name')} onBlur={handleBlur('name')} value={values.name} /> {errors.name} + {!editingTenant || !editingTenant.id ? ( + <> + + + adminPasswordRef.current._root.focus()} + returnKeyType="next" + onChangeText={handleChange('adminEmailAddress')} + onBlur={handleBlur('adminEmailAddress')} + value={values.adminEmailAddress} + /> + + {errors.adminEmailAddress} + + + + + setShowAdminPassword(!showAdminPassword)} + /> + + + {errors.adminPassword} + + ) : null} Date: Wed, 18 Mar 2020 22:02:26 +0300 Subject: [PATCH 33/52] refactor: remove unnecessary condition --- .../src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js index 0a1c05771b..45710eb594 100644 --- a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js +++ b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js @@ -73,7 +73,7 @@ function CreateUpdateTenantForm({ editingTenant = {}, submit, remove }) { /> {errors.name} - {!editingTenant || !editingTenant.id ? ( + {!editingTenant.id ? ( <>