@flock/wirespec 0.16.8 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arrow-arrow-core.mjs +306 -61
- package/arrow-arrow-core.mjs.map +1 -1
- package/clikt-clikt.mjs +1160 -1160
- package/colormath-root-colormath.mjs +425 -425
- package/kotlin-openapi-bindings.mjs +4762 -4762
- package/kotlin-rgxgen.mjs +1769 -1769
- package/kotlinx-io-kotlinx-io-core.mjs +380 -380
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1645 -1645
- package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1307 -1307
- package/markdown.mjs +1871 -1871
- package/mordant-mordant.mjs +1637 -1637
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +1673 -1503
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +248 -248
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +239 -250
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +251 -251
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +260 -231
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +78 -78
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +342 -340
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +511 -511
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +578 -576
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +168 -167
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +82 -81
- package/wirespec-src-plugin-cli.mjs.map +1 -1
- package/wirespec-src-plugin-npm.mjs +30 -29
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +27 -27
|
@@ -78,7 +78,7 @@ function emit(identifier) {
|
|
|
78
78
|
}
|
|
79
79
|
initMetadataForInterface(TypeScriptIdentifierEmitter, 'TypeScriptIdentifierEmitter');
|
|
80
80
|
function sanitizeSymbol(_this__u8e3s4) {
|
|
81
|
-
return this.
|
|
81
|
+
return this.j2b(_this__u8e3s4.b1());
|
|
82
82
|
}
|
|
83
83
|
function sanitizeSymbol_0(_this__u8e3s4) {
|
|
84
84
|
var tmp = asSequence(_this__u8e3s4);
|
|
@@ -94,7 +94,7 @@ function emit_0(type, module_0) {
|
|
|
94
94
|
while (tmp0_iterator.h()) {
|
|
95
95
|
var e = tmp0_iterator.i();
|
|
96
96
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
97
|
-
var key = e.
|
|
97
|
+
var key = e.c29_1;
|
|
98
98
|
if (set.e(key)) {
|
|
99
99
|
list.e(e);
|
|
100
100
|
}
|
|
@@ -105,20 +105,20 @@ function emit_0(type, module_0) {
|
|
|
105
105
|
while (tmp0_iterator_0.h()) {
|
|
106
106
|
var item = tmp0_iterator_0.i();
|
|
107
107
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
108
|
-
var tmp$ret$2 = 'import {' + item.
|
|
108
|
+
var tmp$ret$2 = 'import {' + item.c29_1 + "} from './" + item.c29_1 + "'";
|
|
109
109
|
destination.e(tmp$ret$2);
|
|
110
110
|
}
|
|
111
111
|
var tmp = destination;
|
|
112
|
-
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.m2b(type.k24_1) + ' = {\n |' + this.h25(type.l24_1) + '\n |}\n |\n ');
|
|
113
113
|
}
|
|
114
114
|
function emit_1(_this__u8e3s4) {
|
|
115
115
|
// Inline function 'kotlin.let' call
|
|
116
116
|
var tmp;
|
|
117
117
|
if (_this__u8e3s4 instanceof Dict) {
|
|
118
|
-
tmp = 'Record<string, ' + this.
|
|
118
|
+
tmp = 'Record<string, ' + this.j25(_this__u8e3s4.u23_1) + '>';
|
|
119
119
|
} else {
|
|
120
120
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
121
|
-
tmp = this.
|
|
121
|
+
tmp = this.j25(_this__u8e3s4.r23_1) + '[]';
|
|
122
122
|
} else {
|
|
123
123
|
if (_this__u8e3s4 instanceof Unit) {
|
|
124
124
|
tmp = 'void';
|
|
@@ -127,10 +127,10 @@ function emit_1(_this__u8e3s4) {
|
|
|
127
127
|
tmp = 'any';
|
|
128
128
|
} else {
|
|
129
129
|
if (_this__u8e3s4 instanceof Custom) {
|
|
130
|
-
tmp = this.
|
|
130
|
+
tmp = this.j2b(_this__u8e3s4.c29_1);
|
|
131
131
|
} else {
|
|
132
132
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
133
|
-
var tmp1_subject = _this__u8e3s4.
|
|
133
|
+
var tmp1_subject = _this__u8e3s4.g29_1;
|
|
134
134
|
var tmp_0;
|
|
135
135
|
if (tmp1_subject instanceof String_0) {
|
|
136
136
|
tmp_0 = 'string';
|
|
@@ -164,15 +164,15 @@ function emit_1(_this__u8e3s4) {
|
|
|
164
164
|
}
|
|
165
165
|
// Inline function 'kotlin.contracts.contract' call
|
|
166
166
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptTypeDefinitionEmitter.emit.<anonymous>' call
|
|
167
|
-
return tmp + (_this__u8e3s4.
|
|
167
|
+
return tmp + (_this__u8e3s4.jm() ? ' | undefined' : '');
|
|
168
168
|
}
|
|
169
169
|
function emit_2(_this__u8e3s4) {
|
|
170
170
|
var tmp;
|
|
171
171
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
172
|
-
tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
172
|
+
tmp = _RegExp___get_value__impl__7o7618(_this__u8e3s4.g28_1) + '.test(value)';
|
|
173
173
|
} else {
|
|
174
174
|
if (_this__u8e3s4 instanceof Bound) {
|
|
175
|
-
tmp = '' + _this__u8e3s4.
|
|
175
|
+
tmp = '' + _this__u8e3s4.h28_1 + ' < value && value < ' + _this__u8e3s4.i28_1 + ';';
|
|
176
176
|
} else {
|
|
177
177
|
noWhenBranchMatchedException();
|
|
178
178
|
}
|
|
@@ -180,35 +180,35 @@ function emit_2(_this__u8e3s4) {
|
|
|
180
180
|
return tmp;
|
|
181
181
|
}
|
|
182
182
|
function emit_3(_this__u8e3s4) {
|
|
183
|
-
return joinToString(_this__u8e3s4.
|
|
183
|
+
return joinToString(_this__u8e3s4.i24_1, ',\n', VOID, VOID, VOID, VOID, TypeScriptTypeDefinitionEmitter$emit$lambda_0(this));
|
|
184
184
|
}
|
|
185
185
|
function emit_4(_this__u8e3s4) {
|
|
186
|
-
return Spacer_instance.toString() + this.
|
|
186
|
+
return Spacer_instance.toString() + this.i26(_this__u8e3s4.o24_1) + ': ' + this.j25(_this__u8e3s4.p24_1);
|
|
187
187
|
}
|
|
188
188
|
initMetadataForInterface(TypeScriptTypeDefinitionEmitter, 'TypeScriptTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, TypeScriptIdentifierEmitter]);
|
|
189
189
|
function emitClient(ast) {
|
|
190
|
-
var tmp = 'client.' + this.
|
|
191
|
-
var tmp_0 = this.
|
|
190
|
+
var tmp = 'client.' + this.q25().z25_1;
|
|
191
|
+
var tmp_0 = this.m25(ast);
|
|
192
192
|
var tmp_1 = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda);
|
|
193
193
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
194
194
|
// Inline function 'kotlin.collections.flatMap' call
|
|
195
195
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
196
|
-
var this_0 = ast.
|
|
196
|
+
var this_0 = ast.n25_1;
|
|
197
197
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
198
|
-
var tmp_2 = this_0.
|
|
198
|
+
var tmp_2 = this_0.pk_1.p25_1.nk();
|
|
199
199
|
// Inline function 'kotlin.collections.flatMap' call
|
|
200
200
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
201
|
-
var this_1 = this_0.
|
|
201
|
+
var this_1 = this_0.qk_1;
|
|
202
202
|
var destination = ArrayList_init_$Create$();
|
|
203
203
|
var tmp0_iterator = this_1.g();
|
|
204
204
|
while (tmp0_iterator.h()) {
|
|
205
205
|
var element = tmp0_iterator.i();
|
|
206
206
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
207
|
-
var list = element.
|
|
207
|
+
var list = element.p25_1;
|
|
208
208
|
addAll(destination, list);
|
|
209
209
|
}
|
|
210
210
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
211
|
-
var this_2 = tmp_2.
|
|
211
|
+
var this_2 = tmp_2.uk(destination).tk();
|
|
212
212
|
var destination_0 = ArrayList_init_$Create$();
|
|
213
213
|
var tmp0_iterator_0 = this_2.g();
|
|
214
214
|
while (tmp0_iterator_0.h()) {
|
|
@@ -223,96 +223,42 @@ function emitClient(ast) {
|
|
|
223
223
|
while (tmp0_iterator_1.h()) {
|
|
224
224
|
var e = tmp0_iterator_1.i();
|
|
225
225
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClient.<anonymous>' call
|
|
226
|
-
var key = e.
|
|
226
|
+
var key = e.c29_1;
|
|
227
227
|
if (set.e(key)) {
|
|
228
228
|
list_1.e(e);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
var tmp_3 = list_1;
|
|
232
232
|
var tmp_4 = joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClient$lambda_0);
|
|
233
|
-
var tmp_5 = this.
|
|
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
|
|
233
|
+
var tmp_5 = this.m25(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 '));
|
|
235
235
|
}
|
|
236
236
|
initMetadataForInterface(TypeScriptClientEmitter, 'TypeScriptClientEmitter', VOID, VOID, [ClientEmitter, TypeScriptTypeDefinitionEmitter]);
|
|
237
|
-
function emit_5(
|
|
238
|
-
|
|
239
|
-
// Inline function 'kotlin.collections.distinctBy' call
|
|
240
|
-
var this_0 = importReferences(endpoint);
|
|
241
|
-
var set = HashSet_init_$Create$();
|
|
242
|
-
var list = ArrayList_init_$Create$();
|
|
243
|
-
var tmp0_iterator = this_0.g();
|
|
244
|
-
while (tmp0_iterator.h()) {
|
|
245
|
-
var e = tmp0_iterator.i();
|
|
246
|
-
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
247
|
-
var key = e.w28_1;
|
|
248
|
-
if (set.e(key)) {
|
|
249
|
-
list.e(e);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// Inline function 'kotlin.collections.mapTo' call
|
|
253
|
-
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
254
|
-
var tmp0_iterator_0 = list.g();
|
|
255
|
-
while (tmp0_iterator_0.h()) {
|
|
256
|
-
var item = tmp0_iterator_0.i();
|
|
257
|
-
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
258
|
-
var tmp$ret$2 = 'import {' + item.w28_1 + "} from '../model'";
|
|
259
|
-
destination.e(tmp$ret$2);
|
|
260
|
-
}
|
|
261
|
-
var tmp = destination;
|
|
262
|
-
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
263
|
-
var tmp_1 = this.g2b(endpoint.o24_1);
|
|
264
|
-
var tmp_2 = get_pathParams(endpoint);
|
|
265
|
-
var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
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);
|
|
270
|
-
var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
271
|
-
var tmp_9 = Spacer_instance.toString();
|
|
272
|
-
var tmp_10 = distinctByStatus(endpoint.u24_1);
|
|
273
|
-
var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
274
|
-
var tmp_12 = emitFunction_0(first(endpoint.t24_1), this, endpoint);
|
|
275
|
-
var tmp_13 = distinctByStatus(endpoint.u24_1);
|
|
276
|
-
var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
277
|
-
var tmp_15 = Spacer_instance.toString();
|
|
278
|
-
var tmp_16 = Spacer_instance.x26(2);
|
|
279
|
-
var tmp_17 = emitHandleFunction(this, endpoint);
|
|
280
|
-
var tmp_18 = Spacer_instance.toString();
|
|
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));
|
|
283
|
-
var tmp_21 = Spacer_instance.toString();
|
|
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 ');
|
|
289
|
-
}
|
|
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 ');
|
|
237
|
+
function emit_5(refined) {
|
|
238
|
+
return trimMargin('\n |export type ' + this.m2b(refined.m26_1) + ' = string;\n |export const validate' + refined.m26_1.b1() + ' = (value: string): value is ' + this.m2b(refined.m26_1) + ' => \n |' + Spacer_instance.toString() + this.u26(refined) + ';\n |\n ');
|
|
293
239
|
}
|
|
294
240
|
function emitValidator(_this__u8e3s4) {
|
|
295
241
|
var defaultReturn = 'true;';
|
|
296
|
-
var type = _this__u8e3s4.
|
|
242
|
+
var type = _this__u8e3s4.n26_1.g29_1;
|
|
297
243
|
var tmp;
|
|
298
244
|
if (type instanceof Integer) {
|
|
299
|
-
var tmp0_safe_receiver = type.
|
|
300
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.
|
|
245
|
+
var tmp0_safe_receiver = type.m28_1;
|
|
246
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.k25(tmp0_safe_receiver);
|
|
301
247
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
302
248
|
} else {
|
|
303
249
|
if (type instanceof Number_0) {
|
|
304
|
-
var tmp2_safe_receiver = type.
|
|
305
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.
|
|
250
|
+
var tmp2_safe_receiver = type.p28_1;
|
|
251
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.k25(tmp2_safe_receiver);
|
|
306
252
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
307
253
|
} else {
|
|
308
254
|
if (type instanceof String_0) {
|
|
309
|
-
var tmp4_safe_receiver = type.
|
|
255
|
+
var tmp4_safe_receiver = type.j28_1;
|
|
310
256
|
var tmp_0;
|
|
311
257
|
var tmp_1 = tmp4_safe_receiver;
|
|
312
258
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
313
259
|
tmp_0 = null;
|
|
314
260
|
} else {
|
|
315
|
-
tmp_0 = this.
|
|
261
|
+
tmp_0 = this.k25(new RegExp_0(tmp4_safe_receiver));
|
|
316
262
|
}
|
|
317
263
|
var tmp5_elvis_lhs = tmp_0;
|
|
318
264
|
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
@@ -332,23 +278,106 @@ function emitValidator(_this__u8e3s4) {
|
|
|
332
278
|
return tmp;
|
|
333
279
|
}
|
|
334
280
|
initMetadataForInterface(TypeScriptRefinedTypeDefinitionEmitter, 'TypeScriptRefinedTypeDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
281
|
+
function emit_6(endpoint) {
|
|
282
|
+
// Inline function 'kotlin.collections.map' call
|
|
283
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
284
|
+
var this_0 = importReferences(endpoint);
|
|
285
|
+
var set = HashSet_init_$Create$();
|
|
286
|
+
var list = ArrayList_init_$Create$();
|
|
287
|
+
var tmp0_iterator = this_0.g();
|
|
288
|
+
while (tmp0_iterator.h()) {
|
|
289
|
+
var e = tmp0_iterator.i();
|
|
290
|
+
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
291
|
+
var key = e.c29_1;
|
|
292
|
+
if (set.e(key)) {
|
|
293
|
+
list.e(e);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
297
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
298
|
+
var tmp0_iterator_0 = list.g();
|
|
299
|
+
while (tmp0_iterator_0.h()) {
|
|
300
|
+
var item = tmp0_iterator_0.i();
|
|
301
|
+
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
302
|
+
var tmp$ret$2 = 'import {type ' + item.c29_1 + "} from '../model'";
|
|
303
|
+
destination.e(tmp$ret$2);
|
|
304
|
+
}
|
|
305
|
+
var tmp = destination;
|
|
306
|
+
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda);
|
|
307
|
+
var tmp_1 = this.m2b(endpoint.r24_1);
|
|
308
|
+
var tmp_2 = get_pathParams(endpoint);
|
|
309
|
+
var tmp_3 = emitType(tmp_2, this, 'Path', TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
310
|
+
var tmp_4 = emitType(endpoint.u24_1, this, 'Queries', TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
311
|
+
var tmp_5 = emitType(endpoint.v24_1, this, 'Headers', TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
312
|
+
var tmp_6 = emitType_1(first(endpoint.w24_1), this, endpoint);
|
|
313
|
+
var tmp_7 = distinctByStatus(endpoint.x24_1);
|
|
314
|
+
var tmp_8 = joinToString(tmp_7, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
315
|
+
var tmp_9 = Spacer_instance.toString();
|
|
316
|
+
var tmp_10 = distinctByStatus(endpoint.x24_1);
|
|
317
|
+
var tmp_11 = joinToString(tmp_10, ' | ', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
318
|
+
var tmp_12 = emitFunction_0(first(endpoint.w24_1), this, endpoint);
|
|
319
|
+
var tmp_13 = distinctByStatus(endpoint.x24_1);
|
|
320
|
+
var tmp_14 = joinToString(tmp_13, '\n', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
321
|
+
var tmp_15 = Spacer_instance.toString();
|
|
322
|
+
var tmp_16 = Spacer_instance.a27(2);
|
|
323
|
+
var tmp_17 = emitHandleFunction(this, endpoint);
|
|
324
|
+
var tmp_18 = Spacer_instance.toString();
|
|
325
|
+
var tmp_19 = prependIndent(emitClient_0(endpoint, this), Spacer_instance.a27(1));
|
|
326
|
+
var tmp_20 = prependIndent(emitServer(endpoint, this), Spacer_instance.a27(1));
|
|
327
|
+
var tmp_21 = Spacer_instance.toString();
|
|
328
|
+
var tmp_22 = Spacer_instance.a27(2);
|
|
329
|
+
var tmp_23 = Companion_instance_0.b26(this.m2b(endpoint.r24_1));
|
|
330
|
+
var tmp_24 = Spacer_instance.a27(2);
|
|
331
|
+
var tmp_25 = Spacer_instance.a27(2);
|
|
332
|
+
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.s24_1.q2_1 + '",\n |' + tmp_25 + 'path: "' + joinToString(endpoint.t24_1, '/', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emit$lambda_6(this)) + '",\n |' + Spacer_instance.a27(2) + 'server,\n |' + Spacer_instance.a27(2) + 'client\n |' + Spacer_instance.toString() + '} as const\n |}\n |\n ');
|
|
333
|
+
}
|
|
334
|
+
initMetadataForInterface(TypeScriptEndpointDefinitionEmitter, 'TypeScriptEndpointDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
335
335
|
function emit_7(enum_0, module_0) {
|
|
336
|
-
var tmp = this.
|
|
337
|
-
return 'export type ' + tmp + ' = ' + joinToString(enum_0.
|
|
336
|
+
var tmp = this.m2b(enum_0.q26_1);
|
|
337
|
+
return 'export type ' + tmp + ' = ' + joinToString(enum_0.r26_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEnumDefinitionEmitter$emit$lambda) + '\n';
|
|
338
338
|
}
|
|
339
339
|
initMetadataForInterface(TypeScriptEnumDefinitionEmitter, 'TypeScriptEnumDefinitionEmitter', VOID, VOID, [TypeScriptTypeDefinitionEmitter]);
|
|
340
|
-
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter,
|
|
340
|
+
initMetadataForClass(TypeScriptEmitter, 'TypeScriptEmitter', TypeScriptEmitter, LanguageEmitter, [LanguageEmitter, TypeScriptRefinedTypeDefinitionEmitter, TypeScriptTypeDefinitionEmitter, TypeScriptEndpointDefinitionEmitter, TypeScriptClientEmitter, TypeScriptEnumDefinitionEmitter, TypeScriptIdentifierEmitter]);
|
|
341
341
|
initMetadataForObject(TypeScriptShared, 'TypeScriptShared');
|
|
342
342
|
//endregion
|
|
343
343
|
function emitClientInterface(_this__u8e3s4, $this, endpoint) {
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
// Inline function 'kotlin.text.orEmpty' call
|
|
345
|
+
// Inline function 'kotlin.takeIf' call
|
|
346
|
+
var this_0 = paramList(_this__u8e3s4, endpoint);
|
|
347
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
348
|
+
var tmp;
|
|
349
|
+
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClientInterface.<anonymous>' call
|
|
350
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
351
|
+
if (!this_0.l()) {
|
|
352
|
+
tmp = this_0;
|
|
353
|
+
} else {
|
|
354
|
+
tmp = null;
|
|
355
|
+
}
|
|
356
|
+
var tmp0_safe_receiver = tmp;
|
|
357
|
+
var tmp_0;
|
|
358
|
+
if (tmp0_safe_receiver == null) {
|
|
359
|
+
tmp_0 = null;
|
|
360
|
+
} else {
|
|
361
|
+
tmp_0 = joinToString(tmp0_safe_receiver, ', ', VOID, VOID, VOID, VOID, TypeScriptClientEmitter$emitClientInterface$lambda($this));
|
|
362
|
+
}
|
|
363
|
+
var tmp1_safe_receiver = tmp_0;
|
|
364
|
+
var tmp_1;
|
|
365
|
+
if (tmp1_safe_receiver == null) {
|
|
366
|
+
tmp_1 = null;
|
|
367
|
+
} else {
|
|
368
|
+
// Inline function 'kotlin.let' call
|
|
369
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
370
|
+
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitClientInterface.<anonymous>' call
|
|
371
|
+
tmp_1 = 'params: {' + tmp1_safe_receiver + '}';
|
|
372
|
+
}
|
|
373
|
+
var tmp0_elvis_lhs = tmp_1;
|
|
374
|
+
return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
346
375
|
}
|
|
347
376
|
function emitFunction($this, endpoint, request) {
|
|
348
|
-
var tmp = endpoint.
|
|
377
|
+
var tmp = endpoint.r24_1.b1();
|
|
349
378
|
var tmp_0 = emitClientInterface(request, $this, endpoint);
|
|
350
379
|
var tmp_1 = Spacer_instance.toString();
|
|
351
|
-
var tmp_2 = endpoint.
|
|
380
|
+
var tmp_2 = endpoint.r24_1.b1();
|
|
352
381
|
// Inline function 'kotlin.text.orEmpty' call
|
|
353
382
|
// Inline function 'kotlin.takeIf' call
|
|
354
383
|
var this_0 = paramList(request, endpoint);
|
|
@@ -368,18 +397,18 @@ function emitFunction($this, endpoint, request) {
|
|
|
368
397
|
// Inline function 'kotlin.let' call
|
|
369
398
|
// Inline function 'kotlin.contracts.contract' call
|
|
370
399
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptClientEmitter.emitFunction.<anonymous>' call
|
|
371
|
-
tmp_4 = '
|
|
400
|
+
tmp_4 = 'params';
|
|
372
401
|
}
|
|
373
402
|
var tmp0_elvis_lhs = tmp_4;
|
|
374
403
|
var tmp$ret$5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
375
|
-
return trimMargin('\n |' + tmp + ': async (
|
|
404
|
+
return trimMargin('\n |' + tmp + ': async (' + tmp_0 + ') => {\n |' + tmp_1 + 'const req = ' + tmp_2 + '.request(' + tmp$ret$5 + ')\n |' + Spacer_instance.toString() + 'const rawRequest = ' + endpoint.r24_1.b1() + '.client(serialization).to(req)\n |' + Spacer_instance.toString() + 'const rawResponse = await handler(rawRequest)\n |' + Spacer_instance.toString() + 'return ' + endpoint.r24_1.b1() + '.client(serialization).from(rawResponse)\n |},\n ');
|
|
376
405
|
}
|
|
377
406
|
function TypeScriptClientEmitter$emitClient$lambda(_destruct__k2r9zo) {
|
|
378
407
|
var endpoint = _destruct__k2r9zo.sd();
|
|
379
|
-
return 'import {' + endpoint.
|
|
408
|
+
return 'import {' + endpoint.r24_1.b1() + '} from "./endpoint/' + endpoint.r24_1.b1() + '"';
|
|
380
409
|
}
|
|
381
410
|
function TypeScriptClientEmitter$emitClient$lambda_0(it) {
|
|
382
|
-
return 'import {' + it.
|
|
411
|
+
return 'import {type ' + it.c29_1 + '} from "./model/' + it.c29_1 + '"';
|
|
383
412
|
}
|
|
384
413
|
function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
385
414
|
return function (_destruct__k2r9zo) {
|
|
@@ -390,13 +419,13 @@ function TypeScriptClientEmitter$emitClient$lambda_1(this$0) {
|
|
|
390
419
|
}
|
|
391
420
|
function TypeScriptClientEmitter$emitClientInterface$lambda(this$0) {
|
|
392
421
|
return function (it) {
|
|
393
|
-
return it.
|
|
422
|
+
return it.v25_1.b1() + ': ' + this$0.j25(it.w25_1);
|
|
394
423
|
};
|
|
395
424
|
}
|
|
396
425
|
function TypeScriptClientEmitter() {
|
|
397
426
|
}
|
|
398
427
|
function TypeScriptEmitter$emit$lambda(it) {
|
|
399
|
-
return 'export {' + it.
|
|
428
|
+
return 'export {' + it.g26().b1() + "} from './" + it.g26().b1() + "'";
|
|
400
429
|
}
|
|
401
430
|
function TypeScriptEmitter$emit$lambda_0(it) {
|
|
402
431
|
// Inline function 'kotlin.text.trimStart' call
|
|
@@ -404,32 +433,32 @@ function TypeScriptEmitter$emit$lambda_0(it) {
|
|
|
404
433
|
}
|
|
405
434
|
function TypeScriptEmitter$emit$lambda_1(this$0) {
|
|
406
435
|
return function (it) {
|
|
407
|
-
return this$0.
|
|
436
|
+
return this$0.j25(it);
|
|
408
437
|
};
|
|
409
438
|
}
|
|
410
439
|
function TypeScriptEmitter() {
|
|
411
440
|
LanguageEmitter.call(this);
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
this.
|
|
441
|
+
this.n2b_1 = FileExtension_TypeScript_getInstance();
|
|
442
|
+
this.o2b_1 = TypeScriptShared_getInstance();
|
|
443
|
+
this.p2b_1 = '//';
|
|
415
444
|
}
|
|
416
|
-
protoOf(TypeScriptEmitter).
|
|
417
|
-
return this.
|
|
445
|
+
protoOf(TypeScriptEmitter).q25 = function () {
|
|
446
|
+
return this.n2b_1;
|
|
418
447
|
};
|
|
419
|
-
protoOf(TypeScriptEmitter).
|
|
420
|
-
return this.
|
|
448
|
+
protoOf(TypeScriptEmitter).r2a = function () {
|
|
449
|
+
return this.o2b_1;
|
|
421
450
|
};
|
|
422
|
-
protoOf(TypeScriptEmitter).
|
|
423
|
-
return this.
|
|
451
|
+
protoOf(TypeScriptEmitter).r25 = function () {
|
|
452
|
+
return this.p2b_1;
|
|
424
453
|
};
|
|
425
|
-
protoOf(TypeScriptEmitter).
|
|
454
|
+
protoOf(TypeScriptEmitter).g23 = function (ast, logger) {
|
|
426
455
|
// Inline function 'kotlin.run' call
|
|
427
456
|
// Inline function 'kotlin.contracts.contract' call
|
|
428
457
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
429
|
-
var $this$run = protoOf(LanguageEmitter).
|
|
458
|
+
var $this$run = protoOf(LanguageEmitter).g23.call(this, ast, logger);
|
|
430
459
|
var tmp;
|
|
431
460
|
if (hasEndpoints(ast)) {
|
|
432
|
-
tmp = $this$run.
|
|
461
|
+
tmp = $this$run.vk(this.l2b(ast));
|
|
433
462
|
} else {
|
|
434
463
|
tmp = $this$run;
|
|
435
464
|
}
|
|
@@ -437,22 +466,22 @@ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
|
437
466
|
// Inline function 'kotlin.collections.map' call
|
|
438
467
|
// Inline function 'kotlin.collections.groupBy' call
|
|
439
468
|
// Inline function 'arrow.core.NonEmptyList.flatMap' call
|
|
440
|
-
var this_0 = ast.
|
|
469
|
+
var this_0 = ast.n25_1;
|
|
441
470
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
442
|
-
var tmp_1 = this_0.
|
|
471
|
+
var tmp_1 = this_0.pk_1.p25_1.nk();
|
|
443
472
|
// Inline function 'kotlin.collections.flatMap' call
|
|
444
473
|
// Inline function 'kotlin.collections.flatMapTo' call
|
|
445
|
-
var this_1 = this_0.
|
|
474
|
+
var this_1 = this_0.qk_1;
|
|
446
475
|
var destination = ArrayList_init_$Create$();
|
|
447
476
|
var tmp0_iterator = this_1.g();
|
|
448
477
|
while (tmp0_iterator.h()) {
|
|
449
478
|
var element = tmp0_iterator.i();
|
|
450
479
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
451
|
-
var list = element.
|
|
480
|
+
var list = element.p25_1;
|
|
452
481
|
addAll(destination, list);
|
|
453
482
|
}
|
|
454
483
|
// Inline function 'kotlin.collections.groupByTo' call
|
|
455
|
-
var this_2 = tmp_1.
|
|
484
|
+
var this_2 = tmp_1.uk(destination);
|
|
456
485
|
var destination_0 = LinkedHashMap_init_$Create$();
|
|
457
486
|
var tmp0_iterator_0 = this_2.g();
|
|
458
487
|
while (tmp0_iterator_0.h()) {
|
|
@@ -484,27 +513,27 @@ protoOf(TypeScriptEmitter).d23 = function (ast, logger) {
|
|
|
484
513
|
var ns = item.a1();
|
|
485
514
|
// Inline function 'kotlin.collections.component2' call
|
|
486
515
|
var defs = item.b1();
|
|
487
|
-
var tmp_3 = ns + '/index.' + this.
|
|
516
|
+
var tmp_3 = ns + '/index.' + this.q25().z25_1;
|
|
488
517
|
var tmp$ret$15 = new Emitted(tmp_3, joinToString(defs, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda));
|
|
489
518
|
destination_1.e(tmp$ret$15);
|
|
490
519
|
}
|
|
491
|
-
return tmp_0.
|
|
520
|
+
return tmp_0.uk(destination_1);
|
|
492
521
|
};
|
|
493
|
-
protoOf(TypeScriptEmitter).
|
|
522
|
+
protoOf(TypeScriptEmitter).e26 = function (module_0, logger) {
|
|
494
523
|
// Inline function 'kotlin.let' call
|
|
495
524
|
// Inline function 'kotlin.contracts.contract' call
|
|
496
525
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
497
|
-
return protoOf(LanguageEmitter).
|
|
526
|
+
return protoOf(LanguageEmitter).e26.call(this, module_0, logger).vk(new Emitted('Wirespec', this.r2a().r2b_1));
|
|
498
527
|
};
|
|
499
|
-
protoOf(TypeScriptEmitter).
|
|
528
|
+
protoOf(TypeScriptEmitter).f26 = function (definition, module_0, logger) {
|
|
500
529
|
// Inline function 'kotlin.let' call
|
|
501
530
|
// Inline function 'kotlin.contracts.contract' call
|
|
502
531
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
503
|
-
var it = protoOf(LanguageEmitter).
|
|
504
|
-
var subPackageName = plus(Companion_instance.
|
|
505
|
-
return new Emitted(subPackageName.
|
|
532
|
+
var it = protoOf(LanguageEmitter).f26.call(this, definition, module_0, logger);
|
|
533
|
+
var subPackageName = plus(Companion_instance.v26(''), definition);
|
|
534
|
+
return new Emitted(subPackageName.y26() + this.j2b(it.a24_1), trimMargin("\n |import {Wirespec} from '../Wirespec'\n |\n |" + it.b24_1 + '\n '));
|
|
506
535
|
};
|
|
507
|
-
protoOf(TypeScriptEmitter).
|
|
536
|
+
protoOf(TypeScriptEmitter).k26 = function (union) {
|
|
508
537
|
// Inline function 'kotlin.collections.map' call
|
|
509
538
|
// Inline function 'kotlin.collections.distinctBy' call
|
|
510
539
|
var this_0 = importReferences(union);
|
|
@@ -514,7 +543,7 @@ protoOf(TypeScriptEmitter).h26 = function (union) {
|
|
|
514
543
|
while (tmp0_iterator.h()) {
|
|
515
544
|
var e = tmp0_iterator.i();
|
|
516
545
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
517
|
-
var key = e.
|
|
546
|
+
var key = e.c29_1;
|
|
518
547
|
if (set.e(key)) {
|
|
519
548
|
list.e(e);
|
|
520
549
|
}
|
|
@@ -525,24 +554,24 @@ protoOf(TypeScriptEmitter).h26 = function (union) {
|
|
|
525
554
|
while (tmp0_iterator_0.h()) {
|
|
526
555
|
var item = tmp0_iterator_0.i();
|
|
527
556
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEmitter.emit.<anonymous>' call
|
|
528
|
-
var tmp$ret$2 = 'import {' + item.
|
|
557
|
+
var tmp$ret$2 = 'import {type ' + item.c29_1 + "} from '../model'";
|
|
529
558
|
destination.e(tmp$ret$2);
|
|
530
559
|
}
|
|
531
560
|
var tmp = destination;
|
|
532
561
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_0);
|
|
533
|
-
var tmp_1 = this.
|
|
534
|
-
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.
|
|
562
|
+
var tmp_1 = this.m2b(union.g24_1);
|
|
563
|
+
return trimMargin('\n |' + tmp_0 + '\n |export type ' + tmp_1 + ' = ' + joinToString(union.h24_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_1(this)) + '\n |\n ');
|
|
535
564
|
};
|
|
536
|
-
protoOf(TypeScriptEmitter).
|
|
537
|
-
return this.
|
|
565
|
+
protoOf(TypeScriptEmitter).j26 = function (channel) {
|
|
566
|
+
return this.s25();
|
|
538
567
|
};
|
|
539
568
|
function emit_8(_this__u8e3s4, $this) {
|
|
540
569
|
var tmp;
|
|
541
570
|
if (_this__u8e3s4 instanceof Literal) {
|
|
542
|
-
tmp = _this__u8e3s4.
|
|
571
|
+
tmp = _this__u8e3s4.t25_1;
|
|
543
572
|
} else {
|
|
544
573
|
if (_this__u8e3s4 instanceof Param) {
|
|
545
|
-
tmp = ':' + _this__u8e3s4.
|
|
574
|
+
tmp = ':' + _this__u8e3s4.y24_1.b1();
|
|
546
575
|
} else {
|
|
547
576
|
noWhenBranchMatchedException();
|
|
548
577
|
}
|
|
@@ -550,54 +579,54 @@ function emit_8(_this__u8e3s4, $this) {
|
|
|
550
579
|
return tmp;
|
|
551
580
|
}
|
|
552
581
|
function emitClient_0(_this__u8e3s4, $this) {
|
|
553
|
-
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.
|
|
582
|
+
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.a27(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.a27(1)) + '\n |})\n ');
|
|
554
583
|
}
|
|
555
584
|
function emitClientTo(_this__u8e3s4, $this) {
|
|
556
|
-
var tmp = Spacer_instance.
|
|
585
|
+
var tmp = Spacer_instance.a27(1);
|
|
557
586
|
// Inline function 'kotlin.text.uppercase' call
|
|
558
587
|
// Inline function 'kotlin.js.asDynamic' call
|
|
559
|
-
var tmp_0 = _this__u8e3s4.
|
|
560
|
-
var tmp_1 = Spacer_instance.
|
|
588
|
+
var tmp_0 = _this__u8e3s4.s24_1.q2_1.toUpperCase();
|
|
589
|
+
var tmp_1 = Spacer_instance.a27(1);
|
|
561
590
|
var tmp_2 = emitPathArray(_this__u8e3s4, $this);
|
|
562
|
-
var tmp_3 = Spacer_instance.
|
|
563
|
-
var tmp_4 = joinToString(_this__u8e3s4.
|
|
564
|
-
var tmp_5 = Spacer_instance.
|
|
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.
|
|
591
|
+
var tmp_3 = Spacer_instance.a27(1);
|
|
592
|
+
var tmp_4 = joinToString(_this__u8e3s4.u24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda($this));
|
|
593
|
+
var tmp_5 = Spacer_instance.a27(1);
|
|
594
|
+
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.v24_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientTo$lambda_0($this)) + '},\n |' + Spacer_instance.a27(1) + 'body: serialization.serialize(it.body)\n |})\n ');
|
|
566
595
|
}
|
|
567
596
|
function emitClientFrom(_this__u8e3s4, $this) {
|
|
568
|
-
var tmp = Spacer_instance.
|
|
569
|
-
var tmp_0 = distinctByStatus(_this__u8e3s4.
|
|
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.
|
|
597
|
+
var tmp = Spacer_instance.a27(1);
|
|
598
|
+
var tmp_0 = distinctByStatus(_this__u8e3s4.x24_1);
|
|
599
|
+
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.a27(2)) + '\n |' + Spacer_instance.a27(2) + 'default:\n |' + Spacer_instance.a27(3) + 'throw new Error(`Cannot internalize response with status: ${it.status}`);\n |' + Spacer_instance.a27(1) + '}\n |}\n ');
|
|
571
600
|
}
|
|
572
601
|
function emitClientFromResponse(_this__u8e3s4, $this) {
|
|
573
|
-
var tmp = fixStatus(_this__u8e3s4.
|
|
574
|
-
var tmp_0 = Spacer_instance.
|
|
575
|
-
var tmp_1 = Spacer_instance.
|
|
576
|
-
var tmp_2 = fixStatus(_this__u8e3s4.
|
|
577
|
-
var tmp_3 = Spacer_instance.
|
|
578
|
-
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
602
|
+
var tmp = fixStatus(_this__u8e3s4.d25_1);
|
|
603
|
+
var tmp_0 = Spacer_instance.a27(1);
|
|
604
|
+
var tmp_1 = Spacer_instance.a27(2);
|
|
605
|
+
var tmp_2 = fixStatus(_this__u8e3s4.d25_1);
|
|
606
|
+
var tmp_3 = Spacer_instance.a27(2);
|
|
607
|
+
return trimMargin('\n |case ' + tmp + ':\n |' + tmp_0 + 'return {\n |' + tmp_1 + 'status: ' + tmp_2 + ',\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitClientFromResponse$lambda($this)) + '},\n |' + Spacer_instance.a27(2) + 'body: serialization.deserialize<' + emitReference(_this__u8e3s4, $this) + '>(it.body)\n |' + Spacer_instance.a27(1) + '};\n ');
|
|
579
608
|
}
|
|
580
609
|
function emitServer(_this__u8e3s4, $this) {
|
|
581
|
-
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.
|
|
610
|
+
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.a27(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.a27(1)) + '\n |})\n ');
|
|
582
611
|
}
|
|
583
612
|
function emitServerFrom(_this__u8e3s4, $this) {
|
|
584
|
-
var tmp = Spacer_instance.
|
|
585
|
-
var tmp_0 = Spacer_instance.
|
|
613
|
+
var tmp = Spacer_instance.a27(1);
|
|
614
|
+
var tmp_0 = Spacer_instance.a27(2);
|
|
586
615
|
// Inline function 'kotlin.text.uppercase' call
|
|
587
616
|
// Inline function 'kotlin.js.asDynamic' call
|
|
588
|
-
var tmp_1 = _this__u8e3s4.
|
|
589
|
-
var tmp_2 = Spacer_instance.
|
|
617
|
+
var tmp_1 = _this__u8e3s4.s24_1.q2_1.toUpperCase();
|
|
618
|
+
var tmp_2 = Spacer_instance.a27(2);
|
|
590
619
|
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.
|
|
592
|
-
var tmp_5 = Spacer_instance.
|
|
593
|
-
var tmp_6 = Spacer_instance.
|
|
594
|
-
var tmp_7 = joinToString(_this__u8e3s4.
|
|
595
|
-
var tmp_8 = Spacer_instance.
|
|
596
|
-
var tmp_9 = Spacer_instance.
|
|
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.
|
|
620
|
+
var tmp_4 = prependIndent(joinToString(tmp_3, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda($this)), Spacer_instance.a27(3));
|
|
621
|
+
var tmp_5 = Spacer_instance.a27(2);
|
|
622
|
+
var tmp_6 = Spacer_instance.a27(2);
|
|
623
|
+
var tmp_7 = joinToString(_this__u8e3s4.u24_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0($this));
|
|
624
|
+
var tmp_8 = Spacer_instance.a27(2);
|
|
625
|
+
var tmp_9 = Spacer_instance.a27(2);
|
|
626
|
+
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.v24_1, ',', VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1($this)) + '\n |' + Spacer_instance.a27(2) + '},\n |' + Spacer_instance.a27(2) + 'body: serialization.deserialize(it.body)\n |' + Spacer_instance.a27(1) + '}\n |}\n ');
|
|
598
627
|
}
|
|
599
628
|
function emitServerTo($this) {
|
|
600
|
-
return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.
|
|
629
|
+
return trimMargin('\n |to: (it) => ({\n |' + Spacer_instance.a27(1) + 'status: it.status,\n |' + Spacer_instance.a27(1) + 'headers: {},\n |' + Spacer_instance.a27(1) + 'body: serialization.serialize(it.body),\n |})\n ');
|
|
601
630
|
}
|
|
602
631
|
function emitType(_this__u8e3s4, $this, name, block) {
|
|
603
632
|
var tmp;
|
|
@@ -610,7 +639,7 @@ function emitType(_this__u8e3s4, $this, name, block) {
|
|
|
610
639
|
return tmp;
|
|
611
640
|
}
|
|
612
641
|
function emitName(_this__u8e3s4, $this) {
|
|
613
|
-
return 'Response' + Companion_instance_0.
|
|
642
|
+
return 'Response' + Companion_instance_0.a26(_this__u8e3s4.d25_1);
|
|
614
643
|
}
|
|
615
644
|
function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
616
645
|
var tmp = Spacer_instance.toString();
|
|
@@ -640,18 +669,18 @@ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
|
640
669
|
}
|
|
641
670
|
var tmp0_elvis_lhs = tmp_4;
|
|
642
671
|
var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
643
|
-
var tmp_6 = Spacer_instance.
|
|
672
|
+
var tmp_6 = Spacer_instance.a27(2);
|
|
644
673
|
var tmp_7 = get_pathParams(endpoint);
|
|
645
674
|
var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0($this));
|
|
646
|
-
var tmp_9 = Spacer_instance.
|
|
647
|
-
var tmp_10 = endpoint.
|
|
648
|
-
var tmp_11 = Spacer_instance.
|
|
649
|
-
var tmp_12 = joinToObject(endpoint.
|
|
650
|
-
var tmp_13 = Spacer_instance.
|
|
651
|
-
var tmp_14 = joinToObject(endpoint.
|
|
652
|
-
var tmp_15 = Spacer_instance.
|
|
675
|
+
var tmp_9 = Spacer_instance.a27(2);
|
|
676
|
+
var tmp_10 = endpoint.s24_1.toString();
|
|
677
|
+
var tmp_11 = Spacer_instance.a27(2);
|
|
678
|
+
var tmp_12 = joinToObject(endpoint.u24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1($this));
|
|
679
|
+
var tmp_13 = Spacer_instance.a27(2);
|
|
680
|
+
var tmp_14 = joinToObject(endpoint.v24_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2($this));
|
|
681
|
+
var tmp_15 = Spacer_instance.a27(2);
|
|
653
682
|
var tmp_16;
|
|
654
|
-
if (_this__u8e3s4.
|
|
683
|
+
if (_this__u8e3s4.a25_1 == null) {
|
|
655
684
|
tmp_16 = null;
|
|
656
685
|
} else {
|
|
657
686
|
// Inline function 'kotlin.let' call
|
|
@@ -664,11 +693,11 @@ function emitFunction_0(_this__u8e3s4, $this, endpoint) {
|
|
|
664
693
|
}
|
|
665
694
|
function emitFunction_1(_this__u8e3s4, $this) {
|
|
666
695
|
var tmp = Spacer_instance.toString();
|
|
667
|
-
var tmp_0 = Companion_instance_0.
|
|
696
|
+
var tmp_0 = Companion_instance_0.a26(_this__u8e3s4.d25_1);
|
|
668
697
|
var tmp_1 = paramList_0(_this__u8e3s4);
|
|
669
698
|
var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3($this));
|
|
670
699
|
var tmp_3 = Spacer_instance.toString();
|
|
671
|
-
var tmp_4 = Companion_instance_0.
|
|
700
|
+
var tmp_4 = Companion_instance_0.a26(_this__u8e3s4.d25_1);
|
|
672
701
|
// Inline function 'kotlin.text.orEmpty' call
|
|
673
702
|
// Inline function 'kotlin.takeIf' call
|
|
674
703
|
var this_0 = paramList_0(_this__u8e3s4);
|
|
@@ -688,18 +717,18 @@ function emitFunction_1(_this__u8e3s4, $this) {
|
|
|
688
717
|
// Inline function 'kotlin.run' call
|
|
689
718
|
// Inline function 'kotlin.contracts.contract' call
|
|
690
719
|
// Inline function 'community.flock.wirespec.emitters.typescript.TypeScriptEndpointDefinitionEmitter.emitFunction.<anonymous>' call
|
|
691
|
-
tmp_6 = 'params: Response' + Companion_instance_0.
|
|
720
|
+
tmp_6 = 'params: Response' + Companion_instance_0.a26(_this__u8e3s4.d25_1) + 'Params';
|
|
692
721
|
}
|
|
693
722
|
var tmp0_elvis_lhs = tmp_6;
|
|
694
723
|
var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
695
|
-
var tmp_8 = Companion_instance_0.
|
|
696
|
-
var tmp_9 = Spacer_instance.
|
|
697
|
-
var tmp_10 = fixStatus(_this__u8e3s4.
|
|
698
|
-
var tmp_11 = Spacer_instance.
|
|
699
|
-
var tmp_12 = joinToObject(_this__u8e3s4.
|
|
700
|
-
var tmp_13 = Spacer_instance.
|
|
724
|
+
var tmp_8 = Companion_instance_0.a26(_this__u8e3s4.d25_1);
|
|
725
|
+
var tmp_9 = Spacer_instance.a27(2);
|
|
726
|
+
var tmp_10 = fixStatus(_this__u8e3s4.d25_1);
|
|
727
|
+
var tmp_11 = Spacer_instance.a27(2);
|
|
728
|
+
var tmp_12 = joinToObject(_this__u8e3s4.e25_1, $this, TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4($this));
|
|
729
|
+
var tmp_13 = Spacer_instance.a27(2);
|
|
701
730
|
var tmp_14;
|
|
702
|
-
if (_this__u8e3s4.
|
|
731
|
+
if (_this__u8e3s4.f25_1 == null) {
|
|
703
732
|
tmp_14 = null;
|
|
704
733
|
} else {
|
|
705
734
|
// Inline function 'kotlin.let' call
|
|
@@ -711,51 +740,51 @@ function emitFunction_1(_this__u8e3s4, $this) {
|
|
|
711
740
|
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 ');
|
|
712
741
|
}
|
|
713
742
|
function emitReference(_this__u8e3s4, $this) {
|
|
714
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
715
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
716
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
743
|
+
var tmp0_safe_receiver = _this__u8e3s4.f25_1;
|
|
744
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c25_1;
|
|
745
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.j25(tmp1_safe_receiver);
|
|
717
746
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
718
747
|
}
|
|
719
748
|
function emitPathArray(_this__u8e3s4, $this) {
|
|
720
|
-
return joinToString(_this__u8e3s4.
|
|
749
|
+
return joinToString(_this__u8e3s4.t24_1, ', ', '[', ']', VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda($this));
|
|
721
750
|
}
|
|
722
751
|
function emitType_0(_this__u8e3s4, $this) {
|
|
723
752
|
var tmp = Spacer_instance.toString();
|
|
724
753
|
var tmp_0 = emitName(_this__u8e3s4, $this);
|
|
725
|
-
var tmp_1 = Spacer_instance.
|
|
726
|
-
var tmp_2 = fixStatus(_this__u8e3s4.
|
|
727
|
-
var tmp_3 = Spacer_instance.
|
|
728
|
-
return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.
|
|
754
|
+
var tmp_1 = Spacer_instance.a27(2);
|
|
755
|
+
var tmp_2 = fixStatus(_this__u8e3s4.d25_1);
|
|
756
|
+
var tmp_3 = Spacer_instance.a27(2);
|
|
757
|
+
return trimIndent('\n |' + tmp + 'export type ' + tmp_0 + ' = {\n |' + tmp_1 + 'status: ' + tmp_2 + '\n |' + tmp_3 + 'headers: {' + joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, TypeScriptEndpointDefinitionEmitter$emitType$lambda_0($this)) + '}\n |' + Spacer_instance.a27(2) + 'body: ' + emitReference(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
729
758
|
}
|
|
730
759
|
function emitReference_0(_this__u8e3s4, $this) {
|
|
731
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
732
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
733
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
760
|
+
var tmp0_safe_receiver = _this__u8e3s4.a25_1;
|
|
761
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c25_1;
|
|
762
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.j25(tmp1_safe_receiver);
|
|
734
763
|
return tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs;
|
|
735
764
|
}
|
|
736
765
|
function emitType_1(_this__u8e3s4, $this, endpoint) {
|
|
737
|
-
return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.
|
|
766
|
+
return trimIndent('\n |' + Spacer_instance.toString() + 'export type Request = {\n |' + Spacer_instance.a27(2) + 'path: Path\n |' + Spacer_instance.a27(2) + 'method: "' + endpoint.s24_1.toString() + '"\n |' + Spacer_instance.a27(2) + 'queries: Queries\n |' + Spacer_instance.a27(2) + 'headers: Headers\n |' + Spacer_instance.a27(2) + 'body: ' + emitReference_0(_this__u8e3s4, $this) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
738
767
|
}
|
|
739
768
|
function emit_9(_this__u8e3s4, $this) {
|
|
740
|
-
return Spacer_instance.toString() + $this.
|
|
769
|
+
return Spacer_instance.toString() + $this.i26(_this__u8e3s4.y24_1) + ': ' + $this.j25(_this__u8e3s4.z24_1);
|
|
741
770
|
}
|
|
742
771
|
function emit_10(_this__u8e3s4, $this) {
|
|
743
|
-
return $this.
|
|
772
|
+
return $this.i26(_this__u8e3s4.v25_1) + (_this__u8e3s4.w25_1.jm() ? '?' : '') + ': ' + $this.j25(_this__u8e3s4.w25_1.w28(false));
|
|
744
773
|
}
|
|
745
774
|
function emitDeserialize(_this__u8e3s4, $this) {
|
|
746
|
-
return $this.
|
|
775
|
+
return $this.i26(_this__u8e3s4.rd_1.y24_1) + ': serialization.deserialize(it.path[' + _this__u8e3s4.qd_1 + '])';
|
|
747
776
|
}
|
|
748
777
|
function emitDeserialize_0(_this__u8e3s4, $this, fields) {
|
|
749
|
-
return $this.
|
|
778
|
+
return $this.i26(_this__u8e3s4.o24_1) + ': serialization.deserialize(it.' + fields + '[' + $this.i26(_this__u8e3s4.o24_1) + '])';
|
|
750
779
|
}
|
|
751
780
|
function emitSerialize(_this__u8e3s4, $this, fields) {
|
|
752
|
-
return $this.
|
|
781
|
+
return $this.i26(_this__u8e3s4.o24_1) + ': serialization.serialize(it.' + fields + '[' + $this.i26(_this__u8e3s4.o24_1) + '])';
|
|
753
782
|
}
|
|
754
783
|
function joinToObject(_this__u8e3s4, $this, transform) {
|
|
755
784
|
return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
|
|
756
785
|
}
|
|
757
786
|
function emitHandleFunction($this, endpoint) {
|
|
758
|
-
return Companion_instance_0.
|
|
787
|
+
return Companion_instance_0.b26($this.m2b(endpoint.r24_1)) + ': (request:Request) => Promise<Response>';
|
|
759
788
|
}
|
|
760
789
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda(it) {
|
|
761
790
|
// Inline function 'kotlin.text.trimStart' call
|
|
@@ -768,12 +797,12 @@ function TypeScriptEndpointDefinitionEmitter$emit$lambda_0(this$0) {
|
|
|
768
797
|
}
|
|
769
798
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
770
799
|
return function (it) {
|
|
771
|
-
return this$0.
|
|
800
|
+
return this$0.i25(it);
|
|
772
801
|
};
|
|
773
802
|
}
|
|
774
803
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
775
804
|
return function (it) {
|
|
776
|
-
return this$0.
|
|
805
|
+
return this$0.i25(it);
|
|
777
806
|
};
|
|
778
807
|
}
|
|
779
808
|
function TypeScriptEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
@@ -823,17 +852,17 @@ function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda(this$0) {
|
|
|
823
852
|
}
|
|
824
853
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_0(this$0) {
|
|
825
854
|
return function (it) {
|
|
826
|
-
return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.
|
|
855
|
+
return prependIndent(emitDeserialize_0(it, this$0, 'queries'), Spacer_instance.a27(3));
|
|
827
856
|
};
|
|
828
857
|
}
|
|
829
858
|
function TypeScriptEndpointDefinitionEmitter$emitServerFrom$lambda_1(this$0) {
|
|
830
859
|
return function (it) {
|
|
831
|
-
return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.
|
|
860
|
+
return prependIndent(emitDeserialize_0(it, this$0, 'headers'), Spacer_instance.a27(3));
|
|
832
861
|
};
|
|
833
862
|
}
|
|
834
863
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda($block) {
|
|
835
864
|
return function (it) {
|
|
836
|
-
return Spacer_instance.
|
|
865
|
+
return Spacer_instance.a27(1) + $block(it);
|
|
837
866
|
};
|
|
838
867
|
}
|
|
839
868
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
@@ -843,17 +872,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda(this$0) {
|
|
|
843
872
|
}
|
|
844
873
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_0(this$0) {
|
|
845
874
|
return function (it) {
|
|
846
|
-
return this$0.
|
|
875
|
+
return this$0.i26(it.y24_1) + ': params[' + this$0.i26(it.y24_1) + ']';
|
|
847
876
|
};
|
|
848
877
|
}
|
|
849
878
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_1(this$0) {
|
|
850
879
|
return function (it) {
|
|
851
|
-
return this$0.
|
|
880
|
+
return this$0.i26(it.o24_1) + ': params[' + this$0.i26(it.o24_1) + ']';
|
|
852
881
|
};
|
|
853
882
|
}
|
|
854
883
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_2(this$0) {
|
|
855
884
|
return function (it) {
|
|
856
|
-
return this$0.
|
|
885
|
+
return this$0.i26(it.o24_1) + ': params[' + this$0.i26(it.o24_1) + ']';
|
|
857
886
|
};
|
|
858
887
|
}
|
|
859
888
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
@@ -863,17 +892,17 @@ function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_3(this$0) {
|
|
|
863
892
|
}
|
|
864
893
|
function TypeScriptEndpointDefinitionEmitter$emitFunction$lambda_4(this$0) {
|
|
865
894
|
return function (it) {
|
|
866
|
-
return this$0.
|
|
895
|
+
return this$0.i26(it.o24_1) + ': params[' + this$0.i26(it.o24_1) + ']';
|
|
867
896
|
};
|
|
868
897
|
}
|
|
869
898
|
function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
870
899
|
return function (it) {
|
|
871
900
|
var tmp;
|
|
872
901
|
if (it instanceof Literal) {
|
|
873
|
-
tmp = '"' + it.
|
|
902
|
+
tmp = '"' + it.t25_1 + '"';
|
|
874
903
|
} else {
|
|
875
904
|
if (it instanceof Param) {
|
|
876
|
-
tmp = 'serialization.serialize(it.path[' + this$0.
|
|
905
|
+
tmp = 'serialization.serialize(it.path[' + this$0.i26(it.y24_1) + '])';
|
|
877
906
|
} else {
|
|
878
907
|
noWhenBranchMatchedException();
|
|
879
908
|
}
|
|
@@ -883,7 +912,7 @@ function TypeScriptEndpointDefinitionEmitter$emitPathArray$lambda(this$0) {
|
|
|
883
912
|
}
|
|
884
913
|
function TypeScriptEndpointDefinitionEmitter$emitType$lambda_0(this$0) {
|
|
885
914
|
return function (it) {
|
|
886
|
-
return this$0.
|
|
915
|
+
return this$0.i26(it.o24_1) + ': ' + this$0.j25(it.p24_1);
|
|
887
916
|
};
|
|
888
917
|
}
|
|
889
918
|
function TypeScriptEndpointDefinitionEmitter() {
|
|
@@ -899,8 +928,8 @@ function TypeScriptRefinedTypeDefinitionEmitter() {
|
|
|
899
928
|
}
|
|
900
929
|
function TypeScriptShared() {
|
|
901
930
|
TypeScriptShared_instance = this;
|
|
902
|
-
this.
|
|
903
|
-
this.
|
|
931
|
+
this.q2b_1 = 'community.flock.wirespec';
|
|
932
|
+
this.r2b_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 ');
|
|
904
933
|
}
|
|
905
934
|
protoOf(TypeScriptShared).toString = function () {
|
|
906
935
|
return 'TypeScriptShared';
|
|
@@ -931,26 +960,26 @@ function TypeScriptTypeDefinitionEmitter$emit$lambda(it) {
|
|
|
931
960
|
}
|
|
932
961
|
function TypeScriptTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
933
962
|
return function (it) {
|
|
934
|
-
return this$0.
|
|
963
|
+
return this$0.i25(it);
|
|
935
964
|
};
|
|
936
965
|
}
|
|
937
966
|
function TypeScriptTypeDefinitionEmitter() {
|
|
938
967
|
}
|
|
939
968
|
//region block: post-declaration
|
|
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).
|
|
950
|
-
protoOf(TypeScriptEmitter).
|
|
951
|
-
protoOf(TypeScriptEmitter).
|
|
952
|
-
protoOf(TypeScriptEmitter).
|
|
953
|
-
protoOf(TypeScriptEmitter).
|
|
969
|
+
protoOf(TypeScriptEmitter).s26 = emit_7;
|
|
970
|
+
protoOf(TypeScriptEmitter).g25 = emit_0;
|
|
971
|
+
protoOf(TypeScriptEmitter).j25 = emit_1;
|
|
972
|
+
protoOf(TypeScriptEmitter).k25 = emit_2;
|
|
973
|
+
protoOf(TypeScriptEmitter).h25 = emit_3;
|
|
974
|
+
protoOf(TypeScriptEmitter).i25 = emit_4;
|
|
975
|
+
protoOf(TypeScriptEmitter).i26 = emit;
|
|
976
|
+
protoOf(TypeScriptEmitter).t26 = emit_6;
|
|
977
|
+
protoOf(TypeScriptEmitter).o26 = emit_5;
|
|
978
|
+
protoOf(TypeScriptEmitter).u26 = emitValidator;
|
|
979
|
+
protoOf(TypeScriptEmitter).m2b = sanitizeSymbol;
|
|
980
|
+
protoOf(TypeScriptEmitter).j2b = sanitizeSymbol_0;
|
|
981
|
+
protoOf(TypeScriptEmitter).l2b = emitClient;
|
|
982
|
+
protoOf(TypeScriptEmitter).m25 = emitClientEndpointRequest;
|
|
954
983
|
//endregion
|
|
955
984
|
//region block: exports
|
|
956
985
|
export {
|