@flock/wirespec 0.9.19 → 0.9.21

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.
@@ -91,14 +91,14 @@
91
91
  var NonEmptyList = kotlin_io_arrow_kt_arrow_core.$_$.e;
92
92
  var DefaultRaise = kotlin_io_arrow_kt_arrow_core.$_$.a;
93
93
  var getKClass = kotlin_kotlin.$_$.e;
94
- var nonFatalOrThrow = kotlin_io_arrow_kt_arrow_core.$_$.g;
94
+ var nonFatalOrThrow = kotlin_io_arrow_kt_arrow_core.$_$.h;
95
95
  var raisedOrRethrow = kotlin_io_arrow_kt_arrow_core.$_$.b;
96
96
  var CancellationException = kotlin_kotlin.$_$.v8;
97
97
  var toList = kotlin_kotlin.$_$.i8;
98
98
  var getKClassFromExpression = kotlin_kotlin.$_$.d;
99
99
  var THROW_IAE = kotlin_kotlin.$_$.ze;
100
100
  var enumEntries = kotlin_kotlin.$_$.y8;
101
- var nonEmptyListOf = kotlin_io_arrow_kt_arrow_core.$_$.f;
101
+ var nonEmptyListOf = kotlin_io_arrow_kt_arrow_core.$_$.g;
102
102
  var Companion_instance = kotlin_kotlin.$_$.d4;
103
103
  var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.b2;
104
104
  var createFailure = kotlin_kotlin.$_$.mf;
@@ -108,7 +108,7 @@
108
108
  var last = kotlin_kotlin.$_$.c7;
109
109
  var removePrefix = kotlin_kotlin.$_$.xc;
110
110
  var Pair = kotlin_kotlin.$_$.ve;
111
- var toNonEmptyListOrNull = kotlin_io_arrow_kt_arrow_core.$_$.h;
111
+ var toNonEmptyListOrNull = kotlin_io_arrow_kt_arrow_core.$_$.i;
112
112
  var ensureNotNull = kotlin_kotlin.$_$.nf;
113
113
  var println = kotlin_kotlin.$_$.z8;
114
114
  //endregion
@@ -401,7 +401,7 @@
401
401
  }
