@flock/wirespec 0.18.13 → 0.18.15

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.
Files changed (34) hide show
  1. package/clikt-clikt-mordant.mjs +39 -39
  2. package/colormath-root-colormath.mjs +432 -432
  3. package/kotlin-kotlin-stdlib.mjs +25 -15
  4. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  5. package/kotlin-openapi-bindings.mjs +9842 -9842
  6. package/kotlin-rgxgen.mjs +1758 -1758
  7. package/kotlinx-io-kotlinx-io-core.mjs +404 -404
  8. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1775 -1775
  9. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1466 -1466
  10. package/mordant-mordant.mjs +1190 -1190
  11. package/package.json +13 -2
  12. package/wirespec-msw.d.ts +53 -0
  13. package/wirespec-msw.mjs +83 -0
  14. package/wirespec-src-compiler-emitters-java.mjs +79 -79
  15. package/wirespec-src-compiler-emitters-kotlin.mjs +192 -128
  16. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  17. package/wirespec-src-compiler-emitters-python.mjs +129 -129
  18. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  19. package/wirespec-src-compiler-emitters-rust.mjs +68 -54
  20. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
  21. package/wirespec-src-compiler-emitters-scala.mjs +29 -29
  22. package/wirespec-src-compiler-emitters-typescript.mjs +125 -98
  23. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  24. package/wirespec-src-compiler-emitters-wirespec.mjs +31 -31
  25. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  26. package/wirespec-src-compiler-ir.mjs +144 -134
  27. package/wirespec-src-compiler-ir.mjs.map +1 -1
  28. package/wirespec-src-converter-avro.mjs +479 -479
  29. package/wirespec-src-converter-openapi.mjs +320 -320
  30. package/wirespec-src-ide-lsp.mjs +1348 -1348
  31. package/wirespec-src-plugin-arguments.mjs +136 -136
  32. package/wirespec-src-plugin-cli.mjs +84 -84
  33. package/wirespec-src-plugin-npm.mjs +10 -10
  34. package/wirespec-src-tools-generator.mjs +2 -2
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@flock/wirespec",
3
- "version": "0.18.13",
3
+ "version": "0.18.15",
4
4
  "main": "wirespec-src-plugin-npm.mjs",
5
5
  "types": "wirespec-src-plugin-npm.d.mts",
6
6
  "devDependencies": {
7
7
  "typescript": "5.9.3"
8
8
  },
9
9
  "dependencies": {},
10
- "peerDependencies": {},
10
+ "peerDependencies": {
11
+ "msw": "^2.0.0"
12
+ },
11
13
  "optionalDependencies": {},
12
14
  "bundledDependencies": [],
13
15
  "bin": {
@@ -27,6 +29,15 @@
27
29
  "./serialization": {
28
30
  "types": "./wirespec-serialization.d.ts",
29
31
  "default": "./wirespec-serialization.mjs"
32
+ },
33
+ "./msw": {
34
+ "types": "./wirespec-msw.d.ts",
35
+ "default": "./wirespec-msw.mjs"
36
+ }
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "msw": {
40
+ "optional": true
30
41
  }
31
42
  },
