@flock/wirespec 0.20.0-RC.10 → 0.20.0-RC.12
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/kotlin-kotlin-stdlib.mjs +5 -5
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +13 -13
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +13 -13
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +157 -148
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +75 -75
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +72 -72
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +90 -90
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +10 -10
- package/wirespec-src-compiler-emitters-scala.mjs +9 -9
- package/wirespec-src-compiler-emitters-typescript.mjs +79 -79
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +41 -31
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +53 -53
- package/wirespec-src-compiler-lib.mjs +30 -30
- package/wirespec-src-converter-avro.mjs +6 -6
- package/wirespec-src-converter-openapi.mjs +79 -79
- package/wirespec-src-tools-generator.mjs +11 -11
|
@@ -1264,7 +1264,7 @@ protoOf(RustIrEmitter).c1x = function (endpoint) {
|
|
|
1264
1264
|
var _iterator__ex2g4s = this_0.t();
|
|
1265
1265
|
while (_iterator__ex2g4s.u()) {
|
|
1266
1266
|
var e = _iterator__ex2g4s.v();
|
|
1267
|
-
var key = e.
|
|
1267
|
+
var key = e.fv_1;
|
|
1268
1268
|
if (set.x(key)) {
|
|
1269
1269
|
list.x(e);
|
|
1270
1270
|
}
|
|
@@ -1275,7 +1275,7 @@ protoOf(RustIrEmitter).c1x = function (endpoint) {
|
|
|
1275
1275
|
var _iterator__ex2g4s_0 = list.t();
|
|
1276
1276
|
while (_iterator__ex2g4s_0.u()) {
|
|
1277
1277
|
var item = _iterator__ex2g4s_0.v();
|
|
1278
|
-
var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase(this, item.
|
|
1278
|
+
var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase(this, item.fv_1), item.fv_1);
|
|
1279
1279
|
destination.x(tmp$ret$2);
|
|
1280
1280
|
}
|
|
1281
1281
|
var modelImports = destination;
|
|
@@ -1329,7 +1329,7 @@ protoOf(RustIrEmitter).z1w = function (endpoints, logger) {
|
|
|
1329
1329
|
var _iterator__ex2g4s_0 = destination.t();
|
|
1330
1330
|
while (_iterator__ex2g4s_0.u()) {
|
|
1331
1331
|
var e = _iterator__ex2g4s_0.v();
|
|
1332
|
-
var key = e.
|
|
1332
|
+
var key = e.fv_1;
|
|
1333
1333
|
if (set.x(key)) {
|
|
1334
1334
|
list_0.x(e);
|
|
1335
1335
|
}
|
|
@@ -1356,7 +1356,7 @@ protoOf(RustIrEmitter).z1w = function (endpoints, logger) {
|
|
|
1356
1356
|
var _iterator__ex2g4s_2 = endpoints.t();
|
|
1357
1357
|
while (_iterator__ex2g4s_2.u()) {
|
|
1358
1358
|
var element_1 = _iterator__ex2g4s_2.v();
|
|
1359
|
-
if (element_1.vp_1.l1() === element_0.
|
|
1359
|
+
if (element_1.vp_1.l1() === element_0.fv_1) {
|
|
1360
1360
|
tmp$ret$5 = false;
|
|
1361
1361
|
break $l$block_0;
|
|
1362
1362
|
}
|
|
@@ -1373,7 +1373,7 @@ protoOf(RustIrEmitter).z1w = function (endpoints, logger) {
|
|
|
1373
1373
|
var _iterator__ex2g4s_3 = destination_0.t();
|
|
1374
1374
|
while (_iterator__ex2g4s_3.u()) {
|
|
1375
1375
|
var item = _iterator__ex2g4s_3.v();
|
|
1376
|
-
var tmp$ret$10 = import_0('super::model::' + toSnakeCase(this, item.
|
|
1376
|
+
var tmp$ret$10 = import_0('super::model::' + toSnakeCase(this, item.fv_1), item.fv_1);
|
|
1377
1377
|
destination_1.x(tmp$ret$10);
|
|
1378
1378
|
}
|
|
1379
1379
|
var modelImports = destination_1;
|
|
@@ -1448,7 +1448,7 @@ function buildModelImports(_this__u8e3s4) {
|
|
|
1448
1448
|
var _iterator__ex2g4s = this_0.t();
|
|
1449
1449
|
while (_iterator__ex2g4s.u()) {
|
|
1450
1450
|
var e = _iterator__ex2g4s.v();
|
|
1451
|
-
var key = e.
|
|
1451
|
+
var key = e.fv_1;
|
|
1452
1452
|
if (set.x(key)) {
|
|
1453
1453
|
list.x(e);
|
|
1454
1454
|
}
|
|
@@ -1459,7 +1459,7 @@ function buildModelImports(_this__u8e3s4) {
|
|
|
1459
1459
|
var _iterator__ex2g4s_0 = list.t();
|
|
1460
1460
|
while (_iterator__ex2g4s_0.u()) {
|
|
1461
1461
|
var item = _iterator__ex2g4s_0.v();
|
|
1462
|
-
var tmp$ret$2 = import_0('super::' + toRustSnakeCase(item.
|
|
1462
|
+
var tmp$ret$2 = import_0('super::' + toRustSnakeCase(item.fv_1), Companion_getInstance().s1h(item.fv_1).t1h());
|
|
1463
1463
|
destination.x(tmp$ret$2);
|
|
1464
1464
|
}
|
|
1465
1465
|
return destination;
|
|
@@ -1745,7 +1745,7 @@ function buildEndpointImports(_this__u8e3s4) {
|
|
|
1745
1745
|
var _iterator__ex2g4s = this_0.t();
|
|
1746
1746
|
while (_iterator__ex2g4s.u()) {
|
|
1747
1747
|
var e = _iterator__ex2g4s.v();
|
|
1748
|
-
var key = e.
|
|
1748
|
+
var key = e.fv_1;
|
|
1749
1749
|
if (set.x(key)) {
|
|
1750
1750
|
list.x(e);
|
|
1751
1751
|
}
|
|
@@ -1756,7 +1756,7 @@ function buildEndpointImports(_this__u8e3s4) {
|
|
|
1756
1756
|
var _iterator__ex2g4s_0 = list.t();
|
|
1757
1757
|
while (_iterator__ex2g4s_0.u()) {
|
|
1758
1758
|
var item = _iterator__ex2g4s_0.v();
|
|
1759
|
-
var tmp$ret$2 = import_0('super::super::model::' + toRustSnakeCase(item.
|
|
1759
|
+
var tmp$ret$2 = import_0('super::super::model::' + toRustSnakeCase(item.fv_1), Companion_getInstance().s1h(item.fv_1).t1h());
|
|
1760
1760
|
destination.x(tmp$ret$2);
|
|
1761
1761
|
}
|
|
1762
1762
|
return destination;
|
|
@@ -1773,7 +1773,7 @@ function buildValidateFunction(refined) {
|
|
|
1773
1773
|
function buildToStringFunction(refined) {
|
|
1774
1774
|
_init_properties_RustIrTransformer_kt__rrvmwq();
|
|
1775
1775
|
var tmp;
|
|
1776
|
-
if (refined.ur_1.
|
|
1776
|
+
if (refined.ur_1.rt_1 instanceof String_0) {
|
|
1777
1777
|
tmp = 'self.value.clone()';
|
|
1778
1778
|
} else {
|
|
1779
1779
|
tmp = 'format!("{}", self.value)';
|
|
@@ -776,7 +776,7 @@ protoOf(ScalaIrEmitter).z1w = function (endpoints, logger) {
|
|
|
776
776
|
var _iterator__ex2g4s_0 = destination.t();
|
|
777
777
|
while (_iterator__ex2g4s_0.u()) {
|
|
778
778
|
var e = _iterator__ex2g4s_0.v();
|
|
779
|
-
var key = e.
|
|
779
|
+
var key = e.fv_1;
|
|
780
780
|
if (set.x(key)) {
|
|
781
781
|
list_0.x(e);
|
|
782
782
|
}
|
|
@@ -787,7 +787,7 @@ protoOf(ScalaIrEmitter).z1w = function (endpoints, logger) {
|
|
|
787
787
|
var _iterator__ex2g4s_1 = list_0.t();
|
|
788
788
|
while (_iterator__ex2g4s_1.u()) {
|
|
789
789
|
var item = _iterator__ex2g4s_1.v();
|
|
790
|
-
var tmp$ret$5 = import_0(this.v1x().es_1 + '.model', item.
|
|
790
|
+
var tmp$ret$5 = import_0(this.v1x().es_1 + '.model', item.fv_1);
|
|
791
791
|
destination_0.x(tmp$ret$5);
|
|
792
792
|
}
|
|
793
793
|
var imports = destination_0;
|
|
@@ -899,7 +899,7 @@ function buildModelImports(_this__u8e3s4, packageName) {
|
|
|
899
899
|
var _iterator__ex2g4s = this_0.t();
|
|
900
900
|
while (_iterator__ex2g4s.u()) {
|
|
901
901
|
var e = _iterator__ex2g4s.v();
|
|
902
|
-
var key = e.
|
|
902
|
+
var key = e.fv_1;
|
|
903
903
|
if (set.x(key)) {
|
|
904
904
|
list.x(e);
|
|
905
905
|
}
|
|
@@ -910,7 +910,7 @@ function buildModelImports(_this__u8e3s4, packageName) {
|
|
|
910
910
|
var _iterator__ex2g4s_0 = list.t();
|
|
911
911
|
while (_iterator__ex2g4s_0.u()) {
|
|
912
912
|
var item = _iterator__ex2g4s_0.v();
|
|
913
|
-
var tmp$ret$2 = import_0(packageName.es_1 + '.model', Companion_getInstance().s1h(item.
|
|
913
|
+
var tmp$ret$2 = import_0(packageName.es_1 + '.model', Companion_getInstance().s1h(item.fv_1).t1h());
|
|
914
914
|
destination.x(tmp$ret$2);
|
|
915
915
|
}
|
|
916
916
|
return destination;
|
|
@@ -934,16 +934,16 @@ function addIdentityTypeToCall(_this__u8e3s4) {
|
|
|
934
934
|
function toScalaTypeName(_this__u8e3s4) {
|
|
935
935
|
var tmp;
|
|
936
936
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
937
|
-
var t = _this__u8e3s4.
|
|
937
|
+
var t = _this__u8e3s4.rt_1;
|
|
938
938
|
var tmp_0;
|
|
939
939
|
if (t instanceof String_0) {
|
|
940
940
|
tmp_0 = 'String';
|
|
941
941
|
} else {
|
|
942
942
|
if (t instanceof Integer) {
|
|
943
|
-
tmp_0 = t.
|
|
943
|
+
tmp_0 = t.nu_1.equals(Precision_P32_getInstance()) ? 'Int' : 'Long';
|
|
944
944
|
} else {
|
|
945
945
|
if (t instanceof Number_0) {
|
|
946
|
-
tmp_0 = t.
|
|
946
|
+
tmp_0 = t.qu_1.equals(Precision_P32_getInstance()) ? 'Float' : 'Double';
|
|
947
947
|
} else {
|
|
948
948
|
if (equals(t, Boolean_instance)) {
|
|
949
949
|
tmp_0 = 'Boolean';
|
|
@@ -960,7 +960,7 @@ function toScalaTypeName(_this__u8e3s4) {
|
|
|
960
960
|
tmp = tmp_0;
|
|
961
961
|
} else {
|
|
962
962
|
if (_this__u8e3s4 instanceof Custom) {
|
|
963
|
-
tmp = _this__u8e3s4.
|
|
963
|
+
tmp = _this__u8e3s4.fv_1;
|
|
964
964
|
} else {
|
|
965
965
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
966
966
|
tmp = 'List[' + toScalaTypeName(_this__u8e3s4.po_1) + ']';
|
|
@@ -982,7 +982,7 @@ function toScalaTypeName(_this__u8e3s4) {
|
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
984
|
var base = tmp;
|
|
985
|
-
return _this__u8e3s4.
|
|
985
|
+
return _this__u8e3s4.xu() ? 'Option[' + base + ']' : base;
|
|
986
986
|
}
|
|
987
987
|
function convertToStringCallsToFieldAccess$lambda(expr, tr) {
|
|
988
988
|
var tmp;
|
|
@@ -213,7 +213,7 @@ function emit_3(type, module_0) {
|
|
|
213
213
|
var _iterator__ex2g4s = this_0.t();
|
|
214
214
|
while (_iterator__ex2g4s.u()) {
|
|
215
215
|
var e = _iterator__ex2g4s.v();
|
|
216
|
-
var key = e.
|
|
216
|
+
var key = e.fv_1;
|
|
217
217
|
if (set.x(key)) {
|
|
218
218
|
list.x(e);
|
|
219
219
|
}
|
|
@@ -224,7 +224,7 @@ function emit_3(type, module_0) {
|
|
|
224
224
|
var _iterator__ex2g4s_0 = list.t();
|
|
225
225
|
while (_iterator__ex2g4s_0.u()) {
|
|
226
226
|
var item = _iterator__ex2g4s_0.v();
|
|
227
|
-
var tmp$ret$2 = 'import {' + item.
|
|
227
|
+
var tmp$ret$2 = 'import {' + item.fv_1 + "} from './" + item.fv_1 + "'";
|
|
228
228
|
destination.x(tmp$ret$2);
|
|
229
229
|
}
|
|
230
230
|
var tmp = destination;
|
|
@@ -245,7 +245,7 @@ function emit_4(_this__u8e3s4) {
|
|
|
245
245
|
tmp = 'any';
|
|
246
246
|
} else {
|
|
247
247
|
if (_this__u8e3s4 instanceof Custom) {
|
|
248
|
-
tmp = this.h1y(_this__u8e3s4.
|
|
248
|
+
tmp = this.h1y(_this__u8e3s4.fv_1);
|
|
249
249
|
} else {
|
|
250
250
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
251
251
|
tmp = this.s21(_this__u8e3s4);
|
|
@@ -258,10 +258,10 @@ function emit_4(_this__u8e3s4) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
// Inline function 'kotlin.let' call
|
|
261
|
-
return tmp + (_this__u8e3s4.
|
|
261
|
+
return tmp + (_this__u8e3s4.xu() ? ' | undefined' : '');
|
|
262
262
|
}
|
|
263
263
|
function emitPrimitive(_this__u8e3s4) {
|
|
264
|
-
var tmp0_subject = _this__u8e3s4.
|
|
264
|
+
var tmp0_subject = _this__u8e3s4.rt_1;
|
|
265
265
|
var tmp;
|
|
266
266
|
if (tmp0_subject instanceof String_0) {
|
|
267
267
|
tmp = 'string';
|
|
@@ -292,7 +292,7 @@ function emit_5(_this__u8e3s4) {
|
|
|
292
292
|
tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.qt_1) + '.test(value);';
|
|
293
293
|
} else {
|
|
294
294
|
if (_this__u8e3s4 instanceof Bound) {
|
|
295
|
-
var tmp1_safe_receiver = _this__u8e3s4.
|
|
295
|
+
var tmp1_safe_receiver = _this__u8e3s4.ju_1;
|
|
296
296
|
var tmp_0;
|
|
297
297
|
if (tmp1_safe_receiver == null) {
|
|
298
298
|
tmp_0 = null;
|
|
@@ -301,7 +301,7 @@ function emit_5(_this__u8e3s4) {
|
|
|
301
301
|
tmp_0 = tmp1_safe_receiver + ' < value';
|
|
302
302
|
}
|
|
303
303
|
var minCheck = tmp_0;
|
|
304
|
-
var tmp2_safe_receiver = _this__u8e3s4.
|
|
304
|
+
var tmp2_safe_receiver = _this__u8e3s4.ku_1;
|
|
305
305
|
var tmp_1;
|
|
306
306
|
if (tmp2_safe_receiver == null) {
|
|
307
307
|
tmp_1 = null;
|
|
@@ -368,7 +368,7 @@ function emitClient(ast) {
|
|
|
368
368
|
var _iterator__ex2g4s_1 = destination_0.t();
|
|
369
369
|
while (_iterator__ex2g4s_1.u()) {
|
|
370
370
|
var e = _iterator__ex2g4s_1.v();
|
|
371
|
-
var key = e.
|
|
371
|
+
var key = e.fv_1;
|
|
372
372
|
if (set.x(key)) {
|
|
373
373
|
list_1.x(e);
|
|
374
374
|
}
|
|
@@ -379,56 +379,12 @@ function emitClient(ast) {
|
|
|
379
379
|
return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_3 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' + spacer(joinToString(tmp_4, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_1(this)), 1) + '\n |})\n |\n '));
|
|
380
380
|
}
|
|
381
381
|
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
382
|
-
function emit_8(
|
|
383
|
-
return trimMargin('\n |export type ' + this.r21(refined.tr_1) + ' = ' + this.oq(refined.ur_1) + ';\n |export const validate' + refined.tr_1.l1() + ' = (value: ' + this.oq(refined.ur_1) + '): value is ' + this.r21(refined.tr_1) + ' => {\n |' + this.cs(refined) + '\n |}\n |\n ');
|
|
384
|
-
}
|
|
385
|
-
function emitValidator(_this__u8e3s4) {
|
|
386
|
-
var defaultReturn = Spacer_instance.toString() + 'return true;';
|
|
387
|
-
var type = _this__u8e3s4.ur_1.gv_1;
|
|
388
|
-
var tmp;
|
|
389
|
-
if (type instanceof Integer) {
|
|
390
|
-
var tmp0_safe_receiver = type.lu_1;
|
|
391
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.pq(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.ou_1;
|
|
396
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.pq(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.iu_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.pq(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(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
426
|
-
function emit_9(enum_0, module_0) {
|
|
382
|
+
function emit_8(enum_0, module_0) {
|
|
427
383
|
var tmp = this.r21(enum_0.yr_1);
|
|
428
384
|
return 'export type ' + tmp + ' = ' + joinToString(enum_0.zr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
429
385
|
}
|
|
430
386
|
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
431
|
-
function
|
|
387
|
+
function emit_9(endpoint) {
|
|
432
388
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
433
389
|
var this_0 = importReferences(endpoint);
|
|
434
390
|
var set = HashSet_init_$Create$();
|
|
@@ -436,7 +392,7 @@ function emit_10(endpoint) {
|
|
|
436
392
|
var _iterator__ex2g4s = this_0.t();
|
|
437
393
|
while (_iterator__ex2g4s.u()) {
|
|
438
394
|
var e = _iterator__ex2g4s.v();
|
|
439
|
-
var key = e.
|
|
395
|
+
var key = e.fv_1;
|
|
440
396
|
if (set.x(key)) {
|
|
441
397
|
list.x(e);
|
|
442
398
|
}
|
|
@@ -447,7 +403,7 @@ function emit_10(endpoint) {
|
|
|
447
403
|
var _iterator__ex2g4s_0 = list.t();
|
|
448
404
|
while (_iterator__ex2g4s_0.u()) {
|
|
449
405
|
var item = _iterator__ex2g4s_0.v();
|
|
450
|
-
var tmp$ret$2 = 'import {type ' + item.
|
|
406
|
+
var tmp$ret$2 = 'import {type ' + item.fv_1 + "} from '../model'";
|
|
451
407
|
destination.x(tmp$ret$2);
|
|
452
408
|
}
|
|
453
409
|
var tmp = destination;
|
|
@@ -480,7 +436,51 @@ function emit_10(endpoint) {
|
|
|
480
436
|
return trimMargin('\n |' + tmp_0 + '\n |export namespace ' + tmp_1 + ' {\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_5 + '\n |' + tmp_6 + '\n |' + tmp_8 + '\n |' + tmp_9 + 'export type Response = ' + tmp_11 + '\n |' + tmp_12 + '\n |' + tmp_14 + '\n |' + tmp_15 + 'export type Handler = {\n |' + tmp_16 + tmp_17 + '\n |' + tmp_18 + '}\n |' + tmp_19 + '\n |' + tmp_20 + '\n |' + tmp_21 + 'export const api = {\n |' + tmp_22 + 'name: "' + tmp_23 + '",\n |' + tmp_24 + 'method: "' + endpoint.wp_1.a3_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.xp_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.is(2) + 'server,\n |' + Spacer_instance.is(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
|
|
481
437
|
}
|
|
482
438
|
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
483
|
-
|
|
439
|
+
function emit_10(refined) {
|
|
440
|
+
return trimMargin('\n |export type ' + this.r21(refined.tr_1) + ' = ' + this.oq(refined.ur_1) + ';\n |export const validate' + refined.tr_1.l1() + ' = (value: ' + this.oq(refined.ur_1) + '): value is ' + this.r21(refined.tr_1) + ' => {\n |' + this.cs(refined) + '\n |}\n |\n ');
|
|
441
|
+
}
|
|
442
|
+
function emitValidator(_this__u8e3s4) {
|
|
443
|
+
var defaultReturn = Spacer_instance.toString() + 'return true;';
|
|
444
|
+
var type = _this__u8e3s4.ur_1.rt_1;
|
|
445
|
+
var tmp;
|
|
446
|
+
if (type instanceof Integer) {
|
|
447
|
+
var tmp0_safe_receiver = type.ou_1;
|
|
448
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.pq(tmp0_safe_receiver);
|
|
449
|
+
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
450
|
+
} else {
|
|
451
|
+
if (type instanceof Number_0) {
|
|
452
|
+
var tmp2_safe_receiver = type.ru_1;
|
|
453
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.pq(tmp2_safe_receiver);
|
|
454
|
+
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
455
|
+
} else {
|
|
456
|
+
if (type instanceof String_0) {
|
|
457
|
+
var tmp4_safe_receiver = type.lu_1;
|
|
458
|
+
var tmp_0;
|
|
459
|
+
var tmp_1 = tmp4_safe_receiver;
|
|
460
|
+
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
461
|
+
tmp_0 = null;
|
|
462
|
+
} else {
|
|
463
|
+
tmp_0 = this.pq(new RegExp_0(tmp4_safe_receiver));
|
|
464
|
+
}
|
|
465
|
+
var tmp5_elvis_lhs = tmp_0;
|
|
466
|
+
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
467
|
+
} else {
|
|
468
|
+
if (equals(type, Boolean_instance)) {
|
|
469
|
+
tmp = defaultReturn;
|
|
470
|
+
} else {
|
|
471
|
+
if (equals(type, Bytes_instance)) {
|
|
472
|
+
tmp = defaultReturn;
|
|
473
|
+
} else {
|
|
474
|
+
noWhenBranchMatchedException();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return tmp;
|
|
481
|
+
}
|
|
482
|
+
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
483
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptIdentifierEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptClientEmitter]);
|
|
484
484
|
initMetadataForClass(EndpointParam, 'EndpointParam');
|
|
485
485
|
initMetadataForCompanion(Companion);
|
|
486
486
|
initMetadataForClass(TypeScriptIrEmitter, 'TypeScriptIrEmitter', TypeScriptIrEmitter, VOID, [IrEmitter]);
|
|
@@ -546,7 +546,7 @@ function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
|
|
|
546
546
|
return 'import {' + endpoint.vp_1.l1() + '} from "./endpoint/' + endpoint.vp_1.l1() + '"';
|
|
547
547
|
}
|
|
548
548
|
function TypeScriptClientEmitter$emitClient$lambda_0(it) {
|
|
549
|
-
return 'import {type ' + it.
|
|
549
|
+
return 'import {type ' + it.fv_1 + '} from "./model/' + it.fv_1 + '"';
|
|
550
550
|
}
|
|
551
551
|
function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
552
552
|
return function (_destruct__k2r9zo) {
|
|
@@ -669,7 +669,7 @@ protoOf(TypeScriptEmitter).qr = function (union) {
|
|
|
669
669
|
var _iterator__ex2g4s = this_0.t();
|
|
670
670
|
while (_iterator__ex2g4s.u()) {
|
|
671
671
|
var e = _iterator__ex2g4s.v();
|
|
672
|
-
var key = e.
|
|
672
|
+
var key = e.fv_1;
|
|
673
673
|
if (set.x(key)) {
|
|
674
674
|
list.x(e);
|
|
675
675
|
}
|
|
@@ -680,7 +680,7 @@ protoOf(TypeScriptEmitter).qr = function (union) {
|
|
|
680
680
|
var _iterator__ex2g4s_0 = list.t();
|
|
681
681
|
while (_iterator__ex2g4s_0.u()) {
|
|
682
682
|
var item = _iterator__ex2g4s_0.v();
|
|
683
|
-
var tmp$ret$2 = 'import {type ' + item.
|
|
683
|
+
var tmp$ret$2 = 'import {type ' + item.fv_1 + "} from '../model'";
|
|
684
684
|
destination.x(tmp$ret$2);
|
|
685
685
|
}
|
|
686
686
|
var tmp = destination;
|
|
@@ -893,7 +893,7 @@ function emit_12($this, _this__u8e3s4) {
|
|
|
893
893
|
return Spacer_instance.toString() + $this.or(_this__u8e3s4.cq_1) + ': ' + $this.oq(_this__u8e3s4.dq_1);
|
|
894
894
|
}
|
|
895
895
|
function emit_13($this, _this__u8e3s4) {
|
|
896
|
-
return $this.or(_this__u8e3s4.ar_1) + (_this__u8e3s4.br_1.
|
|
896
|
+
return $this.or(_this__u8e3s4.ar_1) + (_this__u8e3s4.br_1.xu() ? '?' : '') + ': ' + $this.oq(_this__u8e3s4.br_1.zu(false));
|
|
897
897
|
}
|
|
898
898
|
function emitDeserialize($this, _this__u8e3s4) {
|
|
899
899
|
return $this.or(_this__u8e3s4.ue_1.cq_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.te_1 + '])';
|
|
@@ -1161,26 +1161,26 @@ function buildEndpointParams($this, endpoint) {
|
|
|
1161
1161
|
var _iterator__ex2g4s_0 = destination.t();
|
|
1162
1162
|
while (_iterator__ex2g4s_0.u()) {
|
|
1163
1163
|
var element_0 = _iterator__ex2g4s_0.v();
|
|
1164
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.cq_1), emitTypeScriptReference($this, element_0.dq_1.
|
|
1164
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.cq_1), emitTypeScriptReference($this, element_0.dq_1.zu(false)), element_0.dq_1.xu()));
|
|
1165
1165
|
}
|
|
1166
1166
|
// Inline function 'kotlin.collections.forEach' call
|
|
1167
1167
|
var _iterator__ex2g4s_1 = endpoint.yp_1.t();
|
|
1168
1168
|
while (_iterator__ex2g4s_1.u()) {
|
|
1169
1169
|
var element_1 = _iterator__ex2g4s_1.v();
|
|
1170
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.rp_1), emitTypeScriptReference($this, element_1.sp_1.
|
|
1170
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.rp_1), emitTypeScriptReference($this, element_1.sp_1.zu(false)), element_1.sp_1.xu()));
|
|
1171
1171
|
}
|
|
1172
1172
|
// Inline function 'kotlin.collections.forEach' call
|
|
1173
1173
|
var _iterator__ex2g4s_2 = endpoint.zp_1.t();
|
|
1174
1174
|
while (_iterator__ex2g4s_2.u()) {
|
|
1175
1175
|
var element_2 = _iterator__ex2g4s_2.v();
|
|
1176
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.rp_1), emitTypeScriptReference($this, element_2.sp_1.
|
|
1176
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.rp_1), emitTypeScriptReference($this, element_2.sp_1.zu(false)), element_2.sp_1.xu()));
|
|
1177
1177
|
}
|
|
1178
1178
|
var tmp0_safe_receiver = first(endpoint.aq_1).eq_1;
|
|
1179
1179
|
if (tmp0_safe_receiver == null)
|
|
1180
1180
|
null;
|
|
1181
1181
|
else {
|
|
1182
1182
|
// Inline function 'kotlin.let' call
|
|
1183
|
-
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.gq_1.
|
|
1183
|
+
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.gq_1.zu(false)), tmp0_safe_receiver.gq_1.xu()));
|
|
1184
1184
|
}
|
|
1185
1185
|
return this_0.o5();
|
|
1186
1186
|
}
|
|
@@ -1199,10 +1199,10 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1199
1199
|
tmp = 'any';
|
|
1200
1200
|
} else {
|
|
1201
1201
|
if (ref instanceof Custom) {
|
|
1202
|
-
tmp = sanitizeSymbol_1($this, ref.
|
|
1202
|
+
tmp = sanitizeSymbol_1($this, ref.fv_1);
|
|
1203
1203
|
} else {
|
|
1204
1204
|
if (ref instanceof Primitive) {
|
|
1205
|
-
var tmp1_subject = ref.
|
|
1205
|
+
var tmp1_subject = ref.rt_1;
|
|
1206
1206
|
var tmp_0;
|
|
1207
1207
|
if (tmp1_subject instanceof String_0) {
|
|
1208
1208
|
tmp_0 = 'string';
|
|
@@ -1235,7 +1235,7 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
// Inline function 'kotlin.let' call
|
|
1238
|
-
return tmp + (ref.
|
|
1238
|
+
return tmp + (ref.xu() ? ' | undefined' : '');
|
|
1239
1239
|
}
|
|
1240
1240
|
function EndpointParam(name, type, nullable) {
|
|
1241
1241
|
this.e22_1 = name;
|
|
@@ -1835,7 +1835,7 @@ protoOf(TypeScriptIrEmitter).lq = function (type, module_0) {
|
|
|
1835
1835
|
var _iterator__ex2g4s = this_0.t();
|
|
1836
1836
|
while (_iterator__ex2g4s.u()) {
|
|
1837
1837
|
var e = _iterator__ex2g4s.v();
|
|
1838
|
-
var key = e.
|
|
1838
|
+
var key = e.fv_1;
|
|
1839
1839
|
if (set.x(key)) {
|
|
1840
1840
|
list.x(e);
|
|
1841
1841
|
}
|
|
@@ -1846,7 +1846,7 @@ protoOf(TypeScriptIrEmitter).lq = function (type, module_0) {
|
|
|
1846
1846
|
var _iterator__ex2g4s_0 = list.t();
|
|
1847
1847
|
while (_iterator__ex2g4s_0.u()) {
|
|
1848
1848
|
var item = _iterator__ex2g4s_0.v();
|
|
1849
|
-
var tmp$ret$2 = import_0('./' + item.
|
|
1849
|
+
var tmp$ret$2 = import_0('./' + item.fv_1, item.fv_1);
|
|
1850
1850
|
destination.x(tmp$ret$2);
|
|
1851
1851
|
}
|
|
1852
1852
|
var typeImports = destination;
|
|
@@ -1913,7 +1913,7 @@ protoOf(TypeScriptIrEmitter).qr = function (union) {
|
|
|
1913
1913
|
var _iterator__ex2g4s = this_0.t();
|
|
1914
1914
|
while (_iterator__ex2g4s.u()) {
|
|
1915
1915
|
var e = _iterator__ex2g4s.v();
|
|
1916
|
-
var key = e.
|
|
1916
|
+
var key = e.fv_1;
|
|
1917
1917
|
if (set.x(key)) {
|
|
1918
1918
|
list.x(e);
|
|
1919
1919
|
}
|
|
@@ -1924,7 +1924,7 @@ protoOf(TypeScriptIrEmitter).qr = function (union) {
|
|
|
1924
1924
|
var _iterator__ex2g4s_0 = list.t();
|
|
1925
1925
|
while (_iterator__ex2g4s_0.u()) {
|
|
1926
1926
|
var item = _iterator__ex2g4s_0.v();
|
|
1927
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1927
|
+
var tmp$ret$2 = import_0('../model', item.fv_1, true);
|
|
1928
1928
|
destination.x(tmp$ret$2);
|
|
1929
1929
|
}
|
|
1930
1930
|
var imports = destination;
|
|
@@ -1952,7 +1952,7 @@ protoOf(TypeScriptIrEmitter).bs = function (endpoint) {
|
|
|
1952
1952
|
var _iterator__ex2g4s = this_0.t();
|
|
1953
1953
|
while (_iterator__ex2g4s.u()) {
|
|
1954
1954
|
var e = _iterator__ex2g4s.v();
|
|
1955
|
-
var key = e.
|
|
1955
|
+
var key = e.fv_1;
|
|
1956
1956
|
if (set.x(key)) {
|
|
1957
1957
|
list.x(e);
|
|
1958
1958
|
}
|
|
@@ -1963,7 +1963,7 @@ protoOf(TypeScriptIrEmitter).bs = function (endpoint) {
|
|
|
1963
1963
|
var _iterator__ex2g4s_0 = list.t();
|
|
1964
1964
|
while (_iterator__ex2g4s_0.u()) {
|
|
1965
1965
|
var item = _iterator__ex2g4s_0.v();
|
|
1966
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1966
|
+
var tmp$ret$2 = import_0('../model', item.fv_1, true);
|
|
1967
1967
|
destination.x(tmp$ret$2);
|
|
1968
1968
|
}
|
|
1969
1969
|
var imports = destination;
|
|
@@ -1999,7 +1999,7 @@ protoOf(TypeScriptIrEmitter).c1x = function (endpoint) {
|
|
|
1999
1999
|
var _iterator__ex2g4s = this_0.t();
|
|
2000
2000
|
while (_iterator__ex2g4s.u()) {
|
|
2001
2001
|
var e = _iterator__ex2g4s.v();
|
|
2002
|
-
var key = e.
|
|
2002
|
+
var key = e.fv_1;
|
|
2003
2003
|
if (set.x(key)) {
|
|
2004
2004
|
list.x(e);
|
|
2005
2005
|
}
|
|
@@ -2010,7 +2010,7 @@ protoOf(TypeScriptIrEmitter).c1x = function (endpoint) {
|
|
|
2010
2010
|
var _iterator__ex2g4s_0 = list.t();
|
|
2011
2011
|
while (_iterator__ex2g4s_0.u()) {
|
|
2012
2012
|
var item = _iterator__ex2g4s_0.v();
|
|
2013
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
2013
|
+
var tmp$ret$2 = import_0('../model', item.fv_1, true);
|
|
2014
2014
|
destination.x(tmp$ret$2);
|
|
2015
2015
|
}
|
|
2016
2016
|
var imports = destination;
|
|
@@ -2462,9 +2462,9 @@ protoOf(TypeScriptEmitter).mq = emit_6;
|
|
|
2462
2462
|
protoOf(TypeScriptEmitter).nq = emit_7;
|
|
2463
2463
|
protoOf(TypeScriptEmitter).oq = emit_4;
|
|
2464
2464
|
protoOf(TypeScriptEmitter).pq = emit_5;
|
|
2465
|
-
protoOf(TypeScriptEmitter).as =
|
|
2466
|
-
protoOf(TypeScriptEmitter).vr =
|
|
2467
|
-
protoOf(TypeScriptEmitter).bs =
|
|
2465
|
+
protoOf(TypeScriptEmitter).as = emit_8;
|
|
2466
|
+
protoOf(TypeScriptEmitter).vr = emit_10;
|
|
2467
|
+
protoOf(TypeScriptEmitter).bs = emit_9;
|
|
2468
2468
|
protoOf(TypeScriptEmitter).or = emit_2;
|
|
2469
2469
|
protoOf(TypeScriptEmitter).cs = emitValidator;
|
|
2470
2470
|
protoOf(TypeScriptEmitter).r21 = sanitizeSymbol;
|