@flock/wirespec 0.16.7 → 0.16.9

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 (40) hide show
  1. package/arrow-arrow-core.mjs +306 -61
  2. package/arrow-arrow-core.mjs.map +1 -1
  3. package/clikt-clikt.mjs +1165 -1165
  4. package/colormath-root-colormath.mjs +425 -425
  5. package/kotlin-kotlin-stdlib.mjs +34 -34
  6. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  7. package/kotlin-openapi-bindings.mjs +4762 -4762
  8. package/kotlin-rgxgen.mjs +1769 -1769
  9. package/kotlinx-io-kotlinx-io-core.mjs +380 -380
  10. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1645 -1645
  11. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  12. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1307 -1307
  13. package/markdown.mjs +1871 -1871
  14. package/mordant-mordant.mjs +1642 -1642
  15. package/package.json +1 -1
  16. package/wirespec-src-compiler-core.mjs +2649 -2499
  17. package/wirespec-src-compiler-core.mjs.map +1 -1
  18. package/wirespec-src-compiler-emitters-java.mjs +691 -603
  19. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  20. package/wirespec-src-compiler-emitters-kotlin.mjs +626 -576
  21. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  22. package/wirespec-src-compiler-emitters-python.mjs +790 -740
  23. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  24. package/wirespec-src-compiler-emitters-typescript.mjs +291 -287
  25. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  26. package/wirespec-src-compiler-emitters-wirespec.mjs +260 -224
  27. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  28. package/wirespec-src-compiler-lib.mjs +342 -340
  29. package/wirespec-src-compiler-lib.mjs.map +1 -1
  30. package/wirespec-src-converter-avro.mjs +587 -562
  31. package/wirespec-src-converter-avro.mjs.map +1 -1
  32. package/wirespec-src-converter-openapi.mjs +747 -737
  33. package/wirespec-src-converter-openapi.mjs.map +1 -1
  34. package/wirespec-src-plugin-arguments.mjs +168 -167
  35. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  36. package/wirespec-src-plugin-cli.mjs +82 -81
  37. package/wirespec-src-plugin-cli.mjs.map +1 -1
  38. package/wirespec-src-plugin-npm.mjs +30 -29
  39. package/wirespec-src-plugin-npm.mjs.map +1 -1
  40. package/wirespec-src-tools-generator.mjs +27 -27
