@flock/wirespec 0.16.5 → 0.16.7

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 (34) hide show
  1. package/clikt-clikt.mjs +1129 -1129
  2. package/colormath-root-colormath.mjs +400 -400
  3. package/kotlin-kotlin-stdlib.mjs +19 -19
  4. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  5. package/kotlin-rgxgen.mjs +1764 -1764
  6. package/kotlinx-io-kotlinx-io-core.mjs +2 -2
  7. package/markdown.mjs +1796 -1796
  8. package/mordant-mordant.mjs +1531 -1531
  9. package/package.json +5 -1
  10. package/wirespec-serialization.d.ts +3 -0
  11. package/wirespec-serialization.mjs +17 -0
  12. package/wirespec-src-compiler-core.mjs +2935 -2770
  13. package/wirespec-src-compiler-core.mjs.map +1 -1
  14. package/wirespec-src-compiler-emitters-java.mjs +176 -262
  15. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  16. package/wirespec-src-compiler-emitters-kotlin.mjs +179 -179
  17. package/wirespec-src-compiler-emitters-python.mjs +162 -162
  18. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  19. package/wirespec-src-compiler-emitters-typescript.mjs +772 -626
  20. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  21. package/wirespec-src-compiler-emitters-wirespec.mjs +57 -57
  22. package/wirespec-src-compiler-lib.mjs +312 -312
  23. package/wirespec-src-converter-avro.mjs +32 -32
  24. package/wirespec-src-converter-avro.mjs.map +1 -1
  25. package/wirespec-src-converter-openapi.mjs +197 -197
  26. package/wirespec-src-converter-openapi.mjs.map +1 -1
  27. package/wirespec-src-plugin-arguments.mjs +223 -249
  28. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  29. package/wirespec-src-plugin-cli.mjs +75 -75
  30. package/wirespec-src-plugin-npm.d.ts +1 -1
  31. package/wirespec-src-plugin-npm.mjs +12 -11
  32. package/wirespec-src-plugin-npm.mjs.map +1 -1
  33. package/wirespec-src-tools-generator.mjs +25 -25
  34. package/fetch.ts +0 -0
@@ -1,541 +1,95 @@
1
- import {
2
- Companion_instanceb7vsmblp2jf7 as Companion_instance,
3
- Spacer_instancel9yep7i0q3er as Spacer_instance,
4
- Param33sus5zaarsk0 as Param,
5
- Literal32wmkquj6qapn as Literal,
6
- Emitterpslsvv25okcl as Emitter,
7
- Companion_instance26a9xkw31611z as Companion_instance_0,
8
- FileExtension_TypeScript_getInstancelv1vlncbu27z as FileExtension_TypeScript_getInstance,
9
- namespacepzr7vpsv8z39 as namespace,
10
- Emitted12h24rpo4uifw as Emitted,
11
- Companion_instance2ag0h5twtdral as Companion_instance_1,
12
- plus2csvv9vgnno78 as plus,
13
- Bytes2moci2lqqzua3 as Bytes,
14
- Boolean1v54w5v4qjba1 as Boolean_0,
15
- Number3i05nlui0wcz8 as Number_0,
16
- Integeryrcje1s9u7kr as Integer,
17
- String23kqvhe3sk098 as String_0,
18
- Primitivexjb7c0cm123a as Primitive,
19
- Custom37hvrfgd6b0uj as Custom,
20
- Any268baxyo9do19 as Any,
21
- Unit3rie819ih39bz as Unit,
22
- Iterablerto606wd057m as Iterable,
23
- Dict3l6tdihpke4rr as Dict,
24
- Bytes_instance1at7binw0nl40 as Bytes_instance,
25
- Boolean_instance3qnzv8pgzox40 as Boolean_instance,
26
- RegExp1kvu7kxwy7td5 as RegExp_0,
27
- Bound1dotva4vah4jp as Bound,
28
- _RegExp___get_value__impl__7o761828ey0cgsx2afa as _RegExp___get_value__impl__7o7618,
29
- } from './wirespec-src-compiler-core.mjs';
30
1
  import {
31
2
  VOID7hggqo3abtya as VOID,
32
3
  joinToString1cxrrlmo0chqs as joinToString,
33
4
  trimMarginhyd3fsmh8iev as trimMargin,
34
- trimIndent1qytc1wvt8suh as trimIndent,
35
- asSequence3lsvgkvyzox0q as asSequence,
36
- filter184huxd00uyfg as filter,
37
- joinToStringooja5rkatz3u as joinToString_0,
38
- prependIndentkl9wuvcodvmu as prependIndent,
5
+ Unit_instanceat14thlj150z as Unit_instance,
6
+ ArrayList_init_$Create$2rimpp4x9tjd3 as ArrayList_init_$Create$,
7
+ addAll1k27qatfgp3k5 as addAll,
8
+ HashSet_init_$Create$2bsk5herqkxxm as HashSet_init_$Create$,
9
+ protoOf180f3jzyo7rfj as protoOf,
10
+ initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
39
11
  THROW_CCE2g6jy02ryeudk as THROW_CCE,
40
12
  isCharSequence1ju9jr1w86plq as isCharSequence,
41
13
  trimStart5ewg8zf6cs5u as trimStart,
42
14
  toString1pkumu07cwy4m as toString,
43
- isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
44
- _Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
45
- Char19o2r8palgjof as Char,
46
- listOfvhqybd2zx248 as listOf,
47
- noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
48
- protoOf180f3jzyo7rfj as protoOf,
49
- ArrayList_init_$Create$2rimpp4x9tjd3 as ArrayList_init_$Create$,
50
- addAll1k27qatfgp3k5 as addAll,
51
- Unit_instanceat14thlj150z as Unit_instance,
52
15
  LinkedHashMap_init_$Create$2gfxg59gogbfz as LinkedHashMap_init_$Create$,
53
16
  ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$_0,
54
- HashSet_init_$Create$2bsk5herqkxxm as HashSet_init_$Create$,
55
17
  collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
56
- equals2au1ep9vhcato as equals,
57
- first58ocm7j58k3q as first,
58
18
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
19
+ prependIndentkl9wuvcodvmu as prependIndent,
20
+ trimIndent1qytc1wvt8suh as trimIndent,
21
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
22
+ first58ocm7j58k3q as first,
59
23
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
24
+ isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
25
+ _Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
26
+ Char19o2r8palgjof as Char,
27
+ listOfvhqybd2zx248 as listOf,
28
+ asSequence3lsvgkvyzox0q as asSequence,
29
+ filter184huxd00uyfg as filter,
30
+ joinToStringooja5rkatz3u as joinToString_0,
31
+ equals2au1ep9vhcato as equals,
60
32
  } from './kotlin-kotlin-stdlib.mjs';
