@flock/wirespec 0.17.20 → 0.18.1-RC.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/arrow-arrow-annotations.mjs.map +1 -1
  2. package/arrow-arrow-atomic.mjs +13 -13
  3. package/arrow-arrow-atomic.mjs.map +1 -1
  4. package/arrow-arrow-core.mjs +588 -431
  5. package/arrow-arrow-core.mjs.map +1 -1
  6. package/arrow-arrow-exception-utils.mjs +30 -0
  7. package/arrow-arrow-exception-utils.mjs.map +1 -0
  8. package/clikt-clikt-mordant.mjs +318 -0
  9. package/clikt-clikt-mordant.mjs.map +1 -0
  10. package/clikt-clikt.mjs +3834 -3696
  11. package/clikt-clikt.mjs.map +1 -1
  12. package/colormath-root-colormath.mjs +619 -682
  13. package/colormath-root-colormath.mjs.map +1 -1
  14. package/kotlin-js-core.mjs +4 -0
  15. package/kotlin-js-core.mjs.map +1 -0
  16. package/kotlin-js.mjs +4 -0
  17. package/kotlin-js.mjs.map +1 -0
  18. package/kotlin-kotlin-stdlib.mjs +6284 -5825
  19. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  20. package/kotlin-openapi-bindings.mjs +8163 -8198
  21. package/kotlin-openapi-bindings.mjs.map +1 -1
  22. package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
  23. package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
  24. package/kotlin-rgxgen.mjs +2007 -2062
  25. package/kotlin-rgxgen.mjs.map +1 -1
  26. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
  27. package/kotlinx-atomicfu.mjs +4 -0
  28. package/kotlinx-atomicfu.mjs.map +1 -0
  29. package/kotlinx-coroutines-core.mjs +4 -0
  30. package/kotlinx-coroutines-core.mjs.map +1 -0
  31. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  32. package/kotlinx-io-kotlinx-io-core.mjs +803 -839
  33. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  34. package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
  35. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  36. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
  37. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  38. package/mordant-mordant-omnibus.mjs +4 -0
  39. package/mordant-mordant-omnibus.mjs.map +1 -0
  40. package/mordant-mordant.mjs +2525 -4426
  41. package/mordant-mordant.mjs.map +1 -1
  42. package/package.json +4 -7
  43. package/seskar-core.mjs +4 -0
  44. package/seskar-core.mjs.map +1 -0
  45. package/wirespec-bin.mjs +13 -1
  46. package/wirespec-fetch.d.ts +4 -1
  47. package/wirespec-fetch.mjs +34 -0
  48. package/wirespec-serialization.d.ts +13 -2
  49. package/wirespec-serialization.mjs +22 -1
  50. package/wirespec-src-compiler-core.mjs +2857 -3909
  51. package/wirespec-src-compiler-core.mjs.map +1 -1
  52. package/wirespec-src-compiler-emitters-java.mjs +1370 -413
  53. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  54. package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
  55. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  56. package/wirespec-src-compiler-emitters-python.mjs +1465 -387
  57. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  58. package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
  59. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
  60. package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
  61. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
  62. package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
  63. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  64. package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
  65. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  66. package/wirespec-src-compiler-ir.mjs +17369 -0
  67. package/wirespec-src-compiler-ir.mjs.map +1 -0
  68. package/wirespec-src-compiler-lib.mjs +662 -728
  69. package/wirespec-src-compiler-lib.mjs.map +1 -1
  70. package/wirespec-src-converter-avro.mjs +630 -656
  71. package/wirespec-src-converter-avro.mjs.map +1 -1
  72. package/wirespec-src-converter-common.mjs.map +1 -1
  73. package/wirespec-src-converter-openapi.mjs +1705 -2024
  74. package/wirespec-src-converter-openapi.mjs.map +1 -1
  75. package/wirespec-src-plugin-arguments.mjs +418 -459
  76. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  77. package/wirespec-src-plugin-cli.mjs +367 -331
  78. package/wirespec-src-plugin-cli.mjs.map +1 -1
  79. package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
  80. package/wirespec-src-plugin-npm.mjs +166 -359
  81. package/wirespec-src-plugin-npm.mjs.map +1 -1
  82. package/wirespec-src-tools-generator.mjs +79 -106
  83. package/wirespec-src-tools-generator.mjs.map +1 -1
  84. package/arrow-arrow-continuations.mjs +0 -18
  85. package/arrow-arrow-continuations.mjs.map +0 -1
  86. package/markdown.mjs +0 -6756
  87. package/markdown.mjs.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  paramList3pq2vf0mu7as2 as paramList,
3
- Spacer_instancel9yep7i0q3er as Spacer_instance,
3
+ Spacer_instance1p6915grp4mfk as Spacer_instance,
4
4
  importReferencesy4xv7r53sjjs as importReferences,
5
5
  spacer28p2fwyb64afn as spacer,
6
6
  Emitted12h24rpo4uifw as Emitted,
7
7
  ClientEmitter36x0lk1twctuf as ClientEmitter,
8
8
  LanguageEmitterxhzgykhux3qm as LanguageEmitter,
9
- FileExtension_TypeScript_getInstancelv1vlncbu27z as FileExtension_TypeScript_getInstance,
9
+ FileExtension_TypeScript_getInstancebhrmnb4pwt10 as FileExtension_TypeScript_getInstance,
10
10
  hasEndpointsl5cepru27xfm as hasEndpoints,
11
11
  namespace2467cajrmgrc5 as namespace,
12
- Companion_instance2ag0h5twtdral as Companion_instance,
12
+ Companion_instance1a2xqc448tlhh as Companion_instance,
13
13
  plus3lrm73de10b42 as plus,
14
14
  emitClientEndpointRequest3pvx0vdco72lr as emitClientEndpointRequest,
15
15
  Paramvfwnys2w6aj1 as Param,
@@ -17,110 +17,197 @@ import {
17
17
  distinctByStatus134zrt4nyr6p2 as distinctByStatus,
18
18
  fixStatus2l9jrn3538wpy as fixStatus,
19
19
  get_indexedPathParams2pzt0qs62068 as get_indexedPathParams,
20
- Companion_instance2piryw1e8zn12 as Companion_instance_0,
20
+ Companion_instancebcq57hoyp8c2 as Companion_instance_0,
21
21
  get_pathParamsf41cxx5qebxt as get_pathParams,
22
22
  paramList1sr74geu9w202 as paramList_0,
23
23
  FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
24
- Bytes_instance2qx139msy62dm as Bytes_instance,
25
- Boolean_instance15dmfsx1e5thd as Boolean_instance,
26
- RegExpiyof7szm5zfu as RegExp_0,
27
- String1czvr8pxnm6on as String_0,
24
+ Bytes3eoc50vgt1uem as Bytes,
25
+ Boolean1fpfi8m5jt3fg as Boolean_0,
28
26
  Number1mui0heypwdhp as Number_0,
29
27
  Integer39lqx4uc63u28 as Integer,
28
+ String1czvr8pxnm6on as String_0,
30
29
  Primitive1i8my14jkp3nk as Primitive,
31
30
  Custom1lu6o8txpimqz as Custom,
32
31
  Anyv7qdq63z63rc as Any,
33
32
  Unit2z95clvxm08vr as Unit,
34
33
  Iterable29qbzfup67wqp as Iterable,
35
34
  Dict3g7w5wia7rncj as Dict,
36
- Bytes3eoc50vgt1uem as Bytes,
37
- Boolean1fpfi8m5jt3fg as Boolean_0,
35
+ Shared1uygqfbd22ukz as Shared,
36
+ Bytes_instance1o9u095wd3kx6 as Bytes_instance,
37
+ Boolean_instance237vwt01w3hs8 as Boolean_instance,
38
+ RegExpiyof7szm5zfu as RegExp_0,
38
39
  Bound2mp7s0560derz as Bound,
39
- _RegExp___get_value__impl__7o76182ohb7gkdeho1s as _RegExp___get_value__impl__7o7618,
40
+ _RegExp___get_value__impl__7o76182iqk274prw39c as _RegExp___get_value__impl__7o7618,
40
41
  TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
41
42
  } from './wirespec-src-compiler-core.mjs';
42
43
  import {
43
- VOID7hggqo3abtya as VOID,
44
+ VOID3gxj6tk5isa35 as VOID,
44
45
  joinToString1cxrrlmo0chqs as joinToString,
45
46
  trimMarginhyd3fsmh8iev as trimMargin,
46
- Unit_instanceat14thlj150z as Unit_instance,
47
- ArrayList_init_$Create$2rimpp4x9tjd3 as ArrayList_init_$Create$,
47
+ Unit_instance28fytmsmm6r23 as Unit_instance,
48
+ ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
48
49
  addAll1k27qatfgp3k5 as addAll,
49
- HashSet_init_$Create$2bsk5herqkxxm as HashSet_init_$Create$,
50
+ HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
50
51
  protoOf180f3jzyo7rfj as protoOf,
51
52
  initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
52
53
  THROW_CCE2g6jy02ryeudk as THROW_CCE,
53
54
  isCharSequence1ju9jr1w86plq as isCharSequence,
54
55
  trimStart5ewg8zf6cs5u as trimStart,
55
56
  toString1pkumu07cwy4m as toString,
56
- LinkedHashMap_init_$Create$2gfxg59gogbfz as LinkedHashMap_init_$Create$,
57
- ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$_0,
57
+ LinkedHashMap_init_$Create$3t495nfs82xn as LinkedHashMap_init_$Create$,
58
+ ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
58
59
  collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
59
60
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
60
61
  noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
61
62
  prependIndentkl9wuvcodvmu as prependIndent,
62
63
  first58ocm7j58k3q as first,
64
+ emptyList1g2z5xcrvp2zy as emptyList,
65
+ listOfvhqybd2zx248 as listOf,
66
+ plus310ted5e4i90h as plus_0,
67
+ KProperty1ca4yb4wlo496 as KProperty1,
68
+ getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
69
+ StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
70
+ charSequenceLength3278n89t01tmv as charSequenceLength,
71
+ charSequenceGet1vxk1y5n17t1z as charSequenceGet,
72
+ isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
73
+ _Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
74
+ charCodeAt1yspne1d8erbm as charCodeAt,
75
+ toString3dhdjl9yf50de as toString_0,
76
+ substring3saq8ornu0luv as substring,
77
+ Regex_init_$Create$9xrx4twz2i6q as Regex_init_$Create$,
78
+ getStringHashCode26igk1bx568vk as getStringHashCode,
79
+ getBooleanHashCode1bbj3u6b3v0a7 as getBooleanHashCode,
80
+ setOf45ia9pnfhe90 as setOf,
81
+ initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
82
+ to2cs3ny02qtbcb as to,
83
+ toMap1vec9topfei08 as toMap,
84
+ isInterface3d6p8outrmvmk as isInterface,
85
+ ensureNotNull1e947j3ixpazm as ensureNotNull,
86
+ mapOf2zpbbmyqk8xpf as mapOf,
87
+ charArrayOf27f4r3dozbrk1 as charArrayOf,
88
+ trimEndvvzjdhan75g as trimEnd,
89
+ Collection1k04j3hzsbod0 as Collection,
90
+ substringAfterLastuw9v7gfiiihe as substringAfterLast,
91
+ removePrefix279df90bhrqqg as removePrefix,
92
+ toIntOrNull3w2d066r9pvwm as toIntOrNull,
93
+ lazy2hsh8ze7j6ikd as lazy,
94
+ distinct10qe1scfdvu5k as distinct,
95
+ toSet2orjxp16sotqu as toSet,
96
+ listOf1jh22dvmctj1r as listOf_0,
63
97
  equals2au1ep9vhcato as equals,
64
98
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
65
- isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
66
- _Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
67
99
  Char19o2r8palgjof as Char,
68
- listOfvhqybd2zx248 as listOf,
69
100
  asSequence3lsvgkvyzox0q as asSequence,
70
101
  filter184huxd00uyfg as filter,
71
102
  joinToStringooja5rkatz3u as joinToString_0,
72
103
  listOfNotNull2woi2boe01ub4 as listOfNotNull,
73
- charSequenceLength3278n89t01tmv as charSequenceLength,
74
104
  } from './kotlin-kotlin-stdlib.mjs';
105
+ import {
106
+ _NonEmptyList___get_all__impl__pmf5092svcdxelgy1aa as _NonEmptyList___get_all__impl__pmf509,
107
+ NonEmptyList3ak25ihy2gcvs as NonEmptyList,
108
+ _NonEmptyList___init__impl__fxd0xp3qwfhfa83yk9f as _NonEmptyList___init__impl__fxd0xp,
109
+ NonEmptyList__toList_impl_t5xcy2362qtlja6arn8 as NonEmptyList__toList_impl_t5xcy2,
110
+ NonEmptyList__plus_impl_xqmb92tle8a7jcf2wm as NonEmptyList__plus_impl_xqmb9,
111
+ NonEmptyList__plus_impl_xqmb91y38uyofmba13 as NonEmptyList__plus_impl_xqmb9_0,
112
+ } from './arrow-arrow-core.mjs';
113
+ import {
114
+ RawElement2yts1x2rbem1g as RawElement,
115
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
116
+ withElements2toq84v08e72 as withElements,
117
+ Namespace345pal554qu3j as Namespace,
118
+ transformChildrend9p91tpcqdkx as transformChildren,
119
+ rawttvqxl50flj9 as raw,
120
+ TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
121
+ Nameoqr8dt2fim9d as Name,
122
+ transformChildren2mszeagj5nq4c as transformChildren_0,
123
+ sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
124
+ Assignment3kcxc8wlcbmkn as Assignment,
125
+ ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
126
+ VariableReference2vlynnhaw1i64 as VariableReference,
127
+ SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
128
+ convert13xvfhgrf57n5 as convert,
129
+ TransformScopeyrd3lf4zrk76 as TransformScope,
130
+ transform3eti8i2bqvifx as transform,
131
+ Elementitq62jg6fid3 as Element,
132
+ generateTypeScript3suyjcpb6ts4n as generateTypeScript,
133
+ FunctionCall30872kpnbr7op as FunctionCall,
134
+ FieldCall1iz7z2fx2xo4p as FieldCall,
135
+ Custom2si7lto3wompr as Custom_0,
136
+ Parameteruqoxd4rzw7ga as Parameter,
137
+ Function21cuq8qizkin7 as Function,
138
+ BinaryOp35p72iprkxis9 as BinaryOp,
139
+ ErrorStatement1fq19ynue37ia as ErrorStatement,
140
+ Literal50s1y3607cdv as Literal_0,
141
+ Switch3a1zi3na98deu as Switch,
142
+ Interface3pn84xq686t2r as Interface,
143
+ TypeScriptGenerator_instance39tclamtqqcmq as TypeScriptGenerator_instance,
144
+ RawExpression2bo7ldfrptjia as RawExpression,
145
+ Integer1uwg1wvo5lp6z as Integer_0,
146
+ Case2i7oahw4alz6h as Case,
147
+ emit1oxjujel6f3jb as emit,
148
+ emit3bzdcd0f6nwtj as emit_0,
149
+ File3dimy4iqmuock as File,
150
+ emitn3eihixilqyh as emit_1,
151
+ import5uhkz67bd8tt as import_0,
152
+ classifyValidatableFields11bv88x0ho39r as classifyValidatableFields,
153
+ convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
154
+ sanitizeNames2wqmyf8vafp9x as sanitizeNames,
155
+ convert11ert2po54h1y as convert_0,
156
+ convert37aabdzvtv9vg as convert_1,
157
+ convert17zcptkz4mhr4 as convert_2,
158
+ convertConstraintkgpvomct0x0s as convertConstraint,
159
+ requestParameters1z8fdizgtviyb as requestParameters,
160
+ convert32tuiui3czihh as convert_3,
161
+ convert1cn4bolzoed8c as convert_4,
162
+ IrEmitterh2m93ojzvkep as IrEmitter,
163
+ } from './wirespec-src-compiler-ir.mjs';
75
164
  //region block: imports
165
+ var imul = Math.imul;
76
166
  //endregion
77
167
  //region block: pre-declaration
