@flock/wirespec 0.17.14 → 0.17.16
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/kotlin-kotlin-stdlib.mjs +3 -3
- package/kotlinx-io-kotlinx-io-core.mjs +2 -2
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +116 -122
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +148 -106
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +140 -104
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +65 -32
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +148 -105
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +20 -20
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +13 -13
- package/wirespec-src-converter-avro.mjs +4 -4
- package/wirespec-src-converter-openapi.mjs +73 -62
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +10 -10
- package/wirespec-src-plugin-npm.mjs +2 -2
- package/wirespec-src-tools-generator.mjs +4 -4
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
equals2au1ep9vhcato as equals,
|
|
77
77
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
78
78
|
dropLastlqc2oyv04br0 as dropLast,
|
|
79
|
+
charSequenceLength3278n89t01tmv as charSequenceLength,
|
|
79
80
|
replace3le3ie7l9k8aq as replace,
|
|
80
81
|
} from './kotlin-kotlin-stdlib.mjs';
|
|
81
82
|
//region block: imports
|
|
@@ -113,10 +114,10 @@ function emit_3(_this__u8e3s4) {
|
|
|
113
114
|
function emitRoot(_this__u8e3s4, void_0) {
|
|
114
115
|
var tmp;
|
|
115
116
|
if (_this__u8e3s4 instanceof Dict) {
|
|
116
|
-
tmp = this.
|
|
117
|
+
tmp = this.y2a(_this__u8e3s4.e23_1);
|
|
117
118
|
} else {
|
|
118
119
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
119
|
-
tmp = this.
|
|
120
|
+
tmp = this.y2a(_this__u8e3s4.b23_1);
|
|
120
121
|
} else {
|
|
121
122
|
if (_this__u8e3s4 instanceof Unit) {
|
|
122
123
|
tmp = void_0;
|
|
@@ -145,15 +146,45 @@ function emitRoot(_this__u8e3s4, void_0) {
|
|
|
145
146
|
}
|
|
146
147
|
function emitRoot$default(_this__u8e3s4, void_0, $super) {
|
|
147
148
|
void_0 = void_0 === VOID ? 'void' : void_0;
|
|
148
|
-
return $super === VOID ? this.
|
|
149
|
+
return $super === VOID ? this.z2a(_this__u8e3s4, void_0) : emitRoot(_this__u8e3s4, void_0);
|
|
149
150
|
}
|
|
150
151
|
function emit_4(_this__u8e3s4) {
|
|
151
152
|
var tmp;
|
|
152
153
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
153
|
-
tmp = 'java.util.regex.Pattern.compile("' + replace(this.b25(_this__u8e3s4.a28_1), '\\', '\\\\') + '").matcher(record.value).find();';
|
|
154
|
+
tmp = 'return java.util.regex.Pattern.compile("' + replace(this.b25(_this__u8e3s4.a28_1), '\\', '\\\\') + '").matcher(record.value).find();';
|
|
154
155
|
} else {
|
|
155
156
|
if (_this__u8e3s4 instanceof Bound) {
|
|
156
|
-
|
|
157
|
+
var tmp1_safe_receiver = _this__u8e3s4.o28_1;
|
|
158
|
+
var tmp_0;
|
|
159
|
+
if (tmp1_safe_receiver == null) {
|
|
160
|
+
tmp_0 = null;
|
|
161
|
+
} else {
|
|
162
|
+
// Inline function 'kotlin.let' call
|
|
163
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
164
|
+
// Inline function 'community.flock.wirespec.emitters.java.JavaTypeDefinitionEmitter.emit.<anonymous>' call
|
|
165
|
+
tmp_0 = tmp1_safe_receiver + ' < record.value';
|
|
166
|
+
}
|
|
167
|
+
var minCheck = tmp_0;
|
|
168
|
+
var tmp2_safe_receiver = _this__u8e3s4.p28_1;
|
|
169
|
+
var tmp_1;
|
|
170
|
+
if (tmp2_safe_receiver == null) {
|
|
171
|
+
tmp_1 = null;
|
|
172
|
+
} else {
|
|
173
|
+
// Inline function 'kotlin.let' call
|
|
174
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
175
|
+
// Inline function 'community.flock.wirespec.emitters.java.JavaTypeDefinitionEmitter.emit.<anonymous>' call
|
|
176
|
+
tmp_1 = 'record.value < ' + tmp2_safe_receiver;
|
|
177
|
+
}
|
|
178
|
+
var maxCheck = tmp_1;
|
|
179
|
+
var checks = joinToString(listOfNotNull([minCheck, maxCheck]), ' && ');
|
|
180
|
+
var tmp_2;
|
|
181
|
+
// Inline function 'kotlin.text.isEmpty' call
|
|
182
|
+
if (charSequenceLength(checks) === 0) {
|
|
183
|
+
tmp_2 = 'true';
|
|
184
|
+
} else {
|
|
185
|
+
tmp_2 = checks;
|
|
186
|
+
}
|
|
187
|
+
tmp = 'return ' + tmp_2 + ';';
|
|
157
188
|
} else {
|
|
158
189
|
noWhenBranchMatchedException();
|
|
159
190
|
}
|
|
@@ -162,16 +193,16 @@ function emit_4(_this__u8e3s4) {
|
|
|
162
193
|
}
|
|
163
194
|
initMetadataForInterface(JavaTypeDefinitionEmitter, 'JavaTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter]);
|
|
164
195
|
function emit_5(channel) {
|
|
165
|
-
return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |@FunctionalInterface\n |public interface ' + this.y25(channel.o23_1) + ' {\n | void invoke(' + emitFullyQualified(channel, this, channel.p23_1) + this.
|
|
196
|
+
return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |@FunctionalInterface\n |public interface ' + this.y25(channel.o23_1) + ' {\n | void invoke(' + emitFullyQualified(channel, this, channel.p23_1) + this.y2a(channel.p23_1) + ' message);\n |}\n |\n ');
|
|
166
197
|
}
|
|
167
198
|
initMetadataForInterface(JavaChannelDefinitionEmitter, 'JavaChannelDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
168
199
|
function emit_6(identifier) {
|
|
169
200
|
var tmp;
|
|
170
201
|
if (identifier instanceof DefinitionIdentifier) {
|
|
171
|
-
tmp = this.
|
|
202
|
+
tmp = this.i2b(identifier.b1());
|
|
172
203
|
} else {
|
|
173
204
|
if (identifier instanceof FieldIdentifier) {
|
|
174
|
-
tmp = this.
|
|
205
|
+
tmp = this.j2a(this.i2b(identifier.b1()));
|
|
175
206
|
} else {
|
|
176
207
|
noWhenBranchMatchedException();
|
|
177
208
|
}
|
|
@@ -194,7 +225,7 @@ function sanitizeSymbol(_this__u8e3s4) {
|
|
|
194
225
|
destination.e(tmp$ret$0);
|
|
195
226
|
}
|
|
196
227
|
var tmp = asSequence(joinToString(destination, ''));
|
|
197
|
-
return this.
|
|
228
|
+
return this.i2a(joinToString_0(filter(tmp, JavaIdentifierEmitter$sanitizeSymbol$lambda), ''));
|
|
198
229
|
}
|
|
199
230
|
function sanitizeFirstIsDigit(_this__u8e3s4) {
|
|
200
231
|
var tmp;
|
|
@@ -214,22 +245,30 @@ function sanitizeFirstIsDigit(_this__u8e3s4) {
|
|
|
214
245
|
return tmp;
|
|
215
246
|
}
|
|
216
247
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
217
|
-
return Companion_getInstance().
|
|
248
|
+
return Companion_getInstance().j2b_1.o1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
218
249
|
}
|
|
219
250
|
initMetadataForInterface(JavaIdentifierEmitter, 'JavaIdentifierEmitter');
|
|
220
|
-
function emit_7(
|
|
251
|
+
function emit_7(enum_0, module_0) {
|
|
252
|
+
var tmp = this.y25(enum_0.i26_1);
|
|
253
|
+
return trimMargin('\n |public enum ' + tmp + ' implements Wirespec.Enum {\n |' + spacer(joinToString(enum_0.j26_1, ',\n', VOID, VOID, VOID, VOID, JavaEnumDefinitionEmitter$emit$lambda(this))) + ';\n |' + Spacer_instance.toString() + 'public final String label;\n |' + Spacer_instance.toString() + this.y25(enum_0.i26_1) + '(String label) {\n |' + Spacer_instance.s26(2) + 'this.label = label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String toString() {\n |' + Spacer_instance.s26(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String getLabel() {\n |' + Spacer_instance.s26(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
254
|
+
}
|
|
255
|
+
function sanitizeEnum(_this__u8e3s4) {
|
|
256
|
+
return this.j2a(this.i2a(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
|
|
257
|
+
}
|
|
258
|
+
initMetadataForInterface(JavaEnumDefinitionEmitter, 'JavaEnumDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
|
|
259
|
+
function emit_8(union) {
|
|
221
260
|
var tmp = this.y25(union.s23_1);
|
|
222
261
|
return trimMargin('\n |public sealed interface ' + tmp + ' permits ' + joinToString(union.t23_1, VOID, VOID, VOID, VOID, VOID, JavaUnionDefinitionEmitter$emit$lambda) + ' {}\n |\n ');
|
|
223
262
|
}
|
|
224
263
|
initMetadataForInterface(JavaUnionDefinitionEmitter, 'JavaUnionDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
|
|
225
|
-
function
|
|
264
|
+
function emit_9(endpoint) {
|
|
226
265
|
var tmp = emitImports_0(endpoint, this);
|
|
227
266
|
var tmp_0 = this.y25(endpoint.g24_1);
|
|
228
267
|
var tmp_1 = get_pathParams(endpoint);
|
|
229
268
|
var tmp_2 = emitObject(tmp_1, this, 'Path', 'Wirespec.Path', JavaEndpointDefinitionEmitter$emit$lambda(this));
|
|
230
269
|
var tmp_3 = emitObject(endpoint.j24_1, this, 'Queries', 'Wirespec.Queries', JavaEndpointDefinitionEmitter$emit$lambda_0(this));
|
|
231
270
|
var tmp_4 = emitObject(endpoint.k24_1, this, 'RequestHeaders', 'Wirespec.Request.Headers', JavaEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
232
|
-
var tmp_5 = this.
|
|
271
|
+
var tmp_5 = this.t2a(first_0(endpoint.l24_1), endpoint);
|
|
233
272
|
var tmp_6 = Spacer_instance.toString();
|
|
234
273
|
var tmp_7 = emitStatusInterfaces(endpoint, this);
|
|
235
274
|
var tmp_8 = emitResponseInterfaces(endpoint, this);
|
|
@@ -262,55 +301,60 @@ function emit_8(endpoint) {
|
|
|
262
301
|
var tmp_23 = Spacer_instance.s26(3);
|
|
263
302
|
var tmp_24 = Spacer_instance.s26(2);
|
|
264
303
|
var tmp_25 = Spacer_instance.s26(2);
|
|
265
|
-
var tmp_26 = this.
|
|
304
|
+
var tmp_26 = this.v2a(endpoint);
|
|
266
305
|
var tmp_27 = Spacer_instance.s26(2);
|
|
267
306
|
var tmp_28 = Spacer_instance.s26(3);
|
|
268
|
-
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 serialization, Response<?> response) {\n |' + tmp_15 + '\n |' + tmp_16 + 'else { throw new IllegalStateException("Cannot match response with status: " + response.
|
|
307
|
+
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 serialization, Response<?> response) {\n |' + tmp_15 + '\n |' + tmp_16 + 'else { throw new IllegalStateException("Cannot match response with status: " + response.status());}\n |' + tmp_17 + '}\n |\n |' + tmp_18 + 'static Response<?> fromResponse(Wirespec.Deserializer 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.i24_1, '/', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_5) + '"; }\n |' + Spacer_instance.s26(3) + '@Override public String getMethod() { return "' + endpoint.h24_1.toString() + '"; }\n |' + Spacer_instance.s26(3) + '@Override public Wirespec.ServerEdge<Request, Response<?>> getServer(Wirespec.Serialization serialization) {\n |' + Spacer_instance.s26(4) + 'return new Wirespec.ServerEdge<>() {\n |' + Spacer_instance.s26(5) + '@Override public Request from(Wirespec.RawRequest request) { return fromRequest(serialization, request); }\n |' + Spacer_instance.s26(5) + '@Override public Wirespec.RawResponse to(Response<?> response) { return toResponse(serialization, response); }\n |' + Spacer_instance.s26(4) + '};\n |' + Spacer_instance.s26(3) + '}\n |' + Spacer_instance.s26(3) + '@Override public Wirespec.ClientEdge<Request, Response<?>> getClient(Wirespec.Serialization serialization) {\n |' + Spacer_instance.s26(4) + 'return new Wirespec.ClientEdge<>() {\n |' + Spacer_instance.s26(5) + '@Override public Wirespec.RawRequest to(Request request) { return toRequest(serialization, request); }\n |' + Spacer_instance.s26(5) + '@Override public Response<?> from(Wirespec.RawResponse response) { return fromResponse(serialization, response); }\n |' + Spacer_instance.s26(4) + '};\n |' + Spacer_instance.s26(3) + '}\n |' + Spacer_instance.s26(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
269
308
|
}
|
|
270
309
|
function emitHandleFunction(endpoint) {
|
|
271
310
|
return 'java.util.concurrent.CompletableFuture<Response<?>> ' + Companion_instance_1.r25(this.y25(endpoint.g24_1)) + '(Request request);';
|
|
272
311
|
}
|
|
273
|
-
function
|
|
274
|
-
return trimMargin('\n |' + Spacer_instance.toString() + '
|
|
312
|
+
function emit_10(_this__u8e3s4, endpoint) {
|
|
313
|
+
return trimMargin('\n |' + Spacer_instance.toString() + 'record Request (\n |' + Spacer_instance.s26(2) + 'Path path,\n |' + Spacer_instance.s26(2) + 'Wirespec.Method method,\n |' + Spacer_instance.s26(2) + 'Queries queries,\n |' + Spacer_instance.s26(2) + 'RequestHeaders headers,\n |' + Spacer_instance.s26(2) + emit_13(_this__u8e3s4.p24_1, this) + ' body\n |' + Spacer_instance.toString() + ') implements Wirespec.Request<' + emit_13(_this__u8e3s4.p24_1, this) + '> {\n |' + Spacer_instance.s26(2) + emitConstructor(_this__u8e3s4, this, endpoint) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
275
314
|
}
|
|
276
|
-
function
|
|
315
|
+
function emit_11(_this__u8e3s4) {
|
|
277
316
|
var tmp = Spacer_instance.toString();
|
|
278
317
|
var tmp_0 = Companion_instance_1.q25(_this__u8e3s4.s24_1);
|
|
279
|
-
var tmp_1 =
|
|
318
|
+
var tmp_1 = Spacer_instance.s26(2);
|
|
319
|
+
var tmp_2 = Spacer_instance.s26(2);
|
|
320
|
+
var tmp_3 = Spacer_instance.s26(2);
|
|
321
|
+
var tmp_4 = emit_13(_this__u8e3s4.u24_1, this);
|
|
322
|
+
var tmp_5 = Spacer_instance.toString();
|
|
323
|
+
var tmp_6 = toString_0(first(_this__u8e3s4.s24_1));
|
|
324
|
+
var tmp_7 = emit_13(_this__u8e3s4.u24_1, this);
|
|
325
|
+
var tmp_8 = concatGenerics(emit_13(_this__u8e3s4.u24_1, this));
|
|
326
|
+
var tmp_9 = Spacer_instance.s26(2);
|
|
327
|
+
var tmp_10 = Companion_instance_1.q25(_this__u8e3s4.s24_1);
|
|
328
|
+
var tmp_11 = orNull(joinToString(_this__u8e3s4.t24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_6(this)));
|
|
280
329
|
var tmp0_safe_receiver = _this__u8e3s4.u24_1;
|
|
281
|
-
var
|
|
330
|
+
var tmp_12;
|
|
282
331
|
if (tmp0_safe_receiver == null) {
|
|
283
|
-
|
|
332
|
+
tmp_12 = null;
|
|
284
333
|
} else {
|
|
285
334
|
// Inline function 'kotlin.let' call
|
|
286
335
|
// Inline function 'kotlin.contracts.contract' call
|
|
287
336
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
288
|
-
|
|
337
|
+
tmp_12 = emit_13(tmp0_safe_receiver, this) + ' body';
|
|
289
338
|
}
|
|
290
|
-
var
|
|
291
|
-
var
|
|
292
|
-
var
|
|
293
|
-
var tmp_6 = concatGenerics(emit_13(_this__u8e3s4.u24_1, this));
|
|
294
|
-
var tmp_7 = Spacer_instance.s26(2);
|
|
295
|
-
var tmp_8 = fixStatus(_this__u8e3s4.s24_1);
|
|
296
|
-
var tmp_9 = Spacer_instance.s26(2);
|
|
339
|
+
var tmp_13 = joinToString(listOfNotNull([tmp_11, tmp_12]));
|
|
340
|
+
var tmp_14 = Spacer_instance.s26(3);
|
|
341
|
+
var tmp_15 = fixStatus(_this__u8e3s4.s24_1);
|
|
297
342
|
// Inline function 'kotlin.let' call
|
|
298
343
|
// Inline function 'kotlin.contracts.contract' call
|
|
299
344
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emit.<anonymous>' call
|
|
300
|
-
var
|
|
301
|
-
var
|
|
302
|
-
var
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
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.t24_1, this, 'Headers', 'Wirespec.Response.Headers', JavaEndpointDefinitionEmitter$emit$lambda_8(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
345
|
+
var tmp_16 = 'new Headers(' + joinToString(_this__u8e3s4.t24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_7(this)) + ')';
|
|
346
|
+
var tmp_17 = _this__u8e3s4.u24_1 == null ? 'null' : 'body';
|
|
347
|
+
var tmp_18 = Spacer_instance.s26(2);
|
|
348
|
+
var tmp_19 = Spacer_instance.s26(1);
|
|
349
|
+
return trimMargin('\n |' + tmp + 'record Response' + tmp_0 + '(\n |' + tmp_1 + 'int status,\n |' + tmp_2 + 'Headers headers,\n |' + tmp_3 + tmp_4 + ' body\n |' + tmp_5 + ') implements Response' + tmp_6 + 'XX<' + tmp_7 + '>, Response' + tmp_8 + ' {\n |' + tmp_9 + 'public Response' + tmp_10 + '(' + tmp_13 + ') {\n |' + tmp_14 + 'this(' + tmp_15 + ', ' + tmp_16 + ', ' + tmp_17 + ');\n |' + tmp_18 + '}\n |' + tmp_19 + emitObject(_this__u8e3s4.t24_1, this, 'Headers', 'Wirespec.Response.Headers', JavaEndpointDefinitionEmitter$emit$lambda_8(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
306
350
|
}
|
|
307
351
|
initMetadataForInterface(JavaEndpointDefinitionEmitter, 'JavaEndpointDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
308
|
-
function
|
|
309
|
-
return trimMargin('\n |public record ' + this.y25(refined.d26_1) + ' (
|
|
352
|
+
function emit_12(refined) {
|
|
353
|
+
return trimMargin('\n |public record ' + this.y25(refined.d26_1) + ' (' + this.z24(refined.e26_1) + ' value) implements Wirespec.Refined<' + this.z24(refined.e26_1) + '> {\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String toString() { return value.toString(); }\n |' + Spacer_instance.toString() + 'public static boolean validate(' + this.y25(refined.d26_1) + ' record) {\n |' + Spacer_instance.toString() + Spacer_instance.toString() + this.m26(refined) + '\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public ' + this.z24(refined.e26_1) + ' getValue() { return value; }\n |}\n |\n ');
|
|
310
354
|
}
|
|
311
355
|
function emitValidator(_this__u8e3s4) {
|
|
312
|
-
var defaultReturn = 'true;';
|
|
313
|
-
var type = _this__u8e3s4.e26_1.
|
|
356
|
+
var defaultReturn = 'return true;';
|
|
357
|
+
var type = _this__u8e3s4.e26_1.n29_1;
|
|
314
358
|
var tmp;
|
|
315
359
|
if (type instanceof Integer) {
|
|
316
360
|
var tmp0_safe_receiver = type.t28_1;
|
|
@@ -318,7 +362,7 @@ function emitValidator(_this__u8e3s4) {
|
|
|
318
362
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
319
363
|
} else {
|
|
320
364
|
if (type instanceof Number_0) {
|
|
321
|
-
var tmp2_safe_receiver = type.
|
|
365
|
+
var tmp2_safe_receiver = type.w28_1;
|
|
322
366
|
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.a25(tmp2_safe_receiver);
|
|
323
367
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
324
368
|
} else {
|
|
@@ -349,15 +393,7 @@ function emitValidator(_this__u8e3s4) {
|
|
|
349
393
|
return tmp;
|
|
350
394
|
}
|
|
351
395
|
initMetadataForInterface(JavaRefinedTypeDefinitionEmitter, 'JavaRefinedTypeDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
|
|
352
|
-
|
|
353
|
-
var tmp = this.y25(enum_0.i26_1);
|
|
354
|
-
return trimMargin('\n |public enum ' + tmp + ' implements Wirespec.Enum {\n |' + spacer(joinToString(enum_0.j26_1, ',\n', VOID, VOID, VOID, VOID, JavaEnumDefinitionEmitter$emit$lambda(this))) + ';\n |' + Spacer_instance.toString() + 'public final String label;\n |' + Spacer_instance.toString() + this.y25(enum_0.i26_1) + '(String label) {\n |' + Spacer_instance.s26(2) + 'this.label = label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String toString() {\n |' + Spacer_instance.s26(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + '@Override\n |' + Spacer_instance.toString() + 'public String getLabel() {\n |' + Spacer_instance.s26(2) + 'return label;\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
355
|
-
}
|
|
356
|
-
function sanitizeEnum(_this__u8e3s4) {
|
|
357
|
-
return this.k2a(this.j2a(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
|
|
358
|
-
}
|
|
359
|
-
initMetadataForInterface(JavaEnumDefinitionEmitter, 'JavaEnumDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
|
|
360
|
-
initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaIdentifierEmitter, JavaChannelDefinitionEmitter, JavaTypeDefinitionEmitter, JavaUnionDefinitionEmitter, JavaEndpointDefinitionEmitter, JavaRefinedTypeDefinitionEmitter, JavaEnumDefinitionEmitter, LanguageEmitter]);
|
|
396
|
+
initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaEnumDefinitionEmitter, JavaChannelDefinitionEmitter, JavaUnionDefinitionEmitter, JavaIdentifierEmitter, JavaEndpointDefinitionEmitter, JavaTypeDefinitionEmitter, JavaRefinedTypeDefinitionEmitter, LanguageEmitter]);
|
|
361
397
|
initMetadataForCompanion(Companion);
|
|
362
398
|
initMetadataForObject(JavaShared, 'JavaShared');
|
|
363
399
|
//endregion
|
|
@@ -371,7 +407,7 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
371
407
|
while (tmp0_iterator.h()) {
|
|
372
408
|
var element = tmp0_iterator.i();
|
|
373
409
|
// Inline function 'community.flock.wirespec.emitters.java.JavaChannelDefinitionEmitter.emitImports.<anonymous>' call
|
|
374
|
-
if (!(_this__u8e3s4.x25().b1() === element.
|
|
410
|
+
if (!(_this__u8e3s4.x25().b1() === element.j29_1)) {
|
|
375
411
|
destination.e(element);
|
|
376
412
|
}
|
|
377
413
|
}
|
|
@@ -381,7 +417,7 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
381
417
|
while (tmp0_iterator_0.h()) {
|
|
382
418
|
var item = tmp0_iterator_0.i();
|
|
383
419
|
// Inline function 'community.flock.wirespec.emitters.java.JavaChannelDefinitionEmitter.emitImports.<anonymous>' call
|
|
384
|
-
var tmp$ret$3 = 'import ' + $this.
|
|
420
|
+
var tmp$ret$3 = 'import ' + $this.g2a().o26_1 + '.model.' + item.j29_1 + ';';
|
|
385
421
|
destination_0.e(tmp$ret$3);
|
|
386
422
|
}
|
|
387
423
|
var tmp = destination_0;
|
|
@@ -390,7 +426,7 @@ function emitImports(_this__u8e3s4, $this) {
|
|
|
390
426
|
function emitFullyQualified(_this__u8e3s4, $this, reference) {
|
|
391
427
|
var tmp;
|
|
392
428
|
if (_this__u8e3s4.x25().b1() === reference.b1()) {
|
|
393
|
-
tmp = $this.
|
|
429
|
+
tmp = $this.g2a().o26_1 + '.model.';
|
|
394
430
|
} else {
|
|
395
431
|
tmp = '';
|
|
396
432
|
}
|
|
@@ -406,46 +442,46 @@ function JavaEmitter(packageName, emitShared) {
|
|
|
406
442
|
packageName = packageName === VOID ? Companion_instance.n26('community.flock.wirespec.generated') : packageName;
|
|
407
443
|
emitShared = emitShared === VOID ? Companion_instance_0.i23() : emitShared;
|
|
408
444
|
LanguageEmitter.call(this);
|
|
409
|
-
this.
|
|
410
|
-
this.
|
|
411
|
-
this.
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
this.
|
|
415
|
-
}
|
|
416
|
-
protoOf(JavaEmitter).
|
|
417
|
-
return this.
|
|
445
|
+
this.a2b_1 = packageName;
|
|
446
|
+
this.b2b_1 = emitShared;
|
|
447
|
+
this.c2b_1 = '\nimport community.flock.wirespec.java.Wirespec;\n';
|
|
448
|
+
this.d2b_1 = FileExtension_Java_getInstance();
|
|
449
|
+
this.e2b_1 = JavaShared_getInstance();
|
|
450
|
+
this.f2b_1 = '//';
|
|
451
|
+
}
|
|
452
|
+
protoOf(JavaEmitter).g2a = function () {
|
|
453
|
+
return this.a2b_1;
|
|
418
454
|
};
|
|
419
455
|
protoOf(JavaEmitter).g25 = function () {
|
|
420
|
-
return this.
|
|
456
|
+
return this.d2b_1;
|
|
421
457
|
};
|
|
422
|
-
protoOf(JavaEmitter).
|
|
423
|
-
return this.
|
|
458
|
+
protoOf(JavaEmitter).q2a = function () {
|
|
459
|
+
return this.e2b_1;
|
|
424
460
|
};
|
|
425
461
|
protoOf(JavaEmitter).h25 = function () {
|
|
426
|
-
return this.
|
|
462
|
+
return this.f2b_1;
|
|
427
463
|
};
|
|
428
464
|
protoOf(JavaEmitter).v25 = function (module_0, logger) {
|
|
429
465
|
// Inline function 'kotlin.let' call
|
|
430
466
|
// Inline function 'kotlin.contracts.contract' call
|
|
431
467
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEmitter.emit.<anonymous>' call
|
|
432
468
|
var it = protoOf(LanguageEmitter).v25.call(this, module_0, logger);
|
|
433
|
-
return this.
|
|
469
|
+
return this.b2b_1.j23_1 ? it.vk(new Emitted(Companion_instance.n26('community.flock.wirespec.java').q26() + 'Wirespec', this.q2a().h2b_1)) : it;
|
|
434
470
|
};
|
|
435
471
|
protoOf(JavaEmitter).w25 = function (definition, module_0, logger) {
|
|
436
472
|
// Inline function 'kotlin.let' call
|
|
437
473
|
// Inline function 'kotlin.contracts.contract' call
|
|
438
474
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEmitter.emit.<anonymous>' call
|
|
439
475
|
var it = protoOf(LanguageEmitter).w25.call(this, definition, module_0, logger);
|
|
440
|
-
var subPackageName = plus(this.
|
|
441
|
-
var tmp = subPackageName.q26() + this.
|
|
476
|
+
var subPackageName = plus(this.g2a(), definition);
|
|
477
|
+
var tmp = subPackageName.q26() + this.i2b(it.k23_1);
|
|
442
478
|
// Inline function 'kotlin.text.trimStart' call
|
|
443
|
-
var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.s25(module_0) ? this.
|
|
479
|
+
var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.s25(module_0) ? this.c2b_1 : '') + '\n |' + it.l23_1 + '\n ');
|
|
444
480
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
445
481
|
return new Emitted(tmp, tmp$ret$0);
|
|
446
482
|
};
|
|
447
483
|
function emitGetType(_this__u8e3s4, $this) {
|
|
448
|
-
return 'Wirespec.getType(' + $this.
|
|
484
|
+
return 'Wirespec.getType(' + $this.z2a(_this__u8e3s4, 'Void') + '.class, ' + emitGetTypeRaw(_this__u8e3s4, $this) + ')';
|
|
449
485
|
}
|
|
450
486
|
function emitGetTypeRaw(_this__u8e3s4, $this) {
|
|
451
487
|
var tmp;
|
|
@@ -482,16 +518,22 @@ function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
|
482
518
|
var tmp_6 = get_pathParams(endpoint);
|
|
483
519
|
// Inline function 'kotlin.contracts.contract' call
|
|
484
520
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
485
|
-
var
|
|
486
|
-
var
|
|
521
|
+
var tmp$ret$3 = 'new Path(' + joinToString(tmp_6, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_2($this)) + ')';
|
|
522
|
+
var tmp1_elvis_lhs = orNull(tmp$ret$3);
|
|
523
|
+
var tmp_7 = tmp1_elvis_lhs == null ? 'new Path()' : tmp1_elvis_lhs;
|
|
524
|
+
var tmp_8 = 'Wirespec.Method.' + endpoint.h24_1.q2_1;
|
|
487
525
|
// Inline function 'kotlin.let' call
|
|
488
526
|
// Inline function 'kotlin.contracts.contract' call
|
|
489
527
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
490
|
-
var
|
|
528
|
+
var tmp$ret$5 = 'new Queries(' + joinToString(endpoint.j24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_3($this)) + ')';
|
|
529
|
+
var tmp2_elvis_lhs = orNull(tmp$ret$5);
|
|
530
|
+
var tmp_9 = tmp2_elvis_lhs == null ? 'new Queries()' : tmp2_elvis_lhs;
|
|
491
531
|
// Inline function 'kotlin.let' call
|
|
492
532
|
// Inline function 'kotlin.contracts.contract' call
|
|
493
533
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
494
|
-
var
|
|
534
|
+
var tmp$ret$7 = 'new RequestHeaders(' + joinToString(endpoint.k24_1, VOID, VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitConstructor$lambda_4($this)) + ')';
|
|
535
|
+
var tmp3_elvis_lhs = orNull(tmp$ret$7);
|
|
536
|
+
var tmp_10 = tmp3_elvis_lhs == null ? 'new RequestHeaders()' : tmp3_elvis_lhs;
|
|
495
537
|
var tmp_11;
|
|
496
538
|
if (_this__u8e3s4.p24_1 == null) {
|
|
497
539
|
tmp_11 = null;
|
|
@@ -501,8 +543,8 @@ function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
|
501
543
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitConstructor.<anonymous>' call
|
|
502
544
|
tmp_11 = 'body';
|
|
503
545
|
}
|
|
504
|
-
var
|
|
505
|
-
return 'public Request(' + tmp_4 + ') {\n' + tmp_5 + joinToString(listOfNotNull([tmp_7, tmp_8, tmp_9, tmp_10,
|
|
546
|
+
var tmp5_elvis_lhs = tmp_11;
|
|
547
|
+
return 'public Request(' + tmp_4 + ') {\n' + tmp_5 + 'this(' + joinToString(listOfNotNull([tmp_7, tmp_8, tmp_9, tmp_10, tmp5_elvis_lhs == null ? 'null' : tmp5_elvis_lhs])) + ');\n' + Spacer_instance.s26(2) + '}';
|
|
506
548
|
}
|
|
507
549
|
function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
508
550
|
// Inline function 'kotlin.let' call
|
|
@@ -553,13 +595,13 @@ function emitSerialized(_this__u8e3s4, $this) {
|
|
|
553
595
|
} else {
|
|
554
596
|
tmp_1 = 'java.util.Collections.emptyMap()';
|
|
555
597
|
}
|
|
556
|
-
return tmp + 'if (response instanceof Response' + tmp_0 + ' r) { return new Wirespec.RawResponse(r.
|
|
598
|
+
return tmp + 'if (response instanceof Response' + tmp_0 + ' r) { return new Wirespec.RawResponse(r.status(), ' + tmp_1 + ', ' + (!(_this__u8e3s4.u24_1 == null) ? 'serialization.serializeBody(r.body, ' + emitGetType(ensureNotNull(_this__u8e3s4.u24_1).r24_1, $this) + ')' : 'null') + '); }';
|
|
557
599
|
}
|
|
558
600
|
function emitDeserialized(_this__u8e3s4, $this) {
|
|
559
601
|
return Spacer_instance.s26(4) + 'case ' + _this__u8e3s4.s24_1 + ': return new Response' + Companion_instance_1.q25(_this__u8e3s4.s24_1) + '(' + emitDeserializedParams_0(_this__u8e3s4, $this) + ');';
|
|
560
602
|
}
|
|
561
603
|
function emitSerializedParams(_this__u8e3s4, $this, fields) {
|
|
562
|
-
return 'java.util.Map.entry("' + _this__u8e3s4.c24_1.b1() + '", serialization.serializeParam(request.' + fields + '.' + $this.y25(_this__u8e3s4.c24_1) + ', ' + emitGetType(_this__u8e3s4.d24_1, $this) + '))';
|
|
604
|
+
return 'java.util.Map.entry("' + _this__u8e3s4.c24_1.b1() + '", serialization.serializeParam(request.' + (fields === 'queries' ? 'queries' : 'headers') + '().' + $this.y25(_this__u8e3s4.c24_1) + '(), ' + emitGetType(_this__u8e3s4.d24_1, $this) + '))';
|
|
563
605
|
}
|
|
564
606
|
function emitDeserialized_0(_this__u8e3s4, $this) {
|
|
565
607
|
return Spacer_instance.s26(4) + 'serialization.deserializePath(request.path().get(' + _this__u8e3s4.qd_1 + '), ' + emitGetType(_this__u8e3s4.rd_1.o24_1, $this) + ')';
|
|
@@ -568,10 +610,10 @@ function emitDeserializedParams_1(_this__u8e3s4, $this, fields) {
|
|
|
568
610
|
return Spacer_instance.s26(4) + 'serialization.deserializeParam(request.' + fields + '().getOrDefault("' + _this__u8e3s4.c24_1.b1() + '", java.util.Collections.emptyList()), ' + emitGetType(_this__u8e3s4.d24_1, $this) + ')';
|
|
569
611
|
}
|
|
570
612
|
function emitSerializedHeader(_this__u8e3s4, $this) {
|
|
571
|
-
return 'java.util.Map.entry("' + _this__u8e3s4.c24_1.b1() + '", serialization.serializeParam(r.
|
|
613
|
+
return 'java.util.Map.entry("' + _this__u8e3s4.c24_1.b1() + '", serialization.serializeParam(r.headers().' + $this.y25(_this__u8e3s4.c24_1) + '(), ' + emitGetType(_this__u8e3s4.d24_1, $this) + '))';
|
|
572
614
|
}
|
|
573
615
|
function emitIdentifier(_this__u8e3s4, $this) {
|
|
574
|
-
return 'serialization.serializePath(request.path.' + Companion_instance_1.r25($this.y25(_this__u8e3s4.n24_1)) + ', ' + emitGetType(_this__u8e3s4.o24_1, $this) + ')';
|
|
616
|
+
return 'serialization.serializePath(request.path().' + Companion_instance_1.r25($this.y25(_this__u8e3s4.n24_1)) + '(), ' + emitGetType(_this__u8e3s4.o24_1, $this) + ')';
|
|
575
617
|
}
|
|
576
618
|
function emit_13(_this__u8e3s4, $this) {
|
|
577
619
|
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.r24_1;
|
|
@@ -591,7 +633,7 @@ function emitImports_0(_this__u8e3s4, $this) {
|
|
|
591
633
|
while (tmp0_iterator.h()) {
|
|
592
634
|
var element = tmp0_iterator.i();
|
|
593
635
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitImports.<anonymous>' call
|
|
594
|
-
if (!(_this__u8e3s4.x25().b1() === element.
|
|
636
|
+
if (!(_this__u8e3s4.x25().b1() === element.j29_1)) {
|
|
595
637
|
destination.e(element);
|
|
596
638
|
}
|
|
597
639
|
}
|
|
@@ -601,7 +643,7 @@ function emitImports_0(_this__u8e3s4, $this) {
|
|
|
601
643
|
while (tmp0_iterator_0.h()) {
|
|
602
644
|
var item = tmp0_iterator_0.i();
|
|
603
645
|
// Inline function 'community.flock.wirespec.emitters.java.JavaEndpointDefinitionEmitter.emitImports.<anonymous>' call
|
|
604
|
-
var tmp$ret$3 = 'import ' + $this.
|
|
646
|
+
var tmp$ret$3 = 'import ' + $this.g2a().o26_1 + '.model.' + item.j29_1 + ';';
|
|
605
647
|
destination_0.e(tmp$ret$3);
|
|
606
648
|
}
|
|
607
649
|
var tmp = destination_0;
|
|
@@ -636,16 +678,16 @@ function emitRequestFunctions(_this__u8e3s4, $this, endpoint) {
|
|
|
636
678
|
if (!(_this__u8e3s4.p24_1 == null)) {
|
|
637
679
|
var tmp0_safe_receiver = _this__u8e3s4.p24_1;
|
|
638
680
|
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r24_1;
|
|
639
|
-
tmp_11 = 'serialization.serializeBody(request.
|
|
681
|
+
tmp_11 = 'serialization.serializeBody(request.body(), ' + (tmp1_safe_receiver == null ? null : emitGetType(tmp1_safe_receiver, $this)) + ')';
|
|
640
682
|
} else {
|
|
641
683
|
tmp_11 = 'null';
|
|
642
684
|
}
|
|
643
|
-
return trimMargin('\n |' + tmp + 'static Wirespec.RawRequest toRequest(Wirespec.Serializer 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.s26(3) + ');\n |' + Spacer_instance.s26(2) + '}\n |\n |' + Spacer_instance.s26(2) + 'static Request fromRequest(Wirespec.Deserializer serialization, Wirespec.RawRequest request) {\n |' + Spacer_instance.s26(3) + 'return new Request(' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + ');\n |' + Spacer_instance.s26(2) + '}\n ');
|
|
685
|
+
return trimMargin('\n |' + tmp + 'static Wirespec.RawRequest toRequest(Wirespec.Serializer 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.s26(3) + ');\n |' + Spacer_instance.s26(2) + '}\n |\n |' + Spacer_instance.s26(2) + 'static Request fromRequest(Wirespec.Deserializer serialization, Wirespec.RawRequest request) {\n |' + Spacer_instance.s26(3) + 'return new Request(' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + ');\n |' + Spacer_instance.s26(2) + '}\n ');
|
|
644
686
|
}
|
|
645
687
|
function emitObject(_this__u8e3s4, $this, name, extends_0, block) {
|
|
646
688
|
var tmp;
|
|
647
689
|
if (_this__u8e3s4.l()) {
|
|
648
|
-
tmp = Spacer_instance.toString() + 'class ' + name + ' implements ' + extends_0 + ' {}';
|
|
690
|
+
tmp = Spacer_instance.toString() + 'static class ' + name + ' implements ' + extends_0 + ' {}';
|
|
649
691
|
} else {
|
|
650
692
|
var tmp_0 = Spacer_instance.toString();
|
|
651
693
|
tmp = trimMargin('\n |' + tmp_0 + 'public record ' + name + '(\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emitObject$lambda(block)) + '\n |' + Spacer_instance.toString() + ') implements ' + extends_0 + ' {}\n ');
|
|
@@ -699,7 +741,7 @@ function JavaEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
|
699
741
|
}
|
|
700
742
|
function JavaEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
701
743
|
return function (it) {
|
|
702
|
-
return this$0.
|
|
744
|
+
return this$0.u2a(it);
|
|
703
745
|
};
|
|
704
746
|
}
|
|
705
747
|
function JavaEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
@@ -829,14 +871,14 @@ function JavaEndpointDefinitionEmitter() {
|
|
|
829
871
|
}
|
|
830
872
|
function JavaEnumDefinitionEmitter$emit$lambda(this$0) {
|
|
831
873
|
return function (it) {
|
|
832
|
-
return this$0.
|
|
874
|
+
return this$0.w2a(it) + '("' + it + '")';
|
|
833
875
|
};
|
|
834
876
|
}
|
|
835
877
|
function JavaEnumDefinitionEmitter() {
|
|
836
878
|
}
|
|
837
879
|
function Companion() {
|
|
838
880
|
Companion_instance_2 = this;
|
|
839
|
-
this.
|
|
881
|
+
this.j2b_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
882
|
}
|
|
841
883
|
var Companion_instance_2;
|
|
842
884
|
function Companion_getInstance() {
|
|
@@ -853,8 +895,8 @@ function JavaRefinedTypeDefinitionEmitter() {
|
|
|
853
895
|
}
|
|
854
896
|
function JavaShared() {
|
|
855
897
|
JavaShared_instance = this;
|
|
856
|
-
this.
|
|
857
|
-
this.
|
|
898
|
+
this.g2b_1 = 'community.flock.wirespec.java';
|
|
899
|
+
this.h2b_1 = trimMargin('\n |package ' + this.g2b_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<T> { T 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.s26(2) + 'Req from(RawRequest request);\n |' + Spacer_instance.s26(2) + 'RawResponse to(Res response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.s26(2) + 'RawRequest to(Req request);\n |' + Spacer_instance.s26(2) + 'Res from(RawResponse response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.s26(2) + 'String getPathTemplate();\n |' + Spacer_instance.s26(2) + 'String getMethod();\n |' + Spacer_instance.s26(2) + 'ClientEdge<Req, Res> getClient(Serialization serialization);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Server<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.s26(2) + 'String getPathTemplate();\n |' + Spacer_instance.s26(2) + 'String getMethod();\n |' + Spacer_instance.s26(2) + 'ServerEdge<Req, Res> getServer(Serialization 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 path(); Method method(); Queries queries(); Headers headers(); T body(); interface Headers extends Wirespec.Headers {} }\n |' + Spacer_instance.toString() + 'interface Response<T> { int status(); Headers headers(); T body(); interface Headers extends Wirespec.Headers {} }\n |' + Spacer_instance.toString() + 'interface Serialization extends Serializer, Deserializer {}\n |' + Spacer_instance.toString() + 'interface Serializer extends BodySerializer, PathSerializer, ParamSerializer {}\n |' + Spacer_instance.toString() + 'interface Deserializer extends BodyDeserializer, PathDeserializer, ParamDeserializer {}\n |' + Spacer_instance.toString() + 'interface BodySerialization extends BodySerializer, BodyDeserializer {}\n |' + Spacer_instance.toString() + 'interface BodySerializer { <T> byte[] serializeBody(T t, Type type); }\n |' + Spacer_instance.toString() + 'interface BodyDeserializer { <T> T deserializeBody(byte[] raw, Type type); }\n |' + Spacer_instance.toString() + 'interface PathSerialization extends PathSerializer, PathDeserializer {}\n |' + Spacer_instance.toString() + 'interface PathSerializer { <T> String serializePath(T t, Type type); }\n |' + Spacer_instance.toString() + 'interface PathDeserializer { <T> T deserializePath(String raw, Type type); }\n |' + Spacer_instance.toString() + 'interface ParamSerialization extends ParamSerializer, ParamDeserializer {}\n |' + Spacer_instance.toString() + 'interface ParamSerializer { <T> List<String> serializeParam(T value, Type type); }\n |' + Spacer_instance.toString() + 'interface ParamDeserializer { <T> T deserializeParam(List<String> values, Type type); }\n |' + Spacer_instance.toString() + 'record RawRequest(String method, List<String> path, Map<String, List<String>> queries, Map<String, List<String>> headers, byte[] body) {} \n |' + Spacer_instance.toString() + 'record RawResponse(int statusCode, Map<String, List<String>> headers, byte[] body) {}\n |' + Spacer_instance.toString() + 'static Type getType(final Class<?> actualTypeArguments, final Class<?> rawType) {\n |' + Spacer_instance.s26(2) + 'if(rawType != null) {\n |' + Spacer_instance.s26(3) + 'return new ParameterizedType() {\n |' + Spacer_instance.s26(4) + 'public Type getRawType() { return rawType; }\n |' + Spacer_instance.s26(4) + 'public Type[] getActualTypeArguments() { return new Class<?>[]{actualTypeArguments}; }\n |' + Spacer_instance.s26(4) + 'public Type getOwnerType() { return null; }\n |' + Spacer_instance.s26(3) + '};\n |' + Spacer_instance.s26(2) + '}\n |' + Spacer_instance.s26(2) + 'else { return actualTypeArguments; }\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
858
900
|
}
|
|
859
901
|
protoOf(JavaShared).toString = function () {
|
|
860
902
|
return 'JavaShared';
|
|
@@ -891,7 +933,7 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
891
933
|
tmp = 'Object';
|
|
892
934
|
} else {
|
|
893
935
|
if (_this__u8e3s4 instanceof Custom) {
|
|
894
|
-
tmp = _this__u8e3s4.
|
|
936
|
+
tmp = _this__u8e3s4.j29_1;
|
|
895
937
|
} else {
|
|
896
938
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
897
939
|
tmp = emit_15(_this__u8e3s4, $this);
|
|
@@ -906,7 +948,7 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
906
948
|
return tmp;
|
|
907
949
|
}
|
|
908
950
|
function emit_15(_this__u8e3s4, $this) {
|
|
909
|
-
var t = _this__u8e3s4.
|
|
951
|
+
var t = _this__u8e3s4.n29_1;
|
|
910
952
|
var tmp;
|
|
911
953
|
if (t instanceof String_0) {
|
|
912
954
|
tmp = 'String';
|
|
@@ -928,7 +970,7 @@ function emit_15(_this__u8e3s4, $this) {
|
|
|
928
970
|
} else {
|
|
929
971
|
if (t instanceof Number_0) {
|
|
930
972
|
var tmp_1;
|
|
931
|
-
switch (t.
|
|
973
|
+
switch (t.v28_1.r2_1) {
|
|
932
974
|
case 0:
|
|
933
975
|
tmp_1 = 'Float';
|
|
934
976
|
break;
|
|
@@ -979,20 +1021,20 @@ protoOf(JavaEmitter).x24 = emit_1;
|
|
|
979
1021
|
protoOf(JavaEmitter).y24 = emit_2;
|
|
980
1022
|
protoOf(JavaEmitter).z24 = emit_3;
|
|
981
1023
|
protoOf(JavaEmitter).a25 = emit_4;
|
|
982
|
-
protoOf(JavaEmitter).l26 =
|
|
983
|
-
protoOf(JavaEmitter).
|
|
984
|
-
protoOf(JavaEmitter).
|
|
1024
|
+
protoOf(JavaEmitter).l26 = emit_9;
|
|
1025
|
+
protoOf(JavaEmitter).t2a = emit_10;
|
|
1026
|
+
protoOf(JavaEmitter).u2a = emit_11;
|
|
985
1027
|
protoOf(JavaEmitter).z25 = emit_5;
|
|
986
|
-
protoOf(JavaEmitter).k26 =
|
|
987
|
-
protoOf(JavaEmitter).a26 =
|
|
988
|
-
protoOf(JavaEmitter).f26 =
|
|
989
|
-
protoOf(JavaEmitter).
|
|
990
|
-
protoOf(JavaEmitter).
|
|
991
|
-
protoOf(JavaEmitter).
|
|
992
|
-
protoOf(JavaEmitter).
|
|
993
|
-
protoOf(JavaEmitter).
|
|
994
|
-
protoOf(JavaEmitter).
|
|
995
|
-
protoOf(JavaEmitter).
|
|
1028
|
+
protoOf(JavaEmitter).k26 = emit_7;
|
|
1029
|
+
protoOf(JavaEmitter).a26 = emit_8;
|
|
1030
|
+
protoOf(JavaEmitter).f26 = emit_12;
|
|
1031
|
+
protoOf(JavaEmitter).i2b = sanitizeSymbol;
|
|
1032
|
+
protoOf(JavaEmitter).i2a = sanitizeFirstIsDigit;
|
|
1033
|
+
protoOf(JavaEmitter).j2a = sanitizeKeywords;
|
|
1034
|
+
protoOf(JavaEmitter).z2a = emitRoot;
|
|
1035
|
+
protoOf(JavaEmitter).y2a = emitRoot$default;
|
|
1036
|
+
protoOf(JavaEmitter).v2a = emitHandleFunction;
|
|
1037
|
+
protoOf(JavaEmitter).w2a = sanitizeEnum;
|
|
996
1038
|
protoOf(JavaEmitter).m26 = emitValidator;
|
|
997
1039
|
//endregion
|
|
998
1040
|
//region block: exports
|