@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
|
@@ -82,12 +82,12 @@ import {
|
|
|
82
82
|
//endregion
|
|
83
83
|
//region block: pre-declaration
|
|
84
84
|
function emit_0(type, module_0) {
|
|
85
|
-
var tmp = this.
|
|
86
|
-
var tmp_0 = this.
|
|
85
|
+
var tmp = this.i26(type.k24_1);
|
|
86
|
+
var tmp_0 = this.h25(type.l24_1);
|
|
87
87
|
// Inline function 'kotlin.run' call
|
|
88
88
|
// Inline function 'kotlin.contracts.contract' call
|
|
89
89
|
// Inline function 'community.flock.wirespec.emitters.java.JavaTypeDefinitionEmitter.emit.<anonymous>' call
|
|
90
|
-
var $this$run = type.
|
|
90
|
+
var $this$run = type.m24_1;
|
|
91
91
|
var tmp_1;
|
|
92
92
|
if ($this$run.l()) {
|
|
93
93
|
tmp_1 = '';
|
|
@@ -98,25 +98,25 @@ function emit_0(type, module_0) {
|
|
|
98
98
|
return trimMargin('\n |public record ' + tmp + ' (\n |' + tmp_0 + '\n |)' + tmp$ret$1 + ' {\n |};\n |\n ');
|
|
99
99
|
}
|
|
100
100
|
function emit_1(_this__u8e3s4) {
|
|
101
|
-
return dropLast(joinToString(_this__u8e3s4.
|
|
101
|
+
return dropLast(joinToString(_this__u8e3s4.i24_1, '\n', VOID, VOID, VOID, VOID, JavaTypeDefinitionEmitter$emit$lambda_0(this)), 1);
|
|
102
102
|
}
|
|
103
103
|
function emit_2(_this__u8e3s4) {
|
|
104
|
-
return this.
|
|
104
|
+
return this.j25(_this__u8e3s4.p24_1) + ' ' + this.i26(_this__u8e3s4.o24_1);
|
|
105
105
|
}
|
|
106
106
|
function emit_3(_this__u8e3s4) {
|
|
107
107
|
// Inline function 'kotlin.let' call
|
|
108
108
|
// Inline function 'kotlin.contracts.contract' call
|
|
109
109
|
// Inline function 'community.flock.wirespec.emitters.java.JavaTypeDefinitionEmitter.emit.<anonymous>' call
|
|
110
110
|
var it = emitType(_this__u8e3s4, this);
|
|
111
|
-
return _this__u8e3s4.
|
|
111
|
+
return _this__u8e3s4.jm() ? 'java.util.Optional<' + it + '>' : it;
|
|
112
112
|
}
|
|
113
113
|
function emitRoot(_this__u8e3s4, void_0) {
|
|
114
114
|
var tmp;
|
|
115
115
|
if (_this__u8e3s4 instanceof Dict) {
|
|
116
|
-
tmp = this.
|
|
116
|
+
tmp = this.z2a(_this__u8e3s4.u23_1);
|
|
117
117
|
} else {
|
|
118
118
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
119
|
-
tmp = this.
|
|
119
|
+
tmp = this.z2a(_this__u8e3s4.r23_1);
|
|
120
120
|
} else {
|
|
121
121
|
if (_this__u8e3s4 instanceof Unit) {
|
|
122
122
|
tmp = void_0;
|
|
@@ -145,15 +145,15 @@ function emitRoot(_this__u8e3s4, void_0) {
|
|
|
145
145
|
}
|
|
146
146
|
function emitRoot$default(_this__u8e3s4, void_0, $super) {
|
|
147
147
|
void_0 = void_0 === VOID ? 'void' : void_0;
|
|
148
|
-
return $super === VOID ? this.
|
|
148
|
+
return $super === VOID ? this.a2b(_this__u8e3s4, void_0) : emitRoot(_this__u8e3s4, void_0);
|
|
149
149
|
}
|
|
150
150
|
function emit_4(_this__u8e3s4) {
|
|
151
151
|
var tmp;
|
|
152
152
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
153
|
-
tmp = 'java.util.regex.Pattern.compile("' + replace(this.
|
|
153
|
+
tmp = 'java.util.regex.Pattern.compile("' + replace(this.l25(_this__u8e3s4.g28_1), '\\', '\\\\') + '").matcher(record.value).find();';
|
|
154
154
|
} else {
|
|
155
155
|
if (_this__u8e3s4 instanceof Bound) {
|
|
156
|
-
tmp = '' + _this__u8e3s4.
|
|
156
|
+
tmp = '' + _this__u8e3s4.h28_1 + ' < record.value && record.value < ' + _this__u8e3s4.i28_1 + ';';
|
|
157
157
|
} else {
|
|
158
158
|
noWhenBranchMatchedException();
|
|
159
159
|
}
|
|
@@ -162,34 +162,34 @@ function emit_4(_this__u8e3s4) {
|
|
|
162
162
|
}
|
|
163
163
|
initMetadataForInterface(JavaTypeDefinitionEmitter, 'JavaTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter]);
|
|
164
164
|
function emit_5(channel) {
|
|
165
|
-
return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |public interface ' + this.
|
|
165
|
+
return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |@FunctionalInterface\n |public interface ' + this.i26(channel.d24_1) + ' {\n | void invoke(' + emitFullyQualified(channel, this, channel.e24_1) + this.z2a(channel.e24_1) + ' message);\n |}\n |\n ');
|
|
166
166
|
}
|
|
167
167
|
initMetadataForInterface(JavaChannelDefinitionEmitter, 'JavaChannelDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
168
168
|
function emit_6(refined) {
|
|
169
|
-
return trimMargin('\n |public record ' + this.
|
|
169
|
+
return trimMargin('\n |public record ' + this.i26(refined.m26_1) + ' (String value) implements Wirespec.Refined {\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String toString() { return value; }\n |' + Spacer_instance.toString() + 'public static boolean validate(' + this.i26(refined.m26_1) + ' record) {\n |' + Spacer_instance.toString() + Spacer_instance.toString() + 'return ' + this.u26(refined) + '\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String getValue() { return value; }\n |}\n |\n ');
|
|
170
170
|
}
|
|
171
171
|
function emitValidator(_this__u8e3s4) {
|
|
172
172
|
var defaultReturn = 'true;';
|
|
173
|
-
var type = _this__u8e3s4.
|
|
173
|
+
var type = _this__u8e3s4.n26_1.g29_1;
|
|
174
174
|
var tmp;
|
|
175
175
|
if (type instanceof Integer) {
|
|
176
|
-
var tmp0_safe_receiver = type.
|
|
177
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.
|
|
176
|
+
var tmp0_safe_receiver = type.m28_1;
|
|
177
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.k25(tmp0_safe_receiver);
|
|
178
178
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
179
179
|
} else {
|
|
180
180
|
if (type instanceof Number_0) {
|
|
181
|
-
var tmp2_safe_receiver = type.
|
|
182
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.
|
|
181
|
+
var tmp2_safe_receiver = type.p28_1;
|
|
182
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.k25(tmp2_safe_receiver);
|
|
183
183
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
184
184
|
} else {
|
|
185
185
|
if (type instanceof String_0) {
|
|
186
|
-
var tmp4_safe_receiver = type.
|
|
186
|
+
var tmp4_safe_receiver = type.j28_1;
|
|
187
187
|
var tmp_0;
|
|
188
188
|
var tmp_1 = tmp4_safe_receiver;
|
|
189
189
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
190
190
|
tmp_0 = null;
|
|
191
191
|
} else {
|
|
192
|
-
tmp_0 = this.
|
|
192
|
+
tmp_0 = this.k25(new RegExp_0(tmp4_safe_receiver));
|
|
193
193
|
}
|
|
194
194
|
var tmp5_elvis_lhs = tmp_0;
|
|
195
195
|
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
@@ -209,96 +209,13 @@ function emitValidator(_this__u8e3s4) {
|
|
|
209
209
|
return tmp;
|
|
210
210
|
}
|
|
211
211
|
initMetadataForInterface(JavaRefinedTypeDefinitionEmitter, 'JavaRefinedTypeDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
212
|
-
function emit_7(
|
|
213
|
-
var tmp = emitImports_0(endpoint, this);
|
|
214
|
-
var tmp_0 = this.f26(endpoint.o24_1);
|
|
215
|
-
var tmp_1 = get_pathParams(endpoint);
|
|
216
|
-
var tmp_2 = emitObject(tmp_1, this, 'Path', 'Wirespec.Path', JavaEndpointDefinitionEmitter$emit$lambda(this));
|
|
217
|
-
var tmp_3 = emitObject(endpoint.r24_1, this, 'Queries', 'Wirespec.Queries', JavaEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
218
|
-
var tmp_4 = emitObject(endpoint.s24_1, this, 'RequestHeaders', 'Wirespec.Request.Headers', JavaEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
219
|
-
var tmp_5 = this.o2a(first_0(endpoint.t24_1), endpoint);
|
|
220
|
-
var tmp_6 = Spacer_instance.toString();
|
|
221
|
-
var tmp_7 = emitStatusInterfaces(endpoint, this);
|
|
222
|
-
var tmp_8 = emitResponseInterfaces(endpoint, this);
|
|
223
|
-
var tmp_9 = distinctByStatus(endpoint.u24_1);
|
|
224
|
-
var tmp_10 = joinToString(tmp_9, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
225
|
-
var tmp_11 = Spacer_instance.toString();
|
|
226
|
-
var tmp_12 = emitRequestFunctions(first_0(endpoint.t24_1), this, endpoint);
|
|
227
|
-
var tmp_13 = Spacer_instance.x26(2);
|
|
228
|
-
var tmp_14 = distinctByStatus(endpoint.u24_1);
|
|
229
|
-
var tmp_15 = joinToString(tmp_14, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
230
|
-
var tmp_16 = Spacer_instance.x26(3);
|
|
231
|
-
var tmp_17 = Spacer_instance.x26(2);
|
|
232
|
-
var tmp_18 = Spacer_instance.x26(2);
|
|
233
|
-
var tmp_19 = Spacer_instance.x26(3);
|
|
234
|
-
// Inline function 'kotlin.collections.filter' call
|
|
235
|
-
// Inline function 'kotlin.collections.filterTo' call
|
|
236
|
-
var this_0 = distinctByStatus(endpoint.u24_1);
|
|
237
|
-
var destination = ArrayList_init_$Create$();
|
|
238
|
-
var tmp0_iterator = this_0.g();
|
|
239
|
-
while (tmp0_iterator.h()) {
|
|
240
|
-
var element = tmp0_iterator.i();
|
|
241
|
-
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
242
|
-
if (Companion_instance_1.a26(element.a25_1)) {
|
|
243
|
-
destination.e(element);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
var tmp_20 = destination;
|
|
247
|
-
var tmp_21 = joinToString(tmp_20, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
248
|
-
var tmp_22 = Spacer_instance.x26(4);
|
|
249
|
-
var tmp_23 = Spacer_instance.x26(3);
|
|
250
|
-
var tmp_24 = Spacer_instance.x26(2);
|
|
251
|
-
var tmp_25 = Spacer_instance.x26(2);
|
|
252
|
-
var tmp_26 = this.q2a(endpoint);
|
|
253
|
-
var tmp_27 = Spacer_instance.x26(2);
|
|
254
|
-
var tmp_28 = Spacer_instance.x26(3);
|
|
255
|
-
return trimMargin('\n |' + tmp + '\n |\n |public interface ' + tmp_0 + ' extends Wirespec.Endpoint {\n |' + tmp_2 + '\n |\n |' + tmp_3 + '\n |\n |' + tmp_4 + '\n |\n |' + tmp_5 + '\n |\n |' + tmp_6 + 'sealed interface Response<T> extends Wirespec.Response<T> {}\n |' + tmp_7 + '\n |' + tmp_8 + '\n |\n |' + tmp_10 + '\n |\n |' + tmp_11 + 'interface Handler extends Wirespec.Handler {\n |\n |' + tmp_12 + '\n |\n |' + tmp_13 + 'static Wirespec.RawResponse toResponse(Wirespec.Serializer<String> serialization, Response<?> response) {\n |' + tmp_15 + '\n |' + tmp_16 + 'else { throw new IllegalStateException("Cannot match response with status: " + response.getStatus());}\n |' + tmp_17 + '}\n |\n |' + tmp_18 + 'static Response<?> fromResponse(Wirespec.Deserializer<String> serialization, Wirespec.RawResponse response) {\n |' + tmp_19 + 'switch (response.statusCode()) {\n |' + tmp_21 + '\n |' + tmp_22 + 'default: throw new IllegalStateException("Cannot match response with status: " + response.statusCode());\n |' + tmp_23 + '}\n |' + tmp_24 + '}\n |\n |' + tmp_25 + tmp_26 + '\n |' + tmp_27 + 'class Handlers implements Wirespec.Server<Request, Response<?>>, Wirespec.Client<Request, Response<?>> {\n |' + tmp_28 + '@Override public String getPathTemplate() { return "/' + joinToString(endpoint.q24_1, '/', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_5) + '"; }\n |' + Spacer_instance.x26(3) + '@Override public String getMethod() { return "' + endpoint.p24_1.toString() + '"; }\n |' + Spacer_instance.x26(3) + '@Override public Wirespec.ServerEdge<Request, Response<?>> getServer(Wirespec.Serialization<String> serialization) {\n |' + Spacer_instance.x26(4) + 'return new Wirespec.ServerEdge<>() {\n |' + Spacer_instance.x26(5) + '@Override public Request from(Wirespec.RawRequest request) { return fromRequest(serialization, request); }\n |' + Spacer_instance.x26(5) + '@Override public Wirespec.RawResponse to(Response<?> response) { return toResponse(serialization, response); }\n |' + Spacer_instance.x26(4) + '};\n |' + Spacer_instance.x26(3) + '}\n |' + Spacer_instance.x26(3) + '@Override public Wirespec.ClientEdge<Request, Response<?>> getClient(Wirespec.Serialization<String> serialization) {\n |' + Spacer_instance.x26(4) + 'return new Wirespec.ClientEdge<>() {\n |' + Spacer_instance.x26(5) + '@Override public Wirespec.RawRequest to(Request request) { return toRequest(serialization, request); }\n |' + Spacer_instance.x26(5) + '@Override public Response<?> from(Wirespec.RawResponse response) { return fromResponse(serialization, response); }\n |' + Spacer_instance.x26(4) + '};\n |' + Spacer_instance.x26(3) + '}\n |' + Spacer_instance.x26(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
256
|
-
}
|
|
257
|
-
function emitHandleFunction(endpoint) {
|
|
258
|
-
return 'java.util.concurrent.CompletableFuture<Response<?>> ' + Companion_instance_1.y25(this.f26(endpoint.o24_1)) + '(Request request);';
|
|
259
|
-
}
|
|
260
|
-
function emit_8(_this__u8e3s4, endpoint) {
|
|
261
|
-
return trimMargin('\n |' + Spacer_instance.toString() + 'class Request implements Wirespec.Request<' + emit_13(_this__u8e3s4.x24_1, this) + '> {\n |' + Spacer_instance.x26(2) + 'private final Path path;\n |' + Spacer_instance.x26(2) + 'private final Wirespec.Method method;\n |' + Spacer_instance.x26(2) + 'private final Queries queries;\n |' + Spacer_instance.x26(2) + 'private final RequestHeaders headers;\n |' + Spacer_instance.x26(2) + 'private final ' + emit_13(_this__u8e3s4.x24_1, this) + ' body;\n |' + Spacer_instance.x26(2) + emitConstructor(_this__u8e3s4, this, endpoint) + '\n |' + Spacer_instance.x26(2) + '@Override public Path getPath() { return path; }\n |' + Spacer_instance.x26(2) + '@Override public Wirespec.Method getMethod() { return method; }\n |' + Spacer_instance.x26(2) + '@Override public Queries getQueries() { return queries; }\n |' + Spacer_instance.x26(2) + '@Override public RequestHeaders getHeaders() { return headers; }\n |' + Spacer_instance.x26(2) + '@Override public ' + emit_13(_this__u8e3s4.x24_1, this) + ' getBody() { return body; }\n |' + Spacer_instance.toString() + '}\n ');
|
|
262
|
-
}
|
|
263
|
-
function emit_9(_this__u8e3s4) {
|
|
264
|
-
var tmp = Spacer_instance.toString();
|
|
265
|
-
var tmp_0 = Companion_instance_1.x25(_this__u8e3s4.a25_1);
|
|
266
|
-
var tmp_1 = orNull(joinToString(_this__u8e3s4.b25_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_6(this)));
|
|
267
|
-
var tmp0_safe_receiver = _this__u8e3s4.c25_1;
|
|
268
|
-
var tmp_2;
|
|
269
|
-
if (tmp0_safe_receiver == null) {
|
|
270
|
-
tmp_2 = null;
|
|
271
|
-
} else {
|
|
272
|
-
// Inline function 'kotlin.let' call
|
|
273
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
274
|
-
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
275
|
-
tmp_2 = emit_13(tmp0_safe_receiver, this) + ' body';
|
|
276
|
-
}
|
|
277
|
-
var tmp_3 = joinToString(listOfNotNull([tmp_1, tmp_2]));
|
|
278
|
-
var tmp_4 = toString_0(first(_this__u8e3s4.a25_1));
|
|
279
|
-
var tmp_5 = emit_13(_this__u8e3s4.c25_1, this);
|
|
280
|
-
var tmp_6 = concatGenerics(emit_13(_this__u8e3s4.c25_1, this));
|
|
281
|
-
var tmp_7 = Spacer_instance.x26(2);
|
|
282
|
-
var tmp_8 = fixStatus(_this__u8e3s4.a25_1);
|
|
283
|
-
var tmp_9 = Spacer_instance.x26(2);
|
|
284
|
-
// Inline function 'kotlin.let' call
|
|
285
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
286
|
-
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
287
|
-
var tmp_10 = '@Override public Headers getHeaders() { return new Headers(' + joinToString(_this__u8e3s4.b25_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_7(this)) + '); }';
|
|
288
|
-
var tmp_11 = Spacer_instance.x26(2);
|
|
289
|
-
var tmp_12 = emit_13(_this__u8e3s4.c25_1, this);
|
|
290
|
-
var tmp_13 = _this__u8e3s4.c25_1 == null ? 'null' : 'body';
|
|
291
|
-
var tmp_14 = Spacer_instance.x26(1);
|
|
292
|
-
return trimMargin('\n |' + tmp + 'record Response' + tmp_0 + '(' + tmp_3 + ') implements Response' + tmp_4 + 'XX<' + tmp_5 + '>, Response' + tmp_6 + ' {\n |' + tmp_7 + '@Override public int getStatus() { return ' + tmp_8 + '; }\n |' + tmp_9 + tmp_10 + '\n |' + tmp_11 + '@Override public ' + tmp_12 + ' getBody() { return ' + tmp_13 + '; }\n |' + tmp_14 + emitObject(_this__u8e3s4.b25_1, this, 'Headers', 'Wirespec.Response.Headers', JavaEndpointDefinitionEmitter$emit$lambda_8(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
293
|
-
}
|
|
294
|
-
initMetadataForInterface(JavaEndpointDefinitionEmitter, 'JavaEndpointDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
295
|
-
function emit_10(identifier) {
|
|
212
|
+
function emit_7(identifier) {
|
|
296
213
|
var tmp;
|
|
297
214
|
if (identifier instanceof DefinitionIdentifier) {
|
|
298
|
-
tmp = this.
|
|
215
|
+
tmp = this.j2b(identifier.b1());
|
|
299
216
|
} else {
|
|
300
217
|
if (identifier instanceof FieldIdentifier) {
|
|
301
|
-
tmp = this.
|
|
218
|
+
tmp = this.k2a(this.j2b(identifier.b1()));
|
|
302
219
|
} else {
|
|
303
220
|
noWhenBranchMatchedException();
|
|
304
221
|
}
|
|
@@ -317,11 +234,11 @@ function sanitizeSymbol(_this__u8e3s4) {
|
|
|
317
234
|
// Inline function 'community.flock.wirespec.emitters.java.JavaIdentifierEmitter.sanitizeSymbol.<anonymous>' call
|
|
318
235
|
var tmp1 = index;
|
|
319
236
|
index = tmp1 + 1 | 0;
|
|
320
|
-
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance_1.
|
|
237
|
+
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance_1.a26(item) : item;
|
|
321
238
|
destination.e(tmp$ret$0);
|
|
322
239
|
}
|
|
323
240
|
var tmp = asSequence(joinToString(destination, ''));
|
|
324
|
-
return this.
|
|
241
|
+
return this.j2a(joinToString_0(filter(tmp, JavaIdentifierEmitter$sanitizeSymbol$lambda), ''));
|
|
325
242
|
}
|
|
326
243
|
function sanitizeFirstIsDigit(_this__u8e3s4) {
|
|
327
244
|
var tmp;
|
|
@@ -341,23 +258,106 @@ function sanitizeFirstIsDigit(_this__u8e3s4) {
|
|
|
341
258
|
return tmp;
|
|
342
259
|
}
|
|
343
260
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
344
|
-
return Companion_getInstance().
|
|
261
|
+
return Companion_getInstance().k2b_1.o1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
345
262
|
}
|
|
346
263
|
initMetadataForInterface(JavaIdentifierEmitter, 'JavaIdentifierEmitter');
|
|
347
|
-
function
|
|
348
|
-
var tmp = this.
|
|
349
|
-
return trimMargin('\n |public enum ' + tmp + ' implements Wirespec.Enum {\n |' + spacer(joinToString(enum_0.
|
|
264
|
+
function emit_8(enum_0, module_0) {
|
|
265
|
+
var tmp = this.i26(enum_0.q26_1);
|
|
266
|
+
return trimMargin('\n |public enum ' + tmp + ' implements Wirespec.Enum {\n |' + spacer(joinToString(enum_0.r26_1, ',\n', VOID, VOID, VOID, VOID, JavaEnumDefinitionEmitter$emit$lambda(this))) + ';\n |' + Spacer_instance.toString() + 'public final String label;\n |' + Spacer_instance.toString() + this.i26(enum_0.q26_1) + '(String label) {\n |' + Spacer_instance.a27(2) + 'this.label = label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String toString() {\n |' + Spacer_instance.a27(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String getLabel() {\n |' + Spacer_instance.a27(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
350
267
|
}
|
|
351
268
|
function sanitizeEnum(_this__u8e3s4) {
|
|
352
|
-
return this.
|
|
269
|
+
return this.k2a(this.j2a(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
|
|
353
270
|
}
|
|
354
271
|
initMetadataForInterface(JavaEnumDefinitionEmitter, 'JavaEnumDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
|
|
272
|
+
function emit_9(endpoint) {
|
|
273
|
+
var tmp = emitImports_0(endpoint, this);
|
|
274
|
+
var tmp_0 = this.i26(endpoint.r24_1);
|
|
275
|
+
var tmp_1 = get_pathParams(endpoint);
|
|
276
|
+
var tmp_2 = emitObject(tmp_1, this, 'Path', 'Wirespec.Path', JavaEndpointDefinitionEmitter$emit$lambda(this));
|
|
277
|
+
var tmp_3 = emitObject(endpoint.u24_1, this, 'Queries', 'Wirespec.Queries', JavaEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
278
|
+
var tmp_4 = emitObject(endpoint.v24_1, this, 'RequestHeaders', 'Wirespec.Request.Headers', JavaEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
279
|
+
var tmp_5 = this.u2a(first_0(endpoint.w24_1), endpoint);
|
|
280
|
+
var tmp_6 = Spacer_instance.toString();
|
|
281
|
+
var tmp_7 = emitStatusInterfaces(endpoint, this);
|
|
282
|
+
var tmp_8 = emitResponseInterfaces(endpoint, this);
|
|
283
|
+
var tmp_9 = distinctByStatus(endpoint.x24_1);
|
|
284
|
+
var tmp_10 = joinToString(tmp_9, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
285
|
+
var tmp_11 = Spacer_instance.toString();
|
|
286
|
+
var tmp_12 = emitRequestFunctions(first_0(endpoint.w24_1), this, endpoint);
|
|
287
|
+
var tmp_13 = Spacer_instance.a27(2);
|
|
288
|
+
var tmp_14 = distinctByStatus(endpoint.x24_1);
|
|
289
|
+
var tmp_15 = joinToString(tmp_14, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
290
|
+
var tmp_16 = Spacer_instance.a27(3);
|
|
291
|
+
var tmp_17 = Spacer_instance.a27(2);
|
|
292
|
+
var tmp_18 = Spacer_instance.a27(2);
|
|
293
|
+
var tmp_19 = Spacer_instance.a27(3);
|
|
294
|
+
// Inline function 'kotlin.collections.filter' call
|
|
295
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
296
|
+
var this_0 = distinctByStatus(endpoint.x24_1);
|
|
297
|
+
var destination = ArrayList_init_$Create$();
|
|
298
|
+
var tmp0_iterator = this_0.g();
|
|
299
|
+
while (tmp0_iterator.h()) {
|
|
300
|
+
var element = tmp0_iterator.i();
|
|
301
|
+
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
302
|
+
if (Companion_instance_1.d26(element.d25_1)) {
|
|
303
|
+
destination.e(element);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
var tmp_20 = destination;
|
|
307
|
+
var tmp_21 = joinToString(tmp_20, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_4(this));
|
|
308
|
+
var tmp_22 = Spacer_instance.a27(4);
|
|
309
|
+
var tmp_23 = Spacer_instance.a27(3);
|
|
310
|
+
var tmp_24 = Spacer_instance.a27(2);
|
|
311
|
+
var tmp_25 = Spacer_instance.a27(2);
|
|
312
|
+
var tmp_26 = this.w2a(endpoint);
|
|
313
|
+
var tmp_27 = Spacer_instance.a27(2);
|
|
314
|
+
var tmp_28 = Spacer_instance.a27(3);
|
|
315
|
+
return trimMargin('\n |' + tmp + '\n |\n |public interface ' + tmp_0 + ' extends Wirespec.Endpoint {\n |' + tmp_2 + '\n |\n |' + tmp_3 + '\n |\n |' + tmp_4 + '\n |\n |' + tmp_5 + '\n |\n |' + tmp_6 + 'sealed interface Response<T> extends Wirespec.Response<T> {}\n |' + tmp_7 + '\n |' + tmp_8 + '\n |\n |' + tmp_10 + '\n |\n |' + tmp_11 + 'interface Handler extends Wirespec.Handler {\n |\n |' + tmp_12 + '\n |\n |' + tmp_13 + 'static Wirespec.RawResponse toResponse(Wirespec.Serializer<String> serialization, Response<?> response) {\n |' + tmp_15 + '\n |' + tmp_16 + 'else { throw new IllegalStateException("Cannot match response with status: " + response.getStatus());}\n |' + tmp_17 + '}\n |\n |' + tmp_18 + 'static Response<?> fromResponse(Wirespec.Deserializer<String> serialization, Wirespec.RawResponse response) {\n |' + tmp_19 + 'switch (response.statusCode()) {\n |' + tmp_21 + '\n |' + tmp_22 + 'default: throw new IllegalStateException("Cannot match response with status: " + response.statusCode());\n |' + tmp_23 + '}\n |' + tmp_24 + '}\n |\n |' + tmp_25 + tmp_26 + '\n |' + tmp_27 + 'class Handlers implements Wirespec.Server<Request, Response<?>>, Wirespec.Client<Request, Response<?>> {\n |' + tmp_28 + '@Override public String getPathTemplate() { return "/' + joinToString(endpoint.t24_1, '/', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_5) + '"; }\n |' + Spacer_instance.a27(3) + '@Override public String getMethod() { return "' + endpoint.s24_1.toString() + '"; }\n |' + Spacer_instance.a27(3) + '@Override public Wirespec.ServerEdge<Request, Response<?>> getServer(Wirespec.Serialization<String> serialization) {\n |' + Spacer_instance.a27(4) + 'return new Wirespec.ServerEdge<>() {\n |' + Spacer_instance.a27(5) + '@Override public Request from(Wirespec.RawRequest request) { return fromRequest(serialization, request); }\n |' + Spacer_instance.a27(5) + '@Override public Wirespec.RawResponse to(Response<?> response) { return toResponse(serialization, response); }\n |' + Spacer_instance.a27(4) + '};\n |' + Spacer_instance.a27(3) + '}\n |' + Spacer_instance.a27(3) + '@Override public Wirespec.ClientEdge<Request, Response<?>> getClient(Wirespec.Serialization<String> serialization) {\n |' + Spacer_instance.a27(4) + 'return new Wirespec.ClientEdge<>() {\n |' + Spacer_instance.a27(5) + '@Override public Wirespec.RawRequest to(Request request) { return toRequest(serialization, request); }\n |' + Spacer_instance.a27(5) + '@Override public Response<?> from(Wirespec.RawResponse response) { return fromResponse(serialization, response); }\n |' + Spacer_instance.a27(4) + '};\n |' + Spacer_instance.a27(3) + '}\n |' + Spacer_instance.a27(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
316
|
+
}
|
|
317
|
+
function emitHandleFunction(endpoint) {
|
|
318
|
+
return 'java.util.concurrent.CompletableFuture<Response<?>> ' + Companion_instance_1.b26(this.i26(endpoint.r24_1)) + '(Request request);';
|
|
319
|
+
}
|
|
320
|
+
function emit_10(_this__u8e3s4, endpoint) {
|
|
321
|
+
return trimMargin('\n |' + Spacer_instance.toString() + 'class Request implements Wirespec.Request<' + emit_13(_this__u8e3s4.a25_1, this) + '> {\n |' + Spacer_instance.a27(2) + 'private final Path path;\n |' + Spacer_instance.a27(2) + 'private final Wirespec.Method method;\n |' + Spacer_instance.a27(2) + 'private final Queries queries;\n |' + Spacer_instance.a27(2) + 'private final RequestHeaders headers;\n |' + Spacer_instance.a27(2) + 'private final ' + emit_13(_this__u8e3s4.a25_1, this) + ' body;\n |' + Spacer_instance.a27(2) + emitConstructor(_this__u8e3s4, this, endpoint) + '\n |' + Spacer_instance.a27(2) + '@Override public Path getPath() { return path; }\n |' + Spacer_instance.a27(2) + '@Override public Wirespec.Method getMethod() { return method; }\n |' + Spacer_instance.a27(2) + '@Override public Queries getQueries() { return queries; }\n |' + Spacer_instance.a27(2) + '@Override public RequestHeaders getHeaders() { return headers; }\n |' + Spacer_instance.a27(2) + '@Override public ' + emit_13(_this__u8e3s4.a25_1, this) + ' getBody() { return body; }\n |' + Spacer_instance.toString() + '}\n ');
|
|
322
|
+
}
|
|
323
|
+
function emit_11(_this__u8e3s4) {
|
|
324
|
+
var tmp = Spacer_instance.toString();
|
|
325
|
+
var tmp_0 = Companion_instance_1.a26(_this__u8e3s4.d25_1);
|
|
326
|
+
var tmp_1 = orNull(joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_6(this)));
|
|
327
|
+
var tmp0_safe_receiver = _this__u8e3s4.f25_1;
|
|
328
|
+
var tmp_2;
|
|
329
|
+
if (tmp0_safe_receiver == null) {
|
|
330
|
+
tmp_2 = null;
|
|
331
|
+
} else {
|
|
332
|
+
// Inline function 'kotlin.let' call
|
|
333
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
334
|
+
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
335
|
+
tmp_2 = emit_13(tmp0_safe_receiver, this) + ' body';
|
|
336
|
+
}
|
|
337
|
+
var tmp_3 = joinToString(listOfNotNull([tmp_1, tmp_2]));
|
|
338
|
+
var tmp_4 = toString_0(first(_this__u8e3s4.d25_1));
|
|
339
|
+
var tmp_5 = emit_13(_this__u8e3s4.f25_1, this);
|
|
340
|
+
var tmp_6 = concatGenerics(emit_13(_this__u8e3s4.f25_1, this));
|
|
341
|
+
var tmp_7 = Spacer_instance.a27(2);
|
|
342
|
+
var tmp_8 = fixStatus(_this__u8e3s4.d25_1);
|
|
343
|
+
var tmp_9 = Spacer_instance.a27(2);
|
|
344
|
+
// Inline function 'kotlin.let' call
|
|
345
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
346
|
+
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
347
|
+
var tmp_10 = '@Override public Headers getHeaders() { return new Headers(' + joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_7(this)) + '); }';
|
|
348
|
+
var tmp_11 = Spacer_instance.a27(2);
|
|
349
|
+
var tmp_12 = emit_13(_this__u8e3s4.f25_1, this);
|
|
350
|
+
var tmp_13 = _this__u8e3s4.f25_1 == null ? 'null' : 'body';
|
|
351
|
+
var tmp_14 = Spacer_instance.a27(1);
|
|
352
|
+
return trimMargin('\n |' + tmp + 'record Response' + tmp_0 + '(' + tmp_3 + ') implements Response' + tmp_4 + 'XX<' + tmp_5 + '>, Response' + tmp_6 + ' {\n |' + tmp_7 + '@Override public int getStatus() { return ' + tmp_8 + '; }\n |' + tmp_9 + tmp_10 + '\n |' + tmp_11 + '@Override public ' + tmp_12 + ' getBody() { return ' + tmp_13 + '; }\n |' + tmp_14 + emitObject(_this__u8e3s4.e25_1, this, 'Headers', 'Wirespec.Response.Headers', JavaEndpointDefinitionEmitter$emit$lambda_8(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
353
|
+
}
|
|
354
|
+
initMetadataForInterface(JavaEndpointDefinitionEmitter, 'JavaEndpointDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
355
355
|
function emit_12(union) {
|
|
356
|
-
var tmp = this.
|
|
357
|
-
return trimMargin('\n |public sealed interface ' + tmp + ' permits ' + joinToString(union.
|
|
356
|
+
var tmp = this.i26(union.g24_1);
|
|
357
|
+
return trimMargin('\n |public sealed interface ' + tmp + ' permits ' + joinToString(union.h24_1, VOID, VOID, VOID, VOID, VOID, JavaUnionDefinitionEmitter$emit$lambda) + ' {}\n |\n ');
|
|
358
358
|
}
|
|
359
359
|
initMetadataForInterface(JavaUnionDefinitionEmitter, 'JavaUnionDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
|
|
360
|
-
initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaRefinedTypeDefinitionEmitter, JavaTypeDefinitionEmitter,
|
|
360
|
+
initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaRefinedTypeDefinitionEmitter, JavaTypeDefinitionEmitter, JavaIdentifierEmitter, JavaChannelDefinitionEmitter, JavaEnumDefinitionEmitter, JavaEndpointDefinitionEmitter, JavaUnionDefinitionEmitter, LanguageEmitter]);
|
|
361
361
|
initMetadataForCompanion(Companion);
|
|
362
362
|
initMetadataForObject(JavaShared, 'JavaShared');
|
|
363
363
|
//endregion
|
|
@@ -371,7 +371,7 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
371
371
|
while (tmp0_iterator.h()) {
|
|
372
372
|
var element = tmp0_iterator.i();
|
|
373
373
|
// Inline function 'community.flock.wirespec.emitters.java.JavaChannelDefinitionEmitter.emitImports.<anonymous>' call
|
|
374
|
-
if (!(_this__u8e3s4.
|
|
374
|
+
if (!(_this__u8e3s4.g26().b1() === element.c29_1)) {
|
|
375
375
|
destination.e(element);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -381,7 +381,7 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
381
381
|
while (tmp0_iterator_0.h()) {
|
|
382
382
|
var item = tmp0_iterator_0.i();
|
|
383
383
|
// Inline function 'community.flock.wirespec.emitters.java.JavaChannelDefinitionEmitter.emitImports.<anonymous>' call
|
|
384
|
-
var tmp$ret$3 = 'import ' + $this.
|
|
384
|
+
var tmp$ret$3 = 'import ' + $this.h2a().w26_1 + '.model.' + item.c29_1 + ';';
|
|
385
385
|
destination_0.e(tmp$ret$3);
|
|
386
386
|
}
|
|
387
387
|
var tmp = destination_0;
|
|
@@ -389,8 +389,8 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
389
389
|
}
|
|
390
390
|
function emitFullyQualified(_this__u8e3s4, $this, reference) {
|
|
391
391
|
var tmp;
|
|
392
|
-
if (_this__u8e3s4.
|
|
393
|
-
tmp = $this.
|
|
392
|
+
if (_this__u8e3s4.g26().b1() === reference.b1()) {
|
|
393
|
+
tmp = $this.h2a().w26_1 + '.model.';
|
|
394
394
|
} else {
|
|
395
395
|
tmp = '';
|
|
396
396
|
}
|
|
@@ -403,53 +403,53 @@ function JavaChannelDefinitionEmitter$emitImports$lambda(it) {
|
|
|
403
403
|
function JavaChannelDefinitionEmitter() {
|
|
404
404
|
}
|
|
405
405
|
function JavaEmitter(packageName, emitShared) {
|
|
406
|
-
packageName = packageName === VOID ? Companion_instance.
|
|
407
|
-
emitShared = emitShared === VOID ? Companion_instance_0.
|
|
406
|
+
packageName = packageName === VOID ? Companion_instance.v26('community.flock.wirespec.generated') : packageName;
|
|
407
|
+
emitShared = emitShared === VOID ? Companion_instance_0.y23() : emitShared;
|
|
408
408
|
LanguageEmitter.call(this);
|
|
409
|
-
this.
|
|
410
|
-
this.
|
|
411
|
-
this.
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
this.
|
|
415
|
-
}
|
|
416
|
-
protoOf(JavaEmitter).
|
|
417
|
-
return this.
|
|
409
|
+
this.b2b_1 = packageName;
|
|
410
|
+
this.c2b_1 = emitShared;
|
|
411
|
+
this.d2b_1 = '\nimport community.flock.wirespec.java.Wirespec;\n';
|
|
412
|
+
this.e2b_1 = FileExtension_Java_getInstance();
|
|
413
|
+
this.f2b_1 = JavaShared_getInstance();
|
|
414
|
+
this.g2b_1 = '//';
|
|
415
|
+
}
|
|
416
|
+
protoOf(JavaEmitter).h2a = function () {
|
|
417
|
+
return this.b2b_1;
|
|
418
418
|
};
|
|
419
|
-
protoOf(JavaEmitter).
|
|
420
|
-
return this.
|
|
419
|
+
protoOf(JavaEmitter).q25 = function () {
|
|
420
|
+
return this.e2b_1;
|
|
421
421
|
};
|
|
422
|
-
protoOf(JavaEmitter).
|
|
423
|
-
return this.
|
|
422
|
+
protoOf(JavaEmitter).r2a = function () {
|
|
423
|
+
return this.f2b_1;
|
|
424
424
|
};
|
|
425
|
-
protoOf(JavaEmitter).
|
|
426
|
-
return this.
|
|
425
|
+
protoOf(JavaEmitter).r25 = function () {
|
|
426
|
+
return this.g2b_1;
|
|
427
427
|
};
|
|
428
|
-
protoOf(JavaEmitter).
|
|
428
|
+
protoOf(JavaEmitter).e26 = function (module_0, logger) {
|
|
429
429
|
// Inline function 'kotlin.let' call
|
|
430
430
|
// Inline function 'kotlin.contracts.contract' call
|
|
431
431
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEmitter.emit.<anonymous>' call
|
|
432
|
-
var it = protoOf(LanguageEmitter).
|
|
433
|
-
return this.
|
|
432
|
+
var it = protoOf(LanguageEmitter).e26.call(this, module_0, logger);
|
|
433
|
+
return this.c2b_1.z23_1 ? it.vk(new Emitted(Companion_instance.v26('community.flock.wirespec.java').y26() + 'Wirespec', this.r2a().i2b_1)) : it;
|
|
434
434
|
};
|
|
435
|
-
protoOf(JavaEmitter).
|
|
435
|
+
protoOf(JavaEmitter).f26 = function (definition, module_0, logger) {
|
|
436
436
|
// Inline function 'kotlin.let' call
|
|
437
437
|
// Inline function 'kotlin.contracts.contract' call
|
|
438
438
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEmitter.emit.<anonymous>' call
|
|
439
|
-
var it = protoOf(LanguageEmitter).
|
|
440
|
-
var subPackageName = plus(this.
|
|
441
|
-
var tmp = subPackageName.
|
|
439
|
+
var it = protoOf(LanguageEmitter).f26.call(this, definition, module_0, logger);
|
|
440
|
+
var subPackageName = plus(this.h2a(), definition);
|
|
441
|
+
var tmp = subPackageName.y26() + this.j2b(it.a24_1);
|
|
442
442
|
// Inline function 'kotlin.text.trimStart' call
|
|
443
|
-
var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.
|
|
443
|
+
var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.c26(module_0) ? this.d2b_1 : '') + '\n |' + it.b24_1 + '\n ');
|
|
444
444
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
445
445
|
return new Emitted(tmp, tmp$ret$0);
|
|
446
446
|
};
|
|
447
447
|
function emitGetType(_this__u8e3s4, $this) {
|
|
448
|
-
return 'Wirespec.getType(' + $this.
|
|
448
|
+
return 'Wirespec.getType(' + $this.a2b(_this__u8e3s4, 'Void') + '.class, ' + emitGetTypeRaw(_this__u8e3s4, $this) + ')';
|
|
449
449
|
}
|
|
450
450
|
function emitGetTypeRaw(_this__u8e3s4, $this) {
|
|
451
451
|
var tmp;
|
|
452
|
-
var tmp1_elvis_lhs = _this__u8e3s4 == null ? null : _this__u8e3s4.
|
|
452
|
+
var tmp1_elvis_lhs = _this__u8e3s4 == null ? null : _this__u8e3s4.jm();
|
|
453
453
|
if (tmp1_elvis_lhs == null ? false : tmp1_elvis_lhs) {
|
|
454
454
|
tmp = 'java.util.Optional.class';
|
|
455
455
|
} else {
|
|
@@ -464,9 +464,9 @@ function emitGetTypeRaw(_this__u8e3s4, $this) {
|
|
|
464
464
|
function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
465
465
|
var tmp = get_pathParams(endpoint);
|
|
466
466
|
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda($this)));
|
|
467
|
-
var tmp_1 = orNull(joinToString(endpoint.
|
|
468
|
-
var tmp_2 = orNull(joinToString(endpoint.
|
|
469
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
467
|
+
var tmp_1 = orNull(joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_0($this)));
|
|
468
|
+
var tmp_2 = orNull(joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_1($this)));
|
|
469
|
+
var tmp0_safe_receiver = _this__u8e3s4.a25_1;
|
|
470
470
|
var tmp_3;
|
|
471
471
|
if (tmp0_safe_receiver == null) {
|
|
472
472
|
tmp_3 = null;
|
|
@@ -477,23 +477,23 @@ function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
|
477
477
|
tmp_3 = emit_13(tmp0_safe_receiver, $this) + ' body';
|
|
478
478
|
}
|
|
479
479
|
var tmp_4 = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]));
|
|
480
|
-
var tmp_5 = Spacer_instance.
|
|
480
|
+
var tmp_5 = Spacer_instance.a27(3);
|
|
481
481
|
// Inline function 'kotlin.let' call
|
|
482
482
|
var tmp_6 = get_pathParams(endpoint);
|
|
483
483
|
// Inline function 'kotlin.contracts.contract' call
|
|
484
484
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
485
485
|
var tmp_7 = 'this.path = new Path(' + joinToString(tmp_6, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_2($this)) + ');';
|
|
486
|
-
var tmp_8 = 'this.method = Wirespec.Method.' + endpoint.
|
|
486
|
+
var tmp_8 = 'this.method = Wirespec.Method.' + endpoint.s24_1.q2_1 + ';';
|
|
487
487
|
// Inline function 'kotlin.let' call
|
|
488
488
|
// Inline function 'kotlin.contracts.contract' call
|
|
489
489
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
490
|
-
var tmp_9 = 'this.queries = new Queries(' + joinToString(endpoint.
|
|
490
|
+
var tmp_9 = 'this.queries = new Queries(' + joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_3($this)) + ');';
|
|
491
491
|
// Inline function 'kotlin.let' call
|
|
492
492
|
// Inline function 'kotlin.contracts.contract' call
|
|
493
493
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
494
|
-
var tmp_10 = 'this.headers = new RequestHeaders(' + joinToString(endpoint.
|
|
494
|
+
var tmp_10 = 'this.headers = new RequestHeaders(' + joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_4($this)) + ');';
|
|
495
495
|
var tmp_11;
|
|
496
|
-
if (_this__u8e3s4.
|
|
496
|
+
if (_this__u8e3s4.a25_1 == null) {
|
|
497
497
|
tmp_11 = null;
|
|
498
498
|
} else {
|
|
499
499
|
// Inline function 'kotlin.let' call
|
|
@@ -502,15 +502,15 @@ function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
|
502
502
|
tmp_11 = 'body';
|
|
503
503
|
}
|
|
504
504
|
var tmp2_elvis_lhs = tmp_11;
|
|
505
|
-
return 'public Request(' + tmp_4 + ') {\n' + tmp_5 + joinToString(listOfNotNull([tmp_7, tmp_8, tmp_9, tmp_10, 'this.body = ' + (tmp2_elvis_lhs == null ? 'null' : tmp2_elvis_lhs) + ';']), '\n' + Spacer_instance.
|
|
505
|
+
return 'public Request(' + tmp_4 + ') {\n' + tmp_5 + joinToString(listOfNotNull([tmp_7, tmp_8, tmp_9, tmp_10, 'this.body = ' + (tmp2_elvis_lhs == null ? 'null' : tmp2_elvis_lhs) + ';']), '\n' + Spacer_instance.a27(3)) + '\n' + Spacer_instance.a27(2) + '}';
|
|
506
506
|
}
|
|
507
507
|
function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
508
508
|
// Inline function 'kotlin.let' call
|
|
509
509
|
var tmp = get_indexedPathParams(endpoint);
|
|
510
510
|
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda($this)));
|
|
511
|
-
var tmp_1 = orNull(joinToString(endpoint.
|
|
512
|
-
var tmp_2 = orNull(joinToString(endpoint.
|
|
513
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
511
|
+
var tmp_1 = orNull(joinToString(endpoint.u24_1, ',\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda_0($this)));
|
|
512
|
+
var tmp_2 = orNull(joinToString(endpoint.v24_1, ',\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda_1($this)));
|
|
513
|
+
var tmp0_safe_receiver = _this__u8e3s4.a25_1;
|
|
514
514
|
var tmp_3;
|
|
515
515
|
if (tmp0_safe_receiver == null) {
|
|
516
516
|
tmp_3 = null;
|
|
@@ -518,17 +518,17 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
518
518
|
// Inline function 'kotlin.let' call
|
|
519
519
|
// Inline function 'kotlin.contracts.contract' call
|
|
520
520
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
521
|
-
tmp_3 = Spacer_instance.
|
|
521
|
+
tmp_3 = Spacer_instance.a27(4) + 'serialization.deserialize(request.body(), ' + emitGetType(tmp0_safe_receiver.c25_1, $this) + ')';
|
|
522
522
|
}
|
|
523
523
|
// Inline function 'kotlin.contracts.contract' call
|
|
524
524
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
525
525
|
var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
|
|
526
|
-
return isBlank(it) ? '' : '\n' + it + '\n' + Spacer_instance.
|
|
526
|
+
return isBlank(it) ? '' : '\n' + it + '\n' + Spacer_instance.a27(3);
|
|
527
527
|
}
|
|
528
528
|
function emitDeserializedParams_0(_this__u8e3s4, $this) {
|
|
529
529
|
// Inline function 'kotlin.let' call
|
|
530
|
-
var tmp = orNull(joinToString(_this__u8e3s4.
|
|
531
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
530
|
+
var tmp = orNull(joinToString(_this__u8e3s4.e25_1, ',\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda_2($this)));
|
|
531
|
+
var tmp0_safe_receiver = _this__u8e3s4.f25_1;
|
|
532
532
|
var tmp_0;
|
|
533
533
|
if (tmp0_safe_receiver == null) {
|
|
534
534
|
tmp_0 = null;
|
|
@@ -536,50 +536,50 @@ function emitDeserializedParams_0(_this__u8e3s4, $this) {
|
|
|
536
536
|
// Inline function 'kotlin.let' call
|
|
537
537
|
// Inline function 'kotlin.contracts.contract' call
|
|
538
538
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
539
|
-
tmp_0 = Spacer_instance.
|
|
539
|
+
tmp_0 = Spacer_instance.a27(4) + 'serialization.deserialize(response.body(), ' + emitGetType(tmp0_safe_receiver.c25_1, $this) + ')';
|
|
540
540
|
}
|
|
541
541
|
// Inline function 'kotlin.contracts.contract' call
|
|
542
542
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
543
543
|
var it = joinToString(listOfNotNull([tmp, tmp_0]), ',\n');
|
|
544
|
-
return isBlank(it) ? '' : '\n' + it + '\n' + Spacer_instance.
|
|
544
|
+
return isBlank(it) ? '' : '\n' + it + '\n' + Spacer_instance.a27(3);
|
|
545
545
|
}
|
|
546
546
|
function emitSerialized(_this__u8e3s4, $this) {
|
|
547
|
-
var tmp = Spacer_instance.
|
|
548
|
-
var tmp_0 = Companion_instance_1.
|
|
547
|
+
var tmp = Spacer_instance.a27(3);
|
|
548
|
+
var tmp_0 = Companion_instance_1.a26(_this__u8e3s4.d25_1);
|
|
549
549
|
var tmp_1;
|
|
550
550
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
551
|
-
if (!_this__u8e3s4.
|
|
552
|
-
tmp_1 = 'java.util.Map.ofEntries(' + joinToString(_this__u8e3s4.
|
|
551
|
+
if (!_this__u8e3s4.e25_1.l()) {
|
|
552
|
+
tmp_1 = 'java.util.Map.ofEntries(' + joinToString(_this__u8e3s4.e25_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitSerialized$lambda($this)) + ')';
|
|
553
553
|
} else {
|
|
554
554
|
tmp_1 = 'java.util.Collections.emptyMap()';
|
|
555
555
|
}
|
|
556
|
-
return tmp + 'if (response instanceof Response' + tmp_0 + ' r) { return new Wirespec.RawResponse(r.getStatus(), ' + tmp_1 + ', ' + (!(_this__u8e3s4.
|
|
556
|
+
return tmp + 'if (response instanceof Response' + tmp_0 + ' r) { return new Wirespec.RawResponse(r.getStatus(), ' + tmp_1 + ', ' + (!(_this__u8e3s4.f25_1 == null) ? 'serialization.serialize(r.body, ' + emitGetType(ensureNotNull(_this__u8e3s4.f25_1).c25_1, $this) + ')' : 'null') + '); }';
|
|
557
557
|
}
|
|
558
558
|
function emitDeserialized(_this__u8e3s4, $this) {
|
|
559
|
-
return Spacer_instance.
|
|
559
|
+
return Spacer_instance.a27(4) + 'case ' + _this__u8e3s4.d25_1 + ': return new Response' + Companion_instance_1.a26(_this__u8e3s4.d25_1) + '(' + emitDeserializedParams_0(_this__u8e3s4, $this) + ');';
|
|
560
560
|
}
|
|
561
561
|
function emitSerializedParams(_this__u8e3s4, $this, fields) {
|
|
562
|
-
return 'java.util.Map.entry("' + _this__u8e3s4.
|
|
562
|
+
return 'java.util.Map.entry("' + _this__u8e3s4.o24_1.b1() + '", serialization.serializeParam(request.' + fields + '.' + $this.i26(_this__u8e3s4.o24_1) + ', ' + emitGetType(_this__u8e3s4.p24_1, $this) + '))';
|
|
563
563
|
}
|
|
564
564
|
function emitDeserialized_0(_this__u8e3s4, $this) {
|
|
565
|
-
return Spacer_instance.
|
|
565
|
+
return Spacer_instance.a27(4) + 'serialization.deserialize(request.path().get(' + _this__u8e3s4.qd_1 + '), ' + emitGetType(_this__u8e3s4.rd_1.z24_1, $this) + ')';
|
|
566
566
|
}
|
|
567
567
|
function emitDeserializedParams_1(_this__u8e3s4, $this, fields) {
|
|
568
|
-
return Spacer_instance.
|
|
568
|
+
return Spacer_instance.a27(4) + 'serialization.deserializeParam(request.' + fields + '().getOrDefault("' + _this__u8e3s4.o24_1.b1() + '", java.util.Collections.emptyList()), ' + emitGetType(_this__u8e3s4.p24_1, $this) + ')';
|
|
569
569
|
}
|
|
570
570
|
function emitSerializedHeader(_this__u8e3s4, $this) {
|
|
571
|
-
return 'java.util.Map.entry("' + _this__u8e3s4.
|
|
571
|
+
return 'java.util.Map.entry("' + _this__u8e3s4.o24_1.b1() + '", serialization.serializeParam(r.getHeaders().' + $this.i26(_this__u8e3s4.o24_1) + '(), ' + emitGetType(_this__u8e3s4.p24_1, $this) + '))';
|
|
572
572
|
}
|
|
573
573
|
function emitIdentifier(_this__u8e3s4, $this) {
|
|
574
|
-
return 'serialization.serialize(request.path.' + Companion_instance_1.
|
|
574
|
+
return 'serialization.serialize(request.path.' + Companion_instance_1.b26($this.i26(_this__u8e3s4.y24_1)) + ', ' + emitGetType(_this__u8e3s4.z24_1, $this) + ')';
|
|
575
575
|
}
|
|
576
576
|
function emit_13(_this__u8e3s4, $this) {
|
|
577
|
-
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.
|
|
578
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
577
|
+
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.c25_1;
|
|
578
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.j25(tmp1_safe_receiver);
|
|
579
579
|
return tmp2_elvis_lhs == null ? 'Void' : tmp2_elvis_lhs;
|
|
580
580
|
}
|
|
581
581
|
function emit_14(_this__u8e3s4, $this) {
|
|
582
|
-
return $this.
|
|
582
|
+
return $this.j25(_this__u8e3s4.z24_1) + ' ' + $this.i26(_this__u8e3s4.y24_1);
|
|
583
583
|
}
|
|
584
584
|
function emitImports_0(_this__u8e3s4, $this) {
|
|
585
585
|
// Inline function 'kotlin.collections.map' call
|
|
@@ -591,7 +591,7 @@ function emitImports_0(_this__u8e3s4, $this) {
|
|
|
591
591
|
while (tmp0_iterator.h()) {
|
|
592
592
|
var element = tmp0_iterator.i();
|
|
593
593
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitImports.<anonymous>' call
|
|
594
|
-
if (!(_this__u8e3s4.
|
|
594
|
+
if (!(_this__u8e3s4.g26().b1() === element.c29_1)) {
|
|
595
595
|
destination.e(element);
|
|
596
596
|
}
|
|
597
597
|
}
|
|
@@ -601,46 +601,46 @@ function emitImports_0(_this__u8e3s4, $this) {
|
|
|
601
601
|
while (tmp0_iterator_0.h()) {
|
|
602
602
|
var item = tmp0_iterator_0.i();
|
|
603
603
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitImports.<anonymous>' call
|
|
604
|
-
var tmp$ret$3 = 'import ' + $this.
|
|
604
|
+
var tmp$ret$3 = 'import ' + $this.h2a().w26_1 + '.model.' + item.c29_1 + ';';
|
|
605
605
|
destination_0.e(tmp$ret$3);
|
|
606
606
|
}
|
|
607
607
|
var tmp = destination_0;
|
|
608
608
|
return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitImports$lambda);
|
|
609
609
|
}
|
|
610
610
|
function emitRequestFunctions(_this__u8e3s4, $this, endpoint) {
|
|
611
|
-
var tmp = Spacer_instance.
|
|
612
|
-
var tmp_0 = Spacer_instance.
|
|
613
|
-
var tmp_1 = Spacer_instance.
|
|
614
|
-
var tmp_2 = Spacer_instance.
|
|
615
|
-
var tmp_3 = joinToString(endpoint.
|
|
616
|
-
var tmp_4 = Spacer_instance.
|
|
611
|
+
var tmp = Spacer_instance.a27(2);
|
|
612
|
+
var tmp_0 = Spacer_instance.a27(3);
|
|
613
|
+
var tmp_1 = Spacer_instance.a27(4);
|
|
614
|
+
var tmp_2 = Spacer_instance.a27(4);
|
|
615
|
+
var tmp_3 = joinToString(endpoint.t24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitRequestFunctions$lambda($this));
|
|
616
|
+
var tmp_4 = Spacer_instance.a27(4);
|
|
617
617
|
var tmp_5;
|
|
618
618
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
619
|
-
if (!endpoint.
|
|
620
|
-
tmp_5 = 'java.util.Map.ofEntries(' + joinToString(endpoint.
|
|
619
|
+
if (!endpoint.u24_1.l()) {
|
|
620
|
+
tmp_5 = 'java.util.Map.ofEntries(' + joinToString(endpoint.u24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitRequestFunctions$lambda_0($this)) + ')';
|
|
621
621
|
} else {
|
|
622
622
|
tmp_5 = 'java.util.Collections.emptyMap()';
|
|
623
623
|
}
|
|
624
624
|
var tmp_6 = tmp_5;
|
|
625
|
-
var tmp_7 = Spacer_instance.
|
|
625
|
+
var tmp_7 = Spacer_instance.a27(4);
|
|
626
626
|
var tmp_8;
|
|
627
627
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
628
|
-
if (!endpoint.
|
|
629
|
-
tmp_8 = 'java.util.Map.ofEntries(' + joinToString(endpoint.
|
|
628
|
+
if (!endpoint.v24_1.l()) {
|
|
629
|
+
tmp_8 = 'java.util.Map.ofEntries(' + joinToString(endpoint.v24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitRequestFunctions$lambda_1($this)) + ')';
|
|
630
630
|
} else {
|
|
631
631
|
tmp_8 = 'java.util.Collections.emptyMap()';
|
|
632
632
|
}
|
|
633
633
|
var tmp_9 = tmp_8;
|
|
634
|
-
var tmp_10 = Spacer_instance.
|
|
634
|
+
var tmp_10 = Spacer_instance.a27(4);
|
|
635
635
|
var tmp_11;
|
|
636
|
-
if (!(_this__u8e3s4.
|
|
637
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
638
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
636
|
+
if (!(_this__u8e3s4.a25_1 == null)) {
|
|
637
|
+
var tmp0_safe_receiver = _this__u8e3s4.a25_1;
|
|
638
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c25_1;
|
|
639
639
|
tmp_11 = 'serialization.serialize(request.getBody(), ' + (tmp1_safe_receiver == null ? null : emitGetType(tmp1_safe_receiver, $this)) + ')';
|
|
640
640
|
} else {
|
|
641
641
|
tmp_11 = 'null';
|
|
642
642
|
}
|
|
643
|
-
return trimMargin('\n |' + tmp + 'static Wirespec.RawRequest toRequest(Wirespec.Serializer<String> serialization, Request request) {\n |' + tmp_0 + 'return new Wirespec.RawRequest(\n |' + tmp_1 + 'request.method.name(),\n |' + tmp_2 + 'java.util.List.of(' + tmp_3 + '),\n |' + tmp_4 + tmp_6 + ',\n |' + tmp_7 + tmp_9 + ',\n |' + tmp_10 + tmp_11 + '\n |' + Spacer_instance.
|
|
643
|
+
return trimMargin('\n |' + tmp + 'static Wirespec.RawRequest toRequest(Wirespec.Serializer<String> serialization, Request request) {\n |' + tmp_0 + 'return new Wirespec.RawRequest(\n |' + tmp_1 + 'request.method.name(),\n |' + tmp_2 + 'java.util.List.of(' + tmp_3 + '),\n |' + tmp_4 + tmp_6 + ',\n |' + tmp_7 + tmp_9 + ',\n |' + tmp_10 + tmp_11 + '\n |' + Spacer_instance.a27(3) + ');\n |' + Spacer_instance.a27(2) + '}\n |\n |' + Spacer_instance.a27(2) + 'static Request fromRequest(Wirespec.Deserializer<String> serialization, Wirespec.RawRequest request) {\n |' + Spacer_instance.a27(3) + 'return new Request(' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + ');\n |' + Spacer_instance.a27(2) + '}\n ');
|
|
644
644
|
}
|
|
645
645
|
function emitObject(_this__u8e3s4, $this, name, extends_0, block) {
|
|
646
646
|
var tmp;
|
|
@@ -654,14 +654,14 @@ function emitObject(_this__u8e3s4, $this, name, extends_0, block) {
|
|
|
654
654
|
}
|
|
655
655
|
function emitResponseInterfaces(_this__u8e3s4, $this) {
|
|
656
656
|
// Inline function 'kotlin.collections.map' call
|
|
657
|
-
var this_0 = distinctByStatus(_this__u8e3s4.
|
|
657
|
+
var this_0 = distinctByStatus(_this__u8e3s4.x24_1);
|
|
658
658
|
// Inline function 'kotlin.collections.mapTo' call
|
|
659
659
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
660
660
|
var tmp0_iterator = this_0.g();
|
|
661
661
|
while (tmp0_iterator.h()) {
|
|
662
662
|
var item = tmp0_iterator.i();
|
|
663
663
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitResponseInterfaces.<anonymous>' call
|
|
664
|
-
var tmp$ret$0 = emit_13(item.
|
|
664
|
+
var tmp$ret$0 = emit_13(item.f25_1, $this);
|
|
665
665
|
destination.e(tmp$ret$0);
|
|
666
666
|
}
|
|
667
667
|
var tmp = distinct(destination);
|
|
@@ -669,14 +669,14 @@ function emitResponseInterfaces(_this__u8e3s4, $this) {
|
|
|
669
669
|
}
|
|
670
670
|
function emitStatusInterfaces(_this__u8e3s4, $this) {
|
|
671
671
|
// Inline function 'kotlin.collections.map' call
|
|
672
|
-
var this_0 = _this__u8e3s4.
|
|
672
|
+
var this_0 = _this__u8e3s4.x24_1;
|
|
673
673
|
// Inline function 'kotlin.collections.mapTo' call
|
|
674
674
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
675
675
|
var tmp0_iterator = this_0.g();
|
|
676
676
|
while (tmp0_iterator.h()) {
|
|
677
677
|
var item = tmp0_iterator.i();
|
|
678
678
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitStatusInterfaces.<anonymous>' call
|
|
679
|
-
var tmp$ret$0 = new Char(first(item.
|
|
679
|
+
var tmp$ret$0 = new Char(first(item.d25_1));
|
|
680
680
|
destination.e(tmp$ret$0);
|
|
681
681
|
}
|
|
682
682
|
var tmp = distinct(destination);
|
|
@@ -689,17 +689,17 @@ function JavaEndpointDefinitionEmitter$emit$lambda(this$0) {
|
|
|
689
689
|
}
|
|
690
690
|
function JavaEndpointDefinitionEmitter$emit$lambda_0(this$0) {
|
|
691
691
|
return function (it) {
|
|
692
|
-
return this$0.
|
|
692
|
+
return this$0.i25(it);
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
function JavaEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
696
696
|
return function (it) {
|
|
697
|
-
return this$0.
|
|
697
|
+
return this$0.i25(it);
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
700
|
function JavaEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
701
701
|
return function (it) {
|
|
702
|
-
return this$0.
|
|
702
|
+
return this$0.v2a(it);
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
705
|
function JavaEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
@@ -722,27 +722,27 @@ function JavaEndpointDefinitionEmitter$emitConstructor$lambda(this$0) {
|
|
|
722
722
|
}
|
|
723
723
|
function JavaEndpointDefinitionEmitter$emitConstructor$lambda_0(this$0) {
|
|
724
724
|
return function (it) {
|
|
725
|
-
return this$0.
|
|
725
|
+
return this$0.i25(it);
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
728
|
function JavaEndpointDefinitionEmitter$emitConstructor$lambda_1(this$0) {
|
|
729
729
|
return function (it) {
|
|
730
|
-
return this$0.
|
|
730
|
+
return this$0.i25(it);
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
733
|
function JavaEndpointDefinitionEmitter$emitConstructor$lambda_2(this$0) {
|
|
734
734
|
return function (it) {
|
|
735
|
-
return this$0.
|
|
735
|
+
return this$0.i26(it.y24_1);
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
738
|
function JavaEndpointDefinitionEmitter$emitConstructor$lambda_3(this$0) {
|
|
739
739
|
return function (it) {
|
|
740
|
-
return this$0.
|
|
740
|
+
return this$0.i26(it.o24_1);
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
743
|
function JavaEndpointDefinitionEmitter$emitConstructor$lambda_4(this$0) {
|
|
744
744
|
return function (it) {
|
|
745
|
-
return this$0.
|
|
745
|
+
return this$0.i26(it.o24_1);
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
748
|
function JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda(this$0) {
|
|
@@ -762,22 +762,22 @@ function JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda_1(this$0) {
|
|
|
762
762
|
}
|
|
763
763
|
function JavaEndpointDefinitionEmitter$emit$lambda_6(this$0) {
|
|
764
764
|
return function (it) {
|
|
765
|
-
return this$0.
|
|
765
|
+
return this$0.i25(it);
|
|
766
766
|
};
|
|
767
767
|
}
|
|
768
768
|
function JavaEndpointDefinitionEmitter$emit$lambda_7(this$0) {
|
|
769
769
|
return function (it) {
|
|
770
|
-
return this$0.
|
|
770
|
+
return this$0.i26(it.o24_1);
|
|
771
771
|
};
|
|
772
772
|
}
|
|
773
773
|
function JavaEndpointDefinitionEmitter$emit$lambda_8(this$0) {
|
|
774
774
|
return function (it) {
|
|
775
|
-
return this$0.
|
|
775
|
+
return this$0.i25(it);
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
778
|
function JavaEndpointDefinitionEmitter$emitDeserializedParams$lambda_2(this$0) {
|
|
779
779
|
return function (it) {
|
|
780
|
-
return Spacer_instance.
|
|
780
|
+
return Spacer_instance.a27(4) + 'serialization.deserializeParam(response.headers().getOrDefault("' + it.o24_1.b1() + '", java.util.Collections.emptyList()), ' + emitGetType(it.p24_1, this$0) + ')';
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
783
|
function JavaEndpointDefinitionEmitter$emitSerialized$lambda(this$0) {
|
|
@@ -793,7 +793,7 @@ function JavaEndpointDefinitionEmitter$emitRequestFunctions$lambda(this$0) {
|
|
|
793
793
|
return function (it) {
|
|
794
794
|
var tmp;
|
|
795
795
|
if (it instanceof Literal) {
|
|
796
|
-
tmp = '"' + it.
|
|
796
|
+
tmp = '"' + it.t25_1 + '"';
|
|
797
797
|
} else {
|
|
798
798
|
if (it instanceof Param) {
|
|
799
799
|
tmp = emitIdentifier(it, this$0);
|
|
@@ -816,7 +816,7 @@ function JavaEndpointDefinitionEmitter$emitRequestFunctions$lambda_1(this$0) {
|
|
|
816
816
|
}
|
|
817
817
|
function JavaEndpointDefinitionEmitter$emitObject$lambda($block) {
|
|
818
818
|
return function (it) {
|
|
819
|
-
return Spacer_instance.
|
|
819
|
+
return Spacer_instance.a27(2) + $block(it);
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
function JavaEndpointDefinitionEmitter$emitResponseInterfaces$lambda(it) {
|
|
@@ -829,14 +829,14 @@ function JavaEndpointDefinitionEmitter() {
|
|
|
829
829
|
}
|
|
830
830
|
function JavaEnumDefinitionEmitter$emit$lambda(this$0) {
|
|
831
831
|
return function (it) {
|
|
832
|
-
return this$0.
|
|
832
|
+
return this$0.x2a(it) + '("' + it + '")';
|
|
833
833
|
};
|
|
834
834
|
}
|
|
835
835
|
function JavaEnumDefinitionEmitter() {
|
|
836
836
|
}
|
|
837
837
|
function Companion() {
|
|
838
838
|
Companion_instance_2 = this;
|
|
839
|
-
this.
|
|
839
|
+
this.k2b_1 = setOf(['abstract', 'continue', 'for', 'new', 'switch', 'assert', 'default', 'goto', 'package', 'synchronized', 'boolean', 'do', 'if', 'private', 'this', 'break', 'double', 'implements', 'protected', 'throw', 'byte', 'else', 'import', 'public', 'throws', 'case', 'enum', 'instanceof', 'return', 'transient', 'catch', 'extends', 'int', 'short', 'try', 'char', 'final', 'interface', 'static', 'void', 'class', 'finally', 'long', 'strictfp', 'volatile', 'const', 'float', 'native', 'super', 'while', 'true', 'false']);
|
|
840
840
|
}
|
|
841
841
|
var Companion_instance_2;
|
|
842
842
|
function Companion_getInstance() {
|
|
@@ -853,8 +853,8 @@ function JavaRefinedTypeDefinitionEmitter() {
|
|
|
853
853
|
}
|
|
854
854
|
function JavaShared() {
|
|
855
855
|
JavaShared_instance = this;
|
|
856
|
-
this.
|
|
857
|
-
this.
|
|
856
|
+
this.h2b_1 = 'community.flock.wirespec.java';
|
|
857
|
+
this.i2b_1 = trimMargin('\n |package ' + this.h2b_1 + ';\n |\n |import java.lang.reflect.Type;\n |import java.lang.reflect.ParameterizedType;\n |import java.util.List;\n |import java.util.Map;\n |\n |public interface Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { String getLabel(); }\n |' + Spacer_instance.toString() + 'interface Endpoint {}\n |' + Spacer_instance.toString() + 'interface Refined { String getValue(); }\n |' + Spacer_instance.toString() + 'interface Path {}\n |' + Spacer_instance.toString() + 'interface Queries {}\n |' + Spacer_instance.toString() + 'interface Headers {}\n |' + Spacer_instance.toString() + 'interface Handler {}\n |' + Spacer_instance.toString() + 'interface ServerEdge<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.a27(2) + 'Req from(RawRequest request);\n |' + Spacer_instance.a27(2) + 'RawResponse to(Res response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.a27(2) + 'RawRequest to(Req request);\n |' + Spacer_instance.a27(2) + 'Res from(RawResponse response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.a27(2) + 'String getPathTemplate();\n |' + Spacer_instance.a27(2) + 'String getMethod();\n |' + Spacer_instance.a27(2) + 'ClientEdge<Req, Res> getClient(Serialization<String> serialization);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Server<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.a27(2) + 'String getPathTemplate();\n |' + Spacer_instance.a27(2) + 'String getMethod();\n |' + Spacer_instance.a27(2) + 'ServerEdge<Req, Res> getServer(Serialization<String> serialization);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'enum Method { GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH, TRACE }\n |' + Spacer_instance.toString() + 'interface Request<T> { Path getPath(); Method getMethod(); Queries getQueries(); Headers getHeaders(); T getBody(); interface Headers extends Wirespec.Headers {} }\n |' + Spacer_instance.toString() + 'interface Response<T> { int getStatus(); Headers getHeaders(); T getBody(); interface Headers extends Wirespec.Headers {} }\n |' + Spacer_instance.toString() + 'interface ParamSerialization extends ParamSerializer, ParamDeserializer {}\n |' + Spacer_instance.toString() + 'interface Serialization<RAW> extends Serializer<RAW>, Deserializer<RAW>, ParamSerialization {}\n |' + Spacer_instance.toString() + 'interface ParamSerializer { <T> List<String> serializeParam(T value, Type type); }\n |' + Spacer_instance.toString() + 'interface Serializer<RAW> extends ParamSerializer { <T> RAW serialize(T t, Type type); }\n |' + Spacer_instance.toString() + 'interface ParamDeserializer { <T> T deserializeParam(List<String> values, Type type); }\n |' + Spacer_instance.toString() + 'interface Deserializer<RAW> extends ParamDeserializer { <T> T deserialize(RAW raw, Type type); }\n |' + Spacer_instance.toString() + 'record RawRequest(String method, List<String> path, Map<String, List<String>> queries, Map<String, List<String>> headers, String body) {} \n |' + Spacer_instance.toString() + 'record RawResponse(int statusCode, Map<String, List<String>> headers, String body) {}\n |' + Spacer_instance.toString() + 'static Type getType(final Class<?> actualTypeArguments, final Class<?> rawType) {\n |' + Spacer_instance.a27(2) + 'if(rawType != null) {\n |' + Spacer_instance.a27(3) + 'return new ParameterizedType() {\n |' + Spacer_instance.a27(4) + 'public Type getRawType() { return rawType; }\n |' + Spacer_instance.a27(4) + 'public Type[] getActualTypeArguments() { return new Class<?>[]{actualTypeArguments}; }\n |' + Spacer_instance.a27(4) + 'public Type getOwnerType() { return null; }\n |' + Spacer_instance.a27(3) + '};\n |' + Spacer_instance.a27(2) + '}\n |' + Spacer_instance.a27(2) + 'else { return actualTypeArguments; }\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
858
858
|
}
|
|
859
859
|
protoOf(JavaShared).toString = function () {
|
|
860
860
|
return 'JavaShared';
|
|
@@ -879,10 +879,10 @@ function JavaShared_getInstance() {
|
|
|
879
879
|
function emitType(_this__u8e3s4, $this) {
|
|
880
880
|
var tmp;
|
|
881
881
|
if (_this__u8e3s4 instanceof Dict) {
|
|
882
|
-
tmp = 'java.util.Map<String, ' + $this.
|
|
882
|
+
tmp = 'java.util.Map<String, ' + $this.j25(_this__u8e3s4.u23_1) + '>';
|
|
883
883
|
} else {
|
|
884
884
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
885
|
-
tmp = 'java.util.List<' + $this.
|
|
885
|
+
tmp = 'java.util.List<' + $this.j25(_this__u8e3s4.r23_1) + '>';
|
|
886
886
|
} else {
|
|
887
887
|
if (_this__u8e3s4 instanceof Unit) {
|
|
888
888
|
tmp = 'void';
|
|
@@ -891,7 +891,7 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
891
891
|
tmp = 'Object';
|
|
892
892
|
} else {
|
|
893
893
|
if (_this__u8e3s4 instanceof Custom) {
|
|
894
|
-
tmp = _this__u8e3s4.
|
|
894
|
+
tmp = _this__u8e3s4.c29_1;
|
|
895
895
|
} else {
|
|
896
896
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
897
897
|
tmp = emit_15(_this__u8e3s4, $this);
|
|
@@ -906,14 +906,14 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
906
906
|
return tmp;
|
|
907
907
|
}
|
|
908
908
|
function emit_15(_this__u8e3s4, $this) {
|
|
909
|
-
var t = _this__u8e3s4.
|
|
909
|
+
var t = _this__u8e3s4.g29_1;
|
|
910
910
|
var tmp;
|
|
911
911
|
if (t instanceof String_0) {
|
|
912
912
|
tmp = 'String';
|
|
913
913
|
} else {
|
|
914
914
|
if (t instanceof Integer) {
|
|
915
915
|
var tmp_0;
|
|
916
|
-
switch (t.
|
|
916
|
+
switch (t.l28_1.r2_1) {
|
|
917
917
|
case 0:
|
|
918
918
|
tmp_0 = 'Integer';
|
|
919
919
|
break;
|
|
@@ -928,7 +928,7 @@ function emit_15(_this__u8e3s4, $this) {
|
|
|
928
928
|
} else {
|
|
929
929
|
if (t instanceof Number_0) {
|
|
930
930
|
var tmp_1;
|
|
931
|
-
switch (t.
|
|
931
|
+
switch (t.o28_1.r2_1) {
|
|
932
932
|
case 0:
|
|
933
933
|
tmp_1 = 'Float';
|
|
934
934
|
break;
|
|
@@ -957,12 +957,12 @@ function emit_15(_this__u8e3s4, $this) {
|
|
|
957
957
|
}
|
|
958
958
|
function JavaTypeDefinitionEmitter$emit$lambda(this$0) {
|
|
959
959
|
return function (it) {
|
|
960
|
-
return this$0.
|
|
960
|
+
return this$0.j25(it);
|
|
961
961
|
};
|
|
962
962
|
}
|
|
963
963
|
function JavaTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
964
964
|
return function (it) {
|
|
965
|
-
return Spacer_instance.toString() + this$0.
|
|
965
|
+
return Spacer_instance.toString() + this$0.i25(it) + ',';
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
968
|
function JavaTypeDefinitionEmitter() {
|
|
@@ -973,27 +973,27 @@ function JavaUnionDefinitionEmitter$emit$lambda(it) {
|
|
|
973
973
|
function JavaUnionDefinitionEmitter() {
|
|
974
974
|
}
|
|
975
975
|
//region block: post-declaration
|
|
976
|
-
protoOf(JavaEmitter).
|
|
977
|
-
protoOf(JavaEmitter).
|
|
978
|
-
protoOf(JavaEmitter).
|
|
979
|
-
protoOf(JavaEmitter).
|
|
980
|
-
protoOf(JavaEmitter).
|
|
981
|
-
protoOf(JavaEmitter).
|
|
982
|
-
protoOf(JavaEmitter).
|
|
983
|
-
protoOf(JavaEmitter).
|
|
984
|
-
protoOf(JavaEmitter).
|
|
985
|
-
protoOf(JavaEmitter).
|
|
986
|
-
protoOf(JavaEmitter).
|
|
987
|
-
protoOf(JavaEmitter).
|
|
988
|
-
protoOf(JavaEmitter).
|
|
989
|
-
protoOf(JavaEmitter).
|
|
990
|
-
protoOf(JavaEmitter).
|
|
991
|
-
protoOf(JavaEmitter).
|
|
992
|
-
protoOf(JavaEmitter).
|
|
993
|
-
protoOf(JavaEmitter).
|
|
994
|
-
protoOf(JavaEmitter).
|
|
995
|
-
protoOf(JavaEmitter).
|
|
996
|
-
protoOf(JavaEmitter).
|
|
976
|
+
protoOf(JavaEmitter).i26 = emit_7;
|
|
977
|
+
protoOf(JavaEmitter).g25 = emit_0;
|
|
978
|
+
protoOf(JavaEmitter).h25 = emit_1;
|
|
979
|
+
protoOf(JavaEmitter).i25 = emit_2;
|
|
980
|
+
protoOf(JavaEmitter).j25 = emit_3;
|
|
981
|
+
protoOf(JavaEmitter).k25 = emit_4;
|
|
982
|
+
protoOf(JavaEmitter).t26 = emit_9;
|
|
983
|
+
protoOf(JavaEmitter).u2a = emit_10;
|
|
984
|
+
protoOf(JavaEmitter).v2a = emit_11;
|
|
985
|
+
protoOf(JavaEmitter).j26 = emit_5;
|
|
986
|
+
protoOf(JavaEmitter).s26 = emit_8;
|
|
987
|
+
protoOf(JavaEmitter).k26 = emit_12;
|
|
988
|
+
protoOf(JavaEmitter).o26 = emit_6;
|
|
989
|
+
protoOf(JavaEmitter).j2b = sanitizeSymbol;
|
|
990
|
+
protoOf(JavaEmitter).j2a = sanitizeFirstIsDigit;
|
|
991
|
+
protoOf(JavaEmitter).k2a = sanitizeKeywords;
|
|
992
|
+
protoOf(JavaEmitter).a2b = emitRoot;
|
|
993
|
+
protoOf(JavaEmitter).z2a = emitRoot$default;
|
|
994
|
+
protoOf(JavaEmitter).w2a = emitHandleFunction;
|
|
995
|
+
protoOf(JavaEmitter).x2a = sanitizeEnum;
|
|
996
|
+
protoOf(JavaEmitter).u26 = emitValidator;
|
|
997
997
|
//endregion
|
|
998
998
|
//region block: exports
|
|
999
999
|
export {
|