diff --git a/backend/FwLite/FwLiteShared/TypeGen/ReinforcedFwLiteTypingConfig.cs b/backend/FwLite/FwLiteShared/TypeGen/ReinforcedFwLiteTypingConfig.cs index f2ab99bde..e232e6534 100644 --- a/backend/FwLite/FwLiteShared/TypeGen/ReinforcedFwLiteTypingConfig.cs +++ b/backend/FwLite/FwLiteShared/TypeGen/ReinforcedFwLiteTypingConfig.cs @@ -52,41 +52,19 @@ public static void Configure(ConfigurationBuilder builder) ], exportBuilder => exportBuilder.WithPublicProperties()); builder.ExportAsEnum().UseString(); - builder.ExportAsInterface().FlattenHierarchy().WithPublicProperties().WithPublicMethods( - exportBuilder => - { - var isUpdatePatchMethod = exportBuilder.Member.GetParameters() - .Any(p => p.ParameterType.IsGenericType && p.ParameterType.GetGenericTypeDefinition() == (typeof(UpdateObjectInput<>))); - if (isUpdatePatchMethod) - { - exportBuilder.Ignore(); - return; - } - var isTaskMethod = (exportBuilder.Member.ReturnType.IsGenericType && - (exportBuilder.Member.ReturnType.GetGenericTypeDefinition() == typeof(Task<>) - || exportBuilder.Member.ReturnType.GetGenericTypeDefinition() == typeof(ValueTask<>))) - || exportBuilder.Member.ReturnType == typeof(Task) - || exportBuilder.Member.ReturnType == typeof(ValueTask); - if (!isTaskMethod) - { - if (exportBuilder.Member.ReturnType == typeof(void)) - { - exportBuilder.Returns(typeof(Task)); - } else - { - exportBuilder.Returns(typeof(Task<>).MakeGenericType(exportBuilder.Member.ReturnType)); - } - } - }); + builder.ExportAsInterface() + .FlattenHierarchy() + .WithPublicProperties() + .WithPublicMethods(b => b.AlwaysReturnPromise()); builder.ExportAsEnum().UseString(); builder.ExportAsInterfaces([typeof(QueryOptions), typeof(SortOptions), typeof(ExemplarOptions)], exportBuilder => exportBuilder.WithProperties(BindingFlags.Public | BindingFlags.Instance)); builder.ExportAsEnum().UseString(); - builder.ExportAsInterface().WithPublicMethods(); - builder.ExportAsInterface().WithPublicMethods(); + builder.ExportAsInterface().WithPublicMethods(b => b.AlwaysReturnPromise()); + builder.ExportAsInterface().WithPublicMethods(b => b.AlwaysReturnPromise()); builder.ExportAsInterface().WithPublicProperties(); - builder.ExportAsInterface().WithPublicMethods(); + builder.ExportAsInterface().WithPublicMethods(b => b.AlwaysReturnPromise()); builder.ExportAsInterface().WithPublicProperties(); builder.ExportAsInterface().WithPublicProperties(); builder.ExportAsInterface().WithPublicProperties(); @@ -96,6 +74,35 @@ public static void Configure(ConfigurationBuilder builder) builder.ExportAsEnum(); } + private static void AlwaysReturnPromise(this MethodExportBuilder exportBuilder) + { + var isUpdatePatchMethod = exportBuilder.Member.GetParameters() + .Any(p => p.ParameterType.IsGenericType && + p.ParameterType.GetGenericTypeDefinition() == (typeof(UpdateObjectInput<>))); + if (isUpdatePatchMethod) + { + exportBuilder.Ignore(); + return; + } + + var isTaskMethod = (exportBuilder.Member.ReturnType.IsGenericType && + (exportBuilder.Member.ReturnType.GetGenericTypeDefinition() == typeof(Task<>) + || exportBuilder.Member.ReturnType.GetGenericTypeDefinition() == typeof(ValueTask<>))) + || exportBuilder.Member.ReturnType == typeof(Task) + || exportBuilder.Member.ReturnType == typeof(ValueTask); + if (!isTaskMethod) + { + if (exportBuilder.Member.ReturnType == typeof(void)) + { + exportBuilder.Returns(typeof(Task)); + } + else + { + exportBuilder.Returns(typeof(Task<>).MakeGenericType(exportBuilder.Member.ReturnType)); + } + } + } + private static void DisableEsLintChecks(ConfigurationBuilder builder) { typeof(ExportContext).GetProperty(nameof(ExportContext.FileOperations))?.SetValue(builder.Context, diff --git a/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Projects/ICombinedProjectsService.ts b/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Projects/ICombinedProjectsService.ts index 394a30ec6..e25259e2a 100644 --- a/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Projects/ICombinedProjectsService.ts +++ b/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Projects/ICombinedProjectsService.ts @@ -9,8 +9,9 @@ import type {ILexboxServer} from '../Auth/ILexboxServer'; export interface ICombinedProjectsService { + supportsFwData() : Promise; remoteProjects() : Promise; - localProjects() : IProjectModel[]; + localProjects() : Promise; downloadProject(lexboxProjectId: string, projectName: string, server: ILexboxServer) : Promise; createProject(name: string) : Promise; }