@flock/wirespec 0.18.4 → 0.18.6
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 +406 -406
- package/kotlin-kotlin-stdlib.mjs +5 -5
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +4585 -4585
- package/kotlin-rgxgen.mjs +1757 -1757
- package/kotlinx-io-kotlinx-io-core.mjs +397 -397
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1616 -1616
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1271 -1271
- package/mordant-mordant.mjs +1097 -1097
- package/package.json +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +189 -188
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +166 -166
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +218 -217
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +303 -292
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-scala.mjs +111 -110
- package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +149 -146
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +25 -25
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +2974 -2934
- package/wirespec-src-compiler-ir.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +475 -475
- package/wirespec-src-converter-openapi.mjs +365 -365
- package/wirespec-src-plugin-arguments.mjs +115 -115
- package/wirespec-src-plugin-cli.mjs +84 -84
- package/wirespec-src-plugin-npm.mjs +20 -20
- package/wirespec-src-tools-generator.mjs +2 -2
|
@@ -153,6 +153,7 @@ import {
|
|
|
153
153
|
Case2i7oahw4alz6h as Case,
|
|
154
154
|
FieldCall1iz7z2fx2xo4p as FieldCall,
|
|
155
155
|
FunctionCall30872kpnbr7op as FunctionCall,
|
|
156
|
+
Custom_init_$Create$2enn7oyj71j1t as Custom_init_$Create$,
|
|
156
157
|
Parameteruqoxd4rzw7ga as Parameter,
|
|
157
158
|
Function21cuq8qizkin7 as Function,
|
|
158
159
|
Interface3pn84xq686t2r as Interface,
|
|
@@ -168,7 +169,7 @@ function emit_2(identifier) {
|
|
|
168
169
|
}
|
|
169
170
|
initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
|
|
170
171
|
function sanitizeSymbol(_this__u8e3s4) {
|
|
171
|
-
return this.
|
|
172
|
+
return this.p1v(_this__u8e3s4.l1());
|
|
172
173
|
}
|
|
173
174
|
function sanitizeSymbol_0(_this__u8e3s4) {
|
|
174
175
|
var tmp = asSequence(_this__u8e3s4);
|
|
@@ -197,7 +198,7 @@ function emit_3(type, module_0) {
|
|
|
197
198
|
destination.x(tmp$ret$2);
|
|
198
199
|
}
|
|
199
200
|
var tmp = destination;
|
|
200
|
-
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.
|
|
201
|
+
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.x1y(type.vo_1) + ' = {\n |' + this.vp(type.wo_1) + '\n |}\n |\n ');
|
|
201
202
|
}
|
|
202
203
|
function emit_4(_this__u8e3s4) {
|
|
203
204
|
var tmp;
|
|
@@ -214,10 +215,10 @@ function emit_4(_this__u8e3s4) {
|
|
|
214
215
|
tmp = 'any';
|
|
215
216
|
} else {
|
|
216
217
|
if (_this__u8e3s4 instanceof Custom) {
|
|
217
|
-
tmp = this.
|
|
218
|
+
tmp = this.p1v(_this__u8e3s4.ku_1);
|
|
218
219
|
} else {
|
|
219
220
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
220
|
-
tmp = this.
|
|
221
|
+
tmp = this.y1y(_this__u8e3s4);
|
|
221
222
|
} else {
|
|
222
223
|
noWhenBranchMatchedException();
|
|
223
224
|
}
|
|
@@ -372,7 +373,7 @@ function emit_8(endpoint) {
|
|
|
372
373
|
}
|
|
373
374
|
var tmp = destination;
|
|
374
375
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
375
|
-
var tmp_1 = this.
|
|
376
|
+
var tmp_1 = this.x1y(endpoint.ep_1);
|
|
376
377
|
var tmp_2 = get_pathParams(endpoint);
|
|
377
378
|
var tmp_3 = emitType(this, tmp_2, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
378
379
|
var tmp_4 = emitType(this, endpoint.hp_1, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
@@ -394,19 +395,14 @@ function emit_8(endpoint) {
|
|
|
394
395
|
var tmp_20 = prependIndent(emitServer(this, endpoint), Spacer_instance.qr(1));
|
|
395
396
|
var tmp_21 = Spacer_instance.toString();
|
|
396
397
|
var tmp_22 = Spacer_instance.qr(2);
|
|
397
|
-
var tmp_23 = Companion_instance_0.pq(this.
|
|
398
|
+
var tmp_23 = Companion_instance_0.pq(this.x1y(endpoint.ep_1));
|
|
398
399
|
var tmp_24 = Spacer_instance.qr(2);
|
|
399
400
|
var tmp_25 = Spacer_instance.qr(2);
|
|
400
401
|
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.fp_1.a3_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.qr(2) + 'server,\n |' + Spacer_instance.qr(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
|
|
401
402
|
}
|
|
402
403
|
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
403
|
-
function emit_9(
|
|
404
|
-
|
|
405
|
-
return 'export type ' + tmp + ' = ' + joinToString(enum_0.hr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
406
|
-
}
|
|
407
|
-
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
408
|
-
function emit_10(refined) {
|
|
409
|
-
return trimMargin('\n |export type ' + this.w1y(refined.br_1) + ' = ' + this.xp(refined.cr_1) + ';\n |export const validate' + refined.br_1.l1() + ' = (value: ' + this.xp(refined.cr_1) + '): value is ' + this.w1y(refined.br_1) + ' => {\n |' + this.kr(refined) + '\n |}\n |\n ');
|
|
404
|
+
function emit_9(refined) {
|
|
405
|
+
return trimMargin('\n |export type ' + this.x1y(refined.br_1) + ' = ' + this.xp(refined.cr_1) + ';\n |export const validate' + refined.br_1.l1() + ' = (value: ' + this.xp(refined.cr_1) + '): value is ' + this.x1y(refined.br_1) + ' => {\n |' + this.kr(refined) + '\n |}\n |\n ');
|
|
410
406
|
}
|
|
411
407
|
function emitValidator(_this__u8e3s4) {
|
|
412
408
|
var defaultReturn = Spacer_instance.toString() + 'return true;';
|
|
@@ -449,7 +445,12 @@ function emitValidator(_this__u8e3s4) {
|
|
|
449
445
|
return tmp;
|
|
450
446
|
}
|
|
451
447
|
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
452
|
-
|
|
448
|
+
function emit_10(enum_0, module_0) {
|
|
449
|
+
var tmp = this.x1y(enum_0.gr_1);
|
|
450
|
+
return 'export type ' + tmp + ' = ' + joinToString(enum_0.hr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
451
|
+
}
|
|
452
|
+
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
453
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptIdentifierEmitter, TypeScriptClientEmitter]);
|
|
453
454
|
initMetadataForClass(EndpointParam, 'EndpointParam');
|
|
454
455
|
initMetadataForCompanion(Companion);
|
|
455
456
|
initMetadataForClass(TypeScriptIrEmitter, 'TypeScriptIrEmitter', TypeScriptIrEmitter, VOID, [IrEmitter]);
|
|
@@ -545,25 +546,25 @@ function TypeScriptEmitter$emit$lambda_1(this$0) {
|
|
|
545
546
|
}
|
|
546
547
|
function TypeScriptEmitter() {
|
|
547
548
|
LanguageEmitter.call(this);
|
|
548
|
-
this.
|
|
549
|
-
this.
|
|
550
|
-
this.
|
|
549
|
+
this.z1y_1 = FileExtension_TypeScript_getInstance();
|
|
550
|
+
this.a1z_1 = TypeScriptShared_getInstance();
|
|
551
|
+
this.b1z_1 = '//';
|
|
551
552
|
}
|
|
552
553
|
protoOf(TypeScriptEmitter).eq = function () {
|
|
553
|
-
return this.y1y_1;
|
|
554
|
-
};
|
|
555
|
-
protoOf(TypeScriptEmitter).l1v = function () {
|
|
556
554
|
return this.z1y_1;
|
|
557
555
|
};
|
|
558
|
-
protoOf(TypeScriptEmitter).
|
|
556
|
+
protoOf(TypeScriptEmitter).m1v = function () {
|
|
559
557
|
return this.a1z_1;
|
|
560
558
|
};
|
|
559
|
+
protoOf(TypeScriptEmitter).fq = function () {
|
|
560
|
+
return this.b1z_1;
|
|
561
|
+
};
|
|
561
562
|
protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
562
563
|
// Inline function 'kotlin.run' call
|
|
563
564
|
var $this$run = protoOf(LanguageEmitter).on.call(this, ast, logger);
|
|
564
565
|
var tmp;
|
|
565
566
|
if (hasEndpoints(ast)) {
|
|
566
|
-
tmp = NonEmptyList__plus_impl_xqmb9($this$run, this.
|
|
567
|
+
tmp = NonEmptyList__plus_impl_xqmb9($this$run, this.w1y(ast));
|
|
567
568
|
} else {
|
|
568
569
|
tmp = $this$run;
|
|
569
570
|
}
|
|
@@ -622,13 +623,13 @@ protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
|
622
623
|
protoOf(TypeScriptEmitter).tq = function (module_0, logger) {
|
|
623
624
|
// Inline function 'kotlin.let' call
|
|
624
625
|
var it = protoOf(LanguageEmitter).tq.call(this, module_0, logger);
|
|
625
|
-
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.
|
|
626
|
+
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.m1v().d1z_1));
|
|
626
627
|
};
|
|
627
628
|
protoOf(TypeScriptEmitter).uq = function (definition, module_0, logger) {
|
|
628
629
|
// Inline function 'kotlin.let' call
|
|
629
630
|
var it = protoOf(LanguageEmitter).uq.call(this, definition, module_0, logger);
|
|
630
631
|
var subPackageName = plus(Companion_instance.lr(''), definition);
|
|
631
|
-
return new Emitted(subPackageName.or() + this.
|
|
632
|
+
return new Emitted(subPackageName.or() + this.p1v(it.io_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.jo_1 + '\n '));
|
|
632
633
|
};
|
|
633
634
|
protoOf(TypeScriptEmitter).yq = function (union) {
|
|
634
635
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -654,7 +655,7 @@ protoOf(TypeScriptEmitter).yq = function (union) {
|
|
|
654
655
|
}
|
|
655
656
|
var tmp = destination;
|
|
656
657
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
|
|
657
|
-
var tmp_1 = this.
|
|
658
|
+
var tmp_1 = this.x1y(union.qo_1);
|
|
658
659
|
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.ro_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
|
|
659
660
|
};
|
|
660
661
|
protoOf(TypeScriptEmitter).xq = function (channel) {
|
|
@@ -881,7 +882,7 @@ function joinToObject($this, _this__u8e3s4, transform) {
|
|
|
881
882
|
return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
|
|
882
883
|
}
|
|
883
884
|
function emitHandleFunction($this, endpoint) {
|
|
884
|
-
return Companion_instance_0.pq($this.
|
|
885
|
+
return Companion_instance_0.pq($this.x1y(endpoint.ep_1)) + ': (request:Request) => Promise<Response>';
|
|
885
886
|
}
|
|
886
887
|
function lowercase($this, _this__u8e3s4) {
|
|
887
888
|
// Inline function 'kotlin.text.lowercase' call
|
|
@@ -1038,7 +1039,7 @@ function TypeScriptEnumDefinitionEmitter() {
|
|
|
1038
1039
|
function TypeScriptIdentifierEmitter() {
|
|
1039
1040
|
}
|
|
1040
1041
|
function _get_sanitizationConfig__sns434($this) {
|
|
1041
|
-
var tmp0 = $this.
|
|
1042
|
+
var tmp0 = $this.g1z_1;
|
|
1042
1043
|
var tmp = KProperty1;
|
|
1043
1044
|
// Inline function 'kotlin.getValue' call
|
|
1044
1045
|
getPropertyCallableRef('sanitizationConfig', 1, tmp, TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh(), null);
|
|
@@ -1066,7 +1067,7 @@ function sanitizeSymbol_1($this, _this__u8e3s4) {
|
|
|
1066
1067
|
return destination.toString();
|
|
1067
1068
|
}
|
|
1068
1069
|
function sanitizeKeywords($this, _this__u8e3s4) {
|
|
1069
|
-
return Companion_getInstance_0().
|
|
1070
|
+
return Companion_getInstance_0().h1z_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
1070
1071
|
}
|
|
1071
1072
|
function firstToLower($this, _this__u8e3s4) {
|
|
1072
1073
|
// Inline function 'kotlin.text.replaceFirstChar' call
|
|
@@ -1100,7 +1101,7 @@ function sanitizeParamName($this, identifier) {
|
|
|
1100
1101
|
}
|
|
1101
1102
|
}
|
|
1102
1103
|
var parts = destination;
|
|
1103
|
-
var name = parts.a1() > 1 ? (new Name(parts)).
|
|
1104
|
+
var name = parts.a1() > 1 ? (new Name(parts)).s1l() : identifier.l1();
|
|
1104
1105
|
return sanitizeKeywords($this, sanitizeSymbol_1($this, name));
|
|
1105
1106
|
}
|
|
1106
1107
|
function buildEndpointParams($this, endpoint) {
|
|
@@ -1200,17 +1201,17 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1200
1201
|
return tmp + (ref.cu() ? ' | undefined' : '');
|
|
1201
1202
|
}
|
|
1202
1203
|
function EndpointParam(name, type, nullable) {
|
|
1203
|
-
this.
|
|
1204
|
-
this.
|
|
1205
|
-
this.
|
|
1204
|
+
this.i1z_1 = name;
|
|
1205
|
+
this.j1z_1 = type;
|
|
1206
|
+
this.k1z_1 = nullable;
|
|
1206
1207
|
}
|
|
1207
1208
|
protoOf(EndpointParam).toString = function () {
|
|
1208
|
-
return 'EndpointParam(name=' + this.
|
|
1209
|
+
return 'EndpointParam(name=' + this.i1z_1 + ', type=' + this.j1z_1 + ', nullable=' + this.k1z_1 + ')';
|
|
1209
1210
|
};
|
|
1210
1211
|
protoOf(EndpointParam).hashCode = function () {
|
|
1211
|
-
var result = getStringHashCode(this.
|
|
1212
|
-
result = imul(result, 31) + getStringHashCode(this.
|
|
1213
|
-
result = imul(result, 31) + getBooleanHashCode(this.
|
|
1212
|
+
var result = getStringHashCode(this.i1z_1);
|
|
1213
|
+
result = imul(result, 31) + getStringHashCode(this.j1z_1) | 0;
|
|
1214
|
+
result = imul(result, 31) + getBooleanHashCode(this.k1z_1) | 0;
|
|
1214
1215
|
return result;
|
|
1215
1216
|
};
|
|
1216
1217
|
protoOf(EndpointParam).equals = function (other) {
|
|
@@ -1218,17 +1219,17 @@ protoOf(EndpointParam).equals = function (other) {
|
|
|
1218
1219
|
return true;
|
|
1219
1220
|
if (!(other instanceof EndpointParam))
|
|
1220
1221
|
return false;
|
|
1221
|
-
if (!(this.h1z_1 === other.h1z_1))
|
|
1222
|
-
return false;
|
|
1223
1222
|
if (!(this.i1z_1 === other.i1z_1))
|
|
1224
1223
|
return false;
|
|
1225
1224
|
if (!(this.j1z_1 === other.j1z_1))
|
|
1226
1225
|
return false;
|
|
1226
|
+
if (!(this.k1z_1 === other.k1z_1))
|
|
1227
|
+
return false;
|
|
1227
1228
|
return true;
|
|
1228
1229
|
};
|
|
1229
1230
|
function Companion() {
|
|
1230
1231
|
Companion_instance_1 = this;
|
|
1231
|
-
this.
|
|
1232
|
+
this.h1z_1 = setOf(['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'class', 'const', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'type', 'async', 'await']);
|
|
1232
1233
|
}
|
|
1233
1234
|
var Companion_instance_1;
|
|
1234
1235
|
function Companion_getInstance_0() {
|
|
@@ -1241,13 +1242,13 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
|
|
|
1241
1242
|
}
|
|
1242
1243
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0) {
|
|
1243
1244
|
return function (name) {
|
|
1244
|
-
var sanitized = name.
|
|
1245
|
+
var sanitized = name.g1h_1.a1() > 1 ? name.s1l() : sanitizeSymbol_1(this$0, name.s1h());
|
|
1245
1246
|
return new Name(listOf(sanitized));
|
|
1246
1247
|
};
|
|
1247
1248
|
}
|
|
1248
1249
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0) {
|
|
1249
1250
|
return function (name) {
|
|
1250
|
-
var sanitized = name.
|
|
1251
|
+
var sanitized = name.g1h_1.a1() > 1 ? name.s1l() : sanitizeSymbol_1(this$0, name.s1h());
|
|
1251
1252
|
return new Name(listOf(sanitized));
|
|
1252
1253
|
};
|
|
1253
1254
|
}
|
|
@@ -1273,12 +1274,12 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1273
1274
|
return function (stmt, tr) {
|
|
1274
1275
|
var tmp;
|
|
1275
1276
|
if (stmt instanceof VariableReference) {
|
|
1276
|
-
tmp = new VariableReference(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.
|
|
1277
|
+
tmp = new VariableReference(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.g1o_1));
|
|
1277
1278
|
} else {
|
|
1278
1279
|
if (stmt instanceof ConstructorStatement) {
|
|
1279
|
-
var tmp_0 = tr.
|
|
1280
|
+
var tmp_0 = tr.p1t(stmt.p1m_1);
|
|
1280
1281
|
// Inline function 'kotlin.collections.map' call
|
|
1281
|
-
var this_0 = stmt.
|
|
1282
|
+
var this_0 = stmt.q1m_1;
|
|
1282
1283
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1283
1284
|
var destination = ArrayList_init_$Create$_0(this_0.a1());
|
|
1284
1285
|
// Inline function 'kotlin.collections.iterator' call
|
|
@@ -1289,13 +1290,13 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1289
1290
|
var key = item.k1();
|
|
1290
1291
|
// Inline function 'kotlin.collections.component2' call
|
|
1291
1292
|
var value = item.l1();
|
|
1292
|
-
var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), key), tr.
|
|
1293
|
+
var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), key), tr.s1t(value));
|
|
1293
1294
|
destination.x(tmp$ret$3);
|
|
1294
1295
|
}
|
|
1295
1296
|
tmp = new ConstructorStatement(tmp_0, toMap(destination));
|
|
1296
1297
|
} else {
|
|
1297
1298
|
if (stmt instanceof Assignment) {
|
|
1298
|
-
tmp = new Assignment(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.
|
|
1299
|
+
tmp = new Assignment(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.j1o_1), tr.s1t(stmt.k1o_1), stmt.l1o_1);
|
|
1299
1300
|
} else {
|
|
1300
1301
|
tmp = transformChildren(stmt, tr);
|
|
1301
1302
|
}
|
|
@@ -1306,7 +1307,7 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1306
1307
|
}
|
|
1307
1308
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
|
|
1308
1309
|
return function () {
|
|
1309
|
-
var tmp0_reservedKeywords = Companion_getInstance_0().
|
|
1310
|
+
var tmp0_reservedKeywords = Companion_getInstance_0().h1z_1;
|
|
1310
1311
|
var tmp = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda;
|
|
1311
1312
|
var tmp_0 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0);
|
|
1312
1313
|
var tmp_1 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0);
|
|
@@ -1322,11 +1323,11 @@ function TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh() {
|
|
|
1322
1323
|
function TypeScriptIrEmitter$emitShared$lambda(element, transformer) {
|
|
1323
1324
|
var tmp;
|
|
1324
1325
|
if (element instanceof Namespace) {
|
|
1325
|
-
var injected = element.
|
|
1326
|
+
var injected = element.y1m_1.equals(Companion_getInstance().f1h('Wirespec')) ? listOf(new RawElement('export type Type = string')) : emptyList();
|
|
1326
1327
|
var tmp_0;
|
|
1327
1328
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1328
1329
|
if (!injected.r()) {
|
|
1329
|
-
tmp_0 = withElements(element, plus_0(injected, element.
|
|
1330
|
+
tmp_0 = withElements(element, plus_0(injected, element.u1m()));
|
|
1330
1331
|
} else {
|
|
1331
1332
|
tmp_0 = element;
|
|
1332
1333
|
}
|
|
@@ -1341,11 +1342,11 @@ function TypeScriptIrEmitter$emitShared$lambda_0($api) {
|
|
|
1341
1342
|
return function (element, transformer) {
|
|
1342
1343
|
var tmp;
|
|
1343
1344
|
if (element instanceof Namespace) {
|
|
1344
|
-
var injected = element.
|
|
1345
|
+
var injected = element.y1m_1.equals(Companion_getInstance().f1h('Wirespec')) ? listOf(new RawElement($api)) : emptyList();
|
|
1345
1346
|
var tmp_0;
|
|
1346
1347
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1347
1348
|
if (!injected.r()) {
|
|
1348
|
-
tmp_0 = withElements(element, plus_0(element.
|
|
1349
|
+
tmp_0 = withElements(element, plus_0(element.u1m(), injected));
|
|
1349
1350
|
} else {
|
|
1350
1351
|
tmp_0 = element;
|
|
1351
1352
|
}
|
|
@@ -1368,7 +1369,7 @@ function TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint) {
|
|
|
1368
1369
|
var tmp_0;
|
|
1369
1370
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1370
1371
|
if (!injected.r()) {
|
|
1371
|
-
tmp_0 = withElements(element, plus_0(element.
|
|
1372
|
+
tmp_0 = withElements(element, plus_0(element.u1m(), injected));
|
|
1372
1373
|
} else {
|
|
1373
1374
|
tmp_0 = element;
|
|
1374
1375
|
}
|
|
@@ -1387,14 +1388,14 @@ function emit$injectApiConst(_this__u8e3s4, $endpoint) {
|
|
|
1387
1388
|
var tmp = scope;
|
|
1388
1389
|
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1389
1390
|
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1390
|
-
var this_0 = scope.
|
|
1391
|
+
var this_0 = scope.x1t_1;
|
|
1391
1392
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1392
1393
|
// Inline function 'kotlin.apply' call
|
|
1393
1394
|
var this_1 = new TransformerBuilder();
|
|
1394
1395
|
this_1.c1h(TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint));
|
|
1395
1396
|
var tmp$ret$2 = this_1.d1h();
|
|
1396
|
-
tmp.
|
|
1397
|
-
var tmp_0 = scope.
|
|
1397
|
+
tmp.x1t_1 = transform(this_0, tmp$ret$2);
|
|
1398
|
+
var tmp_0 = scope.x1t_1;
|
|
1398
1399
|
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1399
1400
|
}
|
|
1400
1401
|
function emit$applyCallParamsIfNeeded(_this__u8e3s4, hasRequestParams) {
|
|
@@ -1408,18 +1409,18 @@ function TypeScriptIrEmitter$emitClient$lambda(this$0) {
|
|
|
1408
1409
|
}
|
|
1409
1410
|
function TypeScriptIrEmitter() {
|
|
1410
1411
|
Companion_getInstance_0();
|
|
1411
|
-
this.
|
|
1412
|
-
this.
|
|
1412
|
+
this.e1z_1 = TypeScriptGenerator_getInstance();
|
|
1413
|
+
this.f1z_1 = FileExtension_TypeScript_getInstance();
|
|
1413
1414
|
var tmp = this;
|
|
1414
|
-
tmp.
|
|
1415
|
+
tmp.g1z_1 = lazy(TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this));
|
|
1415
1416
|
}
|
|
1416
|
-
protoOf(TypeScriptIrEmitter).
|
|
1417
|
-
return this.
|
|
1417
|
+
protoOf(TypeScriptIrEmitter).k1u = function () {
|
|
1418
|
+
return this.e1z_1;
|
|
1418
1419
|
};
|
|
1419
1420
|
protoOf(TypeScriptIrEmitter).eq = function () {
|
|
1420
|
-
return this.
|
|
1421
|
+
return this.f1z_1;
|
|
1421
1422
|
};
|
|
1422
|
-
protoOf(TypeScriptIrEmitter).
|
|
1423
|
+
protoOf(TypeScriptIrEmitter).n1u = function () {
|
|
1423
1424
|
var packageName = Companion_instance.lr('community.flock.wirespec');
|
|
1424
1425
|
var api = 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => {\n to: (request: REQ) => RawRequest;\n from: (response: RawResponse) => RES\n}\nexport type Server<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => {\n from: (request: RawRequest) => REQ;\n to: (response: RES) => RawResponse\n}\nexport type Api<REQ extends Request<unknown>, RES extends Response<unknown>> = {\n name: string;\n method: Method,\n path: string,\n client: Client<REQ, RES>;\n server: Server<REQ, RES>\n}';
|
|
1425
1426
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
@@ -1429,25 +1430,25 @@ protoOf(TypeScriptIrEmitter).m1u = function () {
|
|
|
1429
1430
|
var tmp = scope;
|
|
1430
1431
|
// Inline function 'community.flock.wirespec.ir.core.injectBefore' call
|
|
1431
1432
|
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1432
|
-
var this_1 = scope.
|
|
1433
|
+
var this_1 = scope.x1t_1;
|
|
1433
1434
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1434
1435
|
// Inline function 'kotlin.apply' call
|
|
1435
1436
|
var this_2 = new TransformerBuilder();
|
|
1436
1437
|
this_2.c1h(TypeScriptIrEmitter$emitShared$lambda);
|
|
1437
1438
|
var tmp$ret$2 = this_2.d1h();
|
|
1438
|
-
tmp.
|
|
1439
|
+
tmp.x1t_1 = transform(this_1, tmp$ret$2);
|
|
1439
1440
|
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
|
|
1440
1441
|
var tmp_0 = scope;
|
|
1441
1442
|
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1442
1443
|
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1443
|
-
var this_3 = scope.
|
|
1444
|
+
var this_3 = scope.x1t_1;
|
|
1444
1445
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1445
1446
|
// Inline function 'kotlin.apply' call
|
|
1446
1447
|
var this_4 = new TransformerBuilder();
|
|
1447
1448
|
this_4.c1h(TypeScriptIrEmitter$emitShared$lambda_0(api));
|
|
1448
1449
|
var tmp$ret$8 = this_4.d1h();
|
|
1449
|
-
tmp_0.
|
|
1450
|
-
var tmp_1 = scope.
|
|
1450
|
+
tmp_0.x1t_1 = transform(this_3, tmp$ret$8);
|
|
1451
|
+
var tmp_1 = scope.x1t_1;
|
|
1451
1452
|
return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1452
1453
|
};
|
|
1453
1454
|
protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
@@ -1506,7 +1507,7 @@ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
|
1506
1507
|
protoOf(TypeScriptIrEmitter).uq = function (definition, module_0, logger) {
|
|
1507
1508
|
var file = emit_0.call(this, definition, module_0, logger);
|
|
1508
1509
|
var subPackageName = plus(Companion_instance.lr(''), definition);
|
|
1509
|
-
return new File(Companion_getInstance().
|
|
1510
|
+
return new File(Companion_getInstance().f1h(subPackageName.or() + sanitizeSymbol_1(this, file.s1m_1.h1h())), plus_0(listOf(import_0('../Wirespec', 'Wirespec')), file.t1m_1));
|
|
1510
1511
|
};
|
|
1511
1512
|
protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
1512
1513
|
var fieldValidations = classifyValidatableFields(type, module_0);
|
|
@@ -1538,7 +1539,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1538
1539
|
var _iterator__ex2g4s_1 = fieldValidations.t();
|
|
1539
1540
|
while (_iterator__ex2g4s_1.u()) {
|
|
1540
1541
|
var item_0 = _iterator__ex2g4s_1.v();
|
|
1541
|
-
var tmp$ret$5 = item_0.
|
|
1542
|
+
var tmp$ret$5 = item_0.m1h_1;
|
|
1542
1543
|
destination_0.x(tmp$ret$5);
|
|
1543
1544
|
}
|
|
1544
1545
|
// Inline function 'kotlin.collections.filter' call
|
|
@@ -1578,7 +1579,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1578
1579
|
var tmp;
|
|
1579
1580
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1580
1581
|
if (!allImports.r()) {
|
|
1581
|
-
tmp = file.
|
|
1582
|
+
tmp = file.w1m(VOID, plus_0(allImports, file.t1m_1));
|
|
1582
1583
|
} else {
|
|
1583
1584
|
tmp = file;
|
|
1584
1585
|
}
|
|
@@ -1614,7 +1615,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1614
1615
|
var tmp;
|
|
1615
1616
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1616
1617
|
if (!imports.r()) {
|
|
1617
|
-
tmp = file.
|
|
1618
|
+
tmp = file.w1m(VOID, plus_0(imports, file.t1m_1));
|
|
1618
1619
|
} else {
|
|
1619
1620
|
tmp = file;
|
|
1620
1621
|
}
|
|
@@ -1622,9 +1623,9 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1622
1623
|
};
|
|
1623
1624
|
protoOf(TypeScriptIrEmitter).dr = function (refined) {
|
|
1624
1625
|
var converted = convert_2(refined);
|
|
1625
|
-
var constraintExpr = convertConstraint(refined.cr_1, new VariableReference(Companion_getInstance().
|
|
1626
|
-
var validatorStr = TypeScriptGenerator_getInstance().
|
|
1627
|
-
return new File(converted.
|
|
1626
|
+
var constraintExpr = convertConstraint(refined.cr_1, new VariableReference(Companion_getInstance().f1h('value')));
|
|
1627
|
+
var validatorStr = TypeScriptGenerator_getInstance().v1u(constraintExpr);
|
|
1628
|
+
return new File(converted.s1m_1, listOf_0([new RawElement('export type ' + converted.s1m_1.h1h() + ' = ' + emitTypeScriptReference(this, refined.cr_1) + ';'), new RawElement('export const validate' + refined.br_1.l1() + ' = (value: ' + emitTypeScriptReference(this, refined.cr_1) + ') =>\n ' + validatorStr + ';')]));
|
|
1628
1629
|
};
|
|
1629
1630
|
protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
1630
1631
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -1654,15 +1655,15 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1654
1655
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1655
1656
|
var this_1 = stripTrailingSpaceFromErrorMessage(convert_3(endpoint));
|
|
1656
1657
|
var scope = new TransformScope(this_1);
|
|
1657
|
-
scope.
|
|
1658
|
-
var tmp = scope.
|
|
1658
|
+
scope.c1u(transformPatternSwitchToValueSwitch());
|
|
1659
|
+
var tmp = scope.x1t_1;
|
|
1659
1660
|
var tmp$ret$7 = isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1660
1661
|
// Inline function 'kotlin.let' call
|
|
1661
|
-
var it = sanitizeNames(emit$injectApiConst(emit$applyCallParamsIfNeeded(tmp$ret$7, hasRequestParams), endpoint).
|
|
1662
|
+
var it = sanitizeNames(emit$injectApiConst(emit$applyCallParamsIfNeeded(tmp$ret$7, hasRequestParams), endpoint).w1m(Companion_getInstance().f1h(sanitize(this, endpoint.ep_1))), _get_sanitizationConfig__sns434(this));
|
|
1662
1663
|
var tmp_0;
|
|
1663
1664
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1664
1665
|
if (!imports.r()) {
|
|
1665
|
-
tmp_0 = it.
|
|
1666
|
+
tmp_0 = it.w1m(VOID, plus_0(imports, it.t1m_1));
|
|
1666
1667
|
} else {
|
|
1667
1668
|
tmp_0 = it;
|
|
1668
1669
|
}
|
|
@@ -1671,7 +1672,7 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1671
1672
|
protoOf(TypeScriptIrEmitter).xq = function (channel) {
|
|
1672
1673
|
return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
|
|
1673
1674
|
};
|
|
1674
|
-
protoOf(TypeScriptIrEmitter).
|
|
1675
|
+
protoOf(TypeScriptIrEmitter).p1u = function (endpoint) {
|
|
1675
1676
|
var endpointName = endpoint.ep_1.l1();
|
|
1676
1677
|
var methodName = firstToLower(this, endpointName);
|
|
1677
1678
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -1714,7 +1715,7 @@ protoOf(TypeScriptIrEmitter).o1u = function (endpoint) {
|
|
|
1714
1715
|
}
|
|
1715
1716
|
var requestArgs = tmp_0;
|
|
1716
1717
|
var code = trimMargin('\n |export const ' + methodName + 'Client = (serialization: Wirespec.Serialization, transportation: Wirespec.Transportation) => ({\n | ' + methodName + ': async (' + paramList + '): Promise<' + endpointName + '.Response<unknown>> => {\n | const request: ' + endpointName + '.Request = ' + requestArgs + ';\n | const rawRequest = ' + endpointName + '.toRawRequest(serialization, request);\n | const rawResponse = await transportation.transport(rawRequest);\n | return ' + endpointName + '.fromRawResponse(serialization, rawResponse);\n | }\n |})\n ');
|
|
1717
|
-
var tmp_1 = Companion_getInstance().
|
|
1718
|
+
var tmp_1 = Companion_getInstance().f1h('client/' + endpointName + 'Client');
|
|
1718
1719
|
// Inline function 'kotlin.collections.buildList' call
|
|
1719
1720
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
1720
1721
|
// Inline function 'kotlin.apply' call
|
|
@@ -1726,7 +1727,7 @@ protoOf(TypeScriptIrEmitter).o1u = function (endpoint) {
|
|
|
1726
1727
|
var tmp$ret$10 = this_1.o5();
|
|
1727
1728
|
return new File(tmp_1, tmp$ret$10);
|
|
1728
1729
|
};
|
|
1729
|
-
protoOf(TypeScriptIrEmitter).
|
|
1730
|
+
protoOf(TypeScriptIrEmitter).o1u = function (endpoints, logger) {
|
|
1730
1731
|
logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
|
|
1731
1732
|
// Inline function 'kotlin.collections.map' call
|
|
1732
1733
|
// Inline function 'kotlin.collections.mapTo' call
|
|
@@ -1741,7 +1742,7 @@ protoOf(TypeScriptIrEmitter).n1u = function (endpoints, logger) {
|
|
|
1741
1742
|
var clientImports = destination;
|
|
1742
1743
|
var spreadEntries = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$emitClient$lambda(this));
|
|
1743
1744
|
var code = trimMargin('\n |export const client = (serialization: Wirespec.Serialization, transportation: Wirespec.Transportation) => ({\n |' + spreadEntries + '\n |})\n ');
|
|
1744
|
-
var tmp = Companion_getInstance().
|
|
1745
|
+
var tmp = Companion_getInstance().f1h('Client');
|
|
1745
1746
|
// Inline function 'kotlin.collections.buildList' call
|
|
1746
1747
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
1747
1748
|
// Inline function 'kotlin.apply' call
|
|
@@ -1756,7 +1757,7 @@ function transformPatternSwitchToValueSwitch() {
|
|
|
1756
1757
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1757
1758
|
// Inline function 'kotlin.apply' call
|
|
1758
1759
|
var this_0 = new TransformerBuilder();
|
|
1759
|
-
this_0.
|
|
1760
|
+
this_0.e1u(transformPatternSwitchToValueSwitch$lambda);
|
|
1760
1761
|
return this_0.d1h();
|
|
1761
1762
|
}
|
|
1762
1763
|
function renameValidateAndBindObjReceiver(_this__u8e3s4, typeName, fieldNames) {
|
|
@@ -1765,14 +1766,14 @@ function renameValidateAndBindObjReceiver(_this__u8e3s4, typeName, fieldNames) {
|
|
|
1765
1766
|
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1766
1767
|
var tmp = scope;
|
|
1767
1768
|
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1768
|
-
var this_0 = scope.
|
|
1769
|
+
var this_0 = scope.x1t_1;
|
|
1769
1770
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1770
1771
|
// Inline function 'kotlin.apply' call
|
|
1771
1772
|
var this_1 = new TransformerBuilder();
|
|
1772
1773
|
this_1.c1h(renameValidateAndBindObjReceiver$lambda(typeName, fieldNames));
|
|
1773
1774
|
var tmp$ret$2 = this_1.d1h();
|
|
1774
|
-
tmp.
|
|
1775
|
-
var tmp_0 = scope.
|
|
1775
|
+
tmp.x1t_1 = transform(this_0, tmp$ret$2);
|
|
1776
|
+
var tmp_0 = scope.x1t_1;
|
|
1776
1777
|
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1777
1778
|
}
|
|
1778
1779
|
function buildApiConst(endpoint) {
|
|
@@ -1801,21 +1802,21 @@ function bindCallToRequestParams(_this__u8e3s4) {
|
|
|
1801
1802
|
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1802
1803
|
var tmp = scope;
|
|
1803
1804
|
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1804
|
-
var this_0 = scope.
|
|
1805
|
+
var this_0 = scope.x1t_1;
|
|
1805
1806
|
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1806
1807
|
// Inline function 'kotlin.apply' call
|
|
1807
1808
|
var this_1 = new TransformerBuilder();
|
|
1808
1809
|
this_1.c1h(bindCallToRequestParams$lambda);
|
|
1809
1810
|
var tmp$ret$2 = this_1.d1h();
|
|
1810
|
-
tmp.
|
|
1811
|
-
var tmp_0 = scope.
|
|
1811
|
+
tmp.x1t_1 = transform(this_0, tmp$ret$2);
|
|
1812
|
+
var tmp_0 = scope.x1t_1;
|
|
1812
1813
|
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1813
1814
|
}
|
|
1814
1815
|
function stripTrailingSpaceFromErrorMessage(_this__u8e3s4) {
|
|
1815
1816
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1816
1817
|
var scope = new TransformScope(_this__u8e3s4);
|
|
1817
|
-
scope.
|
|
1818
|
-
var tmp = scope.
|
|
1818
|
+
scope.e1u(stripTrailingSpaceFromErrorMessage$lambda);
|
|
1819
|
+
var tmp = scope.x1t_1;
|
|
1819
1820
|
return isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1820
1821
|
}
|
|
1821
1822
|
function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
@@ -1823,7 +1824,7 @@ function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
|
1823
1824
|
if (!(stmt instanceof Switch)) {
|
|
1824
1825
|
tmp = true;
|
|
1825
1826
|
} else {
|
|
1826
|
-
var tmp0 = stmt.
|
|
1827
|
+
var tmp0 = stmt.z1o_1;
|
|
1827
1828
|
var tmp$ret$0;
|
|
1828
1829
|
$l$block_0: {
|
|
1829
1830
|
// Inline function 'kotlin.collections.none' call
|
|
@@ -1840,7 +1841,7 @@ function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
|
1840
1841
|
var _iterator__ex2g4s = tmp0.t();
|
|
1841
1842
|
while (_iterator__ex2g4s.u()) {
|
|
1842
1843
|
var element = _iterator__ex2g4s.v();
|
|
1843
|
-
if (!(element.
|
|
1844
|
+
if (!(element.g1p_1 == null)) {
|
|
1844
1845
|
tmp$ret$0 = false;
|
|
1845
1846
|
break $l$block_0;
|
|
1846
1847
|
}
|
|
@@ -1851,11 +1852,11 @@ function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
|
1851
1852
|
}
|
|
1852
1853
|
if (tmp)
|
|
1853
1854
|
return transformChildren(stmt, tr);
|
|
1854
|
-
var tmp0_safe_receiver = stmt.
|
|
1855
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
1855
|
+
var tmp0_safe_receiver = stmt.b1p_1;
|
|
1856
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.s1l();
|
|
1856
1857
|
var varName = tmp1_elvis_lhs == null ? 'r' : tmp1_elvis_lhs;
|
|
1857
1858
|
// Inline function 'kotlin.collections.map' call
|
|
1858
|
-
var this_0 = stmt.
|
|
1859
|
+
var this_0 = stmt.z1o_1;
|
|
1859
1860
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1860
1861
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1861
1862
|
var _iterator__ex2g4s_0 = this_0.t();
|
|
@@ -1863,38 +1864,39 @@ function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
|
1863
1864
|
var item = _iterator__ex2g4s_0.v();
|
|
1864
1865
|
var tmp$ret$5;
|
|
1865
1866
|
$l$block_1: {
|
|
1866
|
-
var tmp_1 = item.
|
|
1867
|
+
var tmp_1 = item.g1p_1;
|
|
1867
1868
|
var tmp0_safe_receiver_0 = tmp_1 instanceof Custom_0 ? tmp_1 : null;
|
|
1868
|
-
var
|
|
1869
|
-
var
|
|
1870
|
-
var tmp3_safe_receiver =
|
|
1871
|
-
var
|
|
1869
|
+
var tmp1_safe_receiver = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.q1h_1;
|
|
1870
|
+
var typeName = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.h1h();
|
|
1871
|
+
var tmp3_safe_receiver = typeName == null ? null : substringAfterLast(typeName, '.');
|
|
1872
|
+
var tmp4_safe_receiver = tmp3_safe_receiver == null ? null : removePrefix(tmp3_safe_receiver, 'Response');
|
|
1873
|
+
var statusNum = tmp4_safe_receiver == null ? null : toIntOrNull(tmp4_safe_receiver);
|
|
1872
1874
|
if (statusNum == null || typeName == null) {
|
|
1873
1875
|
// Inline function 'kotlin.collections.map' call
|
|
1874
|
-
var this_1 = item.
|
|
1876
|
+
var this_1 = item.f1p_1;
|
|
1875
1877
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1876
1878
|
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
1877
1879
|
var _iterator__ex2g4s_1 = this_1.t();
|
|
1878
1880
|
while (_iterator__ex2g4s_1.u()) {
|
|
1879
1881
|
var item_0 = _iterator__ex2g4s_1.v();
|
|
1880
|
-
var tmp$ret$2 = tr.
|
|
1882
|
+
var tmp$ret$2 = tr.r1t(item_0);
|
|
1881
1883
|
destination_0.x(tmp$ret$2);
|
|
1882
1884
|
}
|
|
1883
|
-
tmp$ret$5 = item.
|
|
1885
|
+
tmp$ret$5 = item.i1p(VOID, destination_0);
|
|
1884
1886
|
break $l$block_1;
|
|
1885
1887
|
}
|
|
1886
|
-
var exprCode = TypeScriptGenerator_getInstance().
|
|
1887
|
-
var castAssignment = new Assignment(Companion_getInstance().
|
|
1888
|
+
var exprCode = TypeScriptGenerator_getInstance().v1u(tr.s1t(stmt.y1o_1));
|
|
1889
|
+
var castAssignment = new Assignment(Companion_getInstance().f1h(varName), new RawExpression(exprCode + ' as ' + typeName), false);
|
|
1888
1890
|
var tmp_2 = new Literal_0(statusNum, new Integer_0());
|
|
1889
1891
|
var tmp_3 = listOf(castAssignment);
|
|
1890
1892
|
// Inline function 'kotlin.collections.map' call
|
|
1891
|
-
var this_2 = item.
|
|
1893
|
+
var this_2 = item.f1p_1;
|
|
1892
1894
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1893
1895
|
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
|
|
1894
1896
|
var _iterator__ex2g4s_2 = this_2.t();
|
|
1895
1897
|
while (_iterator__ex2g4s_2.u()) {
|
|
1896
1898
|
var item_1 = _iterator__ex2g4s_2.v();
|
|
1897
|
-
var tmp$ret$6 = tr.
|
|
1899
|
+
var tmp$ret$6 = tr.r1t(item_1);
|
|
1898
1900
|
destination_1.x(tmp$ret$6);
|
|
1899
1901
|
}
|
|
1900
1902
|
tmp$ret$5 = new Case(tmp_2, plus_0(tmp_3, destination_1), null);
|
|
@@ -1902,19 +1904,19 @@ function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
|
1902
1904
|
destination.x(tmp$ret$5);
|
|
1903
1905
|
}
|
|
1904
1906
|
var transformedCases = destination;
|
|
1905
|
-
var tmp_4 = new FieldCall(tr.
|
|
1906
|
-
var
|
|
1907
|
+
var tmp_4 = new FieldCall(tr.s1t(stmt.y1o_1), Companion_getInstance().f1h('status'));
|
|
1908
|
+
var tmp2_safe_receiver = stmt.a1p_1;
|
|
1907
1909
|
var tmp_5;
|
|
1908
|
-
if (
|
|
1910
|
+
if (tmp2_safe_receiver == null) {
|
|
1909
1911
|
tmp_5 = null;
|
|
1910
1912
|
} else {
|
|
1911
1913
|
// Inline function 'kotlin.collections.map' call
|
|
1912
1914
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1913
|
-
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(
|
|
1914
|
-
var _iterator__ex2g4s_3 =
|
|
1915
|
+
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver, 10));
|
|
1916
|
+
var _iterator__ex2g4s_3 = tmp2_safe_receiver.t();
|
|
1915
1917
|
while (_iterator__ex2g4s_3.u()) {
|
|
1916
1918
|
var item_2 = _iterator__ex2g4s_3.v();
|
|
1917
|
-
var tmp$ret$11 = tr.
|
|
1919
|
+
var tmp$ret$11 = tr.r1t(item_2);
|
|
1918
1920
|
destination_2.x(tmp$ret$11);
|
|
1919
1921
|
}
|
|
1920
1922
|
tmp_5 = destination_2;
|
|
@@ -1928,42 +1930,43 @@ function renameValidateAndBindObjReceiver$lambda$lambda($fieldNames) {
|
|
|
1928
1930
|
var tmp_1;
|
|
1929
1931
|
var tmp_2;
|
|
1930
1932
|
if (s instanceof FunctionCall) {
|
|
1931
|
-
tmp_2 = s.
|
|
1933
|
+
tmp_2 = s.b1m_1.equals(Companion_getInstance().f1h('validate'));
|
|
1932
1934
|
} else {
|
|
1933
1935
|
tmp_2 = false;
|
|
1934
1936
|
}
|
|
1935
1937
|
if (tmp_2) {
|
|
1936
|
-
tmp_1 = !(s.
|
|
1938
|
+
tmp_1 = !(s.z1l_1 == null);
|
|
1937
1939
|
} else {
|
|
1938
1940
|
tmp_1 = false;
|
|
1939
1941
|
}
|
|
1940
1942
|
if (tmp_1) {
|
|
1941
1943
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1942
|
-
tmp_0 = !s.
|
|
1944
|
+
tmp_0 = !s.a1m_1.r();
|
|
1943
1945
|
} else {
|
|
1944
1946
|
tmp_0 = false;
|
|
1945
1947
|
}
|
|
1946
1948
|
if (tmp_0) {
|
|
1947
|
-
var tmp_3 = first(s.
|
|
1949
|
+
var tmp_3 = first(s.a1m_1);
|
|
1948
1950
|
var tmp0_safe_receiver = tmp_3 instanceof Custom_0 ? tmp_3 : null;
|
|
1949
|
-
var
|
|
1950
|
-
var
|
|
1951
|
-
|
|
1951
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1h_1;
|
|
1952
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.h1h();
|
|
1953
|
+
var tn = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
|
|
1954
|
+
tmp = new FunctionCall(VOID, VOID, Companion_getInstance().f1h('validate' + tn), mapOf(to(Companion_getInstance().f1h('obj'), t.s1t(ensureNotNull(s.z1l_1)))));
|
|
1952
1955
|
} else {
|
|
1953
1956
|
var tmp_4;
|
|
1954
1957
|
var tmp_5;
|
|
1955
1958
|
if (s instanceof FieldCall) {
|
|
1956
|
-
tmp_5 = s.
|
|
1959
|
+
tmp_5 = s.j1p_1 == null;
|
|
1957
1960
|
} else {
|
|
1958
1961
|
tmp_5 = false;
|
|
1959
1962
|
}
|
|
1960
1963
|
if (tmp_5) {
|
|
1961
|
-
tmp_4 = $fieldNames.u1(s.
|
|
1964
|
+
tmp_4 = $fieldNames.u1(s.k1p_1.s1l());
|
|
1962
1965
|
} else {
|
|
1963
1966
|
tmp_4 = false;
|
|
1964
1967
|
}
|
|
1965
1968
|
if (tmp_4) {
|
|
1966
|
-
tmp = new FieldCall(new VariableReference(Companion_getInstance().
|
|
1969
|
+
tmp = new FieldCall(new VariableReference(Companion_getInstance().f1h('obj')), s.k1p_1);
|
|
1967
1970
|
} else {
|
|
1968
1971
|
tmp = transformChildren(s, t);
|
|
1969
1972
|
}
|
|
@@ -1977,15 +1980,15 @@ function renameValidateAndBindObjReceiver$lambda($typeName, $fieldNames) {
|
|
|
1977
1980
|
if (element instanceof Function) {
|
|
1978
1981
|
var tmp$ret$0;
|
|
1979
1982
|
$l$block: {
|
|
1980
|
-
if (!element.
|
|
1983
|
+
if (!element.t1j_1.equals(Companion_getInstance().f1h('validate'))) {
|
|
1981
1984
|
tmp$ret$0 = element;
|
|
1982
1985
|
break $l$block;
|
|
1983
1986
|
}
|
|
1984
1987
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1985
|
-
var this_0 = element.
|
|
1988
|
+
var this_0 = element.b1k(Companion_getInstance().f1h('validate' + $typeName), VOID, listOf(new Parameter(Companion_getInstance().f1h('obj'), Custom_init_$Create$($typeName))));
|
|
1986
1989
|
var scope = new TransformScope(this_0);
|
|
1987
|
-
scope.
|
|
1988
|
-
var tmp_0 = scope.
|
|
1990
|
+
scope.g1u(renameValidateAndBindObjReceiver$lambda$lambda($fieldNames));
|
|
1991
|
+
var tmp_0 = scope.x1t_1;
|
|
1989
1992
|
tmp$ret$0 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1990
1993
|
}
|
|
1991
1994
|
tmp = tmp$ret$0;
|
|
@@ -2014,23 +2017,23 @@ function bindCallToRequestParams$lambda(element, transformer) {
|
|
|
2014
2017
|
if (element instanceof Interface) {
|
|
2015
2018
|
var tmp$ret$0;
|
|
2016
2019
|
$l$block: {
|
|
2017
|
-
if (!element.
|
|
2020
|
+
if (!element.k1n_1.equals(Companion_getInstance().f1h('Call'))) {
|
|
2018
2021
|
tmp$ret$0 = element;
|
|
2019
2022
|
break $l$block;
|
|
2020
2023
|
}
|
|
2021
2024
|
// Inline function 'kotlin.collections.map' call
|
|
2022
|
-
var this_0 = element.
|
|
2025
|
+
var this_0 = element.l1n_1;
|
|
2023
2026
|
// Inline function 'kotlin.collections.mapTo' call
|
|
2024
2027
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
2025
2028
|
var _iterator__ex2g4s = this_0.t();
|
|
2026
2029
|
while (_iterator__ex2g4s.u()) {
|
|
2027
2030
|
var item = _iterator__ex2g4s.v();
|
|
2028
2031
|
var tmp0_safe_receiver = item instanceof Function ? item : null;
|
|
2029
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
2032
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.b1k(VOID, VOID, listOf(new Parameter(Companion_getInstance().f1h('params'), Custom_init_$Create$('RequestParams'))));
|
|
2030
2033
|
var tmp$ret$1 = tmp1_elvis_lhs == null ? item : tmp1_elvis_lhs;
|
|
2031
2034
|
destination.x(tmp$ret$1);
|
|
2032
2035
|
}
|
|
2033
|
-
tmp$ret$0 = element.
|
|
2036
|
+
tmp$ret$0 = element.r1n(VOID, destination);
|
|
2034
2037
|
}
|
|
2035
2038
|
tmp = tmp$ret$0;
|
|
2036
2039
|
} else {
|
|
@@ -2042,7 +2045,7 @@ function bindCallToRequestParams$lambda(element, transformer) {
|
|
|
2042
2045
|
function stripTrailingSpaceFromErrorMessage$lambda(stmt, transformer) {
|
|
2043
2046
|
var tmp;
|
|
2044
2047
|
if (stmt instanceof Switch) {
|
|
2045
|
-
var tmp1_safe_receiver = stmt.
|
|
2048
|
+
var tmp1_safe_receiver = stmt.a1p_1;
|
|
2046
2049
|
var tmp_0;
|
|
2047
2050
|
if (tmp1_safe_receiver == null) {
|
|
2048
2051
|
tmp_0 = null;
|
|
@@ -2064,7 +2067,7 @@ function stripTrailingSpaceFromErrorMessage$lambda(stmt, transformer) {
|
|
|
2064
2067
|
tmp_1 = tmp0_elvis_lhs;
|
|
2065
2068
|
}
|
|
2066
2069
|
var errorStmt = tmp_1;
|
|
2067
|
-
var tmp_2 = errorStmt.
|
|
2070
|
+
var tmp_2 = errorStmt.n1p_1;
|
|
2068
2071
|
var tmp1_elvis_lhs = tmp_2 instanceof BinaryOp ? tmp_2 : null;
|
|
2069
2072
|
var tmp_3;
|
|
2070
2073
|
if (tmp1_elvis_lhs == null) {
|
|
@@ -2074,7 +2077,7 @@ function stripTrailingSpaceFromErrorMessage$lambda(stmt, transformer) {
|
|
|
2074
2077
|
tmp_3 = tmp1_elvis_lhs;
|
|
2075
2078
|
}
|
|
2076
2079
|
var binary = tmp_3;
|
|
2077
|
-
var tmp_4 = binary.
|
|
2080
|
+
var tmp_4 = binary.o1p_1;
|
|
2078
2081
|
var tmp2_elvis_lhs = tmp_4 instanceof Literal_0 ? tmp_4 : null;
|
|
2079
2082
|
var tmp_5;
|
|
2080
2083
|
if (tmp2_elvis_lhs == null) {
|
|
@@ -2084,13 +2087,13 @@ function stripTrailingSpaceFromErrorMessage$lambda(stmt, transformer) {
|
|
|
2084
2087
|
tmp_5 = tmp2_elvis_lhs;
|
|
2085
2088
|
}
|
|
2086
2089
|
var literal = tmp_5;
|
|
2087
|
-
tmp$ret$0 = new ErrorStatement(new Literal_0(trimEnd(toString(literal.
|
|
2090
|
+
tmp$ret$0 = new ErrorStatement(new Literal_0(trimEnd(toString(literal.q1o_1), charArrayOf([_Char___init__impl__6a9atx(32)])), literal.r1o_1));
|
|
2088
2091
|
}
|
|
2089
2092
|
destination.x(tmp$ret$0);
|
|
2090
2093
|
}
|
|
2091
2094
|
tmp_0 = destination;
|
|
2092
2095
|
}
|
|
2093
|
-
tmp = transformChildren(stmt.
|
|
2096
|
+
tmp = transformChildren(stmt.d1p(VOID, VOID, tmp_0), transformer);
|
|
2094
2097
|
} else {
|
|
2095
2098
|
tmp = transformChildren(stmt, transformer);
|
|
2096
2099
|
}
|
|
@@ -2100,8 +2103,8 @@ function TypeScriptRefinedTypeDefinitionEmitter() {
|
|
|
2100
2103
|
}
|
|
2101
2104
|
function TypeScriptShared() {
|
|
2102
2105
|
TypeScriptShared_instance = this;
|
|
2103
|
-
this.
|
|
2104
|
-
this.
|
|
2106
|
+
this.c1z_1 = 'community.flock.wirespec';
|
|
2107
|
+
this.d1z_1 = trimMargin('\n |export namespace Wirespec {\n |' + Spacer_instance.toString() + 'export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"\n |' + Spacer_instance.toString() + 'export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type RawResponse = { status: number, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type Request<T> = { path: Record<string, unknown>, method: Method, queries?: Record<string, unknown>, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Response<T> = { status:number, headers?: Record<string, unknown>, body?:T }\n |' + Spacer_instance.toString() + 'export type Serialization = { serialize: <T>(type: T) => string; deserialize: <T>(raw: string | undefined) => T }\n |' + Spacer_instance.toString() + 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { to: (request: REQ) => RawRequest; from: (response: RawResponse) => RES }\n |' + Spacer_instance.toString() + 'export type Server<REQ extends Request<unknown>, RES extends Response<unknown>> = (serialization: Serialization) => { from: (request: RawRequest) => REQ; to: (response: RES) => RawResponse }\n |' + Spacer_instance.toString() + 'export type Api<REQ extends Request<unknown>, RES extends Response<unknown>> = { name: string; method: Method, path: string, client: Client<REQ, RES>; server: Server<REQ, RES> }\n |}\n ');
|
|
2105
2108
|
}
|
|
2106
2109
|
protoOf(TypeScriptShared).toString = function () {
|
|
2107
2110
|
return 'TypeScriptShared';
|
|
@@ -2142,17 +2145,17 @@ protoOf(TypeScriptEmitter).vp = emit_6;
|
|
|
2142
2145
|
protoOf(TypeScriptEmitter).wp = emit_7;
|
|
2143
2146
|
protoOf(TypeScriptEmitter).xp = emit_4;
|
|
2144
2147
|
protoOf(TypeScriptEmitter).yp = emit_5;
|
|
2145
|
-
protoOf(TypeScriptEmitter).ir =
|
|
2146
|
-
protoOf(TypeScriptEmitter).dr =
|
|
2148
|
+
protoOf(TypeScriptEmitter).ir = emit_10;
|
|
2149
|
+
protoOf(TypeScriptEmitter).dr = emit_9;
|
|
2147
2150
|
protoOf(TypeScriptEmitter).jr = emit_8;
|
|
2148
2151
|
protoOf(TypeScriptEmitter).wq = emit_2;
|
|
2149
2152
|
protoOf(TypeScriptEmitter).kr = emitValidator;
|
|
2150
|
-
protoOf(TypeScriptEmitter).
|
|
2151
|
-
protoOf(TypeScriptEmitter).
|
|
2152
|
-
protoOf(TypeScriptEmitter).
|
|
2153
|
-
protoOf(TypeScriptEmitter).
|
|
2153
|
+
protoOf(TypeScriptEmitter).x1y = sanitizeSymbol;
|
|
2154
|
+
protoOf(TypeScriptEmitter).p1v = sanitizeSymbol_0;
|
|
2155
|
+
protoOf(TypeScriptEmitter).y1y = emitPrimitive;
|
|
2156
|
+
protoOf(TypeScriptEmitter).w1y = emitClient;
|
|
2154
2157
|
protoOf(TypeScriptEmitter).aq = emitClientEndpointRequest;
|
|
2155
|
-
protoOf(TypeScriptIrEmitter).
|
|
2158
|
+
protoOf(TypeScriptIrEmitter).m1u = emit_1;
|
|
2156
2159
|
//endregion
|
|
2157
2160
|
//region block: exports
|
|
2158
2161
|
export {
|