diff --git a/src/TypedSignalR.Client.TypeScript.Analyzer/TypedSignalR.Client.TypeScript.Analyzer.csproj b/src/TypedSignalR.Client.TypeScript.Analyzer/TypedSignalR.Client.TypeScript.Analyzer.csproj
index 0941e43..6393614 100644
--- a/src/TypedSignalR.Client.TypeScript.Analyzer/TypedSignalR.Client.TypeScript.Analyzer.csproj
+++ b/src/TypedSignalR.Client.TypeScript.Analyzer/TypedSignalR.Client.TypeScript.Analyzer.csproj
@@ -9,6 +9,7 @@
false
true
true
+ true
TypedSignalR.Client.TypeScript.Analyzer
diff --git a/src/TypedSignalR.Client.TypeScript.Generator/App.cs b/src/TypedSignalR.Client.TypeScript.Generator/App.cs
index 93f8518..0c94f58 100644
--- a/src/TypedSignalR.Client.TypeScript.Generator/App.cs
+++ b/src/TypedSignalR.Client.TypeScript.Generator/App.cs
@@ -39,6 +39,8 @@ public async Task Transpile(
NamingStyle namingStyle = NamingStyle.CamelCase,
[Option("en", "value (default) / nameString / nameCamel / NamePascal / union / unionCamel / UnionPascal")]
EnumStyle @enum = EnumStyle.Value,
+ [Option("m", "camelCase (default) / PascalCase / none (The name in C# is used as it is.)")]
+ MethodStyle method = MethodStyle.CamelCase,
[Option("attr", "The flag whether attributes such as JsonPropertyName should affect transpilation.")]
bool attribute = true)
{
@@ -50,7 +52,7 @@ public async Task Transpile(
{
var compilation = await this.CreateCompilationAsync(project);
- await TranspileCore(compilation, output, newLine, 4, assemblies, serializer, namingStyle, @enum, attribute);
+ await TranspileCore(compilation, output, newLine, 4, assemblies, serializer, namingStyle, @enum, method, attribute);
_logger.Log(LogLevel.Information, "======== Transpilation is completed. ========");
_logger.Log(LogLevel.Information, "Please check the output folder: {output}", output);
@@ -89,6 +91,7 @@ private async Task TranspileCore(
SerializerOption serializerOption,
NamingStyle namingStyle,
EnumStyle enumStyle,
+ MethodStyle methodStyle,
bool enableAttributeReference)
{
var typeMapperProvider = new DefaultTypeMapperProvider(compilation, referencedAssembliesTranspilation);
@@ -98,12 +101,13 @@ private async Task TranspileCore(
typeMapperProvider.AddTypeMapper(new AsyncEnumerableTypeMapper(compilation));
typeMapperProvider.AddTypeMapper(new ChannelReaderTypeMapper(compilation));
- var options = new TranspilationOptions(
+ var options = new TypedSignalRTranspilationOptions(
compilation,
typeMapperProvider,
serializerOption,
namingStyle,
enumStyle,
+ methodStyle,
newLine,
indent,
referencedAssembliesTranspilation,
diff --git a/src/TypedSignalR.Client.TypeScript/ApiGenerator.cs b/src/TypedSignalR.Client.TypeScript/ApiGenerator.cs
index 83e7a3a..158a8c3 100644
--- a/src/TypedSignalR.Client.TypeScript/ApiGenerator.cs
+++ b/src/TypedSignalR.Client.TypeScript/ApiGenerator.cs
@@ -11,14 +11,14 @@ namespace TypedSignalR.Client.TypeScript;
internal class ApiGenerator
{
- private readonly ITranspilationOptions _transpilationOptions;
+ private readonly ITypedSignalRTranspilationOptions _options;
private readonly ILogger _logger;
private readonly SpecialSymbols _specialSymbols;
- public ApiGenerator(SpecialSymbols specialSymbols, ITranspilationOptions transpilationOptions, ILogger logger)
+ public ApiGenerator(SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options, ILogger logger)
{
_specialSymbols = specialSymbols;
- _transpilationOptions = transpilationOptions;
+ _options = options;
_logger = logger;
}
@@ -32,7 +32,7 @@ public IReadOnlyList Generate(IReadOnlyList new TypeMetadata(x)).ToArray(),
ReceiverTypes = receiverTypes.Select(static x => new TypeMetadata(x)).ToArray(),
SpecialSymbols = _specialSymbols,
- TranspilationOptions = _transpilationOptions,
+ Options = _options,
};
return new[] { new GeneratedSourceCode("TypedSignalR.Client/index.ts", template.TransformText().NormalizeNewLines("\n")) };
diff --git a/src/TypedSignalR.Client.TypeScript/ITypedSignalRTranspilationOptions.cs b/src/TypedSignalR.Client.TypeScript/ITypedSignalRTranspilationOptions.cs
new file mode 100644
index 0000000..d91690f
--- /dev/null
+++ b/src/TypedSignalR.Client.TypeScript/ITypedSignalRTranspilationOptions.cs
@@ -0,0 +1,8 @@
+using Tapper;
+
+namespace TypedSignalR.Client.TypeScript;
+
+public interface ITypedSignalRTranspilationOptions : ITranspilationOptions
+{
+ MethodStyle MethodStyle { get; }
+}
diff --git a/src/TypedSignalR.Client.TypeScript/InterfaceTranspiler.cs b/src/TypedSignalR.Client.TypeScript/InterfaceTranspiler.cs
index 642c0eb..dd0b6ed 100644
--- a/src/TypedSignalR.Client.TypeScript/InterfaceTranspiler.cs
+++ b/src/TypedSignalR.Client.TypeScript/InterfaceTranspiler.cs
@@ -10,13 +10,13 @@ namespace TypedSignalR.Client.TypeScript;
internal class InterfaceTranspiler
{
private readonly SpecialSymbols _specialSymbols;
- private readonly ITranspilationOptions _transpilationOptions;
+ private readonly ITypedSignalRTranspilationOptions _options;
private readonly ILogger _logger;
- public InterfaceTranspiler(SpecialSymbols specialSymbols, ITranspilationOptions transpilationOptions, ILogger logger)
+ public InterfaceTranspiler(SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options, ILogger logger)
{
_specialSymbols = specialSymbols;
- _transpilationOptions = transpilationOptions;
+ _options = options;
_logger = logger;
}
@@ -37,7 +37,7 @@ public IReadOnlyList Transpile(IEnumerable interfaceTy
private static void AddInterface(
INamedTypeSymbol interfaceSymbol,
SpecialSymbols specialSymbols,
- ITranspilationOptions options,
+ ITypedSignalRTranspilationOptions options,
ref CodeWriter codeWriter)
{
codeWriter.AppendLine($"export type {interfaceSymbol.Name} = {{");
@@ -93,7 +93,7 @@ private static void AddInterface(
foreach (var method in interfaceSymbol.GetMethods())
{
WriteJSDoc(method, ref codeWriter);
- codeWriter.Append($" {method.Name.Format(options.NamingStyle)}(");
+ codeWriter.Append($" {method.Name.Format(options.MethodStyle)}(");
WriteParameters(method, options, specialSymbols, ref codeWriter);
codeWriter.Append("): ");
WriteReturnType(method, options, specialSymbols, ref codeWriter);
diff --git a/src/TypedSignalR.Client.TypeScript/MethodStyle.cs b/src/TypedSignalR.Client.TypeScript/MethodStyle.cs
new file mode 100644
index 0000000..e887c6d
--- /dev/null
+++ b/src/TypedSignalR.Client.TypeScript/MethodStyle.cs
@@ -0,0 +1,8 @@
+namespace TypedSignalR.Client.TypeScript;
+
+public enum MethodStyle
+{
+ None,
+ CamelCase,
+ PascalCase
+}
diff --git a/src/TypedSignalR.Client.TypeScript/StringExtensions.cs b/src/TypedSignalR.Client.TypeScript/StringExtensions.cs
index 371097a..083e756 100644
--- a/src/TypedSignalR.Client.TypeScript/StringExtensions.cs
+++ b/src/TypedSignalR.Client.TypeScript/StringExtensions.cs
@@ -5,24 +5,39 @@ namespace TypedSignalR.Client.TypeScript;
internal static class StringExtensions
{
- public static string NormalizeNewLines(this string source, string newline)
+ public static string NormalizeNewLines(this string text, string newline)
{
- return source.Replace("\r\n", "\n").Replace("\n", newline);
+ return text.Replace("\r\n", "\n").Replace("\n", newline);
}
- public static string NormalizeNewLines(this string source)
+ public static string NormalizeNewLines(this string text)
{
- return source.NormalizeNewLines(Environment.NewLine);
+ return text.NormalizeNewLines(Environment.NewLine);
}
- public static string Format(this string source, NamingStyle namingStyle)
+ public static string Format(this string text, NamingStyle namingStyle)
{
return namingStyle switch
{
- NamingStyle.None => source,
- NamingStyle.CamelCase => $"{char.ToLower(source[0])}{source[1..]}",
- NamingStyle.PascalCase => $"{char.ToUpper(source[0])}{source[1..]}",
+ NamingStyle.None => text,
+ NamingStyle.CamelCase => ToCamel(text),
+ NamingStyle.PascalCase => ToPascal(text),
_ => throw new InvalidOperationException(),
};
}
+
+ public static string Format(this string text, MethodStyle methodStyle)
+ {
+ return methodStyle switch
+ {
+ MethodStyle.None => text,
+ MethodStyle.CamelCase => ToCamel(text),
+ MethodStyle.PascalCase => ToPascal(text),
+ _ => throw new InvalidOperationException(),
+ };
+ }
+
+ private static string ToCamel(string text) => $"{char.ToLower(text[0])}{text[1..]}";
+
+ private static string ToPascal(string text) => $"{char.ToUpper(text[0])}{text[1..]}";
}
diff --git a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.Partial.cs b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.Partial.cs
index c5770ac..764f369 100644
--- a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.Partial.cs
+++ b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.Partial.cs
@@ -10,5 +10,5 @@ public partial class ApiTemplate
internal IReadOnlyList HubTypes { get; init; } = default!;
internal IReadOnlyList ReceiverTypes { get; init; } = default!;
internal SpecialSymbols SpecialSymbols { get; init; } = default!;
- internal ITranspilationOptions TranspilationOptions { get; init; } = default!;
+ internal ITypedSignalRTranspilationOptions Options { get; init; } = default!;
}
diff --git a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.cs b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.cs
index b2d6201..f76af6b 100644
--- a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.cs
+++ b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.cs
@@ -117,7 +117,7 @@ public constructor(
this.Write(this.ToStringHelper.ToStringWithCulture(hubType.Name));
this.Write(" {\r\n\r\n public constructor(private connection: HubConnection) {\r\n }\r\n");
foreach(var method in hubType.Methods) {
- this.Write(this.ToStringHelper.ToStringWithCulture(method.CreateMethodString(SpecialSymbols, TranspilationOptions)));
+ this.Write(this.ToStringHelper.ToStringWithCulture(method.CreateMethodString(SpecialSymbols, Options)));
this.Write("\r\n");
}
this.Write("}\r\n\r\n");
@@ -136,9 +136,9 @@ public constructor(
this.Write("): Disposable => {\r\n\r\n");
foreach(var method in receiverType.Methods) {
this.Write(" const __");
- this.Write(this.ToStringHelper.ToStringWithCulture(method.Name.Format(TranspilationOptions.NamingStyle)));
+ this.Write(this.ToStringHelper.ToStringWithCulture(method.Name.Format(Options.NamingStyle)));
this.Write(" = ");
- this.Write(this.ToStringHelper.ToStringWithCulture(method.WrapLambdaExpressionSyntax(TranspilationOptions)));
+ this.Write(this.ToStringHelper.ToStringWithCulture(method.WrapLambdaExpressionSyntax(Options)));
this.Write(";\r\n");
}
this.Write("\r\n");
@@ -146,7 +146,7 @@ public constructor(
this.Write(" connection.on(\"");
this.Write(this.ToStringHelper.ToStringWithCulture(method.Name));
this.Write("\", __");
- this.Write(this.ToStringHelper.ToStringWithCulture(method.Name.Format(TranspilationOptions.NamingStyle)));
+ this.Write(this.ToStringHelper.ToStringWithCulture(method.Name.Format(Options.NamingStyle)));
this.Write(");\r\n");
}
this.Write("\r\n const methodList: ReceiverMethod[] = [\r\n");
@@ -154,7 +154,7 @@ public constructor(
this.Write(" { methodName: \"");
this.Write(this.ToStringHelper.ToStringWithCulture(receiverType.Methods[i].Name));
this.Write("\", method: __");
- this.Write(this.ToStringHelper.ToStringWithCulture(receiverType.Methods[i].Name.Format(TranspilationOptions.NamingStyle)));
+ this.Write(this.ToStringHelper.ToStringWithCulture(receiverType.Methods[i].Name.Format(Options.NamingStyle)));
this.Write(" }");
this.Write(this.ToStringHelper.ToStringWithCulture(i != receiverType.Methods.Count - 1 ? "," : ""));
this.Write("\r\n");
diff --git a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.tt b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.tt
index 37857ce..83a6471 100644
--- a/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.tt
+++ b/src/TypedSignalR.Client.TypeScript/Templates/ApiTemplate.tt
@@ -91,7 +91,7 @@ class <#= hubType.Name #>_HubProxy implements <#= hubType.Name #> {
public constructor(private connection: HubConnection) {
}
<# foreach(var method in hubType.Methods) { #>
-<#= method.CreateMethodString(SpecialSymbols, TranspilationOptions) #>
+<#= method.CreateMethodString(SpecialSymbols, Options) #>
<# } #>
}
@@ -110,16 +110,16 @@ class <#= receiverType.Name #>_Binder implements ReceiverRegister<<#= receiverTy
public readonly register = (connection: HubConnection, receiver: <#= receiverType.Name #>): Disposable => {
<# foreach(var method in receiverType.Methods) { #>
- const __<#= method.Name.Format(TranspilationOptions.NamingStyle) #> = <#= method.WrapLambdaExpressionSyntax(TranspilationOptions) #>;
+ const __<#= method.Name.Format(Options.NamingStyle) #> = <#= method.WrapLambdaExpressionSyntax(Options) #>;
<# } #>
<# foreach(var method in receiverType.Methods) { #>
- connection.on("<#= method.Name #>", __<#= method.Name.Format(TranspilationOptions.NamingStyle) #>);
+ connection.on("<#= method.Name #>", __<#= method.Name.Format(Options.NamingStyle) #>);
<# } #>
const methodList: ReceiverMethod[] = [
<# for(int i = 0; i < receiverType.Methods.Count; i++) { #>
- { methodName: "<#= receiverType.Methods[i].Name #>", method: __<#= receiverType.Methods[i].Name.Format(TranspilationOptions.NamingStyle) #> }<#= i != receiverType.Methods.Count - 1 ? "," : "" #>
+ { methodName: "<#= receiverType.Methods[i].Name #>", method: __<#= receiverType.Methods[i].Name.Format(Options.NamingStyle) #> }<#= i != receiverType.Methods.Count - 1 ? "," : "" #>
<# } #>
]
diff --git a/src/TypedSignalR.Client.TypeScript/Templates/MethodSymbolExtensions.cs b/src/TypedSignalR.Client.TypeScript/Templates/MethodSymbolExtensions.cs
index d87cd62..d35ce2c 100644
--- a/src/TypedSignalR.Client.TypeScript/Templates/MethodSymbolExtensions.cs
+++ b/src/TypedSignalR.Client.TypeScript/Templates/MethodSymbolExtensions.cs
@@ -1,24 +1,23 @@
using System.Linq;
using Microsoft.CodeAnalysis;
-using Tapper;
using Tapper.TypeMappers;
namespace TypedSignalR.Client.TypeScript.Templates;
internal static class MethodSymbolExtensions
{
- public static string WrapLambdaExpressionSyntax(this IMethodSymbol methodSymbol, ITranspilationOptions options)
+ public static string WrapLambdaExpressionSyntax(this IMethodSymbol methodSymbol, ITypedSignalRTranspilationOptions options)
{
if (methodSymbol.Parameters.Length == 0)
{
- return $"() => receiver.{methodSymbol.Name.Format(options.NamingStyle)}()";
+ return $"() => receiver.{methodSymbol.Name.Format(options.MethodStyle)}()";
}
var parameters = ParametersToTypeArray(methodSymbol, options);
- return $"(...args: {parameters}) => receiver.{methodSymbol.Name.Format(options.NamingStyle)}(...args)";
+ return $"(...args: {parameters}) => receiver.{methodSymbol.Name.Format(options.MethodStyle)}(...args)";
}
- public static string CreateMethodString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ public static string CreateMethodString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
var methodType = methodSymbol.SelectHubMethodType(specialSymbols);
return methodType switch
@@ -30,7 +29,7 @@ public static string CreateMethodString(this IMethodSymbol methodSymbol, Special
};
}
- private static string ParametersToTypeScriptString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string ParametersToTypeScriptString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
var parameters = methodSymbol.Parameters
.Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol))
@@ -39,7 +38,7 @@ private static string ParametersToTypeScriptString(this IMethodSymbol methodSymb
return string.Join(", ", parameters);
}
- private static string ParametersToTypeScriptArgumentString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string ParametersToTypeScriptArgumentString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
var args = methodSymbol.Parameters
.Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol))
@@ -50,7 +49,7 @@ private static string ParametersToTypeScriptArgumentString(this IMethodSymbol me
: string.Empty;
}
- private static string ReturnTypeToTypeScriptString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string ReturnTypeToTypeScriptString(this IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
var returnType = methodSymbol.ReturnType;
// for sever-to-client streaming
@@ -79,15 +78,15 @@ private static string ReturnTypeToTypeScriptString(this IMethodSymbol methodSymb
return TypeMapper.MapTo(methodSymbol.ReturnType, options);
}
- private static string ParametersToTypeArray(IMethodSymbol methodSymbol, ITranspilationOptions options)
+ private static string ParametersToTypeArray(IMethodSymbol methodSymbol, ITypedSignalRTranspilationOptions options)
{
var parameters = methodSymbol.Parameters.Select(x => TypeMapper.MapTo(x.Type, options));
return $"[{string.Join(", ", parameters)}]";
}
- private static string CreateUnaryMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string CreateUnaryMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
- var name = methodSymbol.Name.Format(options.NamingStyle);
+ var name = methodSymbol.Name.Format(options.MethodStyle);
var parameters = methodSymbol.ParametersToTypeScriptString(specialSymbols, options);
var returnType = methodSymbol.ReturnTypeToTypeScriptString(specialSymbols, options);
var args = methodSymbol.ParametersToTypeScriptArgumentString(specialSymbols, options);
@@ -98,9 +97,9 @@ private static string CreateUnaryMethodString(IMethodSymbol methodSymbol, Specia
}}";
}
- private static string CreateServerToClientStreamingMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string CreateServerToClientStreamingMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
- var name = methodSymbol.Name.Format(options.NamingStyle);
+ var name = methodSymbol.Name.Format(options.MethodStyle);
var parameters = methodSymbol.ParametersToTypeScriptString(specialSymbols, options);
var returnType = methodSymbol.ReturnTypeToTypeScriptString(specialSymbols, options);
var args = methodSymbol.ParametersToTypeScriptArgumentString(specialSymbols, options);
@@ -111,9 +110,9 @@ private static string CreateServerToClientStreamingMethodString(IMethodSymbol me
}}";
}
- private static string CreateClientToServerStreamingMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITranspilationOptions options)
+ private static string CreateClientToServerStreamingMethodString(IMethodSymbol methodSymbol, SpecialSymbols specialSymbols, ITypedSignalRTranspilationOptions options)
{
- var name = methodSymbol.Name.Format(options.NamingStyle);
+ var name = methodSymbol.Name.Format(options.MethodStyle);
var parameters = methodSymbol.ParametersToTypeScriptString(specialSymbols, options);
var returnType = methodSymbol.ReturnTypeToTypeScriptString(specialSymbols, options);
var args = methodSymbol.ParametersToTypeScriptArgumentString(specialSymbols, options);
diff --git a/src/TypedSignalR.Client.TypeScript/TypedSignalRCodeGenerator.cs b/src/TypedSignalR.Client.TypeScript/TypedSignalRCodeGenerator.cs
index 98b38f7..894b94a 100644
--- a/src/TypedSignalR.Client.TypeScript/TypedSignalRCodeGenerator.cs
+++ b/src/TypedSignalR.Client.TypeScript/TypedSignalRCodeGenerator.cs
@@ -8,14 +8,14 @@ namespace TypedSignalR.Client.TypeScript;
public class TypedSignalRCodeGenerator
{
- private readonly ITranspilationOptions _options;
+ private readonly ITypedSignalRTranspilationOptions _options;
private readonly Compilation _compilation;
private readonly ILogger _logger;
public TypedSignalRCodeGenerator(
Compilation compilation,
- ITranspilationOptions options,
+ ITypedSignalRTranspilationOptions options,
ILogger logger)
{
_compilation = compilation;
diff --git a/src/TypedSignalR.Client.TypeScript/TypedSignalRTranspilationOptions.cs b/src/TypedSignalR.Client.TypeScript/TypedSignalRTranspilationOptions.cs
new file mode 100644
index 0000000..74cacfd
--- /dev/null
+++ b/src/TypedSignalR.Client.TypeScript/TypedSignalRTranspilationOptions.cs
@@ -0,0 +1,32 @@
+using Microsoft.CodeAnalysis;
+using Tapper;
+
+namespace TypedSignalR.Client.TypeScript;
+
+public class TypedSignalRTranspilationOptions : TranspilationOptions, ITypedSignalRTranspilationOptions
+{
+ public MethodStyle MethodStyle { get; }
+
+ public TypedSignalRTranspilationOptions(Compilation compilation,
+ ITypeMapperProvider typeMapperProvider,
+ SerializerOption serializerOption,
+ NamingStyle namingStyle,
+ EnumStyle enumStyle,
+ MethodStyle methodStyle,
+ NewLineOption newLineOption,
+ int indent,
+ bool referencedAssembliesTranspilation,
+ bool enableAttributeReference) : base(
+ compilation,
+ typeMapperProvider,
+ serializerOption,
+ namingStyle,
+ enumStyle,
+ newLineOption,
+ indent,
+ referencedAssembliesTranspilation,
+ enableAttributeReference)
+ {
+ MethodStyle = methodStyle;
+ }
+}
diff --git a/tests/TypeScriptTests/src/msgpack/clientResults.test.ts b/tests/TypeScriptTests/src/msgpack/clientResults.test.ts
index e6a08e6..2b37d1c 100644
--- a/tests/TypeScriptTests/src/msgpack/clientResults.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/clientResults.test.ts
@@ -11,10 +11,10 @@ const testMethod = async () => {
.build();
const receiver: IClientResultsTestHubReceiver = {
- GetGuidFromClient: (): Promise => {
+ getGuidFromClient: (): Promise => {
return Promise.resolve("ba3088bb-e7ea-4924-b01b-695e879bb166");
},
- GetPersonFromClient: (): Promise => {
+ getPersonFromClient: (): Promise => {
const person: Person = {
Id: "c2368532-2f13-4079-9631-a38a048d84e1",
Name: "Nana Daiba",
@@ -22,7 +22,7 @@ const testMethod = async () => {
}
return Promise.resolve(person);
},
- SumInClient: (left: number, right: number): Promise => {
+ sumInClient: (left: number, right: number): Promise => {
return Promise.resolve(left + right);
}
}
@@ -34,7 +34,7 @@ const testMethod = async () => {
.register(connection, receiver);
await connection.start();
- const result = await hubProxy.StartTest();
+ const result = await hubProxy.startTest();
expect(result).toEqual(true);
diff --git a/tests/TypeScriptTests/src/msgpack/receiver.test.ts b/tests/TypeScriptTests/src/msgpack/receiver.test.ts
index 6a8dd14..8dfb37b 100644
--- a/tests/TypeScriptTests/src/msgpack/receiver.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/receiver.test.ts
@@ -49,15 +49,15 @@ const testMethod = async () => {
let notifyCallCount = 0;
const receiver: IReceiver = {
- ReceiveMessage: (message: string, value: number): Promise => {
+ receiveMessage: (message: string, value: number): Promise => {
receiveMessageList.push([message, value]);
return Promise.resolve();
},
- Notify: (): Promise => {
+ notify: (): Promise => {
notifyCallCount += 1;
return Promise.resolve();
},
- ReceiveCustomMessage: (userDefined: UserDefinedType): Promise => {
+ receiveCustomMessage: (userDefined: UserDefinedType): Promise => {
userDefinedList.push(userDefined)
return Promise.resolve();
}
@@ -70,7 +70,7 @@ const testMethod = async () => {
.register(connection, receiver);
await connection.start();
- await hubProxy.Start();
+ await hubProxy.start();
expect(notifyCallCount).toEqual(17);
diff --git a/tests/TypeScriptTests/src/msgpack/receiverAsClass.test.ts b/tests/TypeScriptTests/src/msgpack/receiverAsClass.test.ts
index e1178be..9903af9 100644
--- a/tests/TypeScriptTests/src/msgpack/receiverAsClass.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/receiverAsClass.test.ts
@@ -44,15 +44,15 @@ class ReceiverAsClass implements IReceiver
public notifyCallCount: number = 0;
public userDefinedList: UserDefinedType[] = [];
- ReceiveMessage(message: string, value: number): Promise {
+ receiveMessage(message: string, value: number): Promise {
this.receiveMessageList.push([message, value]);
return Promise.resolve();
}
- Notify(): Promise {
+ notify(): Promise {
this.notifyCallCount += 1;
return Promise.resolve();
}
- ReceiveCustomMessage(userDefined: UserDefinedType): Promise {
+ receiveCustomMessage(userDefined: UserDefinedType): Promise {
this.userDefinedList.push(userDefined)
return Promise.resolve();
}
@@ -74,7 +74,7 @@ const testMethod = async () => {
.register(connection, receiver);
await connection.start();
- await hubProxy.Start();
+ await hubProxy.start();
const receiveMessageList = receiver.receiveMessageList;
const userDefinedList = receiver.userDefinedList;
diff --git a/tests/TypeScriptTests/src/msgpack/sideeffecthub.test.ts b/tests/TypeScriptTests/src/msgpack/sideeffecthub.test.ts
index 7eaeac9..7dd59b8 100644
--- a/tests/TypeScriptTests/src/msgpack/sideeffecthub.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/sideeffecthub.test.ts
@@ -24,13 +24,13 @@ const testMethod = async () => {
await connection.start();
- await hubProxy.Init()
- await hubProxy.Increment();
- await hubProxy.Increment();
- await hubProxy.Increment();
- await hubProxy.Increment();
+ await hubProxy.init()
+ await hubProxy.increment();
+ await hubProxy.increment();
+ await hubProxy.increment();
+ await hubProxy.increment();
- const r1 = await hubProxy.Result();
+ const r1 = await hubProxy.result();
expect(r1).toEqual(4);
@@ -43,10 +43,10 @@ const testMethod = async () => {
};
list.push(instance);
- await hubProxy.Post(instance);
+ await hubProxy.post(instance);
}
- const data = await hubProxy.Fetch();
+ const data = await hubProxy.fetch();
for (let i = 0; i < list.length; i++) {
const it1 = list[i];
diff --git a/tests/TypeScriptTests/src/msgpack/streaming.test.ts b/tests/TypeScriptTests/src/msgpack/streaming.test.ts
index 2cf23e0..85780ed 100644
--- a/tests/TypeScriptTests/src/msgpack/streaming.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/streaming.test.ts
@@ -38,7 +38,7 @@ const test_ZeroParameter = async (hubProxy: IStreamingHub) => {
var pcs = new PromiseCompletionSource();
const list: Person[] = [];
- hubProxy.ZeroParameter()
+ hubProxy.zeroParameter()
.subscribe({
next: (value: Person): void => {
list.push(value);
@@ -64,7 +64,7 @@ const test_CancellationTokenOnly = async (hubProxy: IStreamingHub) => {
var pcs = new PromiseCompletionSource();
const list: Person[] = [];
- hubProxy.CancellationTokenOnly()
+ hubProxy.cancellationTokenOnly()
.subscribe({
next: (value: Person): void => {
list.push(value);
@@ -98,7 +98,7 @@ const test_Counter = async (hubProxy: IStreamingHub) => {
const step = 2;
- hubProxy.Counter(publisher, 0, step, 10)
+ hubProxy.counter(publisher, 0, step, 10)
.subscribe({
next: (value: Message): void => {
list.push(value);
@@ -137,7 +137,7 @@ const test_CancelableCounter = async (hubProxy: IStreamingHub) => {
const step = 2;
- hubProxy.CancelableCounter(publisher, 0, step, 10)
+ hubProxy.cancelableCounter(publisher, 0, step, 10)
.subscribe({
next: (value: Message): void => {
list.push(value);
@@ -176,7 +176,7 @@ const test_TaskCancelableCounter = async (hubProxy: IStreamingHub) => {
const step = 2;
- hubProxy.TaskCancelableCounter(publisher, 0, step, 10)
+ hubProxy.taskCancelableCounter(publisher, 0, step, 10)
.subscribe({
next: (value: Message): void => {
list.push(value);
@@ -206,7 +206,7 @@ const test_ZeroParameterChannel = async (hubProxy: IStreamingHub) => {
var pcs = new PromiseCompletionSource();
const list: Person[] = [];
- hubProxy.ZeroParameterChannel()
+ hubProxy.zeroParameterChannel()
.subscribe({
next: (value: Person): void => {
list.push(value);
@@ -231,7 +231,7 @@ const test_CancellationTokenOnlyChannel = async (hubProxy: IStreamingHub) => {
var pcs = new PromiseCompletionSource();
const list: Person[] = [];
- hubProxy.CancellationTokenOnlyChannel()
+ hubProxy.cancellationTokenOnlyChannel()
.subscribe({
next: (value: Person): void => {
list.push(value);
@@ -265,7 +265,7 @@ const test_CounterChannel = async (hubProxy: IStreamingHub) => {
const step = 2;
- hubProxy.CounterChannel(publisher, 0, step, 10)
+ hubProxy.counterChannel(publisher, 0, step, 10)
.subscribe({
next: (value: Message): void => {
list.push(value);
@@ -304,7 +304,7 @@ const test_CancelableCounterChannel = async (hubProxy: IStreamingHub) => {
const step = 2;
- hubProxy.CancelableCounterChannel(publisher, 0, step, 10)
+ hubProxy.cancelableCounterChannel(publisher, 0, step, 10)
.subscribe({
next: (value: Message): void => {
list.push(value);
diff --git a/tests/TypeScriptTests/src/msgpack/unary.test.ts b/tests/TypeScriptTests/src/msgpack/unary.test.ts
index af4815b..569f832 100644
--- a/tests/TypeScriptTests/src/msgpack/unary.test.ts
+++ b/tests/TypeScriptTests/src/msgpack/unary.test.ts
@@ -28,19 +28,19 @@ const testMethod = async () => {
await connection.start();
- const r1 = await hubProxy.Get();
+ const r1 = await hubProxy.get();
expect(r1).toEqual("TypedSignalR.Client.TypeScript");
const x = getRandomInt(1000);
const y = getRandomInt(1000);
- const r2 = await hubProxy.Add(x, y);
+ const r2 = await hubProxy.add(x, y);
expect(r2).toEqual(x + y);
const s1 = "revue";
const s2 = "starlight";
- const r3 = await hubProxy.Cat(s1, s2);;
+ const r3 = await hubProxy.cat(s1, s2);;
expect(r3).toEqual(s1 + s2);
@@ -49,7 +49,7 @@ const testMethod = async () => {
Guid: crypto.randomUUID()
}
- const r4 = await hubProxy.Echo(instance);
+ const r4 = await hubProxy.echo(instance);
instance.DateTime = r4.DateTime
r4.DateTime = r4.DateTime