This repository has been archived by the owner on May 16, 2022. It is now read-only.
/
light-node-client.tt
608 lines (494 loc) · 23.3 KB
/
light-node-client.tt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="EnvDTE" #>
<#@ import namespace="EnvDTE" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Threading" #>
<#@ import namespace="System.Threading.Tasks" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension="ts" encoding="utf-8" #>
<#@ assembly name="$(SolutionDir)\Sample\LightNode.Sample.Server.ForAngularClient\bin\Debug\LightNode.Sample.Server.ForAngularClient.exe" #>
<#
// ------------- T4 Configuration ------------- //
// 1. Set LightNodeContract assemblies(and all dependency) path to above #@ assembly name # directive
// 2. Set Namespace & ClientName & Namespace
var clientName = "LightNodeClient";
var namespaceName = "LightNode";
// 3. Set allow upper camel case json(ex: true: json.PersonName, false: json.personName)
var allowUpperCamelJson = true;
// ----------End T4 Configuration ------------- //
var @isDebug = false;
var @serviceProvider = Host as IServiceProvider;
var @dte = serviceProvider.GetService(typeof(DTE)) as DTE;
var @config = dte.Solution
.FindProjectItem(Host.TemplateFile)
.ContainingProject
.ConfigurationManager
.ActiveConfiguration;
foreach(Property prop in config.Properties){
if (prop.Name == "Optimize"){
isDebug = !(bool)prop.Value;
break;
}
}
var typeMap = new Dictionary<string, string>()
{
{"String", "string"},
{"DateTime", "Date"},
{"Int16", "number"},
{"Int32", "number"},
{"Int64", "number"},
{"Single", "number"},
{"Double", "number"},
{"Decimal", "number"},
{"Void", "void"},
{"CancellationToken", "ng.IPromise<any>"}
};
Type[] complexTypes = {};
Type[] enumTypes = {};
Func<string, string> SwapType = (string name) =>
{
return typeMap.ContainsKey(name) ? typeMap[name]
: complexTypes.Any(x => x.Name == name) || enumTypes.All(x => x.Name == name) ? name
: "any";
};
Func<Type, bool> IsEnumerableType = (Type t) =>
{
return t != typeof(string)
&& ((t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|| t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEnumerable<>)));
};
Func<Type, string> BeautifyType = null;
BeautifyType = (Type t) =>
{
if (t.IsArray) return t.GetElementType() == typeof(byte) ? "ArrayBuffer" : BeautifyType(t.GetElementType()) + "[]";
if (!t.IsGenericType) return SwapType(t.Name);
if (t.GetGenericTypeDefinition() == typeof(Nullable<>)) return BeautifyType(t.GetGenericArguments()[0]);
if (IsEnumerableType(t)) return BeautifyType(t.GetGenericArguments()[0]) + "[]";
var innerFormat = string.Join(", ", t.GetGenericArguments().Select(x => BeautifyType(x)));
return Regex.Replace(t.GetGenericTypeDefinition().Name, @"`.+$", "") + "<" + innerFormat + ">";
};
Func<Type, Type> UnWrapNullableOrSelf = (Type t) =>
{
return t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>) ? t.GetGenericArguments()[0] : t;
};
Func<Type, Type> UnWrapEnumerableOrSelf = (Type t) =>
{
return t.IsArray ? t.GetElementType()
: t.IsGenericType && IsEnumerableType(t) ? t.GetGenericArguments()[0] : t;
};
Func<Type, bool> IsComplexType = (Type t) =>
{
var beautifyType = BeautifyType(t);
return typeMap.Values.All(x => x != beautifyType && x + "[]" != beautifyType);
};
Func<string, string> ToLowerCamelCase = (string value) =>
{
return Regex.Replace(value, "^(.)(.*)", x => x.Groups[1].Value.ToLower() + x.Groups[2].Value);
};
Func<Type, bool> ShouldCreateInstance = (Type t) =>
{
var beautifyType = BeautifyType(t).TrimEnd('[', ']');
return beautifyType == "Date" || complexTypes.Any(x => x.Name == beautifyType);
};
var lowerClientName = ToLowerCamelCase(clientName);
var ignoreMethods = new HashSet<string> { "Equals", "GetHashCode", "GetType", "ToString" };
var typeFromAssemblies = System.AppDomain.CurrentDomain
.GetAssemblies()
.Where(x => !Regex.IsMatch(x.GetName().Name, "^(mscorlib|System|Sytem.Web|EnvDTE)$"))
.SelectMany(x => x.GetTypes())
.Where(x => x != null && x.FullName != "LightNode.Server.LightNodeContract");
var contracts = typeFromAssemblies
.Where(x =>
{
while (x != typeof(object) && x != null)
{
if (x.FullName == "LightNode.Server.LightNodeContract") return true;
x = x.BaseType;
}
return false;
})
.Where(x => !x.IsAbstract && x.GetCustomAttributes(true).All(y => y.GetType().FullName != "LightNode.Server.IgnoreOperationAttribute" && y.GetType().FullName != "LightNode.Server.IgnoreClientGenerateAttribute"))
.Select(x =>
{
var methods = x.GetMethods(BindingFlags.Public | BindingFlags.Instance)
.Where(methodInfo => !(methodInfo.IsSpecialName && (methodInfo.Name.StartsWith("set_") || methodInfo.Name.StartsWith("get_"))))
.Where(methodInfo => !ignoreMethods.Contains(methodInfo.Name))
.Where(methodInfo => methodInfo.GetCustomAttributes(true).All(y => y.GetType().FullName != "LightNode.Server.IgnoreOperationAttribute" && y.GetType().FullName != "LightNode.Server.IgnoreClientGenerateAttribute"))
.Select(methodInfo =>
{
var retType = methodInfo.ReturnType;
var returnType =
(retType == typeof(Task)) ? typeof(void)
: (retType.IsGenericType && retType.GetGenericTypeDefinition() == typeof(Task<>)) ? retType.GetGenericArguments()[0]
: retType;
var parameter = methodInfo.GetParameters()
.Select(paramInfo => new
{
paramInfo.Name,
paramInfo.ParameterType,
paramInfo.IsOptional,
paramInfo.DefaultValue,
IsBoolean = paramInfo.ParameterType == typeof(Boolean),
IsCancellationToken = false,
})
.Concat(new[]{new
{
Name = "cancellationToken",
ParameterType = typeof(CancellationToken),
IsOptional = true,
DefaultValue = (object)default(CancellationToken),
IsBoolean = false,
IsCancellationToken = true,
}})
.ToArray();
var parameterString = string.Join(", ", parameter.Select(p =>
{
return p.Name + (p.IsOptional ? "?" : "") + ": " + BeautifyType(p.ParameterType);
}));
var parameterStringWithOptional = string.Join(", ", parameter.Select(p =>
{
var withoutValue = p.Name + (p.IsOptional ? "?" : "") + ": " + BeautifyType(p.ParameterType);
if (p.IsOptional)
{
var withValueBase = p.Name + ": " + BeautifyType(p.ParameterType);
return (
(p.DefaultValue == null) ? withoutValue
: (p.DefaultValue is string) ? withValueBase + " = \"" + p.DefaultValue + "\""
: (p.DefaultValue is CancellationToken) ? withoutValue
: (p.ParameterType.IsEnum) ? withValueBase + " = " + p.ParameterType.Name + "." + p.DefaultValue.ToString()
: withValueBase + " = " + p.DefaultValue.ToString().ToLower());
} else {
return withoutValue;
}
}));
var debugOnlyClientGenerateMethod = methodInfo.GetCustomAttributes(true).Any(y => y.GetType().FullName == "LightNode.Server.DebugOnlyClientGenerateAttribute");
return new
{
OperationName = methodInfo.Name,
ReturnType = returnType,
IsReturnBinary = returnType == typeof(byte[]),
Parameters = parameter,
ParameterString = parameterString,
ParameterStringWithOptional = parameterStringWithOptional,
IsDebugOnly = debugOnlyClientGenerateMethod
};
})
.Where(method => isDebug || !method.IsDebugOnly)
.ToArray();
var debugOnlyClientGenerate = x.GetCustomAttributes(true).Any(y => y.GetType().FullName == "LightNode.Server.DebugOnlyClientGenerateAttribute");
return new
{
RootName = x.Name,
InterfaceName = "_I" + x.Name,
Operations = methods,
IsDebugOnly = debugOnlyClientGenerate
};
})
.Where(contract => isDebug || !contract.IsDebugOnly)
.ToArray();
var @shouldDefineReturnTypes = contracts
.Where(x => isDebug || !x.IsDebugOnly)
.SelectMany(x => x.Operations)
.Where(x => isDebug || !x.IsDebugOnly)
.Select(x => x.ReturnType)
.Select(x => UnWrapEnumerableOrSelf(x))
.Select(x => UnWrapNullableOrSelf(x))
.Where(x => IsComplexType(x))
.ToArray();
var @shouldDefineParameterTypes = contracts
.Where(x => isDebug || !x.IsDebugOnly)
.SelectMany(x => x.Operations)
.Where(x => isDebug || !x.IsDebugOnly)
.SelectMany(x => x.Parameters)
.Select(x => x.ParameterType)
.Select(x => UnWrapEnumerableOrSelf(x))
.Select(x => UnWrapNullableOrSelf(x))
.Where(x => IsComplexType(x))
.Where(x => x.IsEnum) // parameter is not allowed class
.ToArray();
complexTypes = typeFromAssemblies
.Where(x => x.GetCustomAttributes(true).Any(y => y.GetType().FullName == "LightNode.Server.DefineTypeScriptGenerateAttribute"))
.Concat(shouldDefineReturnTypes)
.Where(x => x.IsClass)
.Distinct()
.Where(x => isDebug || x.GetCustomAttributes(true).All(y => y.GetType().FullName != "LightNode.Server.DebugOnlyClientGenerateAttribute"))
.ToArray();
enumTypes = typeFromAssemblies
.Where(x => x.GetCustomAttributes(true).Any(y => y.GetType().FullName == "LightNode.Server.DefineTypeScriptGenerateAttribute"))
.Concat(shouldDefineReturnTypes)
.Concat(shouldDefineParameterTypes)
.Where(x => x.IsEnum)
.Distinct()
.Where(x => isDebug || x.GetCustomAttributes(true).All(y => y.GetType().FullName != "LightNode.Server.DebugOnlyClientGenerateAttribute"))
.ToArray();
#>
/* tslint:disable */
namespace <#= namespaceName #> {
"use strict";
//#region LightNode
angular.module("lightNode", [])
.provider("lightNodeClientHandler", [function () {
this.defaultRequestHeaders = true;
this.lightNodeClientHandlerFactory = function ($http: ng.IHttpService) {
let handler = new LightNodeClientHandler($http);
return handler;
};
this.$get = ["$http", this.lightNodeClientHandlerFactory];
}])
.provider("<#= lowerClientName #>", [function () {
this.lightNodeClientFactory =
function ($q: ng.IQService, rootEndPoint: string, lightNodeClientHandler: LightNodeClientHandler) {
let client = new <#= clientName #>($q, rootEndPoint, lightNodeClientHandler);
client.timeout = this.timeout;
Object.keys(this.defaultRequestHeaders || {}).forEach(
(x: string) => {
client.defaultRequestHeaders[x] = this.defaultRequestHeaders[x];
});
return client;
};
this.$get = [
"$q", "lightNodeClientHandler",
function ($q: ng.IQService, lightNodeClientHandler: LightNodeClientHandler) {
return this.lightNodeClientFactory($q, this.rootEndPoint, lightNodeClientHandler);
}];
}]);
export interface ILightNodeClientHandlerProvider {
lightNodeClientHandlerFactory: ($http: ng.IHttpService) => LightNodeClientHandler;
}
export interface ILightNodeClientProvider {
rootEndPoint: string;
defaultRequestHeaders: { [key: string]: string };
timeout: number;
lightNodeClientFactory: ($q: ng.IQService, rootEndPoint: string, $http: ng.IHttpService) => LightNodeClientBase;
}
export interface IHttpResponseTransformer<T> {
(data: any, headersGetter: ng.IHttpHeadersGetter, status: number): T;
}
export class ArgumentError extends Error {
constructor(message: string = "Value does not fall within the expected range.", paramName?: string) {
super();
this.name = "ArgumentError";
this.message = message + (paramName ? ": " + paramName : "");
}
}
export class ArgumentNullError extends ArgumentError {
constructor(paramName?: string, message: string = "Value cannot be null.") {
super(message, paramName);
this.name = "ArgumentNullError";
}
}
export class ArgumentOutOfRangeError extends ArgumentError {
constructor(paramName?: string, message: string = "Specified argument was out of the range of valid values.") {
super(message, paramName);
this.name = "ArgumentOutOfRangeError";
}
}
export class LightNodeClientHandler {
constructor(private $http: ng.IHttpService) {
if (!$http) {
throw new ArgumentNullError("$http");
}
}
protected serializeToFormData(data: any): string {
return Object.keys(data || {})
.map((x: string) => {
let value = data[x];
if (value === void 0 || value === null) {
value = "";
}
return encodeURIComponent(x) + "=" + encodeURIComponent(value);
})
.join("&");
}
public post<T>(
url: string,
data?: any,
timeout?: number | ng.IPromise<any>,
requestHeaders?: ng.IHttpRequestConfigHeaders,
transformResponse?: IHttpResponseTransformer<T>,
responseType?: string): ng.IPromise<T> {
if (!url) {
throw new ArgumentNullError("url");
}
let config = <ng.IRequestShortcutConfig>{
timeout: timeout,
headers: requestHeaders,
responseType: responseType || "json",
transformResponse: transformResponse
};
return this.$http.post(url, this.serializeToFormData(data), config);
}
}
export class CancellationTokenSource {
constructor(private deferred: ng.IDeferred<any>) {
if (!deferred) {
throw new ArgumentNullError("deferred");
}
}
public get token(): ng.IPromise<any> {
return this.deferred.promise;
}
public cancel(): void {
this.deferred.resolve();
}
}
export class LightNodeClientBase {
constructor(private $q: ng.IQService, private rootEndPoint: string, private innerHandler: LightNodeClientHandler) {
if (!$q) {
throw new ArgumentNullError("$q");
}
if (!rootEndPoint) {
throw new ArgumentNullError("rootEndPoint");
}
if (!innerHandler) {
throw new ArgumentNullError("innerHandler");
}
this.$q = $q;
this.rootEndPoint = rootEndPoint.replace(/\/$/, "");
if (!this.rootEndPoint) {
throw new ArgumentOutOfRangeError("rootEndPoint");
}
this.innerHandler = innerHandler;
this._defaultRequestHeaders = {
"Content-Type": "application/x-www-form-urlencoded",
"X-Requested-With": "XMLHttpRequest"
};
}
private _timeout: number;
public get timeout(): number {
return this._timeout;
}
public set timeout(value: number) {
if (value <= 0) {
throw new ArgumentOutOfRangeError();
}
this._timeout = value;
}
private _defaultRequestHeaders: { [key: string]: string };
public get defaultRequestHeaders(): { [key: string]: string } {
return this._defaultRequestHeaders;
};
protected post<T>(
method: string,
data?: any,
cancellationToken?: ng.IPromise<any>,
transformResponse?: IHttpResponseTransformer<T>,
responseType?: string): ng.IPromise<T> {
if (!method) {
throw new ArgumentNullError("method");
}
return this.innerHandler.post(
this.rootEndPoint + method,
data,
cancellationToken || this.timeout,
this.defaultRequestHeaders,
transformResponse,
responseType)
.then((x: any) => x.data);
}
public createCancellationTokenSource(): CancellationTokenSource {
return new CancellationTokenSource(this.$q.defer<any>());
};
protected validStatusCode(status: number): boolean {
return 200 <= status && status <= 299;
}
protected parseJSON(json: any): any {
return typeof json === "string"
? JSON.parse(json)
: json;
}
}
//#endregion
<# foreach(var enumType in enumTypes) { #>
export enum <#= enumType.Name #> {
<# foreach(var enumMember in Enum.GetNames(enumType).Select(x => new { Name = x, Value = ((Enum)Enum.Parse(enumType, x)).ToString("d") }).ToArray()) { #>
<#= enumMember.Name #> = <#= enumMember.Value #><#= Enum.GetNames(enumType).Last() == enumMember.Name ? "" : "," #>
<# } #>
}
<# } #>
<# foreach(var complexType in complexTypes) { #>
export class <#= complexType.Name #> {
constructor(json?: any) {
<# foreach(var p in complexType.GetProperties().Where(x => x.CanRead).ToArray()) { #>
<# if(ShouldCreateInstance(p.PropertyType)) { #>
<# if(IsEnumerableType(p.PropertyType)) { #>
this.<#= ToLowerCamelCase(p.Name) #> = (<any[]>json.<#= p.Name #> || []).map((x: any) => x ? new <#= BeautifyType(p.PropertyType).TrimEnd('[', ']') #>(x) : null);
<# } else { #>
this.<#= ToLowerCamelCase(p.Name) #> = json.<#= allowUpperCamelJson ? p.Name : ToLowerCamelCase(p.Name) #> ? new <#= BeautifyType(p.PropertyType) #>(json.<#= allowUpperCamelJson ? p.Name : ToLowerCamelCase(p.Name) #>) : null;
<# } #>
<# } else { #>
this.<#= ToLowerCamelCase(p.Name) #> = json.<#= allowUpperCamelJson ? p.Name : ToLowerCamelCase(p.Name) #><#= IsEnumerableType(p.PropertyType) ? " || []" : "" #>;
<# } #>
<# } #>
}
<# foreach(var p in complexType.GetProperties().Where(x => x.CanRead).ToArray()) { #>
public <#= ToLowerCamelCase(p.Name) #>: <#= BeautifyType(p.PropertyType) #>;
<# } #>
}
<# } #>
<# foreach(var contract in contracts) { #>
export interface <#= contract.InterfaceName #> {
<# foreach(var operation in contract.Operations) { #>
<#= ToLowerCamelCase(operation.OperationName) #>(<#= operation.ParameterString #>): ng.IPromise<<#= BeautifyType(operation.ReturnType) #>>;
<# } #>
}
<# } #>
export class <#= clientName #> extends LightNodeClientBase {
constructor($q: ng.IQService, rootEndPoint: string, innerHandler: LightNodeClientHandler) {
super($q, rootEndPoint, innerHandler);
}
<# foreach(var contract in contracts) { #>
private _<#= ToLowerCamelCase(contract.RootName) #>: <#= contract.InterfaceName #>;
public get <#= ToLowerCamelCase(contract.RootName) #>(): <#= contract.InterfaceName #> {
if (!this._<#= ToLowerCamelCase(contract.RootName) #>) {
this._<#= ToLowerCamelCase(contract.RootName) #> = {
<# for(var i = 0; i < contract.Operations.Length; i++) { #>
<#= ToLowerCamelCase(contract.Operations[i].OperationName) #>: this.<#= ToLowerCamelCase(contract.RootName) #><#= contract.Operations[i].OperationName #>.bind(this)<#= i == contract.Operations.Length - 1 ? "" : "," #>
<# } #>
};
}
return this._<#= ToLowerCamelCase(contract.RootName) #>;
}
<# } #>
<# foreach(var contract in contracts) { #>
<# foreach(var operation in contract.Operations) { #>
protected <#= ToLowerCamelCase(contract.RootName) #><#= operation.OperationName #>(<#= operation.ParameterStringWithOptional #>): ng.IPromise<<#= BeautifyType(operation.ReturnType) #>> {
<# if(operation.Parameters.Any(x => !x.IsCancellationToken)) { #>
var data = {
<# foreach(var parameter in operation.Parameters.Where(x => !x.IsCancellationToken)) { #>
"<#= ToLowerCamelCase(parameter.Name) #>": <#= parameter.IsBoolean ? "!!" : "" #><#= ToLowerCamelCase(parameter.Name) #><#= operation.Parameters.Where(x => !x.IsCancellationToken).Last() == parameter ? "" : "," #>
<# } #>
};
<# } else { #>
var data = {};
<# } #>
<# if(operation.ReturnType == typeof(void) ) { #>
return this.post<<#= BeautifyType(operation.ReturnType) #>>("/<#= contract.RootName #>/<#= operation.OperationName #>", data, cancellationToken);
<# } else { #>
return this.post<<#= BeautifyType(operation.ReturnType) #>>("/<#= contract.RootName #>/<#= operation.OperationName #>", data, cancellationToken,
(data: any, headersGetter: ng.IHttpHeadersGetter, status: number) => {
<# if(ShouldCreateInstance(operation.ReturnType)) { #>
if (!this.validStatusCode(status)) {
return data;
}
<# if(IsEnumerableType(operation.ReturnType)) { #>
return (<any[]>this.parseJSON(data) || []).map((x: any) => x ? new <#= BeautifyType(operation.ReturnType).TrimEnd('[', ']') #>(x) : null);
<# } else { #>
let json = this.parseJSON(data);
return json ? new <#= BeautifyType(operation.ReturnType) #>(json) : null;
<# } #>
<# } else { #>
return <#= operation.IsReturnBinary ? "" : "this.parseJSON(" #>data<#= operation.IsReturnBinary ? "" : ")" #>;
<# } #>
}<#= operation.IsReturnBinary ? @", ""arraybuffer""" : "" #>);
<# } #>
}
<# } #>
<# } #>
}
}
/* tslint:enable */