@@ -1,3 +1,44 @@
1
+ import {
2
+ importReferences3pz8oxxe2hwhu as importReferences,
3
+ LanguageEmitterxhzgykhux3qm as LanguageEmitter,
4
+ Companion_instance2ag0h5twtdral as Companion_instance,
5
+ Companion_instance26a9xkw31611z as Companion_instance_0,
6
+ FileExtension_Kotlin_getInstanceme7il40s0mth as FileExtension_Kotlin_getInstance,
7
+ Emitted12h24rpo4uifw as Emitted,
8
+ plus2csvv9vgnno78 as plus,
9
+ Companion_instance2piryw1e8zn12 as Companion_instance_1,
10
+ get_pathParams29rrc1msn3eoz as get_pathParams,
11
+ orNull2zq556ke3x99j as orNull,
12
+ Spacer_instancel9yep7i0q3er as Spacer_instance,
13
+ get_indexedPathParams3mii47g6wg9rv as get_indexedPathParams,
14
+ removeQuestionMark174e2l0zlwrek as removeQuestionMark,
15
+ emit3a0ojvea37u6k as emit,
16
+ concatGenerics2esceo9p1a45k as concatGenerics,
17
+ Param33sus5zaarsk0 as Param,
18
+ Literal32wmkquj6qapn as Literal,
19
+ distinctByStatus27eirf52grddm as distinctByStatus,
20
+ fixStatus2l9jrn3538wpy as fixStatus,
21
+ spacer28p2fwyb64afn as spacer,
22
+ FieldIdentifier2fnn30qixmpf as FieldIdentifier,
23
+ DefinitionIdentifier21mzme854zakh as DefinitionIdentifier,
24
+ addBackticks1di5q03fw4yhx as addBackticks,
25
+ Bytes_instance1at7binw0nl40 as Bytes_instance,
26
+ Boolean_instance3qnzv8pgzox40 as Boolean_instance,
27
+ RegExp1kvu7kxwy7td5 as RegExp_0,
28
+ String23kqvhe3sk098 as String_0,
29
+ Number3i05nlui0wcz8 as Number_0,
30
+ Integeryrcje1s9u7kr as Integer,
31
+ Bytes2moci2lqqzua3 as Bytes,
32
+ Boolean1v54w5v4qjba1 as Boolean_0,
33
+ Primitivexjb7c0cm123a as Primitive,
34
+ Custom37hvrfgd6b0uj as Custom,
35
+ Any268baxyo9do19 as Any,
36
+ Unit3rie819ih39bz as Unit,
37
+ Iterablerto606wd057m as Iterable,
38
+ Dict3l6tdihpke4rr as Dict,
39
+ Bound1dotva4vah4jp as Bound,
40
+ TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
41
+ } from './wirespec-src-compiler-core.mjs';
1
42
  import {
2
43
  ArrayList_init_$Create$2rimpp4x9tjd3 as ArrayList_init_$Create$,
3
44
  Unit_instanceat14thlj150z as Unit_instance,
@@ -5,89 +46,404 @@ import {
5
46
  ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$_0,
6
47
  VOID7hggqo3abtya as VOID,
7
48
  joinToString1cxrrlmo0chqs as joinToString,
49
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
50
+ isCharSequence1ju9jr1w86plq as isCharSequence,
51
+ trimStart5ewg8zf6cs5u as trimStart,
52
+ toString1pkumu07cwy4m as toString,
53
+ trimMarginhyd3fsmh8iev as trimMargin,
54
+ protoOf180f3jzyo7rfj as protoOf,
55
+ initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
56
+ initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
8
57
  charSequenceGet1vxk1y5n17t1z as charSequenceGet,
9
58
  Char19o2r8palgjof as Char,
10
59
  distinct10qe1scfdvu5k as distinct,
11
- trimMarginhyd3fsmh8iev as trimMargin,
12
60
  listOfNotNull2woi2boe01ub4 as listOfNotNull,
13
61
  isBlank1dvkhjjvox3p0 as isBlank,
14
62
  charSequenceLength3278n89t01tmv as charSequenceLength,
63
+ toString14fd7g605f91p as toString_0,
64
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
65
+ first58ocm7j58k3q as first,
15
66
  split2bvyvnrlcifjv as split,
67
+ setOf45ia9pnfhe90 as setOf,
68
+ initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
69
+ isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
70
+ _Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
71
+ listOfvhqybd2zx248 as listOf,
16
72
  checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
17
73
  asSequence3lsvgkvyzox0q as asSequence,
18
74
  filter184huxd00uyfg as filter,
19
75
  joinToStringooja5rkatz3u as joinToString_0,
20
76
  firstOrNulltrxqttxfxqju as firstOrNull,
21
77
  isDigit3mimrri4wkzop as isDigit,
22
- setOf45ia9pnfhe90 as setOf,
23
- protoOf180f3jzyo7rfj as protoOf,
24
- initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
25
- THROW_CCE2g6jy02ryeudk as THROW_CCE,
26
- isCharSequence1ju9jr1w86plq as isCharSequence,
27
- trimStart5ewg8zf6cs5u as trimStart,
28
- toString1pkumu07cwy4m as toString,
29
- toString14fd7g605f91p as toString_0,
30
- noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
31
- isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
32
- _Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
33
- listOfvhqybd2zx248 as listOf,
34
- dropLastlqc2oyv04br0 as dropLast,
35
78
  equals2au1ep9vhcato as equals,
36
- first58ocm7j58k3q as first,
37
- initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
38
79
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
80
+ dropLastlqc2oyv04br0 as dropLast,
39
81
  } from './kotlin-kotlin-stdlib.mjs';
40
- import {
41
- Spacer_instancel9yep7i0q3er as Spacer_instance,
42
- orNull2zq556ke3x99j as orNull,
43
- removeQuestionMark174e2l0zlwrek as removeQuestionMark,
44
- Companion_instanceb7vsmblp2jf7 as Companion_instance,
45
- concatGenerics2esceo9p1a45k as concatGenerics,
46
- Param33sus5zaarsk0 as Param,
47
- Literal32wmkquj6qapn as Literal,
48
- Emitterpslsvv25okcl as Emitter,
49
- Companion_instance2ag0h5twtdral as Companion_instance_0,
50
- Companion_instance26a9xkw31611z as Companion_instance_1,
51
- FileExtension_Kotlin_getInstanceme7il40s0mth as FileExtension_Kotlin_getInstance,
52
- Emitted12h24rpo4uifw as Emitted,
53
- plus2csvv9vgnno78 as plus,
54
- Bytes2moci2lqqzua3 as Bytes,
55
- Boolean1v54w5v4qjba1 as Boolean_0,
56
- Number3i05nlui0wcz8 as Number_0,
57
- Integeryrcje1s9u7kr as Integer,
58
- String23kqvhe3sk098 as String_0,
59
- Primitivexjb7c0cm123a as Primitive,
60
- Custom37hvrfgd6b0uj as Custom,
61
- Any268baxyo9do19 as Any,
62
- Unit3rie819ih39bz as Unit,
63
- Iterablerto606wd057m as Iterable,
64
- Dict3l6tdihpke4rr as Dict,
65
- FieldIdentifier2fnn30qixmpf as FieldIdentifier,
66
- DefinitionIdentifier21mzme854zakh as DefinitionIdentifier,
67
- Bytes_instance1at7binw0nl40 as Bytes_instance,
68
- Boolean_instance3qnzv8pgzox40 as Boolean_instance,
69
- RegExp1kvu7kxwy7td5 as RegExp_0,
70
- Bound1dotva4vah4jp as Bound,
71
- addBackticks1di5q03fw4yhx as addBackticks,
72
- } from './wirespec-src-compiler-core.mjs';
73
82
  //region block: imports
74
83
  //endregion
75
84
  //region block: pre-declaration
85
+ function emit_0(identifier) {
86
+ var tmp;
87
+ if (identifier instanceof DefinitionIdentifier) {
88
+ tmp = this.i2a(identifier);
89
+ } else {
90
+ if (identifier instanceof FieldIdentifier) {
91
+ tmp = this.k2a(this.i2a(identifier));
92
+ } else {
93
+ noWhenBranchMatchedException();
94
+ }
95
+ }
96
+ return tmp;
97
+ }
98
+ function sanitize(_this__u8e3s4) {
99
+ // Inline function 'kotlin.collections.mapIndexed' call
100
+ var this_0 = split(_this__u8e3s4.b1(), ['.', ' ']);
101
+ // Inline function 'kotlin.collections.mapIndexedTo' call
102
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
103
+ var index = 0;
104
+ var tmp0_iterator = this_0.g();
105
+ while (tmp0_iterator.h()) {
106
+ var item = tmp0_iterator.i();
107
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinIdentifierEmitter.sanitize.<anonymous>' call
108
+ var tmp1 = index;
109
+ index = tmp1 + 1 | 0;
110
+ var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance_1.a26(item) : item;
111
+ destination.e(tmp$ret$0);
112
+ }
113
+ var tmp = asSequence(joinToString(destination, ''));
114
+ return this.j2a(joinToString_0(filter(tmp, KotlinIdentifierEmitter$sanitize$lambda), ''));
115
+ }
116
+ function sanitizeFirstIsDigit(_this__u8e3s4) {
117
+ var tmp;
118
+ var tmp0_safe_receiver = firstOrNull(_this__u8e3s4);
119
+ var tmp_0;
120
+ var tmp_1 = tmp0_safe_receiver;
121
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
122
+ tmp_0 = null;
123
+ } else {
124
+ tmp_0 = isDigit(tmp0_safe_receiver);
125
+ }
126
+ if (tmp_0 === true) {
127
+ tmp = '_' + _this__u8e3s4;
128
+ } else {
129
+ tmp = _this__u8e3s4;
130
+ }
131
+ return tmp;
132
+ }
133
+ function sanitizeKeywords(_this__u8e3s4) {
134
+ return Companion_getInstance().y2a_1.o1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
135
+ }
136
+ initMetadataForInterface(KotlinIdentifierEmitter, 'KotlinIdentifierEmitter');
137
+ function emit_1(type, module_0) {
138
+ var tmp;
139
+ if (type.l24_1.i24_1.l()) {
140
+ tmp = 'data object ' + this.i26(type.k24_1);
141
+ } else {
142
+ var tmp_0 = this.i26(type.k24_1);
143
+ var tmp_1 = this.h25(type.l24_1);
144
+ // Inline function 'kotlin.run' call
145
+ // Inline function 'kotlin.contracts.contract' call
146
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinTypeDefinitionEmitter.emit.<anonymous>' call
147
+ var $this$run = type.m24_1;
148
+ var tmp_2;
149
+ if ($this$run.l()) {
150
+ tmp_2 = '';
151
+ } else {
152
+ tmp_2 = ' : ' + joinToString($this$run, ', ', VOID, VOID, VOID, VOID, KotlinTypeDefinitionEmitter$emit$lambda(this));
153
+ }
154
+ var tmp$ret$1 = tmp_2;
155
+ tmp = trimMargin('\n |data class ' + tmp_0 + '(\n |' + tmp_1 + '\n |)' + tmp$ret$1 + '\n |\n ');
156
+ }
157
+ return tmp;
158
+ }
159
+ function emit_2(_this__u8e3s4) {
160
+ return dropLast(joinToString(_this__u8e3s4.i24_1, '\n', VOID, VOID, VOID, VOID, KotlinTypeDefinitionEmitter$emit$lambda_0(this)), 1);
161
+ }
162
+ function emit_3(_this__u8e3s4) {
163
+ return this.i26(_this__u8e3s4.o24_1) + ': ' + this.j25(_this__u8e3s4.p24_1);
164
+ }
165
+ function emit_4(_this__u8e3s4) {
166
+ // Inline function 'kotlin.let' call
167
+ var tmp;
168
+ if (_this__u8e3s4 instanceof Dict) {
169
+ tmp = 'Map<String, ' + this.j25(_this__u8e3s4.u23_1) + '>';
170
+ } else {
171
+ if (_this__u8e3s4 instanceof Iterable) {
172
+ tmp = 'List<' + this.j25(_this__u8e3s4.r23_1) + '>';
173
+ } else {
174
+ if (_this__u8e3s4 instanceof Unit) {
175
+ tmp = 'Unit';
176
+ } else {
177
+ if (_this__u8e3s4 instanceof Any) {
178
+ tmp = 'Any';
179
+ } else {
180
+ if (_this__u8e3s4 instanceof Custom) {
181
+ tmp = _this__u8e3s4.c29_1;
182
+ } else {
183
+ if (_this__u8e3s4 instanceof Primitive) {
184
+ var t = _this__u8e3s4.g29_1;
185
+ var tmp_0;
186
+ if (t instanceof String_0) {
187
+ tmp_0 = 'String';
188
+ } else {
189
+ if (t instanceof Integer) {
190
+ var tmp_1;
191
+ switch (t.l28_1.r2_1) {
192
+ case 0:
193
+ tmp_1 = 'Int';
194
+ break;
195
+ case 1:
196
+ tmp_1 = 'Long';
197
+ break;
198
+ default:
199
+ noWhenBranchMatchedException();
200
+ break;
201
+ }
202
+ tmp_0 = tmp_1;
203
+ } else {
204
+ if (t instanceof Number_0) {
205
+ var tmp_2;
206
+ switch (t.o28_1.r2_1) {
207
+ case 0:
208
+ tmp_2 = 'Float';
209
+ break;
210
+ case 1:
211
+ tmp_2 = 'Double';
212
+ break;
213
+ default:
214
+ noWhenBranchMatchedException();
215
+ break;
216
+ }
217
+ tmp_0 = tmp_2;
218
+ } else {
219
+ if (t instanceof Boolean_0) {
220
+ tmp_0 = 'Boolean';
221
+ } else {
222
+ if (t instanceof Bytes) {
223
+ tmp_0 = 'ByteArray';
224
+ } else {
225
+ noWhenBranchMatchedException();
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ tmp = tmp_0;
232
+ } else {
233
+ noWhenBranchMatchedException();
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+ // Inline function 'kotlin.contracts.contract' call
241
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinTypeDefinitionEmitter.emit.<anonymous>' call
242
+ var it = tmp;
243
+ return _this__u8e3s4.jm() ? it + '?' : it;
244
+ }
245
+ function emit_5(_this__u8e3s4) {
246
+ var tmp;
247
+ if (_this__u8e3s4 instanceof RegExp_0) {
248
+ tmp = 'Regex("""' + this.l25(_this__u8e3s4.g28_1) + '""").matches(value)';
249
+ } else {
250
+ if (_this__u8e3s4 instanceof Bound) {
251
+ tmp = Spacer_instance.toString() + _this__u8e3s4.h28_1 + ' < record.value < ' + _this__u8e3s4.i28_1 + ';';
252
+ } else {
253
+ noWhenBranchMatchedException();
254
+ }
255
+ }
256
+ return tmp;
257
+ }
258
+ initMetadataForInterface(KotlinTypeDefinitionEmitter, 'KotlinTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, KotlinIdentifierEmitter]);
259
+ function emit_6(channel) {
260
+ return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |interface ' + this.i26(channel.d24_1) + 'Channel {\n | operator fun invoke(message: ' + this.j25(channel.e24_1) + ')\n |}\n |\n ');
261
+ }
262
+ initMetadataForInterface(KotlinChannelDefinitionEmitter, 'KotlinChannelDefinitionEmitter', VOID, VOID, [KotlinTypeDefinitionEmitter]);
263
+ function emit_7(enum_0, module_0) {
264
+ var tmp = this.i2a(enum_0.q26_1);
265
+ return trimMargin('\n |enum class ' + tmp + ' (override val label: String): Wirespec.Enum {\n |' + spacer(joinToString(enum_0.r26_1, ',\n', VOID, VOID, VOID, VOID, KotlinEnumDefinitionEmitter$emit$lambda(this))) + ';\n |' + Spacer_instance.toString() + 'override fun toString(): String {\n |' + Spacer_instance.a27(2) + 'return label\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
266
+ }
267
+ function sanitizeEnum(_this__u8e3s4) {
268
+ return this.j2a(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'));
269
+ }
270
+ initMetadataForInterface(KotlinEnumDefinitionEmitter, 'KotlinEnumDefinitionEmitter', VOID, VOID, [KotlinIdentifierEmitter]);
271
+ function emit_8(union) {
272
+ return trimMargin('\n |sealed interface ' + this.i26(union.g24_1) + '\n |\n ');
273
+ }
274
+ initMetadataForInterface(KotlinUnionDefinitionEmitter, 'KotlinUnionDefinitionEmitter', VOID, VOID, [KotlinIdentifierEmitter]);
275
+ function emit_9(refined) {
276
+ return trimMargin('\n |data class ' + this.i2a(refined.m26_1) + '(override val value: String): Wirespec.Refined {\n |' + Spacer_instance.toString() + 'override fun toString() = value\n |}\n |\n |fun ' + refined.m26_1.b1() + '.validate() = ' + this.u26(refined) + '\n |\n ');
277
+ }
278
+ function emitValidator(_this__u8e3s4) {
279
+ var defaultReturn = 'true';
280
+ var type = _this__u8e3s4.n26_1.g29_1;
281
+ var tmp;
282
+ if (type instanceof Integer) {
283
+ var tmp0_safe_receiver = type.m28_1;
284
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.k25(tmp0_safe_receiver);
285
+ tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
286
+ } else {
287
+ if (type instanceof Number_0) {
288
+ var tmp2_safe_receiver = type.p28_1;
289
+ var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.k25(tmp2_safe_receiver);
290
+ tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
291
+ } else {
292
+ if (type instanceof String_0) {
293
+ var tmp4_safe_receiver = type.j28_1;
294
+ var tmp_0;
295
+ var tmp_1 = tmp4_safe_receiver;
296
+ if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
297
+ tmp_0 = null;
298
+ } else {
299
+ tmp_0 = this.k25(new RegExp_0(tmp4_safe_receiver));
300
+ }
301
+ var tmp5_elvis_lhs = tmp_0;
302
+ tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
303
+ } else {
304
+ if (equals(type, Boolean_instance)) {
305
+ tmp = defaultReturn;
306
+ } else {
307
+ if (equals(type, Bytes_instance)) {
308
+ tmp = defaultReturn;
309
+ } else {
310
+ noWhenBranchMatchedException();
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+ return tmp;
317
+ }
318
+ initMetadataForInterface(KotlinRefinedTypeDefinitionEmitter, 'KotlinRefinedTypeDefinitionEmitter', VOID, VOID, [KotlinIdentifierEmitter, KotlinTypeDefinitionEmitter]);
319
+ function emit_10(endpoint) {
320
+ // Inline function 'kotlin.collections.map' call
321
+ var this_0 = importReferences(endpoint);
322
+ // Inline function 'kotlin.collections.mapTo' call
323
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
324
+ var tmp0_iterator = this_0.g();
325
+ while (tmp0_iterator.h()) {
326
+ var item = tmp0_iterator.i();
327
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emit.<anonymous>' call
328
+ var tmp$ret$0 = 'import ' + this.h2a().w26_1 + '.model.' + item.c29_1;
329
+ destination.e(tmp$ret$0);
330
+ }
331
+ var tmp = destination;
332
+ var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda);
333
+ var tmp_1 = this.i26(endpoint.r24_1);
334
+ var tmp_2 = get_pathParams(endpoint);
335
+ var tmp_3 = emitObject$default(tmp_2, this, 'Path', 'Wirespec.Path', VOID, KotlinEndpointDefinitionEmitter$emit$lambda_0(this));
336
+ var tmp_4 = emitObject$default(endpoint.u24_1, this, 'Queries', 'Wirespec.Queries', VOID, KotlinEndpointDefinitionEmitter$emit$lambda_1(this));
337
+ var tmp_5 = emitObject$default(endpoint.v24_1, this, 'Headers', 'Wirespec.Request.Headers', VOID, KotlinEndpointDefinitionEmitter$emit$lambda_2(this));
338
+ var tmp_6 = this.u2a(first(endpoint.w24_1), endpoint);
339
+ var tmp_7 = Spacer_instance.toString();
340
+ var tmp_8 = emitStatusInterfaces(endpoint, this);
341
+ var tmp_9 = emitResponseInterfaces(endpoint, this);
342
+ var tmp_10 = distinctByStatus(endpoint.x24_1);
343
+ var tmp_11 = joinToString(tmp_10, '\n\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_3(this));
344
+ var tmp_12 = Spacer_instance.toString();
345
+ var tmp_13 = Spacer_instance.a27(2);
346
+ var tmp_14 = distinctByStatus(endpoint.x24_1);
347
+ var tmp_15 = joinToString(tmp_14, '\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_4(this));
348
+ var tmp_16 = Spacer_instance.a27(2);
349
+ var tmp_17 = Spacer_instance.toString();
350
+ var tmp_18 = Spacer_instance.a27(2);
351
+ // Inline function 'kotlin.collections.filter' call
352
+ // Inline function 'kotlin.collections.filterTo' call
353
+ var this_1 = distinctByStatus(endpoint.x24_1);
354
+ var destination_0 = ArrayList_init_$Create$();
355
+ var tmp0_iterator_0 = this_1.g();
356
+ while (tmp0_iterator_0.h()) {
357
+ var element = tmp0_iterator_0.i();
358
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emit.<anonymous>' call
359
+ if (Companion_instance_1.d26(element.d25_1)) {
360
+ destination_0.e(element);
361
+ }
362
+ }
363
+ var tmp_19 = destination_0;
364
+ var tmp_20 = joinToString(tmp_19, '\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_5(this));
365
+ var tmp_21 = Spacer_instance.a27(3);
366
+ var tmp_22 = Spacer_instance.a27(2);
367
+ var tmp_23 = Spacer_instance.toString();
368
+ var tmp_24 = Spacer_instance.a27(2);
369
+ var tmp_25 = this.w2a(endpoint);
370
+ var tmp_26 = Spacer_instance.a27(2);
371
+ var tmp_27 = Spacer_instance.a27(3);
372
+ return trimMargin('\n |' + tmp_0 + '\n |\n |object ' + tmp_1 + ' : Wirespec.Endpoint {\n |' + tmp_3 + '\n |\n |' + tmp_4 + '\n |\n |' + tmp_5 + '\n |\n |' + tmp_6 + '\n |\n |' + tmp_7 + 'sealed interface Response<T: Any> : Wirespec.Response<T>\n |\n |' + tmp_8 + '\n |\n |' + tmp_9 + '\n |\n |' + tmp_11 + '\n |\n |' + tmp_12 + 'fun toResponse(serialization: Wirespec.Serializer<String>, response: Response<*>): Wirespec.RawResponse =\n |' + tmp_13 + 'when(response) {\n |' + tmp_15 + '\n |' + tmp_16 + '}\n |\n |' + tmp_17 + 'fun fromResponse(serialization: Wirespec.Deserializer<String>, response: Wirespec.RawResponse): Response<*> =\n |' + tmp_18 + 'when (response.statusCode) {\n |' + tmp_20 + '\n |' + tmp_21 + 'else -> error("Cannot match response with status: ${response.statusCode}")\n |' + tmp_22 + '}\n |\n |' + tmp_23 + 'interface Handler: Wirespec.Handler {\n |' + tmp_24 + tmp_25 + '\n |' + tmp_26 + 'companion object: Wirespec.Server<Request, Response<*>>, Wirespec.Client<Request, Response<*>> {\n |' + tmp_27 + 'override val pathTemplate = "/' + joinToString(endpoint.t24_1, '/', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_6) + '"\n |' + Spacer_instance.a27(3) + 'override val method = "' + endpoint.s24_1.toString() + '"\n |' + Spacer_instance.a27(3) + 'override fun server(serialization: Wirespec.Serialization<String>) = object : Wirespec.ServerEdge<Request, Response<*>> {\n |' + Spacer_instance.a27(4) + 'override fun from(request: Wirespec.RawRequest) = fromRequest(serialization, request)\n |' + Spacer_instance.a27(4) + 'override fun to(response: Response<*>) = toResponse(serialization, response)\n |' + Spacer_instance.a27(3) + '}\n |' + Spacer_instance.a27(3) + 'override fun client(serialization: Wirespec.Serialization<String>) = object : Wirespec.ClientEdge<Request, Response<*>> {\n |' + Spacer_instance.a27(4) + 'override fun to(request: Request) = toRequest(serialization, request)\n |' + Spacer_instance.a27(4) + 'override fun from(response: Wirespec.RawResponse) = fromResponse(serialization, response)\n |' + Spacer_instance.a27(3) + '}\n |' + Spacer_instance.a27(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
373
+ }
374
+ function emitHandleFunction(endpoint) {
375
+ return 'suspend fun ' + Companion_instance_1.b26(this.i26(endpoint.r24_1)) + '(request: Request): Response<*>';
376
+ }
377
+ function emit_11(_this__u8e3s4, endpoint) {
378
+ var tmp = Spacer_instance.toString();
379
+ var tmp_0 = emitConstructor(_this__u8e3s4, this, endpoint);
380
+ var tmp_1 = Spacer_instance.a27(2);
381
+ var tmp_2 = get_pathParams(endpoint);
382
+ var tmp_3 = brace(joinToString(tmp_2, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_7(this)), this);
383
+ var tmp_4 = Spacer_instance.a27(2);
384
+ var tmp_5 = Spacer_instance.a27(2);
385
+ var tmp_6 = brace(joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_8(this)), this);
386
+ var tmp_7 = Spacer_instance.a27(2);
387
+ var tmp_8 = brace(joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_9(this)), this);
388
+ var tmp_9 = _this__u8e3s4.a25_1 == null ? '\n' + Spacer_instance.a27(2) + 'override val body = Unit' : '';
389
+ var tmp_10 = Spacer_instance.toString();
390
+ var tmp_11 = Spacer_instance.toString();
391
+ var tmp_12 = Spacer_instance.a27(2);
392
+ var tmp_13 = Spacer_instance.a27(3);
393
+ var tmp_14 = joinToString(endpoint.t24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_10(this));
394
+ var tmp_15 = Spacer_instance.a27(3);
395
+ var tmp_16 = Spacer_instance.a27(3);
396
+ var tmp_17;
397
+ // Inline function 'kotlin.collections.isNotEmpty' call
398
+ if (!endpoint.u24_1.l()) {
399
+ tmp_17 = joinToString(endpoint.u24_1, ' + ', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_11(this));
400
+ } else {
401
+ tmp_17 = 'emptyMap()';
402
+ }
403
+ var tmp_18 = tmp_17;
404
+ var tmp_19 = Spacer_instance.a27(3);
405
+ var tmp_20;
406
+ // Inline function 'kotlin.collections.isNotEmpty' call
407
+ if (!endpoint.v24_1.l()) {
408
+ tmp_20 = joinToString(endpoint.v24_1, ' + ', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_12(this));
409
+ } else {
410
+ tmp_20 = 'emptyMap()';
411
+ }
412
+ return trimMargin('\n |' + tmp + tmp_0 + '\n |' + tmp_1 + 'override val path = Path' + tmp_3 + '\n |' + tmp_4 + 'override val method = Wirespec.Method.' + endpoint.s24_1.q2_1 + '\n |' + tmp_5 + 'override val queries = Queries' + tmp_6 + '\n |' + tmp_7 + 'override val headers = Headers' + tmp_8 + tmp_9 + '\n |' + tmp_10 + '}\n |\n |' + tmp_11 + 'fun toRequest(serialization: Wirespec.Serializer<String>, request: Request): Wirespec.RawRequest =\n |' + tmp_12 + 'Wirespec.RawRequest(\n |' + tmp_13 + 'path = listOf(' + tmp_14 + '),\n |' + tmp_15 + 'method = request.method.name,\n |' + tmp_16 + 'queries = ' + tmp_18 + ',\n |' + tmp_19 + 'headers = ' + tmp_20 + ',\n |' + Spacer_instance.a27(3) + 'body = ' + (!(_this__u8e3s4.a25_1 == null) ? 'serialization.serialize(request.body, typeOf<' + emit_13(_this__u8e3s4.a25_1, this) + '>())' : 'null') + ',\n |' + Spacer_instance.a27(2) + ')\n |\n |' + Spacer_instance.toString() + 'fun fromRequest(serialization: Wirespec.Deserializer<String>, request: Wirespec.RawRequest): Request =\n |' + Spacer_instance.a27(2) + 'Request' + emitDeserializedParams(_this__u8e3s4, this, endpoint) + '\n ');
413
+ }
414
+ function emit_12(_this__u8e3s4) {
415
+ var tmp = Spacer_instance.toString();
416
+ var tmp_0 = emit_13(_this__u8e3s4.f25_1, this);
417
+ // Inline function 'kotlin.let' call
418
+ // Inline function 'kotlin.contracts.contract' call
419
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emit.<anonymous>' call
420
+ var it = joinToString(_this__u8e3s4.e25_1, ', ', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_13(this));
421
+ var tmp_1 = isBlank(it) ? '' : ', ' + it;
422
+ var tmp_2 = toString_0(charSequenceGet(_this__u8e3s4.d25_1, 0));
423
+ var tmp_3 = emit_13(_this__u8e3s4.f25_1, this);
424
+ var tmp_4 = concatGenerics(emit_13(_this__u8e3s4.f25_1, this));
425
+ var tmp_5 = Spacer_instance.a27(2);
426
+ var tmp_6 = fixStatus(_this__u8e3s4.d25_1);
427
+ var tmp_7 = Spacer_instance.a27(2);
428
+ var tmp_8 = brace(joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emit$lambda_14(this)), this);
429
+ return trimMargin('\n |' + tmp + 'data class Response' + _this__u8e3s4.d25_1 + '(override val body: ' + tmp_0 + tmp_1 + ') : Response' + tmp_2 + 'XX<' + tmp_3 + '>, Response' + tmp_4 + ' {\n |' + tmp_5 + 'override val status = ' + tmp_6 + '\n |' + tmp_7 + 'override val headers = ResponseHeaders' + tmp_8 + '\n |' + emitObject(_this__u8e3s4.e25_1, this, 'ResponseHeaders', 'Wirespec.Response.Headers', 2, KotlinEndpointDefinitionEmitter$emit$lambda_15(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
430
+ }
431
+ initMetadataForInterface(KotlinEndpointDefinitionEmitter, 'KotlinEndpointDefinitionEmitter', VOID, VOID, [KotlinTypeDefinitionEmitter]);
432
+ initMetadataForClass(KotlinEmitter, 'KotlinEmitter', KotlinEmitter, LanguageEmitter, [LanguageEmitter, KotlinChannelDefinitionEmitter, KotlinEnumDefinitionEmitter, KotlinTypeDefinitionEmitter, KotlinIdentifierEmitter, KotlinUnionDefinitionEmitter, KotlinRefinedTypeDefinitionEmitter, KotlinEndpointDefinitionEmitter]);
76
433
  initMetadataForCompanion(Companion);
77
- initMetadataForClass(KotlinEmitter, 'KotlinEmitter', KotlinEmitter, Emitter);
78
434
  initMetadataForObject(KotlinShared, 'KotlinShared');
79
435
  //endregion
80
436
  function emitImports(_this__u8e3s4, $this) {
81
437
  // Inline function 'kotlin.collections.map' call
82
438
  // Inline function 'kotlin.collections.filter' call
83
439
  // Inline function 'kotlin.collections.filterTo' call
84
- var this_0 = $this.i26(_this__u8e3s4);
440
+ var this_0 = importReferences(_this__u8e3s4);
85
441
  var destination = ArrayList_init_$Create$();
86
442
  var tmp0_iterator = this_0.g();
87
443
  while (tmp0_iterator.h()) {
88
444
  var element = tmp0_iterator.i();
89
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitImports.<anonymous>' call
90
- if (!(_this__u8e3s4.m24().b1() === element.h29_1)) {
445
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinChannelDefinitionEmitter.emitImports.<anonymous>' call
446
+ if (!(_this__u8e3s4.g26().b1() === element.c29_1)) {
91
447
  destination.e(element);
92
448
  }
93
449
  }
@@ -96,147 +452,181 @@ function emitImports(_this__u8e3s4, $this) {
96
452
  var tmp0_iterator_0 = destination.g();
97
453
  while (tmp0_iterator_0.h()) {
98
454
  var item = tmp0_iterator_0.i();
99
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitImports.<anonymous>' call
100
- var tmp$ret$3 = 'import ' + $this.m2a_1.b27_1 + '.model.' + item.h29_1 + ';';
455
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinChannelDefinitionEmitter.emitImports.<anonymous>' call
456
+ var tmp$ret$3 = 'import ' + $this.h2a().w26_1 + '.model.' + item.c29_1 + ';';
101
457
  destination_0.e(tmp$ret$3);
102
458
  }
103
459
  var tmp = destination_0;
104
- return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitImports$lambda);
460
+ return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinChannelDefinitionEmitter$emitImports$lambda);
461
+ }
462
+ function KotlinChannelDefinitionEmitter$emitImports$lambda(it) {
463
+ // Inline function 'kotlin.text.trimStart' call
464
+ return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
465
+ }
466
+ function KotlinChannelDefinitionEmitter() {
105
467
  }
468
+ function KotlinEmitter(packageName, emitShared) {
469
+ packageName = packageName === VOID ? Companion_instance.v26('community.flock.wirespec.generated') : packageName;
470
+ emitShared = emitShared === VOID ? Companion_instance_0.y23() : emitShared;
471
+ LanguageEmitter.call(this);
472
+ this.l2a_1 = packageName;
473
+ this.m2a_1 = emitShared;
474
+ this.n2a_1 = '\nimport community.flock.wirespec.kotlin.Wirespec\nimport kotlin.reflect.typeOf\n';
475
+ this.o2a_1 = FileExtension_Kotlin_getInstance();
476
+ this.p2a_1 = KotlinShared_getInstance();
477
+ this.q2a_1 = '//';
478
+ }
479
+ protoOf(KotlinEmitter).h2a = function () {
480
+ return this.l2a_1;
481
+ };
482
+ protoOf(KotlinEmitter).q25 = function () {
483
+ return this.o2a_1;
484
+ };
485
+ protoOf(KotlinEmitter).r2a = function () {
486
+ return this.p2a_1;
487
+ };
488
+ protoOf(KotlinEmitter).r25 = function () {
489
+ return this.q2a_1;
490
+ };
491
+ protoOf(KotlinEmitter).e26 = function (module_0, logger) {
492
+ // Inline function 'kotlin.let' call
493
+ // Inline function 'kotlin.contracts.contract' call
494
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
495
+ var it = protoOf(LanguageEmitter).e26.call(this, module_0, logger);
496
+ return this.m2a_1.z23_1 ? it.vk(new Emitted(Companion_instance.v26('community.flock.wirespec.kotlin').y26() + 'Wirespec', this.r2a().t2a_1)) : it;
497
+ };
498
+ protoOf(KotlinEmitter).f26 = function (definition, module_0, logger) {
499
+ // Inline function 'kotlin.let' call
500
+ // Inline function 'kotlin.contracts.contract' call
501
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
502
+ var it = protoOf(LanguageEmitter).f26.call(this, definition, module_0, logger);
503
+ var subPackageName = plus(this.h2a(), definition);
504
+ var tmp = subPackageName.y26() + it.a24_1;
505
+ // Inline function 'kotlin.text.trimStart' call
506
+ var this_0 = trimMargin('\n |package ' + subPackageName.toString() + '\n |' + (Companion_instance_1.c26(module_0) ? this.n2a_1 : '') + '\n |' + it.b24_1 + '\n ');
507
+ var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
508
+ return new Emitted(tmp, tmp$ret$0);
509
+ };
106
510
  function emitStatusInterfaces(_this__u8e3s4, $this) {
107
511
  // Inline function 'kotlin.collections.map' call
108
- var this_0 = _this__u8e3s4.n25_1;
512
+ var this_0 = _this__u8e3s4.x24_1;
109
513
  // Inline function 'kotlin.collections.mapTo' call
110
514
  var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
111
515
  var tmp0_iterator = this_0.g();
112
516
  while (tmp0_iterator.h()) {
113
517
  var item = tmp0_iterator.i();
114
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitStatusInterfaces.<anonymous>' call
115
- var tmp$ret$0 = new Char(charSequenceGet(item.r26_1, 0));
518
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitStatusInterfaces.<anonymous>' call
519
+ var tmp$ret$0 = new Char(charSequenceGet(item.d25_1, 0));
116
520
  destination.e(tmp$ret$0);
117
521
  }
118
522
  var tmp = distinct(destination);
119
- return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitStatusInterfaces$lambda);
523
+ return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitStatusInterfaces$lambda);
120
524
  }
121
525
  function emitResponseInterfaces(_this__u8e3s4, $this) {
122
526
  // Inline function 'kotlin.collections.map' call
123
- var this_0 = _this__u8e3s4.n25_1;
527
+ var this_0 = _this__u8e3s4.x24_1;
124
528
  // Inline function 'kotlin.collections.mapTo' call
125
529
  var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
126
530
  var tmp0_iterator = this_0.g();
127
531
  while (tmp0_iterator.h()) {
128
532
  var item = tmp0_iterator.i();
129
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitResponseInterfaces.<anonymous>' call
130
- var tmp$ret$0 = emit(item.t26_1, $this);
533
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitResponseInterfaces.<anonymous>' call
534
+ var tmp$ret$0 = emit_13(item.f25_1, $this);
131
535
  destination.e(tmp$ret$0);
132
536
  }
133
537
  var tmp = distinct(destination);
134
- return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitResponseInterfaces$lambda);
135
- }
136
- function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
137
- var tmp;
138
- if (_this__u8e3s4.l()) {
139
- tmp = Spacer_instance.i27(spaces) + 'data object ' + name + ' : ' + extends_0;
140
- } else {
141
- var tmp_0 = Spacer_instance.i27(spaces);
142
- tmp = trimMargin('\n |' + tmp_0 + 'data class ' + name + '(\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitObject$lambda(spaces, block)) + ',\n |' + Spacer_instance.i27(spaces) + ') : ' + extends_0 + '\n ');
143
- }
144
- return tmp;
145
- }
146
- function emitObject$default(_this__u8e3s4, $this, name, extends_0, spaces, block, $super) {
147
- spaces = spaces === VOID ? 1 : spaces;
148
- return emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block);
538
+ return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitResponseInterfaces$lambda);
149
539
  }
150
540
  function emitConstructor(_this__u8e3s4, $this, endpoint) {
151
541
  // Inline function 'kotlin.let' call
152
- var tmp = $this.d26(endpoint);
153
- var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda($this)));
154
- var tmp_1 = orNull(joinToString(endpoint.k25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda_0($this)));
155
- var tmp_2 = orNull(joinToString(endpoint.l25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda_1($this)));
156
- var tmp0_safe_receiver = _this__u8e3s4.x26_1;
542
+ var tmp = get_pathParams(endpoint);
543
+ var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitConstructor$lambda($this)));
544
+ var tmp_1 = orNull(joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitConstructor$lambda_0($this)));
545
+ var tmp_2 = orNull(joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitConstructor$lambda_1($this)));
546
+ var tmp0_safe_receiver = _this__u8e3s4.a25_1;
157
547
  var tmp_3;
158
548
  if (tmp0_safe_receiver == null) {
159
549
  tmp_3 = null;
160
550
  } else {
161
551
  // Inline function 'kotlin.let' call
162
552
  // Inline function 'kotlin.contracts.contract' call
163
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitConstructor.<anonymous>' call
164
- tmp_3 = Spacer_instance.i27(2) + 'override val body: ' + emit(tmp0_safe_receiver, $this) + ',';
553
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
554
+ tmp_3 = Spacer_instance.a27(2) + 'override val body: ' + emit_13(tmp0_safe_receiver, $this) + ',';
165
555
  }
166
556
  // Inline function 'kotlin.contracts.contract' call
167
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitConstructor.<anonymous>' call
557
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
168
558
  var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
169
- return isBlank(it) ? 'object Request : Wirespec.Request<' + emit(_this__u8e3s4.x26_1, $this) + '> {' : 'class Request(\n' + it + '\n' + Spacer_instance.toString() + ') : Wirespec.Request<' + emit(_this__u8e3s4.x26_1, $this) + '> {';
559
+ return isBlank(it) ? 'object Request : Wirespec.Request<' + emit_13(_this__u8e3s4.a25_1, $this) + '> {' : 'class Request(\n' + it + '\n' + Spacer_instance.toString() + ') : Wirespec.Request<' + emit_13(_this__u8e3s4.a25_1, $this) + '> {';
170
560
  }
171
561
  function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
172
562
  // Inline function 'kotlin.let' call
173
- var tmp = $this.j26(endpoint);
174
- var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda($this)));
175
- var tmp_1 = orNull(joinToString(endpoint.k25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda_0($this)));
176
- var tmp_2 = orNull(joinToString(endpoint.l25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda_1($this)));
177
- var tmp0_safe_receiver = _this__u8e3s4.x26_1;
563
+ var tmp = get_indexedPathParams(endpoint);
564
+ var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda($this)));
565
+ var tmp_1 = orNull(joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda_0($this)));
566
+ var tmp_2 = orNull(joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda_1($this)));
567
+ var tmp0_safe_receiver = _this__u8e3s4.a25_1;
178
568
  var tmp_3;
179
569
  if (tmp0_safe_receiver == null) {
180
570
  tmp_3 = null;
181
571
  } else {
182
572
  // Inline function 'kotlin.let' call
183
573
  // Inline function 'kotlin.contracts.contract' call
184
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitDeserializedParams.<anonymous>' call
185
- tmp_3 = Spacer_instance.i27(3) + 'body = serialization.deserialize(requireNotNull(request.body) { "body is null" }, typeOf<' + emit(tmp0_safe_receiver, $this) + '>()),';
574
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
575
+ tmp_3 = Spacer_instance.a27(3) + 'body = serialization.deserialize(requireNotNull(request.body) { "body is null" }, typeOf<' + emit_13(tmp0_safe_receiver, $this) + '>()),';
186
576
  }
187
577
  // Inline function 'kotlin.contracts.contract' call
188
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitDeserializedParams.<anonymous>' call
578
+ // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
189
579
  var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
190
- return isBlank(it) ? '' : '(\n' + it + '\n' + Spacer_instance.i27(2) + ')';
580
+ return isBlank(it) ? '' : '(\n' + it + '\n' + Spacer_instance.a27(2) + ')';
191
581
  }
192
582
  function emitSerialized(_this__u8e3s4, $this) {
193
- var tmp = Spacer_instance.i27(3);
194
- var tmp_0 = Spacer_instance.i27(4);
195
- var tmp_1 = Spacer_instance.i27(4);
583
+ var tmp = Spacer_instance.a27(3);
584
+ var tmp_0 = Spacer_instance.a27(4);
585
+ var tmp_1 = Spacer_instance.a27(4);
196
586
  var tmp_2;
197
587
  // Inline function 'kotlin.collections.isNotEmpty' call
198
- if (!_this__u8e3s4.s26_1.l()) {
199
- tmp_2 = joinToString(_this__u8e3s4.s26_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emitSerialized$lambda($this));
588
+ if (!_this__u8e3s4.e25_1.l()) {
589
+ tmp_2 = joinToString(_this__u8e3s4.e25_1, ' + ', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitSerialized$lambda($this));
200
590
  } else {
201
591
  tmp_2 = 'emptyMap()';
202
592
  }
203
- return trimMargin('\n |' + tmp + 'is Response' + _this__u8e3s4.r26_1 + ' -> Wirespec.RawResponse(\n |' + tmp_0 + 'statusCode = response.status,\n |' + tmp_1 + 'headers = ' + tmp_2 + ',\n |' + Spacer_instance.i27(4) + 'body = ' + (!(_this__u8e3s4.t26_1 == null) ? 'serialization.serialize(response.body, typeOf<' + emit(_this__u8e3s4.t26_1, $this) + '>())' : 'null') + ',\n |' + Spacer_instance.i27(3) + ')\n ');
593
+ return trimMargin('\n |' + tmp + 'is Response' + _this__u8e3s4.d25_1 + ' -> Wirespec.RawResponse(\n |' + tmp_0 + 'statusCode = response.status,\n |' + tmp_1 + 'headers = ' + tmp_2 + ',\n |' + Spacer_instance.a27(4) + 'body = ' + (!(_this__u8e3s4.f25_1 == null) ? 'serialization.serialize(response.body, typeOf<' + emit_13(_this__u8e3s4.f25_1, $this) + '>())' : 'null') + ',\n |' + Spacer_instance.a27(3) + ')\n ');
204
594
  }
205
595
  function emitDeserialized(_this__u8e3s4, $this) {
206
- var tmp = Spacer_instance.i27(3) + _this__u8e3s4.r26_1 + ' -> Response' + _this__u8e3s4.r26_1 + '(';
596
+ var tmp = Spacer_instance.a27(3) + _this__u8e3s4.d25_1 + ' -> Response' + _this__u8e3s4.d25_1 + '(';
207
597
  var tmp_0;
208
- if (!(_this__u8e3s4.t26_1 == null)) {
209
- tmp_0 = Spacer_instance.i27(4) + 'body = serialization.deserialize(requireNotNull(response.body) { "body is null" }, typeOf<' + emit(_this__u8e3s4.t26_1, $this) + '>()),';
598
+ if (!(_this__u8e3s4.f25_1 == null)) {
599
+ tmp_0 = Spacer_instance.a27(4) + 'body = serialization.deserialize(requireNotNull(response.body) { "body is null" }, typeOf<' + emit_13(_this__u8e3s4.f25_1, $this) + '>()),';
210
600
  } else {
211
- tmp_0 = Spacer_instance.i27(4) + 'body = Unit,';
601
+ tmp_0 = Spacer_instance.a27(4) + 'body = Unit,';
212
602
  }
213
603
  var tmp_1 = tmp_0;
214
- return joinToString(listOfNotNull([tmp, tmp_1, orNull(joinToString(_this__u8e3s4.s26_1, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserialized$lambda($this))), Spacer_instance.i27(3) + ')']), '\n');
604
+ return joinToString(listOfNotNull([tmp, tmp_1, orNull(joinToString(_this__u8e3s4.e25_1, ',\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitDeserialized$lambda($this))), Spacer_instance.a27(3) + ')']), '\n');
215
605
  }
216
606
  function emitSerializedParams(_this__u8e3s4, $this, type, fields) {
217
- return 'mapOf("' + _this__u8e3s4.v26_1.b1() + '" to (' + type + '.' + fields + '.' + $this.s24(_this__u8e3s4.v26_1) + '?.let{ serialization.serializeParam(it, typeOf<' + $this.w25(_this__u8e3s4.w26_1) + '>()) } ?: emptyList()))';
607
+ return 'mapOf("' + _this__u8e3s4.o24_1.b1() + '" to (' + type + '.' + fields + '.' + $this.i26(_this__u8e3s4.o24_1) + '?.let{ serialization.serializeParam(it, typeOf<' + $this.j25(_this__u8e3s4.p24_1) + '>()) } ?: emptyList()))';
218
608
  }
219
609
  function emitDeserialized_0(_this__u8e3s4, $this) {
220
- return Spacer_instance.i27(3) + $this.s24(_this__u8e3s4.rd_1.o26_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], typeOf<' + $this.w25(_this__u8e3s4.rd_1.p26_1) + '>())';
610
+ return Spacer_instance.a27(3) + $this.i26(_this__u8e3s4.rd_1.y24_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], typeOf<' + $this.j25(_this__u8e3s4.rd_1.z24_1) + '>())';
221
611
  }
222
612
  function emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces) {
223
- return _this__u8e3s4.w26_1.hm() ? Spacer_instance.i27(spaces) + $this.s24(_this__u8e3s4.v26_1) + ' = ' + type + '.' + fields + '["' + _this__u8e3s4.v26_1.b1() + '"]?.let{ serialization.deserializeParam(it, typeOf<' + $this.w25(_this__u8e3s4.w26_1) + '>()) }' : Spacer_instance.i27(spaces) + $this.s24(_this__u8e3s4.v26_1) + ' = serialization.deserializeParam(requireNotNull(' + type + '.' + fields + '["' + _this__u8e3s4.v26_1.b1() + '"]) { "' + $this.s24(_this__u8e3s4.v26_1) + ' is null" }, typeOf<' + $this.w25(_this__u8e3s4.w26_1) + '>())';
613
+ return _this__u8e3s4.p24_1.jm() ? Spacer_instance.a27(spaces) + $this.i26(_this__u8e3s4.o24_1) + ' = ' + type + '.' + fields + '["' + _this__u8e3s4.o24_1.b1() + '"]?.let{ serialization.deserializeParam(it, typeOf<' + $this.j25(_this__u8e3s4.p24_1) + '>()) }' : Spacer_instance.a27(spaces) + $this.i26(_this__u8e3s4.o24_1) + ' = serialization.deserializeParam(requireNotNull(' + type + '.' + fields + '["' + _this__u8e3s4.o24_1.b1() + '"]) { "' + $this.i26(_this__u8e3s4.o24_1) + ' is null" }, typeOf<' + $this.j25(_this__u8e3s4.p24_1) + '>())';
224
614
  }
225
615
  function emitDeserializedParams$default(_this__u8e3s4, $this, type, fields, spaces, $super) {
226
616
  spaces = spaces === VOID ? 3 : spaces;
227
617
  return emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces);
228
618
  }
229
619
  function emitIdentifier(_this__u8e3s4, $this) {
230
- return 'request.path.' + $this.s24(_this__u8e3s4.o26_1) + '.let{serialization.serialize(it, typeOf<' + $this.w25(_this__u8e3s4.p26_1) + '>())}';
620
+ return 'request.path.' + $this.i26(_this__u8e3s4.y24_1) + '.let{serialization.serialize(it, typeOf<' + $this.j25(_this__u8e3s4.z24_1) + '>())}';
231
621
  }
232
- function emit(_this__u8e3s4, $this) {
233
- var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.z26_1;
234
- var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : $this.w25(tmp1_safe_receiver);
622
+ function emit_13(_this__u8e3s4, $this) {
623
+ var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.c25_1;
624
+ var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : $this.j25(tmp1_safe_receiver);
235
625
  var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : removeQuestionMark(tmp2_safe_receiver);
236
626
  return tmp3_elvis_lhs == null ? 'Unit' : tmp3_elvis_lhs;
237
627
  }
238
- function emit_0(_this__u8e3s4, $this) {
239
- return $this.s24(_this__u8e3s4.o26_1) + ': ' + $this.w25(_this__u8e3s4.p26_1);
628
+ function emit_14(_this__u8e3s4, $this) {
629
+ return $this.i26(_this__u8e3s4.y24_1) + ': ' + $this.j25(_this__u8e3s4.z24_1);
240
630
  }
241
631
  function brace(_this__u8e3s4, $this) {
242
632
  return wrap(_this__u8e3s4, $this, '(', ')');
@@ -251,141 +641,83 @@ function wrap(_this__u8e3s4, $this, prefix, postfix) {
251
641
  }
252
642
  return tmp;
253
643
  }
254
- function sanitizeSymbol(_this__u8e3s4, $this) {
255
- // Inline function 'kotlin.collections.mapIndexed' call
256
- var this_0 = split(_this__u8e3s4, ['.', ' ']);
257
- // Inline function 'kotlin.collections.mapIndexedTo' call
258
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
259
- var index = 0;
260
- var tmp0_iterator = this_0.g();
261
- while (tmp0_iterator.h()) {
262
- var item = tmp0_iterator.i();
263
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.sanitizeSymbol.<anonymous>' call
264
- var tmp1 = index;
265
- index = tmp1 + 1 | 0;
266
- var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance.z23(item) : item;
267
- destination.e(tmp$ret$0);
268
- }
269
- var tmp = asSequence(joinToString(destination, ''));
270
- return sanitizeFirstIsDigit(joinToString_0(filter(tmp, KotlinEmitter$sanitizeSymbol$lambda), ''), $this);
271
- }
272
- function sanitizeFirstIsDigit(_this__u8e3s4, $this) {
273
- var tmp;
274
- var tmp0_safe_receiver = firstOrNull(_this__u8e3s4);
275
- var tmp_0;
276
- var tmp_1 = tmp0_safe_receiver;
277
- if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
278
- tmp_0 = null;
279
- } else {
280
- tmp_0 = isDigit(tmp0_safe_receiver);
281
- }
282
- if (tmp_0 === true) {
283
- tmp = '_' + _this__u8e3s4;
284
- } else {
285
- tmp = _this__u8e3s4;
286
- }
287
- return tmp;
288
- }
289
- function Companion() {
290
- Companion_instance_2 = this;
291
- this.s2a_1 = setOf(['as', 'break', 'class', 'continue', 'do', 'else', 'false', 'for', 'fun', 'if', 'in', 'interface', 'internal', 'is', 'null', 'object', 'open', 'package', 'return', 'super', 'this', 'throw', 'true', 'try', 'typealias', 'typeof', 'val', 'var', 'when', 'while', 'private', 'public']);
292
- this.t2a_1 = 'emptyMap()';
293
- }
294
- var Companion_instance_2;
295
- function Companion_getInstance() {
296
- if (Companion_instance_2 == null)
297
- new Companion();
298
- return Companion_instance_2;
299
- }
300
- function KotlinEmitter$emit$lambda(this$0) {
301
- return function (it) {
302
- return this$0.w25(it);
303
- };
304
- }
305
- function KotlinEmitter$emit$lambda_0(this$0) {
306
- return function (it) {
307
- return Spacer_instance.toString() + 'val ' + this$0.v25(it) + ',';
308
- };
309
- }
310
- function KotlinEmitter$emit$lambda_1(this$0) {
311
- return function (it) {
312
- return this$0.v2a(this$0.u2a(it)) + '("' + it + '")';
313
- };
644
+ function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
645
+ var tmp;
646
+ if (_this__u8e3s4.l()) {
647
+ tmp = Spacer_instance.a27(spaces) + 'data object ' + name + ' : ' + extends_0;
648
+ } else {
649
+ var tmp_0 = Spacer_instance.a27(spaces);
650
+ tmp = trimMargin('\n |' + tmp_0 + 'data class ' + name + '(\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, KotlinEndpointDefinitionEmitter$emitObject$lambda(spaces, block)) + ',\n |' + Spacer_instance.a27(spaces) + ') : ' + extends_0 + '\n ');
651
+ }
652
+ return tmp;
314
653
  }
315
- function KotlinEmitter$emitImports$lambda(it) {
316
- // Inline function 'kotlin.text.trimStart' call
317
- return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
654
+ function emitObject$default(_this__u8e3s4, $this, name, extends_0, spaces, block, $super) {
655
+ spaces = spaces === VOID ? 1 : spaces;
656
+ return emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block);
318
657
  }
319
- function KotlinEmitter$emit$lambda_2(it) {
658
+ function KotlinEndpointDefinitionEmitter$emit$lambda(it) {
320
659
  // Inline function 'kotlin.text.trimStart' call
321
660
  return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
322
661
  }
323
- function KotlinEmitter$emit$lambda_3(this$0) {
662
+ function KotlinEndpointDefinitionEmitter$emit$lambda_0(this$0) {
324
663
  return function (it) {
325
- return emit_0(it, this$0);
664
+ return emit_14(it, this$0);
326
665
  };
327
666
  }
328
- function KotlinEmitter$emit$lambda_4(this$0) {
667
+ function KotlinEndpointDefinitionEmitter$emit$lambda_1(this$0) {
329
668
  return function (it) {
330
- return this$0.v25(it);
669
+ return this$0.i25(it);
331
670
  };
332
671
  }
333
- function KotlinEmitter$emit$lambda_5(this$0) {
672
+ function KotlinEndpointDefinitionEmitter$emit$lambda_2(this$0) {
334
673
  return function (it) {
335
- return this$0.v25(it);
674
+ return this$0.i25(it);
336
675
  };
337
676
  }
338
- function KotlinEmitter$emit$lambda_6(this$0) {
677
+ function KotlinEndpointDefinitionEmitter$emit$lambda_3(this$0) {
339
678
  return function (it) {
340
- return this$0.w2a(it);
679
+ return this$0.v2a(it);
341
680
  };
342
681
  }
343
- function KotlinEmitter$emit$lambda_7(this$0) {
682
+ function KotlinEndpointDefinitionEmitter$emit$lambda_4(this$0) {
344
683
  return function (it) {
345
684
  return emitSerialized(it, this$0);
346
685
  };
347
686
  }
348
- function KotlinEmitter$emit$lambda_8(this$0) {
687
+ function KotlinEndpointDefinitionEmitter$emit$lambda_5(this$0) {
349
688
  return function (it) {
350
689
  return emitDeserialized(it, this$0);
351
690
  };
352
691
  }
353
- function KotlinEmitter$emit$lambda_9(this$0) {
354
- return function (it) {
355
- return this$0.y25(it);
356
- };
692
+ function KotlinEndpointDefinitionEmitter$emit$lambda_6(it) {
693
+ return emit(it);
357
694
  }
358
- function KotlinEmitter$emitStatusInterfaces$lambda(it) {
695
+ function KotlinEndpointDefinitionEmitter$emitStatusInterfaces$lambda(it) {
359
696
  return Spacer_instance.toString() + 'sealed interface Response' + toString_0(it.x_1) + 'XX<T: Any> : Response<T>';
360
697
  }
361
- function KotlinEmitter$emitResponseInterfaces$lambda(it) {
698
+ function KotlinEndpointDefinitionEmitter$emitResponseInterfaces$lambda(it) {
362
699
  return Spacer_instance.toString() + 'sealed interface Response' + concatGenerics(it) + ' : Response<' + it + '>';
363
700
  }
364
- function KotlinEmitter$emitObject$lambda($spaces, $block) {
365
- return function (it) {
366
- return Spacer_instance.i27($spaces + 1 | 0) + 'val ' + $block(it);
367
- };
368
- }
369
- function KotlinEmitter$emit$lambda_10(this$0) {
701
+ function KotlinEndpointDefinitionEmitter$emit$lambda_7(this$0) {
370
702
  return function (it) {
371
- return this$0.s24(it.o26_1);
703
+ return this$0.i26(it.y24_1);
372
704
  };
373
705
  }
374
- function KotlinEmitter$emit$lambda_11(this$0) {
706
+ function KotlinEndpointDefinitionEmitter$emit$lambda_8(this$0) {
375
707
  return function (it) {
376
- return this$0.s24(it.v26_1);
708
+ return this$0.i26(it.o24_1);
377
709
  };
378
710
  }
379
- function KotlinEmitter$emit$lambda_12(this$0) {
711
+ function KotlinEndpointDefinitionEmitter$emit$lambda_9(this$0) {
380
712
  return function (it) {
381
- return this$0.s24(it.v26_1);
713
+ return this$0.i26(it.o24_1);
382
714
  };
383
715
  }
384
- function KotlinEmitter$emit$lambda_13(this$0) {
716
+ function KotlinEndpointDefinitionEmitter$emit$lambda_10(this$0) {
385
717
  return function (it) {
386
718
  var tmp;
387
719
  if (it instanceof Literal) {
388
- tmp = '"' + it.q26_1 + '"';
720
+ tmp = '"' + it.t25_1 + '"';
389
721
  } else {
390
722
  if (it instanceof Param) {
391
723
  tmp = emitIdentifier(it, this$0);
@@ -396,423 +728,106 @@ function KotlinEmitter$emit$lambda_13(this$0) {
396
728
  return tmp;
397
729
  };
398
730
  }
399
- function KotlinEmitter$emit$lambda_14(this$0) {
731
+ function KotlinEndpointDefinitionEmitter$emit$lambda_11(this$0) {
400
732
  return function (it) {
401
733
  return '(' + emitSerializedParams(it, this$0, 'request', 'queries') + ')';
402
734
  };
403
735
  }
404
- function KotlinEmitter$emit$lambda_15(this$0) {
736
+ function KotlinEndpointDefinitionEmitter$emit$lambda_12(this$0) {
405
737
  return function (it) {
406
738
  return '(' + emitSerializedParams(it, this$0, 'request', 'headers') + ')';
407
739
  };
408
740
  }
409
- function KotlinEmitter$emit$lambda_16(this$0) {
741
+ function KotlinEndpointDefinitionEmitter$emit$lambda_13(this$0) {
410
742
  return function (it) {
411
- return 'val ' + this$0.v25(it);
743
+ return 'val ' + this$0.i25(it);
412
744
  };
413
745
  }
414
- function KotlinEmitter$emit$lambda_17(this$0) {
746
+ function KotlinEndpointDefinitionEmitter$emit$lambda_14(this$0) {
415
747
  return function (it) {
416
- return this$0.s24(it.v26_1);
748
+ return this$0.i26(it.o24_1);
417
749
  };
418
750
  }
419
- function KotlinEmitter$emit$lambda_18(this$0) {
751
+ function KotlinEndpointDefinitionEmitter$emit$lambda_15(this$0) {
420
752
  return function (it) {
421
- return this$0.v25(it);
753
+ return this$0.i25(it);
422
754
  };
423
755
  }
424
- function KotlinEmitter$emitConstructor$lambda(this$0) {
756
+ function KotlinEndpointDefinitionEmitter$emitConstructor$lambda(this$0) {
425
757
  return function (it) {
426
- return Spacer_instance.i27(2) + emit_0(it, this$0);
758
+ return Spacer_instance.a27(2) + emit_14(it, this$0);
427
759
  };
428
760
  }
429
- function KotlinEmitter$emitConstructor$lambda_0(this$0) {
761
+ function KotlinEndpointDefinitionEmitter$emitConstructor$lambda_0(this$0) {
430
762
  return function (it) {
431
- return Spacer_instance.i27(2) + this$0.v25(it);
763
+ return Spacer_instance.a27(2) + this$0.i25(it);
432
764
  };
433
765
  }
434
- function KotlinEmitter$emitConstructor$lambda_1(this$0) {
766
+ function KotlinEndpointDefinitionEmitter$emitConstructor$lambda_1(this$0) {
435
767
  return function (it) {
436
- return Spacer_instance.i27(2) + this$0.v25(it);
768
+ return Spacer_instance.a27(2) + this$0.i25(it);
437
769
  };
438
770
  }
439
- function KotlinEmitter$emitDeserializedParams$lambda(this$0) {
771
+ function KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda(this$0) {
440
772
  return function (it) {
441
773
  return emitDeserialized_0(it, this$0);
442
774
  };
443
775
  }
444
- function KotlinEmitter$emitDeserializedParams$lambda_0(this$0) {
776
+ function KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda_0(this$0) {
445
777
  return function (it) {
446
778
  return emitDeserializedParams$default(it, this$0, 'request', 'queries');
447
779
  };
448
780
  }
449
- function KotlinEmitter$emitDeserializedParams$lambda_1(this$0) {
781
+ function KotlinEndpointDefinitionEmitter$emitDeserializedParams$lambda_1(this$0) {
450
782
  return function (it) {
451
783
  return emitDeserializedParams$default(it, this$0, 'request', 'headers');
452
784
  };
453
785
  }
454
- function KotlinEmitter$emitSerialized$lambda(this$0) {
786
+ function KotlinEndpointDefinitionEmitter$emitSerialized$lambda(this$0) {
455
787
  return function (it) {
456
788
  return '(' + emitSerializedParams(it, this$0, 'response', 'headers') + ')';
457
789
  };
458
790
  }
459
- function KotlinEmitter$emitDeserialized$lambda(this$0) {
791
+ function KotlinEndpointDefinitionEmitter$emitDeserialized$lambda(this$0) {
460
792
  return function (it) {
461
793
  return emitDeserializedParams_0(it, this$0, 'response', 'headers', 4);
462
794
  };
463
795
  }
464
- function KotlinEmitter$sanitizeSymbol$lambda(it) {
796
+ function KotlinEndpointDefinitionEmitter$emitObject$lambda($spaces, $block) {
797
+ return function (it) {
798
+ return Spacer_instance.a27($spaces + 1 | 0) + 'val ' + $block(it);
799
+ };
800
+ }
801
+ function KotlinEndpointDefinitionEmitter() {
802
+ }
803
+ function KotlinEnumDefinitionEmitter$emit$lambda(this$0) {
804
+ return function (it) {
805
+ return this$0.k2a(this$0.x2a(it)) + '("' + it + '")';
806
+ };
807
+ }
808
+ function KotlinEnumDefinitionEmitter() {
809
+ }
810
+ function Companion() {
811
+ Companion_instance_2 = this;
812
+ this.y2a_1 = setOf(['as', 'break', 'class', 'continue', 'do', 'else', 'false', 'for', 'fun', 'if', 'in', 'interface', 'internal', 'is', 'null', 'object', 'open', 'package', 'return', 'super', 'this', 'throw', 'true', 'try', 'typealias', 'typeof', 'val', 'var', 'when', 'while', 'private', 'public']);
813
+ }
814
+ var Companion_instance_2;
815
+ function Companion_getInstance() {
816
+ if (Companion_instance_2 == null)
817
+ new Companion();
818
+ return Companion_instance_2;
819
+ }
820
+ function KotlinIdentifierEmitter$sanitize$lambda(it) {
465
821
  return isLetterOrDigit(it.x_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).o1(it);
466
822
  }
467
- function KotlinEmitter(packageName, emitShared) {
468
- Companion_getInstance();
469
- packageName = packageName === VOID ? Companion_instance_0.a27('community.flock.wirespec.generated') : packageName;
470
- emitShared = emitShared === VOID ? Companion_instance_1.v23() : emitShared;
471
- Emitter.call(this);
472
- this.m2a_1 = packageName;
473
- this.n2a_1 = emitShared;
474
- this.o2a_1 = '\nimport community.flock.wirespec.kotlin.Wirespec\nimport kotlin.reflect.typeOf\n';
475
- this.p2a_1 = FileExtension_Kotlin_getInstance();
476
- this.q2a_1 = KotlinShared_getInstance();
477
- this.r2a_1 = '//';
478
- }
479
- protoOf(KotlinEmitter).k24 = function () {
480
- return this.p2a_1;
481
- };
482
- protoOf(KotlinEmitter).x2a = function () {
483
- return this.q2a_1;
484
- };
485
- protoOf(KotlinEmitter).b26 = function () {
486
- return this.r2a_1;
487
- };
488
- protoOf(KotlinEmitter).g24 = function (module_0, logger) {
489
- // Inline function 'kotlin.let' call
490
- // Inline function 'kotlin.contracts.contract' call
491
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
492
- var it = protoOf(Emitter).g24.call(this, module_0, logger);
493
- return this.n2a_1.w23_1 ? it.pk(new Emitted(Companion_instance_0.a27('community.flock.wirespec.kotlin').d27() + 'Wirespec', this.x2a().z2a_1)) : it;
494
- };
495
- protoOf(KotlinEmitter).l24 = function (definition, module_0, logger) {
496
- // Inline function 'kotlin.let' call
497
- // Inline function 'kotlin.contracts.contract' call
498
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
499
- var it = protoOf(Emitter).l24.call(this, definition, module_0, logger);
500
- var subPackageName = plus(this.m2a_1, definition);
501
- var tmp = subPackageName.d27() + sanitizeSymbol(it.x23_1, this);
502
- // Inline function 'kotlin.text.trimStart' call
503
- var this_0 = trimMargin('\n |package ' + subPackageName.toString() + '\n |' + (Companion_instance.b24(module_0) ? this.o2a_1 : '') + '\n |' + it.y23_1 + '\n ');
504
- var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
505
- return new Emitted(tmp, tmp$ret$0);
506
- };
507
- protoOf(KotlinEmitter).t25 = function (type, module_0) {
508
- var tmp;
509
- if (type.r25_1.u26_1.l()) {
510
- tmp = 'data object ' + this.s24(type.q25_1);
511
- } else {
512
- var tmp_0 = this.s24(type.q25_1);
513
- var tmp_1 = this.u25(type.r25_1);
514
- // Inline function 'kotlin.run' call
515
- // Inline function 'kotlin.contracts.contract' call
516
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
517
- var $this$run = type.s25_1;
518
- var tmp_2;
519
- if ($this$run.l()) {
520
- tmp_2 = '';
521
- } else {
522
- tmp_2 = ' : ' + joinToString($this$run, ', ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda(this));
523
- }
524
- var tmp$ret$1 = tmp_2;
525
- tmp = trimMargin('\n |data class ' + tmp_0 + '(\n |' + tmp_1 + '\n |)' + tmp$ret$1 + '\n |\n ');
526
- }
527
- return tmp;
528
- };
529
- protoOf(KotlinEmitter).u25 = function (_this__u8e3s4) {
530
- return dropLast(joinToString(_this__u8e3s4.u26_1, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_0(this)), 1);
531
- };
532
- protoOf(KotlinEmitter).v25 = function (_this__u8e3s4) {
533
- return this.s24(_this__u8e3s4.v26_1) + ': ' + this.w25(_this__u8e3s4.w26_1);
534
- };
535
- protoOf(KotlinEmitter).w25 = function (_this__u8e3s4) {
536
- // Inline function 'kotlin.let' call
537
- var tmp;
538
- if (_this__u8e3s4 instanceof Dict) {
539
- tmp = 'Map<String, ' + this.w25(_this__u8e3s4.r23_1) + '>';
540
- } else {
541
- if (_this__u8e3s4 instanceof Iterable) {
542
- tmp = 'List<' + this.w25(_this__u8e3s4.o23_1) + '>';
543
- } else {
544
- if (_this__u8e3s4 instanceof Unit) {
545
- tmp = 'Unit';
546
- } else {
547
- if (_this__u8e3s4 instanceof Any) {
548
- tmp = 'Any';
549
- } else {
550
- if (_this__u8e3s4 instanceof Custom) {
551
- tmp = _this__u8e3s4.h29_1;
552
- } else {
553
- if (_this__u8e3s4 instanceof Primitive) {
554
- var t = _this__u8e3s4.l29_1;
555
- var tmp_0;
556
- if (t instanceof String_0) {
557
- tmp_0 = 'String';
558
- } else {
559
- if (t instanceof Integer) {
560
- var tmp_1;
561
- switch (t.q28_1.r2_1) {
562
- case 0:
563
- tmp_1 = 'Int';
564
- break;
565
- case 1:
566
- tmp_1 = 'Long';
567
- break;
568
- default:
569
- noWhenBranchMatchedException();
570
- break;
571
- }
572
- tmp_0 = tmp_1;
573
- } else {
574
- if (t instanceof Number_0) {
575
- var tmp_2;
576
- switch (t.t28_1.r2_1) {
577
- case 0:
578
- tmp_2 = 'Float';
579
- break;
580
- case 1:
581
- tmp_2 = 'Double';
582
- break;
583
- default:
584
- noWhenBranchMatchedException();
585
- break;
586
- }
587
- tmp_0 = tmp_2;
588
- } else {
589
- if (t instanceof Boolean_0) {
590
- tmp_0 = 'Boolean';
591
- } else {
592
- if (t instanceof Bytes) {
593
- tmp_0 = 'ByteArray';
594
- } else {
595
- noWhenBranchMatchedException();
596
- }
597
- }
598
- }
599
- }
600
- }
601
- tmp = tmp_0;
602
- } else {
603
- noWhenBranchMatchedException();
604
- }
605
- }
606
- }
607
- }
608
- }
609
- }
610
- // Inline function 'kotlin.contracts.contract' call
611
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
612
- var it = tmp;
613
- return _this__u8e3s4.hm() ? it + '?' : it;
614
- };
615
- protoOf(KotlinEmitter).s24 = function (identifier) {
616
- var tmp;
617
- if (identifier instanceof DefinitionIdentifier) {
618
- tmp = sanitizeSymbol(identifier.b1(), this);
619
- } else {
620
- if (identifier instanceof FieldIdentifier) {
621
- tmp = this.v2a(sanitizeSymbol(identifier.b1(), this));
622
- } else {
623
- noWhenBranchMatchedException();
624
- }
625
- }
626
- return tmp;
627
- };
628
- protoOf(KotlinEmitter).b25 = function (refined) {
629
- return trimMargin('\n |data class ' + sanitizeSymbol(refined.z24_1.b1(), this) + '(override val value: String): Wirespec.Refined {\n |' + Spacer_instance.toString() + 'override fun toString() = value\n |}\n |\n |fun ' + refined.z24_1.b1() + '.validate() = ' + this.z25(refined) + '\n |\n ');
630
- };
631
- protoOf(KotlinEmitter).z25 = function (_this__u8e3s4) {
632
- var defaultReturn = 'true';
633
- var type = _this__u8e3s4.a25_1.l29_1;
634
- var tmp;
635
- if (type instanceof Integer) {
636
- var tmp0_safe_receiver = type.r28_1;
637
- var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.x25(tmp0_safe_receiver);
638
- tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
639
- } else {
640
- if (type instanceof Number_0) {
641
- var tmp2_safe_receiver = type.u28_1;
642
- var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.x25(tmp2_safe_receiver);
643
- tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
644
- } else {
645
- if (type instanceof String_0) {
646
- var tmp4_safe_receiver = type.o28_1;
647
- var tmp_0;
648
- var tmp_1 = tmp4_safe_receiver;
649
- if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
650
- tmp_0 = null;
651
- } else {
652
- tmp_0 = this.x25(new RegExp_0(tmp4_safe_receiver));
653
- }
654
- var tmp5_elvis_lhs = tmp_0;
655
- tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
656
- } else {
657
- if (equals(type, Boolean_instance)) {
658
- tmp = defaultReturn;
659
- } else {
660
- if (equals(type, Bytes_instance)) {
661
- tmp = defaultReturn;
662
- } else {
663
- noWhenBranchMatchedException();
664
- }
665
- }
666
- }
667
- }
668
- }
669
- return tmp;
670
- };
671
- protoOf(KotlinEmitter).x25 = function (_this__u8e3s4) {
672
- var tmp;
673
- if (_this__u8e3s4 instanceof RegExp_0) {
674
- tmp = 'Regex("""' + this.a26(_this__u8e3s4.l28_1) + '""").matches(value)';
675
- } else {
676
- if (_this__u8e3s4 instanceof Bound) {
677
- tmp = Spacer_instance.toString() + _this__u8e3s4.m28_1 + ' < record.value < ' + _this__u8e3s4.n28_1 + ';';
678
- } else {
679
- noWhenBranchMatchedException();
680
- }
681
- }
682
- return tmp;
683
- };
684
- protoOf(KotlinEmitter).f25 = function (enum_0, module_0) {
685
- var tmp = sanitizeSymbol(enum_0.d25_1.b1(), this);
686
- return trimMargin('\n |enum class ' + tmp + ' (override val label: String): Wirespec.Enum {\n |' + this.h26(joinToString(enum_0.e25_1, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_1(this))) + ';\n |' + Spacer_instance.toString() + 'override fun toString(): String {\n |' + Spacer_instance.i27(2) + 'return label\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
687
- };
688
- protoOf(KotlinEmitter).x24 = function (union) {
689
- return trimMargin('\n |sealed interface ' + this.s24(union.v24_1) + '\n |\n ');
690
- };
691
- protoOf(KotlinEmitter).t24 = function (channel) {
692
- return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |interface ' + this.s24(channel.q24_1) + 'Channel {\n | operator fun invoke(message: ' + this.w25(channel.r24_1) + ')\n |}\n |\n ');
693
- };
694
- protoOf(KotlinEmitter).o25 = function (endpoint) {
695
- // Inline function 'kotlin.collections.map' call
696
- var this_0 = this.i26(endpoint);
697
- // Inline function 'kotlin.collections.mapTo' call
698
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
699
- var tmp0_iterator = this_0.g();
700
- while (tmp0_iterator.h()) {
701
- var item = tmp0_iterator.i();
702
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
703
- var tmp$ret$0 = 'import ' + this.m2a_1.b27_1 + '.model.' + item.h29_1;
704
- destination.e(tmp$ret$0);
705
- }
706
- var tmp = destination;
707
- var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_2);
708
- var tmp_1 = this.s24(endpoint.h25_1);
709
- var tmp_2 = this.d26(endpoint);
710
- var tmp_3 = emitObject$default(tmp_2, this, 'Path', 'Wirespec.Path', VOID, KotlinEmitter$emit$lambda_3(this));
711
- var tmp_4 = emitObject$default(endpoint.k25_1, this, 'Queries', 'Wirespec.Queries', VOID, KotlinEmitter$emit$lambda_4(this));
712
- var tmp_5 = emitObject$default(endpoint.l25_1, this, 'Headers', 'Wirespec.Request.Headers', VOID, KotlinEmitter$emit$lambda_5(this));
713
- var tmp_6 = this.a2b(first(endpoint.m25_1), endpoint);
714
- var tmp_7 = Spacer_instance.toString();
715
- var tmp_8 = emitStatusInterfaces(endpoint, this);
716
- var tmp_9 = emitResponseInterfaces(endpoint, this);
717
- var tmp_10 = this.l26(endpoint.n25_1);
718
- var tmp_11 = joinToString(tmp_10, '\n\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_6(this));
719
- var tmp_12 = Spacer_instance.toString();
720
- var tmp_13 = Spacer_instance.i27(2);
721
- var tmp_14 = this.l26(endpoint.n25_1);
722
- var tmp_15 = joinToString(tmp_14, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_7(this));
723
- var tmp_16 = Spacer_instance.i27(2);
724
- var tmp_17 = Spacer_instance.toString();
725
- var tmp_18 = Spacer_instance.i27(2);
726
- // Inline function 'kotlin.collections.filter' call
727
- // Inline function 'kotlin.collections.filterTo' call
728
- var this_1 = this.l26(endpoint.n25_1);
729
- var destination_0 = ArrayList_init_$Create$();
730
- var tmp0_iterator_0 = this_1.g();
731
- while (tmp0_iterator_0.h()) {
732
- var element = tmp0_iterator_0.i();
733
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
734
- if (Companion_instance.e24(element.r26_1)) {
735
- destination_0.e(element);
736
- }
737
- }
738
- var tmp_19 = destination_0;
739
- var tmp_20 = joinToString(tmp_19, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_8(this));
740
- var tmp_21 = Spacer_instance.i27(3);
741
- var tmp_22 = Spacer_instance.i27(2);
742
- var tmp_23 = Spacer_instance.toString();
743
- var tmp_24 = Spacer_instance.i27(2);
744
- var tmp_25 = this.b2b(endpoint);
745
- var tmp_26 = Spacer_instance.i27(2);
746
- var tmp_27 = Spacer_instance.i27(3);
747
- return trimMargin('\n |' + tmp_0 + '\n |\n |object ' + tmp_1 + ' : Wirespec.Endpoint {\n |' + tmp_3 + '\n |\n |' + tmp_4 + '\n |\n |' + tmp_5 + '\n |\n |' + tmp_6 + '\n |\n |' + tmp_7 + 'sealed interface Response<T: Any> : Wirespec.Response<T>\n |\n |' + tmp_8 + '\n |\n |' + tmp_9 + '\n |\n |' + tmp_11 + '\n |\n |' + tmp_12 + 'fun toResponse(serialization: Wirespec.Serializer<String>, response: Response<*>): Wirespec.RawResponse =\n |' + tmp_13 + 'when(response) {\n |' + tmp_15 + '\n |' + tmp_16 + '}\n |\n |' + tmp_17 + 'fun fromResponse(serialization: Wirespec.Deserializer<String>, response: Wirespec.RawResponse): Response<*> =\n |' + tmp_18 + 'when (response.statusCode) {\n |' + tmp_20 + '\n |' + tmp_21 + 'else -> error("Cannot match response with status: ${response.statusCode}")\n |' + tmp_22 + '}\n |\n |' + tmp_23 + 'interface Handler: Wirespec.Handler {\n |' + tmp_24 + tmp_25 + '\n |' + tmp_26 + 'companion object: Wirespec.Server<Request, Response<*>>, Wirespec.Client<Request, Response<*>> {\n |' + tmp_27 + 'override val pathTemplate = "/' + joinToString(endpoint.j25_1, '/', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_9(this)) + '"\n |' + Spacer_instance.i27(3) + 'override val method = "' + endpoint.i25_1.toString() + '"\n |' + Spacer_instance.i27(3) + 'override fun server(serialization: Wirespec.Serialization<String>) = object : Wirespec.ServerEdge<Request, Response<*>> {\n |' + Spacer_instance.i27(4) + 'override fun from(request: Wirespec.RawRequest) = fromRequest(serialization, request)\n |' + Spacer_instance.i27(4) + 'override fun to(response: Response<*>) = toResponse(serialization, response)\n |' + Spacer_instance.i27(3) + '}\n |' + Spacer_instance.i27(3) + 'override fun client(serialization: Wirespec.Serialization<String>) = object : Wirespec.ClientEdge<Request, Response<*>> {\n |' + Spacer_instance.i27(4) + 'override fun to(request: Request) = toRequest(serialization, request)\n |' + Spacer_instance.i27(4) + 'override fun from(response: Wirespec.RawResponse) = fromResponse(serialization, response)\n |' + Spacer_instance.i27(3) + '}\n |' + Spacer_instance.i27(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
748
- };
749
- protoOf(KotlinEmitter).b2b = function (endpoint) {
750
- return 'suspend fun ' + Companion_instance.a24(this.s24(endpoint.h25_1)) + '(request: Request): Response<*>';
751
- };
752
- protoOf(KotlinEmitter).a2b = function (_this__u8e3s4, endpoint) {
753
- var tmp = Spacer_instance.toString();
754
- var tmp_0 = emitConstructor(_this__u8e3s4, this, endpoint);
755
- var tmp_1 = Spacer_instance.i27(2);
756
- var tmp_2 = this.d26(endpoint);
757
- var tmp_3 = brace(joinToString(tmp_2, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_10(this)), this);
758
- var tmp_4 = Spacer_instance.i27(2);
759
- var tmp_5 = Spacer_instance.i27(2);
760
- var tmp_6 = brace(joinToString(endpoint.k25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_11(this)), this);
761
- var tmp_7 = Spacer_instance.i27(2);
762
- var tmp_8 = brace(joinToString(endpoint.l25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_12(this)), this);
763
- var tmp_9 = _this__u8e3s4.x26_1 == null ? '\n' + Spacer_instance.i27(2) + 'override val body = Unit' : '';
764
- var tmp_10 = Spacer_instance.toString();
765
- var tmp_11 = Spacer_instance.toString();
766
- var tmp_12 = Spacer_instance.i27(2);
767
- var tmp_13 = Spacer_instance.i27(3);
768
- var tmp_14 = joinToString(endpoint.j25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_13(this));
769
- var tmp_15 = Spacer_instance.i27(3);
770
- var tmp_16 = Spacer_instance.i27(3);
771
- var tmp_17;
772
- // Inline function 'kotlin.collections.isNotEmpty' call
773
- if (!endpoint.k25_1.l()) {
774
- tmp_17 = joinToString(endpoint.k25_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_14(this));
775
- } else {
776
- tmp_17 = 'emptyMap()';
777
- }
778
- var tmp_18 = tmp_17;
779
- var tmp_19 = Spacer_instance.i27(3);
780
- var tmp_20;
781
- // Inline function 'kotlin.collections.isNotEmpty' call
782
- if (!endpoint.l25_1.l()) {
783
- tmp_20 = joinToString(endpoint.l25_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_15(this));
784
- } else {
785
- tmp_20 = 'emptyMap()';
786
- }
787
- return trimMargin('\n |' + tmp + tmp_0 + '\n |' + tmp_1 + 'override val path = Path' + tmp_3 + '\n |' + tmp_4 + 'override val method = Wirespec.Method.' + endpoint.i25_1.q2_1 + '\n |' + tmp_5 + 'override val queries = Queries' + tmp_6 + '\n |' + tmp_7 + 'override val headers = Headers' + tmp_8 + tmp_9 + '\n |' + tmp_10 + '}\n |\n |' + tmp_11 + 'fun toRequest(serialization: Wirespec.Serializer<String>, request: Request): Wirespec.RawRequest =\n |' + tmp_12 + 'Wirespec.RawRequest(\n |' + tmp_13 + 'path = listOf(' + tmp_14 + '),\n |' + tmp_15 + 'method = request.method.name,\n |' + tmp_16 + 'queries = ' + tmp_18 + ',\n |' + tmp_19 + 'headers = ' + tmp_20 + ',\n |' + Spacer_instance.i27(3) + 'body = serialization.serialize(request.body, typeOf<' + emit(_this__u8e3s4.x26_1, this) + '>()),\n |' + Spacer_instance.i27(2) + ')\n |\n |' + Spacer_instance.toString() + 'fun fromRequest(serialization: Wirespec.Deserializer<String>, request: Wirespec.RawRequest): Request =\n |' + Spacer_instance.i27(2) + 'Request' + emitDeserializedParams(_this__u8e3s4, this, endpoint) + '\n ');
788
- };
789
- protoOf(KotlinEmitter).w2a = function (_this__u8e3s4) {
790
- var tmp = Spacer_instance.toString();
791
- var tmp_0 = emit(_this__u8e3s4.t26_1, this);
792
- // Inline function 'kotlin.let' call
793
- // Inline function 'kotlin.contracts.contract' call
794
- // Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
795
- var it = joinToString(_this__u8e3s4.s26_1, ', ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_16(this));
796
- var tmp_1 = isBlank(it) ? '' : ', ' + it;
797
- var tmp_2 = toString_0(charSequenceGet(_this__u8e3s4.r26_1, 0));
798
- var tmp_3 = emit(_this__u8e3s4.t26_1, this);
799
- var tmp_4 = concatGenerics(emit(_this__u8e3s4.t26_1, this));
800
- var tmp_5 = Spacer_instance.i27(2);
801
- var tmp_6 = this.k26(_this__u8e3s4.r26_1);
802
- var tmp_7 = Spacer_instance.i27(2);
803
- var tmp_8 = brace(joinToString(_this__u8e3s4.s26_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_17(this)), this);
804
- return trimMargin('\n |' + tmp + 'data class Response' + _this__u8e3s4.r26_1 + '(override val body: ' + tmp_0 + tmp_1 + ') : Response' + tmp_2 + 'XX<' + tmp_3 + '>, Response' + tmp_4 + ' {\n |' + tmp_5 + 'override val status = ' + tmp_6 + '\n |' + tmp_7 + 'override val headers = ResponseHeaders' + tmp_8 + '\n |' + emitObject(_this__u8e3s4.s26_1, this, 'ResponseHeaders', 'Wirespec.Response.Headers', 2, KotlinEmitter$emit$lambda_18(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
805
- };
806
- protoOf(KotlinEmitter).u2a = function (_this__u8e3s4) {
807
- return sanitizeFirstIsDigit(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'), this);
808
- };
809
- protoOf(KotlinEmitter).v2a = function (_this__u8e3s4) {
810
- return Companion_getInstance().s2a_1.o1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
811
- };
823
+ function KotlinIdentifierEmitter() {
824
+ }
825
+ function KotlinRefinedTypeDefinitionEmitter() {
826
+ }
812
827
  function KotlinShared() {
813
828
  KotlinShared_instance = this;
814
- this.y2a_1 = 'community.flock.wirespec.kotlin';
815
- this.z2a_1 = trimMargin('\n |package ' + this.y2a_1 + '\n |\n |import kotlin.reflect.KType\n |\n |object Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { val label: String }\n |' + Spacer_instance.toString() + 'interface Endpoint\n |' + Spacer_instance.toString() + 'interface Refined { val value: String }\n |' + Spacer_instance.toString() + 'interface Path\n |' + Spacer_instance.toString() + 'interface Queries\n |' + Spacer_instance.toString() + 'interface Headers\n |' + Spacer_instance.toString() + 'interface Handler\n |' + Spacer_instance.toString() + 'interface ServerEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.toString() + 'fun from(request: RawRequest): Req \n |' + Spacer_instance.toString() + 'fun to(response: Res): RawResponse\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.i27(2) + 'fun to(request: Req): RawRequest\n |' + Spacer_instance.i27(2) + 'fun from(response: RawResponse): Res\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.i27(2) + 'val pathTemplate: String\n |' + Spacer_instance.i27(2) + 'val method: String\n |' + Spacer_instance.i27(2) + 'fun client(serialization: Serialization<String>): ClientEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Server<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.i27(2) + 'val pathTemplate: String\n |' + Spacer_instance.i27(2) + 'val method: String\n |' + Spacer_instance.i27(2) + 'fun server(serialization: Serialization<String>): ServerEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'enum class Method { GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH, TRACE }\n |' + Spacer_instance.toString() + 'interface Request<T : Any> { val path: Path; val method: Method; val queries: Queries; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Response<T : Any> { val status: Int; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Serialization<RAW : Any> : Serializer<RAW>, Deserializer<RAW>, ParamSerialization\n |' + Spacer_instance.toString() + 'interface ParamSerialization: ParamSerializer, ParamDeserializer\n |' + Spacer_instance.toString() + 'interface ParamSerializer { fun <T> serializeParam(value: T, kType: KType): List<String> }\n |' + Spacer_instance.toString() + 'interface Serializer<RAW : Any> : ParamSerializer { fun <T> serialize(t: T, kType: KType): RAW }\n |' + Spacer_instance.toString() + 'interface Deserializer<RAW: Any>: ParamDeserializer { fun <T> deserialize(raw: RAW, kType: KType): T }\n |' + Spacer_instance.toString() + 'interface ParamDeserializer { fun <T> deserializeParam(values: List<String>, kType: KType): T }\n |' + Spacer_instance.toString() + 'data class RawRequest(val method: String, val path: List<String>, val queries: Map<String, List<String>>, val headers: Map<String, List<String>>, val body: String?) \n |' + Spacer_instance.toString() + 'data class RawResponse(val statusCode: Int, val headers: Map<String, List<String>>, val body: String?)\n |}\n ');
829
+ this.s2a_1 = 'community.flock.wirespec.kotlin';
830
+ this.t2a_1 = trimMargin('\n |package ' + this.s2a_1 + '\n |\n |import kotlin.reflect.KType\n |\n |object Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { val label: String }\n |' + Spacer_instance.toString() + 'interface Endpoint\n |' + Spacer_instance.toString() + 'interface Refined { val value: String }\n |' + Spacer_instance.toString() + 'interface Path\n |' + Spacer_instance.toString() + 'interface Queries\n |' + Spacer_instance.toString() + 'interface Headers\n |' + Spacer_instance.toString() + 'interface Handler\n |' + Spacer_instance.toString() + 'interface ServerEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.toString() + 'fun from(request: RawRequest): Req \n |' + Spacer_instance.toString() + 'fun to(response: Res): RawResponse\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.a27(2) + 'fun to(request: Req): RawRequest\n |' + Spacer_instance.a27(2) + 'fun from(response: RawResponse): Res\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.a27(2) + 'val pathTemplate: String\n |' + Spacer_instance.a27(2) + 'val method: String\n |' + Spacer_instance.a27(2) + 'fun client(serialization: Serialization<String>): ClientEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Server<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.a27(2) + 'val pathTemplate: String\n |' + Spacer_instance.a27(2) + 'val method: String\n |' + Spacer_instance.a27(2) + 'fun server(serialization: Serialization<String>): ServerEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'enum class Method { GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH, TRACE }\n |' + Spacer_instance.toString() + 'interface Request<T : Any> { val path: Path; val method: Method; val queries: Queries; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Response<T : Any> { val status: Int; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Serialization<RAW : Any> : Serializer<RAW>, Deserializer<RAW>, ParamSerialization\n |' + Spacer_instance.toString() + 'interface ParamSerialization: ParamSerializer, ParamDeserializer\n |' + Spacer_instance.toString() + 'interface ParamSerializer { fun <T> serializeParam(value: T, kType: KType): List<String> }\n |' + Spacer_instance.toString() + 'interface Serializer<RAW : Any> : ParamSerializer { fun <T> serialize(t: T, kType: KType): RAW }\n |' + Spacer_instance.toString() + 'interface Deserializer<RAW: Any>: ParamDeserializer { fun <T> deserialize(raw: RAW, kType: KType): T }\n |' + Spacer_instance.toString() + 'interface ParamDeserializer { fun <T> deserializeParam(values: List<String>, kType: KType): T }\n |' + Spacer_instance.toString() + 'data class RawRequest(val method: String, val path: List<String>, val queries: Map<String, List<String>>, val headers: Map<String, List<String>>, val body: String?) \n |' + Spacer_instance.toString() + 'data class RawResponse(val statusCode: Int, val headers: Map<String, List<String>>, val body: String?)\n |}\n ');
816
831
  }
817
832
  protoOf(KotlinShared).toString = function () {
818
833
  return 'KotlinShared';
@@ -834,6 +849,41 @@ function KotlinShared_getInstance() {
834
849
  new KotlinShared();
835
850
  return KotlinShared_instance;
836
851
  }
852
+ function KotlinTypeDefinitionEmitter$emit$lambda(this$0) {
853
+ return function (it) {
854
+ return this$0.j25(it);
855
+ };
856
+ }
857
+ function KotlinTypeDefinitionEmitter$emit$lambda_0(this$0) {
858
+ return function (it) {
859
+ return Spacer_instance.toString() + 'val ' + this$0.i25(it) + ',';
860
+ };
861
+ }
862
+ function KotlinTypeDefinitionEmitter() {
863
+ }
864
+ function KotlinUnionDefinitionEmitter() {
865
+ }
866
+ //region block: post-declaration
867
+ protoOf(KotlinEmitter).i26 = emit_0;
868
+ protoOf(KotlinEmitter).g25 = emit_1;
869
+ protoOf(KotlinEmitter).h25 = emit_2;
870
+ protoOf(KotlinEmitter).i25 = emit_3;
871
+ protoOf(KotlinEmitter).j25 = emit_4;
872
+ protoOf(KotlinEmitter).k25 = emit_5;
873
+ protoOf(KotlinEmitter).t26 = emit_10;
874
+ protoOf(KotlinEmitter).u2a = emit_11;
875
+ protoOf(KotlinEmitter).v2a = emit_12;
876
+ protoOf(KotlinEmitter).j26 = emit_6;
877
+ protoOf(KotlinEmitter).s26 = emit_7;
878
+ protoOf(KotlinEmitter).k26 = emit_8;
879
+ protoOf(KotlinEmitter).o26 = emit_9;
880
+ protoOf(KotlinEmitter).u26 = emitValidator;
881
+ protoOf(KotlinEmitter).i2a = sanitize;
882
+ protoOf(KotlinEmitter).j2a = sanitizeFirstIsDigit;
883
+ protoOf(KotlinEmitter).k2a = sanitizeKeywords;
884
+ protoOf(KotlinEmitter).w2a = emitHandleFunction;
885
+ protoOf(KotlinEmitter).x2a = sanitizeEnum;
886
+ //endregion
837
887
  //region block: exports
838
888
  export {
839
889
  KotlinEmitter as KotlinEmitterddb8247fx90i,