@flock/wirespec 0.18.1-RC.3 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/clikt-clikt-mordant.mjs +79 -79
  2. package/clikt-clikt.mjs +1265 -1265
  3. package/clikt-clikt.mjs.map +1 -1
  4. package/colormath-root-colormath.mjs +433 -433
  5. package/kotlin-kotlin-stdlib.mjs +34 -28
  6. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  7. package/kotlin-openapi-bindings.mjs +5407 -5405
  8. package/kotlin-openapi-bindings.mjs.map +1 -1
  9. package/kotlin-rgxgen.mjs +1760 -1760
  10. package/kotlinx-io-kotlinx-io-core.mjs +404 -404
  11. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1701 -1701
  12. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1320 -1319
  13. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  14. package/mordant-mordant.mjs +1198 -1198
  15. package/package.json +1 -1
  16. package/wirespec-src-compiler-core.mjs +192 -205
  17. package/wirespec-src-compiler-core.mjs.map +1 -1
  18. package/wirespec-src-compiler-emitters-java.mjs +711 -777
  19. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  20. package/wirespec-src-compiler-emitters-kotlin.mjs +311 -418
  21. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  22. package/wirespec-src-compiler-emitters-python.mjs +640 -769
  23. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  24. package/wirespec-src-compiler-emitters-rust.mjs +1582 -1708
  25. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
  26. package/wirespec-src-compiler-emitters-scala.mjs +680 -635
  27. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
  28. package/wirespec-src-compiler-emitters-typescript.mjs +579 -562
  29. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  30. package/wirespec-src-compiler-emitters-wirespec.mjs +20 -20
  31. package/wirespec-src-compiler-ir.mjs +5428 -6057
  32. package/wirespec-src-compiler-ir.mjs.map +1 -1
  33. package/wirespec-src-compiler-lib.mjs +279 -279
  34. package/wirespec-src-converter-avro.mjs +559 -559
  35. package/wirespec-src-converter-avro.mjs.map +1 -1
  36. package/wirespec-src-converter-openapi.mjs +802 -404
  37. package/wirespec-src-converter-openapi.mjs.map +1 -1
  38. package/wirespec-src-plugin-arguments.mjs +144 -144
  39. package/wirespec-src-plugin-cli.mjs +87 -87
  40. package/wirespec-src-plugin-npm.mjs +44 -25
  41. package/wirespec-src-plugin-npm.mjs.map +1 -1
  42. package/wirespec-src-tools-generator.mjs +13 -13
@@ -43,25 +43,26 @@ import {
43
43
  KProperty1ca4yb4wlo496 as KProperty1,
44
44
  getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
45
45
  listOf1jh22dvmctj1r as listOf,
46
- firstOrNull1982767dljvdy as firstOrNull_0,
47
- toSet2orjxp16sotqu as toSet,
48
- emptySetcxexqki71qfa as emptySet,
49
46
  listOfvhqybd2zx248 as listOf_0,
50
47
  to2cs3ny02qtbcb as to,
51
48
  toMap1vec9topfei08 as toMap,
52
- removePrefix279df90bhrqqg as removePrefix,
53
- plus310ted5e4i90h as plus,
54
- contains3ue2qo8xhmpf1 as contains,
55
- mapCapacity1h45rc3eh9p2l as mapCapacity,
56
- LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
57
49
  lazy2hsh8ze7j6ikd as lazy,
58
50
  Collection1k04j3hzsbod0 as Collection,
59
51
  emptyList1g2z5xcrvp2zy as emptyList,
60
52
  dropLast1vpiyky649o34 as dropLast,
61
53
  drop3na99dw9feawf as drop,
62
54
  HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
63
- Paire9pteg33gng7 as Pair,
55
+ toSet2orjxp16sotqu as toSet,
56
+ plus310ted5e4i90h as plus,
64
57
  addAll1k27qatfgp3k5 as addAll,
58
+ firstOrNull1982767dljvdy as firstOrNull_0,
59
+ Paire9pteg33gng7 as Pair,
60
+ plus20p0vtfmu0596 as plus_0,
61
+ emptySetcxexqki71qfa as emptySet,
62
+ removePrefix279df90bhrqqg as removePrefix,
63
+ contains3ue2qo8xhmpf1 as contains,
64
+ mapCapacity1h45rc3eh9p2l as mapCapacity,
65
+ LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
65
66
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
66
67
  } from './kotlin-kotlin-stdlib.mjs';