78
- function emit(identifier) {
79
- return '"' + identifier.b1() + '"';
168
+ function emit_2(identifier) {
169
+ return '"' + identifier.l1() + '"';
80
170
  }
81
171
  initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
82
172
  function sanitizeSymbol(_this__u8e3s4) {
83
- return this.n2b(_this__u8e3s4.b1());
173
+ return this.w1v(_this__u8e3s4.l1());
84
174
  }
85
175
  function sanitizeSymbol_0(_this__u8e3s4) {
86
176
  var tmp = asSequence(_this__u8e3s4);
87
177
  return joinToString_0(filter(tmp, TypeScriptTypeDefinitionEmitter$sanitizeSymbol$lambda), '');
88
178
  }
89
- function emit_0(type, module_0) {
90
- // Inline function 'kotlin.collections.map' call
179
+ function emit_3(type, module_0) {
91
180
  // Inline function 'kotlin.collections.distinctBy' call
92
181
  var this_0 = importReferences(type);
93
182
  var set = HashSet_init_$Create$();
94
183
  var list = ArrayList_init_$Create$();
95
- var tmp0_iterator = this_0.g();
96
- while (tmp0_iterator.h()) {
97
- var e = tmp0_iterator.i();
98
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
99
- var key = e.l29_1;
100
- if (set.e(key)) {
101
- list.e(e);
184
+ var _iterator__ex2g4s = this_0.t();
185
+ while (_iterator__ex2g4s.u()) {
186
+ var e = _iterator__ex2g4s.v();
187
+ var key = e.lu_1;
188
+ if (set.x(key)) {
189
+ list.x(e);
102
190
  }
103
191
  }
192
+ // Inline function 'kotlin.collections.map' call
104
193
  // Inline function 'kotlin.collections.mapTo' call
105
194
  var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
106
- var tmp0_iterator_0 = list.g();
107
- while (tmp0_iterator_0.h()) {
108
- var item = tmp0_iterator_0.i();
109
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
110
- var tmp$ret$2 = 'import {' + item.l29_1 + "} from './" + item.l29_1 + "'";
111
- destination.e(tmp$ret$2);
195
+ var _iterator__ex2g4s_0 = list.t();
196
+ while (_iterator__ex2g4s_0.u()) {
197
+ var item = _iterator__ex2g4s_0.v();
198
+ var tmp$ret$2 = 'import {' + item.lu_1 + "} from './" + item.lu_1 + "'";
199
+ destination.x(tmp$ret$2);
112
200
  }
113
201
  var tmp = destination;
114
- return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.q2b(type.x23_1) + ' = {\n |' + this.x24(type.y23_1) + '\n |}\n |\n ');
202
+ return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.n20(type.vo_1) + ' = {\n |' + this.vp(type.wo_1) + '\n |}\n |\n ');
115
203
  }
116
- function emit_1(_this__u8e3s4) {
117
- // Inline function 'kotlin.let' call
204
+ function emit_4(_this__u8e3s4) {
118
205
  var tmp;
119
206
  if (_this__u8e3s4 instanceof Dict) {
120
- tmp = 'Record<string, ' + this.z24(_this__u8e3s4.e23_1) + '>';
207
+ tmp = 'Record<string, ' + this.xp(_this__u8e3s4.co_1) + '>';
121
208
  } else {
122
209
  if (_this__u8e3s4 instanceof Iterable) {
123
- tmp = this.z24(_this__u8e3s4.b23_1) + '[]';
210
+ tmp = this.xp(_this__u8e3s4.zn_1) + '[]';
124
211
  } else {
125
212
  if (_this__u8e3s4 instanceof Unit) {
126
213
  tmp = 'void';
@@ -129,10 +216,10 @@ function emit_1(_this__u8e3s4) {
129
216
  tmp = 'any';
130
217
  } else {
131
218
  if (_this__u8e3s4 instanceof Custom) {
132
- tmp = this.n2b(_this__u8e3s4.l29_1);
219
+ tmp = this.w1v(_this__u8e3s4.lu_1);
133
220
  } else {
134
221
  if (_this__u8e3s4 instanceof Primitive) {
135
- tmp = this.r2b(_this__u8e3s4);
222
+ tmp = this.o20(_this__u8e3s4);
136
223
  } else {
137
224
  noWhenBranchMatchedException();
138
225
  }
@@ -141,12 +228,11 @@ function emit_1(_this__u8e3s4) {
141
228
  }
142
229
  }
143
230
  }
144
- // Inline function 'kotlin.contracts.contract' call
145
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
146
- return tmp + (_this__u8e3s4.jm() ? ' | undefined' : '');
231
+ // Inline function 'kotlin.let' call
232
+ return tmp + (_this__u8e3s4.du() ? ' | undefined' : '');
147
233
  }
148
234
  function emitPrimitive(_this__u8e3s4) {
149
- var tmp0_subject = _this__u8e3s4.p29_1;
235
+ var tmp0_subject = _this__u8e3s4.pu_1;
150
236
  var tmp;
151
237
  if (tmp0_subject instanceof String_0) {
152
238
  tmp = 'string';
@@ -171,45 +257,37 @@ function emitPrimitive(_this__u8e3s4) {
171
257
  }
172
258
  return tmp;
173
259
  }
174
- function emit_2(_this__u8e3s4) {
260
+ function emit_5(_this__u8e3s4) {
175
261
  var tmp;
176
262
  if (_this__u8e3s4 instanceof RegExp_0) {
177
- tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.a28_1) + '.test(value);';
263
+ tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.ys_1) + '.test(value);';
178
264
  } else {
179
265
  if (_this__u8e3s4 instanceof Bound) {
180
- var tmp1_safe_receiver = _this__u8e3s4.q28_1;
266
+ var tmp1_safe_receiver = _this__u8e3s4.pt_1;
181
267
  var tmp_0;
182
268
  if (tmp1_safe_receiver == null) {
183
269
  tmp_0 = null;
184
270
  } else {
185
271
  // Inline function 'kotlin.let' call
186
- // Inline function 'kotlin.contracts.contract' call
187
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
188
272
  tmp_0 = tmp1_safe_receiver + ' < value';
189
273
  }
190
274
  var minCheck = tmp_0;
191
- var tmp2_safe_receiver = _this__u8e3s4.r28_1;
275
+ var tmp2_safe_receiver = _this__u8e3s4.qt_1;
192
276
  var tmp_1;
193
277
  if (tmp2_safe_receiver == null) {
194
278
  tmp_1 = null;
195
279
  } else {
196
280
  // Inline function 'kotlin.let' call
197
- // Inline function 'kotlin.contracts.contract' call
198
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
199
281
  tmp_1 = 'value < ' + tmp2_safe_receiver;
200
282
  }
201
283
  var maxCheck = tmp_1;
202
284
  var tmp_2 = Spacer_instance.toString();
203
285
  // Inline function 'kotlin.let' call
204
- // Inline function 'kotlin.contracts.contract' call
205
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
206
286
  // Inline function 'kotlin.text.ifEmpty' call
207
287
  var this_0 = joinToString(listOfNotNull([minCheck, maxCheck]), ' && ');
208
- // Inline function 'kotlin.contracts.contract' call
209
288
  var tmp_3;
210
289
  // Inline function 'kotlin.text.isEmpty' call
211
290
  if (charSequenceLength(this_0) === 0) {
212
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>.<anonymous>' call
213
291
  tmp_3 = 'true';
214
292
  } else {
215
293
  tmp_3 = this_0;
@@ -221,145 +299,82 @@ function emit_2(_this__u8e3s4) {
221
299
  }
222
300
  return tmp;
223
301
  }
224
- function emit_3(_this__u8e3s4) {
225
- return joinToString(_this__u8e3s4.u23_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
302
+ function emit_6(_this__u8e3s4) {
303
+ return joinToString(_this__u8e3s4.so_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
226
304
  }
227
- function emit_4(_this__u8e3s4) {
228
- return Spacer_instance.toString() + this.y25(_this__u8e3s4.c24_1) + ': ' + this.z24(_this__u8e3s4.d24_1);
305
+ function emit_7(_this__u8e3s4) {
306
+ return Spacer_instance.toString() + this.wq(_this__u8e3s4.ap_1) + ': ' + this.xp(_this__u8e3s4.bp_1);
229
307
  }
230
308
  initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, TypeScriptIdentifierEmitter]);
231
309
  function emitClient(ast) {
232
- var tmp = 'client.' + this.g25().p25_1;
233
- var tmp_0 = this.c25(ast);
310
+ var tmp = 'client.' + this.eq().nq_1;
311
+ var tmp_0 = this.aq(ast);
234
312
  var tmp_1 = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda);
235
- // Inline function 'kotlin.collections.distinctBy' call
236
- // Inline function 'kotlin.collections.flatMap' call
237
313
  // Inline function 'arrow.core.NonEmptyList.flatMap' call
238
- var this_0 = ast.d25_1;
239
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
240
- var tmp_2 = this_0.pk_1.f25_1.nk();
314
+ var this_0 = ast.bq_1;
241
315
  // Inline function 'kotlin.collections.flatMap' call
316
+ var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
242
317
  // Inline function 'kotlin.collections.flatMapTo' call
243
- var this_1 = this_0.qk_1;
244
318
  var destination = ArrayList_init_$Create$();
245
- var tmp0_iterator = this_1.g();
246
- while (tmp0_iterator.h()) {
247
- var element = tmp0_iterator.i();
248
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
249
- var list = element.f25_1;
319
+ var _iterator__ex2g4s = tmp0.t();
320
+ while (_iterator__ex2g4s.u()) {
321
+ var element = _iterator__ex2g4s.v();
322
+ var list = new NonEmptyList(element.dq_1);
250
323
  addAll(destination, list);
251
324
  }
325
+ var tmp$ret$3 = _NonEmptyList___init__impl__fxd0xp(destination);
326
+ // Inline function 'kotlin.collections.flatMap' call
327
+ var tmp0_0 = NonEmptyList__toList_impl_t5xcy2(tmp$ret$3);
252
328
  // Inline function 'kotlin.collections.flatMapTo' call
253
- var this_2 = tmp_2.uk(destination).tk();
254
329
  var destination_0 = ArrayList_init_$Create$();
255
- var tmp0_iterator_0 = this_2.g();
256
- while (tmp0_iterator_0.h()) {
257
- var element_0 = tmp0_iterator_0.i();
258
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
330
+ var _iterator__ex2g4s_0 = tmp0_0.t();
331
+ while (_iterator__ex2g4s_0.u()) {
332
+ var element_0 = _iterator__ex2g4s_0.v();
259
333
  var list_0 = importReferences(element_0);
260
334
  addAll(destination_0, list_0);
261
335
  }
336
+ // Inline function 'kotlin.collections.distinctBy' call
262
337
  var set = HashSet_init_$Create$();
263
338
  var list_1 = ArrayList_init_$Create$();
264
- var tmp0_iterator_1 = destination_0.g();
265
- while (tmp0_iterator_1.h()) {
266
- var e = tmp0_iterator_1.i();
267
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
268
- var key = e.l29_1;
269
- if (set.e(key)) {
270
- list_1.e(e);
339
+ var _iterator__ex2g4s_1 = destination_0.t();
340
+ while (_iterator__ex2g4s_1.u()) {
341
+ var e = _iterator__ex2g4s_1.v();
342
+ var key = e.lu_1;
343
+ if (set.x(key)) {
344
+ list_1.x(e);
271
345
  }
272
346
  }
273
- var tmp_3 = list_1;
274
- var tmp_4 = joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
275
- var tmp_5 = this.c25(ast);
276
- return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_4 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' + spacer(joinToString(tmp_5, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_1(this)), 1) + '\n |})\n |\n '));
347
+ var tmp_2 = list_1;
348
+ var tmp_3 = joinToString(tmp_2, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
349
+ var tmp_4 = this.aq(ast);
350
+ return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_3 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' + spacer(joinToString(tmp_4, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_1(this)), 1) + '\n |})\n |\n '));
277
351
  }
278
352
  initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
279
- function emit_5(enum_0, module_0) {
280
- var tmp = this.q2b(enum_0.i26_1);
281
- return 'export type ' + tmp + ' = ' + joinToString(enum_0.j26_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
282
- }
283
- initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
284
- function emit_6(endpoint) {
285
- // Inline function 'kotlin.collections.map' call
286
- // Inline function 'kotlin.collections.distinctBy' call
287
- var this_0 = importReferences(endpoint);
288
- var set = HashSet_init_$Create$();
289
- var list = ArrayList_init_$Create$();
290
- var tmp0_iterator = this_0.g();
291
- while (tmp0_iterator.h()) {
292
- var e = tmp0_iterator.i();
293
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
294
- var key = e.l29_1;
295
- if (set.e(key)) {
296
- list.e(e);
297
- }
298
- }
299
- // Inline function 'kotlin.collections.mapTo' call
300
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
301
- var tmp0_iterator_0 = list.g();
302
- while (tmp0_iterator_0.h()) {
303
- var item = tmp0_iterator_0.i();
304
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
305
- var tmp$ret$2 = 'import {type ' + item.l29_1 + "} from '../model'";
306
- destination.e(tmp$ret$2);
307
- }
308
- var tmp = destination;
309
- var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
310
- var tmp_1 = this.q2b(endpoint.g24_1);
311
- var tmp_2 = get_pathParams(endpoint);
312
- var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
313
- var tmp_4 = emitType(endpoint.j24_1, this, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
314
- var tmp_5 = emitType(endpoint.k24_1, this, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
315
- var tmp_6 = emitType_1(first(endpoint.l24_1), this, endpoint);
316
- var tmp_7 = distinctByStatus(endpoint.m24_1);
317
- var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
318
- var tmp_9 = Spacer_instance.toString();
319
- var tmp_10 = distinctByStatus(endpoint.m24_1);
320
- var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
321
- var tmp_12 = emitFunction_0(first(endpoint.l24_1), this, endpoint);
322
- var tmp_13 = distinctByStatus(endpoint.m24_1);
323
- var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
324
- var tmp_15 = Spacer_instance.toString();
325
- var tmp_16 = Spacer_instance.s26(2);
326
- var tmp_17 = emitHandleFunction(this, endpoint);
327
- var tmp_18 = Spacer_instance.toString();
328
- var tmp_19 = prependIndent(emitClient_0(endpoint, this), Spacer_instance.s26(1));
329
- var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.s26(1));
330
- var tmp_21 = Spacer_instance.toString();
331
- var tmp_22 = Spacer_instance.s26(2);
332
- var tmp_23 = Companion_instance_0.r25(this.q2b(endpoint.g24_1));
333
- var tmp_24 = Spacer_instance.s26(2);
334
- var tmp_25 = Spacer_instance.s26(2);
335
- return trimMargin('\n |' + tmp_0 + '\n |export namespace ' + tmp_1 + ' {\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_5 + '\n |' + tmp_6 + '\n |' + tmp_8 + '\n |' + tmp_9 + 'export type Response = ' + tmp_11 + '\n |' + tmp_12 + '\n |' + tmp_14 + '\n |' + tmp_15 + 'export type Handler = {\n |' + tmp_16 + tmp_17 + '\n |' + tmp_18 + '}\n |' + tmp_19 + '\n |' + tmp_20 + '\n |' + tmp_21 + 'export const api = {\n |' + tmp_22 + 'name: "' + tmp_23 + '",\n |' + tmp_24 + 'method: "' + endpoint.h24_1.q2_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.i24_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.s26(2) + 'server,\n |' + Spacer_instance.s26(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
336
- }
337
- initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
338
- function emit_7(refined) {
339
- return trimMargin('\n |export type ' + this.q2b(refined.d26_1) + ' = ' + this.z24(refined.e26_1) + ';\n |export const validate' + refined.d26_1.b1() + ' = (value: ' + this.z24(refined.e26_1) + '): value is ' + this.q2b(refined.d26_1) + ' => {\n |' + this.m26(refined) + '\n |}\n |\n ');
353
+ function emit_8(refined) {
354
+ return trimMargin('\n |export type ' + this.n20(refined.br_1) + ' = ' + this.xp(refined.cr_1) + ';\n |export const validate' + refined.br_1.l1() + ' = (value: ' + this.xp(refined.cr_1) + '): value is ' + this.n20(refined.br_1) + ' => {\n |' + this.kr(refined) + '\n |}\n |\n ');
340
355
  }
341
356
  function emitValidator(_this__u8e3s4) {
342
357
  var defaultReturn = Spacer_instance.toString() + 'return true;';
343
- var type = _this__u8e3s4.e26_1.p29_1;
358
+ var type = _this__u8e3s4.cr_1.pu_1;
344
359
  var tmp;
345
360
  if (type instanceof Integer) {
346
- var tmp0_safe_receiver = type.v28_1;
347
- var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.a25(tmp0_safe_receiver);
361
+ var tmp0_safe_receiver = type.ut_1;
362
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yp(tmp0_safe_receiver);
348
363
  tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
349
364
  } else {
350
365
  if (type instanceof Number_0) {
351
- var tmp2_safe_receiver = type.y28_1;
352
- var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.a25(tmp2_safe_receiver);
366
+ var tmp2_safe_receiver = type.xt_1;
367
+ var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.yp(tmp2_safe_receiver);
353
368
  tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
354
369
  } else {
355
370
  if (type instanceof String_0) {
356
- var tmp4_safe_receiver = type.s28_1;
371
+ var tmp4_safe_receiver = type.rt_1;
357
372
  var tmp_0;
358
373
  var tmp_1 = tmp4_safe_receiver;
359
374
  if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
360
375
  tmp_0 = null;
361
376
  } else {
362
- tmp_0 = this.a25(new RegExp_0(tmp4_safe_receiver));
377
+ tmp_0 = this.yp(new RegExp_0(tmp4_safe_receiver));
363
378
  }
364
379
  var tmp5_elvis_lhs = tmp_0;
365
380
  tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
@@ -379,18 +394,76 @@ function emitValidator(_this__u8e3s4) {
379
394
  return tmp;
380
395
  }
381
396
  initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
382
- initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptIdentifierEmitter, TypeScriptClientEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptTypeDefinitionEmitter]);
397
+ function emit_9(endpoint) {
398
+ // Inline function 'kotlin.collections.distinctBy' call
399
+ var this_0 = importReferences(endpoint);
400
+ var set = HashSet_init_$Create$();
401
+ var list = ArrayList_init_$Create$();
402
+ var _iterator__ex2g4s = this_0.t();
403
+ while (_iterator__ex2g4s.u()) {
404
+ var e = _iterator__ex2g4s.v();
405
+ var key = e.lu_1;
406
+ if (set.x(key)) {
407
+ list.x(e);
408
+ }
409
+ }
410
+ // Inline function 'kotlin.collections.map' call
411
+ // Inline function 'kotlin.collections.mapTo' call
412
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
413
+ var _iterator__ex2g4s_0 = list.t();
414
+ while (_iterator__ex2g4s_0.u()) {
415
+ var item = _iterator__ex2g4s_0.v();
416
+ var tmp$ret$2 = 'import {type ' + item.lu_1 + "} from '../model'";
417
+ destination.x(tmp$ret$2);
418
+ }
419
+ var tmp = destination;
420
+ var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
421
+ var tmp_1 = this.n20(endpoint.ep_1);
422
+ var tmp_2 = get_pathParams(endpoint);
423
+ var tmp_3 = emitType(this, tmp_2, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
424
+ var tmp_4 = emitType(this, endpoint.hp_1, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
425
+ var tmp_5 = emitType(this, endpoint.ip_1, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
426
+ var tmp_6 = emitType_1(this, first(endpoint.jp_1), endpoint);
427
+ var tmp_7 = distinctByStatus(endpoint.kp_1);
428
+ var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
429
+ var tmp_9 = Spacer_instance.toString();
430
+ var tmp_10 = distinctByStatus(endpoint.kp_1);
431
+ var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
432
+ var tmp_12 = emitFunction_0(this, first(endpoint.jp_1), endpoint);
433
+ var tmp_13 = distinctByStatus(endpoint.kp_1);
434
+ var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
435
+ var tmp_15 = Spacer_instance.toString();
436
+ var tmp_16 = Spacer_instance.qr(2);
437
+ var tmp_17 = emitHandleFunction(this, endpoint);
438
+ var tmp_18 = Spacer_instance.toString();
439
+ var tmp_19 = prependIndent(emitClient_0(this, endpoint), Spacer_instance.qr(1));
440
+ var tmp_20 = prependIndent(emitServer(this, endpoint), Spacer_instance.qr(1));
441
+ var tmp_21 = Spacer_instance.toString();
442
+ var tmp_22 = Spacer_instance.qr(2);
443
+ var tmp_23 = Companion_instance_0.pq(this.n20(endpoint.ep_1));
444
+ var tmp_24 = Spacer_instance.qr(2);
445
+ var tmp_25 = Spacer_instance.qr(2);
446
+ return trimMargin('\n |' + tmp_0 + '\n |export namespace ' + tmp_1 + ' {\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_5 + '\n |' + tmp_6 + '\n |' + tmp_8 + '\n |' + tmp_9 + 'export type Response = ' + tmp_11 + '\n |' + tmp_12 + '\n |' + tmp_14 + '\n |' + tmp_15 + 'export type Handler = {\n |' + tmp_16 + tmp_17 + '\n |' + tmp_18 + '}\n |' + tmp_19 + '\n |' + tmp_20 + '\n |' + tmp_21 + 'export const api = {\n |' + tmp_22 + 'name: "' + tmp_23 + '",\n |' + tmp_24 + 'method: "' + endpoint.fp_1.a3_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.qr(2) + 'server,\n |' + Spacer_instance.qr(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
447
+ }
448
+ initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
449
+ function emit_10(enum_0, module_0) {
450
+ var tmp = this.n20(enum_0.gr_1);
451
+ return 'export type ' + tmp + ' = ' + joinToString(enum_0.hr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
452
+ }
453
+ initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
454
+ initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptIdentifierEmitter, TypeScriptClientEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptEnumDefinitionEmitter]);
455
+ initMetadataForClass(EndpointParam, 'EndpointParam');
456
+ initMetadataForCompanion(Companion);
457
+ initMetadataForClass(TypeScriptIrEmitter$shared$1);
458
+ initMetadataForClass(TypeScriptIrEmitter, 'TypeScriptIrEmitter', TypeScriptIrEmitter, VOID, [IrEmitter]);
383
459
  initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
384
460
  //endregion
385
- function emitClientInterface(_this__u8e3s4, $this, endpoint) {
386
- // Inline function 'kotlin.text.orEmpty' call
461
+ function emitClientInterface($this, _this__u8e3s4, endpoint) {
387
462
  // Inline function 'kotlin.takeIf' call
388
463
  var this_0 = paramList(_this__u8e3s4, endpoint);
389
- // Inline function 'kotlin.contracts.contract' call
390
464
  var tmp;
391
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClientInterface.<anonymous>' call
392
465
  // Inline function 'kotlin.collections.isNotEmpty' call
393
- if (!this_0.l()) {
466
+ if (!this_0.r()) {
394
467
  tmp = this_0;
395
468
  } else {
396
469
  tmp = null;
@@ -408,26 +481,22 @@ function emitClientInterface(_this__u8e3s4, $this, endpoint) {
408
481
  tmp_1 = null;
409
482
  } else {
410
483
  // Inline function 'kotlin.let' call
411
- // Inline function 'kotlin.contracts.contract' call
412
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClientInterface.<anonymous>' call
413
484
  tmp_1 = 'params: {' + tmp1_safe_receiver + '}';
414
485
  }
486
+ // Inline function 'kotlin.text.orEmpty' call
415
487
  var tmp0_elvis_lhs = tmp_1;
416
488
  return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
417
489
  }
418
490
  function emitFunction($this, endpoint, request) {
419
- var tmp = endpoint.g24_1.b1();
420
- var tmp_0 = emitClientInterface(request, $this, endpoint);
491
+ var tmp = endpoint.ep_1.l1();
492
+ var tmp_0 = emitClientInterface($this, request, endpoint);
421
493
  var tmp_1 = Spacer_instance.toString();
422
- var tmp_2 = endpoint.g24_1.b1();
423
- // Inline function 'kotlin.text.orEmpty' call
494
+ var tmp_2 = endpoint.ep_1.l1();
424
495
  // Inline function 'kotlin.takeIf' call
425
496
  var this_0 = paramList(request, endpoint);
426
- // Inline function 'kotlin.contracts.contract' call
427
497
  var tmp_3;
428
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
429
498
  // Inline function 'kotlin.collections.isNotEmpty' call
430
- if (!this_0.l()) {
499
+ if (!this_0.r()) {
431
500
  tmp_3 = this_0;
432
501
  } else {
433
502
  tmp_3 = null;
@@ -437,37 +506,36 @@ function emitFunction($this, endpoint, request) {
437
506
  tmp_4 = null;
438
507
  } else {
439
508
  // Inline function 'kotlin.let' call
440
- // Inline function 'kotlin.contracts.contract' call
441
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
442
509
  tmp_4 = 'params';
443
510
  }
511
+ // Inline function 'kotlin.text.orEmpty' call
444
512
  var tmp0_elvis_lhs = tmp_4;
445
513
  var tmp$ret$5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
446
- return trimMargin('\n |' + tmp + ': async (' + tmp_0 + ') => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.g24_1.b1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.g24_1.b1() + '.client(serialization).from(rawResponse)\n |},\n ');
514
+ return trimMargin('\n |' + tmp + ': async (' + tmp_0 + ') => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.ep_1.l1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.ep_1.l1() + '.client(serialization).from(rawResponse)\n |},\n ');
447
515
  }
448
516
  function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
449
- var endpoint = _destruct__k2r9zo.sd();
450
- return 'import {' + endpoint.g24_1.b1() + '} from "./endpoint/' + endpoint.g24_1.b1() + '"';
517
+ var endpoint = _destruct__k2r9zo.ne();
518
+ return 'import {' + endpoint.ep_1.l1() + '} from "./endpoint/' + endpoint.ep_1.l1() + '"';
451
519
  }
452
520
  function TypeScriptClientEmitter$emitClient$lambda_0(it) {
453
- return 'import {type ' + it.l29_1 + '} from "./model/' + it.l29_1 + '"';
521
+ return 'import {type ' + it.lu_1 + '} from "./model/' + it.lu_1 + '"';
454
522
  }
455
523
  function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
456
524
  return function (_destruct__k2r9zo) {
457
- var endpoint = _destruct__k2r9zo.sd();
458
- var request = _destruct__k2r9zo.td();
525
+ var endpoint = _destruct__k2r9zo.ne();
526
+ var request = _destruct__k2r9zo.oe();
459
527
  return emitFunction(this$0, endpoint, request);
460
528
  };
461
529
  }
462
530
  function TypeScriptClientEmitter$emitClientInterface$lambda(this$0) {
463
531
  return function (it) {
464
- return this$0.y25(it.l25_1) + ': ' + this$0.z24(it.m25_1);
532
+ return this$0.wq(it.jq_1) + ': ' + this$0.xp(it.kq_1);
465
533
  };
466
534
  }
467
535
  function TypeScriptClientEmitter() {
468
536
  }
469
537
  function TypeScriptEmitter$emit$lambda(it) {
470
- return 'export {' + it.x25().b1() + "} from './" + it.x25().b1() + "'";
538
+ return 'export {' + it.vq().l1() + "} from './" + it.vq().l1() + "'";
471
539
  }
472
540
  function TypeScriptEmitter$emit$lambda_0(it) {
473
541
  // Inline function 'kotlin.text.trimStart' call
@@ -475,214 +543,202 @@ function TypeScriptEmitter$emit$lambda_0(it) {
475
543
  }
476
544
  function TypeScriptEmitter$emit$lambda_1(this$0) {
477
545
  return function (it) {
478
- return this$0.z24(it);
546
+ return this$0.xp(it);
479
547
  };
480
548
  }
481
549
  function TypeScriptEmitter() {
482
550
  LanguageEmitter.call(this);
483
- this.s2b_1 = FileExtension_TypeScript_getInstance();
484
- this.t2b_1 = TypeScriptShared_getInstance();
485
- this.u2b_1 = '//';
551
+ this.p20_1 = FileExtension_TypeScript_getInstance();
552
+ this.q20_1 = TypeScriptShared_getInstance();
553
+ this.r20_1 = '//';
486
554
  }
487
- protoOf(TypeScriptEmitter).g25 = function () {
488
- return this.s2b_1;
555
+ protoOf(TypeScriptEmitter).eq = function () {
556
+ return this.p20_1;
489
557
  };
490
- protoOf(TypeScriptEmitter).s2a = function () {
491
- return this.t2b_1;
558
+ protoOf(TypeScriptEmitter).t1v = function () {
559
+ return this.q20_1;
492
560
  };
493
- protoOf(TypeScriptEmitter).h25 = function () {
494
- return this.u2b_1;
561
+ protoOf(TypeScriptEmitter).fq = function () {
562
+ return this.r20_1;
495
563
  };
496
- protoOf(TypeScriptEmitter).q22 = function (ast, logger) {
564
+ protoOf(TypeScriptEmitter).on = function (ast, logger) {
497
565
  // Inline function 'kotlin.run' call
498
- // Inline function 'kotlin.contracts.contract' call
499
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
500
- var $this$run = protoOf(LanguageEmitter).q22.call(this, ast, logger);
566
+ var $this$run = protoOf(LanguageEmitter).on.call(this, ast, logger);
501
567
  var tmp;
502
568
  if (hasEndpoints(ast)) {
503
- tmp = $this$run.vk(this.p2b(ast));
569
+ tmp = NonEmptyList__plus_impl_xqmb9($this$run, this.m20(ast));
504
570
  } else {
505
571
  tmp = $this$run;
506
572
  }
507
573
  var tmp_0 = tmp;
508
- // Inline function 'kotlin.collections.map' call
509
- // Inline function 'kotlin.collections.groupBy' call
510
574
  // Inline function 'arrow.core.NonEmptyList.flatMap' call
511
- var this_0 = ast.d25_1;
512
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
513
- var tmp_1 = this_0.pk_1.f25_1.nk();
575
+ var this_0 = ast.bq_1;
514
576
  // Inline function 'kotlin.collections.flatMap' call
577
+ var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
515
578
  // Inline function 'kotlin.collections.flatMapTo' call
516
- var this_1 = this_0.qk_1;
517
579
  var destination = ArrayList_init_$Create$();
518
- var tmp0_iterator = this_1.g();
519
- while (tmp0_iterator.h()) {
520
- var element = tmp0_iterator.i();
521
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
522
- var list = element.f25_1;
580
+ var _iterator__ex2g4s = tmp0.t();
581
+ while (_iterator__ex2g4s.u()) {
582
+ var element = _iterator__ex2g4s.v();
583
+ var list = new NonEmptyList(element.dq_1);
523
584
  addAll(destination, list);
524
585
  }
586
+ var tmp$ret$5 = _NonEmptyList___init__impl__fxd0xp(destination);
587
+ // Inline function 'kotlin.collections.groupBy' call
588
+ var tmp0_0 = new NonEmptyList(tmp$ret$5);
525
589
  // Inline function 'kotlin.collections.groupByTo' call
526
- var this_2 = tmp_1.uk(destination);
527
590
  var destination_0 = LinkedHashMap_init_$Create$();
528
- var tmp0_iterator_0 = this_2.g();
529
- while (tmp0_iterator_0.h()) {
530
- var element_0 = tmp0_iterator_0.i();
531
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
591
+ var _iterator__ex2g4s_0 = tmp0_0.t();
592
+ while (_iterator__ex2g4s_0.u()) {
593
+ var element_0 = _iterator__ex2g4s_0.v();
532
594
  var key = namespace(element_0);
533
595
  // Inline function 'kotlin.collections.getOrPut' call
534
- var value = destination_0.g2(key);
535
- var tmp_2;
596
+ var value = destination_0.p2(key);
597
+ var tmp_1;
536
598
  if (value == null) {
537
- // Inline function 'kotlin.collections.groupByTo.<anonymous>' call
538
599
  var answer = ArrayList_init_$Create$();
539
- destination_0.n2(key, answer);
540
- tmp_2 = answer;
600
+ destination_0.w2(key, answer);
601
+ tmp_1 = answer;
541
602
  } else {
542
- tmp_2 = value;
603
+ tmp_1 = value;
543
604
  }
544
- var list_0 = tmp_2;
545
- list_0.e(element_0);
605
+ var list_0 = tmp_1;
606
+ list_0.x(element_0);
546
607
  }
608
+ // Inline function 'kotlin.collections.map' call
547
609
  // Inline function 'kotlin.collections.mapTo' call
548
- var destination_1 = ArrayList_init_$Create$_0(destination_0.j());
610
+ var destination_1 = ArrayList_init_$Create$_0(destination_0.a1());
549
611
  // Inline function 'kotlin.collections.iterator' call
550
- var tmp0_iterator_1 = destination_0.z().g();
551
- while (tmp0_iterator_1.h()) {
552
- var item = tmp0_iterator_1.i();
553
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
612
+ var _iterator__ex2g4s_1 = destination_0.j1().t();
613
+ while (_iterator__ex2g4s_1.u()) {
614
+ var item = _iterator__ex2g4s_1.v();
554
615
  // Inline function 'kotlin.collections.component1' call
555
- var ns = item.a1();
616
+ var ns = item.k1();
556
617
  // Inline function 'kotlin.collections.component2' call
557
- var defs = item.b1();
558
- var tmp_3 = ns + '/index.' + this.g25().p25_1;
559
- var tmp$ret$15 = new Emitted(tmp_3, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
560
- destination_1.e(tmp$ret$15);
618
+ var defs = item.l1();
619
+ var tmp_2 = ns + '/index.' + this.eq().nq_1;
620
+ var tmp$ret$14 = new Emitted(tmp_2, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
621
+ destination_1.x(tmp$ret$14);
561
622
  }
562
- return tmp_0.uk(destination_1);
623
+ return NonEmptyList__plus_impl_xqmb9_0(tmp_0, destination_1);
563
624
  };
564
- protoOf(TypeScriptEmitter).v25 = function (module_0, logger) {
625
+ protoOf(TypeScriptEmitter).tq = function (module_0, logger) {
565
626
  // Inline function 'kotlin.let' call
566
- // Inline function 'kotlin.contracts.contract' call
567
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
568
- return protoOf(LanguageEmitter).v25.call(this, module_0, logger).vk(new Emitted('Wirespec', this.s2a().w2b_1));
627
+ var it = protoOf(LanguageEmitter).tq.call(this, module_0, logger);
628
+ return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.t1v().t20_1));
569
629
  };
570
- protoOf(TypeScriptEmitter).w25 = function (definition, module_0, logger) {
630
+ protoOf(TypeScriptEmitter).uq = function (definition, module_0, logger) {
571
631
  // Inline function 'kotlin.let' call
572
- // Inline function 'kotlin.contracts.contract' call
573
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
574
- var it = protoOf(LanguageEmitter).w25.call(this, definition, module_0, logger);
575
- var subPackageName = plus(Companion_instance.n26(''), definition);
576
- return new Emitted(subPackageName.q26() + this.n2b(it.k23_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.l23_1 + '\n '));
632
+ var it = protoOf(LanguageEmitter).uq.call(this, definition, module_0, logger);
633
+ var subPackageName = plus(Companion_instance.lr(''), definition);
634
+ return new Emitted(subPackageName.or() + this.w1v(it.io_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.jo_1 + '\n '));
577
635
  };
578
- protoOf(TypeScriptEmitter).a26 = function (union) {
579
- // Inline function 'kotlin.collections.map' call
636
+ protoOf(TypeScriptEmitter).yq = function (union) {
580
637
  // Inline function 'kotlin.collections.distinctBy' call
581
638
  var this_0 = importReferences(union);
582
639
  var set = HashSet_init_$Create$();
583
640
  var list = ArrayList_init_$Create$();
584
- var tmp0_iterator = this_0.g();
585
- while (tmp0_iterator.h()) {
586
- var e = tmp0_iterator.i();
587
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
588
- var key = e.l29_1;
589
- if (set.e(key)) {
590
- list.e(e);
641
+ var _iterator__ex2g4s = this_0.t();
642
+ while (_iterator__ex2g4s.u()) {
643
+ var e = _iterator__ex2g4s.v();
644
+ var key = e.lu_1;
645
+ if (set.x(key)) {
646
+ list.x(e);
591
647
  }
592
648
  }
649
+ // Inline function 'kotlin.collections.map' call
593
650
  // Inline function 'kotlin.collections.mapTo' call
594
651
  var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
595
- var tmp0_iterator_0 = list.g();
596
- while (tmp0_iterator_0.h()) {
597
- var item = tmp0_iterator_0.i();
598
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
599
- var tmp$ret$2 = 'import {type ' + item.l29_1 + "} from '../model'";
600
- destination.e(tmp$ret$2);
652
+ var _iterator__ex2g4s_0 = list.t();
653
+ while (_iterator__ex2g4s_0.u()) {
654
+ var item = _iterator__ex2g4s_0.v();
655
+ var tmp$ret$2 = 'import {type ' + item.lu_1 + "} from '../model'";
656
+ destination.x(tmp$ret$2);
601
657
  }
602
658
  var tmp = destination;
603
659
  var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
604
- var tmp_1 = this.q2b(union.s23_1);
605
- return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.t23_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
660
+ var tmp_1 = this.n20(union.qo_1);
661
+ return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.ro_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
606
662
  };
607
- protoOf(TypeScriptEmitter).z25 = function (channel) {
608
- return this.i25();
663
+ protoOf(TypeScriptEmitter).xq = function (channel) {
664
+ return this.gq();
609
665
  };
610
- function emit_8(_this__u8e3s4, $this) {
666
+ function emit_11($this, _this__u8e3s4) {
611
667
  var tmp;
612
668
  if (_this__u8e3s4 instanceof Literal) {
613
- tmp = _this__u8e3s4.j25_1;
669
+ tmp = _this__u8e3s4.hq_1;
614
670
  } else {
615
671
  if (_this__u8e3s4 instanceof Param) {
616
- tmp = ':' + _this__u8e3s4.n24_1.b1();
672
+ tmp = ':' + _this__u8e3s4.lp_1.l1();
617
673
  } else {
618
674
  noWhenBranchMatchedException();
619
675
  }
620
676
  }
621
677
  return tmp;
622
678
  }
623
- function emitClient_0(_this__u8e3s4, $this) {
624
- return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.s26(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.s26(1)) + '\n |})\n ');
679
+ function emitClient_0($this, _this__u8e3s4) {
680
+ return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo($this, _this__u8e3s4), Spacer_instance.qr(1)) + ',\n |' + prependIndent(emitClientFrom($this, _this__u8e3s4), Spacer_instance.qr(1)) + '\n |})\n ');
625
681
  }
626
- function emitClientTo(_this__u8e3s4, $this) {
627
- var tmp = Spacer_instance.s26(1);
682
+ function emitClientTo($this, _this__u8e3s4) {
683
+ var tmp = Spacer_instance.qr(1);
628
684
  // Inline function 'kotlin.text.uppercase' call
629
685
  // Inline function 'kotlin.js.asDynamic' call
630
- var tmp_0 = _this__u8e3s4.h24_1.q2_1.toUpperCase();
631
- var tmp_1 = Spacer_instance.s26(1);
632
- var tmp_2 = emitPathArray(_this__u8e3s4, $this);
633
- var tmp_3 = Spacer_instance.s26(1);
634
- var tmp_4 = joinToString(_this__u8e3s4.j24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
635
- var tmp_5 = Spacer_instance.s26(1);
636
- return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.k24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.s26(1) + 'body: serialization.serialize(it.body)\n |})\n ');
637
- }
638
- function emitClientFrom(_this__u8e3s4, $this) {
639
- var tmp = Spacer_instance.s26(1);
640
- var tmp_0 = distinctByStatus(_this__u8e3s4.m24_1);
641
- return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.s26(2)) + '\n |' + Spacer_instance.s26(2) + 'default:\n |' + Spacer_instance.s26(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.s26(1) + '}\n |}\n ');
642
- }
643
- function emitClientFromResponse(_this__u8e3s4, $this) {
644
- var tmp = fixStatus(_this__u8e3s4.s24_1);
645
- var tmp_0 = Spacer_instance.s26(1);
646
- var tmp_1 = Spacer_instance.s26(2);
647
- var tmp_2 = fixStatus(_this__u8e3s4.s24_1);
648
- var tmp_3 = Spacer_instance.s26(2);
649
- return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.t24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.s26(2) + 'body: serialization.deserialize<' + emitReference(_this__u8e3s4, $this) + '>(it.body)\n |' + Spacer_instance.s26(1) + '};\n ');
650
- }
651
- function emitServer(_this__u8e3s4, $this) {
652
- return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.s26(1)) + ',\n |' + prependIndent(emitServerTo(_this__u8e3s4, $this), Spacer_instance.s26(1)) + '\n |})\n ');
653
- }
654
- function emitServerFrom(_this__u8e3s4, $this) {
655
- var tmp = Spacer_instance.s26(1);
656
- var tmp_0 = Spacer_instance.s26(2);
686
+ var tmp_0 = _this__u8e3s4.fp_1.a3_1.toUpperCase();
687
+ var tmp_1 = Spacer_instance.qr(1);
688
+ var tmp_2 = emitPathArray($this, _this__u8e3s4);
689
+ var tmp_3 = Spacer_instance.qr(1);
690
+ var tmp_4 = joinToString(_this__u8e3s4.hp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
691
+ var tmp_5 = Spacer_instance.qr(1);
692
+ return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.ip_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.qr(1) + 'body: serialization.serialize(it.body)\n |})\n ');
693
+ }
694
+ function emitClientFrom($this, _this__u8e3s4) {
695
+ var tmp = Spacer_instance.qr(1);
696
+ var tmp_0 = distinctByStatus(_this__u8e3s4.kp_1);
697
+ return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.qr(2)) + '\n |' + Spacer_instance.qr(2) + 'default:\n |' + Spacer_instance.qr(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.qr(1) + '}\n |}\n ');
698
+ }
699
+ function emitClientFromResponse($this, _this__u8e3s4) {
700
+ var tmp = fixStatus(_this__u8e3s4.qp_1);
701
+ var tmp_0 = Spacer_instance.qr(1);
702
+ var tmp_1 = Spacer_instance.qr(2);
703
+ var tmp_2 = fixStatus(_this__u8e3s4.qp_1);
704
+ var tmp_3 = Spacer_instance.qr(2);
705
+ return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.rp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.qr(2) + 'body: serialization.deserialize<' + emitReference($this, _this__u8e3s4) + '>(it.body)\n |' + Spacer_instance.qr(1) + '};\n ');
706
+ }
707
+ function emitServer($this, _this__u8e3s4) {
708
+ return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom($this, _this__u8e3s4), Spacer_instance.qr(1)) + ',\n |' + prependIndent(emitServerTo($this, _this__u8e3s4), Spacer_instance.qr(1)) + '\n |})\n ');
709
+ }
710
+ function emitServerFrom($this, _this__u8e3s4) {
711
+ var tmp = Spacer_instance.qr(1);
712
+ var tmp_0 = Spacer_instance.qr(2);
657
713
  // Inline function 'kotlin.text.uppercase' call
658
714
  // Inline function 'kotlin.js.asDynamic' call
659
- var tmp_1 = _this__u8e3s4.h24_1.q2_1.toUpperCase();
660
- var tmp_2 = Spacer_instance.s26(2);
715
+ var tmp_1 = _this__u8e3s4.fp_1.a3_1.toUpperCase();
716
+ var tmp_2 = Spacer_instance.qr(2);
661
717
  var tmp_3 = get_indexedPathParams(_this__u8e3s4);
662
- var tmp_4 = prependIndent(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.s26(3));
663
- var tmp_5 = Spacer_instance.s26(2);
664
- var tmp_6 = Spacer_instance.s26(2);
665
- var tmp_7 = joinToString(_this__u8e3s4.j24_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
666
- var tmp_8 = Spacer_instance.s26(2);
667
- var tmp_9 = Spacer_instance.s26(2);
668
- return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.k24_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.s26(2) + '},\n |' + Spacer_instance.s26(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.s26(1) + '}\n |}\n ');
669
- }
670
- function emitServerTo(_this__u8e3s4, $this) {
671
- var tmp = Spacer_instance.s26(1);
672
- var tmp_0 = distinctByStatus(_this__u8e3s4.m24_1);
673
- return trimMargin('\n |to: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda($this)), Spacer_instance.s26(2)) + '\n |' + Spacer_instance.s26(1) + '}\n |}\n ');
674
- }
675
- function emitServerToResponse(_this__u8e3s4, $this) {
676
- var tmp = fixStatus(_this__u8e3s4.s24_1);
677
- var tmp_0 = Spacer_instance.s26(1);
678
- var tmp_1 = Spacer_instance.s26(2);
679
- var tmp_2 = fixStatus(_this__u8e3s4.s24_1);
680
- var tmp_3 = Spacer_instance.s26(2);
681
- return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {\n |' + prependIndent(joinToString(_this__u8e3s4.t24_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerToResponse$lambda($this)), Spacer_instance.s26(3)) + '\n |' + Spacer_instance.s26(2) + '} as Record<string, string>,\n |' + Spacer_instance.s26(2) + 'body: serialization.serialize(it.body),\n |' + Spacer_instance.s26(1) + '};\n ');
682
- }
683
- function emitType(_this__u8e3s4, $this, name, block) {
718
+ var tmp_4 = prependIndent(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.qr(3));
719
+ var tmp_5 = Spacer_instance.qr(2);
720
+ var tmp_6 = Spacer_instance.qr(2);
721
+ var tmp_7 = joinToString(_this__u8e3s4.hp_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
722
+ var tmp_8 = Spacer_instance.qr(2);
723
+ var tmp_9 = Spacer_instance.qr(2);
724
+ return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.ip_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.qr(2) + '},\n |' + Spacer_instance.qr(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.qr(1) + '}\n |}\n ');
725
+ }
726
+ function emitServerTo($this, _this__u8e3s4) {
727
+ var tmp = Spacer_instance.qr(1);
728
+ var tmp_0 = distinctByStatus(_this__u8e3s4.kp_1);
729
+ return trimMargin('\n |to: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda($this)), Spacer_instance.qr(2)) + '\n |' + Spacer_instance.qr(1) + '}\n |}\n ');
730
+ }
731
+ function emitServerToResponse($this, _this__u8e3s4) {
732
+ var tmp = fixStatus(_this__u8e3s4.qp_1);
733
+ var tmp_0 = Spacer_instance.qr(1);
734
+ var tmp_1 = Spacer_instance.qr(2);
735
+ var tmp_2 = fixStatus(_this__u8e3s4.qp_1);
736
+ var tmp_3 = Spacer_instance.qr(2);
737
+ return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {\n |' + prependIndent(joinToString(_this__u8e3s4.rp_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerToResponse$lambda($this)), Spacer_instance.qr(3)) + '\n |' + Spacer_instance.qr(2) + '} as Record<string, string>,\n |' + Spacer_instance.qr(2) + 'body: serialization.serialize(it.body),\n |' + Spacer_instance.qr(1) + '};\n ');
738
+ }
739
+ function emitType($this, _this__u8e3s4, name, block) {
684
740
  var tmp;
685
- if (_this__u8e3s4.l()) {
741
+ if (_this__u8e3s4.r()) {
686
742
  tmp = Spacer_instance.toString() + 'type ' + name + ' = {}';
687
743
  } else {
688
744
  var tmp_0 = Spacer_instance.toString();
@@ -690,22 +746,19 @@ function emitType(_this__u8e3s4, $this, name, block) {
690
746
  }
691
747
  return tmp;
692
748
  }
693
- function emitName(_this__u8e3s4, $this) {
694
- return 'Response' + Companion_instance_0.q25(_this__u8e3s4.s24_1);
749
+ function emitName($this, _this__u8e3s4) {
750
+ return 'Response' + Companion_instance_0.oq(_this__u8e3s4.qp_1);
695
751
  }
696
- function emitFunction_0(_this__u8e3s4, $this, endpoint) {
752
+ function emitFunction_0($this, _this__u8e3s4, endpoint) {
697
753
  var tmp = Spacer_instance.toString();
698
754
  var tmp_0 = paramList(_this__u8e3s4, endpoint);
699
- var tmp_1 = joinToObject(tmp_0, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda($this));
755
+ var tmp_1 = joinToObject($this, tmp_0, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda($this));
700
756
  var tmp_2 = Spacer_instance.toString();
701
- // Inline function 'kotlin.text.orEmpty' call
702
757
  // Inline function 'kotlin.takeIf' call
703
758
  var this_0 = paramList(_this__u8e3s4, endpoint);
704
- // Inline function 'kotlin.contracts.contract' call
705
759
  var tmp_3;
706
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
707
760
  // Inline function 'kotlin.collections.isNotEmpty' call
708
- if (!this_0.l()) {
761
+ if (!this_0.r()) {
709
762
  tmp_3 = this_0;
710
763
  } else {
711
764
  tmp_3 = null;
@@ -715,49 +768,43 @@ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
715
768
  tmp_4 = null;
716
769
  } else {
717
770
  // Inline function 'kotlin.run' call
718
- // Inline function 'kotlin.contracts.contract' call
719
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
720
771
  tmp_4 = 'params: RequestParams';
721
772
  }
773
+ // Inline function 'kotlin.text.orEmpty' call
722
774
  var tmp0_elvis_lhs = tmp_4;
723
775
  var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
724
- var tmp_6 = Spacer_instance.s26(2);
776
+ var tmp_6 = Spacer_instance.qr(2);
725
777
  var tmp_7 = get_pathParams(endpoint);
726
- var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
727
- var tmp_9 = Spacer_instance.s26(2);
728
- var tmp_10 = endpoint.h24_1.toString();
729
- var tmp_11 = Spacer_instance.s26(2);
730
- var tmp_12 = joinToObject(endpoint.j24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
731
- var tmp_13 = Spacer_instance.s26(2);
732
- var tmp_14 = joinToObject(endpoint.k24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
733
- var tmp_15 = Spacer_instance.s26(2);
778
+ var tmp_8 = joinToObject($this, tmp_7, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
779
+ var tmp_9 = Spacer_instance.qr(2);
780
+ var tmp_10 = endpoint.fp_1.toString();
781
+ var tmp_11 = Spacer_instance.qr(2);
782
+ var tmp_12 = joinToObject($this, endpoint.hp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
783
+ var tmp_13 = Spacer_instance.qr(2);
784
+ var tmp_14 = joinToObject($this, endpoint.ip_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
785
+ var tmp_15 = Spacer_instance.qr(2);
734
786
  var tmp_16;
735
- if (_this__u8e3s4.p24_1 == null) {
787
+ if (_this__u8e3s4.np_1 == null) {
736
788
  tmp_16 = null;
737
789
  } else {
738
790
  // Inline function 'kotlin.let' call
739
- // Inline function 'kotlin.contracts.contract' call
740
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
741
791
  tmp_16 = 'params.body';
742
792
  }
743
793
  var tmp2_elvis_lhs = tmp_16;
744
794
  return trimMargin('\n |' + tmp + 'export type RequestParams = ' + tmp_1 + '\n |' + tmp_2 + 'export const request = (' + tmp_5 + '): Request => ({\n |' + tmp_6 + 'path: ' + tmp_8 + ',\n |' + tmp_9 + 'method: "' + tmp_10 + '",\n |' + tmp_11 + 'queries: ' + tmp_12 + ',\n |' + tmp_13 + 'headers: ' + tmp_14 + ',\n |' + tmp_15 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
745
795
  }
746
- function emitFunction_1(_this__u8e3s4, $this) {
796
+ function emitFunction_1($this, _this__u8e3s4) {
747
797
  var tmp = Spacer_instance.toString();
748
- var tmp_0 = Companion_instance_0.q25(_this__u8e3s4.s24_1);
798
+ var tmp_0 = Companion_instance_0.oq(_this__u8e3s4.qp_1);
749
799
  var tmp_1 = paramList_0(_this__u8e3s4);
750
- var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
800
+ var tmp_2 = joinToObject($this, tmp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
751
801
  var tmp_3 = Spacer_instance.toString();
752
- var tmp_4 = Companion_instance_0.q25(_this__u8e3s4.s24_1);
753
- // Inline function 'kotlin.text.orEmpty' call
802
+ var tmp_4 = Companion_instance_0.oq(_this__u8e3s4.qp_1);
754
803
  // Inline function 'kotlin.takeIf' call
755
804
  var this_0 = paramList_0(_this__u8e3s4);
756
- // Inline function 'kotlin.contracts.contract' call
757
805
  var tmp_5;
758
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
759
806
  // Inline function 'kotlin.collections.isNotEmpty' call
760
- if (!this_0.l()) {
807
+ if (!this_0.r()) {
761
808
  tmp_5 = this_0;
762
809
  } else {
763
810
  tmp_5 = null;
@@ -767,85 +814,82 @@ function emitFunction_1(_this__u8e3s4, $this) {
767
814
  tmp_6 = null;
768
815
  } else {
769
816
  // Inline function 'kotlin.run' call
770
- // Inline function 'kotlin.contracts.contract' call
771
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
772
- tmp_6 = 'params: Response' + Companion_instance_0.q25(_this__u8e3s4.s24_1) + 'Params';
817
+ tmp_6 = 'params: Response' + Companion_instance_0.oq(_this__u8e3s4.qp_1) + 'Params';
773
818
  }
819
+ // Inline function 'kotlin.text.orEmpty' call
774
820
  var tmp0_elvis_lhs = tmp_6;
775
821
  var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
776
- var tmp_8 = Companion_instance_0.q25(_this__u8e3s4.s24_1);
777
- var tmp_9 = Spacer_instance.s26(2);
778
- var tmp_10 = fixStatus(_this__u8e3s4.s24_1);
779
- var tmp_11 = Spacer_instance.s26(2);
780
- var tmp_12 = joinToObject(_this__u8e3s4.t24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
781
- var tmp_13 = Spacer_instance.s26(2);
822
+ var tmp_8 = Companion_instance_0.oq(_this__u8e3s4.qp_1);
823
+ var tmp_9 = Spacer_instance.qr(2);
824
+ var tmp_10 = fixStatus(_this__u8e3s4.qp_1);
825
+ var tmp_11 = Spacer_instance.qr(2);
826
+ var tmp_12 = joinToObject($this, _this__u8e3s4.rp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
827
+ var tmp_13 = Spacer_instance.qr(2);
782
828
  var tmp_14;
783
- if (_this__u8e3s4.u24_1 == null) {
829
+ if (_this__u8e3s4.sp_1 == null) {
784
830
  tmp_14 = null;
785
831
  } else {
786
832
  // Inline function 'kotlin.let' call
787
- // Inline function 'kotlin.contracts.contract' call
788
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
789
833
  tmp_14 = 'params.body';
790
834
  }
791
835
  var tmp2_elvis_lhs = tmp_14;
792
836
  return trimMargin('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
793
837
  }
794
- function emitReference(_this__u8e3s4, $this) {
795
- var tmp0_safe_receiver = _this__u8e3s4.u24_1;
796
- var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r24_1;
797
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.z24(tmp1_safe_receiver);
838
+ function emitReference($this, _this__u8e3s4) {
839
+ var tmp0_safe_receiver = _this__u8e3s4.sp_1;
840
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
841
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.xp(tmp1_safe_receiver);
798
842
  return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
799
843
  }
800
- function emitPathArray(_this__u8e3s4, $this) {
801
- return joinToString(_this__u8e3s4.i24_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
844
+ function emitPathArray($this, _this__u8e3s4) {
845
+ return joinToString(_this__u8e3s4.gp_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
802
846
  }
803
- function emitType_0(_this__u8e3s4, $this) {
847
+ function emitType_0($this, _this__u8e3s4) {
804
848
  var tmp = Spacer_instance.toString();
805
- var tmp_0 = emitName(_this__u8e3s4, $this);
806
- var tmp_1 = Spacer_instance.s26(2);
807
- var tmp_2 = fixStatus(_this__u8e3s4.s24_1);
808
- var tmp_3 = Spacer_instance.s26(2);
809
- return trimMargin('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.t24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.s26(2) + 'body: ' + emitReference(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
810
- }
811
- function emitReference_0(_this__u8e3s4, $this) {
812
- var tmp0_safe_receiver = _this__u8e3s4.p24_1;
813
- var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r24_1;
814
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.z24(tmp1_safe_receiver);
849
+ var tmp_0 = emitName($this, _this__u8e3s4);
850
+ var tmp_1 = Spacer_instance.qr(2);
851
+ var tmp_2 = fixStatus(_this__u8e3s4.qp_1);
852
+ var tmp_3 = Spacer_instance.qr(2);
853
+ return trimMargin('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.rp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.qr(2) + 'body: ' + emitReference($this, _this__u8e3s4) + '\n |' + Spacer_instance.toString() + '}\n ');
854
+ }
855
+ function emitReference_0($this, _this__u8e3s4) {
856
+ var tmp0_safe_receiver = _this__u8e3s4.np_1;
857
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
858
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.xp(tmp1_safe_receiver);
815
859
  return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
816
860
  }
817
- function emitType_1(_this__u8e3s4, $this, endpoint) {
818
- return trimMargin('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.s26(2) + 'path: Path\n |' + Spacer_instance.s26(2) + 'method: "' + endpoint.h24_1.toString() + '"\n |' + Spacer_instance.s26(2) + 'queries: Queries\n |' + Spacer_instance.s26(2) + 'headers: Headers\n |' + Spacer_instance.s26(2) + 'body: ' + emitReference_0(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
861
+ function emitType_1($this, _this__u8e3s4, endpoint) {
862
+ return trimMargin('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.qr(2) + 'path: Path\n |' + Spacer_instance.qr(2) + 'method: "' + endpoint.fp_1.toString() + '"\n |' + Spacer_instance.qr(2) + 'queries: Queries\n |' + Spacer_instance.qr(2) + 'headers: Headers\n |' + Spacer_instance.qr(2) + 'body: ' + emitReference_0($this, _this__u8e3s4) + '\n |' + Spacer_instance.toString() + '}\n ');
819
863
  }
820
- function emit_9(_this__u8e3s4, $this) {
821
- return Spacer_instance.toString() + $this.y25(_this__u8e3s4.n24_1) + ': ' + $this.z24(_this__u8e3s4.o24_1);
864
+ function emit_12($this, _this__u8e3s4) {
865
+ return Spacer_instance.toString() + $this.wq(_this__u8e3s4.lp_1) + ': ' + $this.xp(_this__u8e3s4.mp_1);
822
866
  }
823
- function emit_10(_this__u8e3s4, $this) {
824
- return $this.y25(_this__u8e3s4.l25_1) + (_this__u8e3s4.m25_1.jm() ? '?' : '') + ': ' + $this.z24(_this__u8e3s4.m25_1.f29(false));
867
+ function emit_13($this, _this__u8e3s4) {
868
+ return $this.wq(_this__u8e3s4.jq_1) + (_this__u8e3s4.kq_1.du() ? '?' : '') + ': ' + $this.xp(_this__u8e3s4.kq_1.fu(false));
825
869
  }
826
- function emitDeserialize(_this__u8e3s4, $this) {
827
- return $this.y25(_this__u8e3s4.rd_1.n24_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.qd_1 + '])';
870
+ function emitDeserialize($this, _this__u8e3s4) {
871
+ return $this.wq(_this__u8e3s4.me_1.lp_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.le_1 + '])';
828
872
  }
829
- function emitDeserialize_0(_this__u8e3s4, $this, fields, caseSensitive) {
830
- return caseSensitive ? $this.y25(_this__u8e3s4.c24_1) + ': serialization.deserialize(it.' + fields + '[' + $this.y25(_this__u8e3s4.c24_1) + '])' : $this.y25(_this__u8e3s4.c24_1) + ': serialization.deserialize(Object.entries(it.' + fields + ').find(([key]) => key.toLowerCase() === ' + $this.y25(lowercase(_this__u8e3s4.c24_1, $this)) + ')?.[1])';
873
+ function emitDeserialize_0($this, _this__u8e3s4, fields, caseSensitive) {
874
+ return caseSensitive ? $this.wq(_this__u8e3s4.ap_1) + ': serialization.deserialize(it.' + fields + '[' + $this.wq(_this__u8e3s4.ap_1) + '])' : $this.wq(_this__u8e3s4.ap_1) + ': serialization.deserialize(Object.entries(it.' + fields + ').find(([key]) => key.toLowerCase() === ' + $this.wq(lowercase($this, _this__u8e3s4.ap_1)) + ')?.[1])';
831
875
  }
832
- function emitDeserialize$default(_this__u8e3s4, $this, fields, caseSensitive, $super) {
876
+ function emitDeserialize$default($this, _this__u8e3s4, fields, caseSensitive, $super) {
833
877
  caseSensitive = caseSensitive === VOID ? true : caseSensitive;
834
- return emitDeserialize_0(_this__u8e3s4, $this, fields, caseSensitive);
878
+ return emitDeserialize_0($this, _this__u8e3s4, fields, caseSensitive);
835
879
  }
836
- function emitSerialize(_this__u8e3s4, $this, fields) {
837
- return $this.y25(_this__u8e3s4.c24_1) + ': serialization.serialize(it.' + fields + '[' + $this.y25(_this__u8e3s4.c24_1) + '])';
880
+ function emitSerialize($this, _this__u8e3s4, fields) {
881
+ return $this.wq(_this__u8e3s4.ap_1) + ': serialization.serialize(it.' + fields + '[' + $this.wq(_this__u8e3s4.ap_1) + '])';
838
882
  }
839
- function joinToObject(_this__u8e3s4, $this, transform) {
883
+ function joinToObject($this, _this__u8e3s4, transform) {
840
884
  return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
841
885
  }
842
886
  function emitHandleFunction($this, endpoint) {
843
- return Companion_instance_0.r25($this.q2b(endpoint.g24_1)) + ': (request:Request) => Promise<Response>';
887
+ return Companion_instance_0.pq($this.n20(endpoint.ep_1)) + ': (request:Request) => Promise<Response>';
844
888
  }
845
- function lowercase(_this__u8e3s4, $this) {
889
+ function lowercase($this, _this__u8e3s4) {
846
890
  // Inline function 'kotlin.text.lowercase' call
847
891
  // Inline function 'kotlin.js.asDynamic' call
848
- var tmp$ret$1 = _this__u8e3s4.b1().toLowerCase();
892
+ var tmp$ret$1 = _this__u8e3s4.l1().toLowerCase();
849
893
  return new FieldIdentifier(tmp$ret$1);
850
894
  }
851
895
  function TypeScriptEndpointDefinitionEmitter$emit$lambda(it) {
@@ -854,127 +898,127 @@ function TypeScriptEndpointDefinitionEmitter$emit$lambda(it) {
854
898
  }
855
899
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this$0) {
856
900
  return function (it) {
857
- return emit_9(it, this$0);
901
+ return emit_12(this$0, it);
858
902
  };
859
903
  }
860
904
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this$0) {
861
905
  return function (it) {
862
- return this$0.y24(it);
906
+ return this$0.wp(it);
863
907
  };
864
908
  }
865
909
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this$0) {
866
910
  return function (it) {
867
- return this$0.y24(it);
911
+ return this$0.wp(it);
868
912
  };
869
913
  }
870
914
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this$0) {
871
915
  return function (it) {
872
- return emitType_0(it, this$0);
916
+ return emitType_0(this$0, it);
873
917
  };
874
918
  }
875
919
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this$0) {
876
920
  return function (it) {
877
- return emitName(it, this$0);
921
+ return emitName(this$0, it);
878
922
  };
879
923
  }
880
924
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this$0) {
881
925
  return function (it) {
882
- return emitFunction_1(it, this$0);
926
+ return emitFunction_1(this$0, it);
883
927
  };
884
928
  }
885
929
  function TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this$0) {
886
930
  return function (it) {
887
- return emit_8(it, this$0);
931
+ return emit_11(this$0, it);
888
932
  };
889
933
  }
890
934
  function TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda(this$0) {
891
935
  return function (it) {
892
- return emitSerialize(it, this$0, 'queries');
936
+ return emitSerialize(this$0, it, 'queries');
893
937
  };
894
938
  }
895
939
  function TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0(this$0) {
896
940
  return function (it) {
897
- return emitSerialize(it, this$0, 'headers');
941
+ return emitSerialize(this$0, it, 'headers');
898
942
  };
899
943
  }
900
944
  function TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda(this$0) {
901
945
  return function (it) {
902
- return emitClientFromResponse(it, this$0);
946
+ return emitClientFromResponse(this$0, it);
903
947
  };
904
948
  }
905
949
  function TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda(this$0) {
906
950
  return function (it) {
907
- return emitDeserialize_0(it, this$0, 'headers', false);
951
+ return emitDeserialize_0(this$0, it, 'headers', false);
908
952
  };
909
953
  }
910
954
  function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda(this$0) {
911
955
  return function (it) {
912
- return emitDeserialize(it, this$0);
956
+ return emitDeserialize(this$0, it);
913
957
  };
914
958
  }
915
959
  function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0(this$0) {
916
960
  return function (it) {
917
- return prependIndent(emitDeserialize$default(it, this$0, 'queries'), Spacer_instance.s26(3));
961
+ return prependIndent(emitDeserialize$default(this$0, it, 'queries'), Spacer_instance.qr(3));
918
962
  };
919
963
  }
920
964
  function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1(this$0) {
921
965
  return function (it) {
922
- return prependIndent(emitDeserialize_0(it, this$0, 'headers', false), Spacer_instance.s26(3));
966
+ return prependIndent(emitDeserialize_0(this$0, it, 'headers', false), Spacer_instance.qr(3));
923
967
  };
924
968
  }
925
969
  function TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda(this$0) {
926
970
  return function (it) {
927
- return emitServerToResponse(it, this$0);
971
+ return emitServerToResponse(this$0, it);
928
972
  };
929
973
  }
930
974
  function TypeScriptEndpointDefinitionEmitter$emitServerToResponse$lambda(this$0) {
931
975
  return function (it) {
932
- return emitSerialize(it, this$0, 'headers');
976
+ return emitSerialize(this$0, it, 'headers');
933
977
  };
934
978
  }
935
979
  function TypeScriptEndpointDefinitionEmitter$emitType$lambda($block) {
936
980
  return function (it) {
937
- return Spacer_instance.s26(1) + $block(it);
981
+ return Spacer_instance.qr(1) + $block(it);
938
982
  };
939
983
  }
940
984
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
941
985
  return function (it) {
942
- return emit_10(it, this$0);
986
+ return emit_13(this$0, it);
943
987
  };
944
988
  }
945
989
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0(this$0) {
946
990
  return function (it) {
947
- return this$0.y25(it.n24_1) + ': params[' + this$0.y25(it.n24_1) + ']';
991
+ return this$0.wq(it.lp_1) + ': params[' + this$0.wq(it.lp_1) + ']';
948
992
  };
949
993
  }
950
994
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1(this$0) {
951
995
  return function (it) {
952
- return this$0.y25(it.c24_1) + ': params[' + this$0.y25(it.c24_1) + ']';
996
+ return this$0.wq(it.ap_1) + ': params[' + this$0.wq(it.ap_1) + ']';
953
997
  };
954
998
  }
955
999
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2(this$0) {
956
1000
  return function (it) {
957
- return this$0.y25(it.c24_1) + ': params[' + this$0.y25(it.c24_1) + ']';
1001
+ return this$0.wq(it.ap_1) + ': params[' + this$0.wq(it.ap_1) + ']';
958
1002
  };
959
1003
  }
960
1004
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
961
1005
  return function (it) {
962
- return emit_10(it, this$0);
1006
+ return emit_13(this$0, it);
963
1007
  };
964
1008
  }
965
1009
  function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4(this$0) {
966
1010
  return function (it) {
967
- return this$0.y25(it.c24_1) + ': params[' + this$0.y25(it.c24_1) + ']';
1011
+ return this$0.wq(it.ap_1) + ': params[' + this$0.wq(it.ap_1) + ']';
968
1012
  };
969
1013
  }
970
1014
  function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
971
1015
  return function (it) {
972
1016
  var tmp;
973
1017
  if (it instanceof Literal) {
974
- tmp = '"' + it.j25_1 + '"';
1018
+ tmp = '"' + it.hq_1 + '"';
975
1019
  } else {
976
1020
  if (it instanceof Param) {
977
- tmp = 'serialization.serialize(it.path[' + this$0.y25(it.n24_1) + '])';
1021
+ tmp = 'serialization.serialize(it.path[' + this$0.wq(it.lp_1) + '])';
978
1022
  } else {
979
1023
  noWhenBranchMatchedException();
980
1024
  }
@@ -984,7 +1028,7 @@ function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
984
1028
  }
985
1029
  function TypeScriptEndpointDefinitionEmitter$emitType$lambda_0(this$0) {
986
1030
  return function (it) {
987
- return this$0.y25(it.c24_1) + ': ' + this$0.z24(it.d24_1);
1031
+ return this$0.wq(it.ap_1) + ': ' + this$0.xp(it.bp_1);
988
1032
  };
989
1033
  }
990
1034
  function TypeScriptEndpointDefinitionEmitter() {
@@ -996,13 +1040,1053 @@ function TypeScriptEnumDefinitionEmitter() {
996
1040
  }
997
1041
  function TypeScriptIdentifierEmitter() {
998
1042
  }
1043
+ function TypeScriptIrEmitter$shared$o$source$lambda(element, transformer) {
1044
+ var tmp;
1045
+ if (element instanceof Namespace) {
1046
+ var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? listOf(new RawElement('export type Type = string')) : emptyList();
1047
+ var tmp_0;
1048
+ // Inline function 'kotlin.collections.isNotEmpty' call
1049
+ if (!injected.r()) {
1050
+ tmp_0 = withElements(element, plus_0(injected, element.v1m()));
1051
+ } else {
1052
+ tmp_0 = element;
1053
+ }
1054
+ tmp = tmp_0;
1055
+ } else {
1056
+ tmp = element;
1057
+ }
1058
+ var transformed = tmp;
1059
+ return transformChildren(transformed, transformer);
1060
+ }
1061
+ function TypeScriptIrEmitter$shared$o$source$lambda_0(this$0) {
1062
+ return function (element, transformer) {
1063
+ var tmp;
1064
+ if (element instanceof Namespace) {
1065
+ var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? listOf(new RawElement(this$0.u20_1)) : emptyList();
1066
+ var tmp_0;
1067
+ // Inline function 'kotlin.collections.isNotEmpty' call
1068
+ if (!injected.r()) {
1069
+ tmp_0 = withElements(element, plus_0(element.v1m(), injected));
1070
+ } else {
1071
+ tmp_0 = element;
1072
+ }
1073
+ tmp = tmp_0;
1074
+ } else {
1075
+ tmp = element;
1076
+ }
1077
+ var transformed = tmp;
1078
+ return transformChildren(transformed, transformer);
1079
+ };
1080
+ }
1081
+ function _get_sanitizationConfig__sns434($this) {
1082
+ var tmp0 = $this.z20_1;
1083
+ var tmp = KProperty1;
1084
+ // Inline function 'kotlin.getValue' call
1085
+ getPropertyCallableRef('sanitizationConfig', 1, tmp, TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh(), null);
1086
+ return tmp0.l1();
1087
+ }
1088
+ function buildApiConst($this, endpoint) {
1089
+ var apiName = firstToLower($this, endpoint.ep_1.l1());
1090
+ var method = endpoint.fp_1.a3_1;
1091
+ var pathString = joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$buildApiConst$lambda);
1092
+ return raw(trimMargin('\n |export const client:Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n | from: (it) => fromRawResponse(serialization, it),\n | to: (it) => toRawRequest(serialization, it)\n |})\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n | from: (it) => fromRawRequest(serialization, it),\n | to: (it) => toRawResponse(serialization, it)\n |})\n |export const api = {\n | name: "' + apiName + '",\n | method: "' + method + '",\n | path: "' + pathString + '",\n | server,\n | client\n |} as const\n '));
1093
+ }
1094
+ function transformPatternSwitchToValueSwitch($this) {
1095
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1096
+ // Inline function 'kotlin.apply' call
1097
+ var this_0 = new TransformerBuilder();
1098
+ this_0.g1u(TypeScriptIrEmitter$transformPatternSwitchToValueSwitch$lambda);
1099
+ return this_0.e1h();
1100
+ }
1101
+ function sanitize($this, _this__u8e3s4) {
1102
+ return '"' + _this__u8e3s4.l1() + '"';
1103
+ }
1104
+ function sanitizeSymbol_1($this, _this__u8e3s4) {
1105
+ // Inline function 'kotlin.text.filter' call
1106
+ // Inline function 'kotlin.text.filterTo' call
1107
+ var destination = StringBuilder_init_$Create$();
1108
+ var inductionVariable = 0;
1109
+ var last = charSequenceLength(_this__u8e3s4);
1110
+ if (inductionVariable < last)
1111
+ do {
1112
+ var index = inductionVariable;
1113
+ inductionVariable = inductionVariable + 1 | 0;
1114
+ var element = charSequenceGet(_this__u8e3s4, index);
1115
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
1116
+ destination.s(element);
1117
+ }
1118
+ }
1119
+ while (inductionVariable < last);
1120
+ return destination.toString();
1121
+ }
1122
+ function sanitizeKeywords($this, _this__u8e3s4) {
1123
+ return Companion_getInstance_0().b21_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
1124
+ }
1125
+ function firstToLower($this, _this__u8e3s4) {
1126
+ // Inline function 'kotlin.text.replaceFirstChar' call
1127
+ var tmp;
1128
+ // Inline function 'kotlin.text.isNotEmpty' call
1129
+ if (charSequenceLength(_this__u8e3s4) > 0) {
1130
+ // Inline function 'kotlin.text.lowercase' call
1131
+ var this_0 = charCodeAt(_this__u8e3s4, 0);
1132
+ // Inline function 'kotlin.js.asDynamic' call
1133
+ // Inline function 'kotlin.js.unsafeCast' call
1134
+ var tmp$ret$4 = toString_0(this_0).toLowerCase();
1135
+ tmp = toString(tmp$ret$4) + substring(_this__u8e3s4, 1);
1136
+ } else {
1137
+ tmp = _this__u8e3s4;
1138
+ }
1139
+ return tmp;
1140
+ }
1141
+ function sanitizeParamName($this, identifier) {
1142
+ var tmp0 = identifier.l1();
1143
+ // Inline function 'kotlin.text.split' call
1144
+ // Inline function 'kotlin.collections.filter' call
1145
+ var tmp0_0 = Regex_init_$Create$('[.\\s-]+').xc(tmp0, 0);
1146
+ // Inline function 'kotlin.collections.filterTo' call
1147
+ var destination = ArrayList_init_$Create$();
1148
+ var _iterator__ex2g4s = tmp0_0.t();
1149
+ while (_iterator__ex2g4s.u()) {
1150
+ var element = _iterator__ex2g4s.v();
1151
+ // Inline function 'kotlin.text.isNotEmpty' call
1152
+ if (charSequenceLength(element) > 0) {
1153
+ destination.x(element);
1154
+ }
1155
+ }
1156
+ var parts = destination;
1157
+ var name = parts.a1() > 1 ? (new Name(parts)).r1l() : identifier.l1();
1158
+ return sanitizeKeywords($this, sanitizeSymbol_1($this, name));
1159
+ }
1160
+ function buildEndpointParams($this, endpoint) {
1161
+ // Inline function 'kotlin.collections.buildList' call
1162
+ // Inline function 'kotlin.collections.buildListInternal' call
1163
+ // Inline function 'kotlin.apply' call
1164
+ var this_0 = ArrayList_init_$Create$();
1165
+ // Inline function 'kotlin.collections.filterIsInstance' call
1166
+ var tmp0 = endpoint.gp_1;
1167
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1168
+ var destination = ArrayList_init_$Create$();
1169
+ var _iterator__ex2g4s = tmp0.t();
1170
+ while (_iterator__ex2g4s.u()) {
1171
+ var element = _iterator__ex2g4s.v();
1172
+ if (element instanceof Param) {
1173
+ destination.x(element);
1174
+ }
1175
+ }
1176
+ // Inline function 'kotlin.collections.forEach' call
1177
+ var _iterator__ex2g4s_0 = destination.t();
1178
+ while (_iterator__ex2g4s_0.u()) {
1179
+ var element_0 = _iterator__ex2g4s_0.v();
1180
+ this_0.x(new EndpointParam(sanitizeParamName($this, element_0.lp_1), emitTypeScriptReference($this, element_0.mp_1.fu(false)), element_0.mp_1.du()));
1181
+ }
1182
+ // Inline function 'kotlin.collections.forEach' call
1183
+ var _iterator__ex2g4s_1 = endpoint.hp_1.t();
1184
+ while (_iterator__ex2g4s_1.u()) {
1185
+ var element_1 = _iterator__ex2g4s_1.v();
1186
+ this_0.x(new EndpointParam(sanitizeParamName($this, element_1.ap_1), emitTypeScriptReference($this, element_1.bp_1.fu(false)), element_1.bp_1.du()));
1187
+ }
1188
+ // Inline function 'kotlin.collections.forEach' call
1189
+ var _iterator__ex2g4s_2 = endpoint.ip_1.t();
1190
+ while (_iterator__ex2g4s_2.u()) {
1191
+ var element_2 = _iterator__ex2g4s_2.v();
1192
+ this_0.x(new EndpointParam(sanitizeParamName($this, element_2.ap_1), emitTypeScriptReference($this, element_2.bp_1.fu(false)), element_2.bp_1.du()));
1193
+ }
1194
+ var tmp0_safe_receiver = first(endpoint.jp_1).np_1;
1195
+ if (tmp0_safe_receiver == null)
1196
+ null;
1197
+ else {
1198
+ // Inline function 'kotlin.let' call
1199
+ this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.pp_1.fu(false)), tmp0_safe_receiver.pp_1.du()));
1200
+ }
1201
+ return this_0.o5();
1202
+ }
1203
+ function emitTypeScriptReference($this, ref) {
1204
+ var tmp;
1205
+ if (ref instanceof Dict) {
1206
+ tmp = 'Record<string, ' + emitTypeScriptReference($this, ref.co_1) + '>';
1207
+ } else {
1208
+ if (ref instanceof Iterable) {
1209
+ tmp = emitTypeScriptReference($this, ref.zn_1) + '[]';
1210
+ } else {
1211
+ if (ref instanceof Unit) {
1212
+ tmp = 'undefined';
1213
+ } else {
1214
+ if (ref instanceof Any) {
1215
+ tmp = 'any';
1216
+ } else {
1217
+ if (ref instanceof Custom) {
1218
+ tmp = sanitizeSymbol_1($this, ref.lu_1);
1219
+ } else {
1220
+ if (ref instanceof Primitive) {
1221
+ var tmp1_subject = ref.pu_1;
1222
+ var tmp_0;
1223
+ if (tmp1_subject instanceof String_0) {
1224
+ tmp_0 = 'string';
1225
+ } else {
1226
+ if (tmp1_subject instanceof Integer) {
1227
+ tmp_0 = 'number';
1228
+ } else {
1229
+ if (tmp1_subject instanceof Number_0) {
1230
+ tmp_0 = 'number';
1231
+ } else {
1232
+ if (tmp1_subject instanceof Boolean_0) {
1233
+ tmp_0 = 'boolean';
1234
+ } else {
1235
+ if (tmp1_subject instanceof Bytes) {
1236
+ tmp_0 = 'ArrayBuffer';
1237
+ } else {
1238
+ noWhenBranchMatchedException();
1239
+ }
1240
+ }
1241
+ }
1242
+ }
1243
+ }
1244
+ tmp = tmp_0;
1245
+ } else {
1246
+ noWhenBranchMatchedException();
1247
+ }
1248
+ }
1249
+ }
1250
+ }
1251
+ }
1252
+ }
1253
+ // Inline function 'kotlin.let' call
1254
+ return tmp + (ref.du() ? ' | undefined' : '');
1255
+ }
1256
+ function EndpointParam(name, type, nullable) {
1257
+ this.c21_1 = name;
1258
+ this.d21_1 = type;
1259
+ this.e21_1 = nullable;
1260
+ }
1261
+ protoOf(EndpointParam).toString = function () {
1262
+ return 'EndpointParam(name=' + this.c21_1 + ', type=' + this.d21_1 + ', nullable=' + this.e21_1 + ')';
1263
+ };
1264
+ protoOf(EndpointParam).hashCode = function () {
1265
+ var result = getStringHashCode(this.c21_1);
1266
+ result = imul(result, 31) + getStringHashCode(this.d21_1) | 0;
1267
+ result = imul(result, 31) + getBooleanHashCode(this.e21_1) | 0;
1268
+ return result;
1269
+ };
1270
+ protoOf(EndpointParam).equals = function (other) {
1271
+ if (this === other)
1272
+ return true;
1273
+ if (!(other instanceof EndpointParam))
1274
+ return false;
1275
+ if (!(this.c21_1 === other.c21_1))
1276
+ return false;
1277
+ if (!(this.d21_1 === other.d21_1))
1278
+ return false;
1279
+ if (!(this.e21_1 === other.e21_1))
1280
+ return false;
1281
+ return true;
1282
+ };
1283
+ function Companion() {
1284
+ Companion_instance_1 = this;
1285
+ this.b21_1 = setOf(['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'class', 'const', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'type', 'async', 'await']);
1286
+ }
1287
+ var Companion_instance_1;
1288
+ function Companion_getInstance_0() {
1289
+ if (Companion_instance_1 == null)
1290
+ new Companion();
1291
+ return Companion_instance_1;
1292
+ }
1293
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
1294
+ return '_' + it;
1295
+ }
1296
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0) {
1297
+ return function (name) {
1298
+ var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : sanitizeSymbol_1(this$0, name.s1h());
1299
+ return new Name(listOf(sanitized));
1300
+ };
1301
+ }
1302
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0) {
1303
+ return function (name) {
1304
+ var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : sanitizeSymbol_1(this$0, name.s1h());
1305
+ return new Name(listOf(sanitized));
1306
+ };
1307
+ }
1308
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
1309
+ // Inline function 'kotlin.text.filter' call
1310
+ // Inline function 'kotlin.text.filterTo' call
1311
+ var destination = StringBuilder_init_$Create$();
1312
+ var inductionVariable = 0;
1313
+ var last = charSequenceLength(it);
1314
+ if (inductionVariable < last)
1315
+ do {
1316
+ var index = inductionVariable;
1317
+ inductionVariable = inductionVariable + 1 | 0;
1318
+ var element = charSequenceGet(it, index);
1319
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
1320
+ destination.s(element);
1321
+ }
1322
+ }
1323
+ while (inductionVariable < last);
1324
+ return destination.toString();
1325
+ }
1326
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
1327
+ return function (stmt, tr) {
1328
+ var tmp;
1329
+ if (stmt instanceof VariableReference) {
1330
+ tmp = new VariableReference(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.u1o_1));
1331
+ } else {
1332
+ if (stmt instanceof ConstructorStatement) {
1333
+ var tmp_0 = tr.r1t(stmt.p1m_1);
1334
+ // Inline function 'kotlin.collections.map' call
1335
+ var this_0 = stmt.q1m_1;
1336
+ // Inline function 'kotlin.collections.mapTo' call
1337
+ var destination = ArrayList_init_$Create$_0(this_0.a1());
1338
+ // Inline function 'kotlin.collections.iterator' call
1339
+ var _iterator__ex2g4s = this_0.j1().t();
1340
+ while (_iterator__ex2g4s.u()) {
1341
+ var item = _iterator__ex2g4s.v();
1342
+ // Inline function 'kotlin.collections.component1' call
1343
+ var key = item.k1();
1344
+ // Inline function 'kotlin.collections.component2' call
1345
+ var value = item.l1();
1346
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), key), tr.u1t(value));
1347
+ destination.x(tmp$ret$3);
1348
+ }
1349
+ tmp = new ConstructorStatement(tmp_0, toMap(destination));
1350
+ } else {
1351
+ if (stmt instanceof Assignment) {
1352
+ tmp = new Assignment(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.v1o_1), tr.u1t(stmt.w1o_1), stmt.x1o_1);
1353
+ } else {
1354
+ tmp = transformChildren_0(stmt, tr);
1355
+ }
1356
+ }
1357
+ }
1358
+ return tmp;
1359
+ };
1360
+ }
1361
+ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
1362
+ return function () {
1363
+ var tmp0_reservedKeywords = Companion_getInstance_0().b21_1;
1364
+ var tmp = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda;
1365
+ var tmp_0 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0);
1366
+ var tmp_1 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0);
1367
+ var tmp_2 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_2;
1368
+ return new SanitizationConfig(tmp0_reservedKeywords, tmp, tmp_0, tmp_1, tmp_2, TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0), false);
1369
+ };
1370
+ }
1371
+ function TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh() {
1372
+ return function (p0) {
1373
+ return _get_sanitizationConfig__sns434(p0);
1374
+ };
1375
+ }
1376
+ function TypeScriptIrEmitter$shared$1() {
1377
+ this.u20_1 = 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => {\n to: (request: REQ) => RawRequest;\n from: (response: RawResponse) => RES\n}\nexport type Server<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => {\n from: (request: RawRequest) => REQ;\n to: (response: RES) => RawResponse\n}\nexport type Api<REQ extends Request<unknown>, RES extends Response<unknown>> = {\n name: string;\n method: Method,\n path: string,\n client: Client<REQ, RES>;\n server: Server<REQ, RES>\n}';
1378
+ this.v20_1 = 'community.flock.wirespec';
1379
+ var tmp = this;
1380
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1381
+ var this_0 = convert(new Shared(this.v20_1));
1382
+ var scope = new TransformScope(this_0);
1383
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectBefore' call
1384
+ var tmp_0 = scope;
1385
+ // Inline function 'community.flock.wirespec.ir.core.injectBefore' call
1386
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1387
+ var this_1 = scope.z1t_1;
1388
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1389
+ // Inline function 'kotlin.apply' call
1390
+ var this_2 = new TransformerBuilder();
1391
+ this_2.d1h(TypeScriptIrEmitter$shared$o$source$lambda);
1392
+ var tmp$ret$2 = this_2.e1h();
1393
+ tmp_0.z1t_1 = transform(this_1, tmp$ret$2);
1394
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
1395
+ var tmp_1 = scope;
1396
+ // Inline function 'community.flock.wirespec.ir.core.injectAfter' call
1397
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1398
+ var this_3 = scope.z1t_1;
1399
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1400
+ // Inline function 'kotlin.apply' call
1401
+ var this_4 = new TransformerBuilder();
1402
+ this_4.d1h(TypeScriptIrEmitter$shared$o$source$lambda_0(this));
1403
+ var tmp$ret$8 = this_4.e1h();
1404
+ tmp_1.z1t_1 = transform(this_3, tmp$ret$8);
1405
+ var tmp_2 = scope.z1t_1;
1406
+ var tmp$ret$13 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
1407
+ tmp.w20_1 = generateTypeScript(tmp$ret$13);
1408
+ }
1409
+ protoOf(TypeScriptIrEmitter$shared$1).r1w = function () {
1410
+ return this.w20_1;
1411
+ };
1412
+ function TypeScriptIrEmitter$emit$lambda(it) {
1413
+ return 'export {' + it.vq().l1() + "} from './" + it.vq().l1() + "'";
1414
+ }
1415
+ function TypeScriptIrEmitter$emit$lambda$lambda($fieldNames) {
1416
+ return function (s, t) {
1417
+ var tmp;
1418
+ var tmp_0;
1419
+ var tmp_1;
1420
+ var tmp_2;
1421
+ if (s instanceof FunctionCall) {
1422
+ tmp_2 = s.b1m_1.equals(Companion_getInstance().m1h('validate'));
1423
+ } else {
1424
+ tmp_2 = false;
1425
+ }
1426
+ if (tmp_2) {
1427
+ tmp_1 = !(s.z1l_1 == null);
1428
+ } else {
1429
+ tmp_1 = false;
1430
+ }
1431
+ if (tmp_1) {
1432
+ // Inline function 'kotlin.collections.isNotEmpty' call
1433
+ tmp_0 = !s.a1m_1.r();
1434
+ } else {
1435
+ tmp_0 = false;
1436
+ }
1437
+ if (tmp_0) {
1438
+ var tmp_3 = first(s.a1m_1);
1439
+ var tmp0_safe_receiver = tmp_3 instanceof Custom_0 ? tmp_3 : null;
1440
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1h_1;
1441
+ var typeName = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
1442
+ tmp = new FunctionCall(VOID, VOID, Companion_getInstance().m1h('validate' + typeName), mapOf(to(Companion_getInstance().m1h('obj'), t.u1t(ensureNotNull(s.z1l_1)))));
1443
+ } else {
1444
+ var tmp_4;
1445
+ var tmp_5;
1446
+ if (s instanceof FieldCall) {
1447
+ tmp_5 = s.i1p_1 == null;
1448
+ } else {
1449
+ tmp_5 = false;
1450
+ }
1451
+ if (tmp_5) {
1452
+ tmp_4 = $fieldNames.u1(s.j1p_1.r1l());
1453
+ } else {
1454
+ tmp_4 = false;
1455
+ }
1456
+ if (tmp_4) {
1457
+ tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('obj')), s.j1p_1);
1458
+ } else {
1459
+ tmp = transformChildren_0(s, t);
1460
+ }
1461
+ }
1462
+ return tmp;
1463
+ };
1464
+ }
1465
+ function TypeScriptIrEmitter$emit$lambda_0($type, $fieldNames) {
1466
+ return function (element, transformer) {
1467
+ var tmp;
1468
+ if (element instanceof Function) {
1469
+ var tmp_0;
1470
+ if (element.t1j_1.equals(Companion_getInstance().m1h('validate'))) {
1471
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1472
+ var this_0 = element.b1k(Companion_getInstance().m1h('validate' + $type.vo_1.l1()), VOID, listOf(new Parameter(Companion_getInstance().m1h('obj'), new Custom_0($type.vo_1.l1()))));
1473
+ var scope = new TransformScope(this_0);
1474
+ scope.i1u(TypeScriptIrEmitter$emit$lambda$lambda($fieldNames));
1475
+ var tmp_1 = scope.z1t_1;
1476
+ tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1477
+ } else {
1478
+ tmp_0 = element;
1479
+ }
1480
+ tmp = tmp_0;
1481
+ } else {
1482
+ tmp = element;
1483
+ }
1484
+ var transformed = tmp;
1485
+ return transformChildren(transformed, transformer);
1486
+ };
1487
+ }
1488
+ function TypeScriptIrEmitter$emit$lambda_1(stmt, transformer) {
1489
+ var tmp;
1490
+ if (stmt instanceof Switch) {
1491
+ var tmp1_safe_receiver = stmt.o1p_1;
1492
+ var tmp_0;
1493
+ if (tmp1_safe_receiver == null) {
1494
+ tmp_0 = null;
1495
+ } else {
1496
+ // Inline function 'kotlin.collections.map' call
1497
+ // Inline function 'kotlin.collections.mapTo' call
1498
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_safe_receiver, 10));
1499
+ var _iterator__ex2g4s = tmp1_safe_receiver.t();
1500
+ while (_iterator__ex2g4s.u()) {
1501
+ var item = _iterator__ex2g4s.v();
1502
+ var tmp_1;
1503
+ var tmp_2;
1504
+ if (item instanceof ErrorStatement) {
1505
+ var tmp_3 = item.s1p_1;
1506
+ tmp_2 = tmp_3 instanceof BinaryOp;
1507
+ } else {
1508
+ tmp_2 = false;
1509
+ }
1510
+ if (tmp_2) {
1511
+ var tmp_4 = item.s1p_1;
1512
+ var binary = tmp_4 instanceof BinaryOp ? tmp_4 : THROW_CCE();
1513
+ var tmp_5 = binary.t1p_1;
1514
+ var literal = tmp_5 instanceof Literal_0 ? tmp_5 : null;
1515
+ tmp_1 = !(literal == null) ? new ErrorStatement(new Literal_0(trimEnd(toString(literal.d1p_1), charArrayOf([_Char___init__impl__6a9atx(32)])), literal.e1p_1)) : item;
1516
+ } else {
1517
+ tmp_1 = item;
1518
+ }
1519
+ var tmp$ret$0 = tmp_1;
1520
+ destination.x(tmp$ret$0);
1521
+ }
1522
+ tmp_0 = destination;
1523
+ }
1524
+ tmp = transformChildren_0(stmt.r1p(VOID, VOID, tmp_0), transformer);
1525
+ } else {
1526
+ tmp = transformChildren_0(stmt, transformer);
1527
+ }
1528
+ return tmp;
1529
+ }
1530
+ function TypeScriptIrEmitter$emit$lambda_2(element, transformer) {
1531
+ var tmp;
1532
+ if (element instanceof Interface) {
1533
+ var tmp_0;
1534
+ if (element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
1535
+ // Inline function 'kotlin.collections.map' call
1536
+ var this_0 = element.n1o_1;
1537
+ // Inline function 'kotlin.collections.mapTo' call
1538
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1539
+ var _iterator__ex2g4s = this_0.t();
1540
+ while (_iterator__ex2g4s.u()) {
1541
+ var item = _iterator__ex2g4s.v();
1542
+ var tmp_1;
1543
+ if (item instanceof Function) {
1544
+ tmp_1 = item.b1k(VOID, VOID, listOf(new Parameter(Companion_getInstance().m1h('params'), new Custom_0('RequestParams'))));
1545
+ } else {
1546
+ tmp_1 = item;
1547
+ }
1548
+ var tmp$ret$0 = tmp_1;
1549
+ destination.x(tmp$ret$0);
1550
+ }
1551
+ tmp_0 = element.t1o(VOID, destination);
1552
+ } else {
1553
+ tmp_0 = element;
1554
+ }
1555
+ tmp = tmp_0;
1556
+ } else {
1557
+ tmp = element;
1558
+ }
1559
+ var transformed = tmp;
1560
+ return transformChildren(transformed, transformer);
1561
+ }
1562
+ function TypeScriptIrEmitter$emit$lambda_3(this$0, $endpoint) {
1563
+ return function (element, transformer) {
1564
+ var tmp;
1565
+ if (element instanceof Namespace) {
1566
+ var injected = listOf(buildApiConst(this$0, $endpoint));
1567
+ var tmp_0;
1568
+ // Inline function 'kotlin.collections.isNotEmpty' call
1569
+ if (!injected.r()) {
1570
+ tmp_0 = withElements(element, plus_0(element.v1m(), injected));
1571
+ } else {
1572
+ tmp_0 = element;
1573
+ }
1574
+ tmp = tmp_0;
1575
+ } else {
1576
+ tmp = element;
1577
+ }
1578
+ var transformed = tmp;
1579
+ return transformChildren(transformed, transformer);
1580
+ };
1581
+ }
1582
+ function TypeScriptIrEmitter$buildApiConst$lambda(it) {
1583
+ var tmp;
1584
+ if (it instanceof Literal) {
1585
+ tmp = it.hq_1;
1586
+ } else {
1587
+ if (it instanceof Param) {
1588
+ tmp = '{' + it.lp_1.l1() + '}';
1589
+ } else {
1590
+ noWhenBranchMatchedException();
1591
+ }
1592
+ }
1593
+ return tmp;
1594
+ }
1595
+ function TypeScriptIrEmitter$emitClient$lambda(this$0) {
1596
+ return function (it) {
1597
+ var methodName = firstToLower(this$0, it.ep_1.l1());
1598
+ return ' ...' + methodName + 'Client(serialization, transportation),';
1599
+ };
1600
+ }
1601
+ function TypeScriptIrEmitter$transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
1602
+ var tmp;
1603
+ var tmp_0;
1604
+ if (stmt instanceof Switch) {
1605
+ var tmp0 = stmt.n1p_1;
1606
+ var tmp$ret$0;
1607
+ $l$block_0: {
1608
+ // Inline function 'kotlin.collections.any' call
1609
+ var tmp_1;
1610
+ if (isInterface(tmp0, Collection)) {
1611
+ tmp_1 = tmp0.r();
1612
+ } else {
1613
+ tmp_1 = false;
1614
+ }
1615
+ if (tmp_1) {
1616
+ tmp$ret$0 = false;
1617
+ break $l$block_0;
1618
+ }
1619
+ var _iterator__ex2g4s = tmp0.t();
1620
+ while (_iterator__ex2g4s.u()) {
1621
+ var element = _iterator__ex2g4s.v();
1622
+ if (!(element.a1q_1 == null)) {
1623
+ tmp$ret$0 = true;
1624
+ break $l$block_0;
1625
+ }
1626
+ }
1627
+ tmp$ret$0 = false;
1628
+ }
1629
+ tmp_0 = tmp$ret$0;
1630
+ } else {
1631
+ tmp_0 = false;
1632
+ }
1633
+ if (tmp_0) {
1634
+ var tmp0_safe_receiver = stmt.p1p_1;
1635
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l();
1636
+ var varName = tmp1_elvis_lhs == null ? 'r' : tmp1_elvis_lhs;
1637
+ // Inline function 'kotlin.collections.map' call
1638
+ var this_0 = stmt.n1p_1;
1639
+ // Inline function 'kotlin.collections.mapTo' call
1640
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1641
+ var _iterator__ex2g4s_0 = this_0.t();
1642
+ while (_iterator__ex2g4s_0.u()) {
1643
+ var item = _iterator__ex2g4s_0.v();
1644
+ var tmp_2 = item.a1q_1;
1645
+ var tmp0_safe_receiver_0 = tmp_2 instanceof Custom_0 ? tmp_2 : null;
1646
+ var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.q1h_1;
1647
+ var tmp2_safe_receiver = typeName == null ? null : substringAfterLast(typeName, '.');
1648
+ var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : removePrefix(tmp2_safe_receiver, 'Response');
1649
+ var statusNum = tmp3_safe_receiver == null ? null : toIntOrNull(tmp3_safe_receiver);
1650
+ var tmp_3;
1651
+ if (!(statusNum == null) && !(typeName == null)) {
1652
+ var exprCode = TypeScriptGenerator_instance.a1v(tr.u1t(stmt.m1p_1));
1653
+ var castAssignment = new Assignment(Companion_getInstance().m1h(varName), new RawExpression(exprCode + ' as ' + typeName), false);
1654
+ var tmp_4 = new Literal_0(statusNum, new Integer_0());
1655
+ var tmp_5 = listOf(castAssignment);
1656
+ // Inline function 'kotlin.collections.map' call
1657
+ var this_1 = item.z1p_1;
1658
+ // Inline function 'kotlin.collections.mapTo' call
1659
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
1660
+ var _iterator__ex2g4s_1 = this_1.t();
1661
+ while (_iterator__ex2g4s_1.u()) {
1662
+ var item_0 = _iterator__ex2g4s_1.v();
1663
+ var tmp$ret$2 = tr.t1t(item_0);
1664
+ destination_0.x(tmp$ret$2);
1665
+ }
1666
+ tmp_3 = new Case(tmp_4, plus_0(tmp_5, destination_0), null);
1667
+ } else {
1668
+ // Inline function 'kotlin.collections.map' call
1669
+ var this_2 = item.z1p_1;
1670
+ // Inline function 'kotlin.collections.mapTo' call
1671
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
1672
+ var _iterator__ex2g4s_2 = this_2.t();
1673
+ while (_iterator__ex2g4s_2.u()) {
1674
+ var item_1 = _iterator__ex2g4s_2.v();
1675
+ var tmp$ret$5 = tr.t1t(item_1);
1676
+ destination_1.x(tmp$ret$5);
1677
+ }
1678
+ tmp_3 = item.c1q(VOID, destination_1);
1679
+ }
1680
+ var tmp$ret$8 = tmp_3;
1681
+ destination.x(tmp$ret$8);
1682
+ }
1683
+ var transformedCases = destination;
1684
+ var tmp_6 = new FieldCall(tr.u1t(stmt.m1p_1), Companion_getInstance().m1h('status'));
1685
+ var tmp2_safe_receiver_0 = stmt.o1p_1;
1686
+ var tmp_7;
1687
+ if (tmp2_safe_receiver_0 == null) {
1688
+ tmp_7 = null;
1689
+ } else {
1690
+ // Inline function 'kotlin.collections.map' call
1691
+ // Inline function 'kotlin.collections.mapTo' call
1692
+ var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver_0, 10));
1693
+ var _iterator__ex2g4s_3 = tmp2_safe_receiver_0.t();
1694
+ while (_iterator__ex2g4s_3.u()) {
1695
+ var item_2 = _iterator__ex2g4s_3.v();
1696
+ var tmp$ret$11 = tr.t1t(item_2);
1697
+ destination_2.x(tmp$ret$11);
1698
+ }
1699
+ tmp_7 = destination_2;
1700
+ }
1701
+ tmp = new Switch(tmp_6, transformedCases, tmp_7, null);
1702
+ } else {
1703
+ tmp = transformChildren_0(stmt, tr);
1704
+ }
1705
+ return tmp;
1706
+ }
1707
+ function TypeScriptIrEmitter() {
1708
+ Companion_getInstance_0();
1709
+ this.x20_1 = TypeScriptGenerator_instance;
1710
+ this.y20_1 = FileExtension_TypeScript_getInstance();
1711
+ var tmp = this;
1712
+ tmp.z20_1 = lazy(TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this));
1713
+ var tmp_0 = this;
1714
+ tmp_0.a21_1 = new TypeScriptIrEmitter$shared$1();
1715
+ }
1716
+ protoOf(TypeScriptIrEmitter).m1u = function () {
1717
+ return this.x20_1;
1718
+ };
1719
+ protoOf(TypeScriptIrEmitter).eq = function () {
1720
+ return this.y20_1;
1721
+ };
1722
+ protoOf(TypeScriptIrEmitter).t1v = function () {
1723
+ return this.a21_1;
1724
+ };
1725
+ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
1726
+ var tmp = emit.call(this, ast, logger);
1727
+ // Inline function 'arrow.core.NonEmptyList.flatMap' call
1728
+ var this_0 = ast.bq_1;
1729
+ // Inline function 'kotlin.collections.flatMap' call
1730
+ var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
1731
+ // Inline function 'kotlin.collections.flatMapTo' call
1732
+ var destination = ArrayList_init_$Create$();
1733
+ var _iterator__ex2g4s = tmp0.t();
1734
+ while (_iterator__ex2g4s.u()) {
1735
+ var element = _iterator__ex2g4s.v();
1736
+ var list = new NonEmptyList(element.dq_1);
1737
+ addAll(destination, list);
1738
+ }
1739
+ var tmp$ret$3 = _NonEmptyList___init__impl__fxd0xp(destination);
1740
+ // Inline function 'kotlin.collections.groupBy' call
1741
+ var tmp0_0 = new NonEmptyList(tmp$ret$3);
1742
+ // Inline function 'kotlin.collections.groupByTo' call
1743
+ var destination_0 = LinkedHashMap_init_$Create$();
1744
+ var _iterator__ex2g4s_0 = tmp0_0.t();
1745
+ while (_iterator__ex2g4s_0.u()) {
1746
+ var element_0 = _iterator__ex2g4s_0.v();
1747
+ var key = namespace(element_0);
1748
+ // Inline function 'kotlin.collections.getOrPut' call
1749
+ var value = destination_0.p2(key);
1750
+ var tmp_0;
1751
+ if (value == null) {
1752
+ var answer = ArrayList_init_$Create$();
1753
+ destination_0.w2(key, answer);
1754
+ tmp_0 = answer;
1755
+ } else {
1756
+ tmp_0 = value;
1757
+ }
1758
+ var list_0 = tmp_0;
1759
+ list_0.x(element_0);
1760
+ }
1761
+ // Inline function 'kotlin.collections.map' call
1762
+ // Inline function 'kotlin.collections.mapTo' call
1763
+ var destination_1 = ArrayList_init_$Create$_0(destination_0.a1());
1764
+ // Inline function 'kotlin.collections.iterator' call
1765
+ var _iterator__ex2g4s_1 = destination_0.j1().t();
1766
+ while (_iterator__ex2g4s_1.u()) {
1767
+ var item = _iterator__ex2g4s_1.v();
1768
+ // Inline function 'kotlin.collections.component1' call
1769
+ var ns = item.k1();
1770
+ // Inline function 'kotlin.collections.component2' call
1771
+ var defs = item.l1();
1772
+ var tmp_1 = ns + '/index.' + this.eq().nq_1;
1773
+ var tmp$ret$12 = new Emitted(tmp_1, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$emit$lambda));
1774
+ destination_1.x(tmp$ret$12);
1775
+ }
1776
+ return NonEmptyList__plus_impl_xqmb9_0(tmp, destination_1);
1777
+ };
1778
+ protoOf(TypeScriptIrEmitter).n1u = function (module_0, logger) {
1779
+ return NonEmptyList__plus_impl_xqmb9(emit_0.call(this, module_0, logger), new File(Companion_getInstance().m1h('Wirespec'), listOf(new RawElement(this.t1v().r1w()))));
1780
+ };
1781
+ protoOf(TypeScriptIrEmitter).uq = function (definition, module_0, logger) {
1782
+ var file = emit_1.call(this, definition, module_0, logger);
1783
+ var subPackageName = plus(Companion_instance.lr(''), definition);
1784
+ return new File(Companion_getInstance().m1h(subPackageName.or() + sanitizeSymbol_1(this, file.t1m_1.x1l())), plus_0(listOf(import_0('../Wirespec', 'Wirespec')), file.u1m_1));
1785
+ };
1786
+ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
1787
+ var fieldValidations = classifyValidatableFields(type, module_0);
1788
+ // Inline function 'kotlin.collections.distinctBy' call
1789
+ var this_0 = importReferences(type);
1790
+ var set = HashSet_init_$Create$();
1791
+ var list = ArrayList_init_$Create$();
1792
+ var _iterator__ex2g4s = this_0.t();
1793
+ while (_iterator__ex2g4s.u()) {
1794
+ var e = _iterator__ex2g4s.v();
1795
+ var key = e.lu_1;
1796
+ if (set.x(key)) {
1797
+ list.x(e);
1798
+ }
1799
+ }
1800
+ // Inline function 'kotlin.collections.map' call
1801
+ // Inline function 'kotlin.collections.mapTo' call
1802
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
1803
+ var _iterator__ex2g4s_0 = list.t();
1804
+ while (_iterator__ex2g4s_0.u()) {
1805
+ var item = _iterator__ex2g4s_0.v();
1806
+ var tmp$ret$2 = import_0('./' + item.lu_1, item.lu_1);
1807
+ destination.x(tmp$ret$2);
1808
+ }
1809
+ var typeImports = destination;
1810
+ // Inline function 'kotlin.collections.map' call
1811
+ // Inline function 'kotlin.collections.mapTo' call
1812
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(fieldValidations, 10));
1813
+ var _iterator__ex2g4s_1 = fieldValidations.t();
1814
+ while (_iterator__ex2g4s_1.u()) {
1815
+ var item_0 = _iterator__ex2g4s_1.v();
1816
+ var tmp$ret$5 = item_0.j1h_1;
1817
+ destination_0.x(tmp$ret$5);
1818
+ }
1819
+ // Inline function 'kotlin.collections.filter' call
1820
+ var tmp0 = distinct(destination_0);
1821
+ // Inline function 'kotlin.collections.filterTo' call
1822
+ var destination_1 = ArrayList_init_$Create$();
1823
+ var _iterator__ex2g4s_2 = tmp0.t();
1824
+ while (_iterator__ex2g4s_2.u()) {
1825
+ var element = _iterator__ex2g4s_2.v();
1826
+ if (!(element === type.vo_1.l1())) {
1827
+ destination_1.x(element);
1828
+ }
1829
+ }
1830
+ // Inline function 'kotlin.collections.map' call
1831
+ // Inline function 'kotlin.collections.mapTo' call
1832
+ var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
1833
+ var _iterator__ex2g4s_3 = destination_1.t();
1834
+ while (_iterator__ex2g4s_3.u()) {
1835
+ var item_1 = _iterator__ex2g4s_3.v();
1836
+ var tmp$ret$11 = import_0('./' + item_1, 'validate' + item_1);
1837
+ destination_2.x(tmp$ret$11);
1838
+ }
1839
+ var validateImports = destination_2;
1840
+ var allImports = plus_0(typeImports, validateImports);
1841
+ // Inline function 'kotlin.collections.map' call
1842
+ var this_1 = type.wo_1.so_1;
1843
+ // Inline function 'kotlin.collections.mapTo' call
1844
+ var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
1845
+ var _iterator__ex2g4s_4 = this_1.t();
1846
+ while (_iterator__ex2g4s_4.u()) {
1847
+ var item_2 = _iterator__ex2g4s_4.v();
1848
+ var tmp$ret$14 = item_2.ap_1.l1();
1849
+ destination_3.x(tmp$ret$14);
1850
+ }
1851
+ var fieldNames = toSet(destination_3);
1852
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1853
+ var this_2 = sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this));
1854
+ var scope = new TransformScope(this_2);
1855
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1856
+ var tmp = scope;
1857
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1858
+ var this_3 = scope.z1t_1;
1859
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1860
+ // Inline function 'kotlin.apply' call
1861
+ var this_4 = new TransformerBuilder();
1862
+ this_4.d1h(TypeScriptIrEmitter$emit$lambda_0(type, fieldNames));
1863
+ var tmp$ret$19 = this_4.e1h();
1864
+ tmp.z1t_1 = transform(this_3, tmp$ret$19);
1865
+ var tmp_0 = scope.z1t_1;
1866
+ var file = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1867
+ var tmp_1;
1868
+ // Inline function 'kotlin.collections.isNotEmpty' call
1869
+ if (!allImports.r()) {
1870
+ tmp_1 = file.x1m(VOID, plus_0(allImports, file.u1m_1));
1871
+ } else {
1872
+ tmp_1 = file;
1873
+ }
1874
+ return tmp_1;
1875
+ };
1876
+ protoOf(TypeScriptIrEmitter).ir = function (enum_0, module_0) {
1877
+ return sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
1878
+ };
1879
+ protoOf(TypeScriptIrEmitter).yq = function (union) {
1880
+ // Inline function 'kotlin.collections.distinctBy' call
1881
+ var this_0 = importReferences(union);
1882
+ var set = HashSet_init_$Create$();
1883
+ var list = ArrayList_init_$Create$();
1884
+ var _iterator__ex2g4s = this_0.t();
1885
+ while (_iterator__ex2g4s.u()) {
1886
+ var e = _iterator__ex2g4s.v();
1887
+ var key = e.lu_1;
1888
+ if (set.x(key)) {
1889
+ list.x(e);
1890
+ }
1891
+ }
1892
+ // Inline function 'kotlin.collections.map' call
1893
+ // Inline function 'kotlin.collections.mapTo' call
1894
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
1895
+ var _iterator__ex2g4s_0 = list.t();
1896
+ while (_iterator__ex2g4s_0.u()) {
1897
+ var item = _iterator__ex2g4s_0.v();
1898
+ var tmp$ret$2 = import_0('../model', item.lu_1, true);
1899
+ destination.x(tmp$ret$2);
1900
+ }
1901
+ var imports = destination;
1902
+ var file = sanitizeNames(convert_1(union), _get_sanitizationConfig__sns434(this));
1903
+ var tmp;
1904
+ // Inline function 'kotlin.collections.isNotEmpty' call
1905
+ if (!imports.r()) {
1906
+ tmp = file.x1m(VOID, plus_0(imports, file.u1m_1));
1907
+ } else {
1908
+ tmp = file;
1909
+ }
1910
+ return tmp;
1911
+ };
1912
+ protoOf(TypeScriptIrEmitter).dr = function (refined) {
1913
+ var converted = convert_2(refined);
1914
+ var constraintExpr = convertConstraint(refined.cr_1, new VariableReference(Companion_getInstance().m1h('value')));
1915
+ var validatorStr = TypeScriptGenerator_instance.a1v(constraintExpr);
1916
+ return new File(converted.t1m_1, listOf_0([new RawElement('export type ' + converted.t1m_1.x1l() + ' = ' + emitTypeScriptReference(this, refined.cr_1) + ';'), new RawElement('export const validate' + refined.br_1.l1() + ' = (value: ' + emitTypeScriptReference(this, refined.cr_1) + ') =>\n ' + validatorStr + ';')]));
1917
+ };
1918
+ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
1919
+ // Inline function 'kotlin.collections.distinctBy' call
1920
+ var this_0 = importReferences(endpoint);
1921
+ var set = HashSet_init_$Create$();
1922
+ var list = ArrayList_init_$Create$();
1923
+ var _iterator__ex2g4s = this_0.t();
1924
+ while (_iterator__ex2g4s.u()) {
1925
+ var e = _iterator__ex2g4s.v();
1926
+ var key = e.lu_1;
1927
+ if (set.x(key)) {
1928
+ list.x(e);
1929
+ }
1930
+ }
1931
+ // Inline function 'kotlin.collections.map' call
1932
+ // Inline function 'kotlin.collections.mapTo' call
1933
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
1934
+ var _iterator__ex2g4s_0 = list.t();
1935
+ while (_iterator__ex2g4s_0.u()) {
1936
+ var item = _iterator__ex2g4s_0.v();
1937
+ var tmp$ret$2 = import_0('../model', item.lu_1, true);
1938
+ destination.x(tmp$ret$2);
1939
+ }
1940
+ var imports = destination;
1941
+ // Inline function 'kotlin.collections.isNotEmpty' call
1942
+ var hasRequestParams = !requestParameters(endpoint).r();
1943
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1944
+ var this_1 = convert_3(endpoint);
1945
+ var scope = new TransformScope(this_1);
1946
+ scope.g1u(TypeScriptIrEmitter$emit$lambda_1);
1947
+ var tmp = scope.z1t_1;
1948
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1949
+ var this_2 = isInterface(tmp, Element) ? tmp : THROW_CCE();
1950
+ var scope_0 = new TransformScope(this_2);
1951
+ scope_0.e1u(transformPatternSwitchToValueSwitch(this));
1952
+ var tmp_0 = scope_0.z1t_1;
1953
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1954
+ var this_3 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1955
+ var scope_1 = new TransformScope(this_3);
1956
+ if (hasRequestParams) {
1957
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1958
+ var tmp_1 = scope_1;
1959
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1960
+ var this_4 = scope_1.z1t_1;
1961
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1962
+ // Inline function 'kotlin.apply' call
1963
+ var this_5 = new TransformerBuilder();
1964
+ this_5.d1h(TypeScriptIrEmitter$emit$lambda_2);
1965
+ var tmp$ret$12 = this_5.e1h();
1966
+ tmp_1.z1t_1 = transform(this_4, tmp$ret$12);
1967
+ }
1968
+ var tmp_2 = scope_1.z1t_1;
1969
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1970
+ var this_6 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
1971
+ var scope_2 = new TransformScope(this_6);
1972
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
1973
+ var tmp_3 = scope_2;
1974
+ // Inline function 'community.flock.wirespec.ir.core.injectAfter' call
1975
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1976
+ var this_7 = scope_2.z1t_1;
1977
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1978
+ // Inline function 'kotlin.apply' call
1979
+ var this_8 = new TransformerBuilder();
1980
+ this_8.d1h(TypeScriptIrEmitter$emit$lambda_3(this, endpoint));
1981
+ var tmp$ret$19 = this_8.e1h();
1982
+ tmp_3.z1t_1 = transform(this_7, tmp$ret$19);
1983
+ var tmp_4 = scope_2.z1t_1;
1984
+ var tmp$ret$24 = isInterface(tmp_4, Element) ? tmp_4 : THROW_CCE();
1985
+ // Inline function 'kotlin.let' call
1986
+ var it = sanitizeNames(tmp$ret$24.x1m(Companion_getInstance().m1h(sanitize(this, endpoint.ep_1))), _get_sanitizationConfig__sns434(this));
1987
+ var tmp_5;
1988
+ // Inline function 'kotlin.collections.isNotEmpty' call
1989
+ if (!imports.r()) {
1990
+ tmp_5 = it.x1m(VOID, plus_0(imports, it.u1m_1));
1991
+ } else {
1992
+ tmp_5 = it;
1993
+ }
1994
+ return tmp_5;
1995
+ };
1996
+ protoOf(TypeScriptIrEmitter).xq = function (channel) {
1997
+ return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
1998
+ };
1999
+ protoOf(TypeScriptIrEmitter).q1u = function (endpoint) {
2000
+ var endpointName = endpoint.ep_1.l1();
2001
+ var methodName = firstToLower(this, endpointName);
2002
+ // Inline function 'kotlin.collections.distinctBy' call
2003
+ var this_0 = importReferences(endpoint);
2004
+ var set = HashSet_init_$Create$();
2005
+ var list = ArrayList_init_$Create$();
2006
+ var _iterator__ex2g4s = this_0.t();
2007
+ while (_iterator__ex2g4s.u()) {
2008
+ var e = _iterator__ex2g4s.v();
2009
+ var key = e.lu_1;
2010
+ if (set.x(key)) {
2011
+ list.x(e);
2012
+ }
2013
+ }
2014
+ // Inline function 'kotlin.collections.map' call
2015
+ // Inline function 'kotlin.collections.mapTo' call
2016
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
2017
+ var _iterator__ex2g4s_0 = list.t();
2018
+ while (_iterator__ex2g4s_0.u()) {
2019
+ var item = _iterator__ex2g4s_0.v();
2020
+ var tmp$ret$2 = import_0('../model', item.lu_1, true);
2021
+ destination.x(tmp$ret$2);
2022
+ }
2023
+ var imports = destination;
2024
+ var params = buildEndpointParams(this, endpoint);
2025
+ var tmp;
2026
+ // Inline function 'kotlin.collections.isNotEmpty' call
2027
+ if (!params.r()) {
2028
+ tmp = 'params: ' + endpointName + '.RequestParams';
2029
+ } else {
2030
+ tmp = '';
2031
+ }
2032
+ var paramList = tmp;
2033
+ var tmp_0;
2034
+ // Inline function 'kotlin.collections.isNotEmpty' call
2035
+ if (!params.r()) {
2036
+ tmp_0 = endpointName + '.request(params)';
2037
+ } else {
2038
+ tmp_0 = endpointName + '.request()';
2039
+ }
2040
+ var requestArgs = tmp_0;
2041
+ var code = trimMargin('\n |export const ' + methodName + 'Client = (serialization: Wirespec.Serialization, transportation: Wirespec.Transportation) => ({\n | ' + methodName + ': async (' + paramList + '): Promise<' + endpointName + '.Response<unknown>> => {\n | const request: ' + endpointName + '.Request = ' + requestArgs + ';\n | const rawRequest = ' + endpointName + '.toRawRequest(serialization, request);\n | const rawResponse = await transportation.transport(rawRequest);\n | return ' + endpointName + '.fromRawResponse(serialization, rawResponse);\n | }\n |})\n ');
2042
+ var tmp_1 = Companion_getInstance().m1h('client/' + endpointName + 'Client');
2043
+ // Inline function 'kotlin.collections.buildList' call
2044
+ // Inline function 'kotlin.collections.buildListInternal' call
2045
+ // Inline function 'kotlin.apply' call
2046
+ var this_1 = ArrayList_init_$Create$();
2047
+ this_1.x(import_0('../Wirespec', 'Wirespec'));
2048
+ this_1.x(import_0('../endpoint/' + endpointName, endpointName));
2049
+ this_1.e1(imports);
2050
+ this_1.x(new RawElement(code));
2051
+ var tmp$ret$10 = this_1.o5();
2052
+ return new File(tmp_1, tmp$ret$10);
2053
+ };
2054
+ protoOf(TypeScriptIrEmitter).p1u = function (endpoints, logger) {
2055
+ logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
2056
+ // Inline function 'kotlin.collections.map' call
2057
+ // Inline function 'kotlin.collections.mapTo' call
2058
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
2059
+ var _iterator__ex2g4s = endpoints.t();
2060
+ while (_iterator__ex2g4s.u()) {
2061
+ var item = _iterator__ex2g4s.v();
2062
+ var methodName = firstToLower(this, item.ep_1.l1());
2063
+ var tmp$ret$0 = import_0('./client/' + item.ep_1.l1() + 'Client', methodName + 'Client');
2064
+ destination.x(tmp$ret$0);
2065
+ }
2066
+ var clientImports = destination;
2067
+ var spreadEntries = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$emitClient$lambda(this));
2068
+ var code = trimMargin('\n |export const client = (serialization: Wirespec.Serialization, transportation: Wirespec.Transportation) => ({\n |' + spreadEntries + '\n |})\n ');
2069
+ var tmp = Companion_getInstance().m1h('Client');
2070
+ // Inline function 'kotlin.collections.buildList' call
2071
+ // Inline function 'kotlin.collections.buildListInternal' call
2072
+ // Inline function 'kotlin.apply' call
2073
+ var this_0 = ArrayList_init_$Create$();
2074
+ this_0.x(import_0('./Wirespec', 'Wirespec'));
2075
+ this_0.e1(clientImports);
2076
+ this_0.x(new RawElement(code));
2077
+ var tmp$ret$6 = this_0.o5();
2078
+ return new File(tmp, tmp$ret$6);
2079
+ };
999
2080
  function TypeScriptRefinedTypeDefinitionEmitter() {
1000
2081
  }
1001
2082
  function TypeScriptShared() {
1002
2083
  TypeScriptShared_instance = this;
1003
- this.v2b_1 = 'community.flock.wirespec';
1004
- this.w2b_1 = trimMargin('\n |export namespace Wirespec {\n |' + Spacer_instance.toString() + 'export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"\n |' + Spacer_instance.toString() + 'export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type RawResponse = { status: number, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type Request<T> = { path: Record<string, unknown>, method: Method, queries?: Record<string, unknown>, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Response<T> = { status:number, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Serialization = { serialize: <T>(type: T) => string; deserialize: <T>(raw: string | undefined) => T }\n |' + Spacer_instance.toString() + 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { to: (request: REQ) => RawRequest; from: (response: RawResponse) => RES }\n |' + Spacer_instance.toString() + 'export type Server<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { from: (request: RawRequest) => REQ; to: (response: RES) => RawResponse }\n |' + Spacer_instance.toString() + 'export type Api<REQ extends Request<unknown>, RES extends Response<unknown>> = { name: string; method: Method, path: string, client: Client<REQ, RES>; server: Server<REQ, RES> }\n |}\n ');
2084
+ this.s20_1 = 'community.flock.wirespec';
2085
+ this.t20_1 = trimMargin('\n |export namespace Wirespec {\n |' + Spacer_instance.toString() + 'export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"\n |' + Spacer_instance.toString() + 'export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type RawResponse = { status: number, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type Request<T> = { path: Record<string, unknown>, method: Method, queries?: Record<string, unknown>, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Response<T> = { status:number, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Serialization = { serialize: <T>(type: T) => string; deserialize: <T>(raw: string | undefined) => T }\n |' + Spacer_instance.toString() + 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { to: (request: REQ) => RawRequest; from: (response: RawResponse) => RES }\n |' + Spacer_instance.toString() + 'export type Server<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { from: (request: RawRequest) => REQ; to: (response: RES) => RawResponse }\n |' + Spacer_instance.toString() + 'export type Api<REQ extends Request<unknown>, RES extends Response<unknown>> = { name: string; method: Method, path: string, client: Client<REQ, RES>; server: Server<REQ, RES> }\n |}\n ');
1005
2086
  }
2087
+ protoOf(TypeScriptShared).r1w = function () {
2088
+ return this.t20_1;
2089
+ };
1006
2090
  protoOf(TypeScriptShared).toString = function () {
1007
2091
  return 'TypeScriptShared';
1008
2092
  };
@@ -1014,7 +2098,6 @@ protoOf(TypeScriptShared).equals = function (other) {
1014
2098
  return true;
1015
2099
  if (!(other instanceof TypeScriptShared))
1016
2100
  return false;
1017
- other instanceof TypeScriptShared || THROW_CCE();
1018
2101
  return true;
1019
2102
  };
1020
2103
  var TypeScriptShared_instance;
@@ -1024,7 +2107,7 @@ function TypeScriptShared_getInstance() {
1024
2107
  return TypeScriptShared_instance;
1025
2108
  }
1026
2109
  function TypeScriptTypeDefinitionEmitter$sanitizeSymbol$lambda(it) {
1027
- return isLetterOrDigit(it.x_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).o1(it);
2110
+ return isLetterOrDigit(it.h1_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).u1(it);
1028
2111
  }
1029
2112
  function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
1030
2113
  // Inline function 'kotlin.text.trimStart' call
@@ -1032,32 +2115,32 @@ function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
1032
2115
  }
1033
2116
  function TypeScriptTypeDefinitionEmitter$emit$lambda_0(this$0) {
1034
2117
  return function (it) {
1035
- return this$0.y24(it);
2118
+ return this$0.wp(it);
1036
2119
  };
1037
2120
  }
1038
2121
  function TypeScriptTypeDefinitionEmitter() {
1039
2122
  }
1040
2123
  //region block: post-declaration
1041
- protoOf(TypeScriptEmitter).k26 = emit_5;
1042
- protoOf(TypeScriptEmitter).w24 = emit_0;
1043
- protoOf(TypeScriptEmitter).z24 = emit_1;
1044
- protoOf(TypeScriptEmitter).a25 = emit_2;
1045
- protoOf(TypeScriptEmitter).x24 = emit_3;
1046
- protoOf(TypeScriptEmitter).y24 = emit_4;
1047
- protoOf(TypeScriptEmitter).y25 = emit;
1048
- protoOf(TypeScriptEmitter).l26 = emit_6;
1049
- protoOf(TypeScriptEmitter).f26 = emit_7;
1050
- protoOf(TypeScriptEmitter).m26 = emitValidator;
1051
- protoOf(TypeScriptEmitter).q2b = sanitizeSymbol;
1052
- protoOf(TypeScriptEmitter).n2b = sanitizeSymbol_0;
1053
- protoOf(TypeScriptEmitter).r2b = emitPrimitive;
1054
- protoOf(TypeScriptEmitter).p2b = emitClient;
1055
- protoOf(TypeScriptEmitter).c25 = emitClientEndpointRequest;
2124
+ protoOf(TypeScriptEmitter).up = emit_3;
2125
+ protoOf(TypeScriptEmitter).vp = emit_6;
2126
+ protoOf(TypeScriptEmitter).wp = emit_7;
2127
+ protoOf(TypeScriptEmitter).xp = emit_4;
2128
+ protoOf(TypeScriptEmitter).yp = emit_5;
2129
+ protoOf(TypeScriptEmitter).ir = emit_10;
2130
+ protoOf(TypeScriptEmitter).dr = emit_8;
2131
+ protoOf(TypeScriptEmitter).jr = emit_9;
2132
+ protoOf(TypeScriptEmitter).wq = emit_2;
2133
+ protoOf(TypeScriptEmitter).kr = emitValidator;
2134
+ protoOf(TypeScriptEmitter).n20 = sanitizeSymbol;
2135
+ protoOf(TypeScriptEmitter).w1v = sanitizeSymbol_0;
2136
+ protoOf(TypeScriptEmitter).o20 = emitPrimitive;
2137
+ protoOf(TypeScriptEmitter).m20 = emitClient;
2138
+ protoOf(TypeScriptEmitter).aq = emitClientEndpointRequest;
1056
2139
  //endregion
1057
2140
  //region block: exports
1058
2141
  export {
1059
2142
  TypeScriptEmitter as TypeScriptEmitter1b8xo1btx35xi,
1060
- TypeScriptShared_getInstance as TypeScriptShared_getInstance1i92wfog13qlr,
2143
+ TypeScriptIrEmitter as TypeScriptIrEmitter3q01omscsvyj9,
1061
2144
  };
1062
2145
  //endregion
1063
2146