@flock/wirespec 0.18.5 → 0.18.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/arrow-arrow-atomic.mjs +11 -11
- package/arrow-arrow-core.mjs +141 -141
- package/clikt-clikt-mordant.mjs +80 -80
- package/clikt-clikt.mjs +1395 -1395
- package/clikt-clikt.mjs.map +1 -1
- package/colormath-root-colormath.mjs +442 -442
- package/kotlin-kotlin-stdlib.mjs +1055 -947
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +20835 -6841
- package/kotlin-openapi-bindings.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1797 -1797
- package/kotlinx-io-kotlinx-io-core.mjs +405 -405
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1967 -1770
- package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1881 -1406
- package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/mordant-mordant.mjs +1269 -1269
- package/package.json +3 -2
- package/wirespec-lsp.mjs +7 -0
- package/wirespec-src-compiler-core.mjs +1709 -1645
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +378 -377
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +289 -289
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +333 -332
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +388 -377
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-scala.mjs +158 -157
- package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +415 -412
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +83 -83
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +3239 -3199
- package/wirespec-src-compiler-ir.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +399 -399
- package/wirespec-src-converter-avro.mjs +507 -507
- package/wirespec-src-converter-openapi.mjs +1487 -1413
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-ide-lsp.mjs +4928 -0
- package/wirespec-src-ide-lsp.mjs.map +1 -0
- package/wirespec-src-plugin-arguments.mjs +175 -175
- package/wirespec-src-plugin-cli.mjs +102 -102
- package/wirespec-src-plugin-npm.d.mts +2 -0
- package/wirespec-src-plugin-npm.mjs +42 -37
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +32 -32
|
@@ -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.u1v(_this__u8e3s4.l1());
|
|
172
173
|
}
|
|
173
174
|
function sanitizeSymbol_0(_this__u8e3s4) {
|
|
174
175
|
var tmp = asSequence(_this__u8e3s4);
|
|
@@ -182,7 +183,7 @@ function emit_3(type, module_0) {
|
|
|
182
183
|
var _iterator__ex2g4s = this_0.t();
|
|
183
184
|
while (_iterator__ex2g4s.u()) {
|
|
184
185
|
var e = _iterator__ex2g4s.v();
|
|
185
|
-
var key = e.
|
|
186
|
+
var key = e.pu_1;
|
|
186
187
|
if (set.x(key)) {
|
|
187
188
|
list.x(e);
|
|
188
189
|
}
|
|
@@ -193,19 +194,19 @@ function emit_3(type, module_0) {
|
|
|
193
194
|
var _iterator__ex2g4s_0 = list.t();
|
|
194
195
|
while (_iterator__ex2g4s_0.u()) {
|
|
195
196
|
var item = _iterator__ex2g4s_0.v();
|
|
196
|
-
var tmp$ret$2 = 'import {' + item.
|
|
197
|
+
var tmp$ret$2 = 'import {' + item.pu_1 + "} from './" + item.pu_1 + "'";
|
|
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.c1z(type.zo_1) + ' = {\n |' + this.zp(type.ap_1) + '\n |}\n |\n ');
|
|
201
202
|
}
|
|
202
203
|
function emit_4(_this__u8e3s4) {
|
|
203
204
|
var tmp;
|
|
204
205
|
if (_this__u8e3s4 instanceof Dict) {
|
|
205
|
-
tmp = 'Record<string, ' + this.
|
|
206
|
+
tmp = 'Record<string, ' + this.bq(_this__u8e3s4.go_1) + '>';
|
|
206
207
|
} else {
|
|
207
208
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
208
|
-
tmp = this.
|
|
209
|
+
tmp = this.bq(_this__u8e3s4.do_1) + '[]';
|
|
209
210
|
} else {
|
|
210
211
|
if (_this__u8e3s4 instanceof Unit) {
|
|
211
212
|
tmp = 'void';
|
|
@@ -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.u1v(_this__u8e3s4.pu_1);
|
|
218
219
|
} else {
|
|
219
220
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
220
|
-
tmp = this.
|
|
221
|
+
tmp = this.d1z(_this__u8e3s4);
|
|
221
222
|
} else {
|
|
222
223
|
noWhenBranchMatchedException();
|
|
223
224
|
}
|
|
@@ -227,10 +228,10 @@ function emit_4(_this__u8e3s4) {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
// Inline function 'kotlin.let' call
|
|
230
|
-
return tmp + (_this__u8e3s4.
|
|
231
|
+
return tmp + (_this__u8e3s4.hu() ? ' | undefined' : '');
|
|
231
232
|
}
|
|
232
233
|
function emitPrimitive(_this__u8e3s4) {
|
|
233
|
-
var tmp0_subject = _this__u8e3s4.
|
|
234
|
+
var tmp0_subject = _this__u8e3s4.tu_1;
|
|
234
235
|
var tmp;
|
|
235
236
|
if (tmp0_subject instanceof String_0) {
|
|
236
237
|
tmp = 'string';
|
|
@@ -258,10 +259,10 @@ function emitPrimitive(_this__u8e3s4) {
|
|
|
258
259
|
function emit_5(_this__u8e3s4) {
|
|
259
260
|
var tmp;
|
|
260
261
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
261
|
-
tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
262
|
+
tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.dt_1) + '.test(value);';
|
|
262
263
|
} else {
|
|
263
264
|
if (_this__u8e3s4 instanceof Bound) {
|
|
264
|
-
var tmp1_safe_receiver = _this__u8e3s4.
|
|
265
|
+
var tmp1_safe_receiver = _this__u8e3s4.tt_1;
|
|
265
266
|
var tmp_0;
|
|
266
267
|
if (tmp1_safe_receiver == null) {
|
|
267
268
|
tmp_0 = null;
|
|
@@ -270,7 +271,7 @@ function emit_5(_this__u8e3s4) {
|
|
|
270
271
|
tmp_0 = tmp1_safe_receiver + ' < value';
|
|
271
272
|
}
|
|
272
273
|
var minCheck = tmp_0;
|
|
273
|
-
var tmp2_safe_receiver = _this__u8e3s4.
|
|
274
|
+
var tmp2_safe_receiver = _this__u8e3s4.ut_1;
|
|
274
275
|
var tmp_1;
|
|
275
276
|
if (tmp2_safe_receiver == null) {
|
|
276
277
|
tmp_1 = null;
|
|
@@ -298,18 +299,18 @@ function emit_5(_this__u8e3s4) {
|
|
|
298
299
|
return tmp;
|
|
299
300
|
}
|
|
300
301
|
function emit_6(_this__u8e3s4) {
|
|
301
|
-
return joinToString(_this__u8e3s4.
|
|
302
|
+
return joinToString(_this__u8e3s4.wo_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
|
|
302
303
|
}
|
|
303
304
|
function emit_7(_this__u8e3s4) {
|
|
304
|
-
return Spacer_instance.toString() + this.
|
|
305
|
+
return Spacer_instance.toString() + this.br(_this__u8e3s4.ep_1) + ': ' + this.bq(_this__u8e3s4.fp_1);
|
|
305
306
|
}
|
|
306
307
|
initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, TypeScriptIdentifierEmitter]);
|
|
307
308
|
function emitClient(ast) {
|
|
308
|
-
var tmp = 'client.' + this.
|
|
309
|
-
var tmp_0 = this.
|
|
309
|
+
var tmp = 'client.' + this.iq().rq_1;
|
|
310
|
+
var tmp_0 = this.eq(ast);
|
|
310
311
|
var tmp_1 = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda);
|
|
311
312
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
312
|
-
var this_0 = ast.
|
|
313
|
+
var this_0 = ast.fq_1;
|
|
313
314
|
// Inline function 'kotlin.collections.flatMap' call
|
|
314
315
|
var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
|
|
315
316
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
@@ -317,7 +318,7 @@ function emitClient(ast) {
|
|
|
317
318
|
var _iterator__ex2g4s = tmp0.t();
|
|
318
319
|
while (_iterator__ex2g4s.u()) {
|
|
319
320
|
var element = _iterator__ex2g4s.v();
|
|
320
|
-
var list = new NonEmptyList(element.
|
|
321
|
+
var list = new NonEmptyList(element.hq_1);
|
|
321
322
|
addAll(destination, list);
|
|
322
323
|
}
|
|
323
324
|
var tmp$ret$3 = _NonEmptyList___init__impl__fxd0xp(destination);
|
|
@@ -337,42 +338,94 @@ function emitClient(ast) {
|
|
|
337
338
|
var _iterator__ex2g4s_1 = destination_0.t();
|
|
338
339
|
while (_iterator__ex2g4s_1.u()) {
|
|
339
340
|
var e = _iterator__ex2g4s_1.v();
|
|
340
|
-
var key = e.
|
|
341
|
+
var key = e.pu_1;
|
|
341
342
|
if (set.x(key)) {
|
|
342
343
|
list_1.x(e);
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
346
|
var tmp_2 = list_1;
|
|
346
347
|
var tmp_3 = joinToString(tmp_2, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
|
|
347
|
-
var tmp_4 = this.
|
|
348
|
+
var tmp_4 = this.eq(ast);
|
|
348
349
|
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 '));
|
|
349
350
|
}
|
|
350
351
|
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
351
|
-
function emit_8(
|
|
352
|
-
|
|
352
|
+
function emit_8(endpoint) {
|
|
353
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
354
|
+
var this_0 = importReferences(endpoint);
|
|
355
|
+
var set = HashSet_init_$Create$();
|
|
356
|
+
var list = ArrayList_init_$Create$();
|
|
357
|
+
var _iterator__ex2g4s = this_0.t();
|
|
358
|
+
while (_iterator__ex2g4s.u()) {
|
|
359
|
+
var e = _iterator__ex2g4s.v();
|
|
360
|
+
var key = e.pu_1;
|
|
361
|
+
if (set.x(key)) {
|
|
362
|
+
list.x(e);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
// Inline function 'kotlin.collections.map' call
|
|
366
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
367
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
368
|
+
var _iterator__ex2g4s_0 = list.t();
|
|
369
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
370
|
+
var item = _iterator__ex2g4s_0.v();
|
|
371
|
+
var tmp$ret$2 = 'import {type ' + item.pu_1 + "} from '../model'";
|
|
372
|
+
destination.x(tmp$ret$2);
|
|
373
|
+
}
|
|
374
|
+
var tmp = destination;
|
|
375
|
+
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
376
|
+
var tmp_1 = this.c1z(endpoint.ip_1);
|
|
377
|
+
var tmp_2 = get_pathParams(endpoint);
|
|
378
|
+
var tmp_3 = emitType(this, tmp_2, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
379
|
+
var tmp_4 = emitType(this, endpoint.lp_1, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
380
|
+
var tmp_5 = emitType(this, endpoint.mp_1, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
381
|
+
var tmp_6 = emitType_1(this, first(endpoint.np_1), endpoint);
|
|
382
|
+
var tmp_7 = distinctByStatus(endpoint.op_1);
|
|
383
|
+
var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
384
|
+
var tmp_9 = Spacer_instance.toString();
|
|
385
|
+
var tmp_10 = distinctByStatus(endpoint.op_1);
|
|
386
|
+
var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
387
|
+
var tmp_12 = emitFunction_0(this, first(endpoint.np_1), endpoint);
|
|
388
|
+
var tmp_13 = distinctByStatus(endpoint.op_1);
|
|
389
|
+
var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
390
|
+
var tmp_15 = Spacer_instance.toString();
|
|
391
|
+
var tmp_16 = Spacer_instance.vr(2);
|
|
392
|
+
var tmp_17 = emitHandleFunction(this, endpoint);
|
|
393
|
+
var tmp_18 = Spacer_instance.toString();
|
|
394
|
+
var tmp_19 = prependIndent(emitClient_0(this, endpoint), Spacer_instance.vr(1));
|
|
395
|
+
var tmp_20 = prependIndent(emitServer(this, endpoint), Spacer_instance.vr(1));
|
|
396
|
+
var tmp_21 = Spacer_instance.toString();
|
|
397
|
+
var tmp_22 = Spacer_instance.vr(2);
|
|
398
|
+
var tmp_23 = Companion_instance_0.tq(this.c1z(endpoint.ip_1));
|
|
399
|
+
var tmp_24 = Spacer_instance.vr(2);
|
|
400
|
+
var tmp_25 = Spacer_instance.vr(2);
|
|
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.jp_1.a3_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.kp_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.vr(2) + 'server,\n |' + Spacer_instance.vr(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
|
|
402
|
+
}
|
|
403
|
+
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
404
|
+
function emit_9(refined) {
|
|
405
|
+
return trimMargin('\n |export type ' + this.c1z(refined.gr_1) + ' = ' + this.bq(refined.hr_1) + ';\n |export const validate' + refined.gr_1.l1() + ' = (value: ' + this.bq(refined.hr_1) + '): value is ' + this.c1z(refined.gr_1) + ' => {\n |' + this.pr(refined) + '\n |}\n |\n ');
|
|
353
406
|
}
|
|
354
407
|
function emitValidator(_this__u8e3s4) {
|
|
355
408
|
var defaultReturn = Spacer_instance.toString() + 'return true;';
|
|
356
|
-
var type = _this__u8e3s4.
|
|
409
|
+
var type = _this__u8e3s4.hr_1.tu_1;
|
|
357
410
|
var tmp;
|
|
358
411
|
if (type instanceof Integer) {
|
|
359
|
-
var tmp0_safe_receiver = type.
|
|
360
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.
|
|
412
|
+
var tmp0_safe_receiver = type.yt_1;
|
|
413
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.cq(tmp0_safe_receiver);
|
|
361
414
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
362
415
|
} else {
|
|
363
416
|
if (type instanceof Number_0) {
|
|
364
|
-
var tmp2_safe_receiver = type.
|
|
365
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.
|
|
417
|
+
var tmp2_safe_receiver = type.bu_1;
|
|
418
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.cq(tmp2_safe_receiver);
|
|
366
419
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
367
420
|
} else {
|
|
368
421
|
if (type instanceof String_0) {
|
|
369
|
-
var tmp4_safe_receiver = type.
|
|
422
|
+
var tmp4_safe_receiver = type.vt_1;
|
|
370
423
|
var tmp_0;
|
|
371
424
|
var tmp_1 = tmp4_safe_receiver;
|
|
372
425
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
373
426
|
tmp_0 = null;
|
|
374
427
|
} else {
|
|
375
|
-
tmp_0 = this.
|
|
428
|
+
tmp_0 = this.cq(new RegExp_0(tmp4_safe_receiver));
|
|
376
429
|
}
|
|
377
430
|
var tmp5_elvis_lhs = tmp_0;
|
|
378
431
|
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
@@ -392,64 +445,12 @@ function emitValidator(_this__u8e3s4) {
|
|
|
392
445
|
return tmp;
|
|
393
446
|
}
|
|
394
447
|
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
395
|
-
function emit_9(endpoint) {
|
|
396
|
-
// Inline function 'kotlin.collections.distinctBy' call
|
|
397
|
-
var this_0 = importReferences(endpoint);
|
|
398
|
-
var set = HashSet_init_$Create$();
|
|
399
|
-
var list = ArrayList_init_$Create$();
|
|
400
|
-
var _iterator__ex2g4s = this_0.t();
|
|
401
|
-
while (_iterator__ex2g4s.u()) {
|
|
402
|
-
var e = _iterator__ex2g4s.v();
|
|
403
|
-
var key = e.ku_1;
|
|
404
|
-
if (set.x(key)) {
|
|
405
|
-
list.x(e);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
// Inline function 'kotlin.collections.map' call
|
|
409
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
410
|
-
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
411
|
-
var _iterator__ex2g4s_0 = list.t();
|
|
412
|
-
while (_iterator__ex2g4s_0.u()) {
|
|
413
|
-
var item = _iterator__ex2g4s_0.v();
|
|
414
|
-
var tmp$ret$2 = 'import {type ' + item.ku_1 + "} from '../model'";
|
|
415
|
-
destination.x(tmp$ret$2);
|
|
416
|
-
}
|
|
417
|
-
var tmp = destination;
|
|
418
|
-
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
419
|
-
var tmp_1 = this.w1y(endpoint.ep_1);
|
|
420
|
-
var tmp_2 = get_pathParams(endpoint);
|
|
421
|
-
var tmp_3 = emitType(this, tmp_2, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
422
|
-
var tmp_4 = emitType(this, endpoint.hp_1, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
423
|
-
var tmp_5 = emitType(this, endpoint.ip_1, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
424
|
-
var tmp_6 = emitType_1(this, first(endpoint.jp_1), endpoint);
|
|
425
|
-
var tmp_7 = distinctByStatus(endpoint.kp_1);
|
|
426
|
-
var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
427
|
-
var tmp_9 = Spacer_instance.toString();
|
|
428
|
-
var tmp_10 = distinctByStatus(endpoint.kp_1);
|
|
429
|
-
var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
430
|
-
var tmp_12 = emitFunction_0(this, first(endpoint.jp_1), endpoint);
|
|
431
|
-
var tmp_13 = distinctByStatus(endpoint.kp_1);
|
|
432
|
-
var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
433
|
-
var tmp_15 = Spacer_instance.toString();
|
|
434
|
-
var tmp_16 = Spacer_instance.qr(2);
|
|
435
|
-
var tmp_17 = emitHandleFunction(this, endpoint);
|
|
436
|
-
var tmp_18 = Spacer_instance.toString();
|
|
437
|
-
var tmp_19 = prependIndent(emitClient_0(this, endpoint), Spacer_instance.qr(1));
|
|
438
|
-
var tmp_20 = prependIndent(emitServer(this, endpoint), Spacer_instance.qr(1));
|
|
439
|
-
var tmp_21 = Spacer_instance.toString();
|
|
440
|
-
var tmp_22 = Spacer_instance.qr(2);
|
|
441
|
-
var tmp_23 = Companion_instance_0.pq(this.w1y(endpoint.ep_1));
|
|
442
|
-
var tmp_24 = Spacer_instance.qr(2);
|
|
443
|
-
var tmp_25 = Spacer_instance.qr(2);
|
|
444
|
-
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 ');
|
|
445
|
-
}
|
|
446
|
-
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
447
448
|
function emit_10(enum_0, module_0) {
|
|
448
|
-
var tmp = this.
|
|
449
|
-
return 'export type ' + tmp + ' = ' + joinToString(enum_0.
|
|
449
|
+
var tmp = this.c1z(enum_0.lr_1);
|
|
450
|
+
return 'export type ' + tmp + ' = ' + joinToString(enum_0.mr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
450
451
|
}
|
|
451
452
|
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
452
|
-
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter,
|
|
453
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptClientEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptIdentifierEmitter]);
|
|
453
454
|
initMetadataForClass(EndpointParam, 'EndpointParam');
|
|
454
455
|
initMetadataForCompanion(Companion);
|
|
455
456
|
initMetadataForClass(TypeScriptIrEmitter, 'TypeScriptIrEmitter', TypeScriptIrEmitter, VOID, [IrEmitter]);
|
|
@@ -485,10 +486,10 @@ function emitClientInterface($this, _this__u8e3s4, endpoint) {
|
|
|
485
486
|
return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
486
487
|
}
|
|
487
488
|
function emitFunction($this, endpoint, request) {
|
|
488
|
-
var tmp = endpoint.
|
|
489
|
+
var tmp = endpoint.ip_1.l1();
|
|
489
490
|
var tmp_0 = emitClientInterface($this, request, endpoint);
|
|
490
491
|
var tmp_1 = Spacer_instance.toString();
|
|
491
|
-
var tmp_2 = endpoint.
|
|
492
|
+
var tmp_2 = endpoint.ip_1.l1();
|
|
492
493
|
// Inline function 'kotlin.takeIf' call
|
|
493
494
|
var this_0 = paramList(request, endpoint);
|
|
494
495
|
var tmp_3;
|
|
@@ -508,31 +509,31 @@ function emitFunction($this, endpoint, request) {
|
|
|
508
509
|
// Inline function 'kotlin.text.orEmpty' call
|
|
509
510
|
var tmp0_elvis_lhs = tmp_4;
|
|
510
511
|
var tmp$ret$5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
511
|
-
return trimMargin('\n |' + tmp + ': async (' + tmp_0 + ') => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.
|
|
512
|
+
return trimMargin('\n |' + tmp + ': async (' + tmp_0 + ') => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.ip_1.l1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.ip_1.l1() + '.client(serialization).from(rawResponse)\n |},\n ');
|
|
512
513
|
}
|
|
513
514
|
function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
|
|
514
|
-
var endpoint = _destruct__k2r9zo.
|
|
515
|
-
return 'import {' + endpoint.
|
|
515
|
+
var endpoint = _destruct__k2r9zo.qe();
|
|
516
|
+
return 'import {' + endpoint.ip_1.l1() + '} from "./endpoint/' + endpoint.ip_1.l1() + '"';
|
|
516
517
|
}
|
|
517
518
|
function TypeScriptClientEmitter$emitClient$lambda_0(it) {
|
|
518
|
-
return 'import {type ' + it.
|
|
519
|
+
return 'import {type ' + it.pu_1 + '} from "./model/' + it.pu_1 + '"';
|
|
519
520
|
}
|
|
520
521
|
function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
521
522
|
return function (_destruct__k2r9zo) {
|
|
522
|
-
var endpoint = _destruct__k2r9zo.
|
|
523
|
-
var request = _destruct__k2r9zo.
|
|
523
|
+
var endpoint = _destruct__k2r9zo.qe();
|
|
524
|
+
var request = _destruct__k2r9zo.re();
|
|
524
525
|
return emitFunction(this$0, endpoint, request);
|
|
525
526
|
};
|
|
526
527
|
}
|
|
527
528
|
function TypeScriptClientEmitter$emitClientInterface$lambda(this$0) {
|
|
528
529
|
return function (it) {
|
|
529
|
-
return this$0.
|
|
530
|
+
return this$0.br(it.nq_1) + ': ' + this$0.bq(it.oq_1);
|
|
530
531
|
};
|
|
531
532
|
}
|
|
532
533
|
function TypeScriptClientEmitter() {
|
|
533
534
|
}
|
|
534
535
|
function TypeScriptEmitter$emit$lambda(it) {
|
|
535
|
-
return 'export {' + it.
|
|
536
|
+
return 'export {' + it.ar().l1() + "} from './" + it.ar().l1() + "'";
|
|
536
537
|
}
|
|
537
538
|
function TypeScriptEmitter$emit$lambda_0(it) {
|
|
538
539
|
// Inline function 'kotlin.text.trimStart' call
|
|
@@ -540,36 +541,36 @@ function TypeScriptEmitter$emit$lambda_0(it) {
|
|
|
540
541
|
}
|
|
541
542
|
function TypeScriptEmitter$emit$lambda_1(this$0) {
|
|
542
543
|
return function (it) {
|
|
543
|
-
return this$0.
|
|
544
|
+
return this$0.bq(it);
|
|
544
545
|
};
|
|
545
546
|
}
|
|
546
547
|
function TypeScriptEmitter() {
|
|
547
548
|
LanguageEmitter.call(this);
|
|
548
|
-
this.
|
|
549
|
-
this.
|
|
550
|
-
this.
|
|
549
|
+
this.e1z_1 = FileExtension_TypeScript_getInstance();
|
|
550
|
+
this.f1z_1 = TypeScriptShared_getInstance();
|
|
551
|
+
this.g1z_1 = '//';
|
|
551
552
|
}
|
|
552
|
-
protoOf(TypeScriptEmitter).
|
|
553
|
-
return this.
|
|
553
|
+
protoOf(TypeScriptEmitter).iq = function () {
|
|
554
|
+
return this.e1z_1;
|
|
554
555
|
};
|
|
555
|
-
protoOf(TypeScriptEmitter).
|
|
556
|
-
return this.
|
|
556
|
+
protoOf(TypeScriptEmitter).r1v = function () {
|
|
557
|
+
return this.f1z_1;
|
|
557
558
|
};
|
|
558
|
-
protoOf(TypeScriptEmitter).
|
|
559
|
-
return this.
|
|
559
|
+
protoOf(TypeScriptEmitter).jq = function () {
|
|
560
|
+
return this.g1z_1;
|
|
560
561
|
};
|
|
561
|
-
protoOf(TypeScriptEmitter).
|
|
562
|
+
protoOf(TypeScriptEmitter).sn = function (ast, logger) {
|
|
562
563
|
// Inline function 'kotlin.run' call
|
|
563
|
-
var $this$run = protoOf(LanguageEmitter).
|
|
564
|
+
var $this$run = protoOf(LanguageEmitter).sn.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.b1z(ast));
|
|
567
568
|
} else {
|
|
568
569
|
tmp = $this$run;
|
|
569
570
|
}
|
|
570
571
|
var tmp_0 = tmp;
|
|
571
572
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
572
|
-
var this_0 = ast.
|
|
573
|
+
var this_0 = ast.fq_1;
|
|
573
574
|
// Inline function 'kotlin.collections.flatMap' call
|
|
574
575
|
var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
|
|
575
576
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
@@ -577,7 +578,7 @@ protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
|
577
578
|
var _iterator__ex2g4s = tmp0.t();
|
|
578
579
|
while (_iterator__ex2g4s.u()) {
|
|
579
580
|
var element = _iterator__ex2g4s.v();
|
|
580
|
-
var list = new NonEmptyList(element.
|
|
581
|
+
var list = new NonEmptyList(element.hq_1);
|
|
581
582
|
addAll(destination, list);
|
|
582
583
|
}
|
|
583
584
|
var tmp$ret$5 = _NonEmptyList___init__impl__fxd0xp(destination);
|
|
@@ -594,7 +595,7 @@ protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
|
594
595
|
var tmp_1;
|
|
595
596
|
if (value == null) {
|
|
596
597
|
var answer = ArrayList_init_$Create$();
|
|
597
|
-
destination_0.
|
|
598
|
+
destination_0.s2(key, answer);
|
|
598
599
|
tmp_1 = answer;
|
|
599
600
|
} else {
|
|
600
601
|
tmp_1 = value;
|
|
@@ -613,24 +614,24 @@ protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
|
613
614
|
var ns = item.k1();
|
|
614
615
|
// Inline function 'kotlin.collections.component2' call
|
|
615
616
|
var defs = item.l1();
|
|
616
|
-
var tmp_2 = ns + '/index.' + this.
|
|
617
|
+
var tmp_2 = ns + '/index.' + this.iq().rq_1;
|
|
617
618
|
var tmp$ret$14 = new Emitted(tmp_2, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
|
|
618
619
|
destination_1.x(tmp$ret$14);
|
|
619
620
|
}
|
|
620
621
|
return NonEmptyList__plus_impl_xqmb9_0(tmp_0, destination_1);
|
|
621
622
|
};
|
|
622
|
-
protoOf(TypeScriptEmitter).
|
|
623
|
+
protoOf(TypeScriptEmitter).yq = function (module_0, logger) {
|
|
623
624
|
// Inline function 'kotlin.let' call
|
|
624
|
-
var it = protoOf(LanguageEmitter).
|
|
625
|
-
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.
|
|
625
|
+
var it = protoOf(LanguageEmitter).yq.call(this, module_0, logger);
|
|
626
|
+
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.r1v().i1z_1));
|
|
626
627
|
};
|
|
627
|
-
protoOf(TypeScriptEmitter).
|
|
628
|
+
protoOf(TypeScriptEmitter).zq = function (definition, module_0, logger) {
|
|
628
629
|
// Inline function 'kotlin.let' call
|
|
629
|
-
var it = protoOf(LanguageEmitter).
|
|
630
|
-
var subPackageName = plus(Companion_instance.
|
|
631
|
-
return new Emitted(subPackageName.
|
|
630
|
+
var it = protoOf(LanguageEmitter).zq.call(this, definition, module_0, logger);
|
|
631
|
+
var subPackageName = plus(Companion_instance.qr(''), definition);
|
|
632
|
+
return new Emitted(subPackageName.tr() + this.u1v(it.mo_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.no_1 + '\n '));
|
|
632
633
|
};
|
|
633
|
-
protoOf(TypeScriptEmitter).
|
|
634
|
+
protoOf(TypeScriptEmitter).dr = function (union) {
|
|
634
635
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
635
636
|
var this_0 = importReferences(union);
|
|
636
637
|
var set = HashSet_init_$Create$();
|
|
@@ -638,7 +639,7 @@ protoOf(TypeScriptEmitter).yq = function (union) {
|
|
|
638
639
|
var _iterator__ex2g4s = this_0.t();
|
|
639
640
|
while (_iterator__ex2g4s.u()) {
|
|
640
641
|
var e = _iterator__ex2g4s.v();
|
|
641
|
-
var key = e.
|
|
642
|
+
var key = e.pu_1;
|
|
642
643
|
if (set.x(key)) {
|
|
643
644
|
list.x(e);
|
|
644
645
|
}
|
|
@@ -649,24 +650,24 @@ protoOf(TypeScriptEmitter).yq = function (union) {
|
|
|
649
650
|
var _iterator__ex2g4s_0 = list.t();
|
|
650
651
|
while (_iterator__ex2g4s_0.u()) {
|
|
651
652
|
var item = _iterator__ex2g4s_0.v();
|
|
652
|
-
var tmp$ret$2 = 'import {type ' + item.
|
|
653
|
+
var tmp$ret$2 = 'import {type ' + item.pu_1 + "} from '../model'";
|
|
653
654
|
destination.x(tmp$ret$2);
|
|
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
|
-
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.
|
|
658
|
+
var tmp_1 = this.c1z(union.uo_1);
|
|
659
|
+
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.vo_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
|
|
659
660
|
};
|
|
660
|
-
protoOf(TypeScriptEmitter).
|
|
661
|
-
return this.
|
|
661
|
+
protoOf(TypeScriptEmitter).cr = function (channel) {
|
|
662
|
+
return this.kq();
|
|
662
663
|
};
|
|
663
664
|
function emit_11($this, _this__u8e3s4) {
|
|
664
665
|
var tmp;
|
|
665
666
|
if (_this__u8e3s4 instanceof Literal) {
|
|
666
|
-
tmp = _this__u8e3s4.
|
|
667
|
+
tmp = _this__u8e3s4.lq_1;
|
|
667
668
|
} else {
|
|
668
669
|
if (_this__u8e3s4 instanceof Param) {
|
|
669
|
-
tmp = ':' + _this__u8e3s4.
|
|
670
|
+
tmp = ':' + _this__u8e3s4.pp_1.l1();
|
|
670
671
|
} else {
|
|
671
672
|
noWhenBranchMatchedException();
|
|
672
673
|
}
|
|
@@ -674,64 +675,64 @@ function emit_11($this, _this__u8e3s4) {
|
|
|
674
675
|
return tmp;
|
|
675
676
|
}
|
|
676
677
|
function emitClient_0($this, _this__u8e3s4) {
|
|
677
|
-
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo($this, _this__u8e3s4), Spacer_instance.
|
|
678
|
+
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo($this, _this__u8e3s4), Spacer_instance.vr(1)) + ',\n |' + prependIndent(emitClientFrom($this, _this__u8e3s4), Spacer_instance.vr(1)) + '\n |})\n ');
|
|
678
679
|
}
|
|
679
680
|
function emitClientTo($this, _this__u8e3s4) {
|
|
680
|
-
var tmp = Spacer_instance.
|
|
681
|
+
var tmp = Spacer_instance.vr(1);
|
|
681
682
|
// Inline function 'kotlin.text.uppercase' call
|
|
682
683
|
// Inline function 'kotlin.js.asDynamic' call
|
|
683
|
-
var tmp_0 = _this__u8e3s4.
|
|
684
|
-
var tmp_1 = Spacer_instance.
|
|
684
|
+
var tmp_0 = _this__u8e3s4.jp_1.a3_1.toUpperCase();
|
|
685
|
+
var tmp_1 = Spacer_instance.vr(1);
|
|
685
686
|
var tmp_2 = emitPathArray($this, _this__u8e3s4);
|
|
686
|
-
var tmp_3 = Spacer_instance.
|
|
687
|
-
var tmp_4 = joinToString(_this__u8e3s4.
|
|
688
|
-
var tmp_5 = Spacer_instance.
|
|
689
|
-
return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
687
|
+
var tmp_3 = Spacer_instance.vr(1);
|
|
688
|
+
var tmp_4 = joinToString(_this__u8e3s4.lp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
|
|
689
|
+
var tmp_5 = Spacer_instance.vr(1);
|
|
690
|
+
return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.mp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.vr(1) + 'body: serialization.serialize(it.body)\n |})\n ');
|
|
690
691
|
}
|
|
691
692
|
function emitClientFrom($this, _this__u8e3s4) {
|
|
692
|
-
var tmp = Spacer_instance.
|
|
693
|
-
var tmp_0 = distinctByStatus(_this__u8e3s4.
|
|
694
|
-
return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.
|
|
693
|
+
var tmp = Spacer_instance.vr(1);
|
|
694
|
+
var tmp_0 = distinctByStatus(_this__u8e3s4.op_1);
|
|
695
|
+
return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.vr(2)) + '\n |' + Spacer_instance.vr(2) + 'default:\n |' + Spacer_instance.vr(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.vr(1) + '}\n |}\n ');
|
|
695
696
|
}
|
|
696
697
|
function emitClientFromResponse($this, _this__u8e3s4) {
|
|
697
|
-
var tmp = fixStatus(_this__u8e3s4.
|
|
698
|
-
var tmp_0 = Spacer_instance.
|
|
699
|
-
var tmp_1 = Spacer_instance.
|
|
700
|
-
var tmp_2 = fixStatus(_this__u8e3s4.
|
|
701
|
-
var tmp_3 = Spacer_instance.
|
|
702
|
-
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
698
|
+
var tmp = fixStatus(_this__u8e3s4.up_1);
|
|
699
|
+
var tmp_0 = Spacer_instance.vr(1);
|
|
700
|
+
var tmp_1 = Spacer_instance.vr(2);
|
|
701
|
+
var tmp_2 = fixStatus(_this__u8e3s4.up_1);
|
|
702
|
+
var tmp_3 = Spacer_instance.vr(2);
|
|
703
|
+
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.vp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.vr(2) + 'body: serialization.deserialize<' + emitReference($this, _this__u8e3s4) + '>(it.body)\n |' + Spacer_instance.vr(1) + '};\n ');
|
|
703
704
|
}
|
|
704
705
|
function emitServer($this, _this__u8e3s4) {
|
|
705
|
-
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom($this, _this__u8e3s4), Spacer_instance.
|
|
706
|
+
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom($this, _this__u8e3s4), Spacer_instance.vr(1)) + ',\n |' + prependIndent(emitServerTo($this, _this__u8e3s4), Spacer_instance.vr(1)) + '\n |})\n ');
|
|
706
707
|
}
|
|
707
708
|
function emitServerFrom($this, _this__u8e3s4) {
|
|
708
|
-
var tmp = Spacer_instance.
|
|
709
|
-
var tmp_0 = Spacer_instance.
|
|
709
|
+
var tmp = Spacer_instance.vr(1);
|
|
710
|
+
var tmp_0 = Spacer_instance.vr(2);
|
|
710
711
|
// Inline function 'kotlin.text.uppercase' call
|
|
711
712
|
// Inline function 'kotlin.js.asDynamic' call
|
|
712
|
-
var tmp_1 = _this__u8e3s4.
|
|
713
|
-
var tmp_2 = Spacer_instance.
|
|
713
|
+
var tmp_1 = _this__u8e3s4.jp_1.a3_1.toUpperCase();
|
|
714
|
+
var tmp_2 = Spacer_instance.vr(2);
|
|
714
715
|
var tmp_3 = get_indexedPathParams(_this__u8e3s4);
|
|
715
|
-
var tmp_4 = prependIndent(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.
|
|
716
|
-
var tmp_5 = Spacer_instance.
|
|
717
|
-
var tmp_6 = Spacer_instance.
|
|
718
|
-
var tmp_7 = joinToString(_this__u8e3s4.
|
|
719
|
-
var tmp_8 = Spacer_instance.
|
|
720
|
-
var tmp_9 = Spacer_instance.
|
|
721
|
-
return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.
|
|
716
|
+
var tmp_4 = prependIndent(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.vr(3));
|
|
717
|
+
var tmp_5 = Spacer_instance.vr(2);
|
|
718
|
+
var tmp_6 = Spacer_instance.vr(2);
|
|
719
|
+
var tmp_7 = joinToString(_this__u8e3s4.lp_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
|
|
720
|
+
var tmp_8 = Spacer_instance.vr(2);
|
|
721
|
+
var tmp_9 = Spacer_instance.vr(2);
|
|
722
|
+
return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.mp_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.vr(2) + '},\n |' + Spacer_instance.vr(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.vr(1) + '}\n |}\n ');
|
|
722
723
|
}
|
|
723
724
|
function emitServerTo($this, _this__u8e3s4) {
|
|
724
|
-
var tmp = Spacer_instance.
|
|
725
|
-
var tmp_0 = distinctByStatus(_this__u8e3s4.
|
|
726
|
-
return trimMargin('\n |to: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda($this)), Spacer_instance.
|
|
725
|
+
var tmp = Spacer_instance.vr(1);
|
|
726
|
+
var tmp_0 = distinctByStatus(_this__u8e3s4.op_1);
|
|
727
|
+
return trimMargin('\n |to: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda($this)), Spacer_instance.vr(2)) + '\n |' + Spacer_instance.vr(1) + '}\n |}\n ');
|
|
727
728
|
}
|
|
728
729
|
function emitServerToResponse($this, _this__u8e3s4) {
|
|
729
|
-
var tmp = fixStatus(_this__u8e3s4.
|
|
730
|
-
var tmp_0 = Spacer_instance.
|
|
731
|
-
var tmp_1 = Spacer_instance.
|
|
732
|
-
var tmp_2 = fixStatus(_this__u8e3s4.
|
|
733
|
-
var tmp_3 = Spacer_instance.
|
|
734
|
-
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {\n |' + prependIndent(joinToString(_this__u8e3s4.
|
|
730
|
+
var tmp = fixStatus(_this__u8e3s4.up_1);
|
|
731
|
+
var tmp_0 = Spacer_instance.vr(1);
|
|
732
|
+
var tmp_1 = Spacer_instance.vr(2);
|
|
733
|
+
var tmp_2 = fixStatus(_this__u8e3s4.up_1);
|
|
734
|
+
var tmp_3 = Spacer_instance.vr(2);
|
|
735
|
+
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {\n |' + prependIndent(joinToString(_this__u8e3s4.vp_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerToResponse$lambda($this)), Spacer_instance.vr(3)) + '\n |' + Spacer_instance.vr(2) + '} as Record<string, string>,\n |' + Spacer_instance.vr(2) + 'body: serialization.serialize(it.body),\n |' + Spacer_instance.vr(1) + '};\n ');
|
|
735
736
|
}
|
|
736
737
|
function emitType($this, _this__u8e3s4, name, block) {
|
|
737
738
|
var tmp;
|
|
@@ -744,7 +745,7 @@ function emitType($this, _this__u8e3s4, name, block) {
|
|
|
744
745
|
return tmp;
|
|
745
746
|
}
|
|
746
747
|
function emitName($this, _this__u8e3s4) {
|
|
747
|
-
return 'Response' + Companion_instance_0.
|
|
748
|
+
return 'Response' + Companion_instance_0.sq(_this__u8e3s4.up_1);
|
|
748
749
|
}
|
|
749
750
|
function emitFunction_0($this, _this__u8e3s4, endpoint) {
|
|
750
751
|
var tmp = Spacer_instance.toString();
|
|
@@ -770,18 +771,18 @@ function emitFunction_0($this, _this__u8e3s4, endpoint) {
|
|
|
770
771
|
// Inline function 'kotlin.text.orEmpty' call
|
|
771
772
|
var tmp0_elvis_lhs = tmp_4;
|
|
772
773
|
var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
773
|
-
var tmp_6 = Spacer_instance.
|
|
774
|
+
var tmp_6 = Spacer_instance.vr(2);
|
|
774
775
|
var tmp_7 = get_pathParams(endpoint);
|
|
775
776
|
var tmp_8 = joinToObject($this, tmp_7, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
|
|
776
|
-
var tmp_9 = Spacer_instance.
|
|
777
|
-
var tmp_10 = endpoint.
|
|
778
|
-
var tmp_11 = Spacer_instance.
|
|
779
|
-
var tmp_12 = joinToObject($this, endpoint.
|
|
780
|
-
var tmp_13 = Spacer_instance.
|
|
781
|
-
var tmp_14 = joinToObject($this, endpoint.
|
|
782
|
-
var tmp_15 = Spacer_instance.
|
|
777
|
+
var tmp_9 = Spacer_instance.vr(2);
|
|
778
|
+
var tmp_10 = endpoint.jp_1.toString();
|
|
779
|
+
var tmp_11 = Spacer_instance.vr(2);
|
|
780
|
+
var tmp_12 = joinToObject($this, endpoint.lp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
|
|
781
|
+
var tmp_13 = Spacer_instance.vr(2);
|
|
782
|
+
var tmp_14 = joinToObject($this, endpoint.mp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
|
|
783
|
+
var tmp_15 = Spacer_instance.vr(2);
|
|
783
784
|
var tmp_16;
|
|
784
|
-
if (_this__u8e3s4.
|
|
785
|
+
if (_this__u8e3s4.rp_1 == null) {
|
|
785
786
|
tmp_16 = null;
|
|
786
787
|
} else {
|
|
787
788
|
// Inline function 'kotlin.let' call
|
|
@@ -792,11 +793,11 @@ function emitFunction_0($this, _this__u8e3s4, endpoint) {
|
|
|
792
793
|
}
|
|
793
794
|
function emitFunction_1($this, _this__u8e3s4) {
|
|
794
795
|
var tmp = Spacer_instance.toString();
|
|
795
|
-
var tmp_0 = Companion_instance_0.
|
|
796
|
+
var tmp_0 = Companion_instance_0.sq(_this__u8e3s4.up_1);
|
|
796
797
|
var tmp_1 = paramList_0(_this__u8e3s4);
|
|
797
798
|
var tmp_2 = joinToObject($this, tmp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
|
|
798
799
|
var tmp_3 = Spacer_instance.toString();
|
|
799
|
-
var tmp_4 = Companion_instance_0.
|
|
800
|
+
var tmp_4 = Companion_instance_0.sq(_this__u8e3s4.up_1);
|
|
800
801
|
// Inline function 'kotlin.takeIf' call
|
|
801
802
|
var this_0 = paramList_0(_this__u8e3s4);
|
|
802
803
|
var tmp_5;
|
|
@@ -811,19 +812,19 @@ function emitFunction_1($this, _this__u8e3s4) {
|
|
|
811
812
|
tmp_6 = null;
|
|
812
813
|
} else {
|
|
813
814
|
// Inline function 'kotlin.run' call
|
|
814
|
-
tmp_6 = 'params: Response' + Companion_instance_0.
|
|
815
|
+
tmp_6 = 'params: Response' + Companion_instance_0.sq(_this__u8e3s4.up_1) + 'Params';
|
|
815
816
|
}
|
|
816
817
|
// Inline function 'kotlin.text.orEmpty' call
|
|
817
818
|
var tmp0_elvis_lhs = tmp_6;
|
|
818
819
|
var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
819
|
-
var tmp_8 = Companion_instance_0.
|
|
820
|
-
var tmp_9 = Spacer_instance.
|
|
821
|
-
var tmp_10 = fixStatus(_this__u8e3s4.
|
|
822
|
-
var tmp_11 = Spacer_instance.
|
|
823
|
-
var tmp_12 = joinToObject($this, _this__u8e3s4.
|
|
824
|
-
var tmp_13 = Spacer_instance.
|
|
820
|
+
var tmp_8 = Companion_instance_0.sq(_this__u8e3s4.up_1);
|
|
821
|
+
var tmp_9 = Spacer_instance.vr(2);
|
|
822
|
+
var tmp_10 = fixStatus(_this__u8e3s4.up_1);
|
|
823
|
+
var tmp_11 = Spacer_instance.vr(2);
|
|
824
|
+
var tmp_12 = joinToObject($this, _this__u8e3s4.vp_1, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
|
|
825
|
+
var tmp_13 = Spacer_instance.vr(2);
|
|
825
826
|
var tmp_14;
|
|
826
|
-
if (_this__u8e3s4.
|
|
827
|
+
if (_this__u8e3s4.wp_1 == null) {
|
|
827
828
|
tmp_14 = null;
|
|
828
829
|
} else {
|
|
829
830
|
// Inline function 'kotlin.let' call
|
|
@@ -833,55 +834,55 @@ function emitFunction_1($this, _this__u8e3s4) {
|
|
|
833
834
|
return trimMargin('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
|
|
834
835
|
}
|
|
835
836
|
function emitReference($this, _this__u8e3s4) {
|
|
836
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
837
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
838
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
837
|
+
var tmp0_safe_receiver = _this__u8e3s4.wp_1;
|
|
838
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.tp_1;
|
|
839
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.bq(tmp1_safe_receiver);
|
|
839
840
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
840
841
|
}
|
|
841
842
|
function emitPathArray($this, _this__u8e3s4) {
|
|
842
|
-
return joinToString(_this__u8e3s4.
|
|
843
|
+
return joinToString(_this__u8e3s4.kp_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
|
|
843
844
|
}
|
|
844
845
|
function emitType_0($this, _this__u8e3s4) {
|
|
845
846
|
var tmp = Spacer_instance.toString();
|
|
846
847
|
var tmp_0 = emitName($this, _this__u8e3s4);
|
|
847
|
-
var tmp_1 = Spacer_instance.
|
|
848
|
-
var tmp_2 = fixStatus(_this__u8e3s4.
|
|
849
|
-
var tmp_3 = Spacer_instance.
|
|
850
|
-
return trimMargin('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
848
|
+
var tmp_1 = Spacer_instance.vr(2);
|
|
849
|
+
var tmp_2 = fixStatus(_this__u8e3s4.up_1);
|
|
850
|
+
var tmp_3 = Spacer_instance.vr(2);
|
|
851
|
+
return trimMargin('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.vp_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.vr(2) + 'body: ' + emitReference($this, _this__u8e3s4) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
851
852
|
}
|
|
852
853
|
function emitReference_0($this, _this__u8e3s4) {
|
|
853
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
854
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
855
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
854
|
+
var tmp0_safe_receiver = _this__u8e3s4.rp_1;
|
|
855
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.tp_1;
|
|
856
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.bq(tmp1_safe_receiver);
|
|
856
857
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
857
858
|
}
|
|
858
859
|
function emitType_1($this, _this__u8e3s4, endpoint) {
|
|
859
|
-
return trimMargin('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.
|
|
860
|
+
return trimMargin('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.vr(2) + 'path: Path\n |' + Spacer_instance.vr(2) + 'method: "' + endpoint.jp_1.toString() + '"\n |' + Spacer_instance.vr(2) + 'queries: Queries\n |' + Spacer_instance.vr(2) + 'headers: Headers\n |' + Spacer_instance.vr(2) + 'body: ' + emitReference_0($this, _this__u8e3s4) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
860
861
|
}
|
|
861
862
|
function emit_12($this, _this__u8e3s4) {
|
|
862
|
-
return Spacer_instance.toString() + $this.
|
|
863
|
+
return Spacer_instance.toString() + $this.br(_this__u8e3s4.pp_1) + ': ' + $this.bq(_this__u8e3s4.qp_1);
|
|
863
864
|
}
|
|
864
865
|
function emit_13($this, _this__u8e3s4) {
|
|
865
|
-
return $this.
|
|
866
|
+
return $this.br(_this__u8e3s4.nq_1) + (_this__u8e3s4.oq_1.hu() ? '?' : '') + ': ' + $this.bq(_this__u8e3s4.oq_1.ju(false));
|
|
866
867
|
}
|
|
867
868
|
function emitDeserialize($this, _this__u8e3s4) {
|
|
868
|
-
return $this.
|
|
869
|
+
return $this.br(_this__u8e3s4.pe_1.pp_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.oe_1 + '])';
|
|
869
870
|
}
|
|
870
871
|
function emitDeserialize_0($this, _this__u8e3s4, fields, caseSensitive) {
|
|
871
|
-
return caseSensitive ? $this.
|
|
872
|
+
return caseSensitive ? $this.br(_this__u8e3s4.ep_1) + ': serialization.deserialize(it.' + fields + '[' + $this.br(_this__u8e3s4.ep_1) + '])' : $this.br(_this__u8e3s4.ep_1) + ': serialization.deserialize(Object.entries(it.' + fields + ').find(([key]) => key.toLowerCase() === ' + $this.br(lowercase($this, _this__u8e3s4.ep_1)) + ')?.[1])';
|
|
872
873
|
}
|
|
873
874
|
function emitDeserialize$default($this, _this__u8e3s4, fields, caseSensitive, $super) {
|
|
874
875
|
caseSensitive = caseSensitive === VOID ? true : caseSensitive;
|
|
875
876
|
return emitDeserialize_0($this, _this__u8e3s4, fields, caseSensitive);
|
|
876
877
|
}
|
|
877
878
|
function emitSerialize($this, _this__u8e3s4, fields) {
|
|
878
|
-
return $this.
|
|
879
|
+
return $this.br(_this__u8e3s4.ep_1) + ': serialization.serialize(it.' + fields + '[' + $this.br(_this__u8e3s4.ep_1) + '])';
|
|
879
880
|
}
|
|
880
881
|
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.
|
|
885
|
+
return Companion_instance_0.tq($this.c1z(endpoint.ip_1)) + ': (request:Request) => Promise<Response>';
|
|
885
886
|
}
|
|
886
887
|
function lowercase($this, _this__u8e3s4) {
|
|
887
888
|
// Inline function 'kotlin.text.lowercase' call
|
|
@@ -900,12 +901,12 @@ function TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this$0) {
|
|
|
900
901
|
}
|
|
901
902
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
902
903
|
return function (it) {
|
|
903
|
-
return this$0.
|
|
904
|
+
return this$0.aq(it);
|
|
904
905
|
};
|
|
905
906
|
}
|
|
906
907
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
907
908
|
return function (it) {
|
|
908
|
-
return this$0.
|
|
909
|
+
return this$0.aq(it);
|
|
909
910
|
};
|
|
910
911
|
}
|
|
911
912
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
@@ -955,12 +956,12 @@ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda(this$0) {
|
|
|
955
956
|
}
|
|
956
957
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0(this$0) {
|
|
957
958
|
return function (it) {
|
|
958
|
-
return prependIndent(emitDeserialize$default(this$0, it, 'queries'), Spacer_instance.
|
|
959
|
+
return prependIndent(emitDeserialize$default(this$0, it, 'queries'), Spacer_instance.vr(3));
|
|
959
960
|
};
|
|
960
961
|
}
|
|
961
962
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1(this$0) {
|
|
962
963
|
return function (it) {
|
|
963
|
-
return prependIndent(emitDeserialize_0(this$0, it, 'headers', false), Spacer_instance.
|
|
964
|
+
return prependIndent(emitDeserialize_0(this$0, it, 'headers', false), Spacer_instance.vr(3));
|
|
964
965
|
};
|
|
965
966
|
}
|
|
966
967
|
function TypeScriptEndpointDefinitionEmitter$emitServerTo$lambda(this$0) {
|
|
@@ -975,7 +976,7 @@ function TypeScriptEndpointDefinitionEmitter$emitServerToResponse$lambda(this$0)
|
|
|
975
976
|
}
|
|
976
977
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda($block) {
|
|
977
978
|
return function (it) {
|
|
978
|
-
return Spacer_instance.
|
|
979
|
+
return Spacer_instance.vr(1) + $block(it);
|
|
979
980
|
};
|
|
980
981
|
}
|
|
981
982
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
@@ -985,17 +986,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
|
985
986
|
}
|
|
986
987
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0(this$0) {
|
|
987
988
|
return function (it) {
|
|
988
|
-
return this$0.
|
|
989
|
+
return this$0.br(it.pp_1) + ': params[' + this$0.br(it.pp_1) + ']';
|
|
989
990
|
};
|
|
990
991
|
}
|
|
991
992
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1(this$0) {
|
|
992
993
|
return function (it) {
|
|
993
|
-
return this$0.
|
|
994
|
+
return this$0.br(it.ep_1) + ': params[' + this$0.br(it.ep_1) + ']';
|
|
994
995
|
};
|
|
995
996
|
}
|
|
996
997
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2(this$0) {
|
|
997
998
|
return function (it) {
|
|
998
|
-
return this$0.
|
|
999
|
+
return this$0.br(it.ep_1) + ': params[' + this$0.br(it.ep_1) + ']';
|
|
999
1000
|
};
|
|
1000
1001
|
}
|
|
1001
1002
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
@@ -1005,17 +1006,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
|
1005
1006
|
}
|
|
1006
1007
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4(this$0) {
|
|
1007
1008
|
return function (it) {
|
|
1008
|
-
return this$0.
|
|
1009
|
+
return this$0.br(it.ep_1) + ': params[' + this$0.br(it.ep_1) + ']';
|
|
1009
1010
|
};
|
|
1010
1011
|
}
|
|
1011
1012
|
function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
1012
1013
|
return function (it) {
|
|
1013
1014
|
var tmp;
|
|
1014
1015
|
if (it instanceof Literal) {
|
|
1015
|
-
tmp = '"' + it.
|
|
1016
|
+
tmp = '"' + it.lq_1 + '"';
|
|
1016
1017
|
} else {
|
|
1017
1018
|
if (it instanceof Param) {
|
|
1018
|
-
tmp = 'serialization.serialize(it.path[' + this$0.
|
|
1019
|
+
tmp = 'serialization.serialize(it.path[' + this$0.br(it.pp_1) + '])';
|
|
1019
1020
|
} else {
|
|
1020
1021
|
noWhenBranchMatchedException();
|
|
1021
1022
|
}
|
|
@@ -1025,7 +1026,7 @@ function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
|
1025
1026
|
}
|
|
1026
1027
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda_0(this$0) {
|
|
1027
1028
|
return function (it) {
|
|
1028
|
-
return this$0.
|
|
1029
|
+
return this$0.br(it.ep_1) + ': ' + this$0.bq(it.fp_1);
|
|
1029
1030
|
};
|
|
1030
1031
|
}
|
|
1031
1032
|
function TypeScriptEndpointDefinitionEmitter() {
|
|
@@ -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.l1z_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().m1z_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
|
|
@@ -1088,7 +1089,7 @@ function sanitizeParamName($this, identifier) {
|
|
|
1088
1089
|
var tmp0 = identifier.l1();
|
|
1089
1090
|
// Inline function 'kotlin.text.split' call
|
|
1090
1091
|
// Inline function 'kotlin.collections.filter' call
|
|
1091
|
-
var tmp0_0 = Regex_init_$Create$('[.\\s-]+').
|
|
1092
|
+
var tmp0_0 = Regex_init_$Create$('[.\\s-]+').zc(tmp0, 0);
|
|
1092
1093
|
// Inline function 'kotlin.collections.filterTo' call
|
|
1093
1094
|
var destination = ArrayList_init_$Create$();
|
|
1094
1095
|
var _iterator__ex2g4s = tmp0_0.t();
|
|
@@ -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)).x1l() : identifier.l1();
|
|
1104
1105
|
return sanitizeKeywords($this, sanitizeSymbol_1($this, name));
|
|
1105
1106
|
}
|
|
1106
1107
|
function buildEndpointParams($this, endpoint) {
|
|
@@ -1109,7 +1110,7 @@ function buildEndpointParams($this, endpoint) {
|
|
|
1109
1110
|
// Inline function 'kotlin.apply' call
|
|
1110
1111
|
var this_0 = ArrayList_init_$Create$();
|
|
1111
1112
|
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1112
|
-
var tmp0 = endpoint.
|
|
1113
|
+
var tmp0 = endpoint.kp_1;
|
|
1113
1114
|
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1114
1115
|
var destination = ArrayList_init_$Create$();
|
|
1115
1116
|
var _iterator__ex2g4s = tmp0.t();
|
|
@@ -1123,36 +1124,36 @@ function buildEndpointParams($this, endpoint) {
|
|
|
1123
1124
|
var _iterator__ex2g4s_0 = destination.t();
|
|
1124
1125
|
while (_iterator__ex2g4s_0.u()) {
|
|
1125
1126
|
var element_0 = _iterator__ex2g4s_0.v();
|
|
1126
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.
|
|
1127
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.pp_1), emitTypeScriptReference($this, element_0.qp_1.ju(false)), element_0.qp_1.hu()));
|
|
1127
1128
|
}
|
|
1128
1129
|
// Inline function 'kotlin.collections.forEach' call
|
|
1129
|
-
var _iterator__ex2g4s_1 = endpoint.
|
|
1130
|
+
var _iterator__ex2g4s_1 = endpoint.lp_1.t();
|
|
1130
1131
|
while (_iterator__ex2g4s_1.u()) {
|
|
1131
1132
|
var element_1 = _iterator__ex2g4s_1.v();
|
|
1132
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.
|
|
1133
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.ep_1), emitTypeScriptReference($this, element_1.fp_1.ju(false)), element_1.fp_1.hu()));
|
|
1133
1134
|
}
|
|
1134
1135
|
// Inline function 'kotlin.collections.forEach' call
|
|
1135
|
-
var _iterator__ex2g4s_2 = endpoint.
|
|
1136
|
+
var _iterator__ex2g4s_2 = endpoint.mp_1.t();
|
|
1136
1137
|
while (_iterator__ex2g4s_2.u()) {
|
|
1137
1138
|
var element_2 = _iterator__ex2g4s_2.v();
|
|
1138
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.
|
|
1139
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.ep_1), emitTypeScriptReference($this, element_2.fp_1.ju(false)), element_2.fp_1.hu()));
|
|
1139
1140
|
}
|
|
1140
|
-
var tmp0_safe_receiver = first(endpoint.
|
|
1141
|
+
var tmp0_safe_receiver = first(endpoint.np_1).rp_1;
|
|
1141
1142
|
if (tmp0_safe_receiver == null)
|
|
1142
1143
|
null;
|
|
1143
1144
|
else {
|
|
1144
1145
|
// Inline function 'kotlin.let' call
|
|
1145
|
-
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.
|
|
1146
|
+
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.tp_1.ju(false)), tmp0_safe_receiver.tp_1.hu()));
|
|
1146
1147
|
}
|
|
1147
1148
|
return this_0.o5();
|
|
1148
1149
|
}
|
|
1149
1150
|
function emitTypeScriptReference($this, ref) {
|
|
1150
1151
|
var tmp;
|
|
1151
1152
|
if (ref instanceof Dict) {
|
|
1152
|
-
tmp = 'Record<string, ' + emitTypeScriptReference($this, ref.
|
|
1153
|
+
tmp = 'Record<string, ' + emitTypeScriptReference($this, ref.go_1) + '>';
|
|
1153
1154
|
} else {
|
|
1154
1155
|
if (ref instanceof Iterable) {
|
|
1155
|
-
tmp = emitTypeScriptReference($this, ref.
|
|
1156
|
+
tmp = emitTypeScriptReference($this, ref.do_1) + '[]';
|
|
1156
1157
|
} else {
|
|
1157
1158
|
if (ref instanceof Unit) {
|
|
1158
1159
|
tmp = 'undefined';
|
|
@@ -1161,10 +1162,10 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1161
1162
|
tmp = 'any';
|
|
1162
1163
|
} else {
|
|
1163
1164
|
if (ref instanceof Custom) {
|
|
1164
|
-
tmp = sanitizeSymbol_1($this, ref.
|
|
1165
|
+
tmp = sanitizeSymbol_1($this, ref.pu_1);
|
|
1165
1166
|
} else {
|
|
1166
1167
|
if (ref instanceof Primitive) {
|
|
1167
|
-
var tmp1_subject = ref.
|
|
1168
|
+
var tmp1_subject = ref.tu_1;
|
|
1168
1169
|
var tmp_0;
|
|
1169
1170
|
if (tmp1_subject instanceof String_0) {
|
|
1170
1171
|
tmp_0 = 'string';
|
|
@@ -1197,20 +1198,20 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1197
1198
|
}
|
|
1198
1199
|
}
|
|
1199
1200
|
// Inline function 'kotlin.let' call
|
|
1200
|
-
return tmp + (ref.
|
|
1201
|
+
return tmp + (ref.hu() ? ' | undefined' : '');
|
|
1201
1202
|
}
|
|
1202
1203
|
function EndpointParam(name, type, nullable) {
|
|
1203
|
-
this.
|
|
1204
|
-
this.
|
|
1205
|
-
this.
|
|
1204
|
+
this.n1z_1 = name;
|
|
1205
|
+
this.o1z_1 = type;
|
|
1206
|
+
this.p1z_1 = nullable;
|
|
1206
1207
|
}
|
|
1207
1208
|
protoOf(EndpointParam).toString = function () {
|
|
1208
|
-
return 'EndpointParam(name=' + this.
|
|
1209
|
+
return 'EndpointParam(name=' + this.n1z_1 + ', type=' + this.o1z_1 + ', nullable=' + this.p1z_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.n1z_1);
|
|
1213
|
+
result = imul(result, 31) + getStringHashCode(this.o1z_1) | 0;
|
|
1214
|
+
result = imul(result, 31) + getBooleanHashCode(this.p1z_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.
|
|
1222
|
+
if (!(this.n1z_1 === other.n1z_1))
|
|
1222
1223
|
return false;
|
|
1223
|
-
if (!(this.
|
|
1224
|
+
if (!(this.o1z_1 === other.o1z_1))
|
|
1224
1225
|
return false;
|
|
1225
|
-
if (!(this.
|
|
1226
|
+
if (!(this.p1z_1 === other.p1z_1))
|
|
1226
1227
|
return false;
|
|
1227
1228
|
return true;
|
|
1228
1229
|
};
|
|
1229
1230
|
function Companion() {
|
|
1230
1231
|
Companion_instance_1 = this;
|
|
1231
|
-
this.
|
|
1232
|
+
this.m1z_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.l1h_1.a1() > 1 ? name.x1l() : sanitizeSymbol_1(this$0, name.x1h());
|
|
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.l1h_1.a1() > 1 ? name.x1l() : sanitizeSymbol_1(this$0, name.x1h());
|
|
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.l1o_1));
|
|
1277
1278
|
} else {
|
|
1278
1279
|
if (stmt instanceof ConstructorStatement) {
|
|
1279
|
-
var tmp_0 = tr.
|
|
1280
|
+
var tmp_0 = tr.u1t(stmt.u1m_1);
|
|
1280
1281
|
// Inline function 'kotlin.collections.map' call
|
|
1281
|
-
var this_0 = stmt.
|
|
1282
|
+
var this_0 = stmt.v1m_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.x1t(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.o1o_1), tr.x1t(stmt.p1o_1), stmt.q1o_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().m1z_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.d1n_1.equals(Companion_getInstance().k1h('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.z1m()));
|
|
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.d1n_1.equals(Companion_getInstance().k1h('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.z1m(), injected));
|
|
1349
1350
|
} else {
|
|
1350
1351
|
tmp_0 = element;
|
|
1351
1352
|
}
|
|
@@ -1358,7 +1359,7 @@ function TypeScriptIrEmitter$emitShared$lambda_0($api) {
|
|
|
1358
1359
|
};
|
|
1359
1360
|
}
|
|
1360
1361
|
function TypeScriptIrEmitter$emit$lambda(it) {
|
|
1361
|
-
return 'export {' + it.
|
|
1362
|
+
return 'export {' + it.ar().l1() + "} from './" + it.ar().l1() + "'";
|
|
1362
1363
|
}
|
|
1363
1364
|
function TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint) {
|
|
1364
1365
|
return function (element, transformer) {
|
|
@@ -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.z1m(), 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.c1u_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
|
-
this_1.
|
|
1395
|
-
var tmp$ret$2 = this_1.
|
|
1396
|
-
tmp.
|
|
1397
|
-
var tmp_0 = scope.
|
|
1395
|
+
this_1.h1h(TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint));
|
|
1396
|
+
var tmp$ret$2 = this_1.i1h();
|
|
1397
|
+
tmp.c1u_1 = transform(this_0, tmp$ret$2);
|
|
1398
|
+
var tmp_0 = scope.c1u_1;
|
|
1398
1399
|
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1399
1400
|
}
|
|
1400
1401
|
function emit$applyCallParamsIfNeeded(_this__u8e3s4, hasRequestParams) {
|
|
@@ -1402,25 +1403,25 @@ function emit$applyCallParamsIfNeeded(_this__u8e3s4, hasRequestParams) {
|
|
|
1402
1403
|
}
|
|
1403
1404
|
function TypeScriptIrEmitter$emitClient$lambda(this$0) {
|
|
1404
1405
|
return function (it) {
|
|
1405
|
-
var methodName = firstToLower(this$0, it.
|
|
1406
|
+
var methodName = firstToLower(this$0, it.ip_1.l1());
|
|
1406
1407
|
return ' ...' + methodName + 'Client(serialization, transportation),';
|
|
1407
1408
|
};
|
|
1408
1409
|
}
|
|
1409
1410
|
function TypeScriptIrEmitter() {
|
|
1410
1411
|
Companion_getInstance_0();
|
|
1411
|
-
this.
|
|
1412
|
-
this.
|
|
1412
|
+
this.j1z_1 = TypeScriptGenerator_getInstance();
|
|
1413
|
+
this.k1z_1 = FileExtension_TypeScript_getInstance();
|
|
1413
1414
|
var tmp = this;
|
|
1414
|
-
tmp.
|
|
1415
|
+
tmp.l1z_1 = lazy(TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this));
|
|
1415
1416
|
}
|
|
1416
|
-
protoOf(TypeScriptIrEmitter).
|
|
1417
|
-
return this.
|
|
1417
|
+
protoOf(TypeScriptIrEmitter).p1u = function () {
|
|
1418
|
+
return this.j1z_1;
|
|
1418
1419
|
};
|
|
1419
|
-
protoOf(TypeScriptIrEmitter).
|
|
1420
|
-
return this.
|
|
1420
|
+
protoOf(TypeScriptIrEmitter).iq = function () {
|
|
1421
|
+
return this.k1z_1;
|
|
1421
1422
|
};
|
|
1422
|
-
protoOf(TypeScriptIrEmitter).
|
|
1423
|
-
var packageName = Companion_instance.
|
|
1423
|
+
protoOf(TypeScriptIrEmitter).s1u = function () {
|
|
1424
|
+
var packageName = Companion_instance.qr('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
|
|
1426
1427
|
var this_0 = convert(packageName);
|
|
@@ -1429,31 +1430,31 @@ 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.c1u_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
|
-
this_2.
|
|
1437
|
-
var tmp$ret$2 = this_2.
|
|
1438
|
-
tmp.
|
|
1437
|
+
this_2.h1h(TypeScriptIrEmitter$emitShared$lambda);
|
|
1438
|
+
var tmp$ret$2 = this_2.i1h();
|
|
1439
|
+
tmp.c1u_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.c1u_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
|
-
this_4.
|
|
1448
|
-
var tmp$ret$8 = this_4.
|
|
1449
|
-
tmp_0.
|
|
1450
|
-
var tmp_1 = scope.
|
|
1448
|
+
this_4.h1h(TypeScriptIrEmitter$emitShared$lambda_0(api));
|
|
1449
|
+
var tmp$ret$8 = this_4.i1h();
|
|
1450
|
+
tmp_0.c1u_1 = transform(this_3, tmp$ret$8);
|
|
1451
|
+
var tmp_1 = scope.c1u_1;
|
|
1451
1452
|
return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1452
1453
|
};
|
|
1453
|
-
protoOf(TypeScriptIrEmitter).
|
|
1454
|
+
protoOf(TypeScriptIrEmitter).sn = function (ast, logger) {
|
|
1454
1455
|
var tmp = emit.call(this, ast, logger);
|
|
1455
1456
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
1456
|
-
var this_0 = ast.
|
|
1457
|
+
var this_0 = ast.fq_1;
|
|
1457
1458
|
// Inline function 'kotlin.collections.flatMap' call
|
|
1458
1459
|
var tmp0 = _NonEmptyList___get_all__impl__pmf509(this_0);
|
|
1459
1460
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
@@ -1461,7 +1462,7 @@ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
|
1461
1462
|
var _iterator__ex2g4s = tmp0.t();
|
|
1462
1463
|
while (_iterator__ex2g4s.u()) {
|
|
1463
1464
|
var element = _iterator__ex2g4s.v();
|
|
1464
|
-
var list = new NonEmptyList(element.
|
|
1465
|
+
var list = new NonEmptyList(element.hq_1);
|
|
1465
1466
|
addAll(destination, list);
|
|
1466
1467
|
}
|
|
1467
1468
|
var tmp$ret$3 = _NonEmptyList___init__impl__fxd0xp(destination);
|
|
@@ -1478,7 +1479,7 @@ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
|
1478
1479
|
var tmp_0;
|
|
1479
1480
|
if (value == null) {
|
|
1480
1481
|
var answer = ArrayList_init_$Create$();
|
|
1481
|
-
destination_0.
|
|
1482
|
+
destination_0.s2(key, answer);
|
|
1482
1483
|
tmp_0 = answer;
|
|
1483
1484
|
} else {
|
|
1484
1485
|
tmp_0 = value;
|
|
@@ -1497,18 +1498,18 @@ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
|
1497
1498
|
var ns = item.k1();
|
|
1498
1499
|
// Inline function 'kotlin.collections.component2' call
|
|
1499
1500
|
var defs = item.l1();
|
|
1500
|
-
var tmp_1 = ns + '/index.' + this.
|
|
1501
|
+
var tmp_1 = ns + '/index.' + this.iq().rq_1;
|
|
1501
1502
|
var tmp$ret$12 = new Emitted(tmp_1, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$emit$lambda));
|
|
1502
1503
|
destination_1.x(tmp$ret$12);
|
|
1503
1504
|
}
|
|
1504
1505
|
return NonEmptyList__plus_impl_xqmb9_0(tmp, destination_1);
|
|
1505
1506
|
};
|
|
1506
|
-
protoOf(TypeScriptIrEmitter).
|
|
1507
|
+
protoOf(TypeScriptIrEmitter).zq = function (definition, module_0, logger) {
|
|
1507
1508
|
var file = emit_0.call(this, definition, module_0, logger);
|
|
1508
|
-
var subPackageName = plus(Companion_instance.
|
|
1509
|
-
return new File(Companion_getInstance().
|
|
1509
|
+
var subPackageName = plus(Companion_instance.qr(''), definition);
|
|
1510
|
+
return new File(Companion_getInstance().k1h(subPackageName.tr() + sanitizeSymbol_1(this, file.x1m_1.m1h())), plus_0(listOf(import_0('../Wirespec', 'Wirespec')), file.y1m_1));
|
|
1510
1511
|
};
|
|
1511
|
-
protoOf(TypeScriptIrEmitter).
|
|
1512
|
+
protoOf(TypeScriptIrEmitter).yp = function (type, module_0) {
|
|
1512
1513
|
var fieldValidations = classifyValidatableFields(type, module_0);
|
|
1513
1514
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
1514
1515
|
var this_0 = importReferences(type);
|
|
@@ -1517,7 +1518,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1517
1518
|
var _iterator__ex2g4s = this_0.t();
|
|
1518
1519
|
while (_iterator__ex2g4s.u()) {
|
|
1519
1520
|
var e = _iterator__ex2g4s.v();
|
|
1520
|
-
var key = e.
|
|
1521
|
+
var key = e.pu_1;
|
|
1521
1522
|
if (set.x(key)) {
|
|
1522
1523
|
list.x(e);
|
|
1523
1524
|
}
|
|
@@ -1528,7 +1529,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1528
1529
|
var _iterator__ex2g4s_0 = list.t();
|
|
1529
1530
|
while (_iterator__ex2g4s_0.u()) {
|
|
1530
1531
|
var item = _iterator__ex2g4s_0.v();
|
|
1531
|
-
var tmp$ret$2 = import_0('./' + item.
|
|
1532
|
+
var tmp$ret$2 = import_0('./' + item.pu_1, item.pu_1);
|
|
1532
1533
|
destination.x(tmp$ret$2);
|
|
1533
1534
|
}
|
|
1534
1535
|
var typeImports = destination;
|
|
@@ -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.r1h_1;
|
|
1542
1543
|
destination_0.x(tmp$ret$5);
|
|
1543
1544
|
}
|
|
1544
1545
|
// Inline function 'kotlin.collections.filter' call
|
|
@@ -1548,7 +1549,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1548
1549
|
var _iterator__ex2g4s_2 = tmp0.t();
|
|
1549
1550
|
while (_iterator__ex2g4s_2.u()) {
|
|
1550
1551
|
var element = _iterator__ex2g4s_2.v();
|
|
1551
|
-
if (!(element === type.
|
|
1552
|
+
if (!(element === type.zo_1.l1())) {
|
|
1552
1553
|
destination_1.x(element);
|
|
1553
1554
|
}
|
|
1554
1555
|
}
|
|
@@ -1564,30 +1565,30 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1564
1565
|
var validateImports = destination_2;
|
|
1565
1566
|
var allImports = plus_0(typeImports, validateImports);
|
|
1566
1567
|
// Inline function 'kotlin.collections.map' call
|
|
1567
|
-
var this_1 = type.wo_1
|
|
1568
|
+
var this_1 = type.ap_1.wo_1;
|
|
1568
1569
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1569
1570
|
var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
1570
1571
|
var _iterator__ex2g4s_4 = this_1.t();
|
|
1571
1572
|
while (_iterator__ex2g4s_4.u()) {
|
|
1572
1573
|
var item_2 = _iterator__ex2g4s_4.v();
|
|
1573
|
-
var tmp$ret$14 = item_2.
|
|
1574
|
+
var tmp$ret$14 = item_2.ep_1.l1();
|
|
1574
1575
|
destination_3.x(tmp$ret$14);
|
|
1575
1576
|
}
|
|
1576
1577
|
var fieldNames = toSet(destination_3);
|
|
1577
|
-
var file = renameValidateAndBindObjReceiver(sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this)), type.
|
|
1578
|
+
var file = renameValidateAndBindObjReceiver(sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this)), type.zo_1.l1(), fieldNames);
|
|
1578
1579
|
var tmp;
|
|
1579
1580
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1580
1581
|
if (!allImports.r()) {
|
|
1581
|
-
tmp = file.
|
|
1582
|
+
tmp = file.b1n(VOID, plus_0(allImports, file.y1m_1));
|
|
1582
1583
|
} else {
|
|
1583
1584
|
tmp = file;
|
|
1584
1585
|
}
|
|
1585
1586
|
return tmp;
|
|
1586
1587
|
};
|
|
1587
|
-
protoOf(TypeScriptIrEmitter).
|
|
1588
|
+
protoOf(TypeScriptIrEmitter).nr = function (enum_0, module_0) {
|
|
1588
1589
|
return sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
|
|
1589
1590
|
};
|
|
1590
|
-
protoOf(TypeScriptIrEmitter).
|
|
1591
|
+
protoOf(TypeScriptIrEmitter).dr = function (union) {
|
|
1591
1592
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
1592
1593
|
var this_0 = importReferences(union);
|
|
1593
1594
|
var set = HashSet_init_$Create$();
|
|
@@ -1595,7 +1596,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1595
1596
|
var _iterator__ex2g4s = this_0.t();
|
|
1596
1597
|
while (_iterator__ex2g4s.u()) {
|
|
1597
1598
|
var e = _iterator__ex2g4s.v();
|
|
1598
|
-
var key = e.
|
|
1599
|
+
var key = e.pu_1;
|
|
1599
1600
|
if (set.x(key)) {
|
|
1600
1601
|
list.x(e);
|
|
1601
1602
|
}
|
|
@@ -1606,7 +1607,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1606
1607
|
var _iterator__ex2g4s_0 = list.t();
|
|
1607
1608
|
while (_iterator__ex2g4s_0.u()) {
|
|
1608
1609
|
var item = _iterator__ex2g4s_0.v();
|
|
1609
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1610
|
+
var tmp$ret$2 = import_0('../model', item.pu_1, true);
|
|
1610
1611
|
destination.x(tmp$ret$2);
|
|
1611
1612
|
}
|
|
1612
1613
|
var imports = destination;
|
|
@@ -1614,19 +1615,19 @@ 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.b1n(VOID, plus_0(imports, file.y1m_1));
|
|
1618
1619
|
} else {
|
|
1619
1620
|
tmp = file;
|
|
1620
1621
|
}
|
|
1621
1622
|
return tmp;
|
|
1622
1623
|
};
|
|
1623
|
-
protoOf(TypeScriptIrEmitter).
|
|
1624
|
+
protoOf(TypeScriptIrEmitter).ir = function (refined) {
|
|
1624
1625
|
var converted = convert_2(refined);
|
|
1625
|
-
var constraintExpr = convertConstraint(refined.
|
|
1626
|
-
var validatorStr = TypeScriptGenerator_getInstance().
|
|
1627
|
-
return new File(converted.
|
|
1626
|
+
var constraintExpr = convertConstraint(refined.hr_1, new VariableReference(Companion_getInstance().k1h('value')));
|
|
1627
|
+
var validatorStr = TypeScriptGenerator_getInstance().a1v(constraintExpr);
|
|
1628
|
+
return new File(converted.x1m_1, listOf_0([new RawElement('export type ' + converted.x1m_1.m1h() + ' = ' + emitTypeScriptReference(this, refined.hr_1) + ';'), new RawElement('export const validate' + refined.gr_1.l1() + ' = (value: ' + emitTypeScriptReference(this, refined.hr_1) + ') =>\n ' + validatorStr + ';')]));
|
|
1628
1629
|
};
|
|
1629
|
-
protoOf(TypeScriptIrEmitter).
|
|
1630
|
+
protoOf(TypeScriptIrEmitter).or = function (endpoint) {
|
|
1630
1631
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
1631
1632
|
var this_0 = importReferences(endpoint);
|
|
1632
1633
|
var set = HashSet_init_$Create$();
|
|
@@ -1634,7 +1635,7 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1634
1635
|
var _iterator__ex2g4s = this_0.t();
|
|
1635
1636
|
while (_iterator__ex2g4s.u()) {
|
|
1636
1637
|
var e = _iterator__ex2g4s.v();
|
|
1637
|
-
var key = e.
|
|
1638
|
+
var key = e.pu_1;
|
|
1638
1639
|
if (set.x(key)) {
|
|
1639
1640
|
list.x(e);
|
|
1640
1641
|
}
|
|
@@ -1645,7 +1646,7 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1645
1646
|
var _iterator__ex2g4s_0 = list.t();
|
|
1646
1647
|
while (_iterator__ex2g4s_0.u()) {
|
|
1647
1648
|
var item = _iterator__ex2g4s_0.v();
|
|
1648
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1649
|
+
var tmp$ret$2 = import_0('../model', item.pu_1, true);
|
|
1649
1650
|
destination.x(tmp$ret$2);
|
|
1650
1651
|
}
|
|
1651
1652
|
var imports = destination;
|
|
@@ -1654,25 +1655,25 @@ 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.h1u(transformPatternSwitchToValueSwitch());
|
|
1659
|
+
var tmp = scope.c1u_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).b1n(Companion_getInstance().k1h(sanitize(this, endpoint.ip_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.b1n(VOID, plus_0(imports, it.y1m_1));
|
|
1666
1667
|
} else {
|
|
1667
1668
|
tmp_0 = it;
|
|
1668
1669
|
}
|
|
1669
1670
|
return tmp_0;
|
|
1670
1671
|
};
|
|
1671
|
-
protoOf(TypeScriptIrEmitter).
|
|
1672
|
+
protoOf(TypeScriptIrEmitter).cr = function (channel) {
|
|
1672
1673
|
return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
|
|
1673
1674
|
};
|
|
1674
|
-
protoOf(TypeScriptIrEmitter).
|
|
1675
|
-
var endpointName = endpoint.
|
|
1675
|
+
protoOf(TypeScriptIrEmitter).u1u = function (endpoint) {
|
|
1676
|
+
var endpointName = endpoint.ip_1.l1();
|
|
1676
1677
|
var methodName = firstToLower(this, endpointName);
|
|
1677
1678
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
1678
1679
|
var this_0 = importReferences(endpoint);
|
|
@@ -1681,7 +1682,7 @@ protoOf(TypeScriptIrEmitter).o1u = function (endpoint) {
|
|
|
1681
1682
|
var _iterator__ex2g4s = this_0.t();
|
|
1682
1683
|
while (_iterator__ex2g4s.u()) {
|
|
1683
1684
|
var e = _iterator__ex2g4s.v();
|
|
1684
|
-
var key = e.
|
|
1685
|
+
var key = e.pu_1;
|
|
1685
1686
|
if (set.x(key)) {
|
|
1686
1687
|
list.x(e);
|
|
1687
1688
|
}
|
|
@@ -1692,7 +1693,7 @@ protoOf(TypeScriptIrEmitter).o1u = function (endpoint) {
|
|
|
1692
1693
|
var _iterator__ex2g4s_0 = list.t();
|
|
1693
1694
|
while (_iterator__ex2g4s_0.u()) {
|
|
1694
1695
|
var item = _iterator__ex2g4s_0.v();
|
|
1695
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1696
|
+
var tmp$ret$2 = import_0('../model', item.pu_1, true);
|
|
1696
1697
|
destination.x(tmp$ret$2);
|
|
1697
1698
|
}
|
|
1698
1699
|
var imports = destination;
|
|
@@ -1714,40 +1715,40 @@ 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().k1h('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
|
|
1721
1722
|
var this_1 = ArrayList_init_$Create$();
|
|
1722
1723
|
this_1.x(import_0('../Wirespec', 'Wirespec'));
|
|
1723
1724
|
this_1.x(import_0('../endpoint/' + endpointName, endpointName));
|
|
1724
|
-
this_1.
|
|
1725
|
+
this_1.f1(imports);
|
|
1725
1726
|
this_1.x(new RawElement(code));
|
|
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
|
-
logger.
|
|
1730
|
+
protoOf(TypeScriptIrEmitter).t1u = function (endpoints, logger) {
|
|
1731
|
+
logger.xq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
|
|
1731
1732
|
// Inline function 'kotlin.collections.map' call
|
|
1732
1733
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1733
1734
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
|
|
1734
1735
|
var _iterator__ex2g4s = endpoints.t();
|
|
1735
1736
|
while (_iterator__ex2g4s.u()) {
|
|
1736
1737
|
var item = _iterator__ex2g4s.v();
|
|
1737
|
-
var methodName = firstToLower(this, item.
|
|
1738
|
-
var tmp$ret$0 = import_0('./client/' + item.
|
|
1738
|
+
var methodName = firstToLower(this, item.ip_1.l1());
|
|
1739
|
+
var tmp$ret$0 = import_0('./client/' + item.ip_1.l1() + 'Client', methodName + 'Client');
|
|
1739
1740
|
destination.x(tmp$ret$0);
|
|
1740
1741
|
}
|
|
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().k1h('Client');
|
|
1745
1746
|
// Inline function 'kotlin.collections.buildList' call
|
|
1746
1747
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
1747
1748
|
// Inline function 'kotlin.apply' call
|
|
1748
1749
|
var this_0 = ArrayList_init_$Create$();
|
|
1749
1750
|
this_0.x(import_0('./Wirespec', 'Wirespec'));
|
|
1750
|
-
this_0.
|
|
1751
|
+
this_0.f1(clientImports);
|
|
1751
1752
|
this_0.x(new RawElement(code));
|
|
1752
1753
|
var tmp$ret$6 = this_0.o5();
|
|
1753
1754
|
return new File(tmp, tmp$ret$6);
|
|
@@ -1756,8 +1757,8 @@ 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
|
-
return this_0.
|
|
1760
|
+
this_0.j1u(transformPatternSwitchToValueSwitch$lambda);
|
|
1761
|
+
return this_0.i1h();
|
|
1761
1762
|
}
|
|
1762
1763
|
function renameValidateAndBindObjReceiver(_this__u8e3s4, typeName, fieldNames) {
|
|
1763
1764
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
@@ -1765,19 +1766,19 @@ 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.c1u_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
|
-
this_1.
|
|
1773
|
-
var tmp$ret$2 = this_1.
|
|
1774
|
-
tmp.
|
|
1775
|
-
var tmp_0 = scope.
|
|
1773
|
+
this_1.h1h(renameValidateAndBindObjReceiver$lambda(typeName, fieldNames));
|
|
1774
|
+
var tmp$ret$2 = this_1.i1h();
|
|
1775
|
+
tmp.c1u_1 = transform(this_0, tmp$ret$2);
|
|
1776
|
+
var tmp_0 = scope.c1u_1;
|
|
1776
1777
|
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1777
1778
|
}
|
|
1778
1779
|
function buildApiConst(endpoint) {
|
|
1779
1780
|
// Inline function 'kotlin.text.replaceFirstChar' call
|
|
1780
|
-
var this_0 = endpoint.
|
|
1781
|
+
var this_0 = endpoint.ip_1.l1();
|
|
1781
1782
|
var tmp;
|
|
1782
1783
|
// Inline function 'kotlin.text.isNotEmpty' call
|
|
1783
1784
|
if (charSequenceLength(this_0) > 0) {
|
|
@@ -1791,8 +1792,8 @@ function buildApiConst(endpoint) {
|
|
|
1791
1792
|
tmp = this_0;
|
|
1792
1793
|
}
|
|
1793
1794
|
var apiName = tmp;
|
|
1794
|
-
var method = endpoint.
|
|
1795
|
-
var pathString = joinToString(endpoint.
|
|
1795
|
+
var method = endpoint.jp_1.a3_1;
|
|
1796
|
+
var pathString = joinToString(endpoint.kp_1, '/', VOID, VOID, VOID, VOID, buildApiConst$lambda);
|
|
1796
1797
|
return raw(trimMargin('\n |export const client:Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n | from: (it) => fromRawResponse(serialization, it),\n | to: (it) => toRawRequest(serialization, it)\n |})\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n | from: (it) => fromRawRequest(serialization, it),\n | to: (it) => toRawResponse(serialization, it)\n |})\n |export const api = {\n | name: "' + apiName + '",\n | method: "' + method + '",\n | path: "' + pathString + '",\n | server,\n | client\n |} as const\n '));
|
|
1797
1798
|
}
|
|
1798
1799
|
function bindCallToRequestParams(_this__u8e3s4) {
|
|
@@ -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.c1u_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
|
-
this_1.
|
|
1809
|
-
var tmp$ret$2 = this_1.
|
|
1810
|
-
tmp.
|
|
1811
|
-
var tmp_0 = scope.
|
|
1809
|
+
this_1.h1h(bindCallToRequestParams$lambda);
|
|
1810
|
+
var tmp$ret$2 = this_1.i1h();
|
|
1811
|
+
tmp.c1u_1 = transform(this_0, tmp$ret$2);
|
|
1812
|
+
var tmp_0 = scope.c1u_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.j1u(stripTrailingSpaceFromErrorMessage$lambda);
|
|
1819
|
+
var tmp = scope.c1u_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.e1p_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.l1p_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.g1p_1;
|
|
1856
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.x1l();
|
|
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.e1p_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.l1p_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.v1h_1;
|
|
1870
|
+
var typeName = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.m1h();
|
|
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.k1p_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.w1t(item_0);
|
|
1881
1883
|
destination_0.x(tmp$ret$2);
|
|
1882
1884
|
}
|
|
1883
|
-
tmp$ret$5 = item.
|
|
1885
|
+
tmp$ret$5 = item.n1p(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().a1v(tr.x1t(stmt.d1p_1));
|
|
1889
|
+
var castAssignment = new Assignment(Companion_getInstance().k1h(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.k1p_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.w1t(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.x1t(stmt.d1p_1), Companion_getInstance().k1h('status'));
|
|
1908
|
+
var tmp2_safe_receiver = stmt.f1p_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.w1t(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.g1m_1.equals(Companion_getInstance().k1h('validate'));
|
|
1932
1934
|
} else {
|
|
1933
1935
|
tmp_2 = false;
|
|
1934
1936
|
}
|
|
1935
1937
|
if (tmp_2) {
|
|
1936
|
-
tmp_1 = !(s.
|
|
1938
|
+
tmp_1 = !(s.e1m_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.f1m_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.f1m_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.v1h_1;
|
|
1952
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.m1h();
|
|
1953
|
+
var tn = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
|
|
1954
|
+
tmp = new FunctionCall(VOID, VOID, Companion_getInstance().k1h('validate' + tn), mapOf(to(Companion_getInstance().k1h('obj'), t.x1t(ensureNotNull(s.e1m_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.o1p_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.p1p_1.x1l());
|
|
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().k1h('obj')), s.p1p_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.y1j_1.equals(Companion_getInstance().k1h('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.g1k(Companion_getInstance().k1h('validate' + $typeName), VOID, listOf(new Parameter(Companion_getInstance().k1h('obj'), Custom_init_$Create$($typeName))));
|
|
1986
1989
|
var scope = new TransformScope(this_0);
|
|
1987
|
-
scope.
|
|
1988
|
-
var tmp_0 = scope.
|
|
1990
|
+
scope.l1u(renameValidateAndBindObjReceiver$lambda$lambda($fieldNames));
|
|
1991
|
+
var tmp_0 = scope.c1u_1;
|
|
1989
1992
|
tmp$ret$0 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1990
1993
|
}
|
|
1991
1994
|
tmp = tmp$ret$0;
|
|
@@ -1999,10 +2002,10 @@ function renameValidateAndBindObjReceiver$lambda($typeName, $fieldNames) {
|
|
|
1999
2002
|
function buildApiConst$lambda(it) {
|
|
2000
2003
|
var tmp;
|
|
2001
2004
|
if (it instanceof Literal) {
|
|
2002
|
-
tmp = it.
|
|
2005
|
+
tmp = it.lq_1;
|
|
2003
2006
|
} else {
|
|
2004
2007
|
if (it instanceof Param) {
|
|
2005
|
-
tmp = '{' + it.
|
|
2008
|
+
tmp = '{' + it.pp_1.l1() + '}';
|
|
2006
2009
|
} else {
|
|
2007
2010
|
noWhenBranchMatchedException();
|
|
2008
2011
|
}
|
|
@@ -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.p1n_1.equals(Companion_getInstance().k1h('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.q1n_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.g1k(VOID, VOID, listOf(new Parameter(Companion_getInstance().k1h('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.w1n(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.f1p_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.s1p_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.t1p_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.v1o_1), charArrayOf([_Char___init__impl__6a9atx(32)])), literal.w1o_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.i1p(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.h1z_1 = 'community.flock.wirespec';
|
|
2107
|
+
this.i1z_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';
|
|
@@ -2131,28 +2134,28 @@ function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
|
|
|
2131
2134
|
}
|
|
2132
2135
|
function TypeScriptTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
2133
2136
|
return function (it) {
|
|
2134
|
-
return this$0.
|
|
2137
|
+
return this$0.aq(it);
|
|
2135
2138
|
};
|
|
2136
2139
|
}
|
|
2137
2140
|
function TypeScriptTypeDefinitionEmitter() {
|
|
2138
2141
|
}
|
|
2139
2142
|
//region block: post-declaration
|
|
2140
|
-
protoOf(TypeScriptEmitter).
|
|
2141
|
-
protoOf(TypeScriptEmitter).
|
|
2142
|
-
protoOf(TypeScriptEmitter).
|
|
2143
|
-
protoOf(TypeScriptEmitter).
|
|
2144
|
-
protoOf(TypeScriptEmitter).
|
|
2145
|
-
protoOf(TypeScriptEmitter).
|
|
2146
|
-
protoOf(TypeScriptEmitter).
|
|
2147
|
-
protoOf(TypeScriptEmitter).
|
|
2148
|
-
protoOf(TypeScriptEmitter).
|
|
2149
|
-
protoOf(TypeScriptEmitter).
|
|
2150
|
-
protoOf(TypeScriptEmitter).
|
|
2151
|
-
protoOf(TypeScriptEmitter).
|
|
2152
|
-
protoOf(TypeScriptEmitter).
|
|
2153
|
-
protoOf(TypeScriptEmitter).
|
|
2154
|
-
protoOf(TypeScriptEmitter).
|
|
2155
|
-
protoOf(TypeScriptIrEmitter).
|
|
2143
|
+
protoOf(TypeScriptEmitter).yp = emit_3;
|
|
2144
|
+
protoOf(TypeScriptEmitter).zp = emit_6;
|
|
2145
|
+
protoOf(TypeScriptEmitter).aq = emit_7;
|
|
2146
|
+
protoOf(TypeScriptEmitter).bq = emit_4;
|
|
2147
|
+
protoOf(TypeScriptEmitter).cq = emit_5;
|
|
2148
|
+
protoOf(TypeScriptEmitter).nr = emit_10;
|
|
2149
|
+
protoOf(TypeScriptEmitter).ir = emit_9;
|
|
2150
|
+
protoOf(TypeScriptEmitter).or = emit_8;
|
|
2151
|
+
protoOf(TypeScriptEmitter).br = emit_2;
|
|
2152
|
+
protoOf(TypeScriptEmitter).pr = emitValidator;
|
|
2153
|
+
protoOf(TypeScriptEmitter).c1z = sanitizeSymbol;
|
|
2154
|
+
protoOf(TypeScriptEmitter).u1v = sanitizeSymbol_0;
|
|
2155
|
+
protoOf(TypeScriptEmitter).d1z = emitPrimitive;
|
|
2156
|
+
protoOf(TypeScriptEmitter).b1z = emitClient;
|
|
2157
|
+
protoOf(TypeScriptEmitter).eq = emitClientEndpointRequest;
|
|
2158
|
+
protoOf(TypeScriptIrEmitter).r1u = emit_1;
|
|
2156
2159
|
//endregion
|
|
2157
2160
|
//region block: exports
|
|
2158
2161
|
export {
|