@flock/wirespec 0.16.7 → 0.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clikt-clikt.mjs +1172 -1172
- package/colormath-root-colormath.mjs +425 -425
- package/kotlin-kotlin-stdlib.mjs +31 -31
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1767 -1767
- package/kotlinx-io-kotlinx-io-core.mjs +380 -380
- package/markdown.mjs +1864 -1864
- package/mordant-mordant.mjs +1638 -1638
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +1908 -1928
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +697 -609
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +627 -577
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +789 -739
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +288 -284
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +258 -222
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +310 -310
- package/wirespec-src-converter-avro.mjs +372 -347
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +507 -499
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +136 -136
- package/wirespec-src-plugin-cli.mjs +75 -75
- package/wirespec-src-plugin-npm.mjs +15 -15
- package/wirespec-src-tools-generator.mjs +24 -24
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
paramList32w7ar4yzhgjr as paramList,
|
|
3
|
+
Spacer_instancel9yep7i0q3er as Spacer_instance,
|
|
4
|
+
importReferences3pz8oxxe2hwhu as importReferences,
|
|
5
|
+
spacer28p2fwyb64afn as spacer,
|
|
6
|
+
Emitted12h24rpo4uifw as Emitted,
|
|
7
|
+
ClientEmitter36x0lk1twctuf as ClientEmitter,
|
|
8
|
+
LanguageEmitterxhzgykhux3qm as LanguageEmitter,
|
|
9
|
+
FileExtension_TypeScript_getInstancelv1vlncbu27z as FileExtension_TypeScript_getInstance,
|
|
10
|
+
hasEndpointsx7as2ywiwjq9 as hasEndpoints,
|
|
11
|
+
namespacepzr7vpsv8z39 as namespace,
|
|
12
|
+
Companion_instance2ag0h5twtdral as Companion_instance,
|
|
13
|
+
plus2csvv9vgnno78 as plus,
|
|
14
|
+
emitClientEndpointRequest2jjbqrtgbjtwm as emitClientEndpointRequest,
|
|
15
|
+
Param33sus5zaarsk0 as Param,
|
|
16
|
+
Literal32wmkquj6qapn as Literal,
|
|
17
|
+
distinctByStatus27eirf52grddm as distinctByStatus,
|
|
18
|
+
fixStatus2l9jrn3538wpy as fixStatus,
|
|
19
|
+
get_indexedPathParams3mii47g6wg9rv as get_indexedPathParams,
|
|
20
|
+
Companion_instance2piryw1e8zn12 as Companion_instance_0,
|
|
21
|
+
get_pathParams29rrc1msn3eoz as get_pathParams,
|
|
22
|
+
paramListu5lifi5jaaet as paramList_0,
|
|
23
|
+
Bytes_instance1at7binw0nl40 as Bytes_instance,
|
|
24
|
+
Boolean_instance3qnzv8pgzox40 as Boolean_instance,
|
|
25
|
+
RegExp1kvu7kxwy7td5 as RegExp_0,
|
|
26
|
+
String23kqvhe3sk098 as String_0,
|
|
27
|
+
Number3i05nlui0wcz8 as Number_0,
|
|
28
|
+
Integeryrcje1s9u7kr as Integer,
|
|
29
|
+
Bytes2moci2lqqzua3 as Bytes,
|
|
30
|
+
Boolean1v54w5v4qjba1 as Boolean_0,
|
|
31
|
+
Primitivexjb7c0cm123a as Primitive,
|
|
32
|
+
Custom37hvrfgd6b0uj as Custom,
|
|
33
|
+
Any268baxyo9do19 as Any,
|
|
34
|
+
Unit3rie819ih39bz as Unit,
|
|
35
|
+
Iterablerto606wd057m as Iterable,
|
|
36
|
+
Dict3l6tdihpke4rr as Dict,
|
|
37
|
+
Bound1dotva4vah4jp as Bound,
|
|
38
|
+
_RegExp___get_value__impl__7o761828ey0cgsx2afa as _RegExp___get_value__impl__7o7618,
|
|
39
|
+
TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
|
|
40
|
+
} from './wirespec-src-compiler-core.mjs';
|
|
1
41
|
import {
|
|
2
42
|
VOID7hggqo3abtya as VOID,
|
|
3
43
|
joinToString1cxrrlmo0chqs as joinToString,
|
|
@@ -16,10 +56,11 @@ import {
|
|
|
16
56
|
ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$_0,
|
|
17
57
|
collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
|
|
18
58
|
initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
|
|
59
|
+
noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
|
|
19
60
|
prependIndentkl9wuvcodvmu as prependIndent,
|
|
20
61
|
trimIndent1qytc1wvt8suh as trimIndent,
|
|
21
|
-
noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
|
|
22
62
|
first58ocm7j58k3q as first,
|
|
63
|
+
equals2au1ep9vhcato as equals,
|
|
23
64
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
24
65
|
isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
|
|
25
66
|
_Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
|
|
@@ -28,43 +69,7 @@ import {
|
|
|
28
69
|
asSequence3lsvgkvyzox0q as asSequence,
|
|
29
70
|
filter184huxd00uyfg as filter,
|
|
30
71
|
joinToStringooja5rkatz3u as joinToString_0,
|
|
31
|
-
equals2au1ep9vhcato as equals,
|
|
32
72
|
} from './kotlin-kotlin-stdlib.mjs';
|
|
33
|
-
import {
|
|
34
|
-
Spacer_instancel9yep7i0q3er as Spacer_instance,
|
|
35
|
-
Emitted12h24rpo4uifw as Emitted,
|
|
36
|
-
ClientEmitter36x0lk1twctuf as ClientEmitter,
|
|
37
|
-
ParamEmitter90po0zctl38y as ParamEmitter,
|
|
38
|
-
SpaceEmitter36bi9y7576grw as SpaceEmitter,
|
|
39
|
-
ImportEmitter1wwmtnnt1doer as ImportEmitter,
|
|
40
|
-
Emitterpslsvv25okcl as Emitter,
|
|
41
|
-
FileExtension_TypeScript_getInstancelv1vlncbu27z as FileExtension_TypeScript_getInstance,
|
|
42
|
-
namespacepzr7vpsv8z39 as namespace,
|
|
43
|
-
Companion_instance2ag0h5twtdral as Companion_instance,
|
|
44
|
-
plus2csvv9vgnno78 as plus,
|
|
45
|
-
emitClientEndpointRequest2jjbqrtgbjtwm as emitClientEndpointRequest,
|
|
46
|
-
Companion_instanceb7vsmblp2jf7 as Companion_instance_0,
|
|
47
|
-
Param33sus5zaarsk0 as Param,
|
|
48
|
-
Literal32wmkquj6qapn as Literal,
|
|
49
|
-
EndpointEmitterjel5bxqmk97i as EndpointEmitter,
|
|
50
|
-
Bytes2moci2lqqzua3 as Bytes,
|
|
51
|
-
Boolean1v54w5v4qjba1 as Boolean_0,
|
|
52
|
-
Number3i05nlui0wcz8 as Number_0,
|
|
53
|
-
Integeryrcje1s9u7kr as Integer,
|
|
54
|
-
String23kqvhe3sk098 as String_0,
|
|
55
|
-
Primitivexjb7c0cm123a as Primitive,
|
|
56
|
-
Custom37hvrfgd6b0uj as Custom,
|
|
57
|
-
Any268baxyo9do19 as Any,
|
|
58
|
-
Unit3rie819ih39bz as Unit,
|
|
59
|
-
Iterablerto606wd057m as Iterable,
|
|
60
|
-
Dict3l6tdihpke4rr as Dict,
|
|
61
|
-
Bytes_instance1at7binw0nl40 as Bytes_instance,
|
|
62
|
-
Boolean_instance3qnzv8pgzox40 as Boolean_instance,
|
|
63
|
-
RegExp1kvu7kxwy7td5 as RegExp_0,
|
|
64
|
-
Bound1dotva4vah4jp as Bound,
|
|
65
|
-
_RegExp___get_value__impl__7o761828ey0cgsx2afa as _RegExp___get_value__impl__7o7618,
|
|
66
|
-
TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
|
|
67
|
-
} from './wirespec-src-compiler-core.mjs';
|
|
68
73
|
//region block: imports
|
|
69
74
|
//endregion
|
|
70
75
|
//region block: pre-declaration
|
|
@@ -73,7 +78,7 @@ function emit(identifier) {
|
|
|
73
78
|
}
|
|
74
79
|
initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
|
|
75
80
|
function sanitizeSymbol(_this__u8e3s4) {
|
|
76
|
-
return this.
|
|
81
|
+
return this.d2b(_this__u8e3s4.b1());
|
|
77
82
|
}
|
|
78
83
|
function sanitizeSymbol_0(_this__u8e3s4) {
|
|
79
84
|
var tmp = asSequence(_this__u8e3s4);
|
|
@@ -82,14 +87,14 @@ function sanitizeSymbol_0(_this__u8e3s4) {
|
|
|
82
87
|
function emit_0(type, module_0) {
|
|
83
88
|
// Inline function 'kotlin.collections.map' call
|
|
84
89
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
85
|
-
var this_0 =
|
|
90
|
+
var this_0 = importReferences(type);
|
|
86
91
|
var set = HashSet_init_$Create$();
|
|
87
92
|
var list = ArrayList_init_$Create$();
|
|
88
93
|
var tmp0_iterator = this_0.g();
|
|
89
94
|
while (tmp0_iterator.h()) {
|
|
90
95
|
var e = tmp0_iterator.i();
|
|
91
96
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
92
|
-
var key = e.
|
|
97
|
+
var key = e.w28_1;
|
|
93
98
|
if (set.e(key)) {
|
|
94
99
|
list.e(e);
|
|
95
100
|
}
|
|
@@ -100,20 +105,20 @@ function emit_0(type, module_0) {
|
|
|
100
105
|
while (tmp0_iterator_0.h()) {
|
|
101
106
|
var item = tmp0_iterator_0.i();
|
|
102
107
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
103
|
-
var tmp$ret$2 = 'import {' + item.
|
|
108
|
+
var tmp$ret$2 = 'import {' + item.w28_1 + "} from './" + item.w28_1 + "'";
|
|
104
109
|
destination.e(tmp$ret$2);
|
|
105
110
|
}
|
|
106
111
|
var tmp = destination;
|
|
107
|
-
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.
|
|
112
|
+
return trimMargin('\n |' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda) + '\n |export type ' + this.g2b(type.h24_1) + ' = {\n |' + this.e25(type.i24_1) + '\n |}\n |\n ');
|
|
108
113
|
}
|
|
109
114
|
function emit_1(_this__u8e3s4) {
|
|
110
115
|
// Inline function 'kotlin.let' call
|
|
111
116
|
var tmp;
|
|
112
117
|
if (_this__u8e3s4 instanceof Dict) {
|
|
113
|
-
tmp = 'Record<string, ' + this.
|
|
118
|
+
tmp = 'Record<string, ' + this.g25(_this__u8e3s4.r23_1) + '>';
|
|
114
119
|
} else {
|
|
115
120
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
116
|
-
tmp = this.
|
|
121
|
+
tmp = this.g25(_this__u8e3s4.o23_1) + '[]';
|
|
117
122
|
} else {
|
|
118
123
|
if (_this__u8e3s4 instanceof Unit) {
|
|
119
124
|
tmp = 'void';
|
|
@@ -122,10 +127,10 @@ function emit_1(_this__u8e3s4) {
|
|
|
122
127
|
tmp = 'any';
|
|
123
128
|
} else {
|
|
124
129
|
if (_this__u8e3s4 instanceof Custom) {
|
|
125
|
-
tmp = this.
|
|
130
|
+
tmp = this.d2b(_this__u8e3s4.w28_1);
|
|
126
131
|
} else {
|
|
127
132
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
128
|
-
var tmp1_subject = _this__u8e3s4.
|
|
133
|
+
var tmp1_subject = _this__u8e3s4.a29_1;
|
|
129
134
|
var tmp_0;
|
|
130
135
|
if (tmp1_subject instanceof String_0) {
|
|
131
136
|
tmp_0 = 'string';
|
|
@@ -161,53 +166,13 @@ function emit_1(_this__u8e3s4) {
|
|
|
161
166
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
162
167
|
return tmp + (_this__u8e3s4.hm() ? ' | undefined' : '');
|
|
163
168
|
}
|
|
164
|
-
function emitValidator(_this__u8e3s4) {
|
|
165
|
-
var defaultReturn = 'true;';
|
|
166
|
-
var type = _this__u8e3s4.a25_1.l29_1;
|
|
167
|
-
var tmp;
|
|
168
|
-
if (type instanceof Integer) {
|
|
169
|
-
var tmp0_safe_receiver = type.r28_1;
|
|
170
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.x25(tmp0_safe_receiver);
|
|
171
|
-
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
172
|
-
} else {
|
|
173
|
-
if (type instanceof Number_0) {
|
|
174
|
-
var tmp2_safe_receiver = type.u28_1;
|
|
175
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.x25(tmp2_safe_receiver);
|
|
176
|
-
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
177
|
-
} else {
|
|
178
|
-
if (type instanceof String_0) {
|
|
179
|
-
var tmp4_safe_receiver = type.o28_1;
|
|
180
|
-
var tmp_0;
|
|
181
|
-
var tmp_1 = tmp4_safe_receiver;
|
|
182
|
-
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
183
|
-
tmp_0 = null;
|
|
184
|
-
} else {
|
|
185
|
-
tmp_0 = this.x25(new RegExp_0(tmp4_safe_receiver));
|
|
186
|
-
}
|
|
187
|
-
var tmp5_elvis_lhs = tmp_0;
|
|
188
|
-
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
189
|
-
} else {
|
|
190
|
-
if (equals(type, Boolean_instance)) {
|
|
191
|
-
tmp = defaultReturn;
|
|
192
|
-
} else {
|
|
193
|
-
if (equals(type, Bytes_instance)) {
|
|
194
|
-
tmp = defaultReturn;
|
|
195
|
-
} else {
|
|
196
|
-
noWhenBranchMatchedException();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return tmp;
|
|
203
|
-
}
|
|
204
169
|
function emit_2(_this__u8e3s4) {
|
|
205
170
|
var tmp;
|
|
206
171
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
207
|
-
tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
172
|
+
tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.a28_1) + '.test(value)';
|
|
208
173
|
} else {
|
|
209
174
|
if (_this__u8e3s4 instanceof Bound) {
|
|
210
|
-
tmp = '' + _this__u8e3s4.
|
|
175
|
+
tmp = '' + _this__u8e3s4.b28_1 + ' < value && value < ' + _this__u8e3s4.c28_1 + ';';
|
|
211
176
|
} else {
|
|
212
177
|
noWhenBranchMatchedException();
|
|
213
178
|
}
|
|
@@ -215,22 +180,22 @@ function emit_2(_this__u8e3s4) {
|
|
|
215
180
|
return tmp;
|
|
216
181
|
}
|
|
217
182
|
function emit_3(_this__u8e3s4) {
|
|
218
|
-
return joinToString(_this__u8e3s4.
|
|
183
|
+
return joinToString(_this__u8e3s4.f24_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
|
|
219
184
|
}
|
|
220
185
|
function emit_4(_this__u8e3s4) {
|
|
221
|
-
return Spacer_instance.toString() + this.
|
|
186
|
+
return Spacer_instance.toString() + this.f26(_this__u8e3s4.l24_1) + ': ' + this.g25(_this__u8e3s4.m24_1);
|
|
222
187
|
}
|
|
223
|
-
initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter,
|
|
188
|
+
initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, TypeScriptIdentifierEmitter]);
|
|
224
189
|
function emitClient(ast) {
|
|
225
|
-
var tmp = 'client.' + this.
|
|
226
|
-
var tmp_0 = this.
|
|
190
|
+
var tmp = 'client.' + this.n25().w25_1;
|
|
191
|
+
var tmp_0 = this.j25(ast);
|
|
227
192
|
var tmp_1 = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda);
|
|
228
193
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
229
194
|
// Inline function 'kotlin.collections.flatMap' call
|
|
230
195
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
231
|
-
var this_0 = ast.
|
|
196
|
+
var this_0 = ast.k25_1;
|
|
232
197
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
233
|
-
var tmp_2 = this_0.jk_1.
|
|
198
|
+
var tmp_2 = this_0.jk_1.m25_1.hk();
|
|
234
199
|
// Inline function 'kotlin.collections.flatMap' call
|
|
235
200
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
236
201
|
var this_1 = this_0.kk_1;
|
|
@@ -239,7 +204,7 @@ function emitClient(ast) {
|
|
|
239
204
|
while (tmp0_iterator.h()) {
|
|
240
205
|
var element = tmp0_iterator.i();
|
|
241
206
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
242
|
-
var list = element.
|
|
207
|
+
var list = element.m25_1;
|
|
243
208
|
addAll(destination, list);
|
|
244
209
|
}
|
|
245
210
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
@@ -249,7 +214,7 @@ function emitClient(ast) {
|
|
|
249
214
|
while (tmp0_iterator_0.h()) {
|
|
250
215
|
var element_0 = tmp0_iterator_0.i();
|
|
251
216
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
252
|
-
var list_0 =
|
|
217
|
+
var list_0 = importReferences(element_0);
|
|
253
218
|
addAll(destination_0, list_0);
|
|
254
219
|
}
|
|
255
220
|
var set = HashSet_init_$Create$();
|
|
@@ -258,33 +223,28 @@ function emitClient(ast) {
|
|
|
258
223
|
while (tmp0_iterator_1.h()) {
|
|
259
224
|
var e = tmp0_iterator_1.i();
|
|
260
225
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
261
|
-
var key = e.
|
|
226
|
+
var key = e.w28_1;
|
|
262
227
|
if (set.e(key)) {
|
|
263
228
|
list_1.e(e);
|
|
264
229
|
}
|
|
265
230
|
}
|
|
266
231
|
var tmp_3 = list_1;
|
|
267
232
|
var tmp_4 = joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
|
|
268
|
-
var tmp_5 = this.
|
|
269
|
-
return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_4 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const Client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' +
|
|
233
|
+
var tmp_5 = this.j25(ast);
|
|
234
|
+
return new Emitted(tmp, trimMargin('\n |import {Wirespec} from "./Wirespec"\n |\n |' + tmp_1 + '\n |\n |' + tmp_4 + '\n |\n |type RawHandler = (req: Wirespec.RawRequest) => Promise<Wirespec.RawResponse>\n |\n |export const Client = (serialization: Wirespec.Serialization, handler: RawHandler) => ({\n |' + spacer(joinToString(tmp_5, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_1(this)), 1) + '\n |})\n |\n '));
|
|
270
235
|
}
|
|
271
|
-
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter,
|
|
272
|
-
function emit_5(
|
|
273
|
-
var tmp = this.p2b(enum_0.d25_1);
|
|
274
|
-
return 'export type ' + tmp + ' = ' + joinToString(enum_0.e25_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
275
|
-
}
|
|
276
|
-
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
277
|
-
function emit_6(endpoint) {
|
|
236
|
+
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
237
|
+
function emit_5(endpoint) {
|
|
278
238
|
// Inline function 'kotlin.collections.map' call
|
|
279
239
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
280
|
-
var this_0 =
|
|
240
|
+
var this_0 = importReferences(endpoint);
|
|
281
241
|
var set = HashSet_init_$Create$();
|
|
282
242
|
var list = ArrayList_init_$Create$();
|
|
283
243
|
var tmp0_iterator = this_0.g();
|
|
284
244
|
while (tmp0_iterator.h()) {
|
|
285
245
|
var e = tmp0_iterator.i();
|
|
286
246
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
287
|
-
var key = e.
|
|
247
|
+
var key = e.w28_1;
|
|
288
248
|
if (set.e(key)) {
|
|
289
249
|
list.e(e);
|
|
290
250
|
}
|
|
@@ -295,71 +255,103 @@ function emit_6(endpoint) {
|
|
|
295
255
|
while (tmp0_iterator_0.h()) {
|
|
296
256
|
var item = tmp0_iterator_0.i();
|
|
297
257
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
298
|
-
var tmp$ret$2 = 'import {' + item.
|
|
258
|
+
var tmp$ret$2 = 'import {' + item.w28_1 + "} from '../model'";
|
|
299
259
|
destination.e(tmp$ret$2);
|
|
300
260
|
}
|
|
301
261
|
var tmp = destination;
|
|
302
262
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
303
|
-
var tmp_1 = this.
|
|
304
|
-
var tmp_2 =
|
|
263
|
+
var tmp_1 = this.g2b(endpoint.o24_1);
|
|
264
|
+
var tmp_2 = get_pathParams(endpoint);
|
|
305
265
|
var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
306
|
-
var tmp_4 = emitType(endpoint.
|
|
307
|
-
var tmp_5 = emitType(endpoint.
|
|
308
|
-
var tmp_6 = emitType_1(first(endpoint.
|
|
309
|
-
var tmp_7 =
|
|
266
|
+
var tmp_4 = emitType(endpoint.r24_1, this, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
267
|
+
var tmp_5 = emitType(endpoint.s24_1, this, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
268
|
+
var tmp_6 = emitType_1(first(endpoint.t24_1), this, endpoint);
|
|
269
|
+
var tmp_7 = distinctByStatus(endpoint.u24_1);
|
|
310
270
|
var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
311
271
|
var tmp_9 = Spacer_instance.toString();
|
|
312
|
-
var tmp_10 =
|
|
272
|
+
var tmp_10 = distinctByStatus(endpoint.u24_1);
|
|
313
273
|
var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
314
|
-
var tmp_12 = emitFunction_0(first(endpoint.
|
|
315
|
-
var tmp_13 =
|
|
274
|
+
var tmp_12 = emitFunction_0(first(endpoint.t24_1), this, endpoint);
|
|
275
|
+
var tmp_13 = distinctByStatus(endpoint.u24_1);
|
|
316
276
|
var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
317
277
|
var tmp_15 = Spacer_instance.toString();
|
|
318
|
-
var tmp_16 = Spacer_instance.
|
|
278
|
+
var tmp_16 = Spacer_instance.x26(2);
|
|
319
279
|
var tmp_17 = emitHandleFunction(this, endpoint);
|
|
320
280
|
var tmp_18 = Spacer_instance.toString();
|
|
321
|
-
var tmp_19 = prependIndent(emitClient_0(endpoint, this), Spacer_instance.
|
|
322
|
-
var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.
|
|
281
|
+
var tmp_19 = prependIndent(emitClient_0(endpoint, this), Spacer_instance.x26(1));
|
|
282
|
+
var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.x26(1));
|
|
323
283
|
var tmp_21 = Spacer_instance.toString();
|
|
324
|
-
var tmp_22 = Spacer_instance.
|
|
325
|
-
var tmp_23 = Companion_instance_0.
|
|
326
|
-
var tmp_24 = Spacer_instance.
|
|
327
|
-
var tmp_25 = Spacer_instance.
|
|
328
|
-
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.
|
|
284
|
+
var tmp_22 = Spacer_instance.x26(2);
|
|
285
|
+
var tmp_23 = Companion_instance_0.y25(this.g2b(endpoint.o24_1));
|
|
286
|
+
var tmp_24 = Spacer_instance.x26(2);
|
|
287
|
+
var tmp_25 = Spacer_instance.x26(2);
|
|
288
|
+
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.p24_1.q2_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.q24_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.x26(2) + 'server,\n |' + Spacer_instance.x26(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
|
|
329
289
|
}
|
|
330
|
-
|
|
290
|
+
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
291
|
+
function emit_6(refined) {
|
|
292
|
+
return trimMargin('\n |export type ' + this.g2b(refined.j26_1) + ' = string;\n |export const validate' + refined.j26_1.b1() + ' = (value: string): value is ' + this.g2b(refined.j26_1) + ' => \n |' + Spacer_instance.toString() + this.r26(refined) + ';\n |\n ');
|
|
293
|
+
}
|
|
294
|
+
function emitValidator(_this__u8e3s4) {
|
|
295
|
+
var defaultReturn = 'true;';
|
|
296
|
+
var type = _this__u8e3s4.k26_1.a29_1;
|
|
331
297
|
var tmp;
|
|
332
|
-
if (
|
|
333
|
-
|
|
298
|
+
if (type instanceof Integer) {
|
|
299
|
+
var tmp0_safe_receiver = type.g28_1;
|
|
300
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.h25(tmp0_safe_receiver);
|
|
301
|
+
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
334
302
|
} else {
|
|
335
|
-
if (
|
|
336
|
-
|
|
303
|
+
if (type instanceof Number_0) {
|
|
304
|
+
var tmp2_safe_receiver = type.j28_1;
|
|
305
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.h25(tmp2_safe_receiver);
|
|
306
|
+
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
337
307
|
} else {
|
|
338
|
-
|
|
308
|
+
if (type instanceof String_0) {
|
|
309
|
+
var tmp4_safe_receiver = type.d28_1;
|
|
310
|
+
var tmp_0;
|
|
311
|
+
var tmp_1 = tmp4_safe_receiver;
|
|
312
|
+
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
313
|
+
tmp_0 = null;
|
|
314
|
+
} else {
|
|
315
|
+
tmp_0 = this.h25(new RegExp_0(tmp4_safe_receiver));
|
|
316
|
+
}
|
|
317
|
+
var tmp5_elvis_lhs = tmp_0;
|
|
318
|
+
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
319
|
+
} else {
|
|
320
|
+
if (equals(type, Boolean_instance)) {
|
|
321
|
+
tmp = defaultReturn;
|
|
322
|
+
} else {
|
|
323
|
+
if (equals(type, Bytes_instance)) {
|
|
324
|
+
tmp = defaultReturn;
|
|
325
|
+
} else {
|
|
326
|
+
noWhenBranchMatchedException();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
339
330
|
}
|
|
340
331
|
}
|
|
341
332
|
return tmp;
|
|
342
333
|
}
|
|
343
|
-
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [ImportEmitter, ParamEmitter, EndpointEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
344
|
-
function emit_8(refined) {
|
|
345
|
-
return trimMargin('\n |export type ' + this.p2b(refined.z24_1) + ' = string;\n |export const validate' + refined.z24_1.b1() + ' = (value: string): value is ' + this.p2b(refined.z24_1) + ' => \n |' + Spacer_instance.toString() + this.z25(refined) + ';\n |\n ');
|
|
346
|
-
}
|
|
347
334
|
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
348
|
-
|
|
335
|
+
function emit_7(enum_0, module_0) {
|
|
336
|
+
var tmp = this.g2b(enum_0.n26_1);
|
|
337
|
+
return 'export type ' + tmp + ' = ' + joinToString(enum_0.o26_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
338
|
+
}
|
|
339
|
+
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
340
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptIdentifierEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptClientEmitter, TypeScriptEnumDefinitionEmitter]);
|
|
349
341
|
initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
|
|
350
342
|
//endregion
|
|
351
343
|
function emitClientInterface(_this__u8e3s4, $this, endpoint) {
|
|
352
|
-
var tmp =
|
|
344
|
+
var tmp = paramList(_this__u8e3s4, endpoint);
|
|
353
345
|
return joinToString(tmp, ', ', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClientInterface$lambda($this));
|
|
354
346
|
}
|
|
355
347
|
function emitFunction($this, endpoint, request) {
|
|
356
|
-
var tmp = endpoint.
|
|
348
|
+
var tmp = endpoint.o24_1.b1();
|
|
357
349
|
var tmp_0 = emitClientInterface(request, $this, endpoint);
|
|
358
350
|
var tmp_1 = Spacer_instance.toString();
|
|
359
|
-
var tmp_2 = endpoint.
|
|
351
|
+
var tmp_2 = endpoint.o24_1.b1();
|
|
360
352
|
// Inline function 'kotlin.text.orEmpty' call
|
|
361
353
|
// Inline function 'kotlin.takeIf' call
|
|
362
|
-
var this_0 =
|
|
354
|
+
var this_0 = paramList(request, endpoint);
|
|
363
355
|
// Inline function 'kotlin.contracts.contract' call
|
|
364
356
|
var tmp_3;
|
|
365
357
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
|
|
@@ -380,14 +372,14 @@ function emitFunction($this, endpoint, request) {
|
|
|
380
372
|
}
|
|
381
373
|
var tmp0_elvis_lhs = tmp_4;
|
|
382
374
|
var tmp$ret$5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
383
|
-
return trimMargin('\n |' + tmp + ': async (props: {' + tmp_0 + '}) => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.
|
|
375
|
+
return trimMargin('\n |' + tmp + ': async (props: {' + tmp_0 + '}) => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.o24_1.b1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.o24_1.b1() + '.client(serialization).from(rawResponse)\n |},\n ');
|
|
384
376
|
}
|
|
385
377
|
function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
|
|
386
378
|
var endpoint = _destruct__k2r9zo.sd();
|
|
387
|
-
return 'import {' + endpoint.
|
|
379
|
+
return 'import {' + endpoint.o24_1.b1() + '} from "./endpoint/' + endpoint.o24_1.b1() + '"';
|
|
388
380
|
}
|
|
389
381
|
function TypeScriptClientEmitter$emitClient$lambda_0(it) {
|
|
390
|
-
return 'import {' + it.
|
|
382
|
+
return 'import {' + it.w28_1 + '} from "./model/' + it.w28_1 + '"';
|
|
391
383
|
}
|
|
392
384
|
function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
393
385
|
return function (_destruct__k2r9zo) {
|
|
@@ -398,13 +390,13 @@ function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
|
398
390
|
}
|
|
399
391
|
function TypeScriptClientEmitter$emitClientInterface$lambda(this$0) {
|
|
400
392
|
return function (it) {
|
|
401
|
-
return it.
|
|
393
|
+
return it.s25_1.b1() + ': ' + this$0.g25(it.t25_1);
|
|
402
394
|
};
|
|
403
395
|
}
|
|
404
396
|
function TypeScriptClientEmitter() {
|
|
405
397
|
}
|
|
406
398
|
function TypeScriptEmitter$emit$lambda(it) {
|
|
407
|
-
return 'export {' + it.
|
|
399
|
+
return 'export {' + it.d26().b1() + "} from './" + it.d26().b1() + "'";
|
|
408
400
|
}
|
|
409
401
|
function TypeScriptEmitter$emit$lambda_0(it) {
|
|
410
402
|
// Inline function 'kotlin.text.trimStart' call
|
|
@@ -412,32 +404,32 @@ function TypeScriptEmitter$emit$lambda_0(it) {
|
|
|
412
404
|
}
|
|
413
405
|
function TypeScriptEmitter$emit$lambda_1(this$0) {
|
|
414
406
|
return function (it) {
|
|
415
|
-
return this$0.
|
|
407
|
+
return this$0.g25(it);
|
|
416
408
|
};
|
|
417
409
|
}
|
|
418
410
|
function TypeScriptEmitter() {
|
|
419
|
-
|
|
420
|
-
this.
|
|
421
|
-
this.
|
|
422
|
-
this.
|
|
411
|
+
LanguageEmitter.call(this);
|
|
412
|
+
this.h2b_1 = FileExtension_TypeScript_getInstance();
|
|
413
|
+
this.i2b_1 = TypeScriptShared_getInstance();
|
|
414
|
+
this.j2b_1 = '//';
|
|
423
415
|
}
|
|
424
|
-
protoOf(TypeScriptEmitter).
|
|
425
|
-
return this.
|
|
416
|
+
protoOf(TypeScriptEmitter).n25 = function () {
|
|
417
|
+
return this.h2b_1;
|
|
426
418
|
};
|
|
427
|
-
protoOf(TypeScriptEmitter).
|
|
428
|
-
return this.
|
|
419
|
+
protoOf(TypeScriptEmitter).l2a = function () {
|
|
420
|
+
return this.i2b_1;
|
|
429
421
|
};
|
|
430
|
-
protoOf(TypeScriptEmitter).
|
|
431
|
-
return this.
|
|
422
|
+
protoOf(TypeScriptEmitter).o25 = function () {
|
|
423
|
+
return this.j2b_1;
|
|
432
424
|
};
|
|
433
425
|
protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
434
426
|
// Inline function 'kotlin.run' call
|
|
435
427
|
// Inline function 'kotlin.contracts.contract' call
|
|
436
428
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
437
|
-
var $this$run = protoOf(
|
|
429
|
+
var $this$run = protoOf(LanguageEmitter).d23.call(this, ast, logger);
|
|
438
430
|
var tmp;
|
|
439
|
-
if (
|
|
440
|
-
tmp = $this$run.pk(this.
|
|
431
|
+
if (hasEndpoints(ast)) {
|
|
432
|
+
tmp = $this$run.pk(this.f2b(ast));
|
|
441
433
|
} else {
|
|
442
434
|
tmp = $this$run;
|
|
443
435
|
}
|
|
@@ -445,9 +437,9 @@ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
|
445
437
|
// Inline function 'kotlin.collections.map' call
|
|
446
438
|
// Inline function 'kotlin.collections.groupBy' call
|
|
447
439
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
448
|
-
var this_0 = ast.
|
|
440
|
+
var this_0 = ast.k25_1;
|
|
449
441
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
450
|
-
var tmp_1 = this_0.jk_1.
|
|
442
|
+
var tmp_1 = this_0.jk_1.m25_1.hk();
|
|
451
443
|
// Inline function 'kotlin.collections.flatMap' call
|
|
452
444
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
453
445
|
var this_1 = this_0.kk_1;
|
|
@@ -456,7 +448,7 @@ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
|
456
448
|
while (tmp0_iterator.h()) {
|
|
457
449
|
var element = tmp0_iterator.i();
|
|
458
450
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
459
|
-
var list = element.
|
|
451
|
+
var list = element.m25_1;
|
|
460
452
|
addAll(destination, list);
|
|
461
453
|
}
|
|
462
454
|
// Inline function 'kotlin.collections.groupByTo' call
|
|
@@ -492,37 +484,37 @@ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
|
492
484
|
var ns = item.a1();
|
|
493
485
|
// Inline function 'kotlin.collections.component2' call
|
|
494
486
|
var defs = item.b1();
|
|
495
|
-
var tmp_3 = ns + '/index.' + this.
|
|
487
|
+
var tmp_3 = ns + '/index.' + this.n25().w25_1;
|
|
496
488
|
var tmp$ret$15 = new Emitted(tmp_3, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
|
|
497
489
|
destination_1.e(tmp$ret$15);
|
|
498
490
|
}
|
|
499
491
|
return tmp_0.ok(destination_1);
|
|
500
492
|
};
|
|
501
|
-
protoOf(TypeScriptEmitter).
|
|
493
|
+
protoOf(TypeScriptEmitter).b26 = function (module_0, logger) {
|
|
502
494
|
// Inline function 'kotlin.let' call
|
|
503
495
|
// Inline function 'kotlin.contracts.contract' call
|
|
504
496
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
505
|
-
return protoOf(
|
|
497
|
+
return protoOf(LanguageEmitter).b26.call(this, module_0, logger).pk(new Emitted('Wirespec', this.l2a().l2b_1));
|
|
506
498
|
};
|
|
507
|
-
protoOf(TypeScriptEmitter).
|
|
499
|
+
protoOf(TypeScriptEmitter).c26 = function (definition, module_0, logger) {
|
|
508
500
|
// Inline function 'kotlin.let' call
|
|
509
501
|
// Inline function 'kotlin.contracts.contract' call
|
|
510
502
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
511
|
-
var it = protoOf(
|
|
512
|
-
var subPackageName = plus(Companion_instance.
|
|
513
|
-
return new Emitted(subPackageName.
|
|
503
|
+
var it = protoOf(LanguageEmitter).c26.call(this, definition, module_0, logger);
|
|
504
|
+
var subPackageName = plus(Companion_instance.s26(''), definition);
|
|
505
|
+
return new Emitted(subPackageName.v26() + this.d2b(it.x23_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.y23_1 + '\n '));
|
|
514
506
|
};
|
|
515
|
-
protoOf(TypeScriptEmitter).
|
|
507
|
+
protoOf(TypeScriptEmitter).h26 = function (union) {
|
|
516
508
|
// Inline function 'kotlin.collections.map' call
|
|
517
509
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
518
|
-
var this_0 =
|
|
510
|
+
var this_0 = importReferences(union);
|
|
519
511
|
var set = HashSet_init_$Create$();
|
|
520
512
|
var list = ArrayList_init_$Create$();
|
|
521
513
|
var tmp0_iterator = this_0.g();
|
|
522
514
|
while (tmp0_iterator.h()) {
|
|
523
515
|
var e = tmp0_iterator.i();
|
|
524
516
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
525
|
-
var key = e.
|
|
517
|
+
var key = e.w28_1;
|
|
526
518
|
if (set.e(key)) {
|
|
527
519
|
list.e(e);
|
|
528
520
|
}
|
|
@@ -533,66 +525,79 @@ protoOf(TypeScriptEmitter).x24 = function (union) {
|
|
|
533
525
|
while (tmp0_iterator_0.h()) {
|
|
534
526
|
var item = tmp0_iterator_0.i();
|
|
535
527
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
536
|
-
var tmp$ret$2 = 'import {' + item.
|
|
528
|
+
var tmp$ret$2 = 'import {' + item.w28_1 + "} from '../model'";
|
|
537
529
|
destination.e(tmp$ret$2);
|
|
538
530
|
}
|
|
539
531
|
var tmp = destination;
|
|
540
532
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
|
|
541
|
-
var tmp_1 = this.
|
|
542
|
-
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.
|
|
533
|
+
var tmp_1 = this.g2b(union.d24_1);
|
|
534
|
+
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.e24_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
|
|
543
535
|
};
|
|
544
|
-
protoOf(TypeScriptEmitter).
|
|
545
|
-
return this.
|
|
536
|
+
protoOf(TypeScriptEmitter).g26 = function (channel) {
|
|
537
|
+
return this.p25();
|
|
546
538
|
};
|
|
539
|
+
function emit_8(_this__u8e3s4, $this) {
|
|
540
|
+
var tmp;
|
|
541
|
+
if (_this__u8e3s4 instanceof Literal) {
|
|
542
|
+
tmp = _this__u8e3s4.q25_1;
|
|
543
|
+
} else {
|
|
544
|
+
if (_this__u8e3s4 instanceof Param) {
|
|
545
|
+
tmp = ':' + _this__u8e3s4.v24_1.b1();
|
|
546
|
+
} else {
|
|
547
|
+
noWhenBranchMatchedException();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return tmp;
|
|
551
|
+
}
|
|
547
552
|
function emitClient_0(_this__u8e3s4, $this) {
|
|
548
|
-
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.
|
|
553
|
+
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.x26(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.x26(1)) + '\n |})\n ');
|
|
549
554
|
}
|
|
550
555
|
function emitClientTo(_this__u8e3s4, $this) {
|
|
551
|
-
var tmp = Spacer_instance.
|
|
556
|
+
var tmp = Spacer_instance.x26(1);
|
|
552
557
|
// Inline function 'kotlin.text.uppercase' call
|
|
553
558
|
// Inline function 'kotlin.js.asDynamic' call
|
|
554
|
-
var tmp_0 = _this__u8e3s4.
|
|
555
|
-
var tmp_1 = Spacer_instance.
|
|
559
|
+
var tmp_0 = _this__u8e3s4.p24_1.q2_1.toUpperCase();
|
|
560
|
+
var tmp_1 = Spacer_instance.x26(1);
|
|
556
561
|
var tmp_2 = emitPathArray(_this__u8e3s4, $this);
|
|
557
|
-
var tmp_3 = Spacer_instance.
|
|
558
|
-
var tmp_4 = joinToString(_this__u8e3s4.
|
|
559
|
-
var tmp_5 = Spacer_instance.
|
|
560
|
-
return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
562
|
+
var tmp_3 = Spacer_instance.x26(1);
|
|
563
|
+
var tmp_4 = joinToString(_this__u8e3s4.r24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
|
|
564
|
+
var tmp_5 = Spacer_instance.x26(1);
|
|
565
|
+
return trimMargin('\n |to: (it) => ({\n |' + tmp + 'method: "' + tmp_0 + '",\n |' + tmp_1 + 'path: ' + tmp_2 + ',\n |' + tmp_3 + 'queries: {' + tmp_4 + '},\n |' + tmp_5 + 'headers: {' + joinToString(_this__u8e3s4.s24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.x26(1) + 'body: serialization.serialize(it.body)\n |})\n ');
|
|
561
566
|
}
|
|
562
567
|
function emitClientFrom(_this__u8e3s4, $this) {
|
|
563
|
-
var tmp = Spacer_instance.
|
|
564
|
-
var tmp_0 =
|
|
565
|
-
return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.
|
|
568
|
+
var tmp = Spacer_instance.x26(1);
|
|
569
|
+
var tmp_0 = distinctByStatus(_this__u8e3s4.u24_1);
|
|
570
|
+
return trimMargin('\n |from: (it) => {\n |' + tmp + 'switch (it.status) {\n |' + prependIndent(joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFrom$lambda($this)), Spacer_instance.x26(2)) + '\n |' + Spacer_instance.x26(2) + 'default:\n |' + Spacer_instance.x26(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.x26(1) + '}\n |}\n ');
|
|
566
571
|
}
|
|
567
572
|
function emitClientFromResponse(_this__u8e3s4, $this) {
|
|
568
|
-
var tmp =
|
|
569
|
-
var tmp_0 = Spacer_instance.
|
|
570
|
-
var tmp_1 = Spacer_instance.
|
|
571
|
-
var tmp_2 =
|
|
572
|
-
var tmp_3 = Spacer_instance.
|
|
573
|
-
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
573
|
+
var tmp = fixStatus(_this__u8e3s4.a25_1);
|
|
574
|
+
var tmp_0 = Spacer_instance.x26(1);
|
|
575
|
+
var tmp_1 = Spacer_instance.x26(2);
|
|
576
|
+
var tmp_2 = fixStatus(_this__u8e3s4.a25_1);
|
|
577
|
+
var tmp_3 = Spacer_instance.x26(2);
|
|
578
|
+
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.b25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.x26(2) + 'body: serialization.deserialize<' + emitReference(_this__u8e3s4, $this) + '>(it.body)\n |' + Spacer_instance.x26(1) + '};\n ');
|
|
574
579
|
}
|
|
575
580
|
function emitServer(_this__u8e3s4, $this) {
|
|
576
|
-
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.
|
|
581
|
+
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.x26(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.x26(1)) + '\n |})\n ');
|
|
577
582
|
}
|
|
578
583
|
function emitServerFrom(_this__u8e3s4, $this) {
|
|
579
|
-
var tmp = Spacer_instance.
|
|
580
|
-
var tmp_0 = Spacer_instance.
|
|
584
|
+
var tmp = Spacer_instance.x26(1);
|
|
585
|
+
var tmp_0 = Spacer_instance.x26(2);
|
|
581
586
|
// Inline function 'kotlin.text.uppercase' call
|
|
582
587
|
// Inline function 'kotlin.js.asDynamic' call
|
|
583
|
-
var tmp_1 = _this__u8e3s4.
|
|
584
|
-
var tmp_2 = Spacer_instance.
|
|
585
|
-
var tmp_3 =
|
|
586
|
-
var tmp_4 = prependIndent(joinToString(tmp_3, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.
|
|
587
|
-
var tmp_5 = Spacer_instance.
|
|
588
|
-
var tmp_6 = Spacer_instance.
|
|
589
|
-
var tmp_7 = joinToString(_this__u8e3s4.
|
|
590
|
-
var tmp_8 = Spacer_instance.
|
|
591
|
-
var tmp_9 = Spacer_instance.
|
|
592
|
-
return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.
|
|
588
|
+
var tmp_1 = _this__u8e3s4.p24_1.q2_1.toUpperCase();
|
|
589
|
+
var tmp_2 = Spacer_instance.x26(2);
|
|
590
|
+
var tmp_3 = get_indexedPathParams(_this__u8e3s4);
|
|
591
|
+
var tmp_4 = prependIndent(joinToString(tmp_3, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.x26(3));
|
|
592
|
+
var tmp_5 = Spacer_instance.x26(2);
|
|
593
|
+
var tmp_6 = Spacer_instance.x26(2);
|
|
594
|
+
var tmp_7 = joinToString(_this__u8e3s4.r24_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
|
|
595
|
+
var tmp_8 = Spacer_instance.x26(2);
|
|
596
|
+
var tmp_9 = Spacer_instance.x26(2);
|
|
597
|
+
return trimMargin('\n |from: (it) => {\n |' + tmp + 'return {\n |' + tmp_0 + 'method: "' + tmp_1 + '",\n |' + tmp_2 + 'path: {\n |' + tmp_4 + '\n |' + tmp_5 + '},\n |' + tmp_6 + 'queries: {\n |' + tmp_7 + '\n |' + tmp_8 + '},\n |' + tmp_9 + 'headers: {\n |' + joinToString(_this__u8e3s4.s24_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.x26(2) + '},\n |' + Spacer_instance.x26(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.x26(1) + '}\n |}\n ');
|
|
593
598
|
}
|
|
594
599
|
function emitServerTo($this) {
|
|
595
|
-
return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.
|
|
600
|
+
return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.x26(1) + 'status: it.status,\n |' + Spacer_instance.x26(1) + 'headers: {},\n |' + Spacer_instance.x26(1) + 'body: serialization.serialize(it.body),\n |})\n ');
|
|
596
601
|
}
|
|
597
602
|
function emitType(_this__u8e3s4, $this, name, block) {
|
|
598
603
|
var tmp;
|
|
@@ -605,16 +610,16 @@ function emitType(_this__u8e3s4, $this, name, block) {
|
|
|
605
610
|
return tmp;
|
|
606
611
|
}
|
|
607
612
|
function emitName(_this__u8e3s4, $this) {
|
|
608
|
-
return 'Response' + Companion_instance_0.
|
|
613
|
+
return 'Response' + Companion_instance_0.x25(_this__u8e3s4.a25_1);
|
|
609
614
|
}
|
|
610
615
|
function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
611
616
|
var tmp = Spacer_instance.toString();
|
|
612
|
-
var tmp_0 =
|
|
617
|
+
var tmp_0 = paramList(_this__u8e3s4, endpoint);
|
|
613
618
|
var tmp_1 = joinToObject(tmp_0, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda($this));
|
|
614
619
|
var tmp_2 = Spacer_instance.toString();
|
|
615
620
|
// Inline function 'kotlin.text.orEmpty' call
|
|
616
621
|
// Inline function 'kotlin.takeIf' call
|
|
617
|
-
var this_0 =
|
|
622
|
+
var this_0 = paramList(_this__u8e3s4, endpoint);
|
|
618
623
|
// Inline function 'kotlin.contracts.contract' call
|
|
619
624
|
var tmp_3;
|
|
620
625
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
|
|
@@ -635,18 +640,18 @@ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
|
635
640
|
}
|
|
636
641
|
var tmp0_elvis_lhs = tmp_4;
|
|
637
642
|
var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
638
|
-
var tmp_6 = Spacer_instance.
|
|
639
|
-
var tmp_7 =
|
|
643
|
+
var tmp_6 = Spacer_instance.x26(2);
|
|
644
|
+
var tmp_7 = get_pathParams(endpoint);
|
|
640
645
|
var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
|
|
641
|
-
var tmp_9 = Spacer_instance.
|
|
642
|
-
var tmp_10 = endpoint.
|
|
643
|
-
var tmp_11 = Spacer_instance.
|
|
644
|
-
var tmp_12 = joinToObject(endpoint.
|
|
645
|
-
var tmp_13 = Spacer_instance.
|
|
646
|
-
var tmp_14 = joinToObject(endpoint.
|
|
647
|
-
var tmp_15 = Spacer_instance.
|
|
646
|
+
var tmp_9 = Spacer_instance.x26(2);
|
|
647
|
+
var tmp_10 = endpoint.p24_1.toString();
|
|
648
|
+
var tmp_11 = Spacer_instance.x26(2);
|
|
649
|
+
var tmp_12 = joinToObject(endpoint.r24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
|
|
650
|
+
var tmp_13 = Spacer_instance.x26(2);
|
|
651
|
+
var tmp_14 = joinToObject(endpoint.s24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
|
|
652
|
+
var tmp_15 = Spacer_instance.x26(2);
|
|
648
653
|
var tmp_16;
|
|
649
|
-
if (_this__u8e3s4.
|
|
654
|
+
if (_this__u8e3s4.x24_1 == null) {
|
|
650
655
|
tmp_16 = null;
|
|
651
656
|
} else {
|
|
652
657
|
// Inline function 'kotlin.let' call
|
|
@@ -659,14 +664,14 @@ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
|
659
664
|
}
|
|
660
665
|
function emitFunction_1(_this__u8e3s4, $this) {
|
|
661
666
|
var tmp = Spacer_instance.toString();
|
|
662
|
-
var tmp_0 = Companion_instance_0.
|
|
663
|
-
var tmp_1 =
|
|
667
|
+
var tmp_0 = Companion_instance_0.x25(_this__u8e3s4.a25_1);
|
|
668
|
+
var tmp_1 = paramList_0(_this__u8e3s4);
|
|
664
669
|
var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
|
|
665
670
|
var tmp_3 = Spacer_instance.toString();
|
|
666
|
-
var tmp_4 = Companion_instance_0.
|
|
671
|
+
var tmp_4 = Companion_instance_0.x25(_this__u8e3s4.a25_1);
|
|
667
672
|
// Inline function 'kotlin.text.orEmpty' call
|
|
668
673
|
// Inline function 'kotlin.takeIf' call
|
|
669
|
-
var this_0 =
|
|
674
|
+
var this_0 = paramList_0(_this__u8e3s4);
|
|
670
675
|
// Inline function 'kotlin.contracts.contract' call
|
|
671
676
|
var tmp_5;
|
|
672
677
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
|
|
@@ -683,18 +688,18 @@ function emitFunction_1(_this__u8e3s4, $this) {
|
|
|
683
688
|
// Inline function 'kotlin.run' call
|
|
684
689
|
// Inline function 'kotlin.contracts.contract' call
|
|
685
690
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
|
|
686
|
-
tmp_6 = 'params: Response' + Companion_instance_0.
|
|
691
|
+
tmp_6 = 'params: Response' + Companion_instance_0.x25(_this__u8e3s4.a25_1) + 'Params';
|
|
687
692
|
}
|
|
688
693
|
var tmp0_elvis_lhs = tmp_6;
|
|
689
694
|
var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
690
|
-
var tmp_8 = Companion_instance_0.
|
|
691
|
-
var tmp_9 = Spacer_instance.
|
|
692
|
-
var tmp_10 =
|
|
693
|
-
var tmp_11 = Spacer_instance.
|
|
694
|
-
var tmp_12 = joinToObject(_this__u8e3s4.
|
|
695
|
-
var tmp_13 = Spacer_instance.
|
|
695
|
+
var tmp_8 = Companion_instance_0.x25(_this__u8e3s4.a25_1);
|
|
696
|
+
var tmp_9 = Spacer_instance.x26(2);
|
|
697
|
+
var tmp_10 = fixStatus(_this__u8e3s4.a25_1);
|
|
698
|
+
var tmp_11 = Spacer_instance.x26(2);
|
|
699
|
+
var tmp_12 = joinToObject(_this__u8e3s4.b25_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
|
|
700
|
+
var tmp_13 = Spacer_instance.x26(2);
|
|
696
701
|
var tmp_14;
|
|
697
|
-
if (_this__u8e3s4.
|
|
702
|
+
if (_this__u8e3s4.c25_1 == null) {
|
|
698
703
|
tmp_14 = null;
|
|
699
704
|
} else {
|
|
700
705
|
// Inline function 'kotlin.let' call
|
|
@@ -706,51 +711,51 @@ function emitFunction_1(_this__u8e3s4, $this) {
|
|
|
706
711
|
return trimIndent('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
|
|
707
712
|
}
|
|
708
713
|
function emitReference(_this__u8e3s4, $this) {
|
|
709
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
710
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
711
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
714
|
+
var tmp0_safe_receiver = _this__u8e3s4.c25_1;
|
|
715
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z24_1;
|
|
716
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.g25(tmp1_safe_receiver);
|
|
712
717
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
713
718
|
}
|
|
714
719
|
function emitPathArray(_this__u8e3s4, $this) {
|
|
715
|
-
return joinToString(_this__u8e3s4.
|
|
720
|
+
return joinToString(_this__u8e3s4.q24_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
|
|
716
721
|
}
|
|
717
722
|
function emitType_0(_this__u8e3s4, $this) {
|
|
718
723
|
var tmp = Spacer_instance.toString();
|
|
719
724
|
var tmp_0 = emitName(_this__u8e3s4, $this);
|
|
720
|
-
var tmp_1 = Spacer_instance.
|
|
721
|
-
var tmp_2 =
|
|
722
|
-
var tmp_3 = Spacer_instance.
|
|
723
|
-
return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
725
|
+
var tmp_1 = Spacer_instance.x26(2);
|
|
726
|
+
var tmp_2 = fixStatus(_this__u8e3s4.a25_1);
|
|
727
|
+
var tmp_3 = Spacer_instance.x26(2);
|
|
728
|
+
return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.b25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.x26(2) + 'body: ' + emitReference(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
724
729
|
}
|
|
725
730
|
function emitReference_0(_this__u8e3s4, $this) {
|
|
726
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
727
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
728
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
731
|
+
var tmp0_safe_receiver = _this__u8e3s4.x24_1;
|
|
732
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z24_1;
|
|
733
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.g25(tmp1_safe_receiver);
|
|
729
734
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
730
735
|
}
|
|
731
736
|
function emitType_1(_this__u8e3s4, $this, endpoint) {
|
|
732
|
-
return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.
|
|
737
|
+
return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.x26(2) + 'path: Path\n |' + Spacer_instance.x26(2) + 'method: "' + endpoint.p24_1.toString() + '"\n |' + Spacer_instance.x26(2) + 'queries: Queries\n |' + Spacer_instance.x26(2) + 'headers: Headers\n |' + Spacer_instance.x26(2) + 'body: ' + emitReference_0(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
733
738
|
}
|
|
734
739
|
function emit_9(_this__u8e3s4, $this) {
|
|
735
|
-
return Spacer_instance.toString() + $this.
|
|
740
|
+
return Spacer_instance.toString() + $this.f26(_this__u8e3s4.v24_1) + ': ' + $this.g25(_this__u8e3s4.w24_1);
|
|
736
741
|
}
|
|
737
742
|
function emit_10(_this__u8e3s4, $this) {
|
|
738
|
-
return $this.
|
|
743
|
+
return $this.f26(_this__u8e3s4.s25_1) + (_this__u8e3s4.t25_1.hm() ? '?' : '') + ': ' + $this.g25(_this__u8e3s4.t25_1.q28(false));
|
|
739
744
|
}
|
|
740
745
|
function emitDeserialize(_this__u8e3s4, $this) {
|
|
741
|
-
return $this.
|
|
746
|
+
return $this.f26(_this__u8e3s4.rd_1.v24_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.qd_1 + '])';
|
|
742
747
|
}
|
|
743
748
|
function emitDeserialize_0(_this__u8e3s4, $this, fields) {
|
|
744
|
-
return $this.
|
|
749
|
+
return $this.f26(_this__u8e3s4.l24_1) + ': serialization.deserialize(it.' + fields + '[' + $this.f26(_this__u8e3s4.l24_1) + '])';
|
|
745
750
|
}
|
|
746
751
|
function emitSerialize(_this__u8e3s4, $this, fields) {
|
|
747
|
-
return $this.
|
|
752
|
+
return $this.f26(_this__u8e3s4.l24_1) + ': serialization.serialize(it.' + fields + '[' + $this.f26(_this__u8e3s4.l24_1) + '])';
|
|
748
753
|
}
|
|
749
754
|
function joinToObject(_this__u8e3s4, $this, transform) {
|
|
750
755
|
return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
|
|
751
756
|
}
|
|
752
757
|
function emitHandleFunction($this, endpoint) {
|
|
753
|
-
return Companion_instance_0.
|
|
758
|
+
return Companion_instance_0.y25($this.g2b(endpoint.o24_1)) + ': (request:Request) => Promise<Response>';
|
|
754
759
|
}
|
|
755
760
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda(it) {
|
|
756
761
|
// Inline function 'kotlin.text.trimStart' call
|
|
@@ -763,12 +768,12 @@ function TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this$0) {
|
|
|
763
768
|
}
|
|
764
769
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
765
770
|
return function (it) {
|
|
766
|
-
return this$0.
|
|
771
|
+
return this$0.f25(it);
|
|
767
772
|
};
|
|
768
773
|
}
|
|
769
774
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
770
775
|
return function (it) {
|
|
771
|
-
return this$0.
|
|
776
|
+
return this$0.f25(it);
|
|
772
777
|
};
|
|
773
778
|
}
|
|
774
779
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
@@ -788,7 +793,7 @@ function TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this$0) {
|
|
|
788
793
|
}
|
|
789
794
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this$0) {
|
|
790
795
|
return function (it) {
|
|
791
|
-
return this$0
|
|
796
|
+
return emit_8(it, this$0);
|
|
792
797
|
};
|
|
793
798
|
}
|
|
794
799
|
function TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda(this$0) {
|
|
@@ -818,17 +823,17 @@ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda(this$0) {
|
|
|
818
823
|
}
|
|
819
824
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0(this$0) {
|
|
820
825
|
return function (it) {
|
|
821
|
-
return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.
|
|
826
|
+
return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.x26(3));
|
|
822
827
|
};
|
|
823
828
|
}
|
|
824
829
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1(this$0) {
|
|
825
830
|
return function (it) {
|
|
826
|
-
return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.
|
|
831
|
+
return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.x26(3));
|
|
827
832
|
};
|
|
828
833
|
}
|
|
829
834
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda($block) {
|
|
830
835
|
return function (it) {
|
|
831
|
-
return Spacer_instance.
|
|
836
|
+
return Spacer_instance.x26(1) + $block(it);
|
|
832
837
|
};
|
|
833
838
|
}
|
|
834
839
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
@@ -838,17 +843,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
|
838
843
|
}
|
|
839
844
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0(this$0) {
|
|
840
845
|
return function (it) {
|
|
841
|
-
return this$0.
|
|
846
|
+
return this$0.f26(it.v24_1) + ': params[' + this$0.f26(it.v24_1) + ']';
|
|
842
847
|
};
|
|
843
848
|
}
|
|
844
849
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1(this$0) {
|
|
845
850
|
return function (it) {
|
|
846
|
-
return this$0.
|
|
851
|
+
return this$0.f26(it.l24_1) + ': params[' + this$0.f26(it.l24_1) + ']';
|
|
847
852
|
};
|
|
848
853
|
}
|
|
849
854
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2(this$0) {
|
|
850
855
|
return function (it) {
|
|
851
|
-
return this$0.
|
|
856
|
+
return this$0.f26(it.l24_1) + ': params[' + this$0.f26(it.l24_1) + ']';
|
|
852
857
|
};
|
|
853
858
|
}
|
|
854
859
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
@@ -858,17 +863,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
|
858
863
|
}
|
|
859
864
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4(this$0) {
|
|
860
865
|
return function (it) {
|
|
861
|
-
return this$0.
|
|
866
|
+
return this$0.f26(it.l24_1) + ': params[' + this$0.f26(it.l24_1) + ']';
|
|
862
867
|
};
|
|
863
868
|
}
|
|
864
869
|
function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
865
870
|
return function (it) {
|
|
866
871
|
var tmp;
|
|
867
872
|
if (it instanceof Literal) {
|
|
868
|
-
tmp = '"' + it.
|
|
873
|
+
tmp = '"' + it.q25_1 + '"';
|
|
869
874
|
} else {
|
|
870
875
|
if (it instanceof Param) {
|
|
871
|
-
tmp = 'serialization.serialize(it.path[' + this$0.
|
|
876
|
+
tmp = 'serialization.serialize(it.path[' + this$0.f26(it.v24_1) + '])';
|
|
872
877
|
} else {
|
|
873
878
|
noWhenBranchMatchedException();
|
|
874
879
|
}
|
|
@@ -878,7 +883,7 @@ function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
|
878
883
|
}
|
|
879
884
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda_0(this$0) {
|
|
880
885
|
return function (it) {
|
|
881
|
-
return this$0.
|
|
886
|
+
return this$0.f26(it.l24_1) + ': ' + this$0.g25(it.m24_1);
|
|
882
887
|
};
|
|
883
888
|
}
|
|
884
889
|
function TypeScriptEndpointDefinitionEmitter() {
|
|
@@ -894,8 +899,8 @@ function TypeScriptRefinedTypeDefinitionEmitter() {
|
|
|
894
899
|
}
|
|
895
900
|
function TypeScriptShared() {
|
|
896
901
|
TypeScriptShared_instance = this;
|
|
897
|
-
this.
|
|
898
|
-
this.
|
|
902
|
+
this.k2b_1 = 'community.flock.wirespec';
|
|
903
|
+
this.l2b_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 ');
|
|
899
904
|
}
|
|
900
905
|
protoOf(TypeScriptShared).toString = function () {
|
|
901
906
|
return 'TypeScriptShared';
|
|
@@ -926,27 +931,26 @@ function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
|
|
|
926
931
|
}
|
|
927
932
|
function TypeScriptTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
928
933
|
return function (it) {
|
|
929
|
-
return this$0.
|
|
934
|
+
return this$0.f25(it);
|
|
930
935
|
};
|
|
931
936
|
}
|
|
932
937
|
function TypeScriptTypeDefinitionEmitter() {
|
|
933
938
|
}
|
|
934
939
|
//region block: post-declaration
|
|
935
|
-
protoOf(TypeScriptEmitter).
|
|
936
|
-
protoOf(TypeScriptEmitter).
|
|
937
|
-
protoOf(TypeScriptEmitter).
|
|
938
|
-
protoOf(TypeScriptEmitter).
|
|
939
|
-
protoOf(TypeScriptEmitter).
|
|
940
|
-
protoOf(TypeScriptEmitter).
|
|
941
|
-
protoOf(TypeScriptEmitter).
|
|
942
|
-
protoOf(TypeScriptEmitter).
|
|
943
|
-
protoOf(TypeScriptEmitter).
|
|
944
|
-
protoOf(TypeScriptEmitter).
|
|
945
|
-
protoOf(TypeScriptEmitter).
|
|
946
|
-
protoOf(TypeScriptEmitter).
|
|
947
|
-
protoOf(TypeScriptEmitter).
|
|
948
|
-
protoOf(TypeScriptEmitter).
|
|
949
|
-
protoOf(TypeScriptEmitter).n26 = emitClientEndpointRequest;
|
|
940
|
+
protoOf(TypeScriptEmitter).p26 = emit_7;
|
|
941
|
+
protoOf(TypeScriptEmitter).d25 = emit_0;
|
|
942
|
+
protoOf(TypeScriptEmitter).g25 = emit_1;
|
|
943
|
+
protoOf(TypeScriptEmitter).h25 = emit_2;
|
|
944
|
+
protoOf(TypeScriptEmitter).e25 = emit_3;
|
|
945
|
+
protoOf(TypeScriptEmitter).f25 = emit_4;
|
|
946
|
+
protoOf(TypeScriptEmitter).f26 = emit;
|
|
947
|
+
protoOf(TypeScriptEmitter).q26 = emit_5;
|
|
948
|
+
protoOf(TypeScriptEmitter).l26 = emit_6;
|
|
949
|
+
protoOf(TypeScriptEmitter).r26 = emitValidator;
|
|
950
|
+
protoOf(TypeScriptEmitter).g2b = sanitizeSymbol;
|
|
951
|
+
protoOf(TypeScriptEmitter).d2b = sanitizeSymbol_0;
|
|
952
|
+
protoOf(TypeScriptEmitter).f2b = emitClient;
|
|
953
|
+
protoOf(TypeScriptEmitter).j25 = emitClientEndpointRequest;
|
|
950
954
|
//endregion
|
|
951
955
|
//region block: exports
|
|
952
956
|
export {
|