402
402
  function WirespecSpec() {
403
403
  WirespecSpec_instance = this;
404
- this.v20_1 = listOf([to(Regex_init_$Create$('^type'), WsTypeDef_instance), to(Regex_init_$Create$('^enum'), WsEnumTypeDef_instance), to(Regex_init_$Create$('^endpoint'), WsEndpointDef_instance), to(Regex_init_$Create$('^[^\\S\\r\\n]+'), WhiteSpaceExceptNewLine_instance), to(Regex_init_$Create$('^[\\r\\n]'), NewLine_instance), to(Regex_init_$Create$('^\\{'), LeftCurly_instance), to(Regex_init_$Create$('^\\}'), RightCurly_instance), to(Regex_init_$Create$('^->'), Arrow_instance), to(Regex_init_$Create$('^='), Equals_instance), to(Regex_init_$Create$('^\\|'), Pipe_instance), to(Regex_init_$Create$('^:'), Colon_instance), to(Regex_init_$Create$('^,'), Comma_instance), to(Regex_init_$Create$('^\\?'), QuestionMark_instance), to(Regex_init_$Create$('^#'), Hash_instance), to(Regex_init_$Create$('^\\[\\]'), Brackets_instance), to(Regex_init_$Create$('^String'), WsString_instance), to(Regex_init_$Create$('^Integer'), WsInteger_instance), to(Regex_init_$Create$('^Number'), WsNumber_instance), to(Regex_init_$Create$('^Boolean'), WsBoolean_instance), to(Regex_init_$Create$('^Unit'), WsUnit_instance), to(Regex_init_$Create$('^GET|^POST|^PUT|^DELETE|^OPTIONS|^HEAD|^PATCH|^TRACE'), Method_instance), to(Regex_init_$Create$('^/.*/g'), CustomRegex_instance), to(Regex_init_$Create$('^[1-5][0-9][0-9]'), StatusCode_instance), to(Regex_init_$Create$('^[a-z`][a-zA-Z0-9`]*'), CustomValue_instance), to(Regex_init_$Create$('^[A-Z][a-zA-Z_]*'), CustomType_instance), to(Regex_init_$Create$('^/[a-zA-Z-_]+'), Path_instance), to(Regex_init_$Create$('^\\/\\*(\\*(?!\\/)|[^*])*\\*\\/'), WsComment_instance), to(Regex_init_$Create$('^/'), ForwardSlash_instance), to(Regex_init_$Create$('^.'), Invalid_instance)]);
404
+ this.v20_1 = listOf([to(Regex_init_$Create$('^type'), WsTypeDef_instance), to(Regex_init_$Create$('^enum'), WsEnumTypeDef_instance), to(Regex_init_$Create$('^endpoint'), WsEndpointDef_instance), to(Regex_init_$Create$('^[^\\S\\r\\n]+'), WhiteSpaceExceptNewLine_instance), to(Regex_init_$Create$('^[\\r\\n]'), NewLine_instance), to(Regex_init_$Create$('^\\{'), LeftCurly_instance), to(Regex_init_$Create$('^\\}'), RightCurly_instance), to(Regex_init_$Create$('^->'), Arrow_instance), to(Regex_init_$Create$('^='), Equals_instance), to(Regex_init_$Create$('^\\|'), Pipe_instance), to(Regex_init_$Create$('^:'), Colon_instance), to(Regex_init_$Create$('^,'), Comma_instance), to(Regex_init_$Create$('^\\?'), QuestionMark_instance), to(Regex_init_$Create$('^#'), Hash_instance), to(Regex_init_$Create$('^\\[\\]'), Brackets_instance), to(Regex_init_$Create$('^String'), WsString_instance), to(Regex_init_$Create$('^Integer'), WsInteger_instance), to(Regex_init_$Create$('^Number'), WsNumber_instance), to(Regex_init_$Create$('^Boolean'), WsBoolean_instance), to(Regex_init_$Create$('^Unit'), WsUnit_instance), to(Regex_init_$Create$('^GET|^POST|^PUT|^DELETE|^OPTIONS|^HEAD|^PATCH|^TRACE'), Method_instance), to(Regex_init_$Create$('^/.*/g'), CustomRegex_instance), to(Regex_init_$Create$('^[1-5][0-9][0-9]'), StatusCode_instance), to(Regex_init_$Create$('^[a-z`][a-zA-Z0-9`]*'), CustomValue_instance), to(Regex_init_$Create$('^[A-Z][a-zA-Z0-9_]*'), CustomType_instance), to(Regex_init_$Create$('^/[a-zA-Z-_]+'), Path_instance), to(Regex_init_$Create$('^\\/\\*(\\*(?!\\/)|[^*])*\\*\\/'), WsComment_instance), to(Regex_init_$Create$('^/'), ForwardSlash_instance), to(Regex_init_$Create$('^.'), Invalid_instance)]);
405
405
  }
406
406
  protoOf(WirespecSpec).w20 = function () {
407
407
  return this.v20_1;
@@ -1192,7 +1192,7 @@
1192
1192
  logger = logger === VOID ? get_noLogger() : logger;
1193
1193
  Emitter.call(this, logger, false);
1194
1194
  this.w26_1 = packageName;
1195
- this.x26_1 = '\nimport community.flock.wirespec.Wirespec\n';
1195
+ this.x26_1 = '\nimport community.flock.wirespec.Wirespec\nimport kotlin.reflect.typeOf\n';
1196
1196
  }
1197
1197
  protoOf(KotlinEmitter).z21 = function (_this__u8e3s4) {
1198
1198
  var tmp;
@@ -1358,7 +1358,7 @@
1358
1358
  return trimMargin('\n |fun <B> ' + _this__u8e3s4.k24_1 + '(contentMapper: Wirespec.ContentMapper<B>) = { request: Wirespec.Request<B> ->\n |' + ' ' + 'when {\n |' + tmp + '\n |' + ' ' + ' ' + 'else -> error("Cannot map request")\n |' + ' ' + '}\n |}\n ');
1359
1359
  };
