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