32
43
  "repository": {
@@ -0,0 +1,53 @@
1
+ import type { RequestHandler } from 'msw'
2
+ import type { Serialization } from './wirespec-serialization'
3
+
4
+ // Mirrors the generated `Wirespec.RawRequest` / `RawResponse` so generated endpoint `api`
5
+ // objects are assignable to WirespecMswEndpoint (the method union must match exactly).
6
+ type Method = 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH' | 'TRACE'
7
+
8
+ type RawRequest = {
9
+ method: Method
10
+ path: string[]
11
+ queries: Record<string, string>
12
+ headers: Record<string, string>
13
+ body?: string
14
+ }
15
+
16
+ type RawResponse = {
17
+ status: number
18
+ headers: Record<string, string>
19
+ body?: string
20
+ }
21
+
22
+ /**
23
+ * Structural mirror of the generated `Wirespec.Api<Req, Res>` type. The shipped module
24
+ * cannot import the consumer's per-project generated `Wirespec` namespace, so the shape
25
+ * is redeclared here; generated endpoint `api` objects are assignable to it.
26
+ */
27
+ export type WirespecMswEndpoint<Req, Res> = {
28
+ method: string
29
+ path: string
30
+ server: (serialization: Serialization) => {
31
+ from: (request: RawRequest) => Req
32
+ to: (response: Res) => RawResponse
33
+ }
34
+ }
35
+
36
+ export type WirespecMswOptions = {
37
+ /** Host or path prefix prepended to the contract path, e.g. "https://api.example.com" or "/api". */
38
+ baseUrl?: string
39
+ /** Override the serialization used to (de)serialize requests/responses. */
40
+ serialization?: Serialization
41
+ }
42
+
43
+ /**
44
+ * Build a typed MSW request handler for a generated Wirespec endpoint.
45
+ *
46
+ * The generics are inferred from `api.server`, constraining `resolver` to the endpoint's
47
+ * own request/response types: returning a response from a different endpoint is a compile error.
48
+ */
49
+ export declare function wirespec<Req, Res>(
50
+ api: WirespecMswEndpoint<Req, Res>,
51
+ resolver: (request: Req) => Res | Promise<Res>,
52
+ options?: WirespecMswOptions,
53
+ ): RequestHandler
@@ -0,0 +1,83 @@
1
+ import { http, HttpResponse } from 'msw'
2
+ import { wirespecSerialization } from './wirespec-serialization.mjs'
3
+
4
+ const METHODS = {
5
+ GET: 'get',
6
+ PUT: 'put',
7
+ POST: 'post',
8
+ DELETE: 'delete',
9
+ PATCH: 'patch',
10
+ HEAD: 'head',
11
+ OPTIONS: 'options',
12
+ }
13
+
14
+ const PARAM = /^:(.+)$/
15
+ const BRACE = /^\{(.+)\}$/
16
+
17
+ const segments = (path) => path.replace(/^\/+/, '').split('/').filter((s) => s.length > 0)
18
+
19
+ // Normalize a Wirespec contract path into an MSW matcher: `{id}` -> `:id`, single leading slash.
20
+ const normalizePath = (path) => {
21
+ const colon = path.replace(/\{([^/}]+)\}/g, ':$1')
22
+ return colon.startsWith('/') ? colon : `/${colon}`
23
+ }
24
+
25
+ // Without a baseUrl, prefix the contract path with `*` so it matches on any origin
26
+ // (a bare relative path is not matched against absolute request URLs in Node). With a
27
+ // baseUrl, pin the origin/prefix instead.
28
+ const matcher = (baseUrl, path) => {
29
+ const normalized = normalizePath(path)
30
+ return baseUrl ? `${baseUrl.replace(/\/+$/, '')}${normalized}` : `*${normalized}`
31
+ }
32
+
33
+ // Rebuild the positional RawRequest.path from the contract template, substituting MSW's
34
+ // matched params for `:name`/`{name}` segments. Using the template (not the raw URL) keeps
35
+ // path-param indices aligned with the contract even when a baseUrl prefix is present.
36
+ const buildPath = (templatePath, params) =>
37
+ segments(templatePath).map((segment) => {
38
+ const match = segment.match(PARAM) ?? segment.match(BRACE)
39
+ if (!match) return segment
40
+ const value = params[match[1]]
41
+ return Array.isArray(value) ? value[0] : value
42
+ })
43
+
44
+ const readBody = async (request) => {
45
+ if (request.method === 'GET' || request.method === 'HEAD') return undefined
46
+ const text = await request.text()
47
+ return text.length > 0 ? text : undefined
48
+ }
49
+
50
+ /**
51
+ * Build an MSW request handler for a generated Wirespec endpoint `api`.
52
+ *
53
+ * The resolver receives the deserialized, typed Wirespec request and must return one of
54
+ * that endpoint's responses; a response from a different endpoint is a compile error.
55
+ *
56
+ * Options:
57
+ * - baseUrl: host or path prefix to prepend to the contract path (e.g. "https://api.example.com").
58
+ * - serialization: override the (de)serializer (defaults to wirespecSerialization).
59
+ */
60
+ export function wirespec(api, resolver, options = {}) {
61
+ const serialization = options.serialization ?? wirespecSerialization
62
+ const pattern = matcher(options.baseUrl, api.path)
63
+ const method = METHODS[String(api.method).toUpperCase()] ?? 'all'
64
+ const endpoint = api.server(serialization)
65
+
66
+ return http[method](pattern, async ({ request, params }) => {
67
+ const url = new URL(request.url)
68
+ const rawRequest = {
69
+ method: request.method,
70
+ path: buildPath(api.path, params),
71
+ queries: Object.fromEntries(url.searchParams),
72
+ headers: Object.fromEntries(request.headers),
73
+ body: await readBody(request),
74
+ }
75
+ const typedRequest = endpoint.from(rawRequest)
76
+ const response = await resolver(typedRequest)
77
+ const rawResponse = endpoint.to(response)
78
+ return new HttpResponse(rawResponse.body ?? null, {
79
+ status: rawResponse.status,
80
+ headers: rawResponse.headers,
81
+ })
82
+ })
83
+ }
@@ -197,10 +197,10 @@ function emit_6(_this__u8e3s4) {
197
197
  function emitRoot(_this__u8e3s4, void_0) {
198
198
  var tmp;
199
199
  if (_this__u8e3s4 instanceof Dict) {
200
- tmp = this.j1v(_this__u8e3s4.go_1);
200
+ tmp = this.l1v(_this__u8e3s4.go_1);
201
201
  } else {
202
202
  if (_this__u8e3s4 instanceof Iterable) {
203
- tmp = this.j1v(_this__u8e3s4.do_1);
203
+ tmp = this.l1v(_this__u8e3s4.do_1);
204
204
  } else {
205
205
  if (_this__u8e3s4 instanceof Unit) {
206
206
  tmp = void_0;
@@ -229,7 +229,7 @@ function emitRoot(_this__u8e3s4, void_0) {
229
229
  }
230
230
  function emitRoot$default(_this__u8e3s4, void_0, $super) {
231
231
  void_0 = void_0 === VOID ? 'void' : void_0;
232
- return $super === VOID ? this.k1v(_this__u8e3s4, void_0) : emitRoot(_this__u8e3s4, void_0);
232
+ return $super === VOID ? this.m1v(_this__u8e3s4, void_0) : emitRoot(_this__u8e3s4, void_0);
233
233
  }
234
234
  function emit_7(_this__u8e3s4) {
235
235
  var tmp;
@@ -272,7 +272,7 @@ function emit_7(_this__u8e3s4) {
272
272
  }
273
273
  initMetadataForInterface(JavaTypeDefinitionEmitter, 'JavaTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter]);
274
274
  function emit_8(channel) {
275
- return trimMargin('\n |' + emitImports(this, channel) + '\n |\n |@FunctionalInterface\n |public interface ' + this.br(channel.qo_1) + ' {\n | void invoke(' + emitFullyQualified(this, channel, channel.ro_1) + this.j1v(channel.ro_1) + ' message);\n |}\n |\n ');
275
+ return trimMargin('\n |' + emitImports(this, channel) + '\n |\n |@FunctionalInterface\n |public interface ' + this.br(channel.qo_1) + ' {\n | void invoke(' + emitFullyQualified(this, channel, channel.ro_1) + this.l1v(channel.ro_1) + ' message);\n |}\n |\n ');
276
276
  }
277
277
  initMetadataForInterface(JavaChannelDefinitionEmitter, 'JavaChannelDefinitionEmitter', VOID, VOID, [JavaTypeDefinitionEmitter]);
278
278
  function emit_9(endpoint) {
@@ -282,7 +282,7 @@ function emit_9(endpoint) {
282
282
  var tmp_2 = emitObject(this, tmp_1, 'Path', 'Wirespec.Path', JavaEndpointDefinitionEmitter$emit$lambda(this));
283
283
  var tmp_3 = emitObject(this, endpoint.lp_1, 'Queries', 'Wirespec.Queries', JavaEndpointDefinitionEmitter$emit$lambda_0(this));
284
284
  var tmp_4 = emitObject(this, endpoint.mp_1, 'RequestHeaders', 'Wirespec.Request.Headers', JavaEndpointDefinitionEmitter$emit$lambda_1(this));
285
- var tmp_5 = this.v1v(first_0(endpoint.np_1), endpoint);
285
+ var tmp_5 = this.x1v(first_0(endpoint.np_1), endpoint);
286
286
  var tmp_6 = Spacer_instance.toString();
287
287
  var tmp_7 = emitStatusInterfaces(this, endpoint);
288
288
  var tmp_8 = emitResponseInterfaces(this, endpoint);
@@ -299,7 +299,7 @@ function emit_9(endpoint) {
299
299
  var tmp_19 = emitFromResponse(this, endpoint);
300
300
  var tmp_20 = Spacer_instance.vr(2);
301
301
  var tmp_21 = Spacer_instance.vr(2);
302
- var tmp_22 = this.z1v(endpoint);
302
+ var tmp_22 = this.b1w(endpoint);
303
303
  var tmp_23 = Spacer_instance.vr(2);
304
304
  var tmp_24 = Spacer_instance.vr(3);
305
305
  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 + '\n |' + tmp_20 + '}\n |\n |' + tmp_21 + tmp_22 + '\n |' + tmp_23 + 'class Handlers implements Wirespec.Server<Request, Response<?>>, Wirespec.Client<Request, Response<?>> {\n |' + tmp_24 + '@Override public String getPathTemplate() { return "/' + joinToString(endpoint.kp_1, '/', VOID, VOID, VOID, VOID, JavaEndpointDefinitionEmitter$emit$lambda_4) + '"; }\n |' + Spacer_instance.vr(3) + '@Override public String getMethod() { return "' + endpoint.jp_1.toString() + '"; }\n |' + Spacer_instance.vr(3) + '@Override public Wirespec.ServerEdge<Request, Response<?>> getServer(Wirespec.Serialization serialization) {\n |' + Spacer_instance.vr(4) + 'return new Wirespec.ServerEdge<>() {\n |' + Spacer_instance.vr(5) + '@Override public Request from(Wirespec.RawRequest request) { return fromRequest(serialization, request); }\n |' + Spacer_instance.vr(5) + '@Override public Wirespec.RawResponse to(Response<?> response) { return toResponse(serialization, response); }\n |' + Spacer_instance.vr(4) + '};\n |' + Spacer_instance.vr(3) + '}\n |' + Spacer_instance.vr(3) + '@Override public Wirespec.ClientEdge<Request, Response<?>> getClient(Wirespec.Serialization serialization) {\n |' + Spacer_instance.vr(4) + 'return new Wirespec.ClientEdge<>() {\n |' + Spacer_instance.vr(5) + '@Override public Wirespec.RawRequest to(Request request) { return toRequest(serialization, request); }\n |' + Spacer_instance.vr(5) + '@Override public Response<?> from(Wirespec.RawResponse response) { return fromResponse(serialization, response); }\n |' + Spacer_instance.vr(4) + '};\n |' + Spacer_instance.vr(3) + '}\n |' + Spacer_instance.vr(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
@@ -346,10 +346,10 @@ initMetadataForInterface(JavaEndpointDefinitionEmitter, 'JavaEndpointDefinitionE
346
346
  function emit_12(identifier) {
347
347
  var tmp;
348
348
  if (identifier instanceof DefinitionIdentifier) {
349
- tmp = this.u1v(identifier.l1());
349
+ tmp = this.w1v(identifier.l1());
350
350
  } else {
351
351
  if (identifier instanceof FieldIdentifier) {
352
- tmp = this.y1v(this.u1v(identifier.l1()));
352
+ tmp = this.a1w(this.w1v(identifier.l1()));
353
353
  } else {
354
354
  noWhenBranchMatchedException();
355
355
  }
@@ -371,7 +371,7 @@ function sanitizeSymbol(_this__u8e3s4) {
371
371
  destination.x(tmp$ret$0);
372
372
  }
373
373
  var tmp = asSequence(joinToString(destination, ''));
374
- return this.x1v(joinToString_0(filter(tmp, JavaIdentifierEmitter$sanitizeSymbol$lambda), ''));
374
+ return this.z1v(joinToString_0(filter(tmp, JavaIdentifierEmitter$sanitizeSymbol$lambda), ''));
375
375
  }
376
376
  function sanitizeFirstIsDigit(_this__u8e3s4) {
377
377
  var tmp;
@@ -391,7 +391,7 @@ function sanitizeFirstIsDigit(_this__u8e3s4) {
391
391
  return tmp;
392
392
  }
393
393
  function sanitizeKeywords(_this__u8e3s4) {
394
- return Companion_getInstance_0().a1w_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
394
+ return Companion_getInstance_0().c1w_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
395
395
  }
396
396
  initMetadataForInterface(JavaIdentifierEmitter, 'JavaIdentifierEmitter');
397
397
  function emit_13(enum_0, module_0) {
@@ -448,7 +448,7 @@ function emit_15(union) {
448
448
  return trimMargin('\n |public sealed interface ' + tmp + ' permits ' + joinToString(union.vo_1, VOID, VOID, VOID, VOID, VOID, JavaUnionDefinitionEmitter$emit$lambda) + ' {}\n |\n ');
449
449
  }
450
450
  initMetadataForInterface(JavaUnionDefinitionEmitter, 'JavaUnionDefinitionEmitter', VOID, VOID, [JavaIdentifierEmitter]);
451
- initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaEndpointDefinitionEmitter, JavaEnumDefinitionEmitter, JavaRefinedTypeDefinitionEmitter, JavaUnionDefinitionEmitter, JavaTypeDefinitionEmitter, JavaIdentifierEmitter, JavaChannelDefinitionEmitter, LanguageEmitter]);
451
+ initMetadataForClass(JavaEmitter, 'JavaEmitter', JavaEmitter, LanguageEmitter, [JavaTypeDefinitionEmitter, JavaEndpointDefinitionEmitter, JavaEnumDefinitionEmitter, JavaIdentifierEmitter, JavaRefinedTypeDefinitionEmitter, JavaUnionDefinitionEmitter, JavaChannelDefinitionEmitter, LanguageEmitter]);
452
452
  initMetadataForCompanion(Companion);
453
453
  initMetadataForCompanion(Companion_0);
454
454
  initMetadataForClass(JavaIrEmitter, 'JavaIrEmitter', JavaIrEmitter, VOID, [IrEmitter]);
@@ -472,7 +472,7 @@ function emitImports($this, _this__u8e3s4) {
472
472
  var _iterator__ex2g4s_0 = destination.t();
473
473
  while (_iterator__ex2g4s_0.u()) {
474
474
  var item = _iterator__ex2g4s_0.v();
475
- var tmp$ret$3 = 'import ' + $this.i1v().rr_1 + '.model.' + item.pu_1 + ';';
475
+ var tmp$ret$3 = 'import ' + $this.k1v().rr_1 + '.model.' + item.pu_1 + ';';
476
476
  destination_0.x(tmp$ret$3);
477
477
  }
478
478
  var tmp = destination_0;
@@ -481,7 +481,7 @@ function emitImports($this, _this__u8e3s4) {
481
481
  function emitFullyQualified($this, _this__u8e3s4, reference) {
482
482
  var tmp;
483
483
  if (_this__u8e3s4.ar().l1() === reference.l1()) {
484
- tmp = $this.i1v().rr_1 + '.model.';
484
+ tmp = $this.k1v().rr_1 + '.model.';
485
485
  } else {
486
486
  tmp = '';
487
487
  }
@@ -497,42 +497,42 @@ function JavaEmitter(packageName, emitShared) {
497
497
  packageName = packageName === VOID ? Companion_instance.qr('community.flock.wirespec.generated') : packageName;
498
498
  emitShared = emitShared === VOID ? Companion_instance_0.ko() : emitShared;
499
499
  LanguageEmitter.call(this);
500
- this.l1v_1 = packageName;
501
- this.m1v_1 = emitShared;
502
- this.n1v_1 = '\nimport community.flock.wirespec.java.Wirespec;\n';
503
- this.o1v_1 = FileExtension_Java_getInstance();
504
- this.p1v_1 = JavaShared_getInstance();
505
- this.q1v_1 = '//';
506
- }
507
- protoOf(JavaEmitter).i1v = function () {
508
- return this.l1v_1;
500
+ this.n1v_1 = packageName;
501
+ this.o1v_1 = emitShared;
502
+ this.p1v_1 = '\nimport community.flock.wirespec.java.Wirespec;\n';
503
+ this.q1v_1 = FileExtension_Java_getInstance();
504
+ this.r1v_1 = JavaShared_getInstance();
505
+ this.s1v_1 = '//';
506
+ }
507
+ protoOf(JavaEmitter).k1v = function () {
508
+ return this.n1v_1;
509
509
  };
510
510
  protoOf(JavaEmitter).iq = function () {
511
- return this.o1v_1;
511
+ return this.q1v_1;
512
512
  };
513
- protoOf(JavaEmitter).r1v = function () {
514
- return this.p1v_1;
513
+ protoOf(JavaEmitter).t1v = function () {
514
+ return this.r1v_1;
515
515
  };
516
516
  protoOf(JavaEmitter).jq = function () {
517
- return this.q1v_1;
517
+ return this.s1v_1;
518
518
  };
519
519
  protoOf(JavaEmitter).yq = function (module_0, logger) {
520
520
  // Inline function 'kotlin.let' call
521
521
  var it = protoOf(LanguageEmitter).yq.call(this, module_0, logger);
522
- return this.m1v_1.lo_1 ? NonEmptyList__plus_impl_xqmb9(it, new Emitted(Companion_instance.qr('community.flock.wirespec.java').tr() + 'Wirespec', this.r1v().t1v_1)) : it;
522
+ return this.o1v_1.lo_1 ? NonEmptyList__plus_impl_xqmb9(it, new Emitted(Companion_instance.qr('community.flock.wirespec.java').tr() + 'Wirespec', this.t1v().v1v_1)) : it;
523
523
  };
524
524
  protoOf(JavaEmitter).zq = function (definition, module_0, logger) {
525
525
  // Inline function 'kotlin.let' call
526
526
  var it = protoOf(LanguageEmitter).zq.call(this, definition, module_0, logger);
527
- var subPackageName = plus(this.i1v(), definition);
528
- var tmp = subPackageName.tr() + this.u1v(it.mo_1);
527
+ var subPackageName = plus(this.k1v(), definition);
528
+ var tmp = subPackageName.tr() + this.w1v(it.mo_1);
529
529
  // Inline function 'kotlin.text.trimStart' call
530
- var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.uq(module_0) ? this.n1v_1 : '') + '\n |' + it.no_1 + '\n ');
530
+ var this_0 = trimMargin('\n |package ' + subPackageName.toString() + ';\n |' + (Companion_instance_1.uq(module_0) ? this.p1v_1 : '') + '\n |' + it.no_1 + '\n ');
531
531
  var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
532
532
  return new Emitted(tmp, tmp$ret$0);
533
533
  };
534
534
  function emitGetType($this, _this__u8e3s4) {
535
- return 'Wirespec.getType(' + $this.k1v(_this__u8e3s4, 'Void') + '.class, ' + emitGetTypeRaw($this, _this__u8e3s4) + ')';
535
+ return 'Wirespec.getType(' + $this.m1v(_this__u8e3s4, 'Void') + '.class, ' + emitGetTypeRaw($this, _this__u8e3s4) + ')';
536
536
  }
537
537
  function emitGetTypeRaw($this, _this__u8e3s4) {
538
538
  var tmp;
@@ -687,7 +687,7 @@ function emitImports_0($this, _this__u8e3s4) {
687
687
  var _iterator__ex2g4s_0 = destination.t();
688
688
  while (_iterator__ex2g4s_0.u()) {
689
689
  var item = _iterator__ex2g4s_0.v();
690
- var tmp$ret$3 = 'import ' + $this.i1v().rr_1 + '.model.' + item.pu_1 + ';';
690
+ var tmp$ret$3 = 'import ' + $this.k1v().rr_1 + '.model.' + item.pu_1 + ';';
691
691
  destination_0.x(tmp$ret$3);
692
692
  }
693
693
  var tmp = destination_0;
@@ -808,7 +808,7 @@ function JavaEndpointDefinitionEmitter$emit$lambda_1(this$0) {
808
808
  }
809
809
  function JavaEndpointDefinitionEmitter$emit$lambda_2(this$0) {
810
810
  return function (it) {
811
- return this$0.w1v(it);
811
+ return this$0.y1v(it);
812
812
  };
813
813
  }
814
814
  function JavaEndpointDefinitionEmitter$emit$lambda_3(this$0) {
@@ -940,7 +940,7 @@ function sanitizeNegative($this, _this__u8e3s4) {
940
940
  return startsWith(_this__u8e3s4, '-') ? '__' + substring(_this__u8e3s4, 1) : _this__u8e3s4;
941
941
  }
942
942
  function sanitizeEnum($this, _this__u8e3s4) {
943
- return $this.y1v($this.x1v(joinToString(split(sanitizeNegative($this, _this__u8e3s4), ['-', ', ', '.', ' ', '//']), '_')));
943
+ return $this.a1w($this.z1v(joinToString(split(sanitizeNegative($this, _this__u8e3s4), ['-', ', ', '.', ' ', '//']), '_')));
944
944
  }
945
945
  function JavaEnumDefinitionEmitter$emit$lambda(this$0) {
946
946
  return function (it) {
@@ -951,7 +951,7 @@ function JavaEnumDefinitionEmitter() {
951
951
  }
952
952
  function Companion() {
953
953
  Companion_instance_2 = this;
954
- this.a1w_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']);
954
+ this.c1w_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']);
955
955
  }
956
956
  var Companion_instance_2;
957
957
  function Companion_getInstance_0() {
@@ -1015,14 +1015,14 @@ function sanitizeFirstIsDigit_0($this, _this__u8e3s4) {
1015
1015
  return tmp;
1016
1016
  }
1017
1017
  function sanitizeKeywords_0($this, _this__u8e3s4) {
1018
- return Companion_getInstance_1().b1w_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
1018
+ return Companion_getInstance_1().d1w_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
1019
1019
  }
1020
1020
  function sanitizeEnum_0($this, _this__u8e3s4) {
1021
1021
  return sanitizeKeywords_0($this, sanitizeFirstIsDigit_0($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
1022
1022
  }
1023
1023
  function Companion_0() {
1024
1024
  Companion_instance_3 = this;
1025
- this.b1w_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']);
1025
+ this.d1w_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']);
1026
1026
  }
1027
1027
  var Companion_instance_3;
1028
1028
  function Companion_getInstance_1() {
@@ -1134,27 +1134,27 @@ function JavaIrEmitter(packageName, emitShared) {
1134
1134
  Companion_getInstance_1();
1135
1135
  packageName = packageName === VOID ? Companion_instance.qr('community.flock.wirespec.generated') : packageName;
1136
1136
  emitShared = emitShared === VOID ? Companion_instance_0.ko() : emitShared;
1137
- this.c1w_1 = packageName;
1138
- this.d1w_1 = emitShared;
1139
- this.e1w_1 = JavaGenerator_instance;
1140
- this.f1w_1 = FileExtension_Java_getInstance();
1141
- this.g1w_1 = listOf(import_0('community.flock.wirespec.java', 'Wirespec'));
1137
+ this.e1w_1 = packageName;
1138
+ this.f1w_1 = emitShared;
1139
+ this.g1w_1 = JavaGenerator_instance;
1140
+ this.h1w_1 = FileExtension_Java_getInstance();
1141
+ this.i1w_1 = listOf(import_0('community.flock.wirespec.java', 'Wirespec'));
1142
1142
  var tmp = this;
1143
- var tmp_0 = Companion_getInstance_1().b1w_1;
1143
+ var tmp_0 = Companion_getInstance_1().d1w_1;
1144
1144
  var tmp_1 = JavaIrEmitter$sanitizationConfig$lambda;
1145
1145
  var tmp_2 = JavaIrEmitter$sanitizationConfig$lambda_0;
1146
1146
  var tmp_3 = JavaIrEmitter$sanitizationConfig$lambda_1;
1147
1147
  var tmp_4 = JavaIrEmitter$sanitizationConfig$lambda_2(this);
1148
- tmp.h1w_1 = new SanitizationConfig(tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, JavaIrEmitter$sanitizationConfig$lambda_3);
1148
+ tmp.j1w_1 = new SanitizationConfig(tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, JavaIrEmitter$sanitizationConfig$lambda_3);
1149
1149
  }
1150
- protoOf(JavaIrEmitter).i1v = function () {
1151
- return this.c1w_1;
1150
+ protoOf(JavaIrEmitter).k1v = function () {
1151
+ return this.e1w_1;
1152
1152
  };
1153
1153
  protoOf(JavaIrEmitter).p1u = function () {
1154
- return this.e1w_1;
1154
+ return this.g1w_1;
1155
1155
  };
1156
1156
  protoOf(JavaIrEmitter).iq = function () {
1157
- return this.f1w_1;
1157
+ return this.h1w_1;
1158
1158
  };
1159
1159
  protoOf(JavaIrEmitter).s1u = function () {
1160
1160
  var packageName = Companion_instance.qr('community.flock.wirespec.java');
@@ -1197,7 +1197,7 @@ protoOf(JavaIrEmitter).s1u = function () {
1197
1197
  var tmp_1 = scope.c1u_1;
1198
1198
  var wirespecShared = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1199
1199
  var tmp_2;
1200
- if (this.d1w_1.lo_1) {
1200
+ if (this.f1w_1.lo_1) {
1201
1201
  tmp_2 = wirespecShared;
1202
1202
  } else {
1203
1203
  tmp_2 = null;
@@ -1208,7 +1208,7 @@ protoOf(JavaIrEmitter).zq = function (definition, module_0, logger) {
1208
1208
  var file = emit_0.call(this, definition, module_0, logger);
1209
1209
  var tmp = file.b1n(Companion_getInstance().k1h(sanitizeSymbol_0(this, file.x1m_1.m1h())));
1210
1210
  // Inline function 'kotlin.takeIf' call
1211
- var this_0 = this.g1w_1;
1211
+ var this_0 = this.i1w_1;
1212
1212
  var tmp_0;
1213
1213
  if (Companion_instance_1.vq(module_0)) {
1214
1214
  tmp_0 = this_0;
@@ -1216,26 +1216,26 @@ protoOf(JavaIrEmitter).zq = function (definition, module_0, logger) {
1216
1216
  tmp_0 = null;
1217
1217
  }
1218
1218
  var tmp$ret$1 = tmp_0;
1219
- return placeInPackage(prependImports(tmp, tmp$ret$1), this.i1v(), definition);
1219
+ return placeInPackage(prependImports(tmp, tmp$ret$1), this.k1v(), definition);
1220
1220
  };
1221
1221
  protoOf(JavaIrEmitter).yp = function (type, module_0) {
1222
- return sanitizeNames(convertWithValidation(type, module_0), this.h1w_1);
1222
+ return sanitizeNames(convertWithValidation(type, module_0), this.j1w_1);
1223
1223
  };
1224
1224
  protoOf(JavaIrEmitter).nr = function (enum_0, module_0) {
1225
1225
  var tmp = convert_0(enum_0);
1226
1226
  var tmp_0 = JavaIrEmitter$emit$lambda(this);
1227
- return sanitizeNames(injectEnumLabelField(tmp, tmp_0, JavaIrEmitter$emit$lambda_0), this.h1w_1);
1227
+ return sanitizeNames(injectEnumLabelField(tmp, tmp_0, JavaIrEmitter$emit$lambda_0), this.j1w_1);
1228
1228
  };
1229
1229
  protoOf(JavaIrEmitter).dr = function (union) {
1230
- return sanitizeNames(convert_1(union), this.h1w_1);
1230
+ return sanitizeNames(convert_1(union), this.j1w_1);
1231
1231
  };
1232
1232
  protoOf(JavaIrEmitter).ir = function (refined) {
1233
- return sanitizeNames(applyRefinedStructShape(convert_2(refined), refined), this.h1w_1);
1233
+ return sanitizeNames(applyRefinedStructShape(convert_2(refined), refined), this.j1w_1);
1234
1234
  };
1235
1235
  protoOf(JavaIrEmitter).or = function (endpoint) {
1236
- var tmp = sanitizeNames(transformTypeDescriptors(injectApiField(injectHandleFunction(convert_3(endpoint), endpoint))), this.h1w_1);
1236
+ var tmp = sanitizeNames(transformTypeDescriptors(injectApiField(injectHandleFunction(convert_3(endpoint), endpoint))), this.j1w_1);
1237
1237
  // Inline function 'kotlin.takeIf' call
1238
- var this_0 = buildModelImports(endpoint, this.i1v());
1238
+ var this_0 = buildModelImports(endpoint, this.k1v());
1239
1239
  var tmp_0;
1240
1240
  // Inline function 'kotlin.collections.isNotEmpty' call
1241
1241
  if (!this_0.r()) {
@@ -1249,20 +1249,20 @@ protoOf(JavaIrEmitter).or = function (endpoint) {
1249
1249
  protoOf(JavaIrEmitter).cr = function (channel) {
1250
1250
  var tmp;
1251
1251
  if (channel.qo_1.l1() === channel.ro_1.l1()) {
1252
- tmp = this.i1v().rr_1 + '.model.';
1252
+ tmp = this.k1v().rr_1 + '.model.';
1253
1253
  } else {
1254
1254
  tmp = '';
1255
1255
  }
1256
1256
  var fullyQualifiedPrefix = tmp;
1257
- return applyFunctionalInterface(sanitizeNames(convert_4(channel), this.h1w_1), fullyQualifiedPrefix);
1257
+ return applyFunctionalInterface(sanitizeNames(convert_4(channel), this.j1w_1), fullyQualifiedPrefix);
1258
1258
  };
1259
1259
  protoOf(JavaIrEmitter).u1u = function (endpoint) {
1260
- var imports = buildModelImports(endpoint, this.i1v());
1261
- var endpointImport = import_0(this.i1v().rr_1 + '.endpoint', endpoint.ip_1.l1());
1260
+ var imports = buildModelImports(endpoint, this.k1v());
1261
+ var endpointImport = import_0(this.k1v().rr_1 + '.endpoint', endpoint.ip_1.l1());
1262
1262
  var endpointName = endpoint.ip_1.l1();
1263
- var file = wrapAsyncReturnInThenApply(transformTypeDescriptors(sanitizeNames(emitEndpointClient.call(this, endpoint), this.h1w_1)), endpointName);
1264
- var subPackageName = plus_0(this.i1v(), 'client');
1265
- return new File(Companion_getInstance().k1h(subPackageName.tr() + sanitizeSymbol_0(this, file.x1m_1.m1h())), plus_1(plus_1(plus_1(plus_1(listOf(new Package(subPackageName.rr_1)), this.g1w_1), imports), listOf(endpointImport)), file.y1m_1));
1263
+ var file = wrapAsyncReturnInThenApply(transformTypeDescriptors(sanitizeNames(emitEndpointClient.call(this, endpoint), this.j1w_1)), endpointName);
1264
+ var subPackageName = plus_0(this.k1v(), 'client');
1265
+ return new File(Companion_getInstance().k1h(subPackageName.tr() + sanitizeSymbol_0(this, file.x1m_1.m1h())), plus_1(plus_1(plus_1(plus_1(listOf(new Package(subPackageName.rr_1)), this.i1w_1), imports), listOf(endpointImport)), file.y1m_1));
1266
1266
  };
1267
1267
  protoOf(JavaIrEmitter).t1u = function (endpoints, logger) {
1268
1268
  // Inline function 'kotlin.collections.flatMap' call
@@ -1324,7 +1324,7 @@ protoOf(JavaIrEmitter).t1u = function (endpoints, logger) {
1324
1324
  var _iterator__ex2g4s_3 = destination_0.t();
1325
1325
  while (_iterator__ex2g4s_3.u()) {
1326
1326
  var item = _iterator__ex2g4s_3.v();
1327
- var tmp$ret$10 = import_0(this.i1v().rr_1 + '.model', item.pu_1);
1327
+ var tmp$ret$10 = import_0(this.k1v().rr_1 + '.model', item.pu_1);
1328
1328
  destination_1.x(tmp$ret$10);
1329
1329
  }
1330
1330
  var imports = destination_1;
@@ -1334,7 +1334,7 @@ protoOf(JavaIrEmitter).t1u = function (endpoints, logger) {
1334
1334
  var _iterator__ex2g4s_4 = endpoints.t();
1335
1335
  while (_iterator__ex2g4s_4.u()) {
1336
1336
  var item_0 = _iterator__ex2g4s_4.v();
1337
- var tmp$ret$13 = import_0(this.i1v().rr_1 + '.endpoint', item_0.ip_1.l1());
1337
+ var tmp$ret$13 = import_0(this.k1v().rr_1 + '.endpoint', item_0.ip_1.l1());
1338
1338
  destination_2.x(tmp$ret$13);
1339
1339
  }
1340
1340
  var endpointImports = destination_2;
@@ -1344,13 +1344,13 @@ protoOf(JavaIrEmitter).t1u = function (endpoints, logger) {
1344
1344
  var _iterator__ex2g4s_5 = endpoints.t();
1345
1345
  while (_iterator__ex2g4s_5.u()) {
1346
1346
  var item_1 = _iterator__ex2g4s_5.v();
1347
- var tmp$ret$16 = import_0(this.i1v().rr_1 + '.client', item_1.ip_1.l1() + 'Client');
1347
+ var tmp$ret$16 = import_0(this.k1v().rr_1 + '.client', item_1.ip_1.l1() + 'Client');
1348
1348
  destination_3.x(tmp$ret$16);
1349
1349
  }
1350
1350
  var clientImports = destination_3;
1351
1351
  var allImports = plus_1(plus_1(imports, endpointImports), clientImports);
1352
- var file = sanitizeNames(emitClient.call(this, endpoints, logger), this.h1w_1);
1353
- return new File(Companion_getInstance().k1h(this.i1v().tr() + sanitizeSymbol_0(this, file.x1m_1.m1h())), plus_1(plus_1(plus_1(listOf(new Package(this.i1v().rr_1)), this.g1w_1), allImports), file.y1m_1));
1352
+ var file = sanitizeNames(emitClient.call(this, endpoints, logger), this.j1w_1);
1353
+ return new File(Companion_getInstance().k1h(this.k1v().tr() + sanitizeSymbol_0(this, file.x1m_1.m1h())), plus_1(plus_1(plus_1(listOf(new Package(this.k1v().rr_1)), this.i1w_1), allImports), file.y1m_1));
1354
1354
  };
1355
1355
  function transformTypeDescriptors(_this__u8e3s4) {
1356
1356
  // Inline function 'community.flock.wirespec.ir.core.transform' call
@@ -1856,8 +1856,8 @@ function JavaRefinedTypeDefinitionEmitter() {
1856
1856
  }
1857
1857
  function JavaShared() {
1858
1858
  JavaShared_instance = this;
1859
- this.s1v_1 = 'community.flock.wirespec.java';
1860
- this.t1v_1 = trimMargin('\n |package ' + this.s1v_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 |import java.util.Optional;\n |\n |public interface Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { String label(); }\n |' + Spacer_instance.toString() + 'interface Endpoint {}\n |' + Spacer_instance.toString() + 'interface Refined<T> { T value(); }\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.vr(2) + 'Req from(RawRequest request);\n |' + Spacer_instance.vr(2) + 'RawResponse to(Res response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.vr(2) + 'RawRequest to(Req request);\n |' + Spacer_instance.vr(2) + 'Res from(RawResponse response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.vr(2) + 'String getPathTemplate();\n |' + Spacer_instance.vr(2) + 'String getMethod();\n |' + Spacer_instance.vr(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.vr(2) + 'String getPathTemplate();\n |' + Spacer_instance.vr(2) + 'String getMethod();\n |' + Spacer_instance.vr(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> { Integer 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, Optional<byte[]> body) {}\n |' + Spacer_instance.toString() + 'record RawResponse(int statusCode, Map<String, List<String>> headers, Optional<byte[]> body) {}\n |' + Spacer_instance.toString() + 'static Type getType(final Class<?> actualTypeArguments, final Class<?> rawType) {\n |' + Spacer_instance.vr(2) + 'if(rawType != null) {\n |' + Spacer_instance.vr(3) + 'return new ParameterizedType() {\n |' + Spacer_instance.vr(4) + 'public Type getRawType() { return rawType; }\n |' + Spacer_instance.vr(4) + 'public Type[] getActualTypeArguments() { return new Class<?>[]{actualTypeArguments}; }\n |' + Spacer_instance.vr(4) + 'public Type getOwnerType() { return null; }\n |' + Spacer_instance.vr(3) + '};\n |' + Spacer_instance.vr(2) + '}\n |' + Spacer_instance.vr(2) + 'else { return actualTypeArguments; }\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
1859
+ this.u1v_1 = 'community.flock.wirespec.java';
1860
+ this.v1v_1 = trimMargin('\n |package ' + this.u1v_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 |import java.util.Optional;\n |\n |public interface Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { String label(); }\n |' + Spacer_instance.toString() + 'interface Endpoint {}\n |' + Spacer_instance.toString() + 'interface Refined<T> { T value(); }\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.vr(2) + 'Req from(RawRequest request);\n |' + Spacer_instance.vr(2) + 'RawResponse to(Res response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.vr(2) + 'RawRequest to(Req request);\n |' + Spacer_instance.vr(2) + 'Res from(RawResponse response);\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req extends Request<?>, Res extends Response<?>> {\n |' + Spacer_instance.vr(2) + 'String getPathTemplate();\n |' + Spacer_instance.vr(2) + 'String getMethod();\n |' + Spacer_instance.vr(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.vr(2) + 'String getPathTemplate();\n |' + Spacer_instance.vr(2) + 'String getMethod();\n |' + Spacer_instance.vr(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> { Integer 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, Optional<byte[]> body) {}\n |' + Spacer_instance.toString() + 'record RawResponse(int statusCode, Map<String, List<String>> headers, Optional<byte[]> body) {}\n |' + Spacer_instance.toString() + 'static Type getType(final Class<?> actualTypeArguments, final Class<?> rawType) {\n |' + Spacer_instance.vr(2) + 'if(rawType != null) {\n |' + Spacer_instance.vr(3) + 'return new ParameterizedType() {\n |' + Spacer_instance.vr(4) + 'public Type getRawType() { return rawType; }\n |' + Spacer_instance.vr(4) + 'public Type[] getActualTypeArguments() { return new Class<?>[]{actualTypeArguments}; }\n |' + Spacer_instance.vr(4) + 'public Type getOwnerType() { return null; }\n |' + Spacer_instance.vr(3) + '};\n |' + Spacer_instance.vr(2) + '}\n |' + Spacer_instance.vr(2) + 'else { return actualTypeArguments; }\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
1861
1861
  }
1862
1862
  protoOf(JavaShared).toString = function () {
1863
1863
  return 'JavaShared';
@@ -1982,18 +1982,18 @@ protoOf(JavaEmitter).aq = emit_5;
1982
1982
  protoOf(JavaEmitter).bq = emit_6;
1983
1983
  protoOf(JavaEmitter).cq = emit_7;
1984
1984
  protoOf(JavaEmitter).or = emit_9;
1985
- protoOf(JavaEmitter).v1v = emit_10;
1986
- protoOf(JavaEmitter).w1v = emit_11;
1985
+ protoOf(JavaEmitter).x1v = emit_10;
1986
+ protoOf(JavaEmitter).y1v = emit_11;
1987
1987
  protoOf(JavaEmitter).cr = emit_8;
1988
1988
  protoOf(JavaEmitter).nr = emit_13;
1989
1989
  protoOf(JavaEmitter).dr = emit_15;
1990
1990
  protoOf(JavaEmitter).ir = emit_14;
1991
- protoOf(JavaEmitter).u1v = sanitizeSymbol;
1992
- protoOf(JavaEmitter).x1v = sanitizeFirstIsDigit;
1993
- protoOf(JavaEmitter).y1v = sanitizeKeywords;
1994
- protoOf(JavaEmitter).k1v = emitRoot;
1995
- protoOf(JavaEmitter).j1v = emitRoot$default;
1996
- protoOf(JavaEmitter).z1v = emitHandleFunction;
1991
+ protoOf(JavaEmitter).w1v = sanitizeSymbol;
1992
+ protoOf(JavaEmitter).z1v = sanitizeFirstIsDigit;
1993
+ protoOf(JavaEmitter).a1w = sanitizeKeywords;
1994
+ protoOf(JavaEmitter).m1v = emitRoot;
1995
+ protoOf(JavaEmitter).l1v = emitRoot$default;
1996
+ protoOf(JavaEmitter).b1w = emitHandleFunction;
1997
1997
  protoOf(JavaEmitter).pr = emitValidator;
1998
1998
  protoOf(JavaIrEmitter).sn = emit_1;
1999
1999
  protoOf(JavaIrEmitter).r1u = emit_2;