@flock/wirespec 0.9.20 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flock/wirespec",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "main": "wirespec-src-plugin-npm.js",
5
5
  "types": "wirespec-src-plugin-npm.d.ts",
6
6
  "devDependencies": {
@@ -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
@@ -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
  }