61
- //region block: imports
62
- //endregion
63
- //region block: pre-declaration
64
- initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, Emitter);
65
- initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
66
- //endregion
67
- function emitHandleFunction($this, endpoint) {
68
- return Companion_instance.l24(sanitizeSymbol(endpoint.s25_1, $this)) + ': (request:Request) => Promise<Response>';
69
- }
70
- function emitType(_this__u8e3s4, $this, name, block) {
71
- var tmp;
72
- if (_this__u8e3s4.l()) {
73
- tmp = Spacer_instance.toString() + 'type ' + name + ' = {}';
74
- } else {
75
- var tmp_0 = Spacer_instance.toString();
76
- tmp = trimMargin('\n |' + tmp_0 + 'type ' + name + ' = {\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emitType$lambda(block)) + ',\n |' + Spacer_instance.toString() + '}\n ');
77
- }
78
- return tmp;
79
- }
80
- function emitReference(_this__u8e3s4, $this) {
81
- var tmp0_safe_receiver = _this__u8e3s4.m26_1;
82
- var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h24_1;
83
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.n2a(tmp1_safe_receiver);
84
- return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
85
- }
86
- function emitType_0(_this__u8e3s4, $this, endpoint) {
87
- return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.p23(2) + 'path: Path\n |' + Spacer_instance.p23(2) + 'method: "' + endpoint.t25_1.toString() + '"\n |' + Spacer_instance.p23(2) + 'queries: Queries\n |' + Spacer_instance.p23(2) + 'headers: Headers\n |' + Spacer_instance.p23(2) + 'body: ' + emitReference(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
88
- }
89
- function emitFunction(_this__u8e3s4, $this, endpoint) {
90
- var tmp = Spacer_instance.toString();
91
- var tmp_0 = $this.l26(_this__u8e3s4, endpoint);
92
- var tmp_1 = joinToObject(tmp_0, $this, TypeScriptEmitter$emitFunction$lambda($this));
93
- var tmp_2 = Spacer_instance.toString();
94
- // Inline function 'kotlin.text.orEmpty' call
95
- // Inline function 'kotlin.takeIf' call
96
- var this_0 = $this.l26(_this__u8e3s4, endpoint);
97
- // Inline function 'kotlin.contracts.contract' call
98
- var tmp_3;
99
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
100
- // Inline function 'kotlin.collections.isNotEmpty' call
101
- if (!this_0.l()) {
102
- tmp_3 = this_0;
103
- } else {
104
- tmp_3 = null;
105
- }
106
- var tmp_4;
107
- if (tmp_3 == null) {
108
- tmp_4 = null;
109
- } else {
110
- // Inline function 'kotlin.run' call
111
- // Inline function 'kotlin.contracts.contract' call
112
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
113
- tmp_4 = 'params: RequestParams';
114
- }
115
- var tmp0_elvis_lhs = tmp_4;
116
- var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
117
- var tmp_6 = Spacer_instance.p23(2);
118
- var tmp_7 = $this.j26(endpoint);
119
- var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEmitter$emitFunction$lambda_0($this));
120
- var tmp_9 = Spacer_instance.p23(2);
121
- var tmp_10 = endpoint.t25_1.toString();
122
- var tmp_11 = Spacer_instance.p23(2);
123
- var tmp_12 = joinToObject(endpoint.v25_1, $this, TypeScriptEmitter$emitFunction$lambda_1($this));
124
- var tmp_13 = Spacer_instance.p23(2);
125
- var tmp_14 = joinToObject(endpoint.w25_1, $this, TypeScriptEmitter$emitFunction$lambda_2($this));
126
- var tmp_15 = Spacer_instance.p23(2);
127
- var tmp_16;
128
- if (_this__u8e3s4.m26_1 == null) {
129
- tmp_16 = null;
130
- } else {
131
- // Inline function 'kotlin.let' call
132
- // Inline function 'kotlin.contracts.contract' call
133
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
134
- tmp_16 = 'params.body';
135
- }
136
- var tmp2_elvis_lhs = tmp_16;
137
- return trimIndent('\n |' + tmp + 'export type RequestParams = ' + tmp_1 + '\n |' + tmp_2 + 'export const request = (' + tmp_5 + '): Request => ({\n |' + tmp_6 + 'path: ' + tmp_8 + ',\n |' + tmp_9 + 'method: "' + tmp_10 + '",\n |' + tmp_11 + 'queries: ' + tmp_12 + ',\n |' + tmp_13 + 'headers: ' + tmp_14 + ',\n |' + tmp_15 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
138
- }
139
- function emitFunction_0(_this__u8e3s4, $this) {
140
- var tmp = Spacer_instance.toString();
141
- var tmp_0 = Companion_instance.k24(_this__u8e3s4.o26_1);
142
- var tmp_1 = $this.n26(_this__u8e3s4);
143
- var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEmitter$emitFunction$lambda_3($this));
144
- var tmp_3 = Spacer_instance.toString();
145
- var tmp_4 = Companion_instance.k24(_this__u8e3s4.o26_1);
146
- // Inline function 'kotlin.text.orEmpty' call
147
- // Inline function 'kotlin.takeIf' call
148
- var this_0 = $this.n26(_this__u8e3s4);
149
- // Inline function 'kotlin.contracts.contract' call
150
- var tmp_5;
151
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
152
- // Inline function 'kotlin.collections.isNotEmpty' call
153
- if (!this_0.l()) {
154
- tmp_5 = this_0;
155
- } else {
156
- tmp_5 = null;
157
- }
158
- var tmp_6;
159
- if (tmp_5 == null) {
160
- tmp_6 = null;
161
- } else {
162
- // Inline function 'kotlin.run' call
163
- // Inline function 'kotlin.contracts.contract' call
164
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
165
- tmp_6 = 'params: Response' + Companion_instance.k24(_this__u8e3s4.o26_1) + 'Params';
166
- }
167
- var tmp0_elvis_lhs = tmp_6;
168
- var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
169
- var tmp_8 = Companion_instance.k24(_this__u8e3s4.o26_1);
170
- var tmp_9 = Spacer_instance.p23(2);
171
- var tmp_10 = $this.r26(_this__u8e3s4.o26_1);
172
- var tmp_11 = Spacer_instance.p23(2);
173
- var tmp_12 = joinToObject(_this__u8e3s4.p26_1, $this, TypeScriptEmitter$emitFunction$lambda_4($this));
174
- var tmp_13 = Spacer_instance.p23(2);
175
- var tmp_14;
176
- if (_this__u8e3s4.q26_1 == null) {
177
- tmp_14 = null;
178
- } else {
179
- // Inline function 'kotlin.let' call
180
- // Inline function 'kotlin.contracts.contract' call
181
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emitFunction.<anonymous>' call
182
- tmp_14 = 'params.body';
183
- }
184
- var tmp2_elvis_lhs = tmp_14;
185
- return trimIndent('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
186
- }
187
- function joinToObject(_this__u8e3s4, $this, transform) {
188
- return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
189
- }
190
- function emit(_this__u8e3s4, $this) {
191
- return $this.d25(_this__u8e3s4.w23_1) + (_this__u8e3s4.x23_1.hm() ? '?' : '') + ': ' + $this.n2a(_this__u8e3s4.x23_1.r28(false));
192
- }
193
- function emitName(_this__u8e3s4, $this) {
194
- return 'Response' + Companion_instance.k24(_this__u8e3s4.o26_1);
195
- }
196
- function emitReference_0(_this__u8e3s4, $this) {
197
- var tmp0_safe_receiver = _this__u8e3s4.q26_1;
198
- var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h24_1;
199
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.n2a(tmp1_safe_receiver);
200
- return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
201
- }
202
- function emitType_1(_this__u8e3s4, $this) {
203
- var tmp = Spacer_instance.toString();
204
- var tmp_0 = emitName(_this__u8e3s4, $this);
205
- var tmp_1 = Spacer_instance.p23(2);
206
- var tmp_2 = $this.r26(_this__u8e3s4.o26_1);
207
- var tmp_3 = Spacer_instance.p23(2);
208
- return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.p26_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.p23(2) + 'body: ' + emitReference_0(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
209
- }
210
- function sanitizeSymbol(_this__u8e3s4, $this) {
211
- return sanitizeSymbol_0(_this__u8e3s4.b1(), $this);
212
- }
213
- function sanitizeSymbol_0(_this__u8e3s4, $this) {
214
- var tmp = asSequence(_this__u8e3s4);
215
- return joinToString_0(filter(tmp, TypeScriptEmitter$sanitizeSymbol$lambda), '');
216
- }
217
- function emitClient(_this__u8e3s4, $this) {
218
- return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.p23(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.p23(1)) + '\n |})\n ');
219
- }
220
- function emitPathArray(_this__u8e3s4, $this) {
221
- return joinToString(_this__u8e3s4.u25_1, ', ', '[', ']', VOID, VOID, TypeScriptEmitter$emitPathArray$lambda($this));
222
- }
223
- function emitClientTo(_this__u8e3s4, $this) {
224
- var tmp = Spacer_instance.p23(1);
225
- // Inline function 'kotlin.text.uppercase' call
226
- // Inline function 'kotlin.js.asDynamic' call
227
- var tmp_0 = _this__u8e3s4.t25_1.q2_1.toUpperCase();
228
- var tmp_1 = Spacer_instance.p23(1);
229
- var tmp_2 = emitPathArray(_this__u8e3s4, $this);
230
- var tmp_3 = Spacer_instance.p23(1);
231
- var tmp_4 = joinToString(_this__u8e3s4.v25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEmitter$emitClientTo$lambda($this));
232
- var tmp_5 = Spacer_instance.p23(1);
233
- return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.w25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.p23(1) + 'body: serialization.serialize(it.body)\n |})\n ');
234
- }
235
- function emitClientFrom(_this__u8e3s4, $this) {
236
- var tmp = Spacer_instance.p23(1);
237
- var tmp_0 = $this.s26(_this__u8e3s4.y25_1);
238
- return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emitClientFrom$lambda($this)), Spacer_instance.p23(2)) + '\n |' + Spacer_instance.p23(2) + 'default:\n |' + Spacer_instance.p23(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.p23(1) + '}\n |}\n ');
239
- }
240
- function emitClientFromResponse(_this__u8e3s4, $this) {
241
- var tmp = $this.r26(_this__u8e3s4.o26_1);
242
- var tmp_0 = Spacer_instance.p23(1);
243
- var tmp_1 = Spacer_instance.p23(2);
244
- var tmp_2 = $this.r26(_this__u8e3s4.o26_1);
245
- var tmp_3 = Spacer_instance.p23(2);
246
- return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.p26_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.p23(2) + 'body: serialization.deserialize<' + emitReference_0(_this__u8e3s4, $this) + '>(it.body)\n |' + Spacer_instance.p23(1) + '};\n ');
247
- }
248
- function emitServer(_this__u8e3s4, $this) {
249
- return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.p23(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.p23(1)) + '\n |})\n ');
250
- }
251
- function emitServerFrom(_this__u8e3s4, $this) {
252
- var tmp = Spacer_instance.p23(1);
253
- var tmp_0 = Spacer_instance.p23(2);
254
- // Inline function 'kotlin.text.uppercase' call
255
- // Inline function 'kotlin.js.asDynamic' call
256
- var tmp_1 = _this__u8e3s4.t25_1.q2_1.toUpperCase();
257
- var tmp_2 = Spacer_instance.p23(2);
258
- var tmp_3 = $this.k26(_this__u8e3s4);
259
- var tmp_4 = prependIndent(joinToString(tmp_3, ',', VOID, VOID, VOID, VOID, TypeScriptEmitter$emitServerFrom$lambda($this)), Spacer_instance.p23(3));
260
- var tmp_5 = Spacer_instance.p23(2);
261
- var tmp_6 = Spacer_instance.p23(2);
262
- var tmp_7 = joinToString(_this__u8e3s4.v25_1, ',', VOID, VOID, VOID, VOID, TypeScriptEmitter$emitServerFrom$lambda_0($this));
263
- var tmp_8 = Spacer_instance.p23(2);
264
- var tmp_9 = Spacer_instance.p23(2);
265
- return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.w25_1, ',', VOID, VOID, VOID, VOID, TypeScriptEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.p23(2) + '},\n |' + Spacer_instance.p23(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.p23(1) + '}\n |}\n ');
266
- }
267
- function emitServerTo($this) {
268
- return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.p23(1) + 'status: it.status,\n |' + Spacer_instance.p23(1) + 'headers: {},\n |' + Spacer_instance.p23(1) + 'body: serialization.serialize(it.body),\n |})\n ');
269
- }
270
- function emitDeserialize(_this__u8e3s4, $this) {
271
- return $this.d25(_this__u8e3s4.rd_1.e24_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.qd_1 + '])';
272
- }
273
- function emitDeserialize_0(_this__u8e3s4, $this, fields) {
274
- return $this.d25(_this__u8e3s4.i24_1) + ': serialization.deserialize(it.' + fields + '[' + $this.d25(_this__u8e3s4.i24_1) + '])';
275
- }
276
- function emitSerialize(_this__u8e3s4, $this, fields) {
277
- return $this.d25(_this__u8e3s4.i24_1) + ': serialization.serialize(it.' + fields + '[' + $this.d25(_this__u8e3s4.i24_1) + '])';
278
- }
279
- function TypeScriptEmitter$emit$lambda(it) {
280
- return 'export {' + it.x24().b1() + "} from './" + it.x24().b1() + "'";
281
- }
282
- function TypeScriptEmitter$emit$lambda_0(it) {
283
- // Inline function 'kotlin.text.trimStart' call
284
- return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
285
- }
286
- function TypeScriptEmitter$emit$lambda_1(it) {
287
- return '"' + it + '"';
288
- }
289
- function TypeScriptEmitter$emit$lambda_2(this$0) {
290
- return function (it) {
291
- return this$0.q2a(it);
292
- };
293
- }
294
- function TypeScriptEmitter$emit$lambda_3(it) {
295
- // Inline function 'kotlin.text.trimStart' call
296
- return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
297
- }
298
- function TypeScriptEmitter$emit$lambda_4(this$0) {
299
- return function (it) {
300
- return this$0.t2b(it);
301
- };
302
- }
303
- function TypeScriptEmitter$emit$lambda_5(this$0) {
304
- return function (it) {
305
- return this$0.q2a(it);
306
- };
307
- }
308
- function TypeScriptEmitter$emit$lambda_6(this$0) {
309
- return function (it) {
310
- return this$0.q2a(it);
311
- };
312
- }
313
- function TypeScriptEmitter$emit$lambda_7(this$0) {
314
- return function (it) {
315
- return emitType_1(it, this$0);
316
- };
317
- }
318
- function TypeScriptEmitter$emit$lambda_8(this$0) {
319
- return function (it) {
320
- return emitName(it, this$0);
321
- };
322
- }
323
- function TypeScriptEmitter$emit$lambda_9(this$0) {
324
- return function (it) {
325
- return emitFunction_0(it, this$0);
326
- };
327
- }
328
- function TypeScriptEmitter$emit$lambda_10(this$0) {
329
- return function (it) {
330
- return this$0.h26(it);
331
- };
332
- }
333
- function TypeScriptEmitter$emit$lambda_11(it) {
334
- // Inline function 'kotlin.text.trimStart' call
335
- return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
336
- }
337
- function TypeScriptEmitter$emit$lambda_12(this$0) {
338
- return function (it) {
339
- return this$0.n2a(it);
340
- };
341
- }
342
- function TypeScriptEmitter$emitType$lambda($block) {
343
- return function (it) {
344
- return Spacer_instance.p23(1) + $block(it);
345
- };
346
- }
347
- function TypeScriptEmitter$emitFunction$lambda(this$0) {
348
- return function (it) {
349
- return emit(it, this$0);
350
- };
351
- }
352
- function TypeScriptEmitter$emitFunction$lambda_0(this$0) {
353
- return function (it) {
354
- return this$0.d25(it.e24_1) + ': params[' + this$0.d25(it.e24_1) + ']';
355
- };
356
- }
357
- function TypeScriptEmitter$emitFunction$lambda_1(this$0) {
358
- return function (it) {
359
- return this$0.d25(it.i24_1) + ': params[' + this$0.d25(it.i24_1) + ']';
360
- };
361
- }
362
- function TypeScriptEmitter$emitFunction$lambda_2(this$0) {
363
- return function (it) {
364
- return this$0.d25(it.i24_1) + ': params[' + this$0.d25(it.i24_1) + ']';
365
- };
366
- }
367
- function TypeScriptEmitter$emitFunction$lambda_3(this$0) {
368
- return function (it) {
369
- return emit(it, this$0);
370
- };
371
- }
372
- function TypeScriptEmitter$emitFunction$lambda_4(this$0) {
373
- return function (it) {
374
- return this$0.d25(it.i24_1) + ': params[' + this$0.d25(it.i24_1) + ']';
375
- };
376
- }
377
- function TypeScriptEmitter$emitType$lambda_0(this$0) {
378
- return function (it) {
379
- return this$0.d25(it.i24_1) + ': ' + this$0.n2a(it.j24_1);
380
- };
381
- }
382
- function TypeScriptEmitter$sanitizeSymbol$lambda(it) {
383
- return isLetterOrDigit(it.x_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).o1(it);
384
- }
385
- function TypeScriptEmitter$emitPathArray$lambda(this$0) {
386
- return function (it) {
387
- var tmp;
388
- if (it instanceof Literal) {
389
- tmp = '"' + it.i26_1 + '"';
390
- } else {
391
- if (it instanceof Param) {
392
- tmp = 'serialization.serialize(it.path[' + this$0.d25(it.e24_1) + '])';
393
- } else {
394
- noWhenBranchMatchedException();
395
- }
396
- }
397
- return tmp;
398
- };
399
- }
400
- function TypeScriptEmitter$emitClientTo$lambda(this$0) {
401
- return function (it) {
402
- return emitSerialize(it, this$0, 'queries');
403
- };
404
- }
405
- function TypeScriptEmitter$emitClientTo$lambda_0(this$0) {
406
- return function (it) {
407
- return emitSerialize(it, this$0, 'headers');
408
- };
409
- }
410
- function TypeScriptEmitter$emitClientFrom$lambda(this$0) {
411
- return function (it) {
412
- return emitClientFromResponse(it, this$0);
413
- };
414
- }
415
- function TypeScriptEmitter$emitClientFromResponse$lambda(this$0) {
416
- return function (it) {
417
- return emitDeserialize_0(it, this$0, 'headers');
418
- };
419
- }
420
- function TypeScriptEmitter$emitServerFrom$lambda(this$0) {
421
- return function (it) {
422
- return emitDeserialize(it, this$0);
423
- };
424
- }
425
- function TypeScriptEmitter$emitServerFrom$lambda_0(this$0) {
426
- return function (it) {
427
- return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.p23(3));
428
- };
33
+ import {
34
+ Spacer_instancel9yep7i0q3er as Spacer_instance,
35
+ Emitted12h24rpo4uifw as Emitted,
36
+ ClientEmitter36x0lk1twctuf as ClientEmitter,
37
+ ParamEmitter90po0zctl38y as ParamEmitter,
38
+ SpaceEmitter36bi9y7576grw as SpaceEmitter,
39
+ ImportEmitter1wwmtnnt1doer as ImportEmitter,
40
+ Emitterpslsvv25okcl as Emitter,
41
+ FileExtension_TypeScript_getInstancelv1vlncbu27z as FileExtension_TypeScript_getInstance,
42
+ namespacepzr7vpsv8z39 as namespace,
43
+ Companion_instance2ag0h5twtdral as Companion_instance,
44
+ plus2csvv9vgnno78 as plus,
45
+ emitClientEndpointRequest2jjbqrtgbjtwm as emitClientEndpointRequest,
46
+ Companion_instanceb7vsmblp2jf7 as Companion_instance_0,
47
+ Param33sus5zaarsk0 as Param,
48
+ Literal32wmkquj6qapn as Literal,
49
+ EndpointEmitterjel5bxqmk97i as EndpointEmitter,
50
+ Bytes2moci2lqqzua3 as Bytes,
51
+ Boolean1v54w5v4qjba1 as Boolean_0,
52
+ Number3i05nlui0wcz8 as Number_0,
53
+ Integeryrcje1s9u7kr as Integer,
54
+ String23kqvhe3sk098 as String_0,
55
+ Primitivexjb7c0cm123a as Primitive,
56
+ Custom37hvrfgd6b0uj as Custom,
57
+ Any268baxyo9do19 as Any,
58
+ Unit3rie819ih39bz as Unit,
59
+ Iterablerto606wd057m as Iterable,
60
+ Dict3l6tdihpke4rr as Dict,
61
+ Bytes_instance1at7binw0nl40 as Bytes_instance,
62
+ Boolean_instance3qnzv8pgzox40 as Boolean_instance,
63
+ RegExp1kvu7kxwy7td5 as RegExp_0,
64
+ Bound1dotva4vah4jp as Bound,
65
+ _RegExp___get_value__impl__7o761828ey0cgsx2afa as _RegExp___get_value__impl__7o7618,
66
+ TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
67
+ } from './wirespec-src-compiler-core.mjs';
68
+ //region block: imports
69
+ //endregion
70
+ //region block: pre-declaration
71
+ function emit(identifier) {
72
+ return '"' + identifier.b1() + '"';
429
73
  }
430
- function TypeScriptEmitter$emitServerFrom$lambda_1(this$0) {
431
- return function (it) {
432
- return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.p23(3));
433
- };
74
+ initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
75
+ function sanitizeSymbol(_this__u8e3s4) {
76
+ return this.q2b(_this__u8e3s4.b1());
434
77
  }
435
- function TypeScriptEmitter(emitShared) {
436
- emitShared = emitShared === VOID ? Companion_instance_0.r23() : emitShared;
437
- Emitter.call(this);
438
- this.p2b_1 = emitShared;
439
- this.q2b_1 = FileExtension_TypeScript_getInstance();
440
- this.r2b_1 = TypeScriptShared_getInstance();
441
- this.s2b_1 = '//';
78
+ function sanitizeSymbol_0(_this__u8e3s4) {
79
+ var tmp = asSequence(_this__u8e3s4);
80
+ return joinToString_0(filter(tmp, TypeScriptTypeDefinitionEmitter$sanitizeSymbol$lambda), '');
442
81
  }
443
- protoOf(TypeScriptEmitter).q24 = function () {
444
- return this.q2b_1;
445
- };
446
- protoOf(TypeScriptEmitter).u2a = function () {
447
- return this.r2b_1;
448
- };
449
- protoOf(TypeScriptEmitter).w26 = function () {
450
- return this.s2b_1;
451
- };
452
- protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
453
- // Inline function 'kotlin.let' call
454
- // Inline function 'kotlin.contracts.contract' call
455
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
456
- var it = protoOf(Emitter).d23.call(this, ast, logger);
457
- // Inline function 'kotlin.collections.map' call
458
- // Inline function 'kotlin.collections.groupBy' call
459
- // Inline function 'arrow.core.NonEmptyList.flatMap' call
460
- var this_0 = ast.r24_1;
461
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>.<anonymous>' call
462
- var tmp = this_0.jk_1.o24_1.hk();
463
- // Inline function 'kotlin.collections.flatMap' call
464
- // Inline function 'kotlin.collections.flatMapTo' call
465
- var this_1 = this_0.kk_1;
466
- var destination = ArrayList_init_$Create$();
467
- var tmp0_iterator = this_1.g();
468
- while (tmp0_iterator.h()) {
469
- var element = tmp0_iterator.i();
470
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>.<anonymous>' call
471
- var list = element.o24_1;
472
- addAll(destination, list);
473
- }
474
- // Inline function 'kotlin.collections.groupByTo' call
475
- var this_2 = tmp.ok(destination);
476
- var destination_0 = LinkedHashMap_init_$Create$();
477
- var tmp0_iterator_0 = this_2.g();
478
- while (tmp0_iterator_0.h()) {
479
- var element_0 = tmp0_iterator_0.i();
480
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>.<anonymous>' call
481
- var key = namespace(element_0);
482
- // Inline function 'kotlin.collections.getOrPut' call
483
- var value = destination_0.g2(key);
484
- var tmp_0;
485
- if (value == null) {
486
- // Inline function 'kotlin.collections.groupByTo.<anonymous>' call
487
- var answer = ArrayList_init_$Create$();
488
- destination_0.n2(key, answer);
489
- tmp_0 = answer;
490
- } else {
491
- tmp_0 = value;
492
- }
493
- var list_0 = tmp_0;
494
- list_0.e(element_0);
495
- }
496
- // Inline function 'kotlin.collections.mapTo' call
497
- var destination_1 = ArrayList_init_$Create$_0(destination_0.j());
498
- // Inline function 'kotlin.collections.iterator' call
499
- var tmp0_iterator_1 = destination_0.z().g();
500
- while (tmp0_iterator_1.h()) {
501
- var item = tmp0_iterator_1.i();
502
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>.<anonymous>' call
503
- // Inline function 'kotlin.collections.component1' call
504
- var ns = item.a1();
505
- // Inline function 'kotlin.collections.component2' call
506
- var defs = item.b1();
507
- var tmp_1 = ns + '/index.' + this.q24().v24_1;
508
- var tmp$ret$13 = new Emitted(tmp_1, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
509
- destination_1.e(tmp$ret$13);
510
- }
511
- return it.ok(destination_1);
512
- };
513
- protoOf(TypeScriptEmitter).s24 = function (module_0, logger) {
514
- // Inline function 'kotlin.let' call
515
- // Inline function 'kotlin.contracts.contract' call
516
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
517
- var it = protoOf(Emitter).s24.call(this, module_0, logger);
518
- return this.p2b_1.s23_1 ? it.pk(new Emitted('Wirespec', this.u2a().v2b_1)) : it;
519
- };
520
- protoOf(TypeScriptEmitter).w24 = function (definition, module_0, logger) {
521
- // Inline function 'kotlin.let' call
522
- // Inline function 'kotlin.contracts.contract' call
523
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
524
- var it = protoOf(Emitter).w24.call(this, definition, module_0, logger);
525
- var subPackageName = plus(Companion_instance_1.y26(''), definition);
526
- return new Emitted(subPackageName.b27() + sanitizeSymbol_0(it.t23_1, this), trimMargin('\n |' + TypeScriptShared_getInstance().v2b_1 + '\n |\n |' + it.u23_1 + '\n '));
527
- };
528
- protoOf(TypeScriptEmitter).e26 = function (type, module_0) {
82
+ function emit_0(type, module_0) {
529
83
  // Inline function 'kotlin.collections.map' call
530
84
  // Inline function 'kotlin.collections.distinctBy' call
531
- var this_0 = this.t26(type);
85
+ var this_0 = this.i26(type);
532
86
  var set = HashSet_init_$Create$();
533
87
  var list = ArrayList_init_$Create$();
534
88
  var tmp0_iterator = this_0.g();
535
89
  while (tmp0_iterator.h()) {
536
90
  var e = tmp0_iterator.i();
537
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
538
- var key = e.x28_1;
91
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
92
+ var key = e.h29_1;
539
93
  if (set.e(key)) {
540
94
  list.e(e);
541
95
  }
@@ -545,34 +99,21 @@ protoOf(TypeScriptEmitter).e26 = function (type, module_0) {
545
99
  var tmp0_iterator_0 = list.g();
546
100
  while (tmp0_iterator_0.h()) {
547
101
  var item = tmp0_iterator_0.i();
548
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
549
- var tmp$ret$2 = 'import {' + item.x28_1 + "} from './" + item.x28_1 + "'";
102
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
103
+ var tmp$ret$2 = 'import {' + item.h29_1 + "} from './" + item.h29_1 + "'";
550
104
  destination.e(tmp$ret$2);
551
105
  }
552
106
  var tmp = destination;
553
- return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0) + '\n |export type ' + sanitizeSymbol(type.b26_1, this) + ' = {\n |' + this.x2a(type.c26_1) + '\n |}\n |\n ');
554
- };
555
- protoOf(TypeScriptEmitter).q25 = function (enum_0, module_0) {
556
- var tmp = sanitizeSymbol(enum_0.o25_1, this);
557
- return 'export type ' + tmp + ' = ' + joinToString(enum_0.p25_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1) + '\n';
558
- };
559
- protoOf(TypeScriptEmitter).x2a = function (_this__u8e3s4) {
560
- return joinToString(_this__u8e3s4.u26_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_2(this));
561
- };
562
- protoOf(TypeScriptEmitter).t2b = function (_this__u8e3s4) {
563
- return Spacer_instance.toString() + this.d25(_this__u8e3s4.e24_1) + ': ' + this.n2a(_this__u8e3s4.f24_1);
564
- };
565
- protoOf(TypeScriptEmitter).q2a = function (_this__u8e3s4) {
566
- return Spacer_instance.toString() + this.d25(_this__u8e3s4.i24_1) + ': ' + this.n2a(_this__u8e3s4.j24_1);
567
- };
568
- protoOf(TypeScriptEmitter).n2a = function (_this__u8e3s4) {
107
+ return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.p2b(type.q25_1) + ' = {\n |' + this.u25(type.r25_1) + '\n |}\n |\n ');
108
+ }
109
+ function emit_1(_this__u8e3s4) {
569
110
  // Inline function 'kotlin.let' call
570
111
  var tmp;
571
112
  if (_this__u8e3s4 instanceof Dict) {
572
- tmp = 'Record<string, ' + this.n2a(_this__u8e3s4.b24_1) + '>';
113
+ tmp = 'Record<string, ' + this.w25(_this__u8e3s4.r23_1) + '>';
573
114
  } else {
574
115
  if (_this__u8e3s4 instanceof Iterable) {
575
- tmp = this.n2a(_this__u8e3s4.y23_1) + '[]';
116
+ tmp = this.w25(_this__u8e3s4.o23_1) + '[]';
576
117
  } else {
577
118
  if (_this__u8e3s4 instanceof Unit) {
578
119
  tmp = 'void';
@@ -581,10 +122,10 @@ protoOf(TypeScriptEmitter).n2a = function (_this__u8e3s4) {
581
122
  tmp = 'any';
582
123
  } else {
583
124
  if (_this__u8e3s4 instanceof Custom) {
584
- tmp = sanitizeSymbol_0(_this__u8e3s4.x28_1, this);
125
+ tmp = this.q2b(_this__u8e3s4.h29_1);
585
126
  } else {
586
127
  if (_this__u8e3s4 instanceof Primitive) {
587
- var tmp1_subject = _this__u8e3s4.b29_1;
128
+ var tmp1_subject = _this__u8e3s4.l29_1;
588
129
  var tmp_0;
589
130
  if (tmp1_subject instanceof String_0) {
590
131
  tmp_0 = 'string';
@@ -617,34 +158,31 @@ protoOf(TypeScriptEmitter).n2a = function (_this__u8e3s4) {
617
158
  }
618
159
  }
619
160
  // Inline function 'kotlin.contracts.contract' call
620
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
161
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
621
162
  return tmp + (_this__u8e3s4.hm() ? ' | undefined' : '');
622
- };
623
- protoOf(TypeScriptEmitter).m25 = function (refined) {
624
- return trimMargin('\n |export type ' + sanitizeSymbol(refined.k25_1, this) + ' = string;\n |export const validate' + refined.k25_1.b1() + ' = (value: string): value is ' + sanitizeSymbol(refined.k25_1, this) + ' => \n |' + Spacer_instance.toString() + this.y2a(refined) + ';\n |\n ');
625
- };
626
- protoOf(TypeScriptEmitter).y2a = function (_this__u8e3s4) {
163
+ }
164
+ function emitValidator(_this__u8e3s4) {
627
165
  var defaultReturn = 'true;';
628
- var type = _this__u8e3s4.l25_1.b29_1;
166
+ var type = _this__u8e3s4.a25_1.l29_1;
629
167
  var tmp;
630
168
  if (type instanceof Integer) {
631
- var tmp0_safe_receiver = type.h28_1;
632
- var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.z2a(tmp0_safe_receiver);
169
+ var tmp0_safe_receiver = type.r28_1;
170
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.x25(tmp0_safe_receiver);
633
171
  tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
634
172
  } else {
635
173
  if (type instanceof Number_0) {
636
- var tmp2_safe_receiver = type.k28_1;
637
- var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.z2a(tmp2_safe_receiver);
174
+ var tmp2_safe_receiver = type.u28_1;
175
+ var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.x25(tmp2_safe_receiver);
638
176
  tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
639
177
  } else {
640
178
  if (type instanceof String_0) {
641
- var tmp4_safe_receiver = type.e28_1;
179
+ var tmp4_safe_receiver = type.o28_1;
642
180
  var tmp_0;
643
181
  var tmp_1 = tmp4_safe_receiver;
644
182
  if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
645
183
  tmp_0 = null;
646
184
  } else {
647
- tmp_0 = this.z2a(new RegExp_0(tmp4_safe_receiver));
185
+ tmp_0 = this.x25(new RegExp_0(tmp4_safe_receiver));
648
186
  }
649
187
  var tmp5_elvis_lhs = tmp_0;
650
188
  tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
@@ -662,31 +200,329 @@ protoOf(TypeScriptEmitter).y2a = function (_this__u8e3s4) {
662
200
  }
663
201
  }
664
202
  return tmp;
665
- };
666
- protoOf(TypeScriptEmitter).z2a = function (_this__u8e3s4) {
203
+ }
204
+ function emit_2(_this__u8e3s4) {
667
205
  var tmp;
668
206
  if (_this__u8e3s4 instanceof RegExp_0) {
669
- tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.b28_1) + '.test(value)';
207
+ tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.l28_1) + '.test(value)';
670
208
  } else {
671
209
  if (_this__u8e3s4 instanceof Bound) {
672
- tmp = '' + _this__u8e3s4.c28_1 + ' < value && value < ' + _this__u8e3s4.d28_1 + ';';
210
+ tmp = '' + _this__u8e3s4.m28_1 + ' < value && value < ' + _this__u8e3s4.n28_1 + ';';
211
+ } else {
212
+ noWhenBranchMatchedException();
213
+ }
214
+ }
215
+ return tmp;
216
+ }
217
+ function emit_3(_this__u8e3s4) {
218
+ return joinToString(_this__u8e3s4.u26_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
219
+ }
220
+ function emit_4(_this__u8e3s4) {
221
+ return Spacer_instance.toString() + this.s24(_this__u8e3s4.v26_1) + ': ' + this.w25(_this__u8e3s4.w26_1);
222
+ }
223
+ initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, ImportEmitter, TypeScriptIdentifierEmitter]);
224
+ function emitClient(ast) {
225
+ var tmp = 'client.' + this.k24().j24_1;
226
+ var tmp_0 = this.n26(ast);
227
+ var tmp_1 = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda);
228
+ // Inline function 'kotlin.collections.distinctBy' call
229
+ // Inline function 'kotlin.collections.flatMap' call
230
+ // Inline function 'arrow.core.NonEmptyList.flatMap' call
231
+ var this_0 = ast.f24_1;
232
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
233
+ var tmp_2 = this_0.jk_1.d24_1.hk();
234
+ // Inline function 'kotlin.collections.flatMap' call
235
+ // Inline function 'kotlin.collections.flatMapTo' call
236
+ var this_1 = this_0.kk_1;
237
+ var destination = ArrayList_init_$Create$();
238
+ var tmp0_iterator = this_1.g();
239
+ while (tmp0_iterator.h()) {
240
+ var element = tmp0_iterator.i();
241
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
242
+ var list = element.d24_1;
243
+ addAll(destination, list);
244
+ }
245
+ // Inline function 'kotlin.collections.flatMapTo' call
246
+ var this_2 = tmp_2.ok(destination).nk();
247
+ var destination_0 = ArrayList_init_$Create$();
248
+ var tmp0_iterator_0 = this_2.g();
249
+ while (tmp0_iterator_0.h()) {
250
+ var element_0 = tmp0_iterator_0.i();
251
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
252
+ var list_0 = this.i26(element_0);
253
+ addAll(destination_0, list_0);
254
+ }
255
+ var set = HashSet_init_$Create$();
256
+ var list_1 = ArrayList_init_$Create$();
257
+ var tmp0_iterator_1 = destination_0.g();
258
+ while (tmp0_iterator_1.h()) {
259
+ var e = tmp0_iterator_1.i();
260
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
261
+ var key = e.h29_1;
262
+ if (set.e(key)) {
263
+ list_1.e(e);
264
+ }
265
+ }
266
+ var tmp_3 = list_1;
267
+ var tmp_4 = joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
268
+ var tmp_5 = this.n26(ast);
269
+ return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_4 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const Client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' + this.g26(joinToString(tmp_5, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_1(this)), 1) + '\n |})\n |\n '));
270
+ }
271
+ initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, ParamEmitter, SpaceEmitter, ImportEmitter, TypeScriptTypeDefinitionEmitter]);
272
+ function emit_5(enum_0, module_0) {
273
+ var tmp = this.p2b(enum_0.d25_1);
274
+ return 'export type ' + tmp + ' = ' + joinToString(enum_0.e25_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
275
+ }
276
+ initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
277
+ function emit_6(endpoint) {
278
+ // Inline function 'kotlin.collections.map' call
279
+ // Inline function 'kotlin.collections.distinctBy' call
280
+ var this_0 = this.i26(endpoint);
281
+ var set = HashSet_init_$Create$();
282
+ var list = ArrayList_init_$Create$();
283
+ var tmp0_iterator = this_0.g();
284
+ while (tmp0_iterator.h()) {
285
+ var e = tmp0_iterator.i();
286
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
287
+ var key = e.h29_1;
288
+ if (set.e(key)) {
289
+ list.e(e);
290
+ }
291
+ }
292
+ // Inline function 'kotlin.collections.mapTo' call
293
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
294
+ var tmp0_iterator_0 = list.g();
295
+ while (tmp0_iterator_0.h()) {
296
+ var item = tmp0_iterator_0.i();
297
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
298
+ var tmp$ret$2 = 'import {' + item.h29_1 + "} from '../model'";
299
+ destination.e(tmp$ret$2);
300
+ }
301
+ var tmp = destination;
302
+ var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
303
+ var tmp_1 = this.p2b(endpoint.h25_1);
304
+ var tmp_2 = this.d26(endpoint);
305
+ var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
306
+ var tmp_4 = emitType(endpoint.k25_1, this, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
307
+ var tmp_5 = emitType(endpoint.l25_1, this, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
308
+ var tmp_6 = emitType_1(first(endpoint.m25_1), this, endpoint);
309
+ var tmp_7 = this.l26(endpoint.n25_1);
310
+ var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
311
+ var tmp_9 = Spacer_instance.toString();
312
+ var tmp_10 = this.l26(endpoint.n25_1);
313
+ var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
314
+ var tmp_12 = emitFunction_0(first(endpoint.m25_1), this, endpoint);
315
+ var tmp_13 = this.l26(endpoint.n25_1);
316
+ var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
317
+ var tmp_15 = Spacer_instance.toString();
318
+ var tmp_16 = Spacer_instance.i27(2);
319
+ var tmp_17 = emitHandleFunction(this, endpoint);
320
+ var tmp_18 = Spacer_instance.toString();
321
+ var tmp_19 = prependIndent(emitClient_0(endpoint, this), Spacer_instance.i27(1));
322
+ var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.i27(1));
323
+ var tmp_21 = Spacer_instance.toString();
324
+ var tmp_22 = Spacer_instance.i27(2);
325
+ var tmp_23 = Companion_instance_0.a24(this.p2b(endpoint.h25_1));
326
+ var tmp_24 = Spacer_instance.i27(2);
327
+ var tmp_25 = Spacer_instance.i27(2);
328
+ return trimMargin('\n |' + tmp_0 + '\n |export namespace ' + tmp_1 + ' {\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_5 + '\n |' + tmp_6 + '\n |' + tmp_8 + '\n |' + tmp_9 + 'export type Response = ' + tmp_11 + '\n |' + tmp_12 + '\n |' + tmp_14 + '\n |' + tmp_15 + 'export type Handler = {\n |' + tmp_16 + tmp_17 + '\n |' + tmp_18 + '}\n |' + tmp_19 + '\n |' + tmp_20 + '\n |' + tmp_21 + 'export const api = {\n |' + tmp_22 + 'name: "' + tmp_23 + '",\n |' + tmp_24 + 'method: "' + endpoint.i25_1.q2_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.j25_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.i27(2) + 'server,\n |' + Spacer_instance.i27(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
329
+ }
330
+ function emit_7(_this__u8e3s4) {
331
+ var tmp;
332
+ if (_this__u8e3s4 instanceof Literal) {
333
+ tmp = _this__u8e3s4.q26_1;
334
+ } else {
335
+ if (_this__u8e3s4 instanceof Param) {
336
+ tmp = ':' + _this__u8e3s4.o26_1.b1();
673
337
  } else {
674
338
  noWhenBranchMatchedException();
675
339
  }
676
340
  }
677
341
  return tmp;
342
+ }
343
+ initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [ImportEmitter, ParamEmitter, EndpointEmitter, TypeScriptTypeDefinitionEmitter]);
344
+ function emit_8(refined) {
345
+ return trimMargin('\n |export type ' + this.p2b(refined.z24_1) + ' = string;\n |export const validate' + refined.z24_1.b1() + ' = (value: string): value is ' + this.p2b(refined.z24_1) + ' => \n |' + Spacer_instance.toString() + this.z25(refined) + ';\n |\n ');
346
+ }
347
+ initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
348
+ initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, Emitter, [Emitter, TypeScriptEnumDefinitionEmitter, TypeScriptIdentifierEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptClientEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter]);
349
+ initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
350
+ //endregion
351
+ function emitClientInterface(_this__u8e3s4, $this, endpoint) {
352
+ var tmp = $this.e26(_this__u8e3s4, endpoint);
353
+ return joinToString(tmp, ', ', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClientInterface$lambda($this));
354
+ }
355
+ function emitFunction($this, endpoint, request) {
356
+ var tmp = endpoint.h25_1.b1();
357
+ var tmp_0 = emitClientInterface(request, $this, endpoint);
358
+ var tmp_1 = Spacer_instance.toString();
359
+ var tmp_2 = endpoint.h25_1.b1();
360
+ // Inline function 'kotlin.text.orEmpty' call
361
+ // Inline function 'kotlin.takeIf' call
362
+ var this_0 = $this.e26(request, endpoint);
363
+ // Inline function 'kotlin.contracts.contract' call
364
+ var tmp_3;
365
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
366
+ // Inline function 'kotlin.collections.isNotEmpty' call
367
+ if (!this_0.l()) {
368
+ tmp_3 = this_0;
369
+ } else {
370
+ tmp_3 = null;
371
+ }
372
+ var tmp_4;
373
+ if (tmp_3 == null) {
374
+ tmp_4 = null;
375
+ } else {
376
+ // Inline function 'kotlin.let' call
377
+ // Inline function 'kotlin.contracts.contract' call
378
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
379
+ tmp_4 = 'props';
380
+ }
381
+ var tmp0_elvis_lhs = tmp_4;
382
+ var tmp$ret$5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
383
+ return trimMargin('\n |' + tmp + ': async (props: {' + tmp_0 + '}) => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.h25_1.b1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.h25_1.b1() + '.client(serialization).from(rawResponse)\n |},\n ');
384
+ }
385
+ function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
386
+ var endpoint = _destruct__k2r9zo.sd();
387
+ return 'import {' + endpoint.h25_1.b1() + '} from "./endpoint/' + endpoint.h25_1.b1() + '"';
388
+ }
389
+ function TypeScriptClientEmitter$emitClient$lambda_0(it) {
390
+ return 'import {' + it.h29_1 + '} from "./model/' + it.h29_1 + '"';
391
+ }
392
+ function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
393
+ return function (_destruct__k2r9zo) {
394
+ var endpoint = _destruct__k2r9zo.sd();
395
+ var request = _destruct__k2r9zo.td();
396
+ return emitFunction(this$0, endpoint, request);
397
+ };
398
+ }
399
+ function TypeScriptClientEmitter$emitClientInterface$lambda(this$0) {
400
+ return function (it) {
401
+ return it.f27_1.b1() + ': ' + this$0.w25(it.g27_1);
402
+ };
403
+ }
404
+ function TypeScriptClientEmitter() {
405
+ }
406
+ function TypeScriptEmitter$emit$lambda(it) {
407
+ return 'export {' + it.m24().b1() + "} from './" + it.m24().b1() + "'";
408
+ }
409
+ function TypeScriptEmitter$emit$lambda_0(it) {
410
+ // Inline function 'kotlin.text.trimStart' call
411
+ return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
412
+ }
413
+ function TypeScriptEmitter$emit$lambda_1(this$0) {
414
+ return function (it) {
415
+ return this$0.w25(it);
416
+ };
417
+ }
418
+ function TypeScriptEmitter() {
419
+ Emitter.call(this);
420
+ this.r2b_1 = FileExtension_TypeScript_getInstance();
421
+ this.s2b_1 = TypeScriptShared_getInstance();
422
+ this.t2b_1 = '//';
423
+ }
424
+ protoOf(TypeScriptEmitter).k24 = function () {
425
+ return this.r2b_1;
426
+ };
427
+ protoOf(TypeScriptEmitter).x2a = function () {
428
+ return this.s2b_1;
429
+ };
430
+ protoOf(TypeScriptEmitter).b26 = function () {
431
+ return this.t2b_1;
432
+ };
433
+ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
434
+ // Inline function 'kotlin.run' call
435
+ // Inline function 'kotlin.contracts.contract' call
436
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
437
+ var $this$run = protoOf(Emitter).d23.call(this, ast, logger);
438
+ var tmp;
439
+ if (this.m26(ast)) {
440
+ tmp = $this$run.pk(this.o2b(ast));
441
+ } else {
442
+ tmp = $this$run;
443
+ }
444
+ var tmp_0 = tmp;
445
+ // Inline function 'kotlin.collections.map' call
446
+ // Inline function 'kotlin.collections.groupBy' call
447
+ // Inline function 'arrow.core.NonEmptyList.flatMap' call
448
+ var this_0 = ast.f24_1;
449
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
450
+ var tmp_1 = this_0.jk_1.d24_1.hk();
451
+ // Inline function 'kotlin.collections.flatMap' call
452
+ // Inline function 'kotlin.collections.flatMapTo' call
453
+ var this_1 = this_0.kk_1;
454
+ var destination = ArrayList_init_$Create$();
455
+ var tmp0_iterator = this_1.g();
456
+ while (tmp0_iterator.h()) {
457
+ var element = tmp0_iterator.i();
458
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
459
+ var list = element.d24_1;
460
+ addAll(destination, list);
461
+ }
462
+ // Inline function 'kotlin.collections.groupByTo' call
463
+ var this_2 = tmp_1.ok(destination);
464
+ var destination_0 = LinkedHashMap_init_$Create$();
465
+ var tmp0_iterator_0 = this_2.g();
466
+ while (tmp0_iterator_0.h()) {
467
+ var element_0 = tmp0_iterator_0.i();
468
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
469
+ var key = namespace(element_0);
470
+ // Inline function 'kotlin.collections.getOrPut' call
471
+ var value = destination_0.g2(key);
472
+ var tmp_2;
473
+ if (value == null) {
474
+ // Inline function 'kotlin.collections.groupByTo.<anonymous>' call
475
+ var answer = ArrayList_init_$Create$();
476
+ destination_0.n2(key, answer);
477
+ tmp_2 = answer;
478
+ } else {
479
+ tmp_2 = value;
480
+ }
481
+ var list_0 = tmp_2;
482
+ list_0.e(element_0);
483
+ }
484
+ // Inline function 'kotlin.collections.mapTo' call
485
+ var destination_1 = ArrayList_init_$Create$_0(destination_0.j());
486
+ // Inline function 'kotlin.collections.iterator' call
487
+ var tmp0_iterator_1 = destination_0.z().g();
488
+ while (tmp0_iterator_1.h()) {
489
+ var item = tmp0_iterator_1.i();
490
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
491
+ // Inline function 'kotlin.collections.component1' call
492
+ var ns = item.a1();
493
+ // Inline function 'kotlin.collections.component2' call
494
+ var defs = item.b1();
495
+ var tmp_3 = ns + '/index.' + this.k24().j24_1;
496
+ var tmp$ret$15 = new Emitted(tmp_3, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
497
+ destination_1.e(tmp$ret$15);
498
+ }
499
+ return tmp_0.ok(destination_1);
678
500
  };
679
- protoOf(TypeScriptEmitter).z25 = function (endpoint) {
501
+ protoOf(TypeScriptEmitter).g24 = function (module_0, logger) {
502
+ // Inline function 'kotlin.let' call
503
+ // Inline function 'kotlin.contracts.contract' call
504
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
505
+ return protoOf(Emitter).g24.call(this, module_0, logger).pk(new Emitted('Wirespec', this.x2a().v2b_1));
506
+ };
507
+ protoOf(TypeScriptEmitter).l24 = function (definition, module_0, logger) {
508
+ // Inline function 'kotlin.let' call
509
+ // Inline function 'kotlin.contracts.contract' call
510
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
511
+ var it = protoOf(Emitter).l24.call(this, definition, module_0, logger);
512
+ var subPackageName = plus(Companion_instance.a27(''), definition);
513
+ return new Emitted(subPackageName.d27() + this.q2b(it.x23_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.y23_1 + '\n '));
514
+ };
515
+ protoOf(TypeScriptEmitter).x24 = function (union) {
680
516
  // Inline function 'kotlin.collections.map' call
681
517
  // Inline function 'kotlin.collections.distinctBy' call
682
- var this_0 = this.t26(endpoint);
518
+ var this_0 = this.i26(union);
683
519
  var set = HashSet_init_$Create$();
684
520
  var list = ArrayList_init_$Create$();
685
521
  var tmp0_iterator = this_0.g();
686
522
  while (tmp0_iterator.h()) {
687
523
  var e = tmp0_iterator.i();
688
524
  // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
689
- var key = e.x28_1;
525
+ var key = e.h29_1;
690
526
  if (set.e(key)) {
691
527
  list.e(e);
692
528
  }
@@ -697,86 +533,365 @@ protoOf(TypeScriptEmitter).z25 = function (endpoint) {
697
533
  while (tmp0_iterator_0.h()) {
698
534
  var item = tmp0_iterator_0.i();
699
535
  // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
700
- var tmp$ret$2 = 'import {' + item.x28_1 + "} from '../model'";
536
+ var tmp$ret$2 = 'import {' + item.h29_1 + "} from '../model'";
701
537
  destination.e(tmp$ret$2);
702
538
  }
703
539
  var tmp = destination;
704
- var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_3);
705
- var tmp_1 = sanitizeSymbol(endpoint.s25_1, this);
706
- var tmp_2 = this.j26(endpoint);
707
- var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEmitter$emit$lambda_4(this));
708
- var tmp_4 = emitType(endpoint.v25_1, this, 'Queries', TypeScriptEmitter$emit$lambda_5(this));
709
- var tmp_5 = emitType(endpoint.w25_1, this, 'Headers', TypeScriptEmitter$emit$lambda_6(this));
710
- var tmp_6 = emitType_0(first(endpoint.x25_1), this, endpoint);
711
- var tmp_7 = this.s26(endpoint.y25_1);
712
- var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_7(this));
713
- var tmp_9 = Spacer_instance.toString();
714
- var tmp_10 = this.s26(endpoint.y25_1);
715
- var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_8(this));
716
- var tmp_12 = emitFunction(first(endpoint.x25_1), this, endpoint);
717
- var tmp_13 = this.s26(endpoint.y25_1);
718
- var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_9(this));
719
- var tmp_15 = Spacer_instance.toString();
720
- var tmp_16 = Spacer_instance.p23(2);
721
- var tmp_17 = emitHandleFunction(this, endpoint);
722
- var tmp_18 = Spacer_instance.toString();
723
- var tmp_19 = prependIndent(emitClient(endpoint, this), Spacer_instance.p23(1));
724
- var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.p23(1));
725
- var tmp_21 = Spacer_instance.toString();
726
- var tmp_22 = Spacer_instance.p23(2);
727
- var tmp_23 = Companion_instance.l24(sanitizeSymbol(endpoint.s25_1, this));
728
- var tmp_24 = Spacer_instance.p23(2);
729
- var tmp_25 = Spacer_instance.p23(2);
730
- return trimMargin('\n |' + tmp_0 + '\n |export namespace ' + tmp_1 + ' {\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_5 + '\n |' + tmp_6 + '\n |' + tmp_8 + '\n |' + tmp_9 + 'export type Response = ' + tmp_11 + '\n |' + tmp_12 + '\n |' + tmp_14 + '\n |' + tmp_15 + 'export type Handler = {\n |' + tmp_16 + tmp_17 + '\n |' + tmp_18 + '}\n |' + tmp_19 + '\n |' + tmp_20 + '\n |' + tmp_21 + 'export const api = {\n |' + tmp_22 + 'name: "' + tmp_23 + '",\n |' + tmp_24 + 'method: "' + endpoint.t25_1.q2_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.u25_1, '/', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_10(this)) + '",\n |' + Spacer_instance.p23(2) + 'server,\n |' + Spacer_instance.p23(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
540
+ var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
541
+ var tmp_1 = this.p2b(union.v24_1);
542
+ return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.w24_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
543
+ };
544
+ protoOf(TypeScriptEmitter).t24 = function (channel) {
545
+ return this.c26();
731
546
  };
732
- protoOf(TypeScriptEmitter).h26 = function (_this__u8e3s4) {
547
+ function emitClient_0(_this__u8e3s4, $this) {
548
+ return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.i27(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.i27(1)) + '\n |})\n ');
549
+ }
550
+ function emitClientTo(_this__u8e3s4, $this) {
551
+ var tmp = Spacer_instance.i27(1);
552
+ // Inline function 'kotlin.text.uppercase' call
553
+ // Inline function 'kotlin.js.asDynamic' call
554
+ var tmp_0 = _this__u8e3s4.i25_1.q2_1.toUpperCase();
555
+ var tmp_1 = Spacer_instance.i27(1);
556
+ var tmp_2 = emitPathArray(_this__u8e3s4, $this);
557
+ var tmp_3 = Spacer_instance.i27(1);
558
+ var tmp_4 = joinToString(_this__u8e3s4.k25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
559
+ var tmp_5 = Spacer_instance.i27(1);
560
+ return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.l25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.i27(1) + 'body: serialization.serialize(it.body)\n |})\n ');
561
+ }
562
+ function emitClientFrom(_this__u8e3s4, $this) {
563
+ var tmp = Spacer_instance.i27(1);
564
+ var tmp_0 = $this.l26(_this__u8e3s4.n25_1);
565
+ return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.i27(2)) + '\n |' + Spacer_instance.i27(2) + 'default:\n |' + Spacer_instance.i27(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.i27(1) + '}\n |}\n ');
566
+ }
567
+ function emitClientFromResponse(_this__u8e3s4, $this) {
568
+ var tmp = $this.k26(_this__u8e3s4.r26_1);
569
+ var tmp_0 = Spacer_instance.i27(1);
570
+ var tmp_1 = Spacer_instance.i27(2);
571
+ var tmp_2 = $this.k26(_this__u8e3s4.r26_1);
572
+ var tmp_3 = Spacer_instance.i27(2);
573
+ return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.s26_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.i27(2) + 'body: serialization.deserialize<' + emitReference(_this__u8e3s4, $this) + '>(it.body)\n |' + Spacer_instance.i27(1) + '};\n ');
574
+ }
575
+ function emitServer(_this__u8e3s4, $this) {
576
+ return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.i27(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.i27(1)) + '\n |})\n ');
577
+ }
578
+ function emitServerFrom(_this__u8e3s4, $this) {
579
+ var tmp = Spacer_instance.i27(1);
580
+ var tmp_0 = Spacer_instance.i27(2);
581
+ // Inline function 'kotlin.text.uppercase' call
582
+ // Inline function 'kotlin.js.asDynamic' call
583
+ var tmp_1 = _this__u8e3s4.i25_1.q2_1.toUpperCase();
584
+ var tmp_2 = Spacer_instance.i27(2);
585
+ var tmp_3 = $this.j26(_this__u8e3s4);
586
+ var tmp_4 = prependIndent(joinToString(tmp_3, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.i27(3));
587
+ var tmp_5 = Spacer_instance.i27(2);
588
+ var tmp_6 = Spacer_instance.i27(2);
589
+ var tmp_7 = joinToString(_this__u8e3s4.k25_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
590
+ var tmp_8 = Spacer_instance.i27(2);
591
+ var tmp_9 = Spacer_instance.i27(2);
592
+ return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.l25_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.i27(2) + '},\n |' + Spacer_instance.i27(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.i27(1) + '}\n |}\n ');
593
+ }
594
+ function emitServerTo($this) {
595
+ return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.i27(1) + 'status: it.status,\n |' + Spacer_instance.i27(1) + 'headers: {},\n |' + Spacer_instance.i27(1) + 'body: serialization.serialize(it.body),\n |})\n ');
596
+ }
597
+ function emitType(_this__u8e3s4, $this, name, block) {
733
598
  var tmp;
734
- if (_this__u8e3s4 instanceof Literal) {
735
- tmp = _this__u8e3s4.i26_1;
599
+ if (_this__u8e3s4.l()) {
600
+ tmp = Spacer_instance.toString() + 'type ' + name + ' = {}';
736
601
  } else {
737
- if (_this__u8e3s4 instanceof Param) {
738
- tmp = ':' + _this__u8e3s4.e24_1.b1();
739
- } else {
740
- noWhenBranchMatchedException();
741
- }
602
+ var tmp_0 = Spacer_instance.toString();
603
+ tmp = trimMargin('\n |' + tmp_0 + 'type ' + name + ' = {\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda(block)) + ',\n |' + Spacer_instance.toString() + '}\n ');
742
604
  }
743
605
  return tmp;
744
- };
745
- protoOf(TypeScriptEmitter).i25 = function (union) {
746
- // Inline function 'kotlin.collections.map' call
747
- // Inline function 'kotlin.collections.distinctBy' call
748
- var this_0 = this.t26(union);
749
- var set = HashSet_init_$Create$();
750
- var list = ArrayList_init_$Create$();
751
- var tmp0_iterator = this_0.g();
752
- while (tmp0_iterator.h()) {
753
- var e = tmp0_iterator.i();
754
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
755
- var key = e.x28_1;
756
- if (set.e(key)) {
757
- list.e(e);
758
- }
606
+ }
607
+ function emitName(_this__u8e3s4, $this) {
608
+ return 'Response' + Companion_instance_0.z23(_this__u8e3s4.r26_1);
609
+ }
610
+ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
611
+ var tmp = Spacer_instance.toString();
612
+ var tmp_0 = $this.e26(_this__u8e3s4, endpoint);
613
+ var tmp_1 = joinToObject(tmp_0, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda($this));
614
+ var tmp_2 = Spacer_instance.toString();
615
+ // Inline function 'kotlin.text.orEmpty' call
616
+ // Inline function 'kotlin.takeIf' call
617
+ var this_0 = $this.e26(_this__u8e3s4, endpoint);
618
+ // Inline function 'kotlin.contracts.contract' call
619
+ var tmp_3;
620
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
621
+ // Inline function 'kotlin.collections.isNotEmpty' call
622
+ if (!this_0.l()) {
623
+ tmp_3 = this_0;
624
+ } else {
625
+ tmp_3 = null;
759
626
  }
760
- // Inline function 'kotlin.collections.mapTo' call
761
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
762
- var tmp0_iterator_0 = list.g();
763
- while (tmp0_iterator_0.h()) {
764
- var item = tmp0_iterator_0.i();
765
- // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
766
- var tmp$ret$2 = 'import {' + item.x28_1 + "} from '../model'";
767
- destination.e(tmp$ret$2);
627
+ var tmp_4;
628
+ if (tmp_3 == null) {
629
+ tmp_4 = null;
630
+ } else {
631
+ // Inline function 'kotlin.run' call
632
+ // Inline function 'kotlin.contracts.contract' call
633
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
634
+ tmp_4 = 'params: RequestParams';
768
635
  }
769
- var tmp = destination;
770
- var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_11);
771
- var tmp_1 = sanitizeSymbol(union.g25_1, this);
772
- return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.h25_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_12(this)) + '\n |\n ');
773
- };
774
- protoOf(TypeScriptEmitter).d25 = function (identifier) {
775
- return '"' + identifier.b1() + '"';
776
- };
777
- protoOf(TypeScriptEmitter).e25 = function (channel) {
778
- return this.x26();
779
- };
636
+ var tmp0_elvis_lhs = tmp_4;
637
+ var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
638
+ var tmp_6 = Spacer_instance.i27(2);
639
+ var tmp_7 = $this.d26(endpoint);
640
+ var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
641
+ var tmp_9 = Spacer_instance.i27(2);
642
+ var tmp_10 = endpoint.i25_1.toString();
643
+ var tmp_11 = Spacer_instance.i27(2);
644
+ var tmp_12 = joinToObject(endpoint.k25_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
645
+ var tmp_13 = Spacer_instance.i27(2);
646
+ var tmp_14 = joinToObject(endpoint.l25_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
647
+ var tmp_15 = Spacer_instance.i27(2);
648
+ var tmp_16;
649
+ if (_this__u8e3s4.x26_1 == null) {
650
+ tmp_16 = null;
651
+ } else {
652
+ // Inline function 'kotlin.let' call
653
+ // Inline function 'kotlin.contracts.contract' call
654
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
655
+ tmp_16 = 'params.body';
656
+ }
657
+ var tmp2_elvis_lhs = tmp_16;
658
+ return trimIndent('\n |' + tmp + 'export type RequestParams = ' + tmp_1 + '\n |' + tmp_2 + 'export const request = (' + tmp_5 + '): Request => ({\n |' + tmp_6 + 'path: ' + tmp_8 + ',\n |' + tmp_9 + 'method: "' + tmp_10 + '",\n |' + tmp_11 + 'queries: ' + tmp_12 + ',\n |' + tmp_13 + 'headers: ' + tmp_14 + ',\n |' + tmp_15 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
659
+ }
660
+ function emitFunction_1(_this__u8e3s4, $this) {
661
+ var tmp = Spacer_instance.toString();
662
+ var tmp_0 = Companion_instance_0.z23(_this__u8e3s4.r26_1);
663
+ var tmp_1 = $this.f26(_this__u8e3s4);
664
+ var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
665
+ var tmp_3 = Spacer_instance.toString();
666
+ var tmp_4 = Companion_instance_0.z23(_this__u8e3s4.r26_1);
667
+ // Inline function 'kotlin.text.orEmpty' call
668
+ // Inline function 'kotlin.takeIf' call
669
+ var this_0 = $this.f26(_this__u8e3s4);
670
+ // Inline function 'kotlin.contracts.contract' call
671
+ var tmp_5;
672
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
673
+ // Inline function 'kotlin.collections.isNotEmpty' call
674
+ if (!this_0.l()) {
675
+ tmp_5 = this_0;
676
+ } else {
677
+ tmp_5 = null;
678
+ }
679
+ var tmp_6;
680
+ if (tmp_5 == null) {
681
+ tmp_6 = null;
682
+ } else {
683
+ // Inline function 'kotlin.run' call
684
+ // Inline function 'kotlin.contracts.contract' call
685
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
686
+ tmp_6 = 'params: Response' + Companion_instance_0.z23(_this__u8e3s4.r26_1) + 'Params';
687
+ }
688
+ var tmp0_elvis_lhs = tmp_6;
689
+ var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
690
+ var tmp_8 = Companion_instance_0.z23(_this__u8e3s4.r26_1);
691
+ var tmp_9 = Spacer_instance.i27(2);
692
+ var tmp_10 = $this.k26(_this__u8e3s4.r26_1);
693
+ var tmp_11 = Spacer_instance.i27(2);
694
+ var tmp_12 = joinToObject(_this__u8e3s4.s26_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
695
+ var tmp_13 = Spacer_instance.i27(2);
696
+ var tmp_14;
697
+ if (_this__u8e3s4.t26_1 == null) {
698
+ tmp_14 = null;
699
+ } else {
700
+ // Inline function 'kotlin.let' call
701
+ // Inline function 'kotlin.contracts.contract' call
702
+ // Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
703
+ tmp_14 = 'params.body';
704
+ }
705
+ var tmp2_elvis_lhs = tmp_14;
706
+ return trimIndent('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
707
+ }
708
+ function emitReference(_this__u8e3s4, $this) {
709
+ var tmp0_safe_receiver = _this__u8e3s4.t26_1;
710
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z26_1;
711
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.w25(tmp1_safe_receiver);
712
+ return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
713
+ }
714
+ function emitPathArray(_this__u8e3s4, $this) {
715
+ return joinToString(_this__u8e3s4.j25_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
716
+ }
717
+ function emitType_0(_this__u8e3s4, $this) {
718
+ var tmp = Spacer_instance.toString();
719
+ var tmp_0 = emitName(_this__u8e3s4, $this);
720
+ var tmp_1 = Spacer_instance.i27(2);
721
+ var tmp_2 = $this.k26(_this__u8e3s4.r26_1);
722
+ var tmp_3 = Spacer_instance.i27(2);
723
+ return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.s26_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.i27(2) + 'body: ' + emitReference(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
724
+ }
725
+ function emitReference_0(_this__u8e3s4, $this) {
726
+ var tmp0_safe_receiver = _this__u8e3s4.x26_1;
727
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z26_1;
728
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.w25(tmp1_safe_receiver);
729
+ return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
730
+ }
731
+ function emitType_1(_this__u8e3s4, $this, endpoint) {
732
+ return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.i27(2) + 'path: Path\n |' + Spacer_instance.i27(2) + 'method: "' + endpoint.i25_1.toString() + '"\n |' + Spacer_instance.i27(2) + 'queries: Queries\n |' + Spacer_instance.i27(2) + 'headers: Headers\n |' + Spacer_instance.i27(2) + 'body: ' + emitReference_0(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
733
+ }
734
+ function emit_9(_this__u8e3s4, $this) {
735
+ return Spacer_instance.toString() + $this.s24(_this__u8e3s4.o26_1) + ': ' + $this.w25(_this__u8e3s4.p26_1);
736
+ }
737
+ function emit_10(_this__u8e3s4, $this) {
738
+ return $this.s24(_this__u8e3s4.f27_1) + (_this__u8e3s4.g27_1.hm() ? '?' : '') + ': ' + $this.w25(_this__u8e3s4.g27_1.b29(false));
739
+ }
740
+ function emitDeserialize(_this__u8e3s4, $this) {
741
+ return $this.s24(_this__u8e3s4.rd_1.o26_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.qd_1 + '])';
742
+ }
743
+ function emitDeserialize_0(_this__u8e3s4, $this, fields) {
744
+ return $this.s24(_this__u8e3s4.v26_1) + ': serialization.deserialize(it.' + fields + '[' + $this.s24(_this__u8e3s4.v26_1) + '])';
745
+ }
746
+ function emitSerialize(_this__u8e3s4, $this, fields) {
747
+ return $this.s24(_this__u8e3s4.v26_1) + ': serialization.serialize(it.' + fields + '[' + $this.s24(_this__u8e3s4.v26_1) + '])';
748
+ }
749
+ function joinToObject(_this__u8e3s4, $this, transform) {
750
+ return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
751
+ }
752
+ function emitHandleFunction($this, endpoint) {
753
+ return Companion_instance_0.a24($this.p2b(endpoint.h25_1)) + ': (request:Request) => Promise<Response>';
754
+ }
755
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda(it) {
756
+ // Inline function 'kotlin.text.trimStart' call
757
+ return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
758
+ }
759
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this$0) {
760
+ return function (it) {
761
+ return emit_9(it, this$0);
762
+ };
763
+ }
764
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this$0) {
765
+ return function (it) {
766
+ return this$0.v25(it);
767
+ };
768
+ }
769
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this$0) {
770
+ return function (it) {
771
+ return this$0.v25(it);
772
+ };
773
+ }
774
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this$0) {
775
+ return function (it) {
776
+ return emitType_0(it, this$0);
777
+ };
778
+ }
779
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this$0) {
780
+ return function (it) {
781
+ return emitName(it, this$0);
782
+ };
783
+ }
784
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this$0) {
785
+ return function (it) {
786
+ return emitFunction_1(it, this$0);
787
+ };
788
+ }
789
+ function TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this$0) {
790
+ return function (it) {
791
+ return this$0.y25(it);
792
+ };
793
+ }
794
+ function TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda(this$0) {
795
+ return function (it) {
796
+ return emitSerialize(it, this$0, 'queries');
797
+ };
798
+ }
799
+ function TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0(this$0) {
800
+ return function (it) {
801
+ return emitSerialize(it, this$0, 'headers');
802
+ };
803
+ }
804
+ function TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda(this$0) {
805
+ return function (it) {
806
+ return emitClientFromResponse(it, this$0);
807
+ };
808
+ }
809
+ function TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda(this$0) {
810
+ return function (it) {
811
+ return emitDeserialize_0(it, this$0, 'headers');
812
+ };
813
+ }
814
+ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda(this$0) {
815
+ return function (it) {
816
+ return emitDeserialize(it, this$0);
817
+ };
818
+ }
819
+ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0(this$0) {
820
+ return function (it) {
821
+ return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.i27(3));
822
+ };
823
+ }
824
+ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1(this$0) {
825
+ return function (it) {
826
+ return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.i27(3));
827
+ };
828
+ }
829
+ function TypeScriptEndpointDefinitionEmitter$emitType$lambda($block) {
830
+ return function (it) {
831
+ return Spacer_instance.i27(1) + $block(it);
832
+ };
833
+ }
834
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
835
+ return function (it) {
836
+ return emit_10(it, this$0);
837
+ };
838
+ }
839
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0(this$0) {
840
+ return function (it) {
841
+ return this$0.s24(it.o26_1) + ': params[' + this$0.s24(it.o26_1) + ']';
842
+ };
843
+ }
844
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1(this$0) {
845
+ return function (it) {
846
+ return this$0.s24(it.v26_1) + ': params[' + this$0.s24(it.v26_1) + ']';
847
+ };
848
+ }
849
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2(this$0) {
850
+ return function (it) {
851
+ return this$0.s24(it.v26_1) + ': params[' + this$0.s24(it.v26_1) + ']';
852
+ };
853
+ }
854
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
855
+ return function (it) {
856
+ return emit_10(it, this$0);
857
+ };
858
+ }
859
+ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4(this$0) {
860
+ return function (it) {
861
+ return this$0.s24(it.v26_1) + ': params[' + this$0.s24(it.v26_1) + ']';
862
+ };
863
+ }
864
+ function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
865
+ return function (it) {
866
+ var tmp;
867
+ if (it instanceof Literal) {
868
+ tmp = '"' + it.q26_1 + '"';
869
+ } else {
870
+ if (it instanceof Param) {
871
+ tmp = 'serialization.serialize(it.path[' + this$0.s24(it.o26_1) + '])';
872
+ } else {
873
+ noWhenBranchMatchedException();
874
+ }
875
+ }
876
+ return tmp;
877
+ };
878
+ }
879
+ function TypeScriptEndpointDefinitionEmitter$emitType$lambda_0(this$0) {
880
+ return function (it) {
881
+ return this$0.s24(it.v26_1) + ': ' + this$0.w25(it.w26_1);
882
+ };
883
+ }
884
+ function TypeScriptEndpointDefinitionEmitter() {
885
+ }
886
+ function TypeScriptEnumDefinitionEmitter$emit$lambda(it) {
887
+ return '"' + it + '"';
888
+ }
889
+ function TypeScriptEnumDefinitionEmitter() {
890
+ }
891
+ function TypeScriptIdentifierEmitter() {
892
+ }
893
+ function TypeScriptRefinedTypeDefinitionEmitter() {
894
+ }
780
895
  function TypeScriptShared() {
781
896
  TypeScriptShared_instance = this;
782
897
  this.u2b_1 = 'community.flock.wirespec';
@@ -802,6 +917,37 @@ function TypeScriptShared_getInstance() {
802
917
  new TypeScriptShared();
803
918
  return TypeScriptShared_instance;
804
919
  }
920
+ function TypeScriptTypeDefinitionEmitter$sanitizeSymbol$lambda(it) {
921
+ return isLetterOrDigit(it.x_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).o1(it);
922
+ }
923
+ function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
924
+ // Inline function 'kotlin.text.trimStart' call
925
+ return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
926
+ }
927
+ function TypeScriptTypeDefinitionEmitter$emit$lambda_0(this$0) {
928
+ return function (it) {
929
+ return this$0.v25(it);
930
+ };
931
+ }
932
+ function TypeScriptTypeDefinitionEmitter() {
933
+ }
934
+ //region block: post-declaration
935
+ protoOf(TypeScriptEmitter).y25 = emit_7;
936
+ protoOf(TypeScriptEmitter).f25 = emit_5;
937
+ protoOf(TypeScriptEmitter).t25 = emit_0;
938
+ protoOf(TypeScriptEmitter).w25 = emit_1;
939
+ protoOf(TypeScriptEmitter).x25 = emit_2;
940
+ protoOf(TypeScriptEmitter).u25 = emit_3;
941
+ protoOf(TypeScriptEmitter).v25 = emit_4;
942
+ protoOf(TypeScriptEmitter).s24 = emit;
943
+ protoOf(TypeScriptEmitter).o25 = emit_6;
944
+ protoOf(TypeScriptEmitter).b25 = emit_8;
945
+ protoOf(TypeScriptEmitter).z25 = emitValidator;
946
+ protoOf(TypeScriptEmitter).p2b = sanitizeSymbol;
947
+ protoOf(TypeScriptEmitter).q2b = sanitizeSymbol_0;
948
+ protoOf(TypeScriptEmitter).o2b = emitClient;
949
+ protoOf(TypeScriptEmitter).n26 = emitClientEndpointRequest;
950
+ //endregion
805
951
  //region block: exports
806
952
  export {
807
953
  TypeScriptEmitter as TypeScriptEmitter1b8xo1btx35xi,