@flock/wirespec 0.18.1-RC.2 → 0.18.4

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 (44) hide show
  1. package/clikt-clikt-mordant.mjs +79 -79
  2. package/clikt-clikt.mjs +1265 -1265
  3. package/clikt-clikt.mjs.map +1 -1
  4. package/colormath-root-colormath.mjs +433 -433
  5. package/kotlin-kotlin-stdlib.mjs +29 -23
  6. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  7. package/kotlin-openapi-bindings.mjs +5407 -5405
  8. package/kotlin-openapi-bindings.mjs.map +1 -1
  9. package/kotlin-rgxgen.mjs +1760 -1760
  10. package/kotlinx-io-kotlinx-io-core.mjs +404 -404
  11. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1701 -1701
  12. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1320 -1319
  13. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  14. package/mordant-mordant.mjs +1198 -1198
  15. package/package.json +1 -1
  16. package/wirespec-fetch.mjs +13 -19
  17. package/wirespec-src-compiler-core.mjs +193 -206
  18. package/wirespec-src-compiler-core.mjs.map +1 -1
  19. package/wirespec-src-compiler-emitters-java.mjs +718 -784
  20. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  21. package/wirespec-src-compiler-emitters-kotlin.mjs +357 -464
  22. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  23. package/wirespec-src-compiler-emitters-python.mjs +628 -757
  24. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  25. package/wirespec-src-compiler-emitters-rust.mjs +1582 -1708
  26. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
  27. package/wirespec-src-compiler-emitters-scala.mjs +680 -635
  28. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
  29. package/wirespec-src-compiler-emitters-typescript.mjs +627 -610
  30. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  31. package/wirespec-src-compiler-emitters-wirespec.mjs +40 -40
  32. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  33. package/wirespec-src-compiler-ir.mjs +5428 -6057
  34. package/wirespec-src-compiler-ir.mjs.map +1 -1
  35. package/wirespec-src-compiler-lib.mjs +279 -279
  36. package/wirespec-src-converter-avro.mjs +559 -559
  37. package/wirespec-src-converter-avro.mjs.map +1 -1
  38. package/wirespec-src-converter-openapi.mjs +802 -404
  39. package/wirespec-src-converter-openapi.mjs.map +1 -1
  40. package/wirespec-src-plugin-arguments.mjs +144 -144
  41. package/wirespec-src-plugin-cli.mjs +87 -87
  42. package/wirespec-src-plugin-npm.mjs +44 -25
  43. package/wirespec-src-plugin-npm.mjs.map +1 -1
  44. package/wirespec-src-tools-generator.mjs +13 -13
