@flock/wirespec 0.18.13 → 0.18.15
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.
- package/clikt-clikt-mordant.mjs +39 -39
- package/colormath-root-colormath.mjs +432 -432
- package/kotlin-kotlin-stdlib.mjs +25 -15
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +9842 -9842
- package/kotlin-rgxgen.mjs +1758 -1758
- package/kotlinx-io-kotlinx-io-core.mjs +404 -404
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1775 -1775
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1466 -1466
- package/mordant-mordant.mjs +1190 -1190
- package/package.json +13 -2
- package/wirespec-msw.d.ts +53 -0
- package/wirespec-msw.mjs +83 -0
- package/wirespec-src-compiler-emitters-java.mjs +79 -79
- package/wirespec-src-compiler-emitters-kotlin.mjs +192 -128
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +129 -129
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +68 -54
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-scala.mjs +29 -29
- package/wirespec-src-compiler-emitters-typescript.mjs +125 -98
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +31 -31
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +144 -134
- package/wirespec-src-compiler-ir.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +479 -479
- package/wirespec-src-converter-openapi.mjs +320 -320
- package/wirespec-src-ide-lsp.mjs +1348 -1348
- package/wirespec-src-plugin-arguments.mjs +136 -136
- package/wirespec-src-plugin-cli.mjs +84 -84
- package/wirespec-src-plugin-npm.mjs +10 -10
- package/wirespec-src-tools-generator.mjs +2 -2
|
@@ -184,10 +184,10 @@ initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, V
|
|
|
184
184
|
function emit_3(identifier) {
|
|
185
185
|
var tmp;
|
|
186
186
|
if (identifier instanceof DefinitionIdentifier) {
|
|
187
|
-
tmp = this.
|
|
187
|
+
tmp = this.k1w(identifier);
|
|
188
188
|
} else {
|
|
189
189
|
if (identifier instanceof FieldIdentifier) {
|
|
190
|
-
tmp = this.
|
|
190
|
+
tmp = this.a1w(this.k1w(identifier));
|
|
191
191
|
} else {
|
|
192
192
|
noWhenBranchMatchedException();
|
|
193
193
|
}
|
|
@@ -243,11 +243,11 @@ function sanitize(_this__u8e3s4) {
|
|
|
243
243
|
return tmp;
|
|
244
244
|
}
|
|
245
245
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
246
|
-
return Companion_getInstance_0().
|
|
246
|
+
return Companion_getInstance_0().u1x_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
247
247
|
}
|
|
248
248
|
initMetadataForInterface(PythonIdentifierEmitter, 'PythonIdentifierEmitter');
|
|
249
249
|
function emit_4(enum_0, module_0) {
|
|
250
|
-
var tmp = this.
|
|
250
|
+
var tmp = this.k1w(enum_0.lr_1);
|
|
251
251
|
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.mr_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.vr(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.vr(2) + 'return self.value\n ');
|
|
252
252
|
}
|
|
253
253
|
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
@@ -278,7 +278,7 @@ function emit_8(_this__u8e3s4) {
|
|
|
278
278
|
}
|
|
279
279
|
function emit_9(_this__u8e3s4) {
|
|
280
280
|
// Inline function 'kotlin.let' call
|
|
281
|
-
var it = this.
|
|
281
|
+
var it = this.s1x(_this__u8e3s4);
|
|
282
282
|
return _this__u8e3s4.hu() ? 'Optional[' + it + ']' : it;
|
|
283
283
|
}
|
|
284
284
|
function emitType(_this__u8e3s4) {
|
|
@@ -299,7 +299,7 @@ function emitType(_this__u8e3s4) {
|
|
|
299
299
|
tmp = _this__u8e3s4.pu_1;
|
|
300
300
|
} else {
|
|
301
301
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
302
|
-
tmp = this.
|
|
302
|
+
tmp = this.q1x(_this__u8e3s4.tu_1);
|
|
303
303
|
} else {
|
|
304
304
|
noWhenBranchMatchedException();
|
|
305
305
|
}
|
|
@@ -379,15 +379,59 @@ function emitReferenceCustomImports(_this__u8e3s4) {
|
|
|
379
379
|
return 'from ..model.' + _this__u8e3s4.pu_1 + ' import ' + _this__u8e3s4.pu_1;
|
|
380
380
|
}
|
|
381
381
|
initMetadataForInterface(PythonTypeDefinitionEmitter, 'PythonTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
382
|
-
function emit_12(
|
|
382
|
+
function emit_12(refined) {
|
|
383
|
+
return trimMargin('\n |@dataclass\n |class ' + this.k1w(refined.gr_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.s1x(refined.hr_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.vr(2) + 'return ' + this.pr(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.vr(2) + 'return str(self.value)\n |\n ');
|
|
384
|
+
}
|
|
385
|
+
function emitValidator(_this__u8e3s4) {
|
|
386
|
+
var defaultReturn = 'True';
|
|
387
|
+
var type = _this__u8e3s4.hr_1.tu_1;
|
|
388
|
+
var tmp;
|
|
389
|
+
if (type instanceof Integer) {
|
|
390
|
+
var tmp0_safe_receiver = type.yt_1;
|
|
391
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.cq(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.bu_1;
|
|
396
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.cq(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.vt_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.cq(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) {
|
|
383
427
|
var tmp = importReferences(endpoint);
|
|
384
428
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda(this));
|
|
385
429
|
var tmp_1 = this.br(endpoint.ip_1);
|
|
386
|
-
var tmp_2 = spacer(this.
|
|
430
|
+
var tmp_2 = spacer(this.x1v(first(endpoint.np_1), endpoint), 1);
|
|
387
431
|
var tmp_3 = distinctByStatus(endpoint.op_1);
|
|
388
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 ');
|
|
389
433
|
}
|
|
390
|
-
function
|
|
434
|
+
function emit_14(_this__u8e3s4, endpoint) {
|
|
391
435
|
var tmp = emit_18(this, _this__u8e3s4.rp_1);
|
|
392
436
|
var tmp_0 = get_pathParams(endpoint);
|
|
393
437
|
var tmp_1 = emitObject$default(this, tmp_0, 'Path', 'Wirespec.Request.Path', VOID, PythonEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
@@ -420,7 +464,7 @@ function emit_13(_this__u8e3s4, endpoint) {
|
|
|
420
464
|
var tmp_28 = paramList(_this__u8e3s4, endpoint);
|
|
421
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.jp_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 ');
|
|
422
466
|
}
|
|
423
|
-
function
|
|
467
|
+
function emit_15(_this__u8e3s4, endpoint) {
|
|
424
468
|
var tmp = emit_18(this, _this__u8e3s4.wp_1);
|
|
425
469
|
var tmp_0 = emitObject$default(this, _this__u8e3s4.vp_1, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
426
470
|
var tmp_1 = Spacer_instance.toString();
|
|
@@ -441,51 +485,7 @@ function emit_14(_this__u8e3s4, endpoint) {
|
|
|
441
485
|
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.up_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.up_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 ');
|
|
442
486
|
}
|
|
443
487
|
initMetadataForInterface(PythonEndpointDefinitionEmitter, 'PythonEndpointDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter]);
|
|
444
|
-
|
|
445
|
-
return trimMargin('\n |@dataclass\n |class ' + this.i1w(refined.gr_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.p1x(refined.hr_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.vr(2) + 'return ' + this.pr(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.vr(2) + 'return str(self.value)\n |\n ');
|
|
446
|
-
}
|
|
447
|
-
function emitValidator(_this__u8e3s4) {
|
|
448
|
-
var defaultReturn = 'True';
|
|
449
|
-
var type = _this__u8e3s4.hr_1.tu_1;
|
|
450
|
-
var tmp;
|
|
451
|
-
if (type instanceof Integer) {
|
|
452
|
-
var tmp0_safe_receiver = type.yt_1;
|
|
453
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.cq(tmp0_safe_receiver);
|
|
454
|
-
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
455
|
-
} else {
|
|
456
|
-
if (type instanceof Number_0) {
|
|
457
|
-
var tmp2_safe_receiver = type.bu_1;
|
|
458
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.cq(tmp2_safe_receiver);
|
|
459
|
-
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
460
|
-
} else {
|
|
461
|
-
if (type instanceof String_0) {
|
|
462
|
-
var tmp4_safe_receiver = type.vt_1;
|
|
463
|
-
var tmp_0;
|
|
464
|
-
var tmp_1 = tmp4_safe_receiver;
|
|
465
|
-
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
466
|
-
tmp_0 = null;
|
|
467
|
-
} else {
|
|
468
|
-
tmp_0 = this.cq(new RegExp_0(tmp4_safe_receiver));
|
|
469
|
-
}
|
|
470
|
-
var tmp5_elvis_lhs = tmp_0;
|
|
471
|
-
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
472
|
-
} else {
|
|
473
|
-
if (equals(type, Boolean_instance)) {
|
|
474
|
-
tmp = defaultReturn;
|
|
475
|
-
} else {
|
|
476
|
-
if (equals(type, Bytes_instance)) {
|
|
477
|
-
tmp = defaultReturn;
|
|
478
|
-
} else {
|
|
479
|
-
noWhenBranchMatchedException();
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return tmp;
|
|
486
|
-
}
|
|
487
|
-
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
488
|
-
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonChannelDefinitionEmitter, PythonEnumDefinitionEmitter, PythonIdentifierEmitter, PythonUnionDefinitionEmitter, PythonTypeDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonRefinedTypeDefinitionEmitter]);
|
|
488
|
+
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonEnumDefinitionEmitter, PythonUnionDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonTypeDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonChannelDefinitionEmitter, PythonIdentifierEmitter]);
|
|
489
489
|
initMetadataForCompanion(Companion);
|
|
490
490
|
initMetadataForCompanion(Companion_0);
|
|
491
491
|
initMetadataForClass(sam$kotlin_Comparator$0_0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
@@ -495,16 +495,16 @@ initMetadataForObject(PythonShared, 'PythonShared');
|
|
|
495
495
|
function PythonChannelDefinitionEmitter() {
|
|
496
496
|
}
|
|
497
497
|
function sam$kotlin_Comparator$0(function_0) {
|
|
498
|
-
this.
|
|
498
|
+
this.g1x_1 = function_0;
|
|
499
499
|
}
|
|
500
500
|
protoOf(sam$kotlin_Comparator$0).td = function (a, b) {
|
|
501
|
-
return this.
|
|
501
|
+
return this.g1x_1(a, b);
|
|
502
502
|
};
|
|
503
503
|
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
504
504
|
return this.td(a, b);
|
|
505
505
|
};
|
|
506
506
|
protoOf(sam$kotlin_Comparator$0).l3 = function () {
|
|
507
|
-
return this.
|
|
507
|
+
return this.g1x_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.
|
|
531
|
-
var tmp$ret$1 = this$0.
|
|
530
|
+
var tmp = this$0.n1x(a);
|
|
531
|
+
var tmp$ret$1 = this$0.n1x(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.qr('community.flock.wirespec.generated') : packageName;
|
|
540
540
|
emitShared = emitShared === VOID ? Companion_instance_0.ko() : emitShared;
|
|
541
541
|
LanguageEmitter.call(this);
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
544
|
-
this.
|
|
545
|
-
this.
|
|
546
|
-
this.
|
|
547
|
-
this.
|
|
542
|
+
this.h1x_1 = packageName;
|
|
543
|
+
this.i1x_1 = emitShared;
|
|
544
|
+
this.j1x_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.k1x_1 = FileExtension_Python_getInstance();
|
|
546
|
+
this.l1x_1 = PythonShared_instance;
|
|
547
|
+
this.m1x_1 = '#';
|
|
548
548
|
}
|
|
549
549
|
protoOf(PythonEmitter).iq = function () {
|
|
550
|
-
return this.
|
|
550
|
+
return this.k1x_1;
|
|
551
551
|
};
|
|
552
|
-
protoOf(PythonEmitter).
|
|
553
|
-
return this.
|
|
552
|
+
protoOf(PythonEmitter).t1v = function () {
|
|
553
|
+
return this.l1x_1;
|
|
554
554
|
};
|
|
555
555
|
protoOf(PythonEmitter).jq = function () {
|
|
556
|
-
return this.
|
|
556
|
+
return this.m1x_1;
|
|
557
557
|
};
|
|
558
|
-
protoOf(PythonEmitter).
|
|
558
|
+
protoOf(PythonEmitter).n1x = function (definition) {
|
|
559
559
|
var tmp;
|
|
560
560
|
if (definition instanceof Enum) {
|
|
561
561
|
tmp = 1;
|
|
@@ -595,8 +595,8 @@ protoOf(PythonEmitter).yq = function (module_0, logger) {
|
|
|
595
595
|
var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).cm_1;
|
|
596
596
|
// Inline function 'kotlin.let' call
|
|
597
597
|
var it = protoOf(LanguageEmitter).yq.call(this, module_0.av(VOID, statements), logger);
|
|
598
|
-
var init = new Emitted(this.
|
|
599
|
-
var tmp_1 = this.
|
|
598
|
+
var init = new Emitted(this.h1x_1.tr() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
599
|
+
var tmp_1 = this.h1x_1.tr() + 'endpoint/' + '__init__';
|
|
600
600
|
// Inline function 'kotlin.collections.filter' call
|
|
601
601
|
var tmp0 = new NonEmptyList(module_0.hq_1);
|
|
602
602
|
// Inline function 'kotlin.collections.filterTo' call
|
|
@@ -618,7 +618,7 @@ protoOf(PythonEmitter).yq = 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.
|
|
621
|
+
var tmp_2 = this.h1x_1.tr() + 'model/' + '__init__';
|
|
622
622
|
// Inline function 'kotlin.collections.filter' call
|
|
623
623
|
var tmp0_0 = new NonEmptyList(module_0.hq_1);
|
|
624
624
|
// Inline function 'kotlin.collections.filterTo' call
|
|
@@ -640,16 +640,16 @@ protoOf(PythonEmitter).yq = 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.
|
|
644
|
-
return this.
|
|
643
|
+
var shared = new Emitted(this.h1x_1.tr() + 'wirespec', this.t1v().p1x_1);
|
|
644
|
+
return this.i1x_1.lo_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).zq = function (definition, module_0, logger) {
|
|
647
|
-
var subPackageName = plus_1(this.
|
|
647
|
+
var subPackageName = plus_1(this.h1x_1, definition);
|
|
648
648
|
// Inline function 'kotlin.let' call
|
|
649
649
|
var it = protoOf(LanguageEmitter).zq.call(this, definition, module_0, logger);
|
|
650
650
|
var tmp = subPackageName.tr() + it.mo_1;
|
|
651
651
|
// Inline function 'kotlin.text.trimStart' call
|
|
652
|
-
var this_0 = trimMargin('\n |' + this.
|
|
652
|
+
var this_0 = trimMargin('\n |' + this.j1x_1 + '\n |' + it.no_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.rp_1;
|
|
691
691
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.tp_1;
|
|
692
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
692
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.s1x(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.vr(3) + 'body = serialization.deserialize(request.body, ' + $this.
|
|
709
|
+
tmp_3 = Spacer_instance.vr(3) + 'body = serialization.deserialize(request.body, ' + $this.s1x(tmp0_safe_receiver.tp_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.up_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.vr(3) + $this.br(_this__u8e3s4.pe_1.pp_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.oe_1 + '], ' + $this.
|
|
809
|
+
return Spacer_instance.vr(3) + $this.br(_this__u8e3s4.pe_1.pp_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.oe_1 + '], ' + $this.s1x(_this__u8e3s4.pe_1.qp_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.vr(spaces) + $this.br(_this__u8e3s4.ep_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.ep_1.l1() + '"), ' + $this.
|
|
814
|
+
tmp = Spacer_instance.vr(spaces) + $this.br(_this__u8e3s4.ep_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.ep_1.l1() + '"), ' + $this.s1x(_this__u8e3s4.fp_1) + ')';
|
|
815
815
|
} else {
|
|
816
816
|
var tmp_0 = Spacer_instance.vr(spaces);
|
|
817
817
|
var tmp_1 = $this.br(_this__u8e3s4.ep_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.ep_1.l1().toLowerCase() + '"), None), ' + $this.
|
|
820
|
+
tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.ep_1.l1().toLowerCase() + '"), None), ' + $this.s1x(_this__u8e3s4.fp_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.vr(2);
|
|
856
856
|
var tmp0_safe_receiver = _this__u8e3s4.wp_1;
|
|
857
857
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.tp_1;
|
|
858
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
858
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.s1x(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.vp_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.
|
|
882
|
+
tmp_6 = 'serialization.serialize(response.body, ' + $this.s1x(tmp0_safe_receiver.tp_1) + ')';
|
|
883
883
|
}
|
|
884
884
|
var tmp1_elvis_lhs = tmp_6;
|
|
885
885
|
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.up_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.vr(1) + ')\n ');
|
|
886
886
|
}
|
|
887
887
|
function emitSerializedParams($this, _this__u8e3s4, type, fields) {
|
|
888
|
-
return '"' + _this__u8e3s4.ep_1.l1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.br(_this__u8e3s4.ep_1) + ', ' + $this.
|
|
888
|
+
return '"' + _this__u8e3s4.ep_1.l1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.br(_this__u8e3s4.ep_1) + ', ' + $this.s1x(_this__u8e3s4.fp_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.
|
|
915
|
+
return this$0.t1x(it);
|
|
916
916
|
};
|
|
917
917
|
}
|
|
918
918
|
function PythonEndpointDefinitionEmitter$emit$lambda_0(this$0, $endpoint) {
|
|
919
919
|
return function (it) {
|
|
920
|
-
return this$0.
|
|
920
|
+
return this$0.r1x(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.
|
|
1067
|
+
return Spacer_instance.toString() + this$0.a1w(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.
|
|
1074
|
+
this.u1x_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.
|
|
1085
|
+
var tmp0 = $this.z1x_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().
|
|
1148
|
+
return Companion_getInstance_1().b1y_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
|
|
@@ -1171,7 +1171,7 @@ function buildImports($this, wirespecPath) {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
function Companion_0() {
|
|
1173
1173
|
Companion_instance_3 = this;
|
|
1174
|
-
this.
|
|
1174
|
+
this.b1y_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']);
|
|
1175
1175
|
}
|
|
1176
1176
|
var Companion_instance_3;
|
|
1177
1177
|
function Companion_getInstance_1() {
|
|
@@ -1180,16 +1180,16 @@ function Companion_getInstance_1() {
|
|
|
1180
1180
|
return Companion_instance_3;
|
|
1181
1181
|
}
|
|
1182
1182
|
function sam$kotlin_Comparator$0_0(function_0) {
|
|
1183
|
-
this.
|
|
1183
|
+
this.c1y_1 = function_0;
|
|
1184
1184
|
}
|
|
1185
1185
|
protoOf(sam$kotlin_Comparator$0_0).td = function (a, b) {
|
|
1186
|
-
return this.
|
|
1186
|
+
return this.c1y_1(a, b);
|
|
1187
1187
|
};
|
|
1188
1188
|
protoOf(sam$kotlin_Comparator$0_0).compare = function (a, b) {
|
|
1189
1189
|
return this.td(a, b);
|
|
1190
1190
|
};
|
|
1191
1191
|
protoOf(sam$kotlin_Comparator$0_0).l3 = function () {
|
|
1192
|
-
return this.
|
|
1192
|
+
return this.c1y_1;
|
|
1193
1193
|
};
|
|
1194
1194
|
protoOf(sam$kotlin_Comparator$0_0).equals = function (other) {
|
|
1195
1195
|
var tmp;
|
|
@@ -1251,7 +1251,7 @@ function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
function PythonIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
|
|
1253
1253
|
return function () {
|
|
1254
|
-
var tmp = Companion_getInstance_1().
|
|
1254
|
+
var tmp = Companion_getInstance_1().b1y_1;
|
|
1255
1255
|
var tmp_0 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda;
|
|
1256
1256
|
var tmp_1 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
|
|
1257
1257
|
var tmp_2 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
|
|
@@ -1282,25 +1282,25 @@ function PythonIrEmitter(packageName, emitShared) {
|
|
|
1282
1282
|
Companion_getInstance_1();
|
|
1283
1283
|
packageName = packageName === VOID ? Companion_instance.qr('community.flock.wirespec.generated') : packageName;
|
|
1284
1284
|
emitShared = emitShared === VOID ? Companion_instance_0.ko() : emitShared;
|
|
1285
|
-
this.
|
|
1286
|
-
this.
|
|
1287
|
-
this.
|
|
1288
|
-
this.
|
|
1285
|
+
this.v1x_1 = packageName;
|
|
1286
|
+
this.w1x_1 = emitShared;
|
|
1287
|
+
this.x1x_1 = PythonGenerator_instance;
|
|
1288
|
+
this.y1x_1 = FileExtension_Python_getInstance();
|
|
1289
1289
|
var tmp = this;
|
|
1290
|
-
tmp.
|
|
1291
|
-
this.
|
|
1290
|
+
tmp.z1x_1 = lazy(PythonIrEmitter$sanitizationConfig$delegate$lambda(this));
|
|
1291
|
+
this.a1y_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";
|
|
1292
1292
|
}
|
|
1293
1293
|
protoOf(PythonIrEmitter).p1u = function () {
|
|
1294
|
-
return this.
|
|
1294
|
+
return this.x1x_1;
|
|
1295
1295
|
};
|
|
1296
1296
|
protoOf(PythonIrEmitter).iq = function () {
|
|
1297
|
-
return this.
|
|
1297
|
+
return this.y1x_1;
|
|
1298
1298
|
};
|
|
1299
1299
|
protoOf(PythonIrEmitter).s1u = function () {
|
|
1300
1300
|
var source = convert(Companion_instance.qr('shared'));
|
|
1301
1301
|
var tmp;
|
|
1302
|
-
if (this.
|
|
1303
|
-
tmp = new File(Companion_getInstance().k1h(this.
|
|
1302
|
+
if (this.w1x_1.lo_1) {
|
|
1303
|
+
tmp = new File(Companion_getInstance().k1h(this.v1x_1.tr() + 'wirespec'), listOf_0(raw(this.a1y_1 + PythonGenerator_instance.q1u(source))));
|
|
1304
1304
|
} else {
|
|
1305
1305
|
tmp = null;
|
|
1306
1306
|
}
|
|
@@ -1341,7 +1341,7 @@ protoOf(PythonIrEmitter).r1u = function (module_0, logger) {
|
|
|
1341
1341
|
tmp$ret$2 = false;
|
|
1342
1342
|
}
|
|
1343
1343
|
var hasEndpoints = tmp$ret$2;
|
|
1344
|
-
var tmp_2 = Companion_getInstance().k1h(this.
|
|
1344
|
+
var tmp_2 = Companion_getInstance().k1h(this.v1x_1.tr() + '__init__');
|
|
1345
1345
|
// Inline function 'kotlin.collections.buildList' call
|
|
1346
1346
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
1347
1347
|
// Inline function 'kotlin.apply' call
|
|
@@ -1354,7 +1354,7 @@ protoOf(PythonIrEmitter).r1u = function (module_0, logger) {
|
|
|
1354
1354
|
this_1.x(import_0('.', 'wirespec'));
|
|
1355
1355
|
var tmp$ret$7 = this_1.o5();
|
|
1356
1356
|
var init = new File(tmp_2, tmp$ret$7);
|
|
1357
|
-
var tmp_3 = Companion_getInstance().k1h(this.
|
|
1357
|
+
var tmp_3 = Companion_getInstance().k1h(this.v1x_1.tr() + 'endpoint/' + '__init__');
|
|
1358
1358
|
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1359
1359
|
var tmp0_0 = new NonEmptyList(module_0.hq_1);
|
|
1360
1360
|
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
@@ -1376,7 +1376,7 @@ protoOf(PythonIrEmitter).r1u = function (module_0, logger) {
|
|
|
1376
1376
|
destination_0.x(tmp$ret$10);
|
|
1377
1377
|
}
|
|
1378
1378
|
var initEndpoint = new File(tmp_3, destination_0);
|
|
1379
|
-
var tmp_4 = Companion_getInstance().k1h(this.
|
|
1379
|
+
var tmp_4 = Companion_getInstance().k1h(this.v1x_1.tr() + 'model/' + '__init__');
|
|
1380
1380
|
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1381
1381
|
var tmp0_1 = new NonEmptyList(module_0.hq_1);
|
|
1382
1382
|
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
@@ -1398,8 +1398,8 @@ protoOf(PythonIrEmitter).r1u = function (module_0, logger) {
|
|
|
1398
1398
|
destination_2.x(tmp$ret$15);
|
|
1399
1399
|
}
|
|
1400
1400
|
var initModel = new File(tmp_4, destination_2);
|
|
1401
|
-
var initClient = hasEndpoints ? listOf_0(new File(Companion_getInstance().k1h(this.
|
|
1402
|
-
var tmp0_2 = dropLast(split(this.
|
|
1401
|
+
var initClient = hasEndpoints ? listOf_0(new File(Companion_getInstance().k1h(this.v1x_1.tr() + 'client/' + '__init__'), emptyList())) : emptyList();
|
|
1402
|
+
var tmp0_2 = dropLast(split(this.v1x_1.rr_1, ['.']), 1);
|
|
1403
1403
|
var tmp$ret$18;
|
|
1404
1404
|
$l$block_1: {
|
|
1405
1405
|
// Inline function 'kotlin.collections.runningFold' call
|
|
@@ -1440,11 +1440,11 @@ protoOf(PythonIrEmitter).r1u = function (module_0, logger) {
|
|
|
1440
1440
|
destination_3.x(tmp$ret$23);
|
|
1441
1441
|
}
|
|
1442
1442
|
var parentInits = destination_3;
|
|
1443
|
-
return this.
|
|
1443
|
+
return this.w1x_1.lo_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);
|
|
1444
1444
|
};
|
|
1445
1445
|
protoOf(PythonIrEmitter).zq = function (definition, module_0, logger) {
|
|
1446
1446
|
var file = emit_0.call(this, definition, module_0, logger);
|
|
1447
|
-
return placeInModule(prependImports(file, buildImports(this, '..wirespec')), this.
|
|
1447
|
+
return placeInModule(prependImports(file, buildImports(this, '..wirespec')), this.v1x_1, definition);
|
|
1448
1448
|
};
|
|
1449
1449
|
protoOf(PythonIrEmitter).yp = function (type, module_0) {
|
|
1450
1450
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -1559,7 +1559,7 @@ protoOf(PythonIrEmitter).u1u = function (endpoint) {
|
|
|
1559
1559
|
var endpointImport = import_0('..endpoint.' + endpoint.ip_1.l1(), '*');
|
|
1560
1560
|
var endpointName = endpoint.ip_1.l1();
|
|
1561
1561
|
var file = flattenEndpointTypeRefs(snakeCaseClientFunctions(addSelfReceiverToClientFields(sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)))), endpointName);
|
|
1562
|
-
var subPackageName = plus_2(this.
|
|
1562
|
+
var subPackageName = plus_2(this.v1x_1, 'client');
|
|
1563
1563
|
return new File(Companion_getInstance().k1h(subPackageName.tr() + file.x1m_1.m1h()), plus(plus(plus(buildImports(this, '..wirespec'), modelImports), listOf_0(endpointImport)), file.y1m_1));
|
|
1564
1564
|
};
|
|
1565
1565
|
protoOf(PythonIrEmitter).t1u = function (endpoints, logger) {
|
|
@@ -1634,7 +1634,7 @@ protoOf(PythonIrEmitter).t1u = function (endpoints, logger) {
|
|
|
1634
1634
|
accumulator = flattenEndpointTypeRefs(acc, element_0);
|
|
1635
1635
|
}
|
|
1636
1636
|
var file = accumulator;
|
|
1637
|
-
return new File(Companion_getInstance().k1h(this.
|
|
1637
|
+
return new File(Companion_getInstance().k1h(this.v1x_1.tr() + file.x1m_1.m1h()), plus(plus(buildImports(this, '.wirespec'), allImports), file.y1m_1));
|
|
1638
1638
|
};
|
|
1639
1639
|
function replaceRefinedFunctions(_this__u8e3s4, refined) {
|
|
1640
1640
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
@@ -1991,8 +1991,8 @@ function addSelfReceiverToClientFields$lambda($fieldNames) {
|
|
|
1991
1991
|
function PythonRefinedTypeDefinitionEmitter() {
|
|
1992
1992
|
}
|
|
1993
1993
|
function PythonShared() {
|
|
1994
|
-
this.
|
|
1995
|
-
this.
|
|
1994
|
+
this.o1x_1 = 'shared';
|
|
1995
|
+
this.p1x_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";
|
|
1996
1996
|
}
|
|
1997
1997
|
protoOf(PythonShared).toString = function () {
|
|
1998
1998
|
return 'PythonShared';
|
|
@@ -2013,12 +2013,12 @@ function PythonShared_getInstance() {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
function PythonTypeDefinitionEmitter$emit$lambda(this$0) {
|
|
2015
2015
|
return function (it) {
|
|
2016
|
-
return this$0.
|
|
2016
|
+
return this$0.t1x(it);
|
|
2017
2017
|
};
|
|
2018
2018
|
}
|
|
2019
2019
|
function PythonTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
2020
2020
|
return function (it) {
|
|
2021
|
-
return this$0.
|
|
2021
|
+
return this$0.t1x(it);
|
|
2022
2022
|
};
|
|
2023
2023
|
}
|
|
2024
2024
|
function PythonTypeDefinitionEmitter$emit$lambda_1(this$0) {
|
|
@@ -2037,19 +2037,19 @@ protoOf(PythonEmitter).aq = emit_8;
|
|
|
2037
2037
|
protoOf(PythonEmitter).bq = emit_9;
|
|
2038
2038
|
protoOf(PythonEmitter).cq = emit_11;
|
|
2039
2039
|
protoOf(PythonEmitter).nr = emit_4;
|
|
2040
|
-
protoOf(PythonEmitter).ir =
|
|
2041
|
-
protoOf(PythonEmitter).or =
|
|
2040
|
+
protoOf(PythonEmitter).ir = emit_12;
|
|
2041
|
+
protoOf(PythonEmitter).or = emit_13;
|
|
2042
2042
|
protoOf(PythonEmitter).dr = emit_5;
|
|
2043
2043
|
protoOf(PythonEmitter).br = emit_3;
|
|
2044
2044
|
protoOf(PythonEmitter).cr = emit_2;
|
|
2045
|
-
protoOf(PythonEmitter).
|
|
2046
|
-
protoOf(PythonEmitter).
|
|
2047
|
-
protoOf(PythonEmitter).
|
|
2045
|
+
protoOf(PythonEmitter).q1x = emit_10;
|
|
2046
|
+
protoOf(PythonEmitter).x1v = emit_14;
|
|
2047
|
+
protoOf(PythonEmitter).r1x = emit_15;
|
|
2048
2048
|
protoOf(PythonEmitter).pr = emitValidator;
|
|
2049
|
-
protoOf(PythonEmitter).
|
|
2050
|
-
protoOf(PythonEmitter).
|
|
2051
|
-
protoOf(PythonEmitter).
|
|
2052
|
-
protoOf(PythonEmitter).
|
|
2049
|
+
protoOf(PythonEmitter).k1w = sanitize;
|
|
2050
|
+
protoOf(PythonEmitter).a1w = sanitizeKeywords;
|
|
2051
|
+
protoOf(PythonEmitter).s1x = emitType;
|
|
2052
|
+
protoOf(PythonEmitter).t1x = emitReferenceCustomImports;
|
|
2053
2053
|
protoOf(PythonIrEmitter).sn = emit_1;
|
|
2054
2054
|
//endregion
|
|
2055
2055
|
//region block: init
|