1360
1360
  protoOf(KotlinEmitter).v21 = function (_this__u8e3s4) {
1361
- return _this__u8e3s4.p24_1 == null ? 'request.content == null -> ' + emitWrap_0(_this__u8e3s4.q24_1, this) + '(request.path, request.method, request.query, request.headers)' : trimMargin('\n |request.content?.type == "' + _this__u8e3s4.p24_1.n24_1 + '" -> contentMapper\n | .read<' + emitWrap_0(_this__u8e3s4.p24_1.o24_1, this) + '>(request.content!!, Wirespec.getType(' + this.f21(_this__u8e3s4.p24_1.o24_1) + '::class.java, ' + _this__u8e3s4.r24_1 + '))\n | .let { ' + emitWrap_0(_this__u8e3s4.q24_1, this) + '(request.path, request.method, request.query, request.headers, it) }\n ');
1361
+ return _this__u8e3s4.p24_1 == null ? 'request.content == null -> ' + emitWrap_0(_this__u8e3s4.q24_1, this) + '(request.path, request.method, request.query, request.headers)' : trimMargin('\n |request.content?.type == "' + _this__u8e3s4.p24_1.n24_1 + '" -> contentMapper\n | .read<' + emitWrap_0(_this__u8e3s4.p24_1.o24_1, this) + '>(request.content!!, typeOf<' + emitWrap_0(_this__u8e3s4.p24_1.o24_1, this) + '>())\n | .let { ' + emitWrap_0(_this__u8e3s4.q24_1, this) + '(request.path, request.method, request.query, request.headers, it) }\n ');
1362
1362
  };
1363
1363
  protoOf(KotlinEmitter).q23 = function (_this__u8e3s4) {
1364
1364
  Companion_getInstance_3();
@@ -1369,7 +1369,7 @@
1369
1369
  return trimMargin('\n |fun <B> ' + _this__u8e3s4.l25_1 + '(contentMapper: Wirespec.ContentMapper<B>) = { response: Wirespec.Response<B> ->\n |' + ' ' + 'when {\n |' + tmp + '\n |' + ' ' + ' ' + 'else -> error("Cannot map response with status ${response.status}")\n |' + ' ' + '}\n |}\n ');
1370
1370
  };
1371
1371
  protoOf(KotlinEmitter).w21 = function (_this__u8e3s4) {
1372
- return _this__u8e3s4.o25_1 == null ? trimMargin('\n |' + (Companion_getInstance_3().k25(_this__u8e3s4.n25_1) ? 'response.status == ' + _this__u8e3s4.n25_1 + ' && ' : '') + 'response.content == null -> ' + emitWrap_0(_this__u8e3s4.p25_1, this) + '(response.status, response.headers, null)\n ') : trimMargin('\n |' + (Companion_getInstance_3().k25(_this__u8e3s4.n25_1) ? 'response.status == ' + _this__u8e3s4.n25_1 + ' && ' : '') + 'response.content?.type == "' + _this__u8e3s4.o25_1.n24_1 + '" -> contentMapper\n | .read<' + emitWrap_0(_this__u8e3s4.o25_1.o24_1, this) + '>(response.content!!, Wirespec.getType(' + this.f21(_this__u8e3s4.o25_1.o24_1) + '::class.java, false))\n | .let { ' + emitWrap_0(_this__u8e3s4.p25_1, this) + '(response.status, response.headers, it) }\n ');
1372
+ return _this__u8e3s4.o25_1 == null ? trimMargin('\n |' + (Companion_getInstance_3().k25(_this__u8e3s4.n25_1) ? 'response.status == ' + _this__u8e3s4.n25_1 + ' && ' : '') + 'response.content == null -> ' + emitWrap_0(_this__u8e3s4.p25_1, this) + '(response.status, response.headers, null)\n ') : trimMargin('\n |' + (Companion_getInstance_3().k25(_this__u8e3s4.n25_1) ? 'response.status == ' + _this__u8e3s4.n25_1 + ' && ' : '') + 'response.content?.type == "' + _this__u8e3s4.o25_1.n24_1 + '" -> contentMapper\n | .read<' + emitWrap_0(_this__u8e3s4.o25_1.o24_1, this) + '>(response.content!!, typeOf<' + emitWrap_0(_this__u8e3s4.o25_1.o24_1, this) + '>())\n | .let { ' + emitWrap_0(_this__u8e3s4.p25_1, this) + '(response.status, response.headers, it) }\n ');
1373
1373
  };