@@ -1,21 +1,11 @@
1
1
  import {
2
- ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
3
- Unit_instance28fytmsmm6r23 as Unit_instance,
4
- Paire9pteg33gng7 as Pair,
5
- plus20p0vtfmu0596 as plus,
6
- plus310ted5e4i90h as plus_0,
7
- VOID3gxj6tk5isa35 as VOID,
8
- setOf45ia9pnfhe90 as setOf,
9
- listOfvhqybd2zx248 as listOf,
10
- collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
11
- ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
12
- listOf1jh22dvmctj1r as listOf_0,
13
- addAll1k27qatfgp3k5 as addAll,
14
- emptyList1g2z5xcrvp2zy as emptyList,
15
2
  KProperty1ca4yb4wlo496 as KProperty1,
16
3
  getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
17
4
  split2bvyvnrlcifjv as split,
5
+ collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
6
+ ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$,
18
7
  checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
8
+ Unit_instance28fytmsmm6r23 as Unit_instance,
19
9
  joinToString1cxrrlmo0chqs as joinToString,
20
10
  StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
21
11
  charSequenceLength3278n89t01tmv as charSequenceLength,
@@ -25,247 +15,120 @@ import {
25
15
  firstOrNulltrxqttxfxqju as firstOrNull,
26
16
  isDigit3mimrri4wkzop as isDigit,
27
17
  Char19o2r8palgjof as Char,
28
- HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
29
- THROW_CCE2g6jy02ryeudk as THROW_CCE,
30
- isInterface3d6p8outrmvmk as isInterface,
31
- singleo93pzdgfc557 as single,
32
- trimMarginhyd3fsmh8iev as trimMargin,
18
+ setOf45ia9pnfhe90 as setOf,
33
19
  protoOf180f3jzyo7rfj as protoOf,
34
20
  initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
21
+ listOfvhqybd2zx248 as listOf,
35
22
  to2cs3ny02qtbcb as to,
36
23
  toMap1vec9topfei08 as toMap,
37
- initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
38
- endsWith3cq61xxngobwh as endsWith,
39
- noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
24
+ emptyList1g2z5xcrvp2zy as emptyList,
25
+ VOID3gxj6tk5isa35 as VOID,
26
+ ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$_0,
27
+ Paire9pteg33gng7 as Pair,
28
+ plus310ted5e4i90h as plus,
29
+ listOf1jh22dvmctj1r as listOf_0,
30
+ addAll1k27qatfgp3k5 as addAll,
40
31
  lazy2hsh8ze7j6ikd as lazy,
32
+ plus20p0vtfmu0596 as plus_0,
33
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
34
+ isInterface3d6p8outrmvmk as isInterface,
41
35
  firstOrNull1982767dljvdy as firstOrNull_0,
42
36
  ensureNotNull1e947j3ixpazm as ensureNotNull,
37
+ HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
38
+ initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
39
+ trimMarginhyd3fsmh8iev as trimMargin,
40
+ singleo93pzdgfc557 as single,
41
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
42
+ equals2au1ep9vhcato as equals,
43
+ endsWith3cq61xxngobwh as endsWith,
43
44
  } from './kotlin-kotlin-stdlib.mjs';
44
45
  import {
46
+ Companion_instancebcq57hoyp8c2 as Companion_instance,
47
+ FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
48
+ addBackticks1di5q03fw4yhx as addBackticks,
49
+ Companion_instance1a2xqc448tlhh as Companion_instance_0,
50
+ Companion_instance2ryk3262e300f as Companion_instance_1,
51
+ FileExtension_Scala_getInstancedd4dbv51x4if as FileExtension_Scala_getInstance,
52
+ plus14o24vdaiongg as plus_1,
53
+ importReferencesy4xv7r53sjjs as importReferences,
54
+ Unit2z95clvxm08vr as Unit,
55
+ Anyv7qdq63z63rc as Any,
56
+ Dict3g7w5wia7rncj as Dict,
57
+ Iterable29qbzfup67wqp as Iterable,
58
+ Custom1lu6o8txpimqz as Custom,
59
+ Bytes_instance1o9u095wd3kx6 as Bytes_instance,
60
+ Boolean_instance237vwt01w3hs8 as Boolean_instance,
61
+ Precision_P32_getInstance14q7j3bd2fxd5 as Precision_P32_getInstance,
62
+ Number1mui0heypwdhp as Number_0,
63
+ Integer39lqx4uc63u28 as Integer,
64
+ String1czvr8pxnm6on as String_0,
65
+ Primitive1i8my14jkp3nk as Primitive,
66
+ Paramvfwnys2w6aj1 as Param,
67
+ Literal331hu9r04vptz as Literal,
68
+ } from './wirespec-src-compiler-core.mjs';
69
+ import {
70
+ Nameoqr8dt2fim9d as Name,
71
+ FunctionCall30872kpnbr7op as FunctionCall,
72
+ transformChildren2mszeagj5nq4c as transformChildren,
73
+ sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
74
+ ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
75
+ SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
76
+ Custom2si7lto3wompr as Custom_0,
77
+ String_instance3uxvo48ki208u as String_instance,
78
+ Reflect_instance3i17lxiopj78t as Reflect_instance,
45
79
  Package2tniq694j1763 as Package,
46
- import5uhkz67bd8tt as import_0,
47
80
  File3dimy4iqmuock as File,
48
- transformChildrend9p91tpcqdkx as transformChildren,
81
+ transformChildrend9p91tpcqdkx as transformChildren_0,
82
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
49
83
  Interface3pn84xq686t2r as Interface,
50
84
  Namespace345pal554qu3j as Namespace,
51
- Custom2si7lto3wompr as Custom,
52
- Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
53
85
  withElements2toq84v08e72 as withElements,
86
+ ScalaGenerator_getInstance3tda4hcloy1pr as ScalaGenerator_getInstance,
87
+ import5uhkz67bd8tt as import_0,
88
+ interface24qlavvm81r6z as interface_0,
89
+ structo1silz79n3nu as struct,
90
+ convertClientServer1w4pgeabrnbb9 as convertClientServer,
91
+ Array2goj74t0aak7b as Array_0,
92
+ Field354s1ceh5pvhf as Field,
93
+ convertnty9x0e63d0u as convert,
54
94
  TransformScopeyrd3lf4zrk76 as TransformScope,
55
95
  TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
56
96
  transform3eti8i2bqvifx as transform,
57
97
  Elementitq62jg6fid3 as Element,
58
- Struct39wf79cwtn4ty as Struct,
59
- rawttvqxl50flj9 as raw,
60
- Nameoqr8dt2fim9d as Name,
61
- transformChildren2mszeagj5nq4c as transformChildren_0,
62
- sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
63
- ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
64
- FunctionCall30872kpnbr7op as FunctionCall,
65
- SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
66
- convertClientServer3s89ijty7q130 as convertClientServer,
67
- convert13xvfhgrf57n5 as convert,
68
- generateScala1gu01ibz2u66l as generateScala,
69
- RawElement2yts1x2rbem1g as RawElement,
70
- Constructor3io4sluuia3gk as Constructor,
71
- withLabelField33ehya4zusm70 as withLabelField,
72
- Enumlszg09mwd24f as Enum,
73
- transformChildren3n5cjwmxlhwx9 as transformChildren_1,
74
- FieldCall1iz7z2fx2xo4p as FieldCall,
75
- TypeParameter1x56bawg1pg87 as TypeParameter,
76
- Function21cuq8qizkin7 as Function,
77
- ScalaGenerator_instance3rrk4wjh7ybct as ScalaGenerator_instance,
78
- emit3bzdcd0f6nwtj as emit,
79
- withSharedSource1qgrajaccojj3 as withSharedSource,
80
- emitn3eihixilqyh as emit_0,
98
+ emitn3eihixilqyh as emit,
81
99
  prependImports32gcj3yb8voha as prependImports,
82
100
  placeInPackage1ffljbk9me4ug as placeInPackage,
83
101
  convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
84
102
  sanitizeNames2wqmyf8vafp9x as sanitizeNames,
103
+ ensureEmptyStructHasConstructorfl467argh9dd as ensureEmptyStructHasConstructor,
85
104
  convert11ert2po54h1y as convert_0,
105
+ injectEnumLabelFieldyfohidz6c88i as injectEnumLabelField,
86
106
  convert37aabdzvtv9vg as convert_1,
87
107
  convert17zcptkz4mhr4 as convert_2,
108
+ Struct39wf79cwtn4ty as Struct,
109
+ markMembersAsOverride3r1zpft8nbmxg as markMembersAsOverride,
88
110
  convert32tuiui3czihh as convert_3,
89
- flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
111
+ flattenNestedStructs2956rxx8q2zxl as flattenNestedStructs,
90
112
  convert1cn4bolzoed8c as convert_4,
91
113
  emitEndpointClient1meajc90wf3el as emitEndpointClient,
92
114
  emitClient32kfwzg2hm5vj as emitClient,
93
- emit1oxjujel6f3jb as emit_1,
115
+ emit1oxjujel6f3jb as emit_0,
116
+ emit3bzdcd0f6nwtj as emit_1,
94
117
  IrEmitterh2m93ojzvkep as IrEmitter,
118
+ rawttvqxl50flj9 as raw,
119
+ transformChildren3n5cjwmxlhwx9 as transformChildren_1,
120
+ FieldCall1iz7z2fx2xo4p as FieldCall,
121
+ TypeParameter1x56bawg1pg87 as TypeParameter,
122
+ Function21cuq8qizkin7 as Function,
95
123
  } from './wirespec-src-compiler-ir.mjs';
96
- import {
97
- Companion_instancebcq57hoyp8c2 as Companion_instance,
98
- FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
99
- addBackticks1di5q03fw4yhx as addBackticks,
100
- importReferencesy4xv7r53sjjs as importReferences,
101
- Shared1uygqfbd22ukz as Shared,
102
- Companion_instance1a2xqc448tlhh as Companion_instance_0,
103
- Paramvfwnys2w6aj1 as Param,
104
- Literal331hu9r04vptz as Literal,
105
- Companion_instance2ryk3262e300f as Companion_instance_1,
106
- FileExtension_Scala_getInstancedd4dbv51x4if as FileExtension_Scala_getInstance,
107
- plus14o24vdaiongg as plus_1,
108
- } from './wirespec-src-compiler-core.mjs';
109
124
  //region block: imports
110
125
  //endregion
111
126
  //region block: pre-declaration
112
127
  initMetadataForCompanion(Companion);
113
- initMetadataForClass(ScalaIrEmitter$shared$1);
114
128
  initMetadataForClass(ScalaIrEmitter, 'ScalaIrEmitter', ScalaIrEmitter, VOID, [IrEmitter]);
115
129
  //endregion
116
- function ScalaIrEmitter$shared$o$source$lambda(element, transformer) {
117
- var tmp;
118
- if (element instanceof File) {
119
- // Inline function 'kotlin.collections.partition' call
120
- var this_0 = element.u1m_1;
121
- var first = ArrayList_init_$Create$();
122
- var second = ArrayList_init_$Create$();
123
- var _iterator__ex2g4s = this_0.t();
124
- while (_iterator__ex2g4s.u()) {
125
- var element_0 = _iterator__ex2g4s.v();
126
- if (element_0 instanceof Package) {
127
- first.x(element_0);
128
- } else {
129
- second.x(element_0);
130
- }
131
- }
132
- var _destruct__k2r9zo = new Pair(first, second);
133
- var packageElements = _destruct__k2r9zo.ne();
134
- var rest = _destruct__k2r9zo.oe();
135
- tmp = element.x1m(VOID, plus_0(plus(packageElements, import_0('scala.reflect', 'ClassTag')), rest));
136
- } else {
137
- tmp = element;
138
- }
139
- var transformed = tmp;
140
- return transformChildren(transformed, transformer);
141
- }
142
- function ScalaIrEmitter$shared$o$source$lambda_0(element, transformer) {
143
- var tmp;
144
- if (element instanceof Namespace) {
145
- var tmp_0;
146
- if (element.z1m_1.equals(Companion_getInstance().m1h('Wirespec'))) {
147
- // Inline function 'kotlin.collections.flatMap' call
148
- var tmp0 = element.a1n_1;
149
- // Inline function 'kotlin.collections.flatMapTo' call
150
- var destination = ArrayList_init_$Create$();
151
- var _iterator__ex2g4s = tmp0.t();
152
- while (_iterator__ex2g4s.u()) {
153
- var element_0 = _iterator__ex2g4s.v();
154
- var tmp_1;
155
- var tmp_2;
156
- if (element_0 instanceof Interface) {
157
- tmp_2 = setOf(['Request', 'Response']).u1(element_0.m1o_1.x1l());
158
- } else {
159
- tmp_2 = false;
160
- }
161
- if (tmp_2) {
162
- // Inline function 'kotlin.collections.filterIsInstance' call
163
- var tmp0_0 = element_0.n1o_1;
164
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
165
- var destination_0 = ArrayList_init_$Create$();
166
- var _iterator__ex2g4s_0 = tmp0_0.t();
167
- while (_iterator__ex2g4s_0.u()) {
168
- var element_1 = _iterator__ex2g4s_0.v();
169
- if (element_1 instanceof Interface) {
170
- destination_0.x(element_1);
171
- }
172
- }
173
- var tmp$ret$3;
174
- $l$block: {
175
- // Inline function 'kotlin.collections.firstOrNull' call
176
- var _iterator__ex2g4s_1 = destination_0.t();
177
- while (_iterator__ex2g4s_1.u()) {
178
- var element_2 = _iterator__ex2g4s_1.v();
179
- if (element_2.m1o_1.x1l() === 'Headers') {
180
- tmp$ret$3 = element_2;
181
- break $l$block;
182
- }
183
- }
184
- tmp$ret$3 = null;
185
- }
186
- var nestedHeaders = tmp$ret$3;
187
- var tmp_3;
188
- if (!(nestedHeaders == null)) {
189
- var tmp_4 = new Namespace(element_0.m1o_1, listOf(nestedHeaders));
190
- // Inline function 'kotlin.collections.filter' call
191
- var tmp0_1 = element_0.n1o_1;
192
- // Inline function 'kotlin.collections.filterTo' call
193
- var destination_1 = ArrayList_init_$Create$();
194
- var _iterator__ex2g4s_2 = tmp0_1.t();
195
- while (_iterator__ex2g4s_2.u()) {
196
- var element_3 = _iterator__ex2g4s_2.v();
197
- var tmp_5;
198
- if (element_3 instanceof Interface) {
199
- tmp_5 = element_3.m1o_1.x1l() === 'Headers';
200
- } else {
201
- tmp_5 = false;
202
- }
203
- if (!tmp_5) {
204
- destination_1.x(element_3);
205
- }
206
- }
207
- var tmp_6 = destination_1;
208
- // Inline function 'kotlin.collections.map' call
209
- var this_0 = element_0.r1o_1;
210
- // Inline function 'kotlin.collections.mapTo' call
211
- var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
212
- var _iterator__ex2g4s_3 = this_0.t();
213
- while (_iterator__ex2g4s_3.u()) {
214
- var item = _iterator__ex2g4s_3.v();
215
- var tmp_7;
216
- if (item.m1n_1.s1h() === 'headers') {
217
- tmp_7 = item.q1n(VOID, new Custom(element_0.m1o_1.x1l() + '.Headers'));
218
- } else {
219
- tmp_7 = item;
220
- }
221
- var tmp$ret$7 = tmp_7;
222
- destination_2.x(tmp$ret$7);
223
- }
224
- tmp_3 = listOf_0([tmp_4, element_0.t1o(VOID, tmp_6, VOID, VOID, VOID, destination_2)]);
225
- } else {
226
- tmp_3 = listOf(element_0);
227
- }
228
- tmp_1 = tmp_3;
229
- } else {
230
- tmp_1 = listOf(element_0);
231
- }
232
- var list = tmp_1;
233
- addAll(destination, list);
234
- }
235
- var newElements = destination;
236
- tmp_0 = element.d1n(VOID, newElements);
237
- } else {
238
- tmp_0 = element;
239
- }
240
- tmp = tmp_0;
241
- } else {
242
- tmp = element;
243
- }
244
- var transformed = tmp;
245
- return transformChildren(transformed, transformer);
246
- }
247
- function ScalaIrEmitter$shared$o$source$lambda_1(this$0) {
248
- return function (element, transformer) {
249
- var tmp;
250
- if (element instanceof Namespace) {
251
- var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? this$0.c20_1 : emptyList();
252
- var tmp_0;
253
- // Inline function 'kotlin.collections.isNotEmpty' call
254
- if (!injected.r()) {
255
- tmp_0 = withElements(element, plus_0(element.v1m(), injected));
256
- } else {
257
- tmp_0 = element;
258
- }
259
- tmp = tmp_0;
260
- } else {
261
- tmp = element;
262
- }
263
- var transformed = tmp;
264
- return transformChildren(transformed, transformer);
265
- };
266
- }
267
130
  function _get_sanitizationConfig__sns434($this) {
268
- var tmp0 = $this.j20_1;
131
+ var tmp0 = $this.t1y_1;
269
132
  var tmp = KProperty1;
270
133
  // Inline function 'kotlin.getValue' call
271
134
  getPropertyCallableRef('sanitizationConfig', 1, tmp, ScalaIrEmitter$_get_sanitizationConfig_$ref_ydarb0(), null);
@@ -275,7 +138,7 @@ function sanitize($this, _this__u8e3s4) {
275
138
  // Inline function 'kotlin.collections.mapIndexed' call
276
139
  var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
277
140
  // Inline function 'kotlin.collections.mapIndexedTo' call
278
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
141
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
279
142
  var index = 0;
280
143
  var _iterator__ex2g4s = this_0.t();
281
144
  while (_iterator__ex2g4s.u()) {
@@ -330,13 +193,13 @@ function sanitizeFirstIsDigit($this, _this__u8e3s4) {
330
193
  return tmp;
331
194
  }
332
195
  function sanitizeKeywords($this, _this__u8e3s4) {
333
- return Companion_getInstance_0().l20_1.u1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
196
+ return Companion_getInstance_0().u1y_1.u1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
334
197
  }
335
198
  function sanitizeSymbol($this, _this__u8e3s4) {
336
199
  // Inline function 'kotlin.collections.mapIndexed' call
337
200
  var this_0 = split(_this__u8e3s4, ['.', ' ', '-']);
338
201
  // Inline function 'kotlin.collections.mapIndexedTo' call
339
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
202
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
340
203
  var index = 0;
341
204
  var _iterator__ex2g4s = this_0.t();
342
205
  while (_iterator__ex2g4s.u()) {
@@ -368,107 +231,9 @@ function sanitizeSymbol($this, _this__u8e3s4) {
368
231
  function sanitizeEnum($this, _this__u8e3s4) {
369
232
  return sanitizeKeywords($this, sanitizeFirstIsDigit($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
370
233
  }
371
- function buildImports($this, _this__u8e3s4) {
372
- // Inline function 'kotlin.collections.distinctBy' call
373
- var this_0 = importReferences(_this__u8e3s4);
374
- var set = HashSet_init_$Create$();
375
- var list = ArrayList_init_$Create$();
376
- var _iterator__ex2g4s = this_0.t();
377
- while (_iterator__ex2g4s.u()) {
378
- var e = _iterator__ex2g4s.v();
379
- var key = e.lu_1;
380
- if (set.x(key)) {
381
- list.x(e);
382
- }
383
- }
384
- // Inline function 'kotlin.collections.map' call
385
- // Inline function 'kotlin.collections.mapTo' call
386
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
387
- var _iterator__ex2g4s_0 = list.t();
388
- while (_iterator__ex2g4s_0.u()) {
389
- var item = _iterator__ex2g4s_0.v();
390
- var tmp$ret$2 = import_0($this.k1v().mr_1 + '.model', item.lu_1);
391
- destination.x(tmp$ret$2);
392
- }
393
- return destination;
394
- }
395
- function addIdentityTypeToCall($this, _this__u8e3s4) {
396
- // Inline function 'community.flock.wirespec.ir.core.transform' call
397
- var scope = new TransformScope(_this__u8e3s4);
398
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
399
- var tmp = scope;
400
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
401
- var this_0 = scope.z1t_1;
402
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
403
- // Inline function 'kotlin.apply' call
404
- var this_1 = new TransformerBuilder();
405
- this_1.d1h(ScalaIrEmitter$addIdentityTypeToCall$lambda);
406
- var tmp$ret$2 = this_1.e1h();
407
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
408
- var tmp_0 = scope.z1t_1;
409
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
410
- }
411
- function isRequestObject($this, namespace) {
412
- // Inline function 'kotlin.collections.filterIsInstance' call
413
- var tmp0 = namespace.a1n_1;
414
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
415
- var destination = ArrayList_init_$Create$();
416
- var _iterator__ex2g4s = tmp0.t();
417
- while (_iterator__ex2g4s.u()) {
418
- var element = _iterator__ex2g4s.v();
419
- if (element instanceof Struct) {
420
- destination.x(element);
421
- }
422
- }
423
- var tmp$ret$3;
424
- $l$block: {
425
- // Inline function 'kotlin.collections.firstOrNull' call
426
- var _iterator__ex2g4s_0 = destination.t();
427
- while (_iterator__ex2g4s_0.u()) {
428
- var element_0 = _iterator__ex2g4s_0.v();
429
- if (element_0.f1n_1.x1l() === 'Request') {
430
- tmp$ret$3 = element_0;
431
- break $l$block;
432
- }
433
- }
434
- tmp$ret$3 = null;
435
- }
436
- var tmp0_elvis_lhs = tmp$ret$3;
437
- var tmp;
438
- if (tmp0_elvis_lhs == null) {
439
- return false;
440
- } else {
441
- tmp = tmp0_elvis_lhs;
442
- }
443
- var requestStruct = tmp;
444
- return requestStruct.h1n_1.a1() === 1 && single(requestStruct.h1n_1).r1n_1.r() || (requestStruct.g1n_1.r() && requestStruct.h1n_1.r());
445
- }
446
- function injectHandleFunction($this, _this__u8e3s4) {
447
- // Inline function 'community.flock.wirespec.ir.core.transform' call
448
- var scope = new TransformScope(_this__u8e3s4);
449
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
450
- var tmp = scope;
451
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
452
- var this_0 = scope.z1t_1;
453
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
454
- // Inline function 'kotlin.apply' call
455
- var this_1 = new TransformerBuilder();
456
- this_1.d1h(ScalaIrEmitter$injectHandleFunction$lambda);
457
- var tmp$ret$2 = this_1.e1h();
458
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
459
- var tmp_0 = scope.z1t_1;
460
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
461
- }
462
- function buildClientServerObjects($this, endpoint, requestIsObject, namespace) {
463
- var reqType = requestIsObject ? 'Request.type' : 'Request';
464
- var pathTemplate = '/' + joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, ScalaIrEmitter$buildClientServerObjects$lambda);
465
- var clientObject = raw(trimMargin('\n |object Client extends Wirespec.Client[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override def client(serialization: Wirespec.Serialization): Wirespec.ClientEdge[' + reqType + ', Response[?]] = new Wirespec.ClientEdge[' + reqType + ', Response[?]] {\n | override def to(request: ' + reqType + '): Wirespec.RawRequest = toRawRequest(serialization, request)\n | override def from(response: Wirespec.RawResponse): Response[?] = fromRawResponse(serialization, response)\n | }\n |}\n '));
466
- var serverObject = raw(trimMargin('\n |object Server extends Wirespec.Server[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override def server(serialization: Wirespec.Serialization): Wirespec.ServerEdge[' + reqType + ', Response[?]] = new Wirespec.ServerEdge[' + reqType + ', Response[?]] {\n | override def from(request: Wirespec.RawRequest): ' + reqType + ' = fromRawRequest(serialization, request)\n | override def to(response: Response[?]): Wirespec.RawResponse = toRawResponse(serialization, response)\n | }\n |}\n '));
467
- return namespace.d1n(VOID, plus(plus(namespace.a1n_1, clientObject), serverObject));
468
- }
469
234
  function Companion() {
470
235
  Companion_instance_2 = this;
471
- this.l20_1 = setOf(['abstract', 'case', 'class', 'def', 'do', 'else', 'extends', 'false', 'final', 'for', 'forSome', 'if', 'implicit', 'import', 'lazy', 'match', 'new', 'null', 'object', 'override', 'package', 'private', 'protected', 'return', 'sealed', 'super', 'this', 'throw', 'trait', 'true', 'try', 'type', 'val', 'var', 'while', 'with', 'yield', 'given', 'using', 'enum', 'export', 'then']);
236
+ this.u1y_1 = setOf(['abstract', 'case', 'class', 'def', 'do', 'else', 'extends', 'false', 'final', 'for', 'forSome', 'if', 'implicit', 'import', 'lazy', 'match', 'new', 'null', 'object', 'override', 'package', 'private', 'protected', 'return', 'sealed', 'super', 'this', 'throw', 'trait', 'true', 'try', 'type', 'val', 'var', 'while', 'with', 'yield', 'given', 'using', 'enum', 'export', 'then']);
472
237
  }
473
238
  var Companion_instance_2;
474
239
  function Companion_getInstance_0() {
@@ -481,13 +246,13 @@ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
481
246
  }
482
247
  function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0) {
483
248
  return function (name) {
484
- var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : sanitizeSymbol(this$0, name.s1h());
249
+ var sanitized = name.m1h_1.a1() > 1 ? name.q1l() : sanitizeSymbol(this$0, name.r1h());
485
250
  return new Name(listOf(sanitized));
486
251
  };
487
252
  }
488
253
  function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0) {
489
254
  return function (name) {
490
- return new Name(listOf(sanitizeSymbol(this$0, name.r1l())));
255
+ return new Name(listOf(sanitizeSymbol(this$0, name.q1l())));
491
256
  };
492
257
  }
493
258
  function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(this$0) {
@@ -498,21 +263,21 @@ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(this$0) {
498
263
  function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
499
264
  return function (stmt, tr) {
500
265
  var tmp;
266
+ var tmp_0;
501
267
  if (stmt instanceof FunctionCall) {
502
- var tmp_0;
503
- if (stmt.b1m_1.s1h() === 'validate') {
504
- tmp_0 = transformChildren_0(stmt.f1m(VOID, emptyList()), tr);
505
- } else {
506
- tmp_0 = transformChildren_0(stmt, tr);
507
- }
508
- tmp = tmp_0;
268
+ tmp_0 = stmt.a1m_1.r1h() === 'validate';
269
+ } else {
270
+ tmp_0 = false;
271
+ }
272
+ if (tmp_0) {
273
+ tmp = transformChildren(stmt.e1m(VOID, emptyList()), tr);
509
274
  } else {
510
275
  if (stmt instanceof ConstructorStatement) {
511
- var tmp_1 = tr.r1t(stmt.p1m_1);
276
+ var tmp_1 = tr.o1t(stmt.o1m_1);
512
277
  // Inline function 'kotlin.collections.map' call
513
- var this_0 = stmt.q1m_1;
278
+ var this_0 = stmt.p1m_1;
514
279
  // Inline function 'kotlin.collections.mapTo' call
515
- var destination = ArrayList_init_$Create$_0(this_0.a1());
280
+ var destination = ArrayList_init_$Create$(this_0.a1());
516
281
  // Inline function 'kotlin.collections.iterator' call
517
282
  var _iterator__ex2g4s = this_0.j1().t();
518
283
  while (_iterator__ex2g4s.u()) {
@@ -521,12 +286,12 @@ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
521
286
  var name = item.k1();
522
287
  // Inline function 'kotlin.collections.component2' call
523
288
  var expr = item.l1();
524
- var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), name), tr.u1t(expr));
289
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), name), tr.r1t(expr));
525
290
  destination.x(tmp$ret$3);
526
291
  }
527
292
  tmp = new ConstructorStatement(tmp_1, toMap(destination));
528
293
  } else {
529
- tmp = transformChildren_0(stmt, tr);
294
+ tmp = transformChildren(stmt, tr);
530
295
  }
531
296
  }
532
297
  return tmp;
@@ -534,7 +299,7 @@ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
534
299
  }
535
300
  function ScalaIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
536
301
  return function () {
537
- var tmp = Companion_getInstance_0().l20_1;
302
+ var tmp = Companion_getInstance_0().u1y_1;
538
303
  var tmp_0 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda;
539
304
  var tmp_1 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0);
540
305
  var tmp_2 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0);
@@ -547,233 +312,276 @@ function ScalaIrEmitter$_get_sanitizationConfig_$ref_ydarb0() {
547
312
  return _get_sanitizationConfig__sns434(p0);
548
313
  };
549
314
  }
