@flock/wirespec 0.17.16 → 0.17.18
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.mjs +1152 -1152
- package/colormath-root-colormath.mjs +424 -424
- package/kotlin-kotlin-stdlib.mjs +11 -11
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +1 -0
- package/kotlin-rgxgen.mjs +1763 -1763
- package/kotlinx-io-kotlinx-io-core.mjs +377 -377
- package/markdown.mjs +1833 -1833
- package/mordant-mordant.mjs +1605 -1605
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +25 -13
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +118 -84
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +156 -126
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +169 -139
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +89 -85
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +33 -33
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +246 -246
- package/wirespec-src-converter-avro.mjs +265 -265
- package/wirespec-src-converter-openapi.mjs +76 -75
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +132 -132
- package/wirespec-src-plugin-cli.mjs +66 -66
- package/wirespec-src-plugin-npm.mjs +10 -10
- package/wirespec-src-tools-generator.mjs +2 -2
|
@@ -22,9 +22,11 @@ import {
|
|
|
22
22
|
isCharSequence1ju9jr1w86plq as isCharSequence,
|
|
23
23
|
trimStart5ewg8zf6cs5u as trimStart,
|
|
24
24
|
toString1pkumu07cwy4m as toString,
|
|
25
|
+
prependIndentkl9wuvcodvmu as prependIndent,
|
|
25
26
|
listOfNotNull2woi2boe01ub4 as listOfNotNull,
|
|
26
27
|
isBlank1dvkhjjvox3p0 as isBlank,
|
|
27
28
|
first58ocm7j58k3q as first,
|
|
29
|
+
startsWith26w8qjqapeeq6 as startsWith,
|
|
28
30
|
split2bvyvnrlcifjv as split,
|
|
29
31
|
firstOrNulltrxqttxfxqju as firstOrNull,
|
|
30
32
|
isDigit3mimrri4wkzop as isDigit,
|
|
@@ -163,7 +165,7 @@ function sanitize(_this__u8e3s4) {
|
|
|
163
165
|
return tmp;
|
|
164
166
|
}
|
|
165
167
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
166
|
-
return Companion_getInstance().
|
|
168
|
+
return Companion_getInstance().j2c_1.o1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
167
169
|
}
|
|
168
170
|
initMetadataForInterface(PythonIdentifierEmitter, 'PythonIdentifierEmitter');
|
|
169
171
|
function emit_1(type, module_0) {
|
|
@@ -191,7 +193,7 @@ function emit_4(_this__u8e3s4) {
|
|
|
191
193
|
// Inline function 'kotlin.let' call
|
|
192
194
|
// Inline function 'kotlin.contracts.contract' call
|
|
193
195
|
// Inline function 'community.flock.wirespec.emitters.python.PythonTypeDefinitionEmitter.emit.<anonymous>' call
|
|
194
|
-
var it = this.
|
|
196
|
+
var it = this.h2c(_this__u8e3s4);
|
|
195
197
|
return _this__u8e3s4.jm() ? 'Optional[' + it + ']' : it;
|
|
196
198
|
}
|
|
197
199
|
function emitType(_this__u8e3s4) {
|
|
@@ -212,7 +214,7 @@ function emitType(_this__u8e3s4) {
|
|
|
212
214
|
tmp = _this__u8e3s4.j29_1;
|
|
213
215
|
} else {
|
|
214
216
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
215
|
-
tmp = this.
|
|
217
|
+
tmp = this.f2c(_this__u8e3s4.n29_1);
|
|
216
218
|
} else {
|
|
217
219
|
noWhenBranchMatchedException();
|
|
218
220
|
}
|
|
@@ -298,7 +300,55 @@ function emitReferenceCustomImports(_this__u8e3s4) {
|
|
|
298
300
|
return 'from ..model.' + _this__u8e3s4.j29_1 + ' import ' + _this__u8e3s4.j29_1;
|
|
299
301
|
}
|
|
300
302
|
initMetadataForInterface(PythonTypeDefinitionEmitter, 'PythonTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
301
|
-
function emit_7(
|
|
303
|
+
function emit_7(refined) {
|
|
304
|
+
return trimMargin('\n |@dataclass\n |class ' + this.h2a(refined.d26_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.h2c(refined.e26_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.s26(2) + 'return ' + this.m26(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.s26(2) + 'return str(self.value)\n |\n ');
|
|
305
|
+
}
|
|
306
|
+
function emitValidator(_this__u8e3s4) {
|
|
307
|
+
var defaultReturn = 'True';
|
|
308
|
+
var type = _this__u8e3s4.e26_1.n29_1;
|
|
309
|
+
var tmp;
|
|
310
|
+
if (type instanceof Integer) {
|
|
311
|
+
var tmp0_safe_receiver = type.t28_1;
|
|
312
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.a25(tmp0_safe_receiver);
|
|
313
|
+
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
314
|
+
} else {
|
|
315
|
+
if (type instanceof Number_0) {
|
|
316
|
+
var tmp2_safe_receiver = type.w28_1;
|
|
317
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.a25(tmp2_safe_receiver);
|
|
318
|
+
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
319
|
+
} else {
|
|
320
|
+
if (type instanceof String_0) {
|
|
321
|
+
var tmp4_safe_receiver = type.q28_1;
|
|
322
|
+
var tmp_0;
|
|
323
|
+
var tmp_1 = tmp4_safe_receiver;
|
|
324
|
+
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
325
|
+
tmp_0 = null;
|
|
326
|
+
} else {
|
|
327
|
+
tmp_0 = this.a25(new RegExp_0(tmp4_safe_receiver));
|
|
328
|
+
}
|
|
329
|
+
var tmp5_elvis_lhs = tmp_0;
|
|
330
|
+
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
331
|
+
} else {
|
|
332
|
+
if (equals(type, Boolean_instance)) {
|
|
333
|
+
tmp = defaultReturn;
|
|
334
|
+
} else {
|
|
335
|
+
if (equals(type, Bytes_instance)) {
|
|
336
|
+
tmp = defaultReturn;
|
|
337
|
+
} else {
|
|
338
|
+
noWhenBranchMatchedException();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return tmp;
|
|
345
|
+
}
|
|
346
|
+
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
347
|
+
function emit_8(union) {
|
|
348
|
+
return trimMargin('\n |class ' + this.y25(union.s23_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
349
|
+
}
|
|
350
|
+
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
351
|
+
function emit_9(endpoint) {
|
|
302
352
|
var tmp = importReferences(endpoint);
|
|
303
353
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda(this));
|
|
304
354
|
var tmp_1 = this.y25(endpoint.g24_1);
|
|
@@ -306,7 +356,7 @@ function emit_7(endpoint) {
|
|
|
306
356
|
var tmp_3 = distinctByStatus(endpoint.m24_1);
|
|
307
357
|
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(endpoint, this), 1) + '\n |' + spacer(emitHandleClass(endpoint, this), 1) + '\n |' + spacer(emitConvertClass(endpoint, this), 1) + '\n |\n ');
|
|
308
358
|
}
|
|
309
|
-
function
|
|
359
|
+
function emit_10(_this__u8e3s4, endpoint) {
|
|
310
360
|
var tmp = emit_15(_this__u8e3s4.p24_1, this);
|
|
311
361
|
var tmp_0 = get_pathParams(endpoint);
|
|
312
362
|
var tmp_1 = emitObject$default(tmp_0, this, 'Path', 'Wirespec.Request.Path', VOID, PythonEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
@@ -339,7 +389,7 @@ function emit_8(_this__u8e3s4, endpoint) {
|
|
|
339
389
|
var tmp_28 = paramList(_this__u8e3s4, endpoint);
|
|
340
390
|
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.h24_1.q2_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__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
341
391
|
}
|
|
342
|
-
function
|
|
392
|
+
function emit_11(_this__u8e3s4, endpoint) {
|
|
343
393
|
var tmp = emit_15(_this__u8e3s4.u24_1, this);
|
|
344
394
|
var tmp_0 = emitObject$default(_this__u8e3s4.t24_1, this, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
345
395
|
var tmp_1 = Spacer_instance.toString();
|
|
@@ -360,97 +410,28 @@ function emit_9(_this__u8e3s4, endpoint) {
|
|
|
360
410
|
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.s24_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.s24_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__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
361
411
|
}
|
|
362
412
|
initMetadataForInterface(PythonEndpointDefinitionEmitter, 'PythonEndpointDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter]);
|
|
363
|
-
function
|
|
364
|
-
return trimMargin('\n |class ' + this.y25(union.s23_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
365
|
-
}
|
|
366
|
-
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
367
|
-
function emit_11(enum_0, module_0) {
|
|
413
|
+
function emit_12(enum_0, module_0) {
|
|
368
414
|
var tmp = this.h2a(enum_0.i26_1);
|
|
369
415
|
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.j26_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.s26(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.s26(2) + 'return self.value\n ');
|
|
370
416
|
}
|
|
371
|
-
function sanitizeEnum(_this__u8e3s4) {
|
|
372
|
-
// Inline function 'kotlin.let' call
|
|
373
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
374
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEnumDefinitionEmitter.sanitizeEnum.<anonymous>' call
|
|
375
|
-
var it = joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_');
|
|
376
|
-
var tmp;
|
|
377
|
-
var tmp0_safe_receiver = firstOrNull(it);
|
|
378
|
-
var tmp_0;
|
|
379
|
-
var tmp_1 = tmp0_safe_receiver;
|
|
380
|
-
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
381
|
-
tmp_0 = null;
|
|
382
|
-
} else {
|
|
383
|
-
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
384
|
-
}
|
|
385
|
-
if (tmp_0 === true) {
|
|
386
|
-
tmp = '_' + it;
|
|
387
|
-
} else {
|
|
388
|
-
tmp = it;
|
|
389
|
-
}
|
|
390
|
-
return tmp;
|
|
391
|
-
}
|
|
392
417
|
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
393
|
-
|
|
394
|
-
return trimMargin('\n |@dataclass\n |class ' + this.h2a(refined.d26_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.e2c(refined.e26_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.s26(2) + 'return ' + this.m26(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.s26(2) + 'return str(self.value)\n |\n ');
|
|
395
|
-
}
|
|
396
|
-
function emitValidator(_this__u8e3s4) {
|
|
397
|
-
var defaultReturn = 'True';
|
|
398
|
-
var type = _this__u8e3s4.e26_1.n29_1;
|
|
399
|
-
var tmp;
|
|
400
|
-
if (type instanceof Integer) {
|
|
401
|
-
var tmp0_safe_receiver = type.t28_1;
|
|
402
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.a25(tmp0_safe_receiver);
|
|
403
|
-
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
404
|
-
} else {
|
|
405
|
-
if (type instanceof Number_0) {
|
|
406
|
-
var tmp2_safe_receiver = type.w28_1;
|
|
407
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.a25(tmp2_safe_receiver);
|
|
408
|
-
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
409
|
-
} else {
|
|
410
|
-
if (type instanceof String_0) {
|
|
411
|
-
var tmp4_safe_receiver = type.q28_1;
|
|
412
|
-
var tmp_0;
|
|
413
|
-
var tmp_1 = tmp4_safe_receiver;
|
|
414
|
-
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
415
|
-
tmp_0 = null;
|
|
416
|
-
} else {
|
|
417
|
-
tmp_0 = this.a25(new RegExp_0(tmp4_safe_receiver));
|
|
418
|
-
}
|
|
419
|
-
var tmp5_elvis_lhs = tmp_0;
|
|
420
|
-
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
421
|
-
} else {
|
|
422
|
-
if (equals(type, Boolean_instance)) {
|
|
423
|
-
tmp = defaultReturn;
|
|
424
|
-
} else {
|
|
425
|
-
if (equals(type, Bytes_instance)) {
|
|
426
|
-
tmp = defaultReturn;
|
|
427
|
-
} else {
|
|
428
|
-
noWhenBranchMatchedException();
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
return tmp;
|
|
435
|
-
}
|
|
436
|
-
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
437
|
-
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonEndpointDefinitionEmitter, PythonUnionDefinitionEmitter, PythonEnumDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonTypeDefinitionEmitter, PythonChannelDefinitionEmitter, PythonIdentifierEmitter]);
|
|
418
|
+
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonRefinedTypeDefinitionEmitter, PythonTypeDefinitionEmitter, PythonUnionDefinitionEmitter, PythonIdentifierEmitter, PythonEndpointDefinitionEmitter, PythonEnumDefinitionEmitter, PythonChannelDefinitionEmitter]);
|
|
438
419
|
initMetadataForCompanion(Companion);
|
|
439
420
|
initMetadataForObject(PythonShared, 'PythonShared');
|
|
440
421
|
//endregion
|
|
441
422
|
function PythonChannelDefinitionEmitter() {
|
|
442
423
|
}
|
|
443
424
|
function sam$kotlin_Comparator$0(function_0) {
|
|
444
|
-
this.
|
|
425
|
+
this.v2b_1 = function_0;
|
|
445
426
|
}
|
|
446
427
|
protoOf(sam$kotlin_Comparator$0).uc = function (a, b) {
|
|
447
|
-
return this.
|
|
428
|
+
return this.v2b_1(a, b);
|
|
448
429
|
};
|
|
449
430
|
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
450
431
|
return this.uc(a, b);
|
|
451
432
|
};
|
|
452
433
|
protoOf(sam$kotlin_Comparator$0).p3 = function () {
|
|
453
|
-
return this.
|
|
434
|
+
return this.v2b_1;
|
|
454
435
|
};
|
|
455
436
|
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
456
437
|
var tmp;
|
|
@@ -476,8 +457,8 @@ function emit$_anonymous_$emitInit_7cggmt(this$0, def) {
|
|
|
476
457
|
function PythonEmitter$emit$lambda(this$0) {
|
|
477
458
|
return function (a, b) {
|
|
478
459
|
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
479
|
-
var tmp = this$0.
|
|
480
|
-
var tmp$ret$1 = this$0.
|
|
460
|
+
var tmp = this$0.c2c(a);
|
|
461
|
+
var tmp$ret$1 = this$0.c2c(b);
|
|
481
462
|
return compareValues(tmp, tmp$ret$1);
|
|
482
463
|
};
|
|
483
464
|
}
|
|
@@ -485,23 +466,23 @@ function PythonEmitter(packageName, emitShared) {
|
|
|
485
466
|
packageName = packageName === VOID ? Companion_instance.n26('community.flock.wirespec.generated') : packageName;
|
|
486
467
|
emitShared = emitShared === VOID ? Companion_instance_0.i23() : emitShared;
|
|
487
468
|
LanguageEmitter.call(this);
|
|
488
|
-
this.
|
|
489
|
-
this.
|
|
490
|
-
this.
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
469
|
+
this.w2b_1 = packageName;
|
|
470
|
+
this.x2b_1 = emitShared;
|
|
471
|
+
this.y2b_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';
|
|
472
|
+
this.z2b_1 = FileExtension_Python_getInstance();
|
|
473
|
+
this.a2c_1 = PythonShared_instance;
|
|
474
|
+
this.b2c_1 = '#';
|
|
494
475
|
}
|
|
495
476
|
protoOf(PythonEmitter).g25 = function () {
|
|
496
|
-
return this.
|
|
477
|
+
return this.z2b_1;
|
|
497
478
|
};
|
|
498
479
|
protoOf(PythonEmitter).q2a = function () {
|
|
499
|
-
return this.
|
|
480
|
+
return this.a2c_1;
|
|
500
481
|
};
|
|
501
482
|
protoOf(PythonEmitter).h25 = function () {
|
|
502
|
-
return this.
|
|
483
|
+
return this.b2c_1;
|
|
503
484
|
};
|
|
504
|
-
protoOf(PythonEmitter).
|
|
485
|
+
protoOf(PythonEmitter).c2c = function (definition) {
|
|
505
486
|
var tmp;
|
|
506
487
|
if (definition instanceof Enum) {
|
|
507
488
|
tmp = 1;
|
|
@@ -542,8 +523,8 @@ protoOf(PythonEmitter).v25 = function (module_0, logger) {
|
|
|
542
523
|
// Inline function 'kotlin.contracts.contract' call
|
|
543
524
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
544
525
|
var it = protoOf(LanguageEmitter).v25.call(this, module_0.t29(VOID, statements), logger);
|
|
545
|
-
var init = new Emitted(this.
|
|
546
|
-
var tmp_0 = this.
|
|
526
|
+
var init = new Emitted(this.w2b_1.q26() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
527
|
+
var tmp_0 = this.w2b_1.q26() + 'endpoint/' + '__init__';
|
|
547
528
|
// Inline function 'kotlin.collections.map' call
|
|
548
529
|
// Inline function 'kotlin.collections.filter' call
|
|
549
530
|
// Inline function 'kotlin.collections.filterTo' call
|
|
@@ -567,7 +548,7 @@ protoOf(PythonEmitter).v25 = function (module_0, logger) {
|
|
|
567
548
|
destination_0.e(tmp$ret$5);
|
|
568
549
|
}
|
|
569
550
|
var initEndpoint = new Emitted(tmp_0, joinToString(destination_0, '\n'));
|
|
570
|
-
var tmp_1 = this.
|
|
551
|
+
var tmp_1 = this.w2b_1.q26() + 'model/' + '__init__';
|
|
571
552
|
// Inline function 'kotlin.collections.map' call
|
|
572
553
|
// Inline function 'kotlin.collections.filter' call
|
|
573
554
|
// Inline function 'kotlin.collections.filterTo' call
|
|
@@ -591,18 +572,18 @@ protoOf(PythonEmitter).v25 = function (module_0, logger) {
|
|
|
591
572
|
destination_2.e(tmp$ret$11);
|
|
592
573
|
}
|
|
593
574
|
var initModel = new Emitted(tmp_1, joinToString(destination_2, '\n'));
|
|
594
|
-
var shared = new Emitted(this.
|
|
595
|
-
return this.
|
|
575
|
+
var shared = new Emitted(this.w2b_1.q26() + 'wirespec', this.q2a().e2c_1);
|
|
576
|
+
return this.x2b_1.j23_1 ? it.vk(init).vk(initEndpoint).vk(initModel).vk(shared) : it.vk(init);
|
|
596
577
|
};
|
|
597
578
|
protoOf(PythonEmitter).w25 = function (definition, module_0, logger) {
|
|
598
|
-
var subPackageName = plus(this.
|
|
579
|
+
var subPackageName = plus(this.w2b_1, definition);
|
|
599
580
|
// Inline function 'kotlin.let' call
|
|
600
581
|
// Inline function 'kotlin.contracts.contract' call
|
|
601
582
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
602
583
|
var it = protoOf(LanguageEmitter).w25.call(this, definition, module_0, logger);
|
|
603
584
|
var tmp = subPackageName.q26() + it.k23_1;
|
|
604
585
|
// Inline function 'kotlin.text.trimStart' call
|
|
605
|
-
var this_0 = trimMargin('\n |' + this.
|
|
586
|
+
var this_0 = trimMargin('\n |' + this.y2b_1 + '\n |' + it.l23_1 + '\n ');
|
|
606
587
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
607
588
|
return new Emitted(tmp, tmp$ret$0);
|
|
608
589
|
};
|
|
@@ -619,27 +600,31 @@ function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
|
619
600
|
var tmp_8;
|
|
620
601
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
621
602
|
if (!endpoint.j24_1.l()) {
|
|
622
|
-
tmp_8 = joinToString(endpoint.j24_1, ',\n',
|
|
603
|
+
tmp_8 = prependIndent(joinToString(endpoint.j24_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_0($this)), Spacer_instance.s26(3));
|
|
623
604
|
} else {
|
|
624
|
-
tmp_8 = '
|
|
605
|
+
tmp_8 = '';
|
|
625
606
|
}
|
|
626
607
|
var tmp_9 = tmp_8;
|
|
627
608
|
var tmp_10 = Spacer_instance.toString();
|
|
628
609
|
var tmp_11 = Spacer_instance.toString();
|
|
629
|
-
var tmp_12;
|
|
610
|
+
var tmp_12 = Spacer_instance.toString();
|
|
611
|
+
var tmp_13 = Spacer_instance.toString();
|
|
612
|
+
var tmp_14;
|
|
630
613
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
631
614
|
if (!endpoint.k24_1.l()) {
|
|
632
|
-
|
|
615
|
+
tmp_14 = prependIndent(joinToString(endpoint.k24_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_1($this)), Spacer_instance.s26(3));
|
|
633
616
|
} else {
|
|
634
|
-
|
|
617
|
+
tmp_14 = '';
|
|
635
618
|
}
|
|
636
|
-
var
|
|
637
|
-
var
|
|
638
|
-
var
|
|
619
|
+
var tmp_15 = tmp_14;
|
|
620
|
+
var tmp_16 = Spacer_instance.toString();
|
|
621
|
+
var tmp_17 = Spacer_instance.toString();
|
|
622
|
+
var tmp_18 = Spacer_instance.toString();
|
|
623
|
+
var tmp_19 = Spacer_instance.toString();
|
|
639
624
|
var tmp0_safe_receiver = _this__u8e3s4.p24_1;
|
|
640
625
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r24_1;
|
|
641
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
642
|
-
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 = ' + tmp_9 + '
|
|
626
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.h2c(tmp1_safe_receiver);
|
|
627
|
+
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 ');
|
|
643
628
|
}
|
|
644
629
|
function emitFromRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
645
630
|
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.y25(endpoint.g24_1) + ".Request':\n |" + Spacer_instance.toString() + 'return ' + $this.y25(endpoint.g24_1) + '.Request' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + '\n |\n ');
|
|
@@ -658,7 +643,7 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
658
643
|
// Inline function 'kotlin.let' call
|
|
659
644
|
// Inline function 'kotlin.contracts.contract' call
|
|
660
645
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
661
|
-
tmp_3 = Spacer_instance.s26(3) + 'body = serialization.deserialize(request.body, ' + $this.
|
|
646
|
+
tmp_3 = Spacer_instance.s26(3) + 'body = serialization.deserialize(request.body, ' + $this.h2c(tmp0_safe_receiver.r24_1) + '),';
|
|
662
647
|
}
|
|
663
648
|
// Inline function 'kotlin.contracts.contract' call
|
|
664
649
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
@@ -767,10 +752,25 @@ function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
|
767
752
|
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.s24_1 + '.Headers(' + tmp_1 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
|
|
768
753
|
}
|
|
769
754
|
function emitDeserialized(_this__u8e3s4, $this) {
|
|
770
|
-
return Spacer_instance.s26(3) + $this.y25(_this__u8e3s4.rd_1.n24_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], ' + $this.
|
|
755
|
+
return Spacer_instance.s26(3) + $this.y25(_this__u8e3s4.rd_1.n24_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], ' + $this.h2c(_this__u8e3s4.rd_1.o24_1) + ')';
|
|
756
|
+
}
|
|
757
|
+
function emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces, caseSensitive) {
|
|
758
|
+
var tmp;
|
|
759
|
+
if (caseSensitive) {
|
|
760
|
+
tmp = Spacer_instance.s26(spaces) + $this.y25(_this__u8e3s4.c24_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.c24_1.b1() + '"), ' + $this.h2c(_this__u8e3s4.d24_1) + ')';
|
|
761
|
+
} else {
|
|
762
|
+
var tmp_0 = Spacer_instance.s26(spaces);
|
|
763
|
+
var tmp_1 = $this.y25(_this__u8e3s4.c24_1);
|
|
764
|
+
// Inline function 'kotlin.text.lowercase' call
|
|
765
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
766
|
+
tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.c24_1.b1().toLowerCase() + '"), None), ' + $this.h2c(_this__u8e3s4.d24_1) + ')';
|
|
767
|
+
}
|
|
768
|
+
return tmp;
|
|
771
769
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
770
|
+
function emitDeserializedParams$default(_this__u8e3s4, $this, type, fields, spaces, caseSensitive, $super) {
|
|
771
|
+
spaces = spaces === VOID ? 3 : spaces;
|
|
772
|
+
caseSensitive = caseSensitive === VOID ? true : caseSensitive;
|
|
773
|
+
return emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces, caseSensitive);
|
|
774
774
|
}
|
|
775
775
|
function emitToRawResponse(_this__u8e3s4, $this) {
|
|
776
776
|
var tmp = $this.y25(_this__u8e3s4.g24_1);
|
|
@@ -802,10 +802,9 @@ function emitDeserialized_0(_this__u8e3s4, $this, endpoint) {
|
|
|
802
802
|
var tmp_1 = Spacer_instance.s26(2);
|
|
803
803
|
var tmp0_safe_receiver = _this__u8e3s4.u24_1;
|
|
804
804
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r24_1;
|
|
805
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
805
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.h2c(tmp1_safe_receiver);
|
|
806
806
|
var tmp_2 = tmp_1 + 'body = serialization.deserialize(response.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),';
|
|
807
|
-
|
|
808
|
-
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, tmp3_safe_receiver == null ? null : spacer(tmp3_safe_receiver, 2), Spacer_instance.toString() + ')']), '\n');
|
|
807
|
+
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, orNull(joinToString(_this__u8e3s4.t24_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserialized$lambda($this))), Spacer_instance.toString() + ')']), '\n');
|
|
809
808
|
}
|
|
810
809
|
function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
811
810
|
var tmp = $this.y25(endpoint.g24_1);
|
|
@@ -829,13 +828,13 @@ function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
|
829
828
|
// Inline function 'kotlin.let' call
|
|
830
829
|
// Inline function 'kotlin.contracts.contract' call
|
|
831
830
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitSerialized.<anonymous>' call
|
|
832
|
-
tmp_6 = 'serialization.serialize(response.body, ' + $this.
|
|
831
|
+
tmp_6 = 'serialization.serialize(response.body, ' + $this.h2c(tmp0_safe_receiver.r24_1) + ')';
|
|
833
832
|
}
|
|
834
833
|
var tmp1_elvis_lhs = tmp_6;
|
|
835
834
|
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.s24_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.s26(1) + ')\n ');
|
|
836
835
|
}
|
|
837
836
|
function emitSerializedParams(_this__u8e3s4, $this, type, fields) {
|
|
838
|
-
return '"' + _this__u8e3s4.c24_1.b1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.y25(_this__u8e3s4.c24_1) + ', ' + $this.
|
|
837
|
+
return '"' + _this__u8e3s4.c24_1.b1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.y25(_this__u8e3s4.c24_1) + ', ' + $this.h2c(_this__u8e3s4.d24_1) + ')';
|
|
839
838
|
}
|
|
840
839
|
function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
|
|
841
840
|
var tmp;
|
|
@@ -862,12 +861,12 @@ function emit_15(_this__u8e3s4, $this) {
|
|
|
862
861
|
}
|
|
863
862
|
function PythonEndpointDefinitionEmitter$emit$lambda(this$0) {
|
|
864
863
|
return function (it) {
|
|
865
|
-
return this$0.
|
|
864
|
+
return this$0.i2c(it);
|
|
866
865
|
};
|
|
867
866
|
}
|
|
868
867
|
function PythonEndpointDefinitionEmitter$emit$lambda_0(this$0, $endpoint) {
|
|
869
868
|
return function (it) {
|
|
870
|
-
return this$0.
|
|
869
|
+
return this$0.g2c(it, $endpoint);
|
|
871
870
|
};
|
|
872
871
|
}
|
|
873
872
|
function PythonEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
@@ -922,12 +921,12 @@ function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda(this$0) {
|
|
|
922
921
|
}
|
|
923
922
|
function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_0(this$0) {
|
|
924
923
|
return function (it) {
|
|
925
|
-
return
|
|
924
|
+
return emitDeserializedParams$default(it, this$0, 'request', 'queries');
|
|
926
925
|
};
|
|
927
926
|
}
|
|
928
927
|
function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_1(this$0) {
|
|
929
928
|
return function (it) {
|
|
930
|
-
return
|
|
929
|
+
return emitDeserializedParams$default(it, this$0, 'request', 'headers', VOID, false);
|
|
931
930
|
};
|
|
932
931
|
}
|
|
933
932
|
function PythonEndpointDefinitionEmitter$emitResponseUnion$lambda(it) {
|
|
@@ -975,7 +974,7 @@ function PythonEndpointDefinitionEmitter$emitFromRawResponse$lambda(this$0, $thi
|
|
|
975
974
|
}
|
|
976
975
|
function PythonEndpointDefinitionEmitter$emitDeserialized$lambda(this$0) {
|
|
977
976
|
return function (it) {
|
|
978
|
-
return emitDeserializedParams_0(it, this$0, 'response', 'headers');
|
|
977
|
+
return emitDeserializedParams_0(it, this$0, 'response', 'headers', 2, false);
|
|
979
978
|
};
|
|
980
979
|
}
|
|
981
980
|
function PythonEndpointDefinitionEmitter$emitSerialized$lambda(this$0) {
|
|
@@ -990,16 +989,48 @@ function PythonEndpointDefinitionEmitter$emitObject$lambda($spaces, $block) {
|
|
|
990
989
|
}
|
|
991
990
|
function PythonEndpointDefinitionEmitter() {
|
|
992
991
|
}
|
|
992
|
+
function sanitizeNegative(_this__u8e3s4, $this) {
|
|
993
|
+
var tmp;
|
|
994
|
+
if (startsWith(_this__u8e3s4, '-')) {
|
|
995
|
+
// Inline function 'kotlin.text.substring' call
|
|
996
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
997
|
+
tmp = '__' + _this__u8e3s4.substring(1);
|
|
998
|
+
} else {
|
|
999
|
+
tmp = _this__u8e3s4;
|
|
1000
|
+
}
|
|
1001
|
+
return tmp;
|
|
1002
|
+
}
|
|
1003
|
+
function sanitizeEnum(_this__u8e3s4, $this) {
|
|
1004
|
+
// Inline function 'kotlin.let' call
|
|
1005
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
1006
|
+
// Inline function 'community.flock.wirespec.emitters.python.PythonEnumDefinitionEmitter.sanitizeEnum.<anonymous>' call
|
|
1007
|
+
var it = joinToString(split(sanitizeNegative(_this__u8e3s4, $this), ['-', ', ', '.', ' ', '//']), '_');
|
|
1008
|
+
var tmp;
|
|
1009
|
+
var tmp0_safe_receiver = firstOrNull(it);
|
|
1010
|
+
var tmp_0;
|
|
1011
|
+
var tmp_1 = tmp0_safe_receiver;
|
|
1012
|
+
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
1013
|
+
tmp_0 = null;
|
|
1014
|
+
} else {
|
|
1015
|
+
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
1016
|
+
}
|
|
1017
|
+
if (tmp_0 === true) {
|
|
1018
|
+
tmp = '_' + it;
|
|
1019
|
+
} else {
|
|
1020
|
+
tmp = it;
|
|
1021
|
+
}
|
|
1022
|
+
return tmp;
|
|
1023
|
+
}
|
|
993
1024
|
function PythonEnumDefinitionEmitter$emit$lambda(this$0) {
|
|
994
1025
|
return function (it) {
|
|
995
|
-
return Spacer_instance.toString() + this$0.j2a(this$0
|
|
1026
|
+
return Spacer_instance.toString() + this$0.j2a(sanitizeEnum(it, this$0)) + ' = "' + it + '"';
|
|
996
1027
|
};
|
|
997
1028
|
}
|
|
998
1029
|
function PythonEnumDefinitionEmitter() {
|
|
999
1030
|
}
|
|
1000
1031
|
function Companion() {
|
|
1001
1032
|
Companion_instance_2 = this;
|
|
1002
|
-
this.
|
|
1033
|
+
this.j2c_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']);
|
|
1003
1034
|
}
|
|
1004
1035
|
var Companion_instance_2;
|
|
1005
1036
|
function Companion_getInstance() {
|
|
@@ -1012,8 +1043,8 @@ function PythonIdentifierEmitter() {
|
|
|
1012
1043
|
function PythonRefinedTypeDefinitionEmitter() {
|
|
1013
1044
|
}
|
|
1014
1045
|
function PythonShared() {
|
|
1015
|
-
this.
|
|
1016
|
-
this.
|
|
1046
|
+
this.d2c_1 = 'shared';
|
|
1047
|
+
this.e2c_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";
|
|
1017
1048
|
}
|
|
1018
1049
|
protoOf(PythonShared).toString = function () {
|
|
1019
1050
|
return 'PythonShared';
|
|
@@ -1035,12 +1066,12 @@ function PythonShared_getInstance() {
|
|
|
1035
1066
|
}
|
|
1036
1067
|
function PythonTypeDefinitionEmitter$emit$lambda(this$0) {
|
|
1037
1068
|
return function (it) {
|
|
1038
|
-
return this$0.
|
|
1069
|
+
return this$0.i2c(it);
|
|
1039
1070
|
};
|
|
1040
1071
|
}
|
|
1041
1072
|
function PythonTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
1042
1073
|
return function (it) {
|
|
1043
|
-
return this$0.
|
|
1074
|
+
return this$0.i2c(it);
|
|
1044
1075
|
};
|
|
1045
1076
|
}
|
|
1046
1077
|
function PythonTypeDefinitionEmitter$emit$lambda_1(this$0) {
|
|
@@ -1058,21 +1089,20 @@ protoOf(PythonEmitter).w24 = emit_1;
|
|
|
1058
1089
|
protoOf(PythonEmitter).x24 = emit_2;
|
|
1059
1090
|
protoOf(PythonEmitter).y24 = emit_3;
|
|
1060
1091
|
protoOf(PythonEmitter).z24 = emit_4;
|
|
1061
|
-
protoOf(PythonEmitter).
|
|
1092
|
+
protoOf(PythonEmitter).f2c = emit_5;
|
|
1062
1093
|
protoOf(PythonEmitter).a25 = emit_6;
|
|
1063
|
-
protoOf(PythonEmitter).l26 =
|
|
1064
|
-
protoOf(PythonEmitter).t2a =
|
|
1065
|
-
protoOf(PythonEmitter).
|
|
1094
|
+
protoOf(PythonEmitter).l26 = emit_9;
|
|
1095
|
+
protoOf(PythonEmitter).t2a = emit_10;
|
|
1096
|
+
protoOf(PythonEmitter).g2c = emit_11;
|
|
1066
1097
|
protoOf(PythonEmitter).z25 = emit;
|
|
1067
|
-
protoOf(PythonEmitter).k26 =
|
|
1068
|
-
protoOf(PythonEmitter).a26 =
|
|
1069
|
-
protoOf(PythonEmitter).f26 =
|
|
1098
|
+
protoOf(PythonEmitter).k26 = emit_12;
|
|
1099
|
+
protoOf(PythonEmitter).a26 = emit_8;
|
|
1100
|
+
protoOf(PythonEmitter).f26 = emit_7;
|
|
1070
1101
|
protoOf(PythonEmitter).m26 = emitValidator;
|
|
1071
1102
|
protoOf(PythonEmitter).h2a = sanitize;
|
|
1072
1103
|
protoOf(PythonEmitter).j2a = sanitizeKeywords;
|
|
1073
|
-
protoOf(PythonEmitter).
|
|
1074
|
-
protoOf(PythonEmitter).
|
|
1075
|
-
protoOf(PythonEmitter).w2a = sanitizeEnum;
|
|
1104
|
+
protoOf(PythonEmitter).h2c = emitType;
|
|
1105
|
+
protoOf(PythonEmitter).i2c = emitReferenceCustomImports;
|
|
1076
1106
|
//endregion
|
|
1077
1107
|
//region block: init
|
|
1078
1108
|
PythonShared_instance = new PythonShared();
|