67
68
  import {
@@ -77,7 +78,7 @@ import {
77
78
  Enum3l2iuc342kle6 as Enum,
78
79
  Emitted12h24rpo4uifw as Emitted,
79
80
  Model1nx3had6rojzt as Model,
80
- plus3lrm73de10b42 as plus_0,
81
+ plus3lrm73de10b42 as plus_1,
81
82
  Spacer_instance1p6915grp4mfk as Spacer_instance,
82
83
  get_indexedPathParams2pzt0qs62068 as get_indexedPathParams,
83
84
  orNull2zq556ke3x99j as orNull,
@@ -95,9 +96,8 @@ import {
95
96
  get_pathParamsf41cxx5qebxt as get_pathParams,
96
97
  FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
97
98
  DefinitionIdentifiervfasqdb33qef as DefinitionIdentifier,
98
- Shared1uygqfbd22ukz as Shared,
99
+ plus14o24vdaiongg as plus_2,
99
100
  String1czvr8pxnm6on as String_0,
100
- plus14o24vdaiongg as plus_1,
101
101
  Bytes_instance1o9u095wd3kx6 as Bytes_instance,
102
102
  Boolean_instance237vwt01w3hs8 as Boolean_instance,
103
103
  RegExpiyof7szm5zfu as RegExp_0,
@@ -123,54 +123,55 @@ import {
123
123
  } from './arrow-arrow-core.mjs';
124
124
  import {
125
125
  import5uhkz67bd8tt as import_0,
126
- TransformScopeyrd3lf4zrk76 as TransformScope,
127
- TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
128
- transform3eti8i2bqvifx as transform,
129
- Elementitq62jg6fid3 as Element,
130
- File3dimy4iqmuock as File,
131
- Struct39wf79cwtn4ty as Struct,
132
126
  Nameoqr8dt2fim9d as Name,
133
127
  transformChildren2mszeagj5nq4c as transformChildren,
134
128
  sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
135
129
  ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
136
130
  SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
137
- convert13xvfhgrf57n5 as convert,
138
- generatePython28c6k5s89bmk1 as generatePython,
139
- FieldCall1iz7z2fx2xo4p as FieldCall,
140
- Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
141
- VariableReference2vlynnhaw1i64 as VariableReference,
142
- Custom2si7lto3wompr as Custom_0,
143
- Parameteruqoxd4rzw7ga as Parameter,
144
- Function21cuq8qizkin7 as Function,
145
- transformChildrend9p91tpcqdkx as transformChildren_0,
146
- Enumlszg09mwd24f as Enum_0,
147
- Boolean_instance27opaqtiiiysz as Boolean_instance_0,
148
- String_instance3uxvo48ki208u as String_instance,
149
- RawExpression2bo7ldfrptjia as RawExpression,
150
- Interface3pn84xq686t2r as Interface,
151
- FunctionCall30872kpnbr7op as FunctionCall,
131
+ sortKey2uc13shubz5xy as sortKey,
152
132
  PythonGenerator_instance3bpw212sztsap as PythonGenerator_instance,
133
+ convertnty9x0e63d0u as convert,
134
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
135
+ rawttvqxl50flj9 as raw,
136
+ File3dimy4iqmuock as File,
153
137
  emit3bzdcd0f6nwtj as emit,
154
- RawElement2yts1x2rbem1g as RawElement,
155
138
  emitn3eihixilqyh as emit_0,
156
139
  prependImports32gcj3yb8voha as prependImports,
157
140
  placeInModule10pilwex0h8tn as placeInModule,
158
141
  convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
142
+ injectSelfReceiverToValidate4xgr9r5gl5n3 as injectSelfReceiverToValidate,
159
143
  sanitizeNames2wqmyf8vafp9x as sanitizeNames,
160
144
  convert11ert2po54h1y as convert_0,
145
+ sanitizeEnumEntries3pphrvzq8r9fn as sanitizeEnumEntries,
161
146
  convert37aabdzvtv9vg as convert_1,
162
147
  convert17zcptkz4mhr4 as convert_2,
163
- function12vu2kapzno4w as function_0,
164
- convertConstraintkgpvomct0x0s as convertConstraint,
165
148
  convert32tuiui3czihh as convert_3,
166
- Namespace345pal554qu3j as Namespace,
167
- flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
168
- Union38f3pecvfcpxh as Union_0,
169
149
  convert1cn4bolzoed8c as convert_4,
170
150
  emitEndpointClient1meajc90wf3el as emitEndpointClient,
171
151
  emitClient32kfwzg2hm5vj as emitClient,
172
152
  emit1oxjujel6f3jb as emit_1,
173
153
  IrEmitterh2m93ojzvkep as IrEmitter,
154
+ TransformScopeyrd3lf4zrk76 as TransformScope,
155
+ TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
156
+ transform3eti8i2bqvifx as transform,
157
+ Elementitq62jg6fid3 as Element,
158
+ Namespace345pal554qu3j as Namespace,
159
+ flattenNestedStructs2956rxx8q2zxl as flattenNestedStructs,
160
+ Union38f3pecvfcpxh as Union_0,
161
+ Struct39wf79cwtn4ty as Struct,
162
+ Custom2si7lto3wompr as Custom_0,
163
+ Boolean_instance27opaqtiiiysz as Boolean_instance_0,
164
+ String_instance3uxvo48ki208u as String_instance,
165
+ RawExpression2bo7ldfrptjia as RawExpression,
166
+ Function21cuq8qizkin7 as Function,
167
+ function12vu2kapzno4w as function_0,
168
+ VariableReference2vlynnhaw1i64 as VariableReference,
169
+ FieldCall1iz7z2fx2xo4p as FieldCall,
170
+ convertConstraintkgpvomct0x0s as convertConstraint,
171
+ transformChildrend9p91tpcqdkx as transformChildren_0,
172
+ Interface3pn84xq686t2r as Interface,
173
+ Parameteruqoxd4rzw7ga as Parameter,
174
+ FunctionCall30872kpnbr7op as FunctionCall,
174
175
  } from './wirespec-src-compiler-ir.mjs';
175
176
  //region block: imports
176
177
  //endregion
@@ -183,10 +184,10 @@ initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, V
183
184
  function emit_3(identifier) {
184
185
  var tmp;
185
186
  if (identifier instanceof DefinitionIdentifier) {
186
- tmp = this.s1w(identifier);
187
+ tmp = this.c1w(identifier);
187
188
  } else {
188
189
  if (identifier instanceof FieldIdentifier) {
189
- tmp = this.a1w(this.s1w(identifier));
190
+ tmp = this.s1v(this.c1w(identifier));
190
191
  } else {
191
192
  noWhenBranchMatchedException();
192
193
  }
@@ -242,10 +243,19 @@ function sanitize(_this__u8e3s4) {
242
243
  return tmp;
243
244
  }
244
245
  function sanitizeKeywords(_this__u8e3s4) {
245
- return Companion_getInstance_0().f1y_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
246
+ return Companion_getInstance_0().l1x_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
246
247
  }
247
248
  initMetadataForInterface(PythonIdentifierEmitter, 'PythonIdentifierEmitter');
248
- function emit_4(type, module_0) {
249
+ function emit_4(union) {
250
+ return trimMargin('\n |class ' + this.wq(union.qo_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
251
+ }
252
+ initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
253
+ function emit_5(enum_0, module_0) {
254
+ var tmp = this.c1w(enum_0.gr_1);
255
+ return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.hr_1, '\n', VOID, VOID, VOID, VOID, PythonEnumDefinitionEmitter$emit$lambda(this)) + '\n |\n |' + Spacer_instance.toString() + '@property\n |' + Spacer_instance.toString() + 'def label(self) -> str:\n |' + Spacer_instance.qr(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return self.value\n ');
256
+ }
257
+ initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
258
+ function emit_6(type, module_0) {
249
259
  var tmp;
250
260
  if (type.wo_1.so_1.r()) {
251
261
  var tmp_0 = this.wq(type.vo_1);
@@ -260,16 +270,16 @@ function emit_4(type, module_0) {
260
270
  }
261
271
  return tmp;
262
272
  }
263
- function emit_5(_this__u8e3s4) {
273
+ function emit_7(_this__u8e3s4) {
264
274
  return joinToString(_this__u8e3s4.so_1, '\n', VOID, VOID, VOID, VOID, PythonTypeDefinitionEmitter$emit$lambda_1(this));
265
275
  }
266
- function emit_6(_this__u8e3s4) {
276
+ function emit_8(_this__u8e3s4) {
267
277
  return this.wq(_this__u8e3s4.ap_1) + ": '" + this.xp(_this__u8e3s4.bp_1) + "'";
268
278
  }
269
- function emit_7(_this__u8e3s4) {
279
+ function emit_9(_this__u8e3s4) {
270
280
  // Inline function 'kotlin.let' call
271
- var it = this.d1y(_this__u8e3s4);
272
- return _this__u8e3s4.du() ? 'Optional[' + it + ']' : it;
281
+ var it = this.j1x(_this__u8e3s4);
282
+ return _this__u8e3s4.cu() ? 'Optional[' + it + ']' : it;
273
283
  }
274
284
  function emitType(_this__u8e3s4) {
275
285
  var tmp;
@@ -286,10 +296,10 @@ function emitType(_this__u8e3s4) {
286
296
  tmp = 'Any';
287
297
  } else {
288
298
  if (_this__u8e3s4 instanceof Custom) {
289
- tmp = _this__u8e3s4.lu_1;
299
+ tmp = _this__u8e3s4.ku_1;
290
300
  } else {
291
301
  if (_this__u8e3s4 instanceof Primitive) {
292
- tmp = this.b1y(_this__u8e3s4.pu_1);
302
+ tmp = this.h1x(_this__u8e3s4.ou_1);
293
303
  } else {
294
304
  noWhenBranchMatchedException();
295
305
  }
@@ -300,7 +310,7 @@ function emitType(_this__u8e3s4) {
300
310
  }
301
311
  return tmp;
302
312
  }
303
- function emit_8(_this__u8e3s4) {
313
+ function emit_10(_this__u8e3s4) {
304
314
  var tmp;
305
315
  if (_this__u8e3s4 instanceof String_0) {
306
316
  tmp = 'str';
@@ -325,13 +335,13 @@ function emit_8(_this__u8e3s4) {
325
335
  }
326
336
  return tmp;
327
337
  }
328
- function emit_9(_this__u8e3s4) {
338
+ function emit_11(_this__u8e3s4) {
329
339
  var tmp;
330
340
  if (_this__u8e3s4 instanceof RegExp_0) {
331
341
  tmp = 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.ys_1) + '", self.value))';
332
342
  } else {
333
343
  if (_this__u8e3s4 instanceof Bound) {
334
- var tmp1_safe_receiver = _this__u8e3s4.pt_1;
344
+ var tmp1_safe_receiver = _this__u8e3s4.ot_1;
335
345
  var tmp_0;
336
346
  if (tmp1_safe_receiver == null) {
337
347
  tmp_0 = null;
@@ -340,7 +350,7 @@ function emit_9(_this__u8e3s4) {
340
350
  tmp_0 = tmp1_safe_receiver + ' < self.value';
341
351
  }
342
352
  var minCheck = tmp_0;
343
- var tmp2_safe_receiver = _this__u8e3s4.qt_1;
353
+ var tmp2_safe_receiver = _this__u8e3s4.pt_1;
344
354
  var tmp_1;
345
355
  if (tmp2_safe_receiver == null) {
346
356
  tmp_1 = null;
@@ -366,18 +376,62 @@ function emit_9(_this__u8e3s4) {
366
376
  return tmp;
367
377
  }
368
378
  function emitReferenceCustomImports(_this__u8e3s4) {
369
- return 'from ..model.' + _this__u8e3s4.lu_1 + ' import ' + _this__u8e3s4.lu_1;
379
+ return 'from ..model.' + _this__u8e3s4.ku_1 + ' import ' + _this__u8e3s4.ku_1;
370
380
  }
371
381
  initMetadataForInterface(PythonTypeDefinitionEmitter, 'PythonTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, PythonIdentifierEmitter]);
372
- function emit_10(endpoint) {
382
+ function emit_12(refined) {
383
+ return trimMargin('\n |@dataclass\n |class ' + this.c1w(refined.br_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.j1x(refined.cr_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.qr(2) + 'return ' + this.kr(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return str(self.value)\n |\n ');
384
+ }
385
+ function emitValidator(_this__u8e3s4) {
386
+ var defaultReturn = 'True';
387
+ var type = _this__u8e3s4.cr_1.ou_1;
388
+ var tmp;
389
+ if (type instanceof Integer) {
390
+ var tmp0_safe_receiver = type.tt_1;
391
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yp(tmp0_safe_receiver);
392
+ tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
393
+ } else {
394
+ if (type instanceof Number_0) {
395
+ var tmp2_safe_receiver = type.wt_1;
396
+ var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.yp(tmp2_safe_receiver);
397
+ tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
398
+ } else {
399
+ if (type instanceof String_0) {
400
+ var tmp4_safe_receiver = type.qt_1;
401
+ var tmp_0;
402
+ var tmp_1 = tmp4_safe_receiver;
403
+ if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
404
+ tmp_0 = null;
405
+ } else {
406
+ tmp_0 = this.yp(new RegExp_0(tmp4_safe_receiver));
407
+ }
408
+ var tmp5_elvis_lhs = tmp_0;
409
+ tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
410
+ } else {
411
+ if (equals(type, Boolean_instance)) {
412
+ tmp = defaultReturn;
413
+ } else {
414
+ if (equals(type, Bytes_instance)) {
415
+ tmp = defaultReturn;
416
+ } else {
417
+ noWhenBranchMatchedException();
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ return tmp;
424
+ }
425
+ initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
426
+ function emit_13(endpoint) {
373
427
  var tmp = importReferences(endpoint);
374
428
  var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda(this));
375
429
  var tmp_1 = this.wq(endpoint.ep_1);
376
- var tmp_2 = spacer(this.x1v(first(endpoint.jp_1), endpoint), 1);
430
+ var tmp_2 = spacer(this.p1v(first(endpoint.jp_1), endpoint), 1);
377
431
  var tmp_3 = distinctByStatus(endpoint.kp_1);
378
432
  return trimMargin('\n |' + tmp_0 + '\n |\n |class ' + tmp_1 + ' (Wirespec.Endpoint):\n |' + tmp_2 + '\n |' + spacer(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_0(this, endpoint)), 1) + '\n |' + spacer(emitResponseUnion(this, endpoint), 1) + '\n |' + spacer(emitHandleClass(this, endpoint), 1) + '\n |' + spacer(emitConvertClass(this, endpoint), 1) + '\n |\n ');
379
433
  }
380
- function emit_11(_this__u8e3s4, endpoint) {
434
+ function emit_14(_this__u8e3s4, endpoint) {
381
435
  var tmp = emit_18(this, _this__u8e3s4.np_1);
382
436
  var tmp_0 = get_pathParams(endpoint);
383
437
  var tmp_1 = emitObject$default(this, tmp_0, 'Path', 'Wirespec.Request.Path', VOID, PythonEndpointDefinitionEmitter$emit$lambda_1(this));
@@ -410,7 +464,7 @@ function emit_11(_this__u8e3s4, endpoint) {
410
464
  var tmp_28 = paramList(_this__u8e3s4, endpoint);
411
465
  return trimMargin('\n |@dataclass\n |class Request(Wirespec.Request[' + tmp + ']):\n |' + tmp_1 + '\n |' + tmp_2 + '\n |' + tmp_3 + '\n |\n |' + tmp_4 + '@property\n |' + tmp_5 + 'def body(self) -> ' + tmp_6 + ':\n |' + tmp_7 + tmp_8 + 'return self._body\n |\n |' + tmp_9 + '@property\n |' + tmp_10 + 'def path(self) -> Path:\n |' + tmp_11 + tmp_12 + 'return self._path\n |\n |' + tmp_13 + '@property\n |' + tmp_14 + 'def queries(self) -> Queries:\n |' + tmp_15 + tmp_16 + 'return self._queries\n |\n |' + tmp_17 + '@property\n |' + tmp_18 + 'def headers(self) -> Headers:\n |' + tmp_19 + tmp_20 + 'return self._headers\n |\n |' + tmp_21 + '_body: ' + tmp_22 + '\n |' + tmp_23 + '_headers: Headers\n |' + tmp_24 + '_queries: Queries\n |' + tmp_25 + '_path: Path\n |' + tmp_26 + 'method: Wirespec.Method = Wirespec.Method.' + endpoint.fp_1.a3_1 + '\n |\n |' + tmp_27 + 'def __init__(self, ' + joinToString(tmp_28, ', ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_4(this)) + '):\n |' + spacer(emitAssignSelf_0(this, _this__u8e3s4, endpoint), 2) + '\n |\n ');
412
466
  }
413
- function emit_12(_this__u8e3s4, endpoint) {
467
+ function emit_15(_this__u8e3s4, endpoint) {
414
468
  var tmp = emit_18(this, _this__u8e3s4.sp_1);
415
469
  var tmp_0 = emitObject$default(this, _this__u8e3s4.rp_1, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_5(this));
416
470
  var tmp_1 = Spacer_instance.toString();
@@ -431,80 +485,26 @@ function emit_12(_this__u8e3s4, endpoint) {
431
485
  return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.qp_1 + '(Wirespec.Response[' + tmp + ']):\n |' + tmp_0 + '\n |\n |' + tmp_1 + '@property\n |' + tmp_2 + 'def headers(self) -> Headers:\n |' + tmp_3 + tmp_4 + 'return self._headers\n |\n |' + tmp_5 + '@property\n |' + tmp_6 + 'def body(self) -> ' + tmp_7 + ':\n |' + tmp_8 + tmp_9 + 'return self._body\n |\n |' + tmp_10 + '_body: ' + tmp_11 + '\n |' + tmp_12 + '_headers: Headers\n |' + tmp_13 + 'status: int = ' + _this__u8e3s4.qp_1 + '\n |\n |' + tmp_14 + 'def __init__(self, ' + joinToString(tmp_15, ', ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_6(this)) + '):\n |' + spacer(emitAssignSelf_1(this, _this__u8e3s4, endpoint), 2) + '\n |\n ');
432
486
  }
433
487
  initMetadataForInterface(PythonEndpointDefinitionEmitter, 'PythonEndpointDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter]);
434
- function emit_13(refined) {
435
- return trimMargin('\n |@dataclass\n |class ' + this.s1w(refined.br_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.d1y(refined.cr_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.qr(2) + 'return ' + this.kr(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return str(self.value)\n |\n ');
436
- }
437
- function emitValidator(_this__u8e3s4) {
438
- var defaultReturn = 'True';
439
- var type = _this__u8e3s4.cr_1.pu_1;
440
- var tmp;
441
- if (type instanceof Integer) {
442
- var tmp0_safe_receiver = type.ut_1;
443
- var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yp(tmp0_safe_receiver);
444
- tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
445
- } else {
446
- if (type instanceof Number_0) {
447
- var tmp2_safe_receiver = type.xt_1;
448
- var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.yp(tmp2_safe_receiver);
449
- tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
450
- } else {
451
- if (type instanceof String_0) {
452
- var tmp4_safe_receiver = type.rt_1;
453
- var tmp_0;
454
- var tmp_1 = tmp4_safe_receiver;
455
- if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
456
- tmp_0 = null;
457
- } else {
458
- tmp_0 = this.yp(new RegExp_0(tmp4_safe_receiver));
459
- }
460
- var tmp5_elvis_lhs = tmp_0;
461
- tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
462
- } else {
463
- if (equals(type, Boolean_instance)) {
464
- tmp = defaultReturn;
465
- } else {
466
- if (equals(type, Bytes_instance)) {
467
- tmp = defaultReturn;
468
- } else {
469
- noWhenBranchMatchedException();
470
- }
471
- }
472
- }
473
- }
474
- }
475
- return tmp;
476
- }
477
- initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
478
- function emit_14(enum_0, module_0) {
479
- var tmp = this.s1w(enum_0.gr_1);
480
- return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.hr_1, '\n', VOID, VOID, VOID, VOID, PythonEnumDefinitionEmitter$emit$lambda(this)) + '\n |\n |' + Spacer_instance.toString() + '@property\n |' + Spacer_instance.toString() + 'def label(self) -> str:\n |' + Spacer_instance.qr(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return self.value\n ');
481
- }
482
- initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
483
- function emit_15(union) {
484
- return trimMargin('\n |class ' + this.wq(union.qo_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
485
- }
486
- initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
487
- initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonChannelDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonTypeDefinitionEmitter, PythonIdentifierEmitter, PythonRefinedTypeDefinitionEmitter, PythonEnumDefinitionEmitter, PythonUnionDefinitionEmitter]);
488
+ initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonUnionDefinitionEmitter, PythonEnumDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonTypeDefinitionEmitter, PythonChannelDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonIdentifierEmitter]);
488
489
  initMetadataForCompanion(Companion);
489
490
  initMetadataForCompanion(Companion_0);
490
491
  initMetadataForClass(sam$kotlin_Comparator$0_0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
491
- initMetadataForClass(PythonIrEmitter$shared$1);
492
492
  initMetadataForClass(PythonIrEmitter, 'PythonIrEmitter', PythonIrEmitter, VOID, [IrEmitter]);
493
493
  initMetadataForObject(PythonShared, 'PythonShared');
494
494
  //endregion
495
495
  function PythonChannelDefinitionEmitter() {
496
496
  }
497
497
  function sam$kotlin_Comparator$0(function_0) {
498
- this.r1x_1 = function_0;
498
+ this.x1w_1 = function_0;
499
499
  }
500
500
  protoOf(sam$kotlin_Comparator$0).qd = function (a, b) {
501
- return this.r1x_1(a, b);
501
+ return this.x1w_1(a, b);
502
502
  };
503
503
  protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
504
504
  return this.qd(a, b);
505
505
  };
506
506
  protoOf(sam$kotlin_Comparator$0).l3 = function () {
507
- return this.r1x_1;
507
+ return this.x1w_1;
508
508
  };
509
509
  protoOf(sam$kotlin_Comparator$0).equals = function (other) {
510
510
  var tmp;
@@ -527,8 +527,8 @@ protoOf(sam$kotlin_Comparator$0).hashCode = function () {
527
527
  function PythonEmitter$emit$lambda(this$0) {
528
528
  return function (a, b) {
529
529
  // Inline function 'kotlin.comparisons.compareValuesBy' call
530
- var tmp = this$0.y1x(a);
531
- var tmp$ret$1 = this$0.y1x(b);
530
+ var tmp = this$0.e1x(a);
531
+ var tmp$ret$1 = this$0.e1x(b);
532
532
  return compareValues(tmp, tmp$ret$1);
533
533
  };
534
534
  }
@@ -539,23 +539,23 @@ function PythonEmitter(packageName, emitShared) {
539
539
  packageName = packageName === VOID ? Companion_instance.lr('community.flock.wirespec.generated') : packageName;
540
540
  emitShared = emitShared === VOID ? Companion_instance_0.go() : emitShared;
541
541
  LanguageEmitter.call(this);
542
- this.s1x_1 = packageName;
543
- this.t1x_1 = emitShared;
544
- this.u1x_1 = 'import re\n\nfrom abc import abstractmethod\nfrom dataclasses import dataclass\nfrom typing import List, Optional\nfrom enum import Enum\n\nfrom ..wirespec import T, Wirespec\n';
545
- this.v1x_1 = FileExtension_Python_getInstance();
546
- this.w1x_1 = PythonShared_instance;
547
- this.x1x_1 = '#';
542
+ this.y1w_1 = packageName;
543
+ this.z1w_1 = emitShared;
544
+ this.a1x_1 = 'import re\n\nfrom abc import abstractmethod\nfrom dataclasses import dataclass\nfrom typing import List, Optional\nfrom enum import Enum\n\nfrom ..wirespec import T, Wirespec\n';
545
+ this.b1x_1 = FileExtension_Python_getInstance();
546
+ this.c1x_1 = PythonShared_instance;
547
+ this.d1x_1 = '#';
548
548
  }
549
549
  protoOf(PythonEmitter).eq = function () {
550
- return this.v1x_1;
550
+ return this.b1x_1;
551
551
  };
552
- protoOf(PythonEmitter).t1v = function () {
553
- return this.w1x_1;
552
+ protoOf(PythonEmitter).l1v = function () {
553
+ return this.c1x_1;
554
554
  };
555
555
  protoOf(PythonEmitter).fq = function () {
556
- return this.x1x_1;
556
+ return this.d1x_1;
557
557
  };
558
- protoOf(PythonEmitter).y1x = function (definition) {
558
+ protoOf(PythonEmitter).e1x = function (definition) {
559
559
  var tmp;
560
560
  if (definition instanceof Enum) {
561
561
  tmp = 1;
@@ -594,9 +594,9 @@ protoOf(PythonEmitter).tq = function (module_0, logger) {
594
594
  var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
595
595
  var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
596
596
  // Inline function 'kotlin.let' call
597
- var it = protoOf(LanguageEmitter).tq.call(this, module_0.wu(VOID, statements), logger);
598
- var init = new Emitted(this.s1x_1.or() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
599
- var tmp_1 = this.s1x_1.or() + 'endpoint/' + '__init__';
597
+ var it = protoOf(LanguageEmitter).tq.call(this, module_0.vu(VOID, statements), logger);
598
+ var init = new Emitted(this.y1w_1.or() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
599
+ var tmp_1 = this.y1w_1.or() + 'endpoint/' + '__init__';
600
600
  // Inline function 'kotlin.collections.filter' call
601
601
  var tmp0 = new NonEmptyList(module_0.dq_1);
602
602
  // Inline function 'kotlin.collections.filterTo' call
@@ -618,7 +618,7 @@ protoOf(PythonEmitter).tq = function (module_0, logger) {
618
618
  destination_0.x(tmp$ret$5);
619
619
  }
620
620
  var initEndpoint = new Emitted(tmp_1, joinToString(destination_0, '\n'));
621
- var tmp_2 = this.s1x_1.or() + 'model/' + '__init__';
621
+ var tmp_2 = this.y1w_1.or() + 'model/' + '__init__';
622
622
  // Inline function 'kotlin.collections.filter' call
623
623
  var tmp0_0 = new NonEmptyList(module_0.dq_1);
624
624
  // Inline function 'kotlin.collections.filterTo' call
@@ -640,16 +640,16 @@ protoOf(PythonEmitter).tq = function (module_0, logger) {
640
640
  destination_2.x(tmp$ret$11);
641
641
  }
642
642
  var initModel = new Emitted(tmp_2, joinToString(destination_2, '\n'));
643
- var shared = new Emitted(this.s1x_1.or() + 'wirespec', this.t1v().a1y_1);
644
- return this.t1x_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(it, init), initEndpoint), initModel), shared) : NonEmptyList__plus_impl_xqmb9(it, init);
643
+ var shared = new Emitted(this.y1w_1.or() + 'wirespec', this.l1v().g1x_1);
644
+ return this.z1w_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(it, init), initEndpoint), initModel), shared) : NonEmptyList__plus_impl_xqmb9(it, init);
645
645
  };
646
646
  protoOf(PythonEmitter).uq = function (definition, module_0, logger) {
647
- var subPackageName = plus_0(this.s1x_1, definition);
647
+ var subPackageName = plus_1(this.y1w_1, definition);
648
648
  // Inline function 'kotlin.let' call
649
649
  var it = protoOf(LanguageEmitter).uq.call(this, definition, module_0, logger);
650
650
  var tmp = subPackageName.or() + it.io_1;
651
651
  // Inline function 'kotlin.text.trimStart' call
652
- var this_0 = trimMargin('\n |' + this.u1x_1 + '\n |' + it.jo_1 + '\n ');
652
+ var this_0 = trimMargin('\n |' + this.a1x_1 + '\n |' + it.jo_1 + '\n ');
653
653
  var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
654
654
  return new Emitted(tmp, tmp$ret$0);
655
655
  };
@@ -689,7 +689,7 @@ function emitToRawRequest($this, _this__u8e3s4, endpoint) {
689
689
  var tmp_19 = Spacer_instance.toString();
690
690
  var tmp0_safe_receiver = _this__u8e3s4.np_1;
691
691
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
692
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.d1y(tmp1_safe_receiver);
692
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.j1x(tmp1_safe_receiver);
693
693
  return trimMargin("\n |@staticmethod\n |def to_raw_request(serialization: Wirespec.Serializer, request: '" + tmp + ".Request') -> Wirespec.RawRequest:\n |" + tmp_0 + 'return Wirespec.RawRequest(\n |' + tmp_1 + tmp_2 + 'path = [' + tmp_3 + '],\n |' + tmp_4 + tmp_5 + 'method = request.method.value,\n |' + tmp_6 + tmp_7 + 'queries = {\n |' + tmp_9 + '\n |' + tmp_10 + tmp_11 + '},\n |' + tmp_12 + tmp_13 + 'headers = {\n |' + tmp_15 + '\n |' + tmp_16 + tmp_17 + '},\n |' + tmp_18 + tmp_19 + 'body = serialization.serialize(request.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),\n |' + Spacer_instance.toString() + ')\n |\n ');
694
694
  }
695
695
  function emitFromRawRequest($this, _this__u8e3s4, endpoint) {
@@ -706,7 +706,7 @@ function emitDeserializedParams($this, _this__u8e3s4, endpoint) {
706
706
  tmp_3 = null;
707
707
  } else {
708
708
  // Inline function 'kotlin.let' call
709
- tmp_3 = Spacer_instance.qr(3) + 'body = serialization.deserialize(request.body, ' + $this.d1y(tmp0_safe_receiver.pp_1) + '),';
709
+ tmp_3 = Spacer_instance.qr(3) + 'body = serialization.deserialize(request.body, ' + $this.j1x(tmp0_safe_receiver.pp_1) + '),';
710
710
  }
711
711
  // Inline function 'kotlin.let' call
712
712
  var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
@@ -806,18 +806,18 @@ function emitAssignSelf_1($this, _this__u8e3s4, endpoint) {
806
806
  return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.qp_1 + '.Headers(' + tmp_1 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
807
807
  }
808
808
  function emitDeserialized($this, _this__u8e3s4) {
809
- return Spacer_instance.qr(3) + $this.wq(_this__u8e3s4.me_1.lp_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.le_1 + '], ' + $this.d1y(_this__u8e3s4.me_1.mp_1) + ')';
809
+ return Spacer_instance.qr(3) + $this.wq(_this__u8e3s4.me_1.lp_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.le_1 + '], ' + $this.j1x(_this__u8e3s4.me_1.mp_1) + ')';
810
810
  }
811
811
  function emitDeserializedParams_0($this, _this__u8e3s4, type, fields, spaces, caseSensitive) {
812
812
  var tmp;
813
813
  if (caseSensitive) {
814
- tmp = Spacer_instance.qr(spaces) + $this.wq(_this__u8e3s4.ap_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.ap_1.l1() + '"), ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
814
+ tmp = Spacer_instance.qr(spaces) + $this.wq(_this__u8e3s4.ap_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.ap_1.l1() + '"), ' + $this.j1x(_this__u8e3s4.bp_1) + ')';
815
815
  } else {
816
816
  var tmp_0 = Spacer_instance.qr(spaces);
817
817
  var tmp_1 = $this.wq(_this__u8e3s4.ap_1);
818
818
  // Inline function 'kotlin.text.lowercase' call
819
819
  // Inline function 'kotlin.js.asDynamic' call
820
- tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.ap_1.l1().toLowerCase() + '"), None), ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
820
+ tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.ap_1.l1().toLowerCase() + '"), None), ' + $this.j1x(_this__u8e3s4.bp_1) + ')';
821
821
  }
822
822
  return tmp;
823
823
  }
@@ -855,7 +855,7 @@ function emitDeserialized_0($this, _this__u8e3s4, endpoint) {
855
855
  var tmp_1 = Spacer_instance.qr(2);
856
856
  var tmp0_safe_receiver = _this__u8e3s4.sp_1;
857
857
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
858
- var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.d1y(tmp1_safe_receiver);
858
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.j1x(tmp1_safe_receiver);
859
859
  var tmp_2 = tmp_1 + 'body = serialization.deserialize(response.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),';
860
860
  return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, orNull(joinToString(_this__u8e3s4.rp_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserialized$lambda($this))), Spacer_instance.toString() + ')']), '\n');
861
861
  }
@@ -879,13 +879,13 @@ function emitSerialized($this, _this__u8e3s4, endpoint) {
879
879
  tmp_6 = null;
880
880
  } else {
881
881
  // Inline function 'kotlin.let' call
882
- tmp_6 = 'serialization.serialize(response.body, ' + $this.d1y(tmp0_safe_receiver.pp_1) + ')';
882
+ tmp_6 = 'serialization.serialize(response.body, ' + $this.j1x(tmp0_safe_receiver.pp_1) + ')';
883
883
  }
884
884
  var tmp1_elvis_lhs = tmp_6;
885
885
  return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.qp_1 + '():\n |' + tmp_0 + 'return Wirespec.RawResponse(\n |' + tmp_1 + 'status_code = response.status,\n |' + tmp_2 + 'headers = ' + tmp_4 + ',\n |' + tmp_5 + 'body = ' + (tmp1_elvis_lhs == null ? 'type(None)' : tmp1_elvis_lhs) + ',\n |' + Spacer_instance.qr(1) + ')\n ');
886
886
  }
887
887
  function emitSerializedParams($this, _this__u8e3s4, type, fields) {
888
- return '"' + _this__u8e3s4.ap_1.l1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.wq(_this__u8e3s4.ap_1) + ', ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
888
+ return '"' + _this__u8e3s4.ap_1.l1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.wq(_this__u8e3s4.ap_1) + ', ' + $this.j1x(_this__u8e3s4.bp_1) + ')';
889
889
  }
890
890
  function emitObject($this, _this__u8e3s4, name, extends_0, spaces, block) {
891
891
  var tmp;
@@ -912,12 +912,12 @@ function emit_18($this, _this__u8e3s4) {
912
912
  }
913
913
  function PythonEndpointDefinitionEmitter$emit$lambda(this$0) {
914
914
  return function (it) {
915
- return this$0.e1y(it);
915
+ return this$0.k1x(it);
916
916
  };
917
917
  }
918
918
  function PythonEndpointDefinitionEmitter$emit$lambda_0(this$0, $endpoint) {
919
919
  return function (it) {
920
- return this$0.c1y(it, $endpoint);
920
+ return this$0.i1x(it, $endpoint);
921
921
  };
922
922
  }
923
923
  function PythonEndpointDefinitionEmitter$emit$lambda_1(this$0) {
@@ -1064,14 +1064,14 @@ function sanitizeEnum($this, _this__u8e3s4) {
1064
1064
  }
1065
1065
  function PythonEnumDefinitionEmitter$emit$lambda(this$0) {
1066
1066
  return function (it) {
1067
- return Spacer_instance.toString() + this$0.a1w(sanitizeEnum(this$0, it)) + ' = "' + it + '"';
1067
+ return Spacer_instance.toString() + this$0.s1v(sanitizeEnum(this$0, it)) + ' = "' + it + '"';
1068
1068
  };
1069
1069
  }
1070
1070
  function PythonEnumDefinitionEmitter() {
1071
1071
  }
1072
1072
  function Companion() {
1073
1073
  Companion_instance_2 = this;
1074
- this.f1y_1 = setOf(['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']);
1074
+ this.l1x_1 = setOf(['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']);
1075
1075
  }
1076
1076
  var Companion_instance_2;
1077
1077
  function Companion_getInstance_0() {
@@ -1082,7 +1082,7 @@ function Companion_getInstance_0() {
1082
1082
  function PythonIdentifierEmitter() {
1083
1083
  }
1084
1084
  function _get_sanitizationConfig__sns434($this) {
1085
- var tmp0 = $this.k1y_1;
1085
+ var tmp0 = $this.q1x_1;
1086
1086
  var tmp = KProperty1;
1087
1087
  // Inline function 'kotlin.getValue' call
1088
1088
  getPropertyCallableRef('sanitizationConfig', 1, tmp, PythonIrEmitter$_get_sanitizationConfig_$ref_1q5eai(), null);
@@ -1145,7 +1145,7 @@ function sanitize_0($this, _this__u8e3s4) {
1145
1145
  return tmp_2;
1146
1146
  }
1147
1147
  function sanitizeKeywords_0($this, _this__u8e3s4) {
1148
- return Companion_getInstance_1().n1y_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
1148
+ return Companion_getInstance_1().s1x_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
1149
1149
  }
1150
1150
  function sanitizeEnum_0($this, _this__u8e3s4) {
1151
1151
  // Inline function 'kotlin.let' call
@@ -1166,129 +1166,12 @@ function sanitizeEnum_0($this, _this__u8e3s4) {
1166
1166
  }
1167
1167
  return tmp;
1168
1168
  }
1169
- function sort($this, definition) {
1170
- var tmp;
1171
- if (definition instanceof Enum) {
1172
- tmp = 1;
1173
- } else {
1174
- if (definition instanceof Refined) {
1175
- tmp = 2;
1176
- } else {
1177
- if (definition instanceof Type) {
1178
- tmp = 3;
1179
- } else {
1180
- if (definition instanceof Union) {
1181
- tmp = 4;
1182
- } else {
1183
- if (definition instanceof Endpoint) {
1184
- tmp = 5;
1185
- } else {
1186
- if (definition instanceof Channel) {
1187
- tmp = 6;
1188
- } else {
1189
- noWhenBranchMatchedException();
1190
- }
1191
- }
1192
- }
1193
- }
1194
- }
1195
- }
1196
- return tmp;
1197
- }
1198
1169
  function buildImports($this, wirespecPath) {
1199
1170
  return listOf([import_0('__future__', 'annotations'), import_0('', 're'), import_0('abc', 'ABC'), import_0('abc', 'abstractmethod'), import_0('dataclasses', 'dataclass'), import_0('typing', 'Any'), import_0('typing', 'Generic'), import_0('typing', 'List'), import_0('typing', 'Optional'), import_0('', 'enum'), import_0(wirespecPath, 'T'), import_0(wirespecPath, 'Wirespec'), import_0(wirespecPath, '_raise')]);
1200
1171
  }
1201
- function snakeCaseHandlerAndCallMethods($this, _this__u8e3s4) {
1202
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1203
- var scope = new TransformScope(_this__u8e3s4);
1204
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1205
- var tmp = scope;
1206
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1207
- var this_0 = scope.z1t_1;
1208
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1209
- // Inline function 'kotlin.apply' call
1210
- var this_1 = new TransformerBuilder();
1211
- this_1.d1h(PythonIrEmitter$snakeCaseHandlerAndCallMethods$lambda);
1212
- var tmp$ret$2 = this_1.e1h();
1213
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
1214
- var tmp_0 = scope.z1t_1;
1215
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1216
- }
1217
- function flattenEndpointTypeRefs($this, _this__u8e3s4, endpointName) {
1218
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1219
- var scope = new TransformScope(_this__u8e3s4);
1220
- scope.f1u(PythonIrEmitter$flattenEndpointTypeRefs$lambda(endpointName));
1221
- var tmp = scope.z1t_1;
1222
- return isInterface(tmp, Element) ? tmp : THROW_CCE();
1223
- }
1224
- function addSelfReceiverToClientFields($this, _this__u8e3s4) {
1225
- var tmp0_safe_receiver = _this__u8e3s4 instanceof File ? _this__u8e3s4 : null;
1226
- var tmp;
1227
- if (tmp0_safe_receiver == null) {
1228
- tmp = null;
1229
- } else {
1230
- // Inline function 'community.flock.wirespec.ir.core.findElement' call
1231
- // Inline function 'kotlin.collections.filterIsInstance' call
1232
- var tmp0 = tmp0_safe_receiver.v1m();
1233
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1234
- var destination = ArrayList_init_$Create$();
1235
- var _iterator__ex2g4s = tmp0.t();
1236
- while (_iterator__ex2g4s.u()) {
1237
- var element = _iterator__ex2g4s.v();
1238
- if (element instanceof Struct) {
1239
- destination.x(element);
1240
- }
1241
- }
1242
- tmp = firstOrNull_0(destination);
1243
- }
1244
- var struct = tmp;
1245
- var tmp2_safe_receiver = struct == null ? null : struct.g1n_1;
1246
- var tmp_0;
1247
- if (tmp2_safe_receiver == null) {
1248
- tmp_0 = null;
1249
- } else {
1250
- // Inline function 'kotlin.collections.map' call
1251
- // Inline function 'kotlin.collections.mapTo' call
1252
- var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver, 10));
1253
- var _iterator__ex2g4s_0 = tmp2_safe_receiver.t();
1254
- while (_iterator__ex2g4s_0.u()) {
1255
- var item = _iterator__ex2g4s_0.v();
1256
- var tmp$ret$3 = item.m1n_1.s1h();
1257
- destination_0.x(tmp$ret$3);
1258
- }
1259
- tmp_0 = destination_0;
1260
- }
1261
- var tmp3_safe_receiver = tmp_0;
1262
- var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : toSet(tmp3_safe_receiver);
1263
- var fieldNames = tmp4_elvis_lhs == null ? emptySet() : tmp4_elvis_lhs;
1264
- if (fieldNames.r())
1265
- return _this__u8e3s4;
1266
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1267
- var scope = new TransformScope(_this__u8e3s4);
1268
- scope.i1u(PythonIrEmitter$addSelfReceiverToClientFields$lambda(fieldNames));
1269
- var tmp_1 = scope.z1t_1;
1270
- return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1271
- }
1272
- function snakeCaseClientFunctions($this, _this__u8e3s4) {
1273
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1274
- var scope = new TransformScope(_this__u8e3s4);
1275
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1276
- var tmp = scope;
1277
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1278
- var this_0 = scope.z1t_1;
1279
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1280
- // Inline function 'kotlin.apply' call
1281
- var this_1 = new TransformerBuilder();
1282
- this_1.d1h(PythonIrEmitter$snakeCaseClientFunctions$lambda);
1283
- var tmp$ret$2 = this_1.e1h();
1284
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
1285
- scope.i1u(PythonIrEmitter$snakeCaseClientFunctions$lambda_0);
1286
- var tmp_0 = scope.z1t_1;
1287
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1288
- }
1289
1172
  function Companion_0() {
1290
1173
  Companion_instance_3 = this;
1291
- this.n1y_1 = setOf(['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']);
1174
+ this.s1x_1 = setOf(['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']);
1292
1175
  }
1293
1176
  var Companion_instance_3;
1294
1177
  function Companion_getInstance_1() {
@@ -1297,16 +1180,16 @@ function Companion_getInstance_1() {
1297
1180
  return Companion_instance_3;
1298
1181
  }
1299
1182
  function sam$kotlin_Comparator$0_0(function_0) {
1300
- this.o1y_1 = function_0;
1183
+ this.t1x_1 = function_0;
1301
1184
  }
1302
1185
  protoOf(sam$kotlin_Comparator$0_0).qd = function (a, b) {
1303
- return this.o1y_1(a, b);
1186
+ return this.t1x_1(a, b);
1304
1187
  };
1305
1188
  protoOf(sam$kotlin_Comparator$0_0).compare = function (a, b) {
1306
1189
  return this.qd(a, b);
1307
1190
  };
1308
1191
  protoOf(sam$kotlin_Comparator$0_0).l3 = function () {
1309
- return this.o1y_1;
1192
+ return this.t1x_1;
1310
1193
  };
1311
1194
  protoOf(sam$kotlin_Comparator$0_0).equals = function (other) {
1312
1195
  var tmp;
@@ -1330,11 +1213,11 @@ function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
1330
1213
  return '_' + it;
1331
1214
  }
1332
1215
  function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(name) {
1333
- var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : name.s1h();
1216
+ var sanitized = name.m1h_1.a1() > 1 ? name.q1l() : name.r1h();
1334
1217
  return new Name(listOf_0(sanitized));
1335
1218
  }
1336
1219
  function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(name) {
1337
- return new Name(listOf_0(name.r1l()));
1220
+ return new Name(listOf_0(name.q1l()));
1338
1221
  }
1339
1222
  function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
1340
1223
  return it;
@@ -1343,9 +1226,9 @@ function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
1343
1226
  return function (stmt, tr) {
1344
1227
  var tmp;
1345
1228
  if (stmt instanceof ConstructorStatement) {
1346
- var tmp_0 = tr.r1t(stmt.p1m_1);
1229
+ var tmp_0 = tr.o1t(stmt.o1m_1);
1347
1230
  // Inline function 'kotlin.collections.map' call
1348
- var this_0 = stmt.q1m_1;
1231
+ var this_0 = stmt.p1m_1;
1349
1232
  // Inline function 'kotlin.collections.mapTo' call
1350
1233
  var destination = ArrayList_init_$Create$_0(this_0.a1());
1351
1234
  // Inline function 'kotlin.collections.iterator' call
@@ -1356,7 +1239,7 @@ function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
1356
1239
  var k = item.k1();
1357
1240
  // Inline function 'kotlin.collections.component2' call
1358
1241
  var v = item.l1();
1359
- var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.u1t(v));
1242
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.r1t(v));
1360
1243
  destination.x(tmp$ret$3);
1361
1244
  }
1362
1245
  tmp = new ConstructorStatement(tmp_0, toMap(destination));
@@ -1368,7 +1251,7 @@ function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
1368
1251
  }
1369
1252
  function PythonIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
1370
1253
  return function () {
1371
- var tmp = Companion_getInstance_1().n1y_1;
1254
+ var tmp = Companion_getInstance_1().s1x_1;
1372
1255
  var tmp_0 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda;
1373
1256
  var tmp_1 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
1374
1257
  var tmp_2 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
@@ -1381,284 +1264,58 @@ function PythonIrEmitter$_get_sanitizationConfig_$ref_1q5eai() {
1381
1264
  return _get_sanitizationConfig__sns434(p0);
1382
1265
  };
1383
1266
  }
1384
- function PythonIrEmitter$shared$1(this$0) {
1385
- this.p1y_1 = 'shared';
1386
- this.q1y_1 = this$0.l1y_1 + generatePython(convert(new Shared(this.p1y_1)));
1387
- }
1388
- protoOf(PythonIrEmitter$shared$1).r1w = function () {
1389
- return this.q1y_1;
1390
- };
1391
- function PythonIrEmitter$emit$lambda(this$0) {
1392
- return function (a, b) {
1393
- // Inline function 'kotlin.comparisons.compareValuesBy' call
1394
- var this_0 = this$0;
1395
- var tmp = sort(this_0, a);
1396
- var this_1 = this$0;
1397
- var tmp$ret$1 = sort(this_1, b);
1398
- return compareValues(tmp, tmp$ret$1);
1399
- };
1267
+ function PythonIrEmitter$emit$lambda(a, b) {
1268
+ // Inline function 'kotlin.comparisons.compareValuesBy' call
1269
+ var tmp = sortKey(a);
1270
+ var tmp$ret$1 = sortKey(b);
1271
+ return compareValues(tmp, tmp$ret$1);
1400
1272
  }
1401
1273
  function emit$emitInitImport(this$0, def) {
1402
1274
  return import_0('.' + sanitize_0(this$0, def.vq()), sanitize_0(this$0, def.vq()));
1403
1275
  }
1404
- function PythonIrEmitter$emit$lambda$lambda($fieldNames) {
1405
- return function (s, t) {
1406
- var tmp;
1407
- var tmp_0;
1408
- var tmp_1;
1409
- if (s instanceof FieldCall) {
1410
- tmp_1 = s.i1p_1 == null;
1411
- } else {
1412
- tmp_1 = false;
1413
- }
1414
- if (tmp_1) {
1415
- tmp_0 = $fieldNames.u1(s.j1p_1.r1l());
1416
- } else {
1417
- tmp_0 = false;
1418
- }
1419
- if (tmp_0) {
1420
- tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), s.j1p_1);
1421
- } else {
1422
- tmp = transformChildren(s, t);
1423
- }
1424
- return tmp;
1425
- };
1426
- }
1427
- function PythonIrEmitter$emit$lambda_0($fieldNames) {
1428
- return function (element, transformer) {
1429
- var tmp;
1430
- if (element instanceof Function) {
1431
- var tmp_0;
1432
- if (element.t1j_1.equals(Companion_getInstance().m1h('validate'))) {
1433
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1434
- var this_0 = element.b1k(VOID, VOID, listOf_0(new Parameter(Companion_getInstance().m1h('self'), new Custom_0(''))));
1435
- var scope = new TransformScope(this_0);
1436
- scope.i1u(PythonIrEmitter$emit$lambda$lambda($fieldNames));
1437
- var tmp_1 = scope.z1t_1;
1438
- tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1439
- } else {
1440
- tmp_0 = element;
1441
- }
1442
- tmp = tmp_0;
1443
- } else {
1444
- tmp = element;
1445
- }
1446
- var transformed = tmp;
1447
- return transformChildren_0(transformed, transformer);
1448
- };
1449
- }
1450
- function PythonIrEmitter$emit$lambda_1(this$0) {
1451
- return function (element, transformer) {
1452
- var tmp;
1453
- if (element instanceof Enum_0) {
1454
- // Inline function 'kotlin.collections.map' call
1455
- var this_0 = element.f1o_1;
1456
- // Inline function 'kotlin.collections.mapTo' call
1457
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1458
- var _iterator__ex2g4s = this_0.t();
1459
- while (_iterator__ex2g4s.u()) {
1460
- var item = _iterator__ex2g4s.v();
1461
- var tmp$ret$0 = item.c1o(Companion_getInstance().m1h(sanitizeKeywords_0(this$0, sanitizeEnum_0(this$0, item.z1n_1.s1h()))));
1462
- destination.x(tmp$ret$0);
1463
- }
1464
- tmp = element.k1o(VOID, VOID, destination);
1465
- } else {
1466
- tmp = element;
1467
- }
1468
- var transformed = tmp;
1469
- return transformChildren_0(transformed, transformer);
1470
- };
1471
- }
1472
- function PythonIrEmitter$emit$lambda_2($constraintExpr) {
1473
- return function ($this$function) {
1474
- $this$function.l1i('self', new Custom_0(''));
1475
- $this$function.k1i(Boolean_instance_0);
1476
- $this$function.j1k($constraintExpr);
1477
- return Unit_instance;
1478
- };
1479
- }
1480
- function PythonIrEmitter$emit$lambda_3($toStringExpr) {
1481
- return function ($this$function) {
1482
- $this$function.l1i('self', new Custom_0(''));
1483
- $this$function.k1i(String_instance);
1484
- $this$function.j1k(new RawExpression($toStringExpr));
1485
- return Unit_instance;
1486
- };
1487
- }
1488
- function PythonIrEmitter$emit$lambda_4($updatedStruct) {
1489
- return function (element, transformer) {
1490
- var tmp;
1491
- if (element instanceof Struct) {
1492
- tmp = $updatedStruct;
1493
- } else {
1494
- tmp = element;
1495
- }
1496
- var transformed = tmp;
1497
- return transformChildren_0(transformed, transformer);
1498
- };
1499
- }
1500
- function PythonIrEmitter$snakeCaseHandlerAndCallMethods$lambda(element, transformer) {
1501
- var tmp;
1502
- if (element instanceof Interface) {
1503
- var tmp_0;
1504
- if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
1505
- // Inline function 'kotlin.collections.map' call
1506
- var this_0 = element.n1o_1;
1507
- // Inline function 'kotlin.collections.mapTo' call
1508
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1509
- var _iterator__ex2g4s = this_0.t();
1510
- while (_iterator__ex2g4s.u()) {
1511
- var item = _iterator__ex2g4s.v();
1512
- var tmp_1;
1513
- if (item instanceof Function) {
1514
- tmp_1 = item.b1k(Companion_getInstance().m1h(item.t1j_1.y1l()));
1515
- } else {
1516
- tmp_1 = item;
1517
- }
1518
- var tmp$ret$0 = tmp_1;
1519
- destination.x(tmp$ret$0);
1520
- }
1521
- tmp_0 = element.t1o(VOID, destination);
1522
- } else {
1523
- tmp_0 = element;
1524
- }
1525
- tmp = tmp_0;
1526
- } else {
1527
- tmp = element;
1528
- }
1529
- var transformed = tmp;
1530
- return transformChildren_0(transformed, transformer);
1531
- }
1532
- function PythonIrEmitter$flattenEndpointTypeRefs$lambda($endpointName) {
1533
- return function (type, _unused_var__etf5q3) {
1534
- var tmp;
1535
- var tmp_0;
1536
- if (type instanceof Custom_0) {
1537
- tmp_0 = startsWith(type.q1h_1, $endpointName + '.');
1538
- } else {
1539
- tmp_0 = false;
1540
- }
1541
- if (tmp_0) {
1542
- var suffix = removePrefix(type.q1h_1, $endpointName + '.');
1543
- switch (suffix) {
1544
- case 'Call':
1545
- case 'Handler':
1546
- tmp = type;
1547
- break;
1548
- default:
1549
- tmp = type.n1m(suffix);
1550
- break;
1551
- }
1552
- } else {
1553
- tmp = type;
1554
- }
1555
- return tmp;
1556
- };
1557
- }
1558
- function PythonIrEmitter$addSelfReceiverToClientFields$lambda($fieldNames) {
1559
- return function (stmt, tr) {
1560
- var tmp;
1561
- if (stmt instanceof FieldCall) {
1562
- var tmp_0;
1563
- if (stmt.i1p_1 == null && $fieldNames.u1(stmt.j1p_1.s1h())) {
1564
- tmp_0 = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), stmt.j1p_1);
1565
- } else {
1566
- var tmp1_safe_receiver = stmt.i1p_1;
1567
- var tmp_1;
1568
- if (tmp1_safe_receiver == null) {
1569
- tmp_1 = null;
1570
- } else {
1571
- // Inline function 'kotlin.let' call
1572
- tmp_1 = tr.u1t(tmp1_safe_receiver);
1573
- }
1574
- tmp_0 = new FieldCall(tmp_1, stmt.j1p_1);
1575
- }
1576
- tmp = tmp_0;
1577
- } else {
1578
- tmp = transformChildren(stmt, tr);
1579
- }
1580
- return tmp;
1276
+ function PythonIrEmitter$emit$lambda_0(this$0) {
1277
+ return function (it) {
1278
+ return sanitizeKeywords_0(this$0, sanitizeEnum_0(this$0, it));
1581
1279
  };
1582
1280
  }
1583
- function PythonIrEmitter$snakeCaseClientFunctions$lambda(element, transformer) {
1584
- var tmp;
1585
- if (element instanceof Function) {
1586
- tmp = element.b1k(Companion_getInstance().m1h(element.t1j_1.y1l()), VOID, plus(listOf_0(new Parameter(Companion_getInstance().m1h('self'), new Custom_0(''))), element.v1j_1));
1587
- } else {
1588
- tmp = element;
1589
- }
1590
- var transformed = tmp;
1591
- return transformChildren_0(transformed, transformer);
1592
- }
1593
- function PythonIrEmitter$snakeCaseClientFunctions$lambda_0(stmt, tr) {
1594
- var tmp;
1595
- if (stmt instanceof FunctionCall) {
1596
- var nameStr = stmt.b1m_1.s1h();
1597
- var newName = contains(nameStr, '.') ? stmt.b1m_1 : Companion_getInstance().m1h(Companion_getInstance().m1h(nameStr).y1l());
1598
- var tmp1_safe_receiver = stmt.z1l_1;
1599
- var tmp_0;
1600
- if (tmp1_safe_receiver == null) {
1601
- tmp_0 = null;
1602
- } else {
1603
- // Inline function 'kotlin.let' call
1604
- tmp_0 = tr.u1t(tmp1_safe_receiver);
1605
- }
1606
- var tmp2_receiver = tmp_0;
1607
- // Inline function 'kotlin.collections.mapValues' call
1608
- var this_0 = stmt.c1m_1;
1609
- // Inline function 'kotlin.collections.mapValuesTo' call
1610
- var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
1611
- // Inline function 'kotlin.collections.associateByTo' call
1612
- var _iterator__ex2g4s = this_0.j1().t();
1613
- while (_iterator__ex2g4s.u()) {
1614
- var element = _iterator__ex2g4s.v();
1615
- var tmp_1 = element.k1();
1616
- // Inline function 'kotlin.collections.component2' call
1617
- var v = element.l1();
1618
- var tmp$ret$4 = tr.u1t(v);
1619
- destination.w2(tmp_1, tmp$ret$4);
1620
- }
1621
- var tmp4_isAwait = !(stmt.z1l_1 == null);
1622
- tmp = new FunctionCall(tmp2_receiver, VOID, newName, destination, tmp4_isAwait);
1623
- } else {
1624
- tmp = transformChildren(stmt, tr);
1625
- }
1626
- return tmp;
1627
- }
1628
1281
  function PythonIrEmitter(packageName, emitShared) {
1629
1282
  Companion_getInstance_1();
1630
1283
  packageName = packageName === VOID ? Companion_instance.lr('community.flock.wirespec.generated') : packageName;
1631
1284
  emitShared = emitShared === VOID ? Companion_instance_0.go() : emitShared;
1632
- this.g1y_1 = packageName;
1633
- this.h1y_1 = emitShared;
1634
- this.i1y_1 = PythonGenerator_instance;
1635
- this.j1y_1 = FileExtension_Python_getInstance();
1285
+ this.m1x_1 = packageName;
1286
+ this.n1x_1 = emitShared;
1287
+ this.o1x_1 = PythonGenerator_instance;
1288
+ this.p1x_1 = FileExtension_Python_getInstance();
1636
1289
  var tmp = this;
1637
- tmp.k1y_1 = lazy(PythonIrEmitter$sanitizationConfig$delegate$lambda(this));
1638
- this.l1y_1 = "from __future__ import annotations\n\nimport enum\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom typing import Any, Generic, Optional, Type, TypeVar\n\nT = TypeVar('T')\n\n\ndef _raise(msg: str) -> Any:\n raise Exception(msg)\n\n";
1639
- var tmp_0 = this;
1640
- tmp_0.m1y_1 = new PythonIrEmitter$shared$1(this);
1290
+ tmp.q1x_1 = lazy(PythonIrEmitter$sanitizationConfig$delegate$lambda(this));
1291
+ this.r1x_1 = "from __future__ import annotations\n\nimport enum\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom typing import Any, Generic, Optional, Type, TypeVar\n\nT = TypeVar('T')\n\n\ndef _raise(msg: str) -> Any:\n raise Exception(msg)\n\n";
1641
1292
  }
1642
- protoOf(PythonIrEmitter).m1u = function () {
1643
- return this.i1y_1;
1293
+ protoOf(PythonIrEmitter).j1u = function () {
1294
+ return this.o1x_1;
1644
1295
  };
1645
1296
  protoOf(PythonIrEmitter).eq = function () {
1646
- return this.j1y_1;
1297
+ return this.p1x_1;
1647
1298
  };
1648
- protoOf(PythonIrEmitter).t1v = function () {
1649
- return this.m1y_1;
1299
+ protoOf(PythonIrEmitter).m1u = function () {
1300
+ var source = convert(Companion_instance.lr('shared'));
1301
+ var tmp;
1302
+ if (this.n1x_1.ho_1) {
1303
+ tmp = new File(Companion_getInstance().l1h(this.m1x_1.or() + 'wirespec'), listOf_0(raw(this.r1x_1 + PythonGenerator_instance.k1u(source))));
1304
+ } else {
1305
+ tmp = null;
1306
+ }
1307
+ return tmp;
1650
1308
  };
1651
- protoOf(PythonIrEmitter).n1u = function (module_0, logger) {
1309
+ protoOf(PythonIrEmitter).l1u = function (module_0, logger) {
1652
1310
  // Inline function 'kotlin.collections.sortedBy' call
1653
1311
  var this_0 = new NonEmptyList(module_0.dq_1);
1654
1312
  // Inline function 'kotlin.comparisons.compareBy' call
1655
- var tmp = PythonIrEmitter$emit$lambda(this);
1313
+ var tmp = PythonIrEmitter$emit$lambda;
1656
1314
  var tmp$ret$0 = new sam$kotlin_Comparator$0_0(tmp);
1657
1315
  var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
1658
1316
  var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
1659
1317
  var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
1660
- // Inline function 'kotlin.let' call
1661
- var it = emit.call(this, module_0.wu(VOID, statements), logger);
1318
+ var emitted = emit.call(this, module_0.vu(VOID, statements), logger);
1662
1319
  var tmp0 = new NonEmptyList(module_0.dq_1);
1663
1320
  var tmp$ret$2;
1664
1321
  $l$block_0: {
@@ -1684,12 +1341,23 @@ protoOf(PythonIrEmitter).n1u = function (module_0, logger) {
1684
1341
  tmp$ret$2 = false;
1685
1342
  }
1686
1343
  var hasEndpoints = tmp$ret$2;
1687
- var initElements = plus(plus(listOf([import_0('.', 'model'), import_0('.', 'endpoint')]), hasEndpoints ? listOf_0(import_0('.', 'client')) : emptyList()), listOf_0(import_0('.', 'wirespec')));
1688
- var init = new File(Companion_getInstance().m1h(this.g1y_1.or() + '__init__'), initElements);
1689
- var tmp_2 = Companion_getInstance().m1h(this.g1y_1.or() + 'endpoint/' + '__init__');
1690
- // Inline function 'kotlin.collections.filter' call
1344
+ var tmp_2 = Companion_getInstance().l1h(this.m1x_1.or() + '__init__');
1345
+ // Inline function 'kotlin.collections.buildList' call
1346
+ // Inline function 'kotlin.collections.buildListInternal' call
1347
+ // Inline function 'kotlin.apply' call
1348
+ var this_1 = ArrayList_init_$Create$();
1349
+ this_1.x(import_0('.', 'model'));
1350
+ this_1.x(import_0('.', 'endpoint'));
1351
+ if (hasEndpoints) {
1352
+ this_1.x(import_0('.', 'client'));
1353
+ }
1354
+ this_1.x(import_0('.', 'wirespec'));
1355
+ var tmp$ret$7 = this_1.o5();
1356
+ var init = new File(tmp_2, tmp$ret$7);
1357
+ var tmp_3 = Companion_getInstance().l1h(this.m1x_1.or() + 'endpoint/' + '__init__');
1358
+ // Inline function 'kotlin.collections.filterIsInstance' call
1691
1359
  var tmp0_0 = new NonEmptyList(module_0.dq_1);
1692
- // Inline function 'kotlin.collections.filterTo' call
1360
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1693
1361
  var destination = ArrayList_init_$Create$();
1694
1362
  var _iterator__ex2g4s_0 = tmp0_0.t();
1695
1363
  while (_iterator__ex2g4s_0.u()) {
@@ -1704,19 +1372,19 @@ protoOf(PythonIrEmitter).n1u = function (module_0, logger) {
1704
1372
  var _iterator__ex2g4s_1 = destination.t();
1705
1373
  while (_iterator__ex2g4s_1.u()) {
1706
1374
  var item = _iterator__ex2g4s_1.v();
1707
- var tmp$ret$7 = emit$emitInitImport(this, item);
1708
- destination_0.x(tmp$ret$7);
1375
+ var tmp$ret$10 = emit$emitInitImport(this, item);
1376
+ destination_0.x(tmp$ret$10);
1709
1377
  }
1710
- var initEndpoint = new File(tmp_2, destination_0);
1711
- var tmp_3 = Companion_getInstance().m1h(this.g1y_1.or() + 'model/' + '__init__');
1712
- // Inline function 'kotlin.collections.filter' call
1378
+ var initEndpoint = new File(tmp_3, destination_0);
1379
+ var tmp_4 = Companion_getInstance().l1h(this.m1x_1.or() + 'model/' + '__init__');
1380
+ // Inline function 'kotlin.collections.filterIsInstance' call
1713
1381
  var tmp0_1 = new NonEmptyList(module_0.dq_1);
1714
- // Inline function 'kotlin.collections.filterTo' call
1382
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1715
1383
  var destination_1 = ArrayList_init_$Create$();
1716
1384
  var _iterator__ex2g4s_2 = tmp0_1.t();
1717
1385
  while (_iterator__ex2g4s_2.u()) {
1718
1386
  var element_1 = _iterator__ex2g4s_2.v();
1719
- if (isInterface(element_1, Model)) {
1387
+ if (!(element_1 == null) ? isInterface(element_1, Model) : false) {
1720
1388
  destination_1.x(element_1);
1721
1389
  }
1722
1390
  }
@@ -1726,58 +1394,57 @@ protoOf(PythonIrEmitter).n1u = function (module_0, logger) {
1726
1394
  var _iterator__ex2g4s_3 = destination_1.t();
1727
1395
  while (_iterator__ex2g4s_3.u()) {
1728
1396
  var item_0 = _iterator__ex2g4s_3.v();
1729
- var tmp$ret$13 = emit$emitInitImport(this, item_0);
1730
- destination_2.x(tmp$ret$13);
1731
- }
1732
- var initModel = new File(tmp_3, destination_2);
1733
- var initClient = hasEndpoints ? listOf_0(new File(Companion_getInstance().m1h(this.g1y_1.or() + 'client/' + '__init__'), emptyList())) : emptyList();
1734
- var shared = new File(Companion_getInstance().m1h(this.g1y_1.or() + 'wirespec'), listOf_0(new RawElement(this.t1v().r1w())));
1735
- var tmp0_2 = dropLast(split(this.g1y_1.mr_1, ['.']), 1);
1736
- var tmp$ret$16;
1397
+ var tmp$ret$15 = emit$emitInitImport(this, item_0);
1398
+ destination_2.x(tmp$ret$15);
1399
+ }
1400
+ var initModel = new File(tmp_4, destination_2);
1401
+ var initClient = hasEndpoints ? listOf_0(new File(Companion_getInstance().l1h(this.m1x_1.or() + 'client/' + '__init__'), emptyList())) : emptyList();
1402
+ var tmp0_2 = dropLast(split(this.m1x_1.mr_1, ['.']), 1);
1403
+ var tmp$ret$18;
1737
1404
  $l$block_1: {
1738
1405
  // Inline function 'kotlin.collections.runningFold' call
1739
1406
  var estimatedSize = collectionSizeOrDefault(tmp0_2, 9);
1740
1407
  if (estimatedSize === 0) {
1741
- tmp$ret$16 = listOf_0('');
1408
+ tmp$ret$18 = listOf_0('');
1742
1409
  break $l$block_1;
1743
1410
  }
1744
1411
  // Inline function 'kotlin.apply' call
1745
- var this_1 = ArrayList_init_$Create$_0(estimatedSize + 1 | 0);
1746
- this_1.x('');
1747
- var result = this_1;
1412
+ var this_2 = ArrayList_init_$Create$_0(estimatedSize + 1 | 0);
1413
+ this_2.x('');
1414
+ var result = this_2;
1748
1415
  var accumulator = '';
1749
1416
  var _iterator__ex2g4s_4 = tmp0_2.t();
1750
1417
  while (_iterator__ex2g4s_4.u()) {
1751
1418
  var element_2 = _iterator__ex2g4s_4.v();
1752
1419
  var acc = accumulator;
1753
- var tmp_4;
1420
+ var tmp_5;
1754
1421
  // Inline function 'kotlin.text.isEmpty' call
1755
1422
  if (charSequenceLength(acc) === 0) {
1756
- tmp_4 = element_2;
1423
+ tmp_5 = element_2;
1757
1424
  } else {
1758
- tmp_4 = acc + '/' + element_2;
1425
+ tmp_5 = acc + '/' + element_2;
1759
1426
  }
1760
- accumulator = tmp_4;
1427
+ accumulator = tmp_5;
1761
1428
  result.x(accumulator);
1762
1429
  }
1763
- tmp$ret$16 = result;
1430
+ tmp$ret$18 = result;
1764
1431
  }
1765
1432
  // Inline function 'kotlin.collections.map' call
1766
- var this_2 = drop(tmp$ret$16, 1);
1433
+ var this_3 = drop(tmp$ret$18, 1);
1767
1434
  // Inline function 'kotlin.collections.mapTo' call
1768
- var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
1769
- var _iterator__ex2g4s_5 = this_2.t();
1435
+ var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_3, 10));
1436
+ var _iterator__ex2g4s_5 = this_3.t();
1770
1437
  while (_iterator__ex2g4s_5.u()) {
1771
1438
  var item_1 = _iterator__ex2g4s_5.v();
1772
- var tmp$ret$21 = new File(Companion_getInstance().m1h(item_1 + '/__init__'), emptyList());
1773
- destination_3.x(tmp$ret$21);
1439
+ var tmp$ret$23 = new File(Companion_getInstance().l1h(item_1 + '/__init__'), emptyList());
1440
+ destination_3.x(tmp$ret$23);
1774
1441
  }
1775
1442
  var parentInits = destination_3;
1776
- return this.h1y_1.ho_1 ? NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(it, init), initEndpoint), initModel), initClient), shared), parentInits) : NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(it, init), parentInits);
1443
+ return this.n1x_1.ho_1 ? NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(emitted, init), initEndpoint), initModel), initClient), parentInits) : NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(emitted, init), parentInits);
1777
1444
  };
1778
1445
  protoOf(PythonIrEmitter).uq = function (definition, module_0, logger) {
1779
1446
  var file = emit_0.call(this, definition, module_0, logger);
1780
- return placeInModule(prependImports(file, buildImports(this, '..wirespec')), this.g1y_1, definition);
1447
+ return placeInModule(prependImports(file, buildImports(this, '..wirespec')), this.m1x_1, definition);
1781
1448
  };
1782
1449
  protoOf(PythonIrEmitter).up = function (type, module_0) {
1783
1450
  // Inline function 'kotlin.collections.distinctBy' call
@@ -1787,7 +1454,7 @@ protoOf(PythonIrEmitter).up = function (type, module_0) {
1787
1454
  var _iterator__ex2g4s = this_0.t();
1788
1455
  while (_iterator__ex2g4s.u()) {
1789
1456
  var e = _iterator__ex2g4s.v();
1790
- var key = e.lu_1;
1457
+ var key = e.ku_1;
1791
1458
  if (set.x(key)) {
1792
1459
  list.x(e);
1793
1460
  }
@@ -1798,7 +1465,7 @@ protoOf(PythonIrEmitter).up = function (type, module_0) {
1798
1465
  var _iterator__ex2g4s_0 = list.t();
1799
1466
  while (_iterator__ex2g4s_0.u()) {
1800
1467
  var item = _iterator__ex2g4s_0.v();
1801
- var tmp$ret$2 = import_0('.' + item.lu_1, item.lu_1);
1468
+ var tmp$ret$2 = import_0('.' + item.ku_1, item.ku_1);
1802
1469
  destination.x(tmp$ret$2);
1803
1470
  }
1804
1471
  var typeImports = destination;
@@ -1813,130 +1480,27 @@ protoOf(PythonIrEmitter).up = function (type, module_0) {
1813
1480
  destination_0.x(tmp$ret$5);
1814
1481
  }
1815
1482
  var fieldNames = toSet(destination_0);
1816
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1817
- var this_2 = convertWithValidation(type, module_0);
1818
- var scope = new TransformScope(this_2);
1819
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1820
- var tmp = scope;
1821
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1822
- var this_3 = scope.z1t_1;
1823
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1824
- // Inline function 'kotlin.apply' call
1825
- var this_4 = new TransformerBuilder();
1826
- this_4.d1h(PythonIrEmitter$emit$lambda_0(fieldNames));
1827
- var tmp$ret$10 = this_4.e1h();
1828
- tmp.z1t_1 = transform(this_3, tmp$ret$10);
1829
- var tmp_0 = scope.z1t_1;
1830
- var tmp$ret$14 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1831
- var file = sanitizeNames(tmp$ret$14, _get_sanitizationConfig__sns434(this));
1832
- var tmp_1;
1483
+ var tmp = sanitizeNames(injectSelfReceiverToValidate(convertWithValidation(type, module_0), fieldNames), _get_sanitizationConfig__sns434(this));
1484
+ // Inline function 'kotlin.takeIf' call
1485
+ var tmp_0;
1833
1486
  // Inline function 'kotlin.collections.isNotEmpty' call
1834
1487
  if (!typeImports.r()) {
1835
- tmp_1 = file.x1m(VOID, plus(typeImports, file.u1m_1));
1488
+ tmp_0 = typeImports;
1836
1489
  } else {
1837
- tmp_1 = file;
1490
+ tmp_0 = null;
1838
1491
  }
1839
- return tmp_1;
1492
+ var tmp$ret$10 = tmp_0;
1493
+ return prependImports(tmp, tmp$ret$10);
1840
1494
  };
1841
1495
  protoOf(PythonIrEmitter).ir = function (enum_0, module_0) {
1842
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1843
- var this_0 = convert_0(enum_0);
1844
- var scope = new TransformScope(this_0);
1845
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1846
- var tmp = scope;
1847
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1848
- var this_1 = scope.z1t_1;
1849
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1850
- // Inline function 'kotlin.apply' call
1851
- var this_2 = new TransformerBuilder();
1852
- this_2.d1h(PythonIrEmitter$emit$lambda_1(this));
1853
- var tmp$ret$2 = this_2.e1h();
1854
- tmp.z1t_1 = transform(this_1, tmp$ret$2);
1855
- var tmp_0 = scope.z1t_1;
1856
- var tmp$ret$6 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1857
- return sanitizeNames(tmp$ret$6, _get_sanitizationConfig__sns434(this));
1496
+ var tmp = convert_0(enum_0);
1497
+ return sanitizeNames(sanitizeEnumEntries(tmp, PythonIrEmitter$emit$lambda_0(this)), _get_sanitizationConfig__sns434(this));
1858
1498
  };
1859
1499
  protoOf(PythonIrEmitter).yq = function (union) {
1860
1500
  return sanitizeNames(convert_1(union), _get_sanitizationConfig__sns434(this));
1861
1501
  };
1862
1502
  protoOf(PythonIrEmitter).dr = function (refined) {
1863
- var file = convert_2(refined);
1864
- // Inline function 'community.flock.wirespec.ir.core.findElement' call
1865
- // Inline function 'kotlin.collections.filterIsInstance' call
1866
- var tmp0 = file.v1m();
1867
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1868
- var destination = ArrayList_init_$Create$();
1869
- var _iterator__ex2g4s = tmp0.t();
1870
- while (_iterator__ex2g4s.u()) {
1871
- var element = _iterator__ex2g4s.v();
1872
- if (element instanceof Struct) {
1873
- destination.x(element);
1874
- }
1875
- }
1876
- var tmp$ret$2 = firstOrNull_0(destination);
1877
- var struct = ensureNotNull(tmp$ret$2);
1878
- // Inline function 'kotlin.collections.mapNotNull' call
1879
- var tmp0_0 = struct.j1n_1;
1880
- // Inline function 'kotlin.collections.mapNotNullTo' call
1881
- var destination_0 = ArrayList_init_$Create$();
1882
- // Inline function 'kotlin.collections.forEach' call
1883
- var _iterator__ex2g4s_0 = tmp0_0.t();
1884
- while (_iterator__ex2g4s_0.u()) {
1885
- var element_0 = _iterator__ex2g4s_0.v();
1886
- var tmp;
1887
- var tmp_0;
1888
- if (element_0 instanceof Function) {
1889
- tmp_0 = element_0.t1j_1.equals(Companion_getInstance().m1h('validate'));
1890
- } else {
1891
- tmp_0 = false;
1892
- }
1893
- if (tmp_0) {
1894
- var constraintExpr = convertConstraint(refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), Companion_getInstance().m1h('value')));
1895
- tmp = function_0('validate', VOID, VOID, PythonIrEmitter$emit$lambda_2(constraintExpr));
1896
- } else {
1897
- var tmp_1;
1898
- if (element_0 instanceof Function) {
1899
- tmp_1 = element_0.t1j_1.equals(Companion_getInstance().m1h('toString'));
1900
- } else {
1901
- tmp_1 = false;
1902
- }
1903
- if (tmp_1) {
1904
- var tmp_2;
1905
- if (refined.cr_1.pu_1 instanceof String_0) {
1906
- tmp_2 = 'self.value';
1907
- } else {
1908
- tmp_2 = 'str(self.value)';
1909
- }
1910
- var toStringExpr = tmp_2;
1911
- tmp = function_0('__str__', VOID, VOID, PythonIrEmitter$emit$lambda_3(toStringExpr));
1912
- } else {
1913
- tmp = element_0;
1914
- }
1915
- }
1916
- var tmp0_safe_receiver = tmp;
1917
- if (tmp0_safe_receiver == null)
1918
- null;
1919
- else {
1920
- // Inline function 'kotlin.let' call
1921
- destination_0.x(tmp0_safe_receiver);
1922
- }
1923
- }
1924
- var updatedStruct = struct.l1n(VOID, VOID, VOID, VOID, destination_0);
1925
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1926
- var scope = new TransformScope(file);
1927
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1928
- var tmp_3 = scope;
1929
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1930
- var this_0 = scope.z1t_1;
1931
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1932
- // Inline function 'kotlin.apply' call
1933
- var this_1 = new TransformerBuilder();
1934
- this_1.d1h(PythonIrEmitter$emit$lambda_4(updatedStruct));
1935
- var tmp$ret$12 = this_1.e1h();
1936
- tmp_3.z1t_1 = transform(this_0, tmp$ret$12);
1937
- var tmp_4 = scope.z1t_1;
1938
- var tmp$ret$16 = isInterface(tmp_4, Element) ? tmp_4 : THROW_CCE();
1939
- return sanitizeNames(tmp$ret$16, _get_sanitizationConfig__sns434(this));
1503
+ return sanitizeNames(replaceRefinedFunctions(convert_2(refined), refined), _get_sanitizationConfig__sns434(this));
1940
1504
  };
1941
1505
  protoOf(PythonIrEmitter).jr = function (endpoint) {
1942
1506
  // Inline function 'kotlin.collections.distinctBy' call
@@ -1946,7 +1510,7 @@ protoOf(PythonIrEmitter).jr = function (endpoint) {
1946
1510
  var _iterator__ex2g4s = this_0.t();
1947
1511
  while (_iterator__ex2g4s.u()) {
1948
1512
  var e = _iterator__ex2g4s.v();
1949
- var key = e.lu_1;
1513
+ var key = e.ku_1;
1950
1514
  if (set.x(key)) {
1951
1515
  list.x(e);
1952
1516
  }
@@ -1957,62 +1521,19 @@ protoOf(PythonIrEmitter).jr = function (endpoint) {
1957
1521
  var _iterator__ex2g4s_0 = list.t();
1958
1522
  while (_iterator__ex2g4s_0.u()) {
1959
1523
  var item = _iterator__ex2g4s_0.v();
1960
- var tmp$ret$2 = import_0('..model.' + item.lu_1, item.lu_1);
1524
+ var tmp$ret$2 = import_0('..model.' + item.ku_1, item.ku_1);
1961
1525
  destination.x(tmp$ret$2);
1962
1526
  }
1963
1527
  var endpointImports = destination;
1964
- // Inline function 'community.flock.wirespec.ir.core.findElement' call
1965
- // Inline function 'kotlin.collections.filterIsInstance' call
1966
- var tmp0 = convert_3(endpoint).v1m();
1967
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1968
- var destination_0 = ArrayList_init_$Create$();
1969
- var _iterator__ex2g4s_1 = tmp0.t();
1970
- while (_iterator__ex2g4s_1.u()) {
1971
- var element = _iterator__ex2g4s_1.v();
1972
- if (element instanceof Namespace) {
1973
- destination_0.x(element);
1974
- }
1975
- }
1976
- var tmp$ret$7 = firstOrNull_0(destination_0);
1977
- var converted = ensureNotNull(tmp$ret$7);
1978
- var flattened = flattenNestedStructs(converted);
1979
- // Inline function 'kotlin.collections.partition' call
1980
- var this_1 = flattened.a1n_1;
1981
- var first = ArrayList_init_$Create$();
1982
- var second = ArrayList_init_$Create$();
1983
- var _iterator__ex2g4s_2 = this_1.t();
1984
- while (_iterator__ex2g4s_2.u()) {
1985
- var element_0 = _iterator__ex2g4s_2.v();
1986
- var tmp;
1987
- if (element_0 instanceof Struct) {
1988
- tmp = true;
1989
- } else {
1990
- tmp = element_0 instanceof Union_0;
1991
- }
1992
- if (tmp) {
1993
- first.x(element_0);
1994
- } else {
1995
- second.x(element_0);
1996
- }
1997
- }
1998
- var _destruct__k2r9zo = new Pair(first, second);
1999
- var moduleElements = _destruct__k2r9zo.ne();
2000
- var classElements = _destruct__k2r9zo.oe();
2001
- var endpointClass = new Namespace(converted.z1m_1, classElements, converted.b1n_1);
2002
- // Inline function 'kotlin.collections.buildList' call
2003
- // Inline function 'kotlin.collections.buildListInternal' call
2004
- // Inline function 'kotlin.apply' call
2005
- var this_2 = ArrayList_init_$Create$();
2006
- this_2.e1(endpointImports);
2007
- this_2.e1(moduleElements);
2008
- this_2.x(endpointClass);
2009
- var tmp$ret$13 = this_2.o5();
2010
- return sanitizeNames(snakeCaseHandlerAndCallMethods(this, new File(converted.z1m_1, tmp$ret$13)), _get_sanitizationConfig__sns434(this));
1528
+ // Inline function 'kotlin.let' call
1529
+ var it = splitEndpointStructsToModuleLevel(convert_3(endpoint));
1530
+ var tmp$ret$6 = it.v1m(VOID, plus(endpointImports, it.s1m_1));
1531
+ return sanitizeNames(snakeCaseHandlerAndCallMethods(tmp$ret$6), _get_sanitizationConfig__sns434(this));
2011
1532
  };
2012
1533
  protoOf(PythonIrEmitter).xq = function (channel) {
2013
1534
  return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
2014
1535
  };
2015
- protoOf(PythonIrEmitter).q1u = function (endpoint) {
1536
+ protoOf(PythonIrEmitter).o1u = function (endpoint) {
2016
1537
  // Inline function 'kotlin.collections.distinctBy' call
2017
1538
  var this_0 = importReferences(endpoint);
2018
1539
  var set = HashSet_init_$Create$();
@@ -2020,7 +1541,7 @@ protoOf(PythonIrEmitter).q1u = function (endpoint) {
2020
1541
  var _iterator__ex2g4s = this_0.t();
2021
1542
  while (_iterator__ex2g4s.u()) {
2022
1543
  var e = _iterator__ex2g4s.v();
2023
- var key = e.lu_1;
1544
+ var key = e.ku_1;
2024
1545
  if (set.x(key)) {
2025
1546
  list.x(e);
2026
1547
  }
@@ -2031,17 +1552,17 @@ protoOf(PythonIrEmitter).q1u = function (endpoint) {
2031
1552
  var _iterator__ex2g4s_0 = list.t();
2032
1553
  while (_iterator__ex2g4s_0.u()) {
2033
1554
  var item = _iterator__ex2g4s_0.v();
2034
- var tmp$ret$2 = import_0('..model.' + item.lu_1, item.lu_1);
1555
+ var tmp$ret$2 = import_0('..model.' + item.ku_1, item.ku_1);
2035
1556
  destination.x(tmp$ret$2);
2036
1557
  }
2037
1558
  var modelImports = destination;
2038
1559
  var endpointImport = import_0('..endpoint.' + endpoint.ep_1.l1(), '*');
2039
1560
  var endpointName = endpoint.ep_1.l1();
2040
- var file = flattenEndpointTypeRefs(this, snakeCaseClientFunctions(this, addSelfReceiverToClientFields(this, sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)))), endpointName);
2041
- var subPackageName = plus_1(this.g1y_1, 'client');
2042
- return new File(Companion_getInstance().m1h(subPackageName.or() + file.t1m_1.x1l()), plus(plus(plus(buildImports(this, '..wirespec'), modelImports), listOf_0(endpointImport)), file.u1m_1));
1561
+ var file = flattenEndpointTypeRefs(snakeCaseClientFunctions(addSelfReceiverToClientFields(sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)))), endpointName);
1562
+ var subPackageName = plus_2(this.m1x_1, 'client');
1563
+ return new File(Companion_getInstance().l1h(subPackageName.or() + file.r1m_1.w1l()), plus(plus(plus(buildImports(this, '..wirespec'), modelImports), listOf_0(endpointImport)), file.s1m_1));
2043
1564
  };
2044
- protoOf(PythonIrEmitter).p1u = function (endpoints, logger) {
1565
+ protoOf(PythonIrEmitter).n1u = function (endpoints, logger) {
2045
1566
  // Inline function 'kotlin.collections.flatMap' call
2046
1567
  // Inline function 'kotlin.collections.flatMapTo' call
2047
1568
  var destination = ArrayList_init_$Create$();
@@ -2057,7 +1578,7 @@ protoOf(PythonIrEmitter).p1u = function (endpoints, logger) {
2057
1578
  var _iterator__ex2g4s_0 = destination.t();
2058
1579
  while (_iterator__ex2g4s_0.u()) {
2059
1580
  var e = _iterator__ex2g4s_0.v();
2060
- var key = e.lu_1;
1581
+ var key = e.ku_1;
2061
1582
  if (set.x(key)) {
2062
1583
  list_0.x(e);
2063
1584
  }
@@ -2068,7 +1589,7 @@ protoOf(PythonIrEmitter).p1u = function (endpoints, logger) {
2068
1589
  var _iterator__ex2g4s_1 = list_0.t();
2069
1590
  while (_iterator__ex2g4s_1.u()) {
2070
1591
  var item = _iterator__ex2g4s_1.v();
2071
- var tmp$ret$5 = import_0('.model.' + item.lu_1, item.lu_1);
1592
+ var tmp$ret$5 = import_0('.model.' + item.ku_1, item.ku_1);
2072
1593
  destination_0.x(tmp$ret$5);
2073
1594
  }
2074
1595
  var modelImports = destination_0;
@@ -2105,25 +1626,375 @@ protoOf(PythonIrEmitter).p1u = function (endpoints, logger) {
2105
1626
  var endpointNames = destination_3;
2106
1627
  // Inline function 'kotlin.let' call
2107
1628
  // Inline function 'kotlin.collections.fold' call
2108
- var accumulator = snakeCaseClientFunctions(this, addSelfReceiverToClientFields(this, sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this))));
1629
+ var accumulator = snakeCaseClientFunctions(addSelfReceiverToClientFields(sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this))));
2109
1630
  var _iterator__ex2g4s_5 = endpointNames.t();
2110
1631
  while (_iterator__ex2g4s_5.u()) {
2111
1632
  var element_0 = _iterator__ex2g4s_5.v();
2112
1633
  var acc = accumulator;
2113
- accumulator = flattenEndpointTypeRefs(this, acc, element_0);
1634
+ accumulator = flattenEndpointTypeRefs(acc, element_0);
2114
1635
  }
2115
1636
  var file = accumulator;
2116
- return new File(Companion_getInstance().m1h(this.g1y_1.or() + file.t1m_1.x1l()), plus(plus(buildImports(this, '.wirespec'), allImports), file.u1m_1));
1637
+ return new File(Companion_getInstance().l1h(this.m1x_1.or() + file.r1m_1.w1l()), plus(plus(buildImports(this, '.wirespec'), allImports), file.s1m_1));
2117
1638
  };
1639
+ function replaceRefinedFunctions(_this__u8e3s4, refined) {
1640
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1641
+ var scope = new TransformScope(_this__u8e3s4);
1642
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1643
+ var tmp = scope;
1644
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1645
+ var this_0 = scope.w1t_1;
1646
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1647
+ // Inline function 'kotlin.apply' call
1648
+ var this_1 = new TransformerBuilder();
1649
+ this_1.c1h(replaceRefinedFunctions$lambda(refined));
1650
+ var tmp$ret$2 = this_1.d1h();
1651
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1652
+ var tmp_0 = scope.w1t_1;
1653
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1654
+ }
1655
+ function snakeCaseHandlerAndCallMethods(_this__u8e3s4) {
1656
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1657
+ var scope = new TransformScope(_this__u8e3s4);
1658
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1659
+ var tmp = scope;
1660
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1661
+ var this_0 = scope.w1t_1;
1662
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1663
+ // Inline function 'kotlin.apply' call
1664
+ var this_1 = new TransformerBuilder();
1665
+ this_1.c1h(snakeCaseHandlerAndCallMethods$lambda);
1666
+ var tmp$ret$2 = this_1.d1h();
1667
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1668
+ var tmp_0 = scope.w1t_1;
1669
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1670
+ }
1671
+ function splitEndpointStructsToModuleLevel(_this__u8e3s4) {
1672
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
1673
+ // Inline function 'kotlin.collections.filterIsInstance' call
1674
+ var tmp0 = _this__u8e3s4.t1m();
1675
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1676
+ var destination = ArrayList_init_$Create$();
1677
+ var _iterator__ex2g4s = tmp0.t();
1678
+ while (_iterator__ex2g4s.u()) {
1679
+ var element = _iterator__ex2g4s.v();
1680
+ if (element instanceof Namespace) {
1681
+ destination.x(element);
1682
+ }
1683
+ }
1684
+ var tmp$ret$2 = firstOrNull_0(destination);
1685
+ var namespace = ensureNotNull(tmp$ret$2);
1686
+ var flattened = flattenNestedStructs(namespace);
1687
+ // Inline function 'kotlin.collections.partition' call
1688
+ var this_0 = flattened.y1m_1;
1689
+ var first = ArrayList_init_$Create$();
1690
+ var second = ArrayList_init_$Create$();
1691
+ var _iterator__ex2g4s_0 = this_0.t();
1692
+ while (_iterator__ex2g4s_0.u()) {
1693
+ var element_0 = _iterator__ex2g4s_0.v();
1694
+ var tmp;
1695
+ if (element_0 instanceof Struct) {
1696
+ tmp = true;
1697
+ } else {
1698
+ tmp = element_0 instanceof Union_0;
1699
+ }
1700
+ if (tmp) {
1701
+ first.x(element_0);
1702
+ } else {
1703
+ second.x(element_0);
1704
+ }
1705
+ }
1706
+ var _destruct__k2r9zo = new Pair(first, second);
1707
+ var moduleElements = _destruct__k2r9zo.ne();
1708
+ var classElements = _destruct__k2r9zo.oe();
1709
+ var endpointClass = new Namespace(namespace.x1m_1, classElements, namespace.z1m_1);
1710
+ return new File(namespace.x1m_1, plus_0(moduleElements, endpointClass));
1711
+ }
1712
+ function flattenEndpointTypeRefs(_this__u8e3s4, endpointName) {
1713
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1714
+ var scope = new TransformScope(_this__u8e3s4);
1715
+ scope.c1u(flattenEndpointTypeRefs$lambda(endpointName));
1716
+ var tmp = scope.w1t_1;
1717
+ return isInterface(tmp, Element) ? tmp : THROW_CCE();
1718
+ }
1719
+ function snakeCaseClientFunctions(_this__u8e3s4) {
1720
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1721
+ var scope = new TransformScope(_this__u8e3s4);
1722
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1723
+ var tmp = scope;
1724
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1725
+ var this_0 = scope.w1t_1;
1726
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1727
+ // Inline function 'kotlin.apply' call
1728
+ var this_1 = new TransformerBuilder();
1729
+ this_1.c1h(snakeCaseClientFunctions$lambda);
1730
+ var tmp$ret$2 = this_1.d1h();
1731
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1732
+ scope.f1u(snakeCaseClientFunctions$lambda_0);
1733
+ var tmp_0 = scope.w1t_1;
1734
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1735
+ }
1736
+ function addSelfReceiverToClientFields(_this__u8e3s4) {
1737
+ var tmp0_safe_receiver = _this__u8e3s4 instanceof File ? _this__u8e3s4 : null;
1738
+ var tmp;
1739
+ if (tmp0_safe_receiver == null) {
1740
+ tmp = null;
1741
+ } else {
1742
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
1743
+ // Inline function 'kotlin.collections.filterIsInstance' call
1744
+ var tmp0 = tmp0_safe_receiver.t1m();
1745
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1746
+ var destination = ArrayList_init_$Create$();
1747
+ var _iterator__ex2g4s = tmp0.t();
1748
+ while (_iterator__ex2g4s.u()) {
1749
+ var element = _iterator__ex2g4s.v();
1750
+ if (element instanceof Struct) {
1751
+ destination.x(element);
1752
+ }
1753
+ }
1754
+ tmp = firstOrNull_0(destination);
1755
+ }
1756
+ var struct = tmp;
1757
+ var tmp2_safe_receiver = struct == null ? null : struct.d1n_1;
1758
+ var tmp_0;
1759
+ if (tmp2_safe_receiver == null) {
1760
+ tmp_0 = null;
1761
+ } else {
1762
+ // Inline function 'kotlin.collections.map' call
1763
+ // Inline function 'kotlin.collections.mapTo' call
1764
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver, 10));
1765
+ var _iterator__ex2g4s_0 = tmp2_safe_receiver.t();
1766
+ while (_iterator__ex2g4s_0.u()) {
1767
+ var item = _iterator__ex2g4s_0.v();
1768
+ var tmp$ret$3 = item.y1p_1.r1h();
1769
+ destination_0.x(tmp$ret$3);
1770
+ }
1771
+ tmp_0 = destination_0;
1772
+ }
1773
+ var tmp3_safe_receiver = tmp_0;
1774
+ var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : toSet(tmp3_safe_receiver);
1775
+ var fieldNames = tmp4_elvis_lhs == null ? emptySet() : tmp4_elvis_lhs;
1776
+ if (fieldNames.r())
1777
+ return _this__u8e3s4;
1778
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1779
+ var scope = new TransformScope(_this__u8e3s4);
1780
+ scope.f1u(addSelfReceiverToClientFields$lambda(fieldNames));
1781
+ var tmp_1 = scope.w1t_1;
1782
+ return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1783
+ }
1784
+ function replaceRefinedFunctions$lambda$lambda($constraintExpr) {
1785
+ return function ($this$function) {
1786
+ $this$function.k1i('self', new Custom_0(''));
1787
+ $this$function.j1i(Boolean_instance_0);
1788
+ $this$function.i1k($constraintExpr);
1789
+ return Unit_instance;
1790
+ };
1791
+ }
1792
+ function replaceRefinedFunctions$lambda$lambda_0($toStringExpr) {
1793
+ return function ($this$function) {
1794
+ $this$function.k1i('self', new Custom_0(''));
1795
+ $this$function.j1i(String_instance);
1796
+ $this$function.i1k(new RawExpression($toStringExpr));
1797
+ return Unit_instance;
1798
+ };
1799
+ }
1800
+ function replaceRefinedFunctions$lambda($refined) {
1801
+ return function (element, transformer) {
1802
+ var tmp;
1803
+ if (element instanceof Struct) {
1804
+ // Inline function 'kotlin.collections.mapNotNull' call
1805
+ var tmp0 = element.g1n_1;
1806
+ // Inline function 'kotlin.collections.mapNotNullTo' call
1807
+ var destination = ArrayList_init_$Create$();
1808
+ // Inline function 'kotlin.collections.forEach' call
1809
+ var _iterator__ex2g4s = tmp0.t();
1810
+ while (_iterator__ex2g4s.u()) {
1811
+ var element_0 = _iterator__ex2g4s.v();
1812
+ var tmp_0;
1813
+ var tmp_1;
1814
+ if (element_0 instanceof Function) {
1815
+ tmp_1 = element_0.s1j_1.equals(Companion_getInstance().l1h('validate'));
1816
+ } else {
1817
+ tmp_1 = false;
1818
+ }
1819
+ if (tmp_1) {
1820
+ var constraintExpr = convertConstraint($refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().l1h('self')), Companion_getInstance().l1h('value')));
1821
+ tmp_0 = function_0('validate', VOID, VOID, replaceRefinedFunctions$lambda$lambda(constraintExpr));
1822
+ } else {
1823
+ var tmp_2;
1824
+ if (element_0 instanceof Function) {
1825
+ tmp_2 = element_0.s1j_1.equals(Companion_getInstance().l1h('toString'));
1826
+ } else {
1827
+ tmp_2 = false;
1828
+ }
1829
+ if (tmp_2) {
1830
+ var tmp_3;
1831
+ if ($refined.cr_1.ou_1 instanceof String_0) {
1832
+ tmp_3 = 'self.value';
1833
+ } else {
1834
+ tmp_3 = 'str(self.value)';
1835
+ }
1836
+ var toStringExpr = tmp_3;
1837
+ tmp_0 = function_0('__str__', VOID, VOID, replaceRefinedFunctions$lambda$lambda_0(toStringExpr));
1838
+ } else {
1839
+ tmp_0 = element_0;
1840
+ }
1841
+ }
1842
+ var tmp0_safe_receiver = tmp_0;
1843
+ if (tmp0_safe_receiver == null)
1844
+ null;
1845
+ else {
1846
+ // Inline function 'kotlin.let' call
1847
+ destination.x(tmp0_safe_receiver);
1848
+ }
1849
+ }
1850
+ tmp = element.i1n(VOID, VOID, VOID, VOID, destination);
1851
+ } else {
1852
+ tmp = element;
1853
+ }
1854
+ var transformed = tmp;
1855
+ return transformChildren_0(transformed, transformer);
1856
+ };
1857
+ }
1858
+ function snakeCaseHandlerAndCallMethods$lambda(element, transformer) {
1859
+ var tmp;
1860
+ if (element instanceof Interface) {
1861
+ var tmp$ret$0;
1862
+ $l$block: {
1863
+ if (!element.j1n_1.equals(Companion_getInstance().l1h('Handler')) && !element.j1n_1.equals(Companion_getInstance().l1h('Call'))) {
1864
+ tmp$ret$0 = element;
1865
+ break $l$block;
1866
+ }
1867
+ // Inline function 'kotlin.collections.map' call
1868
+ var this_0 = element.k1n_1;
1869
+ // Inline function 'kotlin.collections.mapTo' call
1870
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1871
+ var _iterator__ex2g4s = this_0.t();
1872
+ while (_iterator__ex2g4s.u()) {
1873
+ var item = _iterator__ex2g4s.v();
1874
+ var tmp0_safe_receiver = item instanceof Function ? item : null;
1875
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.a1k(Companion_getInstance().l1h(item.s1j_1.x1l()));
1876
+ var tmp$ret$1 = tmp1_elvis_lhs == null ? item : tmp1_elvis_lhs;
1877
+ destination.x(tmp$ret$1);
1878
+ }
1879
+ tmp$ret$0 = element.q1n(VOID, destination);
1880
+ }
1881
+ tmp = tmp$ret$0;
1882
+ } else {
1883
+ tmp = element;
1884
+ }
1885
+ var transformed = tmp;
1886
+ return transformChildren_0(transformed, transformer);
1887
+ }
1888
+ function flattenEndpointTypeRefs$lambda($endpointName) {
1889
+ return function (type, _unused_var__etf5q3) {
1890
+ var tmp;
1891
+ if (!(type instanceof Custom_0)) {
1892
+ tmp = type;
1893
+ } else {
1894
+ if (!startsWith(type.p1h_1, $endpointName + '.')) {
1895
+ tmp = type;
1896
+ } else {
1897
+ var suffix = removePrefix(type.p1h_1, $endpointName + '.');
1898
+ switch (suffix) {
1899
+ case 'Call':
1900
+ case 'Handler':
1901
+ tmp = type;
1902
+ break;
1903
+ default:
1904
+ tmp = type.m1m(suffix);
1905
+ break;
1906
+ }
1907
+ }
1908
+ }
1909
+ return tmp;
1910
+ };
1911
+ }
1912
+ function snakeCaseClientFunctions$lambda(element, transformer) {
1913
+ var tmp;
1914
+ if (element instanceof Function) {
1915
+ tmp = element.a1k(Companion_getInstance().l1h(element.s1j_1.x1l()), VOID, plus(listOf_0(new Parameter(Companion_getInstance().l1h('self'), new Custom_0(''))), element.u1j_1));
1916
+ } else {
1917
+ tmp = element;
1918
+ }
1919
+ var transformed = tmp;
1920
+ return transformChildren_0(transformed, transformer);
1921
+ }
1922
+ function snakeCaseClientFunctions$lambda_0(stmt, tr) {
1923
+ var tmp;
1924
+ if (stmt instanceof FunctionCall) {
1925
+ var nameStr = stmt.a1m_1.r1h();
1926
+ var newName = contains(nameStr, '.') ? stmt.a1m_1 : Companion_getInstance().l1h(Companion_getInstance().l1h(nameStr).x1l());
1927
+ var tmp1_safe_receiver = stmt.y1l_1;
1928
+ var tmp_0;
1929
+ if (tmp1_safe_receiver == null) {
1930
+ tmp_0 = null;
1931
+ } else {
1932
+ // Inline function 'kotlin.let' call
1933
+ tmp_0 = tr.r1t(tmp1_safe_receiver);
1934
+ }
1935
+ var tmp2_receiver = tmp_0;
1936
+ // Inline function 'kotlin.collections.mapValues' call
1937
+ var this_0 = stmt.b1m_1;
1938
+ // Inline function 'kotlin.collections.mapValuesTo' call
1939
+ var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
1940
+ // Inline function 'kotlin.collections.associateByTo' call
1941
+ var _iterator__ex2g4s = this_0.j1().t();
1942
+ while (_iterator__ex2g4s.u()) {
1943
+ var element = _iterator__ex2g4s.v();
1944
+ var tmp_1 = element.k1();
1945
+ // Inline function 'kotlin.collections.component2' call
1946
+ var v = element.l1();
1947
+ var tmp$ret$4 = tr.r1t(v);
1948
+ destination.w2(tmp_1, tmp$ret$4);
1949
+ }
1950
+ var tmp4_isAwait = !(stmt.y1l_1 == null);
1951
+ tmp = new FunctionCall(tmp2_receiver, VOID, newName, destination, tmp4_isAwait);
1952
+ } else {
1953
+ tmp = transformChildren(stmt, tr);
1954
+ }
1955
+ return tmp;
1956
+ }
1957
+ function addSelfReceiverToClientFields$lambda($fieldNames) {
1958
+ return function (stmt, tr) {
1959
+ var tmp;
1960
+ var tmp_0;
1961
+ var tmp_1;
1962
+ if (stmt instanceof FieldCall) {
1963
+ tmp_1 = stmt.i1p_1 == null;
1964
+ } else {
1965
+ tmp_1 = false;
1966
+ }
1967
+ if (tmp_1) {
1968
+ tmp_0 = $fieldNames.u1(stmt.j1p_1.r1h());
1969
+ } else {
1970
+ tmp_0 = false;
1971
+ }
1972
+ if (tmp_0) {
1973
+ tmp = new FieldCall(new VariableReference(Companion_getInstance().l1h('self')), stmt.j1p_1);
1974
+ } else {
1975
+ if (stmt instanceof FieldCall) {
1976
+ var tmp0_safe_receiver = stmt.i1p_1;
1977
+ var tmp_2;
1978
+ if (tmp0_safe_receiver == null) {
1979
+ tmp_2 = null;
1980
+ } else {
1981
+ // Inline function 'kotlin.let' call
1982
+ tmp_2 = tr.r1t(tmp0_safe_receiver);
1983
+ }
1984
+ tmp = new FieldCall(tmp_2, stmt.j1p_1);
1985
+ } else {
1986
+ tmp = transformChildren(stmt, tr);
1987
+ }
1988
+ }
1989
+ return tmp;
1990
+ };
1991
+ }
2118
1992
  function PythonRefinedTypeDefinitionEmitter() {
2119
1993
  }
2120
1994
  function PythonShared() {
2121
- this.z1x_1 = 'shared';
2122
- this.a1y_1 = "from abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Generic, List, Dict, Optional, TypeVar\n\nT = TypeVar('T')\nREQ = TypeVar('REQ')\nRES = TypeVar('RES')\n\nclass Wirespec:\n\n class Refined(ABC, Generic[T]):\n @property\n @abstractmethod\n def value(self) -> T: pass\n\n class Endpoint(ABC):\n\n class Handler(ABC):\n pass\n\n class Convert(ABC, Generic[REQ, RES]):\n @staticmethod\n @abstractmethod\n def to_raw_request(serializer: 'Wirespec.Serializer', req: REQ) -> 'Wirespec.RawRequest': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_response(serializer: 'Wirespec.Deserializer', res: 'Wirespec.RawResponse') -> RES: pass\n\n @staticmethod\n @abstractmethod\n def to_raw_response(serializer: 'Wirespec.Serializer', res: RES) -> 'Wirespec.RawResponse': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_request(serializer: 'Wirespec.Deserializer[T]', req: 'Wirespec.RawRequest') -> REQ: pass\n\n class Method(Enum):\n GET = \"GET\"\n PUT = \"PUT\"\n POST = \"POST\"\n DELETE = \"DELETE\"\n OPTIONS = \"OPTIONS\"\n HEAD = \"HEAD\"\n PATCH = \"PATCH\"\n TRACE = \"TRACE\"\n\n class Request(Generic[T], ABC):\n\n class Path(ABC): pass\n\n class Queries(ABC): pass\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def path(self) -> Path: pass\n\n @property\n @abstractmethod\n def method(self) -> 'Wirespec.Method': pass\n\n @property\n @abstractmethod\n def queries(self) -> Queries: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Response(Generic[T], ABC):\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def status(self) -> int: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Serializer(Generic[T], ABC):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n\n class Deserializer(Generic[T], ABC):\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n class Serialization(Serializer, Deserializer):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n @dataclass\n class RawRequest:\n method: str\n path: List[str]\n queries: Dict[str, List[str]]\n headers: Dict[str, List[str]]\n body: Optional[str]\n\n\n @dataclass\n class RawResponse:\n status_code: int\n headers: Dict[str, List[str]]\n body: Optional[str]\n";
1995
+ this.f1x_1 = 'shared';
1996
+ this.g1x_1 = "from abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Generic, List, Dict, Optional, TypeVar\n\nT = TypeVar('T')\nREQ = TypeVar('REQ')\nRES = TypeVar('RES')\n\nclass Wirespec:\n\n class Refined(ABC, Generic[T]):\n @property\n @abstractmethod\n def value(self) -> T: pass\n\n class Endpoint(ABC):\n\n class Handler(ABC):\n pass\n\n class Convert(ABC, Generic[REQ, RES]):\n @staticmethod\n @abstractmethod\n def to_raw_request(serializer: 'Wirespec.Serializer', req: REQ) -> 'Wirespec.RawRequest': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_response(serializer: 'Wirespec.Deserializer', res: 'Wirespec.RawResponse') -> RES: pass\n\n @staticmethod\n @abstractmethod\n def to_raw_response(serializer: 'Wirespec.Serializer', res: RES) -> 'Wirespec.RawResponse': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_request(serializer: 'Wirespec.Deserializer[T]', req: 'Wirespec.RawRequest') -> REQ: pass\n\n class Method(Enum):\n GET = \"GET\"\n PUT = \"PUT\"\n POST = \"POST\"\n DELETE = \"DELETE\"\n OPTIONS = \"OPTIONS\"\n HEAD = \"HEAD\"\n PATCH = \"PATCH\"\n TRACE = \"TRACE\"\n\n class Request(Generic[T], ABC):\n\n class Path(ABC): pass\n\n class Queries(ABC): pass\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def path(self) -> Path: pass\n\n @property\n @abstractmethod\n def method(self) -> 'Wirespec.Method': pass\n\n @property\n @abstractmethod\n def queries(self) -> Queries: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Response(Generic[T], ABC):\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def status(self) -> int: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Serializer(Generic[T], ABC):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n\n class Deserializer(Generic[T], ABC):\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n class Serialization(Serializer, Deserializer):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n @dataclass\n class RawRequest:\n method: str\n path: List[str]\n queries: Dict[str, List[str]]\n headers: Dict[str, List[str]]\n body: Optional[str]\n\n\n @dataclass\n class RawResponse:\n status_code: int\n headers: Dict[str, List[str]]\n body: Optional[str]\n";
2123
1997
  }
2124
- protoOf(PythonShared).r1w = function () {
2125
- return this.a1y_1;
2126
- };
2127
1998
  protoOf(PythonShared).toString = function () {
2128
1999
  return 'PythonShared';
2129
2000
  };
@@ -2143,12 +2014,12 @@ function PythonShared_getInstance() {
2143
2014
  }
2144
2015
  function PythonTypeDefinitionEmitter$emit$lambda(this$0) {
2145
2016
  return function (it) {
2146
- return this$0.e1y(it);
2017
+ return this$0.k1x(it);
2147
2018
  };
2148
2019
  }
2149
2020
  function PythonTypeDefinitionEmitter$emit$lambda_0(this$0) {
2150
2021
  return function (it) {
2151
- return this$0.e1y(it);
2022
+ return this$0.k1x(it);
2152
2023
  };
2153
2024
  }
2154
2025
  function PythonTypeDefinitionEmitter$emit$lambda_1(this$0) {
@@ -2161,25 +2032,25 @@ function PythonTypeDefinitionEmitter() {
2161
2032
  function PythonUnionDefinitionEmitter() {
2162
2033
  }
2163
2034
  //region block: post-declaration
2164
- protoOf(PythonEmitter).up = emit_4;
2165
- protoOf(PythonEmitter).vp = emit_5;
2166
- protoOf(PythonEmitter).wp = emit_6;
2167
- protoOf(PythonEmitter).xp = emit_7;
2168
- protoOf(PythonEmitter).yp = emit_9;
2169
- protoOf(PythonEmitter).ir = emit_14;
2170
- protoOf(PythonEmitter).dr = emit_13;
2171
- protoOf(PythonEmitter).jr = emit_10;
2172
- protoOf(PythonEmitter).yq = emit_15;
2035
+ protoOf(PythonEmitter).up = emit_6;
2036
+ protoOf(PythonEmitter).vp = emit_7;
2037
+ protoOf(PythonEmitter).wp = emit_8;
2038
+ protoOf(PythonEmitter).xp = emit_9;
2039
+ protoOf(PythonEmitter).yp = emit_11;
2040
+ protoOf(PythonEmitter).ir = emit_5;
2041
+ protoOf(PythonEmitter).dr = emit_12;
2042
+ protoOf(PythonEmitter).jr = emit_13;
2043
+ protoOf(PythonEmitter).yq = emit_4;
2173
2044
  protoOf(PythonEmitter).wq = emit_3;
2174
2045
  protoOf(PythonEmitter).xq = emit_2;
2175
- protoOf(PythonEmitter).b1y = emit_8;
2176
- protoOf(PythonEmitter).x1v = emit_11;
2177
- protoOf(PythonEmitter).c1y = emit_12;
2046
+ protoOf(PythonEmitter).h1x = emit_10;
2047
+ protoOf(PythonEmitter).p1v = emit_14;
2048
+ protoOf(PythonEmitter).i1x = emit_15;
2178
2049
  protoOf(PythonEmitter).kr = emitValidator;
2179
- protoOf(PythonEmitter).s1w = sanitize;
2180
- protoOf(PythonEmitter).a1w = sanitizeKeywords;
2181
- protoOf(PythonEmitter).d1y = emitType;
2182
- protoOf(PythonEmitter).e1y = emitReferenceCustomImports;
2050
+ protoOf(PythonEmitter).c1w = sanitize;
2051
+ protoOf(PythonEmitter).s1v = sanitizeKeywords;
2052
+ protoOf(PythonEmitter).j1x = emitType;
2053
+ protoOf(PythonEmitter).k1x = emitReferenceCustomImports;
2183
2054
  protoOf(PythonIrEmitter).on = emit_1;
2184
2055
  //endregion
2185
2056
  //region block: init