@flock/wirespec 0.18.1-RC.3 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clikt-clikt-mordant.mjs +79 -79
- package/clikt-clikt.mjs +1265 -1265
- package/clikt-clikt.mjs.map +1 -1
- package/colormath-root-colormath.mjs +433 -433
- package/kotlin-kotlin-stdlib.mjs +34 -28
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +5407 -5405
- package/kotlin-openapi-bindings.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1760 -1760
- package/kotlinx-io-kotlinx-io-core.mjs +404 -404
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1701 -1701
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1320 -1319
- package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/mordant-mordant.mjs +1198 -1198
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +192 -205
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +711 -777
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +311 -418
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +640 -769
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +1582 -1708
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-scala.mjs +680 -635
- package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +579 -562
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +20 -20
- package/wirespec-src-compiler-ir.mjs +5428 -6057
- package/wirespec-src-compiler-ir.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +279 -279
- package/wirespec-src-converter-avro.mjs +559 -559
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +802 -404
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +144 -144
- package/wirespec-src-plugin-cli.mjs +87 -87
- package/wirespec-src-plugin-npm.mjs +44 -25
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +13 -13
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
Unit2z95clvxm08vr as Unit,
|
|
33
33
|
Iterable29qbzfup67wqp as Iterable,
|
|
34
34
|
Dict3g7w5wia7rncj as Dict,
|
|
35
|
-
Shared1uygqfbd22ukz as Shared,
|
|
36
35
|
Bytes_instance1o9u095wd3kx6 as Bytes_instance,
|
|
37
36
|
Boolean_instance237vwt01w3hs8 as Boolean_instance,
|
|
38
37
|
RegExpiyof7szm5zfu as RegExp_0,
|
|
@@ -61,9 +60,6 @@ import {
|
|
|
61
60
|
noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
|
|
62
61
|
prependIndentkl9wuvcodvmu as prependIndent,
|
|
63
62
|
first58ocm7j58k3q as first,
|
|
64
|
-
emptyList1g2z5xcrvp2zy as emptyList,
|
|
65
|
-
listOfvhqybd2zx248 as listOf,
|
|
66
|
-
plus310ted5e4i90h as plus_0,
|
|
67
63
|
KProperty1ca4yb4wlo496 as KProperty1,
|
|
68
64
|
getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
|
|
69
65
|
StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
|
|
@@ -79,21 +75,24 @@ import {
|
|
|
79
75
|
getBooleanHashCode1bbj3u6b3v0a7 as getBooleanHashCode,
|
|
80
76
|
setOf45ia9pnfhe90 as setOf,
|
|
81
77
|
initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
|
|
78
|
+
listOfvhqybd2zx248 as listOf,
|
|
82
79
|
to2cs3ny02qtbcb as to,
|
|
83
80
|
toMap1vec9topfei08 as toMap,
|
|
81
|
+
emptyList1g2z5xcrvp2zy as emptyList,
|
|
82
|
+
plus310ted5e4i90h as plus_0,
|
|
84
83
|
isInterface3d6p8outrmvmk as isInterface,
|
|
85
|
-
ensureNotNull1e947j3ixpazm as ensureNotNull,
|
|
86
|
-
mapOf2zpbbmyqk8xpf as mapOf,
|
|
87
|
-
charArrayOf27f4r3dozbrk1 as charArrayOf,
|
|
88
|
-
trimEndvvzjdhan75g as trimEnd,
|
|
89
|
-
Collection1k04j3hzsbod0 as Collection,
|
|
90
|
-
substringAfterLastuw9v7gfiiihe as substringAfterLast,
|
|
91
|
-
removePrefix279df90bhrqqg as removePrefix,
|
|
92
|
-
toIntOrNull3w2d066r9pvwm as toIntOrNull,
|
|
93
84
|
lazy2hsh8ze7j6ikd as lazy,
|
|
94
85
|
distinct10qe1scfdvu5k as distinct,
|
|
95
86
|
toSet2orjxp16sotqu as toSet,
|
|
96
87
|
listOf1jh22dvmctj1r as listOf_0,
|
|
88
|
+
Collection1k04j3hzsbod0 as Collection,
|
|
89
|
+
substringAfterLastuw9v7gfiiihe as substringAfterLast,
|
|
90
|
+
removePrefix279df90bhrqqg as removePrefix,
|
|
91
|
+
toIntOrNull3w2d066r9pvwm as toIntOrNull,
|
|
92
|
+
ensureNotNull1e947j3ixpazm as ensureNotNull,
|
|
93
|
+
mapOf2zpbbmyqk8xpf as mapOf,
|
|
94
|
+
charArrayOf27f4r3dozbrk1 as charArrayOf,
|
|
95
|
+
trimEndvvzjdhan75g as trimEnd,
|
|
97
96
|
equals2au1ep9vhcato as equals,
|
|
98
97
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
99
98
|
Char19o2r8palgjof as Char,
|
|
@@ -111,44 +110,28 @@ import {
|
|
|
111
110
|
NonEmptyList__plus_impl_xqmb91y38uyofmba13 as NonEmptyList__plus_impl_xqmb9_0,
|
|
112
111
|
} from './arrow-arrow-core.mjs';
|
|
113
112
|
import {
|
|
114
|
-
RawElement2yts1x2rbem1g as RawElement,
|
|
115
|
-
Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
|
|
116
|
-
withElements2toq84v08e72 as withElements,
|
|
117
|
-
Namespace345pal554qu3j as Namespace,
|
|
118
|
-
transformChildrend9p91tpcqdkx as transformChildren,
|
|
119
|
-
rawttvqxl50flj9 as raw,
|
|
120
|
-
TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
|
|
121
113
|
Nameoqr8dt2fim9d as Name,
|
|
122
|
-
transformChildren2mszeagj5nq4c as
|
|
114
|
+
transformChildren2mszeagj5nq4c as transformChildren,
|
|
123
115
|
sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
|
|
124
116
|
Assignment3kcxc8wlcbmkn as Assignment,
|
|
125
117
|
ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
|
|
126
118
|
VariableReference2vlynnhaw1i64 as VariableReference,
|
|
127
119
|
SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
|
|
128
|
-
|
|
120
|
+
RawElement2yts1x2rbem1g as RawElement,
|
|
121
|
+
Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
|
|
122
|
+
withElements2toq84v08e72 as withElements,
|
|
123
|
+
Namespace345pal554qu3j as Namespace,
|
|
124
|
+
transformChildrend9p91tpcqdkx as transformChildren_0,
|
|
129
125
|
TransformScopeyrd3lf4zrk76 as TransformScope,
|
|
126
|
+
TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
|
|
130
127
|
transform3eti8i2bqvifx as transform,
|
|
131
128
|
Elementitq62jg6fid3 as Element,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
FieldCall1iz7z2fx2xo4p as FieldCall,
|
|
135
|
-
Custom2si7lto3wompr as Custom_0,
|
|
136
|
-
Parameteruqoxd4rzw7ga as Parameter,
|
|
137
|
-
Function21cuq8qizkin7 as Function,
|
|
138
|
-
BinaryOp35p72iprkxis9 as BinaryOp,
|
|
139
|
-
ErrorStatement1fq19ynue37ia as ErrorStatement,
|
|
140
|
-
Literal50s1y3607cdv as Literal_0,
|
|
141
|
-
Switch3a1zi3na98deu as Switch,
|
|
142
|
-
Interface3pn84xq686t2r as Interface,
|
|
143
|
-
TypeScriptGenerator_instance39tclamtqqcmq as TypeScriptGenerator_instance,
|
|
144
|
-
RawExpression2bo7ldfrptjia as RawExpression,
|
|
145
|
-
Integer1uwg1wvo5lp6z as Integer_0,
|
|
146
|
-
Case2i7oahw4alz6h as Case,
|
|
129
|
+
TypeScriptGenerator_getInstance3w0ea8m4h2slw as TypeScriptGenerator_getInstance,
|
|
130
|
+
convertnty9x0e63d0u as convert,
|
|
147
131
|
emit1oxjujel6f3jb as emit,
|
|
148
|
-
|
|
149
|
-
File3dimy4iqmuock as File,
|
|
150
|
-
emitn3eihixilqyh as emit_1,
|
|
132
|
+
emitn3eihixilqyh as emit_0,
|
|
151
133
|
import5uhkz67bd8tt as import_0,
|
|
134
|
+
File3dimy4iqmuock as File,
|
|
152
135
|
classifyValidatableFields11bv88x0ho39r as classifyValidatableFields,
|
|
153
136
|
convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
|
|
154
137
|
sanitizeNames2wqmyf8vafp9x as sanitizeNames,
|
|
@@ -159,7 +142,22 @@ import {
|
|
|
159
142
|
requestParameters1z8fdizgtviyb as requestParameters,
|
|
160
143
|
convert32tuiui3czihh as convert_3,
|
|
161
144
|
convert1cn4bolzoed8c as convert_4,
|
|
145
|
+
emit3bzdcd0f6nwtj as emit_1,
|
|
162
146
|
IrEmitterh2m93ojzvkep as IrEmitter,
|
|
147
|
+
rawttvqxl50flj9 as raw,
|
|
148
|
+
Switch3a1zi3na98deu as Switch,
|
|
149
|
+
Custom2si7lto3wompr as Custom_0,
|
|
150
|
+
RawExpression2bo7ldfrptjia as RawExpression,
|
|
151
|
+
Integer1uwg1wvo5lp6z as Integer_0,
|
|
152
|
+
Literal50s1y3607cdv as Literal_0,
|
|
153
|
+
Case2i7oahw4alz6h as Case,
|
|
154
|
+
FieldCall1iz7z2fx2xo4p as FieldCall,
|
|
155
|
+
FunctionCall30872kpnbr7op as FunctionCall,
|
|
156
|
+
Parameteruqoxd4rzw7ga as Parameter,
|
|
157
|
+
Function21cuq8qizkin7 as Function,
|
|
158
|
+
Interface3pn84xq686t2r as Interface,
|
|
159
|
+
ErrorStatement1fq19ynue37ia as ErrorStatement,
|
|
160
|
+
BinaryOp35p72iprkxis9 as BinaryOp,
|
|
163
161
|
} from './wirespec-src-compiler-ir.mjs';
|
|
164
162
|
//region block: imports
|
|
165
163
|
var imul = Math.imul;
|
|
@@ -170,7 +168,7 @@ function emit_2(identifier) {
|
|
|
170
168
|
}
|
|
171
169
|
initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
|
|
172
170
|
function sanitizeSymbol(_this__u8e3s4) {
|
|
173
|
-
return this.
|
|
171
|
+
return this.o1v(_this__u8e3s4.l1());
|
|
174
172
|
}
|
|
175
173
|
function sanitizeSymbol_0(_this__u8e3s4) {
|
|
176
174
|
var tmp = asSequence(_this__u8e3s4);
|
|
@@ -184,7 +182,7 @@ function emit_3(type, module_0) {
|
|
|
184
182
|
var _iterator__ex2g4s = this_0.t();
|
|
185
183
|
while (_iterator__ex2g4s.u()) {
|
|
186
184
|
var e = _iterator__ex2g4s.v();
|
|
187
|
-
var key = e.
|
|
185
|
+
var key = e.ku_1;
|
|
188
186
|
if (set.x(key)) {
|
|
189
187
|
list.x(e);
|
|
190
188
|
}
|
|
@@ -195,11 +193,11 @@ function emit_3(type, module_0) {
|
|
|
195
193
|
var _iterator__ex2g4s_0 = list.t();
|
|
196
194
|
while (_iterator__ex2g4s_0.u()) {
|
|
197
195
|
var item = _iterator__ex2g4s_0.v();
|
|
198
|
-
var tmp$ret$2 = 'import {' + item.
|
|
196
|
+
var tmp$ret$2 = 'import {' + item.ku_1 + "} from './" + item.ku_1 + "'";
|
|
199
197
|
destination.x(tmp$ret$2);
|
|
200
198
|
}
|
|
201
199
|
var tmp = destination;
|
|
202
|
-
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.
|
|
200
|
+
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.w1y(type.vo_1) + ' = {\n |' + this.vp(type.wo_1) + '\n |}\n |\n ');
|
|
203
201
|
}
|
|
204
202
|
function emit_4(_this__u8e3s4) {
|
|
205
203
|
var tmp;
|
|
@@ -216,10 +214,10 @@ function emit_4(_this__u8e3s4) {
|
|
|
216
214
|
tmp = 'any';
|
|
217
215
|
} else {
|
|
218
216
|
if (_this__u8e3s4 instanceof Custom) {
|
|
219
|
-
tmp = this.
|
|
217
|
+
tmp = this.o1v(_this__u8e3s4.ku_1);
|
|
220
218
|
} else {
|
|
221
219
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
222
|
-
tmp = this.
|
|
220
|
+
tmp = this.x1y(_this__u8e3s4);
|
|
223
221
|
} else {
|
|
224
222
|
noWhenBranchMatchedException();
|
|
225
223
|
}
|
|
@@ -229,10 +227,10 @@ function emit_4(_this__u8e3s4) {
|
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
// Inline function 'kotlin.let' call
|
|
232
|
-
return tmp + (_this__u8e3s4.
|
|
230
|
+
return tmp + (_this__u8e3s4.cu() ? ' | undefined' : '');
|
|
233
231
|
}
|
|
234
232
|
function emitPrimitive(_this__u8e3s4) {
|
|
235
|
-
var tmp0_subject = _this__u8e3s4.
|
|
233
|
+
var tmp0_subject = _this__u8e3s4.ou_1;
|
|
236
234
|
var tmp;
|
|
237
235
|
if (tmp0_subject instanceof String_0) {
|
|
238
236
|
tmp = 'string';
|
|
@@ -263,7 +261,7 @@ function emit_5(_this__u8e3s4) {
|
|
|
263
261
|
tmp = Spacer_instance.toString() + 'return ' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.ys_1) + '.test(value);';
|
|
264
262
|
} else {
|
|
265
263
|
if (_this__u8e3s4 instanceof Bound) {
|
|
266
|
-
var tmp1_safe_receiver = _this__u8e3s4.
|
|
264
|
+
var tmp1_safe_receiver = _this__u8e3s4.ot_1;
|
|
267
265
|
var tmp_0;
|
|
268
266
|
if (tmp1_safe_receiver == null) {
|
|
269
267
|
tmp_0 = null;
|
|
@@ -272,7 +270,7 @@ function emit_5(_this__u8e3s4) {
|
|
|
272
270
|
tmp_0 = tmp1_safe_receiver + ' < value';
|
|
273
271
|
}
|
|
274
272
|
var minCheck = tmp_0;
|
|
275
|
-
var tmp2_safe_receiver = _this__u8e3s4.
|
|
273
|
+
var tmp2_safe_receiver = _this__u8e3s4.pt_1;
|
|
276
274
|
var tmp_1;
|
|
277
275
|
if (tmp2_safe_receiver == null) {
|
|
278
276
|
tmp_1 = null;
|
|
@@ -339,7 +337,7 @@ function emitClient(ast) {
|
|
|
339
337
|
var _iterator__ex2g4s_1 = destination_0.t();
|
|
340
338
|
while (_iterator__ex2g4s_1.u()) {
|
|
341
339
|
var e = _iterator__ex2g4s_1.v();
|
|
342
|
-
var key = e.
|
|
340
|
+
var key = e.ku_1;
|
|
343
341
|
if (set.x(key)) {
|
|
344
342
|
list_1.x(e);
|
|
345
343
|
}
|
|
@@ -350,12 +348,7 @@ function emitClient(ast) {
|
|
|
350
348
|
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 '));
|
|
351
349
|
}
|
|
352
350
|
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
353
|
-
function emit_8(
|
|
354
|
-
var tmp = this.n20(enum_0.gr_1);
|
|
355
|
-
return 'export type ' + tmp + ' = ' + joinToString(enum_0.hr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
356
|
-
}
|
|
357
|
-
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
358
|
-
function emit_9(endpoint) {
|
|
351
|
+
function emit_8(endpoint) {
|
|
359
352
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
360
353
|
var this_0 = importReferences(endpoint);
|
|
361
354
|
var set = HashSet_init_$Create$();
|
|
@@ -363,7 +356,7 @@ function emit_9(endpoint) {
|
|
|
363
356
|
var _iterator__ex2g4s = this_0.t();
|
|
364
357
|
while (_iterator__ex2g4s.u()) {
|
|
365
358
|
var e = _iterator__ex2g4s.v();
|
|
366
|
-
var key = e.
|
|
359
|
+
var key = e.ku_1;
|
|
367
360
|
if (set.x(key)) {
|
|
368
361
|
list.x(e);
|
|
369
362
|
}
|
|
@@ -374,12 +367,12 @@ function emit_9(endpoint) {
|
|
|
374
367
|
var _iterator__ex2g4s_0 = list.t();
|
|
375
368
|
while (_iterator__ex2g4s_0.u()) {
|
|
376
369
|
var item = _iterator__ex2g4s_0.v();
|
|
377
|
-
var tmp$ret$2 = 'import {type ' + item.
|
|
370
|
+
var tmp$ret$2 = 'import {type ' + item.ku_1 + "} from '../model'";
|
|
378
371
|
destination.x(tmp$ret$2);
|
|
379
372
|
}
|
|
380
373
|
var tmp = destination;
|
|
381
374
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
382
|
-
var tmp_1 = this.
|
|
375
|
+
var tmp_1 = this.w1y(endpoint.ep_1);
|
|
383
376
|
var tmp_2 = get_pathParams(endpoint);
|
|
384
377
|
var tmp_3 = emitType(this, tmp_2, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
385
378
|
var tmp_4 = emitType(this, endpoint.hp_1, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
@@ -401,31 +394,36 @@ function emit_9(endpoint) {
|
|
|
401
394
|
var tmp_20 = prependIndent(emitServer(this, endpoint), Spacer_instance.qr(1));
|
|
402
395
|
var tmp_21 = Spacer_instance.toString();
|
|
403
396
|
var tmp_22 = Spacer_instance.qr(2);
|
|
404
|
-
var tmp_23 = Companion_instance_0.pq(this.
|
|
397
|
+
var tmp_23 = Companion_instance_0.pq(this.w1y(endpoint.ep_1));
|
|
405
398
|
var tmp_24 = Spacer_instance.qr(2);
|
|
406
399
|
var tmp_25 = Spacer_instance.qr(2);
|
|
407
400
|
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 ');
|
|
408
401
|
}
|
|
409
402
|
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
403
|
+
function emit_9(enum_0, module_0) {
|
|
404
|
+
var tmp = this.w1y(enum_0.gr_1);
|
|
405
|
+
return 'export type ' + tmp + ' = ' + joinToString(enum_0.hr_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
406
|
+
}
|
|
407
|
+
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
410
408
|
function emit_10(refined) {
|
|
411
|
-
return trimMargin('\n |export type ' + this.
|
|
409
|
+
return trimMargin('\n |export type ' + this.w1y(refined.br_1) + ' = ' + this.xp(refined.cr_1) + ';\n |export const validate' + refined.br_1.l1() + ' = (value: ' + this.xp(refined.cr_1) + '): value is ' + this.w1y(refined.br_1) + ' => {\n |' + this.kr(refined) + '\n |}\n |\n ');
|
|
412
410
|
}
|
|
413
411
|
function emitValidator(_this__u8e3s4) {
|
|
414
412
|
var defaultReturn = Spacer_instance.toString() + 'return true;';
|
|
415
|
-
var type = _this__u8e3s4.cr_1.
|
|
413
|
+
var type = _this__u8e3s4.cr_1.ou_1;
|
|
416
414
|
var tmp;
|
|
417
415
|
if (type instanceof Integer) {
|
|
418
|
-
var tmp0_safe_receiver = type.
|
|
416
|
+
var tmp0_safe_receiver = type.tt_1;
|
|
419
417
|
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yp(tmp0_safe_receiver);
|
|
420
418
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
421
419
|
} else {
|
|
422
420
|
if (type instanceof Number_0) {
|
|
423
|
-
var tmp2_safe_receiver = type.
|
|
421
|
+
var tmp2_safe_receiver = type.wt_1;
|
|
424
422
|
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.yp(tmp2_safe_receiver);
|
|
425
423
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
426
424
|
} else {
|
|
427
425
|
if (type instanceof String_0) {
|
|
428
|
-
var tmp4_safe_receiver = type.
|
|
426
|
+
var tmp4_safe_receiver = type.qt_1;
|
|
429
427
|
var tmp_0;
|
|
430
428
|
var tmp_1 = tmp4_safe_receiver;
|
|
431
429
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
@@ -451,10 +449,9 @@ function emitValidator(_this__u8e3s4) {
|
|
|
451
449
|
return tmp;
|
|
452
450
|
}
|
|
453
451
|
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
454
|
-
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter,
|
|
452
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptIdentifierEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptClientEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
455
453
|
initMetadataForClass(EndpointParam, 'EndpointParam');
|
|
456
454
|
initMetadataForCompanion(Companion);
|
|
457
|
-
initMetadataForClass(TypeScriptIrEmitter$shared$1);
|
|
458
455
|
initMetadataForClass(TypeScriptIrEmitter, 'TypeScriptIrEmitter', TypeScriptIrEmitter, VOID, [IrEmitter]);
|
|
459
456
|
initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
|
|
460
457
|
//endregion
|
|
@@ -518,7 +515,7 @@ function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
|
|
|
518
515
|
return 'import {' + endpoint.ep_1.l1() + '} from "./endpoint/' + endpoint.ep_1.l1() + '"';
|
|
519
516
|
}
|
|
520
517
|
function TypeScriptClientEmitter$emitClient$lambda_0(it) {
|
|
521
|
-
return 'import {type ' + it.
|
|
518
|
+
return 'import {type ' + it.ku_1 + '} from "./model/' + it.ku_1 + '"';
|
|
522
519
|
}
|
|
523
520
|
function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
524
521
|
return function (_destruct__k2r9zo) {
|
|
@@ -548,25 +545,25 @@ function TypeScriptEmitter$emit$lambda_1(this$0) {
|
|
|
548
545
|
}
|
|
549
546
|
function TypeScriptEmitter() {
|
|
550
547
|
LanguageEmitter.call(this);
|
|
551
|
-
this.
|
|
552
|
-
this.
|
|
553
|
-
this.
|
|
548
|
+
this.y1y_1 = FileExtension_TypeScript_getInstance();
|
|
549
|
+
this.z1y_1 = TypeScriptShared_getInstance();
|
|
550
|
+
this.a1z_1 = '//';
|
|
554
551
|
}
|
|
555
552
|
protoOf(TypeScriptEmitter).eq = function () {
|
|
556
|
-
return this.
|
|
553
|
+
return this.y1y_1;
|
|
557
554
|
};
|
|
558
|
-
protoOf(TypeScriptEmitter).
|
|
559
|
-
return this.
|
|
555
|
+
protoOf(TypeScriptEmitter).l1v = function () {
|
|
556
|
+
return this.z1y_1;
|
|
560
557
|
};
|
|
561
558
|
protoOf(TypeScriptEmitter).fq = function () {
|
|
562
|
-
return this.
|
|
559
|
+
return this.a1z_1;
|
|
563
560
|
};
|
|
564
561
|
protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
565
562
|
// Inline function 'kotlin.run' call
|
|
566
563
|
var $this$run = protoOf(LanguageEmitter).on.call(this, ast, logger);
|
|
567
564
|
var tmp;
|
|
568
565
|
if (hasEndpoints(ast)) {
|
|
569
|
-
tmp = NonEmptyList__plus_impl_xqmb9($this$run, this.
|
|
566
|
+
tmp = NonEmptyList__plus_impl_xqmb9($this$run, this.v1y(ast));
|
|
570
567
|
} else {
|
|
571
568
|
tmp = $this$run;
|
|
572
569
|
}
|
|
@@ -625,13 +622,13 @@ protoOf(TypeScriptEmitter).on = function (ast, logger) {
|
|
|
625
622
|
protoOf(TypeScriptEmitter).tq = function (module_0, logger) {
|
|
626
623
|
// Inline function 'kotlin.let' call
|
|
627
624
|
var it = protoOf(LanguageEmitter).tq.call(this, module_0, logger);
|
|
628
|
-
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.
|
|
625
|
+
return NonEmptyList__plus_impl_xqmb9(it, new Emitted('Wirespec', this.l1v().c1z_1));
|
|
629
626
|
};
|
|
630
627
|
protoOf(TypeScriptEmitter).uq = function (definition, module_0, logger) {
|
|
631
628
|
// Inline function 'kotlin.let' call
|
|
632
629
|
var it = protoOf(LanguageEmitter).uq.call(this, definition, module_0, logger);
|
|
633
630
|
var subPackageName = plus(Companion_instance.lr(''), definition);
|
|
634
|
-
return new Emitted(subPackageName.or() + this.
|
|
631
|
+
return new Emitted(subPackageName.or() + this.o1v(it.io_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.jo_1 + '\n '));
|
|
635
632
|
};
|
|
636
633
|
protoOf(TypeScriptEmitter).yq = function (union) {
|
|
637
634
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -641,7 +638,7 @@ protoOf(TypeScriptEmitter).yq = function (union) {
|
|
|
641
638
|
var _iterator__ex2g4s = this_0.t();
|
|
642
639
|
while (_iterator__ex2g4s.u()) {
|
|
643
640
|
var e = _iterator__ex2g4s.v();
|
|
644
|
-
var key = e.
|
|
641
|
+
var key = e.ku_1;
|
|
645
642
|
if (set.x(key)) {
|
|
646
643
|
list.x(e);
|
|
647
644
|
}
|
|
@@ -652,12 +649,12 @@ protoOf(TypeScriptEmitter).yq = function (union) {
|
|
|
652
649
|
var _iterator__ex2g4s_0 = list.t();
|
|
653
650
|
while (_iterator__ex2g4s_0.u()) {
|
|
654
651
|
var item = _iterator__ex2g4s_0.v();
|
|
655
|
-
var tmp$ret$2 = 'import {type ' + item.
|
|
652
|
+
var tmp$ret$2 = 'import {type ' + item.ku_1 + "} from '../model'";
|
|
656
653
|
destination.x(tmp$ret$2);
|
|
657
654
|
}
|
|
658
655
|
var tmp = destination;
|
|
659
656
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
|
|
660
|
-
var tmp_1 = this.
|
|
657
|
+
var tmp_1 = this.w1y(union.qo_1);
|
|
661
658
|
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.ro_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
|
|
662
659
|
};
|
|
663
660
|
protoOf(TypeScriptEmitter).xq = function (channel) {
|
|
@@ -865,7 +862,7 @@ function emit_12($this, _this__u8e3s4) {
|
|
|
865
862
|
return Spacer_instance.toString() + $this.wq(_this__u8e3s4.lp_1) + ': ' + $this.xp(_this__u8e3s4.mp_1);
|
|
866
863
|
}
|
|
867
864
|
function emit_13($this, _this__u8e3s4) {
|
|
868
|
-
return $this.wq(_this__u8e3s4.jq_1) + (_this__u8e3s4.kq_1.
|
|
865
|
+
return $this.wq(_this__u8e3s4.jq_1) + (_this__u8e3s4.kq_1.cu() ? '?' : '') + ': ' + $this.xp(_this__u8e3s4.kq_1.eu(false));
|
|
869
866
|
}
|
|
870
867
|
function emitDeserialize($this, _this__u8e3s4) {
|
|
871
868
|
return $this.wq(_this__u8e3s4.me_1.lp_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.le_1 + '])';
|
|
@@ -884,7 +881,7 @@ function joinToObject($this, _this__u8e3s4, transform) {
|
|
|
884
881
|
return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
|
|
885
882
|
}
|
|
886
883
|
function emitHandleFunction($this, endpoint) {
|
|
887
|
-
return Companion_instance_0.pq($this.
|
|
884
|
+
return Companion_instance_0.pq($this.w1y(endpoint.ep_1)) + ': (request:Request) => Promise<Response>';
|
|
888
885
|
}
|
|
889
886
|
function lowercase($this, _this__u8e3s4) {
|
|
890
887
|
// Inline function 'kotlin.text.lowercase' call
|
|
@@ -1040,64 +1037,13 @@ function TypeScriptEnumDefinitionEmitter() {
|
|
|
1040
1037
|
}
|
|
1041
1038
|
function TypeScriptIdentifierEmitter() {
|
|
1042
1039
|
}
|
|
1043
|
-
function TypeScriptIrEmitter$shared$o$source$lambda(element, transformer) {
|
|
1044
|
-
var tmp;
|
|
1045
|
-
if (element instanceof Namespace) {
|
|
1046
|
-
var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? listOf(new RawElement('export type Type = string')) : emptyList();
|
|
1047
|
-
var tmp_0;
|
|
1048
|
-
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1049
|
-
if (!injected.r()) {
|
|
1050
|
-
tmp_0 = withElements(element, plus_0(injected, element.v1m()));
|
|
1051
|
-
} else {
|
|
1052
|
-
tmp_0 = element;
|
|
1053
|
-
}
|
|
1054
|
-
tmp = tmp_0;
|
|
1055
|
-
} else {
|
|
1056
|
-
tmp = element;
|
|
1057
|
-
}
|
|
1058
|
-
var transformed = tmp;
|
|
1059
|
-
return transformChildren(transformed, transformer);
|
|
1060
|
-
}
|
|
1061
|
-
function TypeScriptIrEmitter$shared$o$source$lambda_0(this$0) {
|
|
1062
|
-
return function (element, transformer) {
|
|
1063
|
-
var tmp;
|
|
1064
|
-
if (element instanceof Namespace) {
|
|
1065
|
-
var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? listOf(new RawElement(this$0.u20_1)) : emptyList();
|
|
1066
|
-
var tmp_0;
|
|
1067
|
-
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1068
|
-
if (!injected.r()) {
|
|
1069
|
-
tmp_0 = withElements(element, plus_0(element.v1m(), injected));
|
|
1070
|
-
} else {
|
|
1071
|
-
tmp_0 = element;
|
|
1072
|
-
}
|
|
1073
|
-
tmp = tmp_0;
|
|
1074
|
-
} else {
|
|
1075
|
-
tmp = element;
|
|
1076
|
-
}
|
|
1077
|
-
var transformed = tmp;
|
|
1078
|
-
return transformChildren(transformed, transformer);
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
1040
|
function _get_sanitizationConfig__sns434($this) {
|
|
1082
|
-
var tmp0 = $this.
|
|
1041
|
+
var tmp0 = $this.f1z_1;
|
|
1083
1042
|
var tmp = KProperty1;
|
|
1084
1043
|
// Inline function 'kotlin.getValue' call
|
|
1085
1044
|
getPropertyCallableRef('sanitizationConfig', 1, tmp, TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh(), null);
|
|
1086
1045
|
return tmp0.l1();
|
|
1087
1046
|
}
|
|
1088
|
-
function buildApiConst($this, endpoint) {
|
|
1089
|
-
var apiName = firstToLower($this, endpoint.ep_1.l1());
|
|
1090
|
-
var method = endpoint.fp_1.a3_1;
|
|
1091
|
-
var pathString = joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$buildApiConst$lambda);
|
|
1092
|
-
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 '));
|
|
1093
|
-
}
|
|
1094
|
-
function transformPatternSwitchToValueSwitch($this) {
|
|
1095
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1096
|
-
// Inline function 'kotlin.apply' call
|
|
1097
|
-
var this_0 = new TransformerBuilder();
|
|
1098
|
-
this_0.g1u(TypeScriptIrEmitter$transformPatternSwitchToValueSwitch$lambda);
|
|
1099
|
-
return this_0.e1h();
|
|
1100
|
-
}
|
|
1101
1047
|
function sanitize($this, _this__u8e3s4) {
|
|
1102
1048
|
return '"' + _this__u8e3s4.l1() + '"';
|
|
1103
1049
|
}
|
|
@@ -1120,7 +1066,7 @@ function sanitizeSymbol_1($this, _this__u8e3s4) {
|
|
|
1120
1066
|
return destination.toString();
|
|
1121
1067
|
}
|
|
1122
1068
|
function sanitizeKeywords($this, _this__u8e3s4) {
|
|
1123
|
-
return Companion_getInstance_0().
|
|
1069
|
+
return Companion_getInstance_0().g1z_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
1124
1070
|
}
|
|
1125
1071
|
function firstToLower($this, _this__u8e3s4) {
|
|
1126
1072
|
// Inline function 'kotlin.text.replaceFirstChar' call
|
|
@@ -1154,7 +1100,7 @@ function sanitizeParamName($this, identifier) {
|
|
|
1154
1100
|
}
|
|
1155
1101
|
}
|
|
1156
1102
|
var parts = destination;
|
|
1157
|
-
var name = parts.a1() > 1 ? (new Name(parts)).
|
|
1103
|
+
var name = parts.a1() > 1 ? (new Name(parts)).q1l() : identifier.l1();
|
|
1158
1104
|
return sanitizeKeywords($this, sanitizeSymbol_1($this, name));
|
|
1159
1105
|
}
|
|
1160
1106
|
function buildEndpointParams($this, endpoint) {
|
|
@@ -1177,26 +1123,26 @@ function buildEndpointParams($this, endpoint) {
|
|
|
1177
1123
|
var _iterator__ex2g4s_0 = destination.t();
|
|
1178
1124
|
while (_iterator__ex2g4s_0.u()) {
|
|
1179
1125
|
var element_0 = _iterator__ex2g4s_0.v();
|
|
1180
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.lp_1), emitTypeScriptReference($this, element_0.mp_1.
|
|
1126
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_0.lp_1), emitTypeScriptReference($this, element_0.mp_1.eu(false)), element_0.mp_1.cu()));
|
|
1181
1127
|
}
|
|
1182
1128
|
// Inline function 'kotlin.collections.forEach' call
|
|
1183
1129
|
var _iterator__ex2g4s_1 = endpoint.hp_1.t();
|
|
1184
1130
|
while (_iterator__ex2g4s_1.u()) {
|
|
1185
1131
|
var element_1 = _iterator__ex2g4s_1.v();
|
|
1186
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.ap_1), emitTypeScriptReference($this, element_1.bp_1.
|
|
1132
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_1.ap_1), emitTypeScriptReference($this, element_1.bp_1.eu(false)), element_1.bp_1.cu()));
|
|
1187
1133
|
}
|
|
1188
1134
|
// Inline function 'kotlin.collections.forEach' call
|
|
1189
1135
|
var _iterator__ex2g4s_2 = endpoint.ip_1.t();
|
|
1190
1136
|
while (_iterator__ex2g4s_2.u()) {
|
|
1191
1137
|
var element_2 = _iterator__ex2g4s_2.v();
|
|
1192
|
-
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.ap_1), emitTypeScriptReference($this, element_2.bp_1.
|
|
1138
|
+
this_0.x(new EndpointParam(sanitizeParamName($this, element_2.ap_1), emitTypeScriptReference($this, element_2.bp_1.eu(false)), element_2.bp_1.cu()));
|
|
1193
1139
|
}
|
|
1194
1140
|
var tmp0_safe_receiver = first(endpoint.jp_1).np_1;
|
|
1195
1141
|
if (tmp0_safe_receiver == null)
|
|
1196
1142
|
null;
|
|
1197
1143
|
else {
|
|
1198
1144
|
// Inline function 'kotlin.let' call
|
|
1199
|
-
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.pp_1.
|
|
1145
|
+
this_0.x(new EndpointParam('body', emitTypeScriptReference($this, tmp0_safe_receiver.pp_1.eu(false)), tmp0_safe_receiver.pp_1.cu()));
|
|
1200
1146
|
}
|
|
1201
1147
|
return this_0.o5();
|
|
1202
1148
|
}
|
|
@@ -1215,10 +1161,10 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1215
1161
|
tmp = 'any';
|
|
1216
1162
|
} else {
|
|
1217
1163
|
if (ref instanceof Custom) {
|
|
1218
|
-
tmp = sanitizeSymbol_1($this, ref.
|
|
1164
|
+
tmp = sanitizeSymbol_1($this, ref.ku_1);
|
|
1219
1165
|
} else {
|
|
1220
1166
|
if (ref instanceof Primitive) {
|
|
1221
|
-
var tmp1_subject = ref.
|
|
1167
|
+
var tmp1_subject = ref.ou_1;
|
|
1222
1168
|
var tmp_0;
|
|
1223
1169
|
if (tmp1_subject instanceof String_0) {
|
|
1224
1170
|
tmp_0 = 'string';
|
|
@@ -1251,20 +1197,20 @@ function emitTypeScriptReference($this, ref) {
|
|
|
1251
1197
|
}
|
|
1252
1198
|
}
|
|
1253
1199
|
// Inline function 'kotlin.let' call
|
|
1254
|
-
return tmp + (ref.
|
|
1200
|
+
return tmp + (ref.cu() ? ' | undefined' : '');
|
|
1255
1201
|
}
|
|
1256
1202
|
function EndpointParam(name, type, nullable) {
|
|
1257
|
-
this.
|
|
1258
|
-
this.
|
|
1259
|
-
this.
|
|
1203
|
+
this.h1z_1 = name;
|
|
1204
|
+
this.i1z_1 = type;
|
|
1205
|
+
this.j1z_1 = nullable;
|
|
1260
1206
|
}
|
|
1261
1207
|
protoOf(EndpointParam).toString = function () {
|
|
1262
|
-
return 'EndpointParam(name=' + this.
|
|
1208
|
+
return 'EndpointParam(name=' + this.h1z_1 + ', type=' + this.i1z_1 + ', nullable=' + this.j1z_1 + ')';
|
|
1263
1209
|
};
|
|
1264
1210
|
protoOf(EndpointParam).hashCode = function () {
|
|
1265
|
-
var result = getStringHashCode(this.
|
|
1266
|
-
result = imul(result, 31) + getStringHashCode(this.
|
|
1267
|
-
result = imul(result, 31) + getBooleanHashCode(this.
|
|
1211
|
+
var result = getStringHashCode(this.h1z_1);
|
|
1212
|
+
result = imul(result, 31) + getStringHashCode(this.i1z_1) | 0;
|
|
1213
|
+
result = imul(result, 31) + getBooleanHashCode(this.j1z_1) | 0;
|
|
1268
1214
|
return result;
|
|
1269
1215
|
};
|
|
1270
1216
|
protoOf(EndpointParam).equals = function (other) {
|
|
@@ -1272,17 +1218,17 @@ protoOf(EndpointParam).equals = function (other) {
|
|
|
1272
1218
|
return true;
|
|
1273
1219
|
if (!(other instanceof EndpointParam))
|
|
1274
1220
|
return false;
|
|
1275
|
-
if (!(this.
|
|
1221
|
+
if (!(this.h1z_1 === other.h1z_1))
|
|
1276
1222
|
return false;
|
|
1277
|
-
if (!(this.
|
|
1223
|
+
if (!(this.i1z_1 === other.i1z_1))
|
|
1278
1224
|
return false;
|
|
1279
|
-
if (!(this.
|
|
1225
|
+
if (!(this.j1z_1 === other.j1z_1))
|
|
1280
1226
|
return false;
|
|
1281
1227
|
return true;
|
|
1282
1228
|
};
|
|
1283
1229
|
function Companion() {
|
|
1284
1230
|
Companion_instance_1 = this;
|
|
1285
|
-
this.
|
|
1231
|
+
this.g1z_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']);
|
|
1286
1232
|
}
|
|
1287
1233
|
var Companion_instance_1;
|
|
1288
1234
|
function Companion_getInstance_0() {
|
|
@@ -1291,17 +1237,17 @@ function Companion_getInstance_0() {
|
|
|
1291
1237
|
return Companion_instance_1;
|
|
1292
1238
|
}
|
|
1293
1239
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
|
|
1294
|
-
return
|
|
1240
|
+
return it;
|
|
1295
1241
|
}
|
|
1296
1242
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0) {
|
|
1297
1243
|
return function (name) {
|
|
1298
|
-
var sanitized = name.
|
|
1244
|
+
var sanitized = name.m1h_1.a1() > 1 ? name.q1l() : sanitizeSymbol_1(this$0, name.r1h());
|
|
1299
1245
|
return new Name(listOf(sanitized));
|
|
1300
1246
|
};
|
|
1301
1247
|
}
|
|
1302
1248
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0) {
|
|
1303
1249
|
return function (name) {
|
|
1304
|
-
var sanitized = name.
|
|
1250
|
+
var sanitized = name.m1h_1.a1() > 1 ? name.q1l() : sanitizeSymbol_1(this$0, name.r1h());
|
|
1305
1251
|
return new Name(listOf(sanitized));
|
|
1306
1252
|
};
|
|
1307
1253
|
}
|
|
@@ -1327,12 +1273,12 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1327
1273
|
return function (stmt, tr) {
|
|
1328
1274
|
var tmp;
|
|
1329
1275
|
if (stmt instanceof VariableReference) {
|
|
1330
|
-
tmp = new VariableReference(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.
|
|
1276
|
+
tmp = new VariableReference(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.f1o_1));
|
|
1331
1277
|
} else {
|
|
1332
1278
|
if (stmt instanceof ConstructorStatement) {
|
|
1333
|
-
var tmp_0 = tr.
|
|
1279
|
+
var tmp_0 = tr.o1t(stmt.o1m_1);
|
|
1334
1280
|
// Inline function 'kotlin.collections.map' call
|
|
1335
|
-
var this_0 = stmt.
|
|
1281
|
+
var this_0 = stmt.p1m_1;
|
|
1336
1282
|
// Inline function 'kotlin.collections.mapTo' call
|
|
1337
1283
|
var destination = ArrayList_init_$Create$_0(this_0.a1());
|
|
1338
1284
|
// Inline function 'kotlin.collections.iterator' call
|
|
@@ -1343,15 +1289,15 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1343
1289
|
var key = item.k1();
|
|
1344
1290
|
// Inline function 'kotlin.collections.component2' call
|
|
1345
1291
|
var value = item.l1();
|
|
1346
|
-
var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), key), tr.
|
|
1292
|
+
var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), key), tr.r1t(value));
|
|
1347
1293
|
destination.x(tmp$ret$3);
|
|
1348
1294
|
}
|
|
1349
1295
|
tmp = new ConstructorStatement(tmp_0, toMap(destination));
|
|
1350
1296
|
} else {
|
|
1351
1297
|
if (stmt instanceof Assignment) {
|
|
1352
|
-
tmp = new Assignment(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.
|
|
1298
|
+
tmp = new Assignment(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), stmt.i1o_1), tr.r1t(stmt.j1o_1), stmt.k1o_1);
|
|
1353
1299
|
} else {
|
|
1354
|
-
tmp =
|
|
1300
|
+
tmp = transformChildren(stmt, tr);
|
|
1355
1301
|
}
|
|
1356
1302
|
}
|
|
1357
1303
|
}
|
|
@@ -1360,7 +1306,7 @@ function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0)
|
|
|
1360
1306
|
}
|
|
1361
1307
|
function TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
|
|
1362
1308
|
return function () {
|
|
1363
|
-
var tmp0_reservedKeywords = Companion_getInstance_0().
|
|
1309
|
+
var tmp0_reservedKeywords = Companion_getInstance_0().g1z_1;
|
|
1364
1310
|
var tmp = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda;
|
|
1365
1311
|
var tmp_0 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0);
|
|
1366
1312
|
var tmp_1 = TypeScriptIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0);
|
|
@@ -1373,107 +1319,33 @@ function TypeScriptIrEmitter$_get_sanitizationConfig_$ref_f6f0bh() {
|
|
|
1373
1319
|
return _get_sanitizationConfig__sns434(p0);
|
|
1374
1320
|
};
|
|
1375
1321
|
}
|
|
1376
|
-
function TypeScriptIrEmitter$
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1381
|
-
var this_0 = convert(new Shared(this.v20_1));
|
|
1382
|
-
var scope = new TransformScope(this_0);
|
|
1383
|
-
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectBefore' call
|
|
1384
|
-
var tmp_0 = scope;
|
|
1385
|
-
// Inline function 'community.flock.wirespec.ir.core.injectBefore' call
|
|
1386
|
-
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1387
|
-
var this_1 = scope.z1t_1;
|
|
1388
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1389
|
-
// Inline function 'kotlin.apply' call
|
|
1390
|
-
var this_2 = new TransformerBuilder();
|
|
1391
|
-
this_2.d1h(TypeScriptIrEmitter$shared$o$source$lambda);
|
|
1392
|
-
var tmp$ret$2 = this_2.e1h();
|
|
1393
|
-
tmp_0.z1t_1 = transform(this_1, tmp$ret$2);
|
|
1394
|
-
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
|
|
1395
|
-
var tmp_1 = scope;
|
|
1396
|
-
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1397
|
-
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1398
|
-
var this_3 = scope.z1t_1;
|
|
1399
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1400
|
-
// Inline function 'kotlin.apply' call
|
|
1401
|
-
var this_4 = new TransformerBuilder();
|
|
1402
|
-
this_4.d1h(TypeScriptIrEmitter$shared$o$source$lambda_0(this));
|
|
1403
|
-
var tmp$ret$8 = this_4.e1h();
|
|
1404
|
-
tmp_1.z1t_1 = transform(this_3, tmp$ret$8);
|
|
1405
|
-
var tmp_2 = scope.z1t_1;
|
|
1406
|
-
var tmp$ret$13 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
|
|
1407
|
-
tmp.w20_1 = generateTypeScript(tmp$ret$13);
|
|
1408
|
-
}
|
|
1409
|
-
protoOf(TypeScriptIrEmitter$shared$1).r1w = function () {
|
|
1410
|
-
return this.w20_1;
|
|
1411
|
-
};
|
|
1412
|
-
function TypeScriptIrEmitter$emit$lambda(it) {
|
|
1413
|
-
return 'export {' + it.vq().l1() + "} from './" + it.vq().l1() + "'";
|
|
1414
|
-
}
|
|
1415
|
-
function TypeScriptIrEmitter$emit$lambda$lambda($fieldNames) {
|
|
1416
|
-
return function (s, t) {
|
|
1417
|
-
var tmp;
|
|
1322
|
+
function TypeScriptIrEmitter$emitShared$lambda(element, transformer) {
|
|
1323
|
+
var tmp;
|
|
1324
|
+
if (element instanceof Namespace) {
|
|
1325
|
+
var injected = element.x1m_1.equals(Companion_getInstance().l1h('Wirespec')) ? listOf(new RawElement('export type Type = string')) : emptyList();
|
|
1418
1326
|
var tmp_0;
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
tmp_2 = s.b1m_1.equals(Companion_getInstance().m1h('validate'));
|
|
1423
|
-
} else {
|
|
1424
|
-
tmp_2 = false;
|
|
1425
|
-
}
|
|
1426
|
-
if (tmp_2) {
|
|
1427
|
-
tmp_1 = !(s.z1l_1 == null);
|
|
1428
|
-
} else {
|
|
1429
|
-
tmp_1 = false;
|
|
1430
|
-
}
|
|
1431
|
-
if (tmp_1) {
|
|
1432
|
-
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1433
|
-
tmp_0 = !s.a1m_1.r();
|
|
1434
|
-
} else {
|
|
1435
|
-
tmp_0 = false;
|
|
1436
|
-
}
|
|
1437
|
-
if (tmp_0) {
|
|
1438
|
-
var tmp_3 = first(s.a1m_1);
|
|
1439
|
-
var tmp0_safe_receiver = tmp_3 instanceof Custom_0 ? tmp_3 : null;
|
|
1440
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1h_1;
|
|
1441
|
-
var typeName = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
|
|
1442
|
-
tmp = new FunctionCall(VOID, VOID, Companion_getInstance().m1h('validate' + typeName), mapOf(to(Companion_getInstance().m1h('obj'), t.u1t(ensureNotNull(s.z1l_1)))));
|
|
1327
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1328
|
+
if (!injected.r()) {
|
|
1329
|
+
tmp_0 = withElements(element, plus_0(injected, element.t1m()));
|
|
1443
1330
|
} else {
|
|
1444
|
-
|
|
1445
|
-
var tmp_5;
|
|
1446
|
-
if (s instanceof FieldCall) {
|
|
1447
|
-
tmp_5 = s.i1p_1 == null;
|
|
1448
|
-
} else {
|
|
1449
|
-
tmp_5 = false;
|
|
1450
|
-
}
|
|
1451
|
-
if (tmp_5) {
|
|
1452
|
-
tmp_4 = $fieldNames.u1(s.j1p_1.r1l());
|
|
1453
|
-
} else {
|
|
1454
|
-
tmp_4 = false;
|
|
1455
|
-
}
|
|
1456
|
-
if (tmp_4) {
|
|
1457
|
-
tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('obj')), s.j1p_1);
|
|
1458
|
-
} else {
|
|
1459
|
-
tmp = transformChildren_0(s, t);
|
|
1460
|
-
}
|
|
1331
|
+
tmp_0 = element;
|
|
1461
1332
|
}
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1333
|
+
tmp = tmp_0;
|
|
1334
|
+
} else {
|
|
1335
|
+
tmp = element;
|
|
1336
|
+
}
|
|
1337
|
+
var transformed = tmp;
|
|
1338
|
+
return transformChildren_0(transformed, transformer);
|
|
1464
1339
|
}
|
|
1465
|
-
function TypeScriptIrEmitter$
|
|
1340
|
+
function TypeScriptIrEmitter$emitShared$lambda_0($api) {
|
|
1466
1341
|
return function (element, transformer) {
|
|
1467
1342
|
var tmp;
|
|
1468
|
-
if (element instanceof
|
|
1343
|
+
if (element instanceof Namespace) {
|
|
1344
|
+
var injected = element.x1m_1.equals(Companion_getInstance().l1h('Wirespec')) ? listOf(new RawElement($api)) : emptyList();
|
|
1469
1345
|
var tmp_0;
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
var scope = new TransformScope(this_0);
|
|
1474
|
-
scope.i1u(TypeScriptIrEmitter$emit$lambda$lambda($fieldNames));
|
|
1475
|
-
var tmp_1 = scope.z1t_1;
|
|
1476
|
-
tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1346
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1347
|
+
if (!injected.r()) {
|
|
1348
|
+
tmp_0 = withElements(element, plus_0(element.t1m(), injected));
|
|
1477
1349
|
} else {
|
|
1478
1350
|
tmp_0 = element;
|
|
1479
1351
|
}
|
|
@@ -1482,92 +1354,21 @@ function TypeScriptIrEmitter$emit$lambda_0($type, $fieldNames) {
|
|
|
1482
1354
|
tmp = element;
|
|
1483
1355
|
}
|
|
1484
1356
|
var transformed = tmp;
|
|
1485
|
-
return
|
|
1357
|
+
return transformChildren_0(transformed, transformer);
|
|
1486
1358
|
};
|
|
1487
1359
|
}
|
|
1488
|
-
function TypeScriptIrEmitter$emit$
|
|
1489
|
-
|
|
1490
|
-
if (stmt instanceof Switch) {
|
|
1491
|
-
var tmp1_safe_receiver = stmt.o1p_1;
|
|
1492
|
-
var tmp_0;
|
|
1493
|
-
if (tmp1_safe_receiver == null) {
|
|
1494
|
-
tmp_0 = null;
|
|
1495
|
-
} else {
|
|
1496
|
-
// Inline function 'kotlin.collections.map' call
|
|
1497
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1498
|
-
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_safe_receiver, 10));
|
|
1499
|
-
var _iterator__ex2g4s = tmp1_safe_receiver.t();
|
|
1500
|
-
while (_iterator__ex2g4s.u()) {
|
|
1501
|
-
var item = _iterator__ex2g4s.v();
|
|
1502
|
-
var tmp_1;
|
|
1503
|
-
var tmp_2;
|
|
1504
|
-
if (item instanceof ErrorStatement) {
|
|
1505
|
-
var tmp_3 = item.s1p_1;
|
|
1506
|
-
tmp_2 = tmp_3 instanceof BinaryOp;
|
|
1507
|
-
} else {
|
|
1508
|
-
tmp_2 = false;
|
|
1509
|
-
}
|
|
1510
|
-
if (tmp_2) {
|
|
1511
|
-
var tmp_4 = item.s1p_1;
|
|
1512
|
-
var binary = tmp_4 instanceof BinaryOp ? tmp_4 : THROW_CCE();
|
|
1513
|
-
var tmp_5 = binary.t1p_1;
|
|
1514
|
-
var literal = tmp_5 instanceof Literal_0 ? tmp_5 : null;
|
|
1515
|
-
tmp_1 = !(literal == null) ? new ErrorStatement(new Literal_0(trimEnd(toString(literal.d1p_1), charArrayOf([_Char___init__impl__6a9atx(32)])), literal.e1p_1)) : item;
|
|
1516
|
-
} else {
|
|
1517
|
-
tmp_1 = item;
|
|
1518
|
-
}
|
|
1519
|
-
var tmp$ret$0 = tmp_1;
|
|
1520
|
-
destination.x(tmp$ret$0);
|
|
1521
|
-
}
|
|
1522
|
-
tmp_0 = destination;
|
|
1523
|
-
}
|
|
1524
|
-
tmp = transformChildren_0(stmt.r1p(VOID, VOID, tmp_0), transformer);
|
|
1525
|
-
} else {
|
|
1526
|
-
tmp = transformChildren_0(stmt, transformer);
|
|
1527
|
-
}
|
|
1528
|
-
return tmp;
|
|
1529
|
-
}
|
|
1530
|
-
function TypeScriptIrEmitter$emit$lambda_2(element, transformer) {
|
|
1531
|
-
var tmp;
|
|
1532
|
-
if (element instanceof Interface) {
|
|
1533
|
-
var tmp_0;
|
|
1534
|
-
if (element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
|
|
1535
|
-
// Inline function 'kotlin.collections.map' call
|
|
1536
|
-
var this_0 = element.n1o_1;
|
|
1537
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1538
|
-
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1539
|
-
var _iterator__ex2g4s = this_0.t();
|
|
1540
|
-
while (_iterator__ex2g4s.u()) {
|
|
1541
|
-
var item = _iterator__ex2g4s.v();
|
|
1542
|
-
var tmp_1;
|
|
1543
|
-
if (item instanceof Function) {
|
|
1544
|
-
tmp_1 = item.b1k(VOID, VOID, listOf(new Parameter(Companion_getInstance().m1h('params'), new Custom_0('RequestParams'))));
|
|
1545
|
-
} else {
|
|
1546
|
-
tmp_1 = item;
|
|
1547
|
-
}
|
|
1548
|
-
var tmp$ret$0 = tmp_1;
|
|
1549
|
-
destination.x(tmp$ret$0);
|
|
1550
|
-
}
|
|
1551
|
-
tmp_0 = element.t1o(VOID, destination);
|
|
1552
|
-
} else {
|
|
1553
|
-
tmp_0 = element;
|
|
1554
|
-
}
|
|
1555
|
-
tmp = tmp_0;
|
|
1556
|
-
} else {
|
|
1557
|
-
tmp = element;
|
|
1558
|
-
}
|
|
1559
|
-
var transformed = tmp;
|
|
1560
|
-
return transformChildren(transformed, transformer);
|
|
1360
|
+
function TypeScriptIrEmitter$emit$lambda(it) {
|
|
1361
|
+
return 'export {' + it.vq().l1() + "} from './" + it.vq().l1() + "'";
|
|
1561
1362
|
}
|
|
1562
|
-
function TypeScriptIrEmitter$emit$
|
|
1363
|
+
function TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint) {
|
|
1563
1364
|
return function (element, transformer) {
|
|
1564
1365
|
var tmp;
|
|
1565
1366
|
if (element instanceof Namespace) {
|
|
1566
|
-
var injected = listOf(buildApiConst(
|
|
1367
|
+
var injected = listOf(buildApiConst($endpoint));
|
|
1567
1368
|
var tmp_0;
|
|
1568
1369
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1569
1370
|
if (!injected.r()) {
|
|
1570
|
-
tmp_0 = withElements(element, plus_0(element.
|
|
1371
|
+
tmp_0 = withElements(element, plus_0(element.t1m(), injected));
|
|
1571
1372
|
} else {
|
|
1572
1373
|
tmp_0 = element;
|
|
1573
1374
|
}
|
|
@@ -1576,21 +1377,28 @@ function TypeScriptIrEmitter$emit$lambda_3(this$0, $endpoint) {
|
|
|
1576
1377
|
tmp = element;
|
|
1577
1378
|
}
|
|
1578
1379
|
var transformed = tmp;
|
|
1579
|
-
return
|
|
1380
|
+
return transformChildren_0(transformed, transformer);
|
|
1580
1381
|
};
|
|
1581
1382
|
}
|
|
1582
|
-
function
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1383
|
+
function emit$injectApiConst(_this__u8e3s4, $endpoint) {
|
|
1384
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1385
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1386
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
|
|
1387
|
+
var tmp = scope;
|
|
1388
|
+
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1389
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1390
|
+
var this_0 = scope.w1t_1;
|
|
1391
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1392
|
+
// Inline function 'kotlin.apply' call
|
|
1393
|
+
var this_1 = new TransformerBuilder();
|
|
1394
|
+
this_1.c1h(TypeScriptIrEmitter$emit$injectApiConst$lambda($endpoint));
|
|
1395
|
+
var tmp$ret$2 = this_1.d1h();
|
|
1396
|
+
tmp.w1t_1 = transform(this_0, tmp$ret$2);
|
|
1397
|
+
var tmp_0 = scope.w1t_1;
|
|
1398
|
+
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1399
|
+
}
|
|
1400
|
+
function emit$applyCallParamsIfNeeded(_this__u8e3s4, hasRequestParams) {
|
|
1401
|
+
return hasRequestParams ? bindCallToRequestParams(_this__u8e3s4) : _this__u8e3s4;
|
|
1594
1402
|
}
|
|
1595
1403
|
function TypeScriptIrEmitter$emitClient$lambda(this$0) {
|
|
1596
1404
|
return function (it) {
|
|
@@ -1598,129 +1406,49 @@ function TypeScriptIrEmitter$emitClient$lambda(this$0) {
|
|
|
1598
1406
|
return ' ...' + methodName + 'Client(serialization, transportation),';
|
|
1599
1407
|
};
|
|
1600
1408
|
}
|
|
1601
|
-
function TypeScriptIrEmitter$transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
1602
|
-
var tmp;
|
|
1603
|
-
var tmp_0;
|
|
1604
|
-
if (stmt instanceof Switch) {
|
|
1605
|
-
var tmp0 = stmt.n1p_1;
|
|
1606
|
-
var tmp$ret$0;
|
|
1607
|
-
$l$block_0: {
|
|
1608
|
-
// Inline function 'kotlin.collections.any' call
|
|
1609
|
-
var tmp_1;
|
|
1610
|
-
if (isInterface(tmp0, Collection)) {
|
|
1611
|
-
tmp_1 = tmp0.r();
|
|
1612
|
-
} else {
|
|
1613
|
-
tmp_1 = false;
|
|
1614
|
-
}
|
|
1615
|
-
if (tmp_1) {
|
|
1616
|
-
tmp$ret$0 = false;
|
|
1617
|
-
break $l$block_0;
|
|
1618
|
-
}
|
|
1619
|
-
var _iterator__ex2g4s = tmp0.t();
|
|
1620
|
-
while (_iterator__ex2g4s.u()) {
|
|
1621
|
-
var element = _iterator__ex2g4s.v();
|
|
1622
|
-
if (!(element.a1q_1 == null)) {
|
|
1623
|
-
tmp$ret$0 = true;
|
|
1624
|
-
break $l$block_0;
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
tmp$ret$0 = false;
|
|
1628
|
-
}
|
|
1629
|
-
tmp_0 = tmp$ret$0;
|
|
1630
|
-
} else {
|
|
1631
|
-
tmp_0 = false;
|
|
1632
|
-
}
|
|
1633
|
-
if (tmp_0) {
|
|
1634
|
-
var tmp0_safe_receiver = stmt.p1p_1;
|
|
1635
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l();
|
|
1636
|
-
var varName = tmp1_elvis_lhs == null ? 'r' : tmp1_elvis_lhs;
|
|
1637
|
-
// Inline function 'kotlin.collections.map' call
|
|
1638
|
-
var this_0 = stmt.n1p_1;
|
|
1639
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1640
|
-
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1641
|
-
var _iterator__ex2g4s_0 = this_0.t();
|
|
1642
|
-
while (_iterator__ex2g4s_0.u()) {
|
|
1643
|
-
var item = _iterator__ex2g4s_0.v();
|
|
1644
|
-
var tmp_2 = item.a1q_1;
|
|
1645
|
-
var tmp0_safe_receiver_0 = tmp_2 instanceof Custom_0 ? tmp_2 : null;
|
|
1646
|
-
var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.q1h_1;
|
|
1647
|
-
var tmp2_safe_receiver = typeName == null ? null : substringAfterLast(typeName, '.');
|
|
1648
|
-
var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : removePrefix(tmp2_safe_receiver, 'Response');
|
|
1649
|
-
var statusNum = tmp3_safe_receiver == null ? null : toIntOrNull(tmp3_safe_receiver);
|
|
1650
|
-
var tmp_3;
|
|
1651
|
-
if (!(statusNum == null) && !(typeName == null)) {
|
|
1652
|
-
var exprCode = TypeScriptGenerator_instance.a1v(tr.u1t(stmt.m1p_1));
|
|
1653
|
-
var castAssignment = new Assignment(Companion_getInstance().m1h(varName), new RawExpression(exprCode + ' as ' + typeName), false);
|
|
1654
|
-
var tmp_4 = new Literal_0(statusNum, new Integer_0());
|
|
1655
|
-
var tmp_5 = listOf(castAssignment);
|
|
1656
|
-
// Inline function 'kotlin.collections.map' call
|
|
1657
|
-
var this_1 = item.z1p_1;
|
|
1658
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1659
|
-
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
1660
|
-
var _iterator__ex2g4s_1 = this_1.t();
|
|
1661
|
-
while (_iterator__ex2g4s_1.u()) {
|
|
1662
|
-
var item_0 = _iterator__ex2g4s_1.v();
|
|
1663
|
-
var tmp$ret$2 = tr.t1t(item_0);
|
|
1664
|
-
destination_0.x(tmp$ret$2);
|
|
1665
|
-
}
|
|
1666
|
-
tmp_3 = new Case(tmp_4, plus_0(tmp_5, destination_0), null);
|
|
1667
|
-
} else {
|
|
1668
|
-
// Inline function 'kotlin.collections.map' call
|
|
1669
|
-
var this_2 = item.z1p_1;
|
|
1670
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1671
|
-
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
|
|
1672
|
-
var _iterator__ex2g4s_2 = this_2.t();
|
|
1673
|
-
while (_iterator__ex2g4s_2.u()) {
|
|
1674
|
-
var item_1 = _iterator__ex2g4s_2.v();
|
|
1675
|
-
var tmp$ret$5 = tr.t1t(item_1);
|
|
1676
|
-
destination_1.x(tmp$ret$5);
|
|
1677
|
-
}
|
|
1678
|
-
tmp_3 = item.c1q(VOID, destination_1);
|
|
1679
|
-
}
|
|
1680
|
-
var tmp$ret$8 = tmp_3;
|
|
1681
|
-
destination.x(tmp$ret$8);
|
|
1682
|
-
}
|
|
1683
|
-
var transformedCases = destination;
|
|
1684
|
-
var tmp_6 = new FieldCall(tr.u1t(stmt.m1p_1), Companion_getInstance().m1h('status'));
|
|
1685
|
-
var tmp2_safe_receiver_0 = stmt.o1p_1;
|
|
1686
|
-
var tmp_7;
|
|
1687
|
-
if (tmp2_safe_receiver_0 == null) {
|
|
1688
|
-
tmp_7 = null;
|
|
1689
|
-
} else {
|
|
1690
|
-
// Inline function 'kotlin.collections.map' call
|
|
1691
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
1692
|
-
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver_0, 10));
|
|
1693
|
-
var _iterator__ex2g4s_3 = tmp2_safe_receiver_0.t();
|
|
1694
|
-
while (_iterator__ex2g4s_3.u()) {
|
|
1695
|
-
var item_2 = _iterator__ex2g4s_3.v();
|
|
1696
|
-
var tmp$ret$11 = tr.t1t(item_2);
|
|
1697
|
-
destination_2.x(tmp$ret$11);
|
|
1698
|
-
}
|
|
1699
|
-
tmp_7 = destination_2;
|
|
1700
|
-
}
|
|
1701
|
-
tmp = new Switch(tmp_6, transformedCases, tmp_7, null);
|
|
1702
|
-
} else {
|
|
1703
|
-
tmp = transformChildren_0(stmt, tr);
|
|
1704
|
-
}
|
|
1705
|
-
return tmp;
|
|
1706
|
-
}
|
|
1707
1409
|
function TypeScriptIrEmitter() {
|
|
1708
1410
|
Companion_getInstance_0();
|
|
1709
|
-
this.
|
|
1710
|
-
this.
|
|
1411
|
+
this.d1z_1 = TypeScriptGenerator_getInstance();
|
|
1412
|
+
this.e1z_1 = FileExtension_TypeScript_getInstance();
|
|
1711
1413
|
var tmp = this;
|
|
1712
|
-
tmp.
|
|
1713
|
-
var tmp_0 = this;
|
|
1714
|
-
tmp_0.a21_1 = new TypeScriptIrEmitter$shared$1();
|
|
1414
|
+
tmp.f1z_1 = lazy(TypeScriptIrEmitter$sanitizationConfig$delegate$lambda(this));
|
|
1715
1415
|
}
|
|
1716
|
-
protoOf(TypeScriptIrEmitter).
|
|
1717
|
-
return this.
|
|
1416
|
+
protoOf(TypeScriptIrEmitter).j1u = function () {
|
|
1417
|
+
return this.d1z_1;
|
|
1718
1418
|
};
|
|
1719
1419
|
protoOf(TypeScriptIrEmitter).eq = function () {
|
|
1720
|
-
return this.
|
|
1420
|
+
return this.e1z_1;
|
|
1721
1421
|
};
|
|
1722
|
-
protoOf(TypeScriptIrEmitter).
|
|
1723
|
-
|
|
1422
|
+
protoOf(TypeScriptIrEmitter).m1u = function () {
|
|
1423
|
+
var packageName = Companion_instance.lr('community.flock.wirespec');
|
|
1424
|
+
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
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1426
|
+
var this_0 = convert(packageName);
|
|
1427
|
+
var scope = new TransformScope(this_0);
|
|
1428
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectBefore' call
|
|
1429
|
+
var tmp = scope;
|
|
1430
|
+
// Inline function 'community.flock.wirespec.ir.core.injectBefore' call
|
|
1431
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1432
|
+
var this_1 = scope.w1t_1;
|
|
1433
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1434
|
+
// Inline function 'kotlin.apply' call
|
|
1435
|
+
var this_2 = new TransformerBuilder();
|
|
1436
|
+
this_2.c1h(TypeScriptIrEmitter$emitShared$lambda);
|
|
1437
|
+
var tmp$ret$2 = this_2.d1h();
|
|
1438
|
+
tmp.w1t_1 = transform(this_1, tmp$ret$2);
|
|
1439
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
|
|
1440
|
+
var tmp_0 = scope;
|
|
1441
|
+
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1442
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1443
|
+
var this_3 = scope.w1t_1;
|
|
1444
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1445
|
+
// Inline function 'kotlin.apply' call
|
|
1446
|
+
var this_4 = new TransformerBuilder();
|
|
1447
|
+
this_4.c1h(TypeScriptIrEmitter$emitShared$lambda_0(api));
|
|
1448
|
+
var tmp$ret$8 = this_4.d1h();
|
|
1449
|
+
tmp_0.w1t_1 = transform(this_3, tmp$ret$8);
|
|
1450
|
+
var tmp_1 = scope.w1t_1;
|
|
1451
|
+
return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1724
1452
|
};
|
|
1725
1453
|
protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
1726
1454
|
var tmp = emit.call(this, ast, logger);
|
|
@@ -1775,13 +1503,10 @@ protoOf(TypeScriptIrEmitter).on = function (ast, logger) {
|
|
|
1775
1503
|
}
|
|
1776
1504
|
return NonEmptyList__plus_impl_xqmb9_0(tmp, destination_1);
|
|
1777
1505
|
};
|
|
1778
|
-
protoOf(TypeScriptIrEmitter).n1u = function (module_0, logger) {
|
|
1779
|
-
return NonEmptyList__plus_impl_xqmb9(emit_0.call(this, module_0, logger), new File(Companion_getInstance().m1h('Wirespec'), listOf(new RawElement(this.t1v().r1w()))));
|
|
1780
|
-
};
|
|
1781
1506
|
protoOf(TypeScriptIrEmitter).uq = function (definition, module_0, logger) {
|
|
1782
|
-
var file =
|
|
1507
|
+
var file = emit_0.call(this, definition, module_0, logger);
|
|
1783
1508
|
var subPackageName = plus(Companion_instance.lr(''), definition);
|
|
1784
|
-
return new File(Companion_getInstance().
|
|
1509
|
+
return new File(Companion_getInstance().l1h(subPackageName.or() + sanitizeSymbol_1(this, file.r1m_1.w1l())), plus_0(listOf(import_0('../Wirespec', 'Wirespec')), file.s1m_1));
|
|
1785
1510
|
};
|
|
1786
1511
|
protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
1787
1512
|
var fieldValidations = classifyValidatableFields(type, module_0);
|
|
@@ -1792,7 +1517,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1792
1517
|
var _iterator__ex2g4s = this_0.t();
|
|
1793
1518
|
while (_iterator__ex2g4s.u()) {
|
|
1794
1519
|
var e = _iterator__ex2g4s.v();
|
|
1795
|
-
var key = e.
|
|
1520
|
+
var key = e.ku_1;
|
|
1796
1521
|
if (set.x(key)) {
|
|
1797
1522
|
list.x(e);
|
|
1798
1523
|
}
|
|
@@ -1803,7 +1528,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1803
1528
|
var _iterator__ex2g4s_0 = list.t();
|
|
1804
1529
|
while (_iterator__ex2g4s_0.u()) {
|
|
1805
1530
|
var item = _iterator__ex2g4s_0.v();
|
|
1806
|
-
var tmp$ret$2 = import_0('./' + item.
|
|
1531
|
+
var tmp$ret$2 = import_0('./' + item.ku_1, item.ku_1);
|
|
1807
1532
|
destination.x(tmp$ret$2);
|
|
1808
1533
|
}
|
|
1809
1534
|
var typeImports = destination;
|
|
@@ -1813,7 +1538,7 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1813
1538
|
var _iterator__ex2g4s_1 = fieldValidations.t();
|
|
1814
1539
|
while (_iterator__ex2g4s_1.u()) {
|
|
1815
1540
|
var item_0 = _iterator__ex2g4s_1.v();
|
|
1816
|
-
var tmp$ret$5 = item_0.
|
|
1541
|
+
var tmp$ret$5 = item_0.i1h_1;
|
|
1817
1542
|
destination_0.x(tmp$ret$5);
|
|
1818
1543
|
}
|
|
1819
1544
|
// Inline function 'kotlin.collections.filter' call
|
|
@@ -1849,29 +1574,15 @@ protoOf(TypeScriptIrEmitter).up = function (type, module_0) {
|
|
|
1849
1574
|
destination_3.x(tmp$ret$14);
|
|
1850
1575
|
}
|
|
1851
1576
|
var fieldNames = toSet(destination_3);
|
|
1852
|
-
|
|
1853
|
-
var
|
|
1854
|
-
var scope = new TransformScope(this_2);
|
|
1855
|
-
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1856
|
-
var tmp = scope;
|
|
1857
|
-
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1858
|
-
var this_3 = scope.z1t_1;
|
|
1859
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1860
|
-
// Inline function 'kotlin.apply' call
|
|
1861
|
-
var this_4 = new TransformerBuilder();
|
|
1862
|
-
this_4.d1h(TypeScriptIrEmitter$emit$lambda_0(type, fieldNames));
|
|
1863
|
-
var tmp$ret$19 = this_4.e1h();
|
|
1864
|
-
tmp.z1t_1 = transform(this_3, tmp$ret$19);
|
|
1865
|
-
var tmp_0 = scope.z1t_1;
|
|
1866
|
-
var file = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1867
|
-
var tmp_1;
|
|
1577
|
+
var file = renameValidateAndBindObjReceiver(sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this)), type.vo_1.l1(), fieldNames);
|
|
1578
|
+
var tmp;
|
|
1868
1579
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1869
1580
|
if (!allImports.r()) {
|
|
1870
|
-
|
|
1581
|
+
tmp = file.v1m(VOID, plus_0(allImports, file.s1m_1));
|
|
1871
1582
|
} else {
|
|
1872
|
-
|
|
1583
|
+
tmp = file;
|
|
1873
1584
|
}
|
|
1874
|
-
return
|
|
1585
|
+
return tmp;
|
|
1875
1586
|
};
|
|
1876
1587
|
protoOf(TypeScriptIrEmitter).ir = function (enum_0, module_0) {
|
|
1877
1588
|
return sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
|
|
@@ -1884,7 +1595,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1884
1595
|
var _iterator__ex2g4s = this_0.t();
|
|
1885
1596
|
while (_iterator__ex2g4s.u()) {
|
|
1886
1597
|
var e = _iterator__ex2g4s.v();
|
|
1887
|
-
var key = e.
|
|
1598
|
+
var key = e.ku_1;
|
|
1888
1599
|
if (set.x(key)) {
|
|
1889
1600
|
list.x(e);
|
|
1890
1601
|
}
|
|
@@ -1895,7 +1606,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1895
1606
|
var _iterator__ex2g4s_0 = list.t();
|
|
1896
1607
|
while (_iterator__ex2g4s_0.u()) {
|
|
1897
1608
|
var item = _iterator__ex2g4s_0.v();
|
|
1898
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1609
|
+
var tmp$ret$2 = import_0('../model', item.ku_1, true);
|
|
1899
1610
|
destination.x(tmp$ret$2);
|
|
1900
1611
|
}
|
|
1901
1612
|
var imports = destination;
|
|
@@ -1903,7 +1614,7 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1903
1614
|
var tmp;
|
|
1904
1615
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1905
1616
|
if (!imports.r()) {
|
|
1906
|
-
tmp = file.
|
|
1617
|
+
tmp = file.v1m(VOID, plus_0(imports, file.s1m_1));
|
|
1907
1618
|
} else {
|
|
1908
1619
|
tmp = file;
|
|
1909
1620
|
}
|
|
@@ -1911,9 +1622,9 @@ protoOf(TypeScriptIrEmitter).yq = function (union) {
|
|
|
1911
1622
|
};
|
|
1912
1623
|
protoOf(TypeScriptIrEmitter).dr = function (refined) {
|
|
1913
1624
|
var converted = convert_2(refined);
|
|
1914
|
-
var constraintExpr = convertConstraint(refined.cr_1, new VariableReference(Companion_getInstance().
|
|
1915
|
-
var validatorStr =
|
|
1916
|
-
return new File(converted.
|
|
1625
|
+
var constraintExpr = convertConstraint(refined.cr_1, new VariableReference(Companion_getInstance().l1h('value')));
|
|
1626
|
+
var validatorStr = TypeScriptGenerator_getInstance().u1u(constraintExpr);
|
|
1627
|
+
return new File(converted.r1m_1, listOf_0([new RawElement('export type ' + converted.r1m_1.w1l() + ' = ' + emitTypeScriptReference(this, refined.cr_1) + ';'), new RawElement('export const validate' + refined.br_1.l1() + ' = (value: ' + emitTypeScriptReference(this, refined.cr_1) + ') =>\n ' + validatorStr + ';')]));
|
|
1917
1628
|
};
|
|
1918
1629
|
protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
1919
1630
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -1923,7 +1634,7 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1923
1634
|
var _iterator__ex2g4s = this_0.t();
|
|
1924
1635
|
while (_iterator__ex2g4s.u()) {
|
|
1925
1636
|
var e = _iterator__ex2g4s.v();
|
|
1926
|
-
var key = e.
|
|
1637
|
+
var key = e.ku_1;
|
|
1927
1638
|
if (set.x(key)) {
|
|
1928
1639
|
list.x(e);
|
|
1929
1640
|
}
|
|
@@ -1934,69 +1645,33 @@ protoOf(TypeScriptIrEmitter).jr = function (endpoint) {
|
|
|
1934
1645
|
var _iterator__ex2g4s_0 = list.t();
|
|
1935
1646
|
while (_iterator__ex2g4s_0.u()) {
|
|
1936
1647
|
var item = _iterator__ex2g4s_0.v();
|
|
1937
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1648
|
+
var tmp$ret$2 = import_0('../model', item.ku_1, true);
|
|
1938
1649
|
destination.x(tmp$ret$2);
|
|
1939
1650
|
}
|
|
1940
1651
|
var imports = destination;
|
|
1941
1652
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1942
1653
|
var hasRequestParams = !requestParameters(endpoint).r();
|
|
1943
1654
|
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1944
|
-
var this_1 = convert_3(endpoint);
|
|
1655
|
+
var this_1 = stripTrailingSpaceFromErrorMessage(convert_3(endpoint));
|
|
1945
1656
|
var scope = new TransformScope(this_1);
|
|
1946
|
-
scope.
|
|
1947
|
-
var tmp = scope.
|
|
1948
|
-
|
|
1949
|
-
var this_2 = isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1950
|
-
var scope_0 = new TransformScope(this_2);
|
|
1951
|
-
scope_0.e1u(transformPatternSwitchToValueSwitch(this));
|
|
1952
|
-
var tmp_0 = scope_0.z1t_1;
|
|
1953
|
-
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1954
|
-
var this_3 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1955
|
-
var scope_1 = new TransformScope(this_3);
|
|
1956
|
-
if (hasRequestParams) {
|
|
1957
|
-
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1958
|
-
var tmp_1 = scope_1;
|
|
1959
|
-
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1960
|
-
var this_4 = scope_1.z1t_1;
|
|
1961
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1962
|
-
// Inline function 'kotlin.apply' call
|
|
1963
|
-
var this_5 = new TransformerBuilder();
|
|
1964
|
-
this_5.d1h(TypeScriptIrEmitter$emit$lambda_2);
|
|
1965
|
-
var tmp$ret$12 = this_5.e1h();
|
|
1966
|
-
tmp_1.z1t_1 = transform(this_4, tmp$ret$12);
|
|
1967
|
-
}
|
|
1968
|
-
var tmp_2 = scope_1.z1t_1;
|
|
1969
|
-
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1970
|
-
var this_6 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
|
|
1971
|
-
var scope_2 = new TransformScope(this_6);
|
|
1972
|
-
// Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
|
|
1973
|
-
var tmp_3 = scope_2;
|
|
1974
|
-
// Inline function 'community.flock.wirespec.ir.core.injectAfter' call
|
|
1975
|
-
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1976
|
-
var this_7 = scope_2.z1t_1;
|
|
1977
|
-
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1978
|
-
// Inline function 'kotlin.apply' call
|
|
1979
|
-
var this_8 = new TransformerBuilder();
|
|
1980
|
-
this_8.d1h(TypeScriptIrEmitter$emit$lambda_3(this, endpoint));
|
|
1981
|
-
var tmp$ret$19 = this_8.e1h();
|
|
1982
|
-
tmp_3.z1t_1 = transform(this_7, tmp$ret$19);
|
|
1983
|
-
var tmp_4 = scope_2.z1t_1;
|
|
1984
|
-
var tmp$ret$24 = isInterface(tmp_4, Element) ? tmp_4 : THROW_CCE();
|
|
1657
|
+
scope.b1u(transformPatternSwitchToValueSwitch());
|
|
1658
|
+
var tmp = scope.w1t_1;
|
|
1659
|
+
var tmp$ret$7 = isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1985
1660
|
// Inline function 'kotlin.let' call
|
|
1986
|
-
var it = sanitizeNames(tmp$ret$
|
|
1987
|
-
var
|
|
1661
|
+
var it = sanitizeNames(emit$injectApiConst(emit$applyCallParamsIfNeeded(tmp$ret$7, hasRequestParams), endpoint).v1m(Companion_getInstance().l1h(sanitize(this, endpoint.ep_1))), _get_sanitizationConfig__sns434(this));
|
|
1662
|
+
var tmp_0;
|
|
1988
1663
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1989
1664
|
if (!imports.r()) {
|
|
1990
|
-
|
|
1665
|
+
tmp_0 = it.v1m(VOID, plus_0(imports, it.s1m_1));
|
|
1991
1666
|
} else {
|
|
1992
|
-
|
|
1667
|
+
tmp_0 = it;
|
|
1993
1668
|
}
|
|
1994
|
-
return
|
|
1669
|
+
return tmp_0;
|
|
1995
1670
|
};
|
|
1996
1671
|
protoOf(TypeScriptIrEmitter).xq = function (channel) {
|
|
1997
1672
|
return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
|
|
1998
1673
|
};
|
|
1999
|
-
protoOf(TypeScriptIrEmitter).
|
|
1674
|
+
protoOf(TypeScriptIrEmitter).o1u = function (endpoint) {
|
|
2000
1675
|
var endpointName = endpoint.ep_1.l1();
|
|
2001
1676
|
var methodName = firstToLower(this, endpointName);
|
|
2002
1677
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
@@ -2006,7 +1681,7 @@ protoOf(TypeScriptIrEmitter).q1u = function (endpoint) {
|
|
|
2006
1681
|
var _iterator__ex2g4s = this_0.t();
|
|
2007
1682
|
while (_iterator__ex2g4s.u()) {
|
|
2008
1683
|
var e = _iterator__ex2g4s.v();
|
|
2009
|
-
var key = e.
|
|
1684
|
+
var key = e.ku_1;
|
|
2010
1685
|
if (set.x(key)) {
|
|
2011
1686
|
list.x(e);
|
|
2012
1687
|
}
|
|
@@ -2017,7 +1692,7 @@ protoOf(TypeScriptIrEmitter).q1u = function (endpoint) {
|
|
|
2017
1692
|
var _iterator__ex2g4s_0 = list.t();
|
|
2018
1693
|
while (_iterator__ex2g4s_0.u()) {
|
|
2019
1694
|
var item = _iterator__ex2g4s_0.v();
|
|
2020
|
-
var tmp$ret$2 = import_0('../model', item.
|
|
1695
|
+
var tmp$ret$2 = import_0('../model', item.ku_1, true);
|
|
2021
1696
|
destination.x(tmp$ret$2);
|
|
2022
1697
|
}
|
|
2023
1698
|
var imports = destination;
|
|
@@ -2039,7 +1714,7 @@ protoOf(TypeScriptIrEmitter).q1u = function (endpoint) {
|
|
|
2039
1714
|
}
|
|
2040
1715
|
var requestArgs = tmp_0;
|
|
2041
1716
|
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 ');
|
|
2042
|
-
var tmp_1 = Companion_getInstance().
|
|
1717
|
+
var tmp_1 = Companion_getInstance().l1h('client/' + endpointName + 'Client');
|
|
2043
1718
|
// Inline function 'kotlin.collections.buildList' call
|
|
2044
1719
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
2045
1720
|
// Inline function 'kotlin.apply' call
|
|
@@ -2051,7 +1726,7 @@ protoOf(TypeScriptIrEmitter).q1u = function (endpoint) {
|
|
|
2051
1726
|
var tmp$ret$10 = this_1.o5();
|
|
2052
1727
|
return new File(tmp_1, tmp$ret$10);
|
|
2053
1728
|
};
|
|
2054
|
-
protoOf(TypeScriptIrEmitter).
|
|
1729
|
+
protoOf(TypeScriptIrEmitter).n1u = function (endpoints, logger) {
|
|
2055
1730
|
logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
|
|
2056
1731
|
// Inline function 'kotlin.collections.map' call
|
|
2057
1732
|
// Inline function 'kotlin.collections.mapTo' call
|
|
@@ -2066,7 +1741,7 @@ protoOf(TypeScriptIrEmitter).p1u = function (endpoints, logger) {
|
|
|
2066
1741
|
var clientImports = destination;
|
|
2067
1742
|
var spreadEntries = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, TypeScriptIrEmitter$emitClient$lambda(this));
|
|
2068
1743
|
var code = trimMargin('\n |export const client = (serialization: Wirespec.Serialization, transportation: Wirespec.Transportation) => ({\n |' + spreadEntries + '\n |})\n ');
|
|
2069
|
-
var tmp = Companion_getInstance().
|
|
1744
|
+
var tmp = Companion_getInstance().l1h('Client');
|
|
2070
1745
|
// Inline function 'kotlin.collections.buildList' call
|
|
2071
1746
|
// Inline function 'kotlin.collections.buildListInternal' call
|
|
2072
1747
|
// Inline function 'kotlin.apply' call
|
|
@@ -2077,16 +1752,357 @@ protoOf(TypeScriptIrEmitter).p1u = function (endpoints, logger) {
|
|
|
2077
1752
|
var tmp$ret$6 = this_0.o5();
|
|
2078
1753
|
return new File(tmp, tmp$ret$6);
|
|
2079
1754
|
};
|
|
1755
|
+
function transformPatternSwitchToValueSwitch() {
|
|
1756
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1757
|
+
// Inline function 'kotlin.apply' call
|
|
1758
|
+
var this_0 = new TransformerBuilder();
|
|
1759
|
+
this_0.d1u(transformPatternSwitchToValueSwitch$lambda);
|
|
1760
|
+
return this_0.d1h();
|
|
1761
|
+
}
|
|
1762
|
+
function renameValidateAndBindObjReceiver(_this__u8e3s4, typeName, fieldNames) {
|
|
1763
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1764
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1765
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1766
|
+
var tmp = scope;
|
|
1767
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1768
|
+
var this_0 = scope.w1t_1;
|
|
1769
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1770
|
+
// Inline function 'kotlin.apply' call
|
|
1771
|
+
var this_1 = new TransformerBuilder();
|
|
1772
|
+
this_1.c1h(renameValidateAndBindObjReceiver$lambda(typeName, fieldNames));
|
|
1773
|
+
var tmp$ret$2 = this_1.d1h();
|
|
1774
|
+
tmp.w1t_1 = transform(this_0, tmp$ret$2);
|
|
1775
|
+
var tmp_0 = scope.w1t_1;
|
|
1776
|
+
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1777
|
+
}
|
|
1778
|
+
function buildApiConst(endpoint) {
|
|
1779
|
+
// Inline function 'kotlin.text.replaceFirstChar' call
|
|
1780
|
+
var this_0 = endpoint.ep_1.l1();
|
|
1781
|
+
var tmp;
|
|
1782
|
+
// Inline function 'kotlin.text.isNotEmpty' call
|
|
1783
|
+
if (charSequenceLength(this_0) > 0) {
|
|
1784
|
+
// Inline function 'kotlin.text.lowercase' call
|
|
1785
|
+
var this_1 = charCodeAt(this_0, 0);
|
|
1786
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
1787
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
1788
|
+
var tmp$ret$4 = toString_0(this_1).toLowerCase();
|
|
1789
|
+
tmp = toString(tmp$ret$4) + substring(this_0, 1);
|
|
1790
|
+
} else {
|
|
1791
|
+
tmp = this_0;
|
|
1792
|
+
}
|
|
1793
|
+
var apiName = tmp;
|
|
1794
|
+
var method = endpoint.fp_1.a3_1;
|
|
1795
|
+
var pathString = joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, buildApiConst$lambda);
|
|
1796
|
+
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
|
+
function bindCallToRequestParams(_this__u8e3s4) {
|
|
1799
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1800
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1801
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1802
|
+
var tmp = scope;
|
|
1803
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1804
|
+
var this_0 = scope.w1t_1;
|
|
1805
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1806
|
+
// Inline function 'kotlin.apply' call
|
|
1807
|
+
var this_1 = new TransformerBuilder();
|
|
1808
|
+
this_1.c1h(bindCallToRequestParams$lambda);
|
|
1809
|
+
var tmp$ret$2 = this_1.d1h();
|
|
1810
|
+
tmp.w1t_1 = transform(this_0, tmp$ret$2);
|
|
1811
|
+
var tmp_0 = scope.w1t_1;
|
|
1812
|
+
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1813
|
+
}
|
|
1814
|
+
function stripTrailingSpaceFromErrorMessage(_this__u8e3s4) {
|
|
1815
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1816
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1817
|
+
scope.d1u(stripTrailingSpaceFromErrorMessage$lambda);
|
|
1818
|
+
var tmp = scope.w1t_1;
|
|
1819
|
+
return isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1820
|
+
}
|
|
1821
|
+
function transformPatternSwitchToValueSwitch$lambda(stmt, tr) {
|
|
1822
|
+
var tmp;
|
|
1823
|
+
if (!(stmt instanceof Switch)) {
|
|
1824
|
+
tmp = true;
|
|
1825
|
+
} else {
|
|
1826
|
+
var tmp0 = stmt.y1o_1;
|
|
1827
|
+
var tmp$ret$0;
|
|
1828
|
+
$l$block_0: {
|
|
1829
|
+
// Inline function 'kotlin.collections.none' call
|
|
1830
|
+
var tmp_0;
|
|
1831
|
+
if (isInterface(tmp0, Collection)) {
|
|
1832
|
+
tmp_0 = tmp0.r();
|
|
1833
|
+
} else {
|
|
1834
|
+
tmp_0 = false;
|
|
1835
|
+
}
|
|
1836
|
+
if (tmp_0) {
|
|
1837
|
+
tmp$ret$0 = true;
|
|
1838
|
+
break $l$block_0;
|
|
1839
|
+
}
|
|
1840
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1841
|
+
while (_iterator__ex2g4s.u()) {
|
|
1842
|
+
var element = _iterator__ex2g4s.v();
|
|
1843
|
+
if (!(element.f1p_1 == null)) {
|
|
1844
|
+
tmp$ret$0 = false;
|
|
1845
|
+
break $l$block_0;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
tmp$ret$0 = true;
|
|
1849
|
+
}
|
|
1850
|
+
tmp = tmp$ret$0;
|
|
1851
|
+
}
|
|
1852
|
+
if (tmp)
|
|
1853
|
+
return transformChildren(stmt, tr);
|
|
1854
|
+
var tmp0_safe_receiver = stmt.a1p_1;
|
|
1855
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1l();
|
|
1856
|
+
var varName = tmp1_elvis_lhs == null ? 'r' : tmp1_elvis_lhs;
|
|
1857
|
+
// Inline function 'kotlin.collections.map' call
|
|
1858
|
+
var this_0 = stmt.y1o_1;
|
|
1859
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1860
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1861
|
+
var _iterator__ex2g4s_0 = this_0.t();
|
|
1862
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1863
|
+
var item = _iterator__ex2g4s_0.v();
|
|
1864
|
+
var tmp$ret$5;
|
|
1865
|
+
$l$block_1: {
|
|
1866
|
+
var tmp_1 = item.f1p_1;
|
|
1867
|
+
var tmp0_safe_receiver_0 = tmp_1 instanceof Custom_0 ? tmp_1 : null;
|
|
1868
|
+
var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.p1h_1;
|
|
1869
|
+
var tmp2_safe_receiver = typeName == null ? null : substringAfterLast(typeName, '.');
|
|
1870
|
+
var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : removePrefix(tmp2_safe_receiver, 'Response');
|
|
1871
|
+
var statusNum = tmp3_safe_receiver == null ? null : toIntOrNull(tmp3_safe_receiver);
|
|
1872
|
+
if (statusNum == null || typeName == null) {
|
|
1873
|
+
// Inline function 'kotlin.collections.map' call
|
|
1874
|
+
var this_1 = item.e1p_1;
|
|
1875
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1876
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
1877
|
+
var _iterator__ex2g4s_1 = this_1.t();
|
|
1878
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
1879
|
+
var item_0 = _iterator__ex2g4s_1.v();
|
|
1880
|
+
var tmp$ret$2 = tr.q1t(item_0);
|
|
1881
|
+
destination_0.x(tmp$ret$2);
|
|
1882
|
+
}
|
|
1883
|
+
tmp$ret$5 = item.h1p(VOID, destination_0);
|
|
1884
|
+
break $l$block_1;
|
|
1885
|
+
}
|
|
1886
|
+
var exprCode = TypeScriptGenerator_getInstance().u1u(tr.r1t(stmt.x1o_1));
|
|
1887
|
+
var castAssignment = new Assignment(Companion_getInstance().l1h(varName), new RawExpression(exprCode + ' as ' + typeName), false);
|
|
1888
|
+
var tmp_2 = new Literal_0(statusNum, new Integer_0());
|
|
1889
|
+
var tmp_3 = listOf(castAssignment);
|
|
1890
|
+
// Inline function 'kotlin.collections.map' call
|
|
1891
|
+
var this_2 = item.e1p_1;
|
|
1892
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1893
|
+
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
|
|
1894
|
+
var _iterator__ex2g4s_2 = this_2.t();
|
|
1895
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
1896
|
+
var item_1 = _iterator__ex2g4s_2.v();
|
|
1897
|
+
var tmp$ret$6 = tr.q1t(item_1);
|
|
1898
|
+
destination_1.x(tmp$ret$6);
|
|
1899
|
+
}
|
|
1900
|
+
tmp$ret$5 = new Case(tmp_2, plus_0(tmp_3, destination_1), null);
|
|
1901
|
+
}
|
|
1902
|
+
destination.x(tmp$ret$5);
|
|
1903
|
+
}
|
|
1904
|
+
var transformedCases = destination;
|
|
1905
|
+
var tmp_4 = new FieldCall(tr.r1t(stmt.x1o_1), Companion_getInstance().l1h('status'));
|
|
1906
|
+
var tmp2_safe_receiver_0 = stmt.z1o_1;
|
|
1907
|
+
var tmp_5;
|
|
1908
|
+
if (tmp2_safe_receiver_0 == null) {
|
|
1909
|
+
tmp_5 = null;
|
|
1910
|
+
} else {
|
|
1911
|
+
// Inline function 'kotlin.collections.map' call
|
|
1912
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1913
|
+
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver_0, 10));
|
|
1914
|
+
var _iterator__ex2g4s_3 = tmp2_safe_receiver_0.t();
|
|
1915
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
1916
|
+
var item_2 = _iterator__ex2g4s_3.v();
|
|
1917
|
+
var tmp$ret$11 = tr.q1t(item_2);
|
|
1918
|
+
destination_2.x(tmp$ret$11);
|
|
1919
|
+
}
|
|
1920
|
+
tmp_5 = destination_2;
|
|
1921
|
+
}
|
|
1922
|
+
return new Switch(tmp_4, transformedCases, tmp_5, null);
|
|
1923
|
+
}
|
|
1924
|
+
function renameValidateAndBindObjReceiver$lambda$lambda($fieldNames) {
|
|
1925
|
+
return function (s, t) {
|
|
1926
|
+
var tmp;
|
|
1927
|
+
var tmp_0;
|
|
1928
|
+
var tmp_1;
|
|
1929
|
+
var tmp_2;
|
|
1930
|
+
if (s instanceof FunctionCall) {
|
|
1931
|
+
tmp_2 = s.a1m_1.equals(Companion_getInstance().l1h('validate'));
|
|
1932
|
+
} else {
|
|
1933
|
+
tmp_2 = false;
|
|
1934
|
+
}
|
|
1935
|
+
if (tmp_2) {
|
|
1936
|
+
tmp_1 = !(s.y1l_1 == null);
|
|
1937
|
+
} else {
|
|
1938
|
+
tmp_1 = false;
|
|
1939
|
+
}
|
|
1940
|
+
if (tmp_1) {
|
|
1941
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1942
|
+
tmp_0 = !s.z1l_1.r();
|
|
1943
|
+
} else {
|
|
1944
|
+
tmp_0 = false;
|
|
1945
|
+
}
|
|
1946
|
+
if (tmp_0) {
|
|
1947
|
+
var tmp_3 = first(s.z1l_1);
|
|
1948
|
+
var tmp0_safe_receiver = tmp_3 instanceof Custom_0 ? tmp_3 : null;
|
|
1949
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.p1h_1;
|
|
1950
|
+
var tn = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
|
|
1951
|
+
tmp = new FunctionCall(VOID, VOID, Companion_getInstance().l1h('validate' + tn), mapOf(to(Companion_getInstance().l1h('obj'), t.r1t(ensureNotNull(s.y1l_1)))));
|
|
1952
|
+
} else {
|
|
1953
|
+
var tmp_4;
|
|
1954
|
+
var tmp_5;
|
|
1955
|
+
if (s instanceof FieldCall) {
|
|
1956
|
+
tmp_5 = s.i1p_1 == null;
|
|
1957
|
+
} else {
|
|
1958
|
+
tmp_5 = false;
|
|
1959
|
+
}
|
|
1960
|
+
if (tmp_5) {
|
|
1961
|
+
tmp_4 = $fieldNames.u1(s.j1p_1.q1l());
|
|
1962
|
+
} else {
|
|
1963
|
+
tmp_4 = false;
|
|
1964
|
+
}
|
|
1965
|
+
if (tmp_4) {
|
|
1966
|
+
tmp = new FieldCall(new VariableReference(Companion_getInstance().l1h('obj')), s.j1p_1);
|
|
1967
|
+
} else {
|
|
1968
|
+
tmp = transformChildren(s, t);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return tmp;
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
function renameValidateAndBindObjReceiver$lambda($typeName, $fieldNames) {
|
|
1975
|
+
return function (element, transformer) {
|
|
1976
|
+
var tmp;
|
|
1977
|
+
if (element instanceof Function) {
|
|
1978
|
+
var tmp$ret$0;
|
|
1979
|
+
$l$block: {
|
|
1980
|
+
if (!element.s1j_1.equals(Companion_getInstance().l1h('validate'))) {
|
|
1981
|
+
tmp$ret$0 = element;
|
|
1982
|
+
break $l$block;
|
|
1983
|
+
}
|
|
1984
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1985
|
+
var this_0 = element.a1k(Companion_getInstance().l1h('validate' + $typeName), VOID, listOf(new Parameter(Companion_getInstance().l1h('obj'), new Custom_0($typeName))));
|
|
1986
|
+
var scope = new TransformScope(this_0);
|
|
1987
|
+
scope.f1u(renameValidateAndBindObjReceiver$lambda$lambda($fieldNames));
|
|
1988
|
+
var tmp_0 = scope.w1t_1;
|
|
1989
|
+
tmp$ret$0 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1990
|
+
}
|
|
1991
|
+
tmp = tmp$ret$0;
|
|
1992
|
+
} else {
|
|
1993
|
+
tmp = element;
|
|
1994
|
+
}
|
|
1995
|
+
var transformed = tmp;
|
|
1996
|
+
return transformChildren_0(transformed, transformer);
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function buildApiConst$lambda(it) {
|
|
2000
|
+
var tmp;
|
|
2001
|
+
if (it instanceof Literal) {
|
|
2002
|
+
tmp = it.hq_1;
|
|
2003
|
+
} else {
|
|
2004
|
+
if (it instanceof Param) {
|
|
2005
|
+
tmp = '{' + it.lp_1.l1() + '}';
|
|
2006
|
+
} else {
|
|
2007
|
+
noWhenBranchMatchedException();
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
return tmp;
|
|
2011
|
+
}
|
|
2012
|
+
function bindCallToRequestParams$lambda(element, transformer) {
|
|
2013
|
+
var tmp;
|
|
2014
|
+
if (element instanceof Interface) {
|
|
2015
|
+
var tmp$ret$0;
|
|
2016
|
+
$l$block: {
|
|
2017
|
+
if (!element.j1n_1.equals(Companion_getInstance().l1h('Call'))) {
|
|
2018
|
+
tmp$ret$0 = element;
|
|
2019
|
+
break $l$block;
|
|
2020
|
+
}
|
|
2021
|
+
// Inline function 'kotlin.collections.map' call
|
|
2022
|
+
var this_0 = element.k1n_1;
|
|
2023
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2024
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
2025
|
+
var _iterator__ex2g4s = this_0.t();
|
|
2026
|
+
while (_iterator__ex2g4s.u()) {
|
|
2027
|
+
var item = _iterator__ex2g4s.v();
|
|
2028
|
+
var tmp0_safe_receiver = item instanceof Function ? item : null;
|
|
2029
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.a1k(VOID, VOID, listOf(new Parameter(Companion_getInstance().l1h('params'), new Custom_0('RequestParams'))));
|
|
2030
|
+
var tmp$ret$1 = tmp1_elvis_lhs == null ? item : tmp1_elvis_lhs;
|
|
2031
|
+
destination.x(tmp$ret$1);
|
|
2032
|
+
}
|
|
2033
|
+
tmp$ret$0 = element.q1n(VOID, destination);
|
|
2034
|
+
}
|
|
2035
|
+
tmp = tmp$ret$0;
|
|
2036
|
+
} else {
|
|
2037
|
+
tmp = element;
|
|
2038
|
+
}
|
|
2039
|
+
var transformed = tmp;
|
|
2040
|
+
return transformChildren_0(transformed, transformer);
|
|
2041
|
+
}
|
|
2042
|
+
function stripTrailingSpaceFromErrorMessage$lambda(stmt, transformer) {
|
|
2043
|
+
var tmp;
|
|
2044
|
+
if (stmt instanceof Switch) {
|
|
2045
|
+
var tmp1_safe_receiver = stmt.z1o_1;
|
|
2046
|
+
var tmp_0;
|
|
2047
|
+
if (tmp1_safe_receiver == null) {
|
|
2048
|
+
tmp_0 = null;
|
|
2049
|
+
} else {
|
|
2050
|
+
// Inline function 'kotlin.collections.map' call
|
|
2051
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2052
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_safe_receiver, 10));
|
|
2053
|
+
var _iterator__ex2g4s = tmp1_safe_receiver.t();
|
|
2054
|
+
while (_iterator__ex2g4s.u()) {
|
|
2055
|
+
var item = _iterator__ex2g4s.v();
|
|
2056
|
+
var tmp$ret$0;
|
|
2057
|
+
$l$block_1: {
|
|
2058
|
+
var tmp0_elvis_lhs = item instanceof ErrorStatement ? item : null;
|
|
2059
|
+
var tmp_1;
|
|
2060
|
+
if (tmp0_elvis_lhs == null) {
|
|
2061
|
+
tmp$ret$0 = item;
|
|
2062
|
+
break $l$block_1;
|
|
2063
|
+
} else {
|
|
2064
|
+
tmp_1 = tmp0_elvis_lhs;
|
|
2065
|
+
}
|
|
2066
|
+
var errorStmt = tmp_1;
|
|
2067
|
+
var tmp_2 = errorStmt.m1p_1;
|
|
2068
|
+
var tmp1_elvis_lhs = tmp_2 instanceof BinaryOp ? tmp_2 : null;
|
|
2069
|
+
var tmp_3;
|
|
2070
|
+
if (tmp1_elvis_lhs == null) {
|
|
2071
|
+
tmp$ret$0 = item;
|
|
2072
|
+
break $l$block_1;
|
|
2073
|
+
} else {
|
|
2074
|
+
tmp_3 = tmp1_elvis_lhs;
|
|
2075
|
+
}
|
|
2076
|
+
var binary = tmp_3;
|
|
2077
|
+
var tmp_4 = binary.n1p_1;
|
|
2078
|
+
var tmp2_elvis_lhs = tmp_4 instanceof Literal_0 ? tmp_4 : null;
|
|
2079
|
+
var tmp_5;
|
|
2080
|
+
if (tmp2_elvis_lhs == null) {
|
|
2081
|
+
tmp$ret$0 = item;
|
|
2082
|
+
break $l$block_1;
|
|
2083
|
+
} else {
|
|
2084
|
+
tmp_5 = tmp2_elvis_lhs;
|
|
2085
|
+
}
|
|
2086
|
+
var literal = tmp_5;
|
|
2087
|
+
tmp$ret$0 = new ErrorStatement(new Literal_0(trimEnd(toString(literal.p1o_1), charArrayOf([_Char___init__impl__6a9atx(32)])), literal.q1o_1));
|
|
2088
|
+
}
|
|
2089
|
+
destination.x(tmp$ret$0);
|
|
2090
|
+
}
|
|
2091
|
+
tmp_0 = destination;
|
|
2092
|
+
}
|
|
2093
|
+
tmp = transformChildren(stmt.c1p(VOID, VOID, tmp_0), transformer);
|
|
2094
|
+
} else {
|
|
2095
|
+
tmp = transformChildren(stmt, transformer);
|
|
2096
|
+
}
|
|
2097
|
+
return tmp;
|
|
2098
|
+
}
|
|
2080
2099
|
function TypeScriptRefinedTypeDefinitionEmitter() {
|
|
2081
2100
|
}
|
|
2082
2101
|
function TypeScriptShared() {
|
|
2083
2102
|
TypeScriptShared_instance = this;
|
|
2084
|
-
this.
|
|
2085
|
-
this.
|
|
2103
|
+
this.b1z_1 = 'community.flock.wirespec';
|
|
2104
|
+
this.c1z_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 ');
|
|
2086
2105
|
}
|
|
2087
|
-
protoOf(TypeScriptShared).r1w = function () {
|
|
2088
|
-
return this.t20_1;
|
|
2089
|
-
};
|
|
2090
2106
|
protoOf(TypeScriptShared).toString = function () {
|
|
2091
2107
|
return 'TypeScriptShared';
|
|
2092
2108
|
};
|
|
@@ -2126,16 +2142,17 @@ protoOf(TypeScriptEmitter).vp = emit_6;
|
|
|
2126
2142
|
protoOf(TypeScriptEmitter).wp = emit_7;
|
|
2127
2143
|
protoOf(TypeScriptEmitter).xp = emit_4;
|
|
2128
2144
|
protoOf(TypeScriptEmitter).yp = emit_5;
|
|
2129
|
-
protoOf(TypeScriptEmitter).ir =
|
|
2145
|
+
protoOf(TypeScriptEmitter).ir = emit_9;
|
|
2130
2146
|
protoOf(TypeScriptEmitter).dr = emit_10;
|
|
2131
|
-
protoOf(TypeScriptEmitter).jr =
|
|
2147
|
+
protoOf(TypeScriptEmitter).jr = emit_8;
|
|
2132
2148
|
protoOf(TypeScriptEmitter).wq = emit_2;
|
|
2133
2149
|
protoOf(TypeScriptEmitter).kr = emitValidator;
|
|
2134
|
-
protoOf(TypeScriptEmitter).
|
|
2135
|
-
protoOf(TypeScriptEmitter).
|
|
2136
|
-
protoOf(TypeScriptEmitter).
|
|
2137
|
-
protoOf(TypeScriptEmitter).
|
|
2150
|
+
protoOf(TypeScriptEmitter).w1y = sanitizeSymbol;
|
|
2151
|
+
protoOf(TypeScriptEmitter).o1v = sanitizeSymbol_0;
|
|
2152
|
+
protoOf(TypeScriptEmitter).x1y = emitPrimitive;
|
|
2153
|
+
protoOf(TypeScriptEmitter).v1y = emitClient;
|
|
2138
2154
|
protoOf(TypeScriptEmitter).aq = emitClientEndpointRequest;
|
|
2155
|
+
protoOf(TypeScriptIrEmitter).l1u = emit_1;
|
|
2139
2156
|
//endregion
|
|
2140
2157
|
//region block: exports
|
|
2141
2158
|
export {
|