550
- function ScalaIrEmitter$shared$1() {
551
- this.b20_1 = 'community.flock.wirespec.scala';
552
- this.c20_1 = convertClientServer(new Shared(this.b20_1));
553
- var tmp = this;
554
- // Inline function 'community.flock.wirespec.ir.core.transform' call
555
- var this_0 = convert(new Shared(this.b20_1));
556
- var scope = new TransformScope(this_0);
557
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
558
- var tmp_0 = scope;
559
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
560
- var this_1 = scope.z1t_1;
561
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
562
- // Inline function 'kotlin.apply' call
563
- var this_2 = new TransformerBuilder();
564
- this_2.d1h(ScalaIrEmitter$shared$o$source$lambda);
565
- var tmp$ret$2 = this_2.e1h();
566
- tmp_0.z1t_1 = transform(this_1, tmp$ret$2);
567
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
568
- var tmp_1 = scope;
569
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
570
- var this_3 = scope.z1t_1;
571
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
572
- // Inline function 'kotlin.apply' call
573
- var this_4 = new TransformerBuilder();
574
- this_4.d1h(ScalaIrEmitter$shared$o$source$lambda_0);
575
- var tmp$ret$7 = this_4.e1h();
576
- tmp_1.z1t_1 = transform(this_3, tmp$ret$7);
577
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
578
- var tmp_2 = scope;
579
- // Inline function 'community.flock.wirespec.ir.core.injectAfter' call
580
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
581
- var this_5 = scope.z1t_1;
582
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
583
- // Inline function 'kotlin.apply' call
584
- var this_6 = new TransformerBuilder();
585
- this_6.d1h(ScalaIrEmitter$shared$o$source$lambda_1(this));
586
- var tmp$ret$12 = this_6.e1h();
587
- tmp_2.z1t_1 = transform(this_5, tmp$ret$12);
588
- var tmp_3 = scope.z1t_1;
589
- var tmp$ret$17 = isInterface(tmp_3, Element) ? tmp_3 : THROW_CCE();
590
- tmp.d20_1 = generateScala(tmp$ret$17);
591
- }
592
- protoOf(ScalaIrEmitter$shared$1).r1w = function () {
593
- return this.d20_1;
594
- };
595
- function ScalaIrEmitter$emit$lambda(this$0) {
596
- return function () {
597
- return new File(Companion_getInstance().m1h(Companion_instance_0.lr('community.flock.wirespec.scala').or() + 'Wirespec'), listOf(new RawElement(this$0.t1v().r1w())));
598
- };
315
+ function ScalaIrEmitter$emitShared$lambda($this$struct) {
316
+ $this$struct.j1k(new Custom_0('PathSegment'));
317
+ $this$struct.j1j('value', String_instance);
318
+ return Unit_instance;
599
319
  }
600
- function ScalaIrEmitter$emit$lambda_0(element, transformer) {
601
- var tmp;
602
- if (element instanceof Struct) {
603
- tmp = element.g1n_1.r() ? element.l1n(VOID, VOID, listOf(new Constructor(emptyList(), emptyList()))) : element;
604
- } else {
605
- tmp = element;
606
- }
607
- var transformed = tmp;
608
- return transformChildren(transformed, transformer);
609
- }
610
- function ScalaIrEmitter$emit$lambda$lambda(this$0) {
611
- return function (it) {
612
- return sanitizeEnum(this$0, it);
613
- };
614
- }
615
- function ScalaIrEmitter$emit$lambda_1(this$0) {
616
- return function (element, transformer) {
617
- var tmp;
618
- if (element instanceof Enum) {
619
- tmp = withLabelField(element, ScalaIrEmitter$emit$lambda$lambda(this$0));
620
- } else {
621
- tmp = element;
622
- }
623
- var transformed = tmp;
624
- return transformChildren(transformed, transformer);
625
- };
626
- }
627
- function ScalaIrEmitter$emit$lambda_2(expr, tr) {
628
- var tmp;
629
- var tmp_0;
630
- var tmp_1;
631
- if (expr instanceof FunctionCall) {
632
- tmp_1 = expr.b1m_1.r1l() === 'toString';
633
- } else {
634
- tmp_1 = false;
635
- }
636
- if (tmp_1) {
637
- tmp_0 = !(expr.z1l_1 == null);
638
- } else {
639
- tmp_0 = false;
640
- }
641
- if (tmp_0) {
642
- var tmp0_safe_receiver = expr.z1l_1;
643
- var tmp_2;
644
- if (tmp0_safe_receiver == null) {
645
- tmp_2 = null;
646
- } else {
647
- // Inline function 'kotlin.let' call
648
- tmp_2 = tr.u1t(tmp0_safe_receiver);
649
- }
650
- tmp = new FieldCall(tmp_2, Companion_getInstance().m1h('toString'));
651
- } else {
652
- tmp = transformChildren_1(expr, tr);
653
- }
654
- return tmp;
320
+ function ScalaIrEmitter$emitShared$lambda_0($this$struct) {
321
+ $this$struct.j1k(new Custom_0('PathSegment'));
322
+ $this$struct.j1j('name', String_instance);
323
+ $this$struct.j1j('type', Reflect_instance);
324
+ return Unit_instance;
655
325
  }
656
- function ScalaIrEmitter$addIdentityTypeToCall$lambda(element, transformer) {
326
+ function ScalaIrEmitter$emitShared$lambda_1(element, transformer) {
657
327
  var tmp;
658
- if (element instanceof Struct) {
659
- // Inline function 'kotlin.collections.map' call
660
- var this_0 = element.i1n_1;
661
- // Inline function 'kotlin.collections.mapTo' call
662
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
328
+ if (element instanceof File) {
329
+ // Inline function 'kotlin.collections.partition' call
330
+ var this_0 = element.s1m_1;
331
+ var first = ArrayList_init_$Create$_0();
332
+ var second = ArrayList_init_$Create$_0();
663
333
  var _iterator__ex2g4s = this_0.t();
664
334
  while (_iterator__ex2g4s.u()) {
665
- var item = _iterator__ex2g4s.v();
666
- var tmp_0;
667
- var tmp_1;
668
- if (item instanceof Custom) {
669
- tmp_1 = endsWith(item.q1h_1, '.Call');
670
- } else {
671
- tmp_1 = false;
672
- }
673
- if (tmp_1) {
674
- tmp_0 = item.n1m(VOID, listOf(new Custom('[A] =>> A')));
335
+ var element_0 = _iterator__ex2g4s.v();
336
+ if (element_0 instanceof Package) {
337
+ first.x(element_0);
675
338
  } else {
676
- tmp_0 = item;
339
+ second.x(element_0);
677
340
  }
678
- var tmp$ret$0 = tmp_0;
679
- destination.x(tmp$ret$0);
680
341
  }
681
- tmp = element.l1n(VOID, VOID, VOID, destination);
342
+ var _destruct__k2r9zo = new Pair(first, second);
343
+ var packageElements = _destruct__k2r9zo.ne();
344
+ var rest = _destruct__k2r9zo.oe();
345
+ tmp = element.v1m(VOID, plus(packageElements, rest));
682
346
  } else {
683
347
  tmp = element;
684
348
  }
685
349
  var transformed = tmp;
686
- return transformChildren(transformed, transformer);
350
+ return transformChildren_0(transformed, transformer);
687
351
  }
688
- function ScalaIrEmitter$injectHandleFunction$lambda(element, transformer) {
352
+ function ScalaIrEmitter$emitShared$lambda_2(element, transformer) {
689
353
  var tmp;
690
- if (element instanceof Interface) {
691
- var tmp_0;
692
- if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
693
- var tmp0_typeParameters = listOf(new TypeParameter(new Custom('F[_]')));
694
- // Inline function 'kotlin.collections.map' call
695
- var this_0 = element.n1o_1;
696
- // Inline function 'kotlin.collections.mapTo' call
697
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
698
- var _iterator__ex2g4s = this_0.t();
354
+ if (element instanceof Namespace) {
355
+ var tmp$ret$0;
356
+ $l$block: {
357
+ if (!element.x1m_1.equals(Companion_getInstance().l1h('Wirespec'))) {
358
+ tmp$ret$0 = element;
359
+ break $l$block;
360
+ }
361
+ // Inline function 'kotlin.collections.flatMap' call
362
+ var tmp0 = element.y1m_1;
363
+ // Inline function 'kotlin.collections.flatMapTo' call
364
+ var destination = ArrayList_init_$Create$_0();
365
+ var _iterator__ex2g4s = tmp0.t();
699
366
  while (_iterator__ex2g4s.u()) {
700
- var item = _iterator__ex2g4s.v();
701
- var tmp_1;
702
- if (item instanceof Function) {
703
- var tmp0_safe_receiver = item.w1j_1;
704
- var tmp_2;
705
- if (tmp0_safe_receiver == null) {
706
- tmp_2 = null;
367
+ var element_0 = _iterator__ex2g4s.v();
368
+ var tmp$ret$1;
369
+ $l$block_2: {
370
+ var tmp_0;
371
+ if (!(element_0 instanceof Interface)) {
372
+ tmp_0 = true;
707
373
  } else {
708
- // Inline function 'kotlin.let' call
709
- tmp_2 = new Custom('F', listOf(tmp0_safe_receiver));
374
+ tmp_0 = !setOf(['Request', 'Response']).u1(element_0.j1n_1.w1l());
710
375
  }
711
- var tmp2_returnType = tmp_2;
712
- tmp_1 = item.b1k(VOID, VOID, VOID, tmp2_returnType, VOID, false);
713
- } else {
714
- tmp_1 = item;
376
+ if (tmp_0) {
377
+ tmp$ret$1 = listOf(element_0);
378
+ break $l$block_2;
379
+ }
380
+ // Inline function 'kotlin.collections.filterIsInstance' call
381
+ var tmp0_0 = element_0.k1n_1;
382
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
383
+ var destination_0 = ArrayList_init_$Create$_0();
384
+ var _iterator__ex2g4s_0 = tmp0_0.t();
385
+ while (_iterator__ex2g4s_0.u()) {
386
+ var element_1 = _iterator__ex2g4s_0.v();
387
+ if (element_1 instanceof Interface) {
388
+ destination_0.x(element_1);
389
+ }
390
+ }
391
+ var tmp$ret$5;
392
+ $l$block_1: {
393
+ // Inline function 'kotlin.collections.firstOrNull' call
394
+ var _iterator__ex2g4s_1 = destination_0.t();
395
+ while (_iterator__ex2g4s_1.u()) {
396
+ var element_2 = _iterator__ex2g4s_1.v();
397
+ if (element_2.j1n_1.w1l() === 'Headers') {
398
+ tmp$ret$5 = element_2;
399
+ break $l$block_1;
400
+ }
401
+ }
402
+ tmp$ret$5 = null;
403
+ }
404
+ var tmp0_elvis_lhs = tmp$ret$5;
405
+ var tmp_1;
406
+ if (tmp0_elvis_lhs == null) {
407
+ tmp$ret$1 = listOf(element_0);
408
+ break $l$block_2;
409
+ } else {
410
+ tmp_1 = tmp0_elvis_lhs;
411
+ }
412
+ var nestedHeaders = tmp_1;
413
+ var tmp_2 = new Namespace(element_0.j1n_1, listOf(nestedHeaders));
414
+ // Inline function 'kotlin.collections.filter' call
415
+ var tmp0_1 = element_0.k1n_1;
416
+ // Inline function 'kotlin.collections.filterTo' call
417
+ var destination_1 = ArrayList_init_$Create$_0();
418
+ var _iterator__ex2g4s_2 = tmp0_1.t();
419
+ while (_iterator__ex2g4s_2.u()) {
420
+ var element_3 = _iterator__ex2g4s_2.v();
421
+ var tmp_3;
422
+ if (element_3 instanceof Interface) {
423
+ tmp_3 = element_3.j1n_1.w1l() === 'Headers';
424
+ } else {
425
+ tmp_3 = false;
426
+ }
427
+ if (!tmp_3) {
428
+ destination_1.x(element_3);
429
+ }
430
+ }
431
+ var tmp_4 = destination_1;
432
+ // Inline function 'kotlin.collections.map' call
433
+ var this_0 = element_0.o1n_1;
434
+ // Inline function 'kotlin.collections.mapTo' call
435
+ var destination_2 = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
436
+ var _iterator__ex2g4s_3 = this_0.t();
437
+ while (_iterator__ex2g4s_3.u()) {
438
+ var item = _iterator__ex2g4s_3.v();
439
+ var tmp_5;
440
+ if (item.y1p_1.r1h() === 'headers') {
441
+ tmp_5 = item.c1q(VOID, new Custom_0(element_0.j1n_1.w1l() + '.Headers'));
442
+ } else {
443
+ tmp_5 = item;
444
+ }
445
+ var tmp$ret$9 = tmp_5;
446
+ destination_2.x(tmp$ret$9);
447
+ }
448
+ tmp$ret$1 = listOf_0([tmp_2, element_0.q1n(VOID, tmp_4, VOID, VOID, VOID, destination_2)]);
715
449
  }
716
- var tmp$ret$2 = tmp_1;
717
- destination.x(tmp$ret$2);
450
+ var list = tmp$ret$1;
451
+ addAll(destination, list);
718
452
  }
719
- tmp_0 = element.t1o(VOID, destination, VOID, VOID, tmp0_typeParameters);
720
- } else {
721
- tmp_0 = element;
453
+ var newElements = destination;
454
+ tmp$ret$0 = element.b1n(VOID, newElements);
722
455
  }
723
- tmp = tmp_0;
456
+ tmp = tmp$ret$0;
724
457
  } else {
725
458
  tmp = element;
726
459
  }
727
460
  var transformed = tmp;
728
- return transformChildren(transformed, transformer);
461
+ return transformChildren_0(transformed, transformer);
729
462
  }
730
- function ScalaIrEmitter$buildClientServerObjects$lambda(it) {
731
- var tmp;
732
- if (it instanceof Literal) {
733
- tmp = it.hq_1;
734
- } else {
735
- if (it instanceof Param) {
736
- tmp = '{' + it.lp_1.l1() + '}';
463
+ function ScalaIrEmitter$emitShared$lambda_3($clientServer) {
464
+ return function (element, transformer) {
465
+ var tmp;
466
+ if (element instanceof Namespace) {
467
+ var injected = element.x1m_1.equals(Companion_getInstance().l1h('Wirespec')) ? $clientServer : emptyList();
468
+ var tmp_0;
469
+ // Inline function 'kotlin.collections.isNotEmpty' call
470
+ if (!injected.r()) {
471
+ tmp_0 = withElements(element, plus(element.t1m(), injected));
472
+ } else {
473
+ tmp_0 = element;
474
+ }
475
+ tmp = tmp_0;
737
476
  } else {
738
- noWhenBranchMatchedException();
477
+ tmp = element;
739
478
  }
740
- }
741
- return tmp;
479
+ var transformed = tmp;
480
+ return transformChildren_0(transformed, transformer);
481
+ };
482
+ }
483
+ function ScalaIrEmitter$emit$lambda(this$0) {
484
+ return function (it) {
485
+ return sanitizeEnum(this$0, it);
486
+ };
742
487
  }
743
488
  function ScalaIrEmitter(packageName, emitShared) {
744
489
  Companion_getInstance_0();
745
490
  packageName = packageName === VOID ? Companion_instance_0.lr('community.flock.wirespec.generated') : packageName;
746
491
  emitShared = emitShared === VOID ? Companion_instance_1.go() : emitShared;
747
- this.e20_1 = packageName;
748
- this.f20_1 = emitShared;
749
- this.g20_1 = ScalaGenerator_instance;
750
- this.h20_1 = FileExtension_Scala_getInstance();
751
- this.i20_1 = listOf_0([import_0('community.flock.wirespec.scala', 'Wirespec'), import_0('scala.reflect', 'ClassTag')]);
492
+ this.o1y_1 = packageName;
493
+ this.p1y_1 = emitShared;
494
+ this.q1y_1 = ScalaGenerator_getInstance();
495
+ this.r1y_1 = FileExtension_Scala_getInstance();
496
+ this.s1y_1 = listOf_0([import_0('community.flock.wirespec.scala', 'Wirespec'), import_0('scala.reflect', 'ClassTag')]);
752
497
  var tmp = this;
753
- tmp.j20_1 = lazy(ScalaIrEmitter$sanitizationConfig$delegate$lambda(this));
754
- var tmp_0 = this;
755
- tmp_0.k20_1 = new ScalaIrEmitter$shared$1();
498
+ tmp.t1y_1 = lazy(ScalaIrEmitter$sanitizationConfig$delegate$lambda(this));
756
499
  }
757
- protoOf(ScalaIrEmitter).k1v = function () {
758
- return this.e20_1;
500
+ protoOf(ScalaIrEmitter).c1v = function () {
501
+ return this.o1y_1;
759
502
  };
760
- protoOf(ScalaIrEmitter).m1u = function () {
761
- return this.g20_1;
503
+ protoOf(ScalaIrEmitter).j1u = function () {
504
+ return this.q1y_1;
762
505
  };
763
506
  protoOf(ScalaIrEmitter).eq = function () {
764
- return this.h20_1;
765
- };
766
- protoOf(ScalaIrEmitter).t1v = function () {
767
- return this.k20_1;
507
+ return this.r1y_1;
768
508
  };
769
- protoOf(ScalaIrEmitter).n1u = function (module_0, logger) {
770
- var tmp = emit.call(this, module_0, logger);
771
- return withSharedSource(tmp, this.f20_1, ScalaIrEmitter$emit$lambda(this));
509
+ protoOf(ScalaIrEmitter).m1u = function () {
510
+ var packageName = Companion_instance_0.lr('community.flock.wirespec.scala');
511
+ var tmp = interface_0('PathSegment', true);
512
+ var tmp_0 = struct('Literal', ScalaIrEmitter$emitShared$lambda);
513
+ var pathSegmentTypes = listOf_0([tmp, tmp_0, struct('Param', ScalaIrEmitter$emitShared$lambda_0)]);
514
+ // Inline function 'kotlin.collections.map' call
515
+ var this_0 = convertClientServer(packageName);
516
+ // Inline function 'kotlin.collections.mapTo' call
517
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
518
+ var _iterator__ex2g4s = this_0.t();
519
+ while (_iterator__ex2g4s.u()) {
520
+ var item = _iterator__ex2g4s.v();
521
+ var tmp_1;
522
+ var tmp_2;
523
+ if (item instanceof Interface) {
524
+ tmp_2 = setOf(['Client', 'Server']).u1(item.j1n_1.w1l());
525
+ } else {
526
+ tmp_2 = false;
527
+ }
528
+ if (tmp_2) {
529
+ tmp_1 = item.q1n(VOID, VOID, VOID, VOID, VOID, plus_0(item.o1n_1, new Field(Companion_getInstance().l1h('pathSegments'), new Array_0(new Custom_0('PathSegment')))));
530
+ } else {
531
+ tmp_1 = item;
532
+ }
533
+ var tmp$ret$0 = tmp_1;
534
+ destination.x(tmp$ret$0);
535
+ }
536
+ var clientServer = plus(pathSegmentTypes, destination);
537
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
538
+ var this_1 = convert(packageName);
539
+ var scope = new TransformScope(this_1);
540
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
541
+ var tmp_3 = scope;
542
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
543
+ var this_2 = scope.w1t_1;
544
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
545
+ // Inline function 'kotlin.apply' call
546
+ var this_3 = new TransformerBuilder();
547
+ this_3.c1h(ScalaIrEmitter$emitShared$lambda_1);
548
+ var tmp$ret$5 = this_3.d1h();
549
+ tmp_3.w1t_1 = transform(this_2, tmp$ret$5);
550
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
551
+ var tmp_4 = scope;
552
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
553
+ var this_4 = scope.w1t_1;
554
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
555
+ // Inline function 'kotlin.apply' call
556
+ var this_5 = new TransformerBuilder();
557
+ this_5.c1h(ScalaIrEmitter$emitShared$lambda_2);
558
+ var tmp$ret$10 = this_5.d1h();
559
+ tmp_4.w1t_1 = transform(this_4, tmp$ret$10);
560
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
561
+ var tmp_5 = scope;
562
+ // Inline function 'community.flock.wirespec.ir.core.injectAfter' call
563
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
564
+ var this_6 = scope.w1t_1;
565
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
566
+ // Inline function 'kotlin.apply' call
567
+ var this_7 = new TransformerBuilder();
568
+ this_7.c1h(ScalaIrEmitter$emitShared$lambda_3(clientServer));
569
+ var tmp$ret$15 = this_7.d1h();
570
+ tmp_5.w1t_1 = transform(this_6, tmp$ret$15);
571
+ var tmp_6 = scope.w1t_1;
572
+ var wirespecShared = isInterface(tmp_6, Element) ? tmp_6 : THROW_CCE();
573
+ var tmp_7;
574
+ if (this.p1y_1.ho_1) {
575
+ tmp_7 = wirespecShared.v1m(Companion_getInstance().l1h(packageName.or() + 'Wirespec'));
576
+ } else {
577
+ tmp_7 = null;
578
+ }
579
+ return tmp_7;
772
580
  };
773
581
  protoOf(ScalaIrEmitter).uq = function (definition, module_0, logger) {
774
- var file = emit_0.call(this, definition, module_0, logger);
582
+ var file = emit.call(this, definition, module_0, logger);
775
583
  // Inline function 'kotlin.takeIf' call
776
- var this_0 = this.i20_1;
584
+ var this_0 = this.s1y_1;
777
585
  var tmp;
778
586
  if (Companion_instance.qq(module_0)) {
779
587
  tmp = this_0;
@@ -781,41 +589,14 @@ protoOf(ScalaIrEmitter).uq = function (definition, module_0, logger) {
781
589
  tmp = null;
782
590
  }
783
591
  var tmp$ret$1 = tmp;
784
- return placeInPackage(prependImports(file, tmp$ret$1), this.k1v(), definition);
592
+ return placeInPackage(prependImports(file, tmp$ret$1), this.c1v(), definition);
785
593
  };
786
594
  protoOf(ScalaIrEmitter).up = function (type, module_0) {
787
- // Inline function 'community.flock.wirespec.ir.core.transform' call
788
- var this_0 = sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this));
789
- var scope = new TransformScope(this_0);
790
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
791
- var tmp = scope;
792
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
793
- var this_1 = scope.z1t_1;
794
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
795
- // Inline function 'kotlin.apply' call
796
- var this_2 = new TransformerBuilder();
797
- this_2.d1h(ScalaIrEmitter$emit$lambda_0);
798
- var tmp$ret$2 = this_2.e1h();
799
- tmp.z1t_1 = transform(this_1, tmp$ret$2);
800
- var tmp_0 = scope.z1t_1;
801
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
595
+ return ensureEmptyStructHasConstructor(sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this)));
802
596
  };
803
597
  protoOf(ScalaIrEmitter).ir = function (enum_0, module_0) {
804
- // Inline function 'community.flock.wirespec.ir.core.transform' call
805
- var this_0 = sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
806
- var scope = new TransformScope(this_0);
807
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
808
- var tmp = scope;
809
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
810
- var this_1 = scope.z1t_1;
811
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
812
- // Inline function 'kotlin.apply' call
813
- var this_2 = new TransformerBuilder();
814
- this_2.d1h(ScalaIrEmitter$emit$lambda_1(this));
815
- var tmp$ret$2 = this_2.e1h();
816
- tmp.z1t_1 = transform(this_1, tmp$ret$2);
817
- var tmp_0 = scope.z1t_1;
818
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
598
+ var tmp = sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
599
+ return injectEnumLabelField(tmp, ScalaIrEmitter$emit$lambda(this));
819
600
  };
820
601
  protoOf(ScalaIrEmitter).yq = function (union) {
821
602
  return sanitizeNames(convert_1(union), _get_sanitizationConfig__sns434(this));
@@ -824,9 +605,9 @@ protoOf(ScalaIrEmitter).dr = function (refined) {
824
605
  var file = sanitizeNames(convert_2(refined), _get_sanitizationConfig__sns434(this));
825
606
  // Inline function 'community.flock.wirespec.ir.core.findElement' call
826
607
  // Inline function 'kotlin.collections.filterIsInstance' call
827
- var tmp0 = file.v1m();
608
+ var tmp0 = file.t1m();
828
609
  // Inline function 'kotlin.collections.filterIsInstanceTo' call
829
- var destination = ArrayList_init_$Create$();
610
+ var destination = ArrayList_init_$Create$_0();
830
611
  var _iterator__ex2g4s = tmp0.t();
831
612
  while (_iterator__ex2g4s.u()) {
832
613
  var element = _iterator__ex2g4s.v();
@@ -835,50 +616,15 @@ protoOf(ScalaIrEmitter).dr = function (refined) {
835
616
  }
836
617
  }
837
618
  var tmp$ret$2 = firstOrNull_0(destination);
838
- var struct = ensureNotNull(tmp$ret$2);
839
- // Inline function 'kotlin.collections.map' call
840
- var this_0 = struct.g1n_1;
841
- // Inline function 'kotlin.collections.mapTo' call
842
- var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
843
- var _iterator__ex2g4s_0 = this_0.t();
844
- while (_iterator__ex2g4s_0.u()) {
845
- var item = _iterator__ex2g4s_0.v();
846
- var tmp$ret$3 = item.q1n(VOID, VOID, true);
847
- destination_0.x(tmp$ret$3);
848
- }
849
- var tmp = destination_0;
850
- // Inline function 'kotlin.collections.map' call
851
- var this_1 = struct.j1n_1;
852
- // Inline function 'kotlin.collections.mapTo' call
853
- var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
854
- var _iterator__ex2g4s_1 = this_1.t();
855
- while (_iterator__ex2g4s_1.u()) {
856
- var item_0 = _iterator__ex2g4s_1.v();
857
- var tmp_0;
858
- if (item_0 instanceof Function) {
859
- tmp_0 = item_0.b1k(VOID, VOID, VOID, VOID, VOID, VOID, VOID, true);
860
- } else {
861
- tmp_0 = item_0;
862
- }
863
- var tmp$ret$6 = tmp_0;
864
- destination_1.x(tmp$ret$6);
865
- }
866
- // Inline function 'community.flock.wirespec.ir.core.transform' call
867
- var this_2 = struct.l1n(VOID, tmp, VOID, VOID, destination_1);
868
- var scope = new TransformScope(this_2);
869
- scope.h1u(ScalaIrEmitter$emit$lambda_2);
870
- var tmp_1 = scope.z1t_1;
871
- var updatedStruct = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
872
- return new File(Companion_getInstance().m1h(sanitize(this, refined.br_1)), listOf(updatedStruct));
619
+ var updatedStruct = convertToStringCallsToFieldAccess(markMembersAsOverride(ensureNotNull(tmp$ret$2)));
620
+ return new File(Companion_getInstance().l1h(sanitize(this, refined.br_1)), listOf(updatedStruct));
873
621
  };
874
622
  protoOf(ScalaIrEmitter).jr = function (endpoint) {
875
- var imports = buildImports(this, endpoint);
876
- var file = convert_3(endpoint);
877
623
  // Inline function 'community.flock.wirespec.ir.core.findElement' call
878
624
  // Inline function 'kotlin.collections.filterIsInstance' call
879
- var tmp0 = file.v1m();
625
+ var tmp0 = convert_3(endpoint).t1m();
880
626
  // Inline function 'kotlin.collections.filterIsInstanceTo' call
881
- var destination = ArrayList_init_$Create$();
627
+ var destination = ArrayList_init_$Create$_0();
882
628
  var _iterator__ex2g4s = tmp0.t();
883
629
  while (_iterator__ex2g4s.u()) {
884
630
  var element = _iterator__ex2g4s.v();
@@ -889,54 +635,56 @@ protoOf(ScalaIrEmitter).jr = function (endpoint) {
889
635
  var tmp$ret$2 = firstOrNull_0(destination);
890
636
  var endpointNamespace = ensureNotNull(tmp$ret$2);
891
637
  var flattened = flattenNestedStructs(endpointNamespace);
892
- var requestIsObject = isRequestObject(this, flattened);
893
- // Inline function 'kotlin.let' call
894
- var ns = injectHandleFunction(this, flattened);
895
- var body = buildClientServerObjects(this, endpoint, requestIsObject, ns);
896
- var sanitized = sanitizeNames(new File(Companion_getInstance().m1h(sanitize(this, endpoint.ep_1)), listOf(body)), _get_sanitizationConfig__sns434(this));
897
- var tmp;
638
+ var body = appendClientServerObjects(injectHandleFunction(flattened), endpoint, isRequestObject(flattened));
639
+ var tmp = sanitizeNames(new File(Companion_getInstance().l1h(sanitize(this, endpoint.ep_1)), listOf(body)), _get_sanitizationConfig__sns434(this));
640
+ // Inline function 'kotlin.takeIf' call
641
+ var this_0 = buildModelImports(endpoint, this.c1v());
642
+ var tmp_0;
898
643
  // Inline function 'kotlin.collections.isNotEmpty' call
899
- if (!imports.r()) {
900
- tmp = sanitized.x1m(VOID, plus_0(imports, sanitized.u1m_1));
644
+ if (!this_0.r()) {
645
+ tmp_0 = this_0;
901
646
  } else {
902
- tmp = sanitized;
647
+ tmp_0 = null;
903
648
  }
904
- return tmp;
649
+ var tmp$ret$5 = tmp_0;
650
+ return prependImports(tmp, tmp$ret$5);
905
651
  };
906
652
  protoOf(ScalaIrEmitter).xq = function (channel) {
907
- var imports = buildImports(this, channel);
908
- var file = sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
909
- var tmp;
653
+ var tmp = sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
654
+ // Inline function 'kotlin.takeIf' call
655
+ var this_0 = buildModelImports(channel, this.c1v());
656
+ var tmp_0;
910
657
  // Inline function 'kotlin.collections.isNotEmpty' call
911
- if (!imports.r()) {
912
- tmp = file.x1m(VOID, plus_0(imports, file.u1m_1));
658
+ if (!this_0.r()) {
659
+ tmp_0 = this_0;
913
660
  } else {
914
- tmp = file;
661
+ tmp_0 = null;
915
662
  }
916
- return tmp;
663
+ var tmp$ret$2 = tmp_0;
664
+ return prependImports(tmp, tmp$ret$2);
917
665
  };
918
- protoOf(ScalaIrEmitter).q1u = function (endpoint) {
919
- var imports = buildImports(this, endpoint);
920
- var endpointImport = import_0(this.k1v().mr_1 + '.endpoint', endpoint.ep_1.l1());
921
- var file = addIdentityTypeToCall(this, sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)));
922
- var subPackageName = plus_1(this.k1v(), 'client');
923
- var tmp = Companion_getInstance().m1h(subPackageName.or() + file.t1m_1.x1l());
666
+ protoOf(ScalaIrEmitter).o1u = function (endpoint) {
667
+ var imports = buildModelImports(endpoint, this.c1v());
668
+ var endpointImport = import_0(this.c1v().mr_1 + '.endpoint', endpoint.ep_1.l1());
669
+ var file = addIdentityTypeToCall(sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)));
670
+ var subPackageName = plus_1(this.c1v(), 'client');
671
+ var tmp = Companion_getInstance().l1h(subPackageName.or() + file.r1m_1.w1l());
924
672
  // Inline function 'kotlin.collections.buildList' call
925
673
  // Inline function 'kotlin.collections.buildListInternal' call
926
674
  // Inline function 'kotlin.apply' call
927
- var this_0 = ArrayList_init_$Create$();
675
+ var this_0 = ArrayList_init_$Create$_0();
928
676
  this_0.x(new Package(subPackageName.mr_1));
929
- this_0.e1(this.i20_1);
677
+ this_0.e1(this.s1y_1);
930
678
  this_0.e1(imports);
931
679
  this_0.x(endpointImport);
932
- this_0.e1(file.u1m_1);
680
+ this_0.e1(file.s1m_1);
933
681
  var tmp$ret$3 = this_0.o5();
934
682
  return new File(tmp, tmp$ret$3);
935
683
  };
936
- protoOf(ScalaIrEmitter).p1u = function (endpoints, logger) {
684
+ protoOf(ScalaIrEmitter).n1u = function (endpoints, logger) {
937
685
  // Inline function 'kotlin.collections.flatMap' call
938
686
  // Inline function 'kotlin.collections.flatMapTo' call
939
- var destination = ArrayList_init_$Create$();
687
+ var destination = ArrayList_init_$Create$_0();
940
688
  var _iterator__ex2g4s = endpoints.t();
941
689
  while (_iterator__ex2g4s.u()) {
942
690
  var element = _iterator__ex2g4s.v();
@@ -945,61 +693,358 @@ protoOf(ScalaIrEmitter).p1u = function (endpoints, logger) {
945
693
  }
946
694
  // Inline function 'kotlin.collections.distinctBy' call
947
695
  var set = HashSet_init_$Create$();
948
- var list_0 = ArrayList_init_$Create$();
696
+ var list_0 = ArrayList_init_$Create$_0();
949
697
  var _iterator__ex2g4s_0 = destination.t();
950
698
  while (_iterator__ex2g4s_0.u()) {
951
699
  var e = _iterator__ex2g4s_0.v();
952
- var key = e.lu_1;
700
+ var key = e.ku_1;
953
701
  if (set.x(key)) {
954
702
  list_0.x(e);
955
703
  }
956
704
  }
957
705
  // Inline function 'kotlin.collections.map' call
958
706
  // Inline function 'kotlin.collections.mapTo' call
959
- var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(list_0, 10));
707
+ var destination_0 = ArrayList_init_$Create$(collectionSizeOrDefault(list_0, 10));
960
708
  var _iterator__ex2g4s_1 = list_0.t();
961
709
  while (_iterator__ex2g4s_1.u()) {
962
710
  var item = _iterator__ex2g4s_1.v();
963
- var tmp$ret$5 = import_0(this.k1v().mr_1 + '.model', item.lu_1);
711
+ var tmp$ret$5 = import_0(this.c1v().mr_1 + '.model', item.ku_1);
964
712
  destination_0.x(tmp$ret$5);
965
713
  }
966
714
  var imports = destination_0;
967
715
  // Inline function 'kotlin.collections.map' call
968
716
  // Inline function 'kotlin.collections.mapTo' call
969
- var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
717
+ var destination_1 = ArrayList_init_$Create$(collectionSizeOrDefault(endpoints, 10));
970
718
  var _iterator__ex2g4s_2 = endpoints.t();
971
719
  while (_iterator__ex2g4s_2.u()) {
972
720
  var item_0 = _iterator__ex2g4s_2.v();
973
- var tmp$ret$8 = import_0(this.k1v().mr_1 + '.endpoint', item_0.ep_1.l1());
721
+ var tmp$ret$8 = import_0(this.c1v().mr_1 + '.endpoint', item_0.ep_1.l1());
974
722
  destination_1.x(tmp$ret$8);
975
723
  }
976
724
  var endpointImports = destination_1;
977
725
  // Inline function 'kotlin.collections.map' call
978
726
  // Inline function 'kotlin.collections.mapTo' call
979
- var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
727
+ var destination_2 = ArrayList_init_$Create$(collectionSizeOrDefault(endpoints, 10));
980
728
  var _iterator__ex2g4s_3 = endpoints.t();
981
729
  while (_iterator__ex2g4s_3.u()) {
982
730
  var item_1 = _iterator__ex2g4s_3.v();
983
- var tmp$ret$11 = import_0(this.k1v().mr_1 + '.client', item_1.ep_1.l1() + 'Client');
731
+ var tmp$ret$11 = import_0(this.c1v().mr_1 + '.client', item_1.ep_1.l1() + 'Client');
984
732
  destination_2.x(tmp$ret$11);
985
733
  }
986
734
  var clientImports = destination_2;
987
- var allImports = plus_0(plus_0(imports, endpointImports), clientImports);
988
- var file = addIdentityTypeToCall(this, sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this)));
989
- var tmp = Companion_getInstance().m1h(this.k1v().or() + file.t1m_1.x1l());
735
+ var allImports = plus(plus(imports, endpointImports), clientImports);
736
+ var file = addIdentityTypeToCall(sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this)));
737
+ var tmp = Companion_getInstance().l1h(this.c1v().or() + file.r1m_1.w1l());
990
738
  // Inline function 'kotlin.collections.buildList' call
991
739
  // Inline function 'kotlin.collections.buildListInternal' call
992
740
  // Inline function 'kotlin.apply' call
993
- var this_0 = ArrayList_init_$Create$();
994
- this_0.x(new Package(this.k1v().mr_1));
995
- this_0.e1(this.i20_1);
741
+ var this_0 = ArrayList_init_$Create$_0();
742
+ this_0.x(new Package(this.c1v().mr_1));
743
+ this_0.e1(this.s1y_1);
996
744
  this_0.e1(allImports);
997
- this_0.e1(file.u1m_1);
745
+ this_0.e1(file.s1m_1);
998
746
  var tmp$ret$17 = this_0.o5();
999
747
  return new File(tmp, tmp$ret$17);
1000
748
  };
749
+ function convertToStringCallsToFieldAccess(_this__u8e3s4) {
750
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
751
+ var scope = new TransformScope(_this__u8e3s4);
752
+ scope.e1u(convertToStringCallsToFieldAccess$lambda);
753
+ var tmp = scope.w1t_1;
754
+ return isInterface(tmp, Element) ? tmp : THROW_CCE();
755
+ }
756
+ function appendClientServerObjects(_this__u8e3s4, endpoint, requestIsObject) {
757
+ var reqType = requestIsObject ? 'Request.type' : 'Request';
758
+ var pathTemplate = '/' + joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, appendClientServerObjects$lambda);
759
+ var pathSegmentsCode = joinToString(endpoint.gp_1, ', ', VOID, VOID, VOID, VOID, appendClientServerObjects$lambda_0);
760
+ var clientObject = raw(trimMargin('\n |object Client extends Wirespec.Client[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override val pathSegments: List[Wirespec.PathSegment] = List(' + pathSegmentsCode + ')\n | override def client(serialization: Wirespec.Serialization): Wirespec.ClientEdge[' + reqType + ', Response[?]] = new Wirespec.ClientEdge[' + reqType + ', Response[?]] {\n | override def to(request: ' + reqType + '): Wirespec.RawRequest = toRawRequest(serialization, request)\n | override def from(response: Wirespec.RawResponse): Response[?] = fromRawResponse(serialization, response)\n | }\n |}\n '));
761
+ var serverObject = raw(trimMargin('\n |object Server extends Wirespec.Server[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override val pathSegments: List[Wirespec.PathSegment] = List(' + pathSegmentsCode + ')\n | override def server(serialization: Wirespec.Serialization): Wirespec.ServerEdge[' + reqType + ', Response[?]] = new Wirespec.ServerEdge[' + reqType + ', Response[?]] {\n | override def from(request: Wirespec.RawRequest): ' + reqType + ' = fromRawRequest(serialization, request)\n | override def to(response: Response[?]): Wirespec.RawResponse = toRawResponse(serialization, response)\n | }\n |}\n '));
762
+ return _this__u8e3s4.b1n(VOID, plus_0(plus_0(_this__u8e3s4.y1m_1, clientObject), serverObject));
763
+ }
764
+ function injectHandleFunction(_this__u8e3s4) {
765
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
766
+ var scope = new TransformScope(_this__u8e3s4);
767
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
768
+ var tmp = scope;
769
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
770
+ var this_0 = scope.w1t_1;
771
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
772
+ // Inline function 'kotlin.apply' call
773
+ var this_1 = new TransformerBuilder();
774
+ this_1.c1h(injectHandleFunction$lambda);
775
+ var tmp$ret$2 = this_1.d1h();
776
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
777
+ var tmp_0 = scope.w1t_1;
778
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
779
+ }
780
+ function isRequestObject(namespace) {
781
+ // Inline function 'kotlin.collections.filterIsInstance' call
782
+ var tmp0 = namespace.y1m_1;
783
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
784
+ var destination = ArrayList_init_$Create$_0();
785
+ var _iterator__ex2g4s = tmp0.t();
786
+ while (_iterator__ex2g4s.u()) {
787
+ var element = _iterator__ex2g4s.v();
788
+ if (element instanceof Struct) {
789
+ destination.x(element);
790
+ }
791
+ }
792
+ var tmp$ret$3;
793
+ $l$block: {
794
+ // Inline function 'kotlin.collections.firstOrNull' call
795
+ var _iterator__ex2g4s_0 = destination.t();
796
+ while (_iterator__ex2g4s_0.u()) {
797
+ var element_0 = _iterator__ex2g4s_0.v();
798
+ if (element_0.c1n_1.w1l() === 'Request') {
799
+ tmp$ret$3 = element_0;
800
+ break $l$block;
801
+ }
802
+ }
803
+ tmp$ret$3 = null;
804
+ }
805
+ var tmp0_elvis_lhs = tmp$ret$3;
806
+ var tmp;
807
+ if (tmp0_elvis_lhs == null) {
808
+ return false;
809
+ } else {
810
+ tmp = tmp0_elvis_lhs;
811
+ }
812
+ var requestStruct = tmp;
813
+ return requestStruct.e1n_1.a1() === 1 && single(requestStruct.e1n_1).k1q_1.r() || (requestStruct.d1n_1.r() && requestStruct.e1n_1.r());
814
+ }
815
+ function buildModelImports(_this__u8e3s4, packageName) {
816
+ // Inline function 'kotlin.collections.distinctBy' call
817
+ var this_0 = importReferences(_this__u8e3s4);
818
+ var set = HashSet_init_$Create$();
819
+ var list = ArrayList_init_$Create$_0();
820
+ var _iterator__ex2g4s = this_0.t();
821
+ while (_iterator__ex2g4s.u()) {
822
+ var e = _iterator__ex2g4s.v();
823
+ var key = e.ku_1;
824
+ if (set.x(key)) {
825
+ list.x(e);
826
+ }
827
+ }
828
+ // Inline function 'kotlin.collections.map' call
829
+ // Inline function 'kotlin.collections.mapTo' call
830
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(list, 10));
831
+ var _iterator__ex2g4s_0 = list.t();
832
+ while (_iterator__ex2g4s_0.u()) {
833
+ var item = _iterator__ex2g4s_0.v();
834
+ var tmp$ret$2 = import_0(packageName.mr_1 + '.model', item.ku_1);
835
+ destination.x(tmp$ret$2);
836
+ }
837
+ return destination;
838
+ }
839
+ function addIdentityTypeToCall(_this__u8e3s4) {
840
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
841
+ var scope = new TransformScope(_this__u8e3s4);
842
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
843
+ var tmp = scope;
844
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
845
+ var this_0 = scope.w1t_1;
846
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
847
+ // Inline function 'kotlin.apply' call
848
+ var this_1 = new TransformerBuilder();
849
+ this_1.c1h(addIdentityTypeToCall$lambda);
850
+ var tmp$ret$2 = this_1.d1h();
851
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
852
+ var tmp_0 = scope.w1t_1;
853
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
854
+ }
855
+ function toScalaTypeName(_this__u8e3s4) {
856
+ var tmp;
857
+ if (_this__u8e3s4 instanceof Primitive) {
858
+ var t = _this__u8e3s4.ou_1;
859
+ var tmp_0;
860
+ if (t instanceof String_0) {
861
+ tmp_0 = 'String';
862
+ } else {
863
+ if (t instanceof Integer) {
864
+ tmp_0 = t.st_1.equals(Precision_P32_getInstance()) ? 'Int' : 'Long';
865
+ } else {
866
+ if (t instanceof Number_0) {
867
+ tmp_0 = t.vt_1.equals(Precision_P32_getInstance()) ? 'Float' : 'Double';
868
+ } else {
869
+ if (equals(t, Boolean_instance)) {
870
+ tmp_0 = 'Boolean';
871
+ } else {
872
+ if (equals(t, Bytes_instance)) {
873
+ tmp_0 = 'Array[Byte]';
874
+ } else {
875
+ noWhenBranchMatchedException();
876
+ }
877
+ }
878
+ }
879
+ }
880
+ }
881
+ tmp = tmp_0;
882
+ } else {
883
+ if (_this__u8e3s4 instanceof Custom) {
884
+ tmp = _this__u8e3s4.ku_1;
885
+ } else {
886
+ if (_this__u8e3s4 instanceof Iterable) {
887
+ tmp = 'List[' + toScalaTypeName(_this__u8e3s4.zn_1) + ']';
888
+ } else {
889
+ if (_this__u8e3s4 instanceof Dict) {
890
+ tmp = 'Map[String, ' + toScalaTypeName(_this__u8e3s4.co_1) + ']';
891
+ } else {
892
+ if (_this__u8e3s4 instanceof Any) {
893
+ tmp = 'Any';
894
+ } else {
895
+ if (_this__u8e3s4 instanceof Unit) {
896
+ tmp = 'Unit';
897
+ } else {
898
+ noWhenBranchMatchedException();
899
+ }
900
+ }
901
+ }
902
+ }
903
+ }
904
+ }
905
+ var base = tmp;
906
+ return _this__u8e3s4.cu() ? 'Option[' + base + ']' : base;
907
+ }
908
+ function convertToStringCallsToFieldAccess$lambda(expr, tr) {
909
+ var tmp;
910
+ var tmp_0;
911
+ var tmp_1;
912
+ if (expr instanceof FunctionCall) {
913
+ tmp_1 = expr.a1m_1.q1l() === 'toString';
914
+ } else {
915
+ tmp_1 = false;
916
+ }
917
+ if (tmp_1) {
918
+ tmp_0 = !(expr.y1l_1 == null);
919
+ } else {
920
+ tmp_0 = false;
921
+ }
922
+ if (tmp_0) {
923
+ var tmp0_safe_receiver = expr.y1l_1;
924
+ var tmp_2;
925
+ if (tmp0_safe_receiver == null) {
926
+ tmp_2 = null;
927
+ } else {
928
+ // Inline function 'kotlin.let' call
929
+ tmp_2 = tr.r1t(tmp0_safe_receiver);
930
+ }
931
+ tmp = new FieldCall(tmp_2, Companion_getInstance().l1h('toString'));
932
+ } else {
933
+ tmp = transformChildren_1(expr, tr);
934
+ }
935
+ return tmp;
936
+ }
937
+ function appendClientServerObjects$lambda(it) {
938
+ var tmp;
939
+ if (it instanceof Literal) {
940
+ tmp = it.hq_1;
941
+ } else {
942
+ if (it instanceof Param) {
943
+ tmp = '{' + it.lp_1.l1() + '}';
944
+ } else {
945
+ noWhenBranchMatchedException();
946
+ }
947
+ }
948
+ return tmp;
949
+ }
950
+ function appendClientServerObjects$lambda_0(segment) {
951
+ var tmp;
952
+ if (segment instanceof Literal) {
953
+ tmp = 'Wirespec.Literal("' + segment.hq_1 + '")';
954
+ } else {
955
+ if (segment instanceof Param) {
956
+ tmp = 'Wirespec.Param("' + segment.lp_1.l1() + '", scala.reflect.classTag[' + toScalaTypeName(segment.mp_1) + '])';
957
+ } else {
958
+ noWhenBranchMatchedException();
959
+ }
960
+ }
961
+ return tmp;
962
+ }
963
+ function injectHandleFunction$lambda(element, transformer) {
964
+ var tmp;
965
+ if (element instanceof Interface) {
966
+ var tmp$ret$0;
967
+ $l$block: {
968
+ if (!element.j1n_1.equals(Companion_getInstance().l1h('Handler')) && !element.j1n_1.equals(Companion_getInstance().l1h('Call'))) {
969
+ tmp$ret$0 = element;
970
+ break $l$block;
971
+ }
972
+ var tmp0_typeParameters = listOf(new TypeParameter(new Custom_0('F[_]')));
973
+ // Inline function 'kotlin.collections.map' call
974
+ var this_0 = element.k1n_1;
975
+ // Inline function 'kotlin.collections.mapTo' call
976
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
977
+ var _iterator__ex2g4s = this_0.t();
978
+ while (_iterator__ex2g4s.u()) {
979
+ var item = _iterator__ex2g4s.v();
980
+ var tmp0_safe_receiver = item instanceof Function ? item : null;
981
+ var tmp_0;
982
+ if (tmp0_safe_receiver == null) {
983
+ tmp_0 = null;
984
+ } else {
985
+ var tmp1_safe_receiver = item.v1j_1;
986
+ var tmp_1;
987
+ if (tmp1_safe_receiver == null) {
988
+ tmp_1 = null;
989
+ } else {
990
+ // Inline function 'kotlin.let' call
991
+ tmp_1 = new Custom_0('F', listOf(tmp1_safe_receiver));
992
+ }
993
+ var tmp3_returnType = tmp_1;
994
+ tmp_0 = tmp0_safe_receiver.a1k(VOID, VOID, VOID, tmp3_returnType, VOID, false);
995
+ }
996
+ var tmp4_elvis_lhs = tmp_0;
997
+ var tmp$ret$3 = tmp4_elvis_lhs == null ? item : tmp4_elvis_lhs;
998
+ destination.x(tmp$ret$3);
999
+ }
1000
+ tmp$ret$0 = element.q1n(VOID, destination, VOID, VOID, tmp0_typeParameters);
1001
+ }
1002
+ tmp = tmp$ret$0;
1003
+ } else {
1004
+ tmp = element;
1005
+ }
1006
+ var transformed = tmp;
1007
+ return transformChildren_0(transformed, transformer);
1008
+ }
1009
+ function addIdentityTypeToCall$lambda(element, transformer) {
1010
+ var tmp;
1011
+ if (element instanceof Struct) {
1012
+ // Inline function 'kotlin.collections.map' call
1013
+ var this_0 = element.f1n_1;
1014
+ // Inline function 'kotlin.collections.mapTo' call
1015
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
1016
+ var _iterator__ex2g4s = this_0.t();
1017
+ while (_iterator__ex2g4s.u()) {
1018
+ var item = _iterator__ex2g4s.v();
1019
+ var tmp0_safe_receiver = item instanceof Custom_0 ? item : null;
1020
+ var tmp_0;
1021
+ if (tmp0_safe_receiver == null) {
1022
+ tmp_0 = null;
1023
+ } else {
1024
+ // Inline function 'kotlin.takeIf' call
1025
+ var tmp_1;
1026
+ if (endsWith(tmp0_safe_receiver.p1h_1, '.Call')) {
1027
+ tmp_1 = tmp0_safe_receiver;
1028
+ } else {
1029
+ tmp_1 = null;
1030
+ }
1031
+ tmp_0 = tmp_1;
1032
+ }
1033
+ var tmp1_safe_receiver = tmp_0;
1034
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.m1m(VOID, listOf(new Custom_0('[A] =>> A')));
1035
+ var tmp$ret$2 = tmp2_elvis_lhs == null ? item : tmp2_elvis_lhs;
1036
+ destination.x(tmp$ret$2);
1037
+ }
1038
+ tmp = element.i1n(VOID, VOID, VOID, destination);
1039
+ } else {
1040
+ tmp = element;
1041
+ }
1042
+ var transformed = tmp;
1043
+ return transformChildren_0(transformed, transformer);
1044
+ }
1001
1045
  //region block: post-declaration
1002
- protoOf(ScalaIrEmitter).on = emit_1;
1046
+ protoOf(ScalaIrEmitter).on = emit_0;
1047
+ protoOf(ScalaIrEmitter).l1u = emit_1;
1003
1048
  //endregion
1004
1049
  //region block: exports
1005
1050
  export {