1374
1374
  protoOf(KotlinEmitter).u21 = function (_this__u8e3s4) {
1375
1375
  return sanitizeIdentifier_0(_this__u8e3s4.t25_1, this) + ': ' + emitWrap_0(_this__u8e3s4.u25_1, this);
@@ -4574,18 +4574,25 @@
4574
4574
  // Inline function 'arrow.core.raise.either.<anonymous>' call
4575
4575
  // Inline function 'community.flock.wirespec.compiler.core.parse.EndpointParser.parseContent.<anonymous>' call
4576
4576
  $this.x29(_this__u8e3s4.s29_1);
4577
- var res = new Content_0('application/json', raise.ck(parseReference(_this__u8e3s4, $this, wsType, value)));
4577
+ var reference = raise.ck(parseReference(_this__u8e3s4, $this, wsType, value));
4578
+ var tmp_0;
4579
+ if (reference instanceof Unit) {
4580
+ tmp_0 = null;
4581
+ } else {
4582
+ tmp_0 = new Content_0('application/json', reference);
4583
+ }
4584
+ var res = tmp_0;
4578
4585
  raise.zj();
4579
4586
  // Inline function 'arrow.core.raise.either.<anonymous>' call
4580
4587
  tmp = new Right(res);
4581
4588
  } catch ($p) {
4582
- var tmp_0;
4589
+ var tmp_1;
4583
4590
  if ($p instanceof CancellationException) {
4584
4591
  var e = $p;
4585
4592
  raise.zj();
4586
4593
  // Inline function 'arrow.core.raise.either.<anonymous>' call
4587
4594
  var it = raisedOrRethrow(e, raise);
4588
- tmp_0 = new Left(it);
4595
+ tmp_1 = new Left(it);
4589
4596
  } else {
4590
4597
  if ($p instanceof Error) {
4591
4598
  var e_0 = $p;
@@ -4595,7 +4602,7 @@
4595
4602
  throw $p;
4596
4603
  }
4597
4604
  }
4598
- tmp = tmp_0;
4605
+ tmp = tmp_1;
4599
4606
  }
4600
4607
  return tmp;
4601
4608
  }
@@ -5949,7 +5956,7 @@
5949
5956
  }
5950
5957
  var tmp3_elvis_lhs = tmp_0;
5951
5958
  var next = tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs;
5952
- $this.q29_1.j20(prev + curr + next);
5959
+ $this.q29_1.z2a(prev + curr + next);
5953
5960
  }
5954
5961
  function printTokens$default($this, previousToken, $super) {
5955
5962
  previousToken = previousToken === VOID ? null : previousToken;
@@ -6580,15 +6587,15 @@
6580
6587
  function IdxAndLength(idx, length) {
6581
6588
  idx = idx === VOID ? 0 : idx;
6582
6589
  length = length === VOID ? 0 : length;
6583
- this.z2a_1 = idx;
6584
- this.a2b_1 = length;
6590
+ this.a2b_1 = idx;
6591
+ this.b2b_1 = length;
6585
6592
  }
6586
6593
  protoOf(IdxAndLength).toString = function () {
6587
- return 'IdxAndLength(idx=' + this.z2a_1 + ', length=' + this.a2b_1 + ')';
6594
+ return 'IdxAndLength(idx=' + this.a2b_1 + ', length=' + this.b2b_1 + ')';
6588
6595
  };
6589
6596
  protoOf(IdxAndLength).hashCode = function () {
6590
- var result = this.z2a_1;
6591
- result = imul(result, 31) + this.a2b_1 | 0;
6597
+ var result = this.a2b_1;
6598
+ result = imul(result, 31) + this.b2b_1 | 0;
6592
6599
  return result;
6593
6600
  };
6594
6601
  protoOf(IdxAndLength).equals = function (other) {
@@ -6597,10 +6604,10 @@
6597
6604
  if (!(other instanceof IdxAndLength))
6598
6605
  return false;
6599
6606
  var tmp0_other_with_cast = other instanceof IdxAndLength ? other : THROW_CCE();
6600
- if (!(this.z2a_1 === tmp0_other_with_cast.z2a_1))
6601
- return false;
6602
6607
  if (!(this.a2b_1 === tmp0_other_with_cast.a2b_1))
6603
6608
  return false;
6609
+ if (!(this.b2b_1 === tmp0_other_with_cast.b2b_1))
6610
+ return false;
6604
6611
  return true;
6605
6612
  };
6606
6613
  function Coordinates(line, position, idxAndLength) {
@@ -6611,14 +6618,14 @@
6611
6618
  this.m29_1 = position;
6612
6619
  this.n29_1 = idxAndLength;
6613
6620
  }
6614
- protoOf(Coordinates).b2b = function (line, position, idxAndLength) {
6621
+ protoOf(Coordinates).c2b = function (line, position, idxAndLength) {
6615
6622
  return new Coordinates(line, position, idxAndLength);
6616
6623
  };
6617
- protoOf(Coordinates).c2b = function (line, position, idxAndLength, $super) {
6624
+ protoOf(Coordinates).d2b = function (line, position, idxAndLength, $super) {
6618
6625
  line = line === VOID ? this.l29_1 : line;
6619
6626
  position = position === VOID ? this.m29_1 : position;
6620
6627
  idxAndLength = idxAndLength === VOID ? this.n29_1 : idxAndLength;
6621
- return $super === VOID ? this.b2b(line, position, idxAndLength) : $super.b2b.call(this, line, position, idxAndLength);
6628
+ return $super === VOID ? this.c2b(line, position, idxAndLength) : $super.c2b.call(this, line, position, idxAndLength);
6622
6629
  };
6623
6630
  protoOf(Coordinates).toString = function () {
6624
6631
  return 'Coordinates(line=' + this.l29_1 + ', position=' + this.m29_1 + ', idxAndLength=' + this.n29_1 + ')';
@@ -6651,14 +6658,14 @@
6651
6658
  protoOf(Token).p2 = function () {
6652
6659
  return this.h29_1;
6653
6660
  };
6654
- protoOf(Token).d2b = function (value, type, coordinates) {
6661
+ protoOf(Token).e2b = function (value, type, coordinates) {
6655
6662
  return new Token(value, type, coordinates);
6656
6663
  };
6657
6664
  protoOf(Token).p29 = function (value, type, coordinates, $super) {
6658
6665
  value = value === VOID ? this.h29_1 : value;
6659
6666
  type = type === VOID ? this.i29_1 : type;
6660
6667
  coordinates = coordinates === VOID ? this.j29_1 : coordinates;
6661
- return $super === VOID ? this.d2b(value, type, coordinates) : $super.d2b.call(this, value, type, coordinates);
6668
+ return $super === VOID ? this.e2b(value, type, coordinates) : $super.e2b.call(this, value, type, coordinates);
6662
6669
  };
6663
6670
  protoOf(Token).toString = function () {
6664
6671
  return 'Token(value=' + this.h29_1 + ', type=' + this.i29_1 + ', coordinates=' + this.j29_1 + ')';
@@ -6684,10 +6691,10 @@
6684
6691
  return true;
6685
6692
  };
6686
6693
  function plus_1(_this__u8e3s4, length) {
6687
- return new IdxAndLength(_this__u8e3s4.z2a_1 + length | 0, length);
6694
+ return new IdxAndLength(_this__u8e3s4.a2b_1 + length | 0, length);
6688
6695
  }
6689
6696
  function plus_2(_this__u8e3s4, length) {
6690
- return _this__u8e3s4.c2b(VOID, _this__u8e3s4.m29_1 + length | 0, plus_1(_this__u8e3s4.n29_1, length));
6697
+ return _this__u8e3s4.d2b(VOID, _this__u8e3s4.m29_1 + length | 0, plus_1(_this__u8e3s4.n29_1, length));
6691
6698
  }
6692
6699
  function tokenize(_this__u8e3s4, source) {
6693
6700
  var tmp1_coordinates = new Coordinates();
@@ -7396,7 +7403,7 @@
7396
7403
  return StartOfProgram_instance;
7397
7404
  }
7398
7405
  function EndOfProgram() {
7399
- this.e2b_1 = 'EOP';
7406
+ this.f2b_1 = 'EOP';
7400
7407
  }
7401
7408
  protoOf(EndOfProgram).toString = function () {
7402
7409
  return 'EndOfProgram';
@@ -7434,6 +7441,16 @@
7434
7441
  enableLogging = enableLogging === VOID ? false : enableLogging;
7435
7442
  this.i20_1 = enableLogging;
7436
7443
  }
7444
+ protoOf(Logger).z2a = function (s) {
7445
+ var tmp;
7446
+ if (this.i20_1) {
7447
+ println(s);
7448
+ tmp = Unit_instance;
7449
+ } else {
7450
+ tmp = Unit_instance;
7451
+ }
7452
+ return tmp;
7453
+ };
7437
7454
  protoOf(Logger).j20 = function (s) {
7438
7455
  var tmp;
7439
7456
  if (this.i20_1) {