@flock/wirespec 0.16.1 → 0.16.3

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.16.1",
3
+ "version": "0.16.3",
4
4
  "main": "wirespec-src-plugin-npm.mjs",
5
5
  "types": "wirespec-src-plugin-npm.d.ts",
6
6
  "devDependencies": {
@@ -2446,7 +2446,7 @@ function emitDeserializedParams_4(_this__u8e3s4, $this, endpoint) {
2446
2446
  // Inline function 'kotlin.contracts.contract' call
2447
2447
  // Inline function 'community.flock.wirespec.compiler.core.emit.PythonEmitter.emitDeserializedParams.<anonymous>' call
2448
2448
  var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
2449
- return isBlank(it) ? '' : '(\n' + it + '\n)';
2449
+ return isBlank(it) ? '()' : '(\n' + it + '\n)';
2450
2450
  }
2451
2451
  function emitDeserialized_3(_this__u8e3s4, $this) {
2452
2452
  return Spacer_instance.e25(3) + $this.o25(_this__u8e3s4.rd_1.p25_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], ' + emitType_0(_this__u8e3s4.rd_1.q25_1, $this) + ')';
@@ -3157,96 +3157,101 @@ function emitType_2(_this__u8e3s4, $this, endpoint) {
3157
3157
  }
3158
3158
  function emitFunction(_this__u8e3s4, $this, endpoint) {
3159
3159
  var tmp = Spacer_instance.toString();
3160
+ var tmp_0 = $this.x28(_this__u8e3s4, endpoint);
3161
+ var tmp_1 = joinToObject(tmp_0, $this, TypeScriptEmitter$emitFunction$lambda($this));
3162
+ var tmp_2 = Spacer_instance.toString();
3160
3163
  // Inline function 'kotlin.text.orEmpty' call
3161
3164
  // Inline function 'kotlin.takeIf' call
3162
3165
  var this_0 = $this.x28(_this__u8e3s4, endpoint);
3163
3166
  // Inline function 'kotlin.contracts.contract' call
3164
- var tmp_0;
3167
+ var tmp_3;
3165
3168
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3166
3169
  // Inline function 'kotlin.collections.isNotEmpty' call
3167
3170
  if (!this_0.l()) {
3168
- tmp_0 = this_0;
3171
+ tmp_3 = this_0;
3169
3172
  } else {
3170
- tmp_0 = null;
3173
+ tmp_3 = null;
3171
3174
  }
3172
- var tmp0_safe_receiver = tmp_0;
3173
- var tmp_1;
3174
- if (tmp0_safe_receiver == null) {
3175
- tmp_1 = null;
3175
+ var tmp_4;
3176
+ if (tmp_3 == null) {
3177
+ tmp_4 = null;
3176
3178
  } else {
3177
3179
  // Inline function 'kotlin.run' call
3178
3180
  // Inline function 'kotlin.contracts.contract' call
3179
3181
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3180
- tmp_1 = 'props: ' + joinToObject(tmp0_safe_receiver, $this, TypeScriptEmitter$emitFunction$lambda($this));
3182
+ tmp_4 = 'params: RequestParams';
3181
3183
  }
3182
- var tmp0_elvis_lhs = tmp_1;
3183
- var tmp_2 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
3184
- var tmp_3 = Spacer_instance.e25(2);
3185
- var tmp_4 = $this.j25(endpoint);
3186
- var tmp_5 = joinToObject(tmp_4, $this, TypeScriptEmitter$emitFunction$lambda_0($this));
3184
+ var tmp0_elvis_lhs = tmp_4;
3185
+ var tmp_5 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
3187
3186
  var tmp_6 = Spacer_instance.e25(2);
3188
- var tmp_7 = endpoint.t24_1.toString();
3189
- var tmp_8 = Spacer_instance.e25(2);
3190
- var tmp_9 = joinToObject(endpoint.v24_1, $this, TypeScriptEmitter$emitFunction$lambda_1($this));
3191
- var tmp_10 = Spacer_instance.e25(2);
3192
- var tmp_11 = joinToObject(endpoint.w24_1, $this, TypeScriptEmitter$emitFunction$lambda_2($this));
3193
- var tmp_12 = Spacer_instance.e25(2);
3194
- var tmp_13;
3187
+ var tmp_7 = $this.j25(endpoint);
3188
+ var tmp_8 = joinToObject(tmp_7, $this, TypeScriptEmitter$emitFunction$lambda_0($this));
3189
+ var tmp_9 = Spacer_instance.e25(2);
3190
+ var tmp_10 = endpoint.t24_1.toString();
3191
+ var tmp_11 = Spacer_instance.e25(2);
3192
+ var tmp_12 = joinToObject(endpoint.v24_1, $this, TypeScriptEmitter$emitFunction$lambda_1($this));
3193
+ var tmp_13 = Spacer_instance.e25(2);
3194
+ var tmp_14 = joinToObject(endpoint.w24_1, $this, TypeScriptEmitter$emitFunction$lambda_2($this));
3195
+ var tmp_15 = Spacer_instance.e25(2);
3196
+ var tmp_16;
3195
3197
  if (_this__u8e3s4.f25_1 == null) {
3196
- tmp_13 = null;
3198
+ tmp_16 = null;
3197
3199
  } else {
3198
3200
  // Inline function 'kotlin.let' call
3199
3201
  // Inline function 'kotlin.contracts.contract' call
3200
3202
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3201
- tmp_13 = 'props.body';
3203
+ tmp_16 = 'params.body';
3202
3204
  }
3203
- var tmp2_elvis_lhs = tmp_13;
3204
- return trimIndent('\n |' + tmp + 'export const request = (' + tmp_2 + '): Request => ({\n |' + tmp_3 + 'path: ' + tmp_5 + ',\n |' + tmp_6 + 'method: "' + tmp_7 + '",\n |' + tmp_8 + 'queries: ' + tmp_9 + ',\n |' + tmp_10 + 'headers: ' + tmp_11 + ',\n |' + tmp_12 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
3205
+ var tmp2_elvis_lhs = tmp_16;
3206
+ return trimIndent('\n |' + tmp + 'export type RequestParams = ' + tmp_1 + '\n |' + tmp_2 + 'export const request = (' + tmp_5 + '): Request => ({\n |' + tmp_6 + 'path: ' + tmp_8 + ',\n |' + tmp_9 + 'method: "' + tmp_10 + '",\n |' + tmp_11 + 'queries: ' + tmp_12 + ',\n |' + tmp_13 + 'headers: ' + tmp_14 + ',\n |' + tmp_15 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
3205
3207
  }
3206
3208
  function emitFunction_0(_this__u8e3s4, $this) {
3207
3209
  var tmp = Spacer_instance.toString();
3208
3210
  var tmp_0 = Companion_instance_5.l25(_this__u8e3s4.z24_1);
3211
+ var tmp_1 = $this.y28(_this__u8e3s4);
3212
+ var tmp_2 = joinToObject(tmp_1, $this, TypeScriptEmitter$emitFunction$lambda_3($this));
3213
+ var tmp_3 = Spacer_instance.toString();
3214
+ var tmp_4 = Companion_instance_5.l25(_this__u8e3s4.z24_1);
3209
3215
  // Inline function 'kotlin.text.orEmpty' call
3210
3216
  // Inline function 'kotlin.takeIf' call
3211
3217
  var this_0 = $this.y28(_this__u8e3s4);
3212
3218
  // Inline function 'kotlin.contracts.contract' call
3213
- var tmp_1;
3219
+ var tmp_5;
3214
3220
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3215
3221
  // Inline function 'kotlin.collections.isNotEmpty' call
3216
3222
  if (!this_0.l()) {
3217
- tmp_1 = this_0;
3223
+ tmp_5 = this_0;
3218
3224
  } else {
3219
- tmp_1 = null;
3225
+ tmp_5 = null;
3220
3226
  }
3221
- var tmp0_safe_receiver = tmp_1;
3222
- var tmp_2;
3223
- if (tmp0_safe_receiver == null) {
3224
- tmp_2 = null;
3227
+ var tmp_6;
3228
+ if (tmp_5 == null) {
3229
+ tmp_6 = null;
3225
3230
  } else {
3226
3231
  // Inline function 'kotlin.run' call
3227
3232
  // Inline function 'kotlin.contracts.contract' call
3228
3233
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3229
- tmp_2 = 'props: ' + joinToObject(tmp0_safe_receiver, $this, TypeScriptEmitter$emitFunction$lambda_3($this));
3234
+ tmp_6 = 'params: Response' + Companion_instance_5.l25(_this__u8e3s4.z24_1) + 'Params';
3230
3235
  }
3231
- var tmp0_elvis_lhs = tmp_2;
3232
- var tmp_3 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
3233
- var tmp_4 = Companion_instance_5.l25(_this__u8e3s4.z24_1);
3234
- var tmp_5 = Spacer_instance.e25(2);
3235
- var tmp_6 = $this.c28(_this__u8e3s4.z24_1);
3236
- var tmp_7 = Spacer_instance.e25(2);
3237
- var tmp_8 = joinToObject(_this__u8e3s4.a25_1, $this, TypeScriptEmitter$emitFunction$lambda_4($this));
3236
+ var tmp0_elvis_lhs = tmp_6;
3237
+ var tmp_7 = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
3238
+ var tmp_8 = Companion_instance_5.l25(_this__u8e3s4.z24_1);
3238
3239
  var tmp_9 = Spacer_instance.e25(2);
3239
- var tmp_10;
3240
+ var tmp_10 = $this.c28(_this__u8e3s4.z24_1);
3241
+ var tmp_11 = Spacer_instance.e25(2);
3242
+ var tmp_12 = joinToObject(_this__u8e3s4.a25_1, $this, TypeScriptEmitter$emitFunction$lambda_4($this));
3243
+ var tmp_13 = Spacer_instance.e25(2);
3244
+ var tmp_14;
3240
3245
  if (_this__u8e3s4.b25_1 == null) {
3241
- tmp_10 = null;
3246
+ tmp_14 = null;
3242
3247
  } else {
3243
3248
  // Inline function 'kotlin.let' call
3244
3249
  // Inline function 'kotlin.contracts.contract' call
3245
3250
  // Inline function 'community.flock.wirespec.compiler.core.emit.TypeScriptEmitter.emitFunction.<anonymous>' call
3246
- tmp_10 = 'props.body';
3251
+ tmp_14 = 'params.body';
3247
3252
  }
3248
- var tmp2_elvis_lhs = tmp_10;
3249
- return trimIndent('\n |' + tmp + 'export const response' + tmp_0 + ' = (' + tmp_3 + '): Response' + tmp_4 + ' => ({\n |' + tmp_5 + 'status: ' + tmp_6 + ',\n |' + tmp_7 + 'headers: ' + tmp_8 + ',\n |' + tmp_9 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
3253
+ var tmp2_elvis_lhs = tmp_14;
3254
+ return trimIndent('\n |' + tmp + 'export type Response' + tmp_0 + 'Params = ' + tmp_2 + '\n |' + tmp_3 + 'export const response' + tmp_4 + ' = (' + tmp_7 + '): Response' + tmp_8 + ' => ({\n |' + tmp_9 + 'status: ' + tmp_10 + ',\n |' + tmp_11 + 'headers: ' + tmp_12 + ',\n |' + tmp_13 + 'body: ' + (tmp2_elvis_lhs == null ? 'undefined' : tmp2_elvis_lhs) + ',\n |' + Spacer_instance.toString() + '})\n ');
3250
3255
  }
3251
3256
  function joinToObject(_this__u8e3s4, $this, transform) {
3252
3257
  return joinToString(_this__u8e3s4, ', ', '{', '}', VOID, VOID, transform);
@@ -3415,17 +3420,17 @@ function TypeScriptEmitter$emitFunction$lambda(this$0) {
3415
3420
  }
3416
3421
  function TypeScriptEmitter$emitFunction$lambda_0(this$0) {
3417
3422
  return function (it) {
3418
- return this$0.o25(it.p25_1) + ': props[' + this$0.o25(it.p25_1) + ']';
3423
+ return this$0.o25(it.p25_1) + ': params[' + this$0.o25(it.p25_1) + ']';
3419
3424
  };
3420
3425
  }
3421
3426
  function TypeScriptEmitter$emitFunction$lambda_1(this$0) {
3422
3427
  return function (it) {
3423
- return this$0.o25(it.m25_1) + ': props[' + this$0.o25(it.m25_1) + ']';
3428
+ return this$0.o25(it.m25_1) + ': params[' + this$0.o25(it.m25_1) + ']';
3424
3429
  };
3425
3430
  }
3426
3431
  function TypeScriptEmitter$emitFunction$lambda_2(this$0) {
3427
3432
  return function (it) {
3428
- return this$0.o25(it.m25_1) + ': props[' + this$0.o25(it.m25_1) + ']';
3433
+ return this$0.o25(it.m25_1) + ': params[' + this$0.o25(it.m25_1) + ']';
3429
3434
  };
3430
3435
  }
3431
3436
  function TypeScriptEmitter$emitFunction$lambda_3(this$0) {
@@ -3435,7 +3440,7 @@ function TypeScriptEmitter$emitFunction$lambda_3(this$0) {
3435
3440
  }
3436
3441
  function TypeScriptEmitter$emitFunction$lambda_4(this$0) {
3437
3442
  return function (it) {
3438
- return this$0.o25(it.m25_1) + ': props[' + this$0.o25(it.m25_1) + ']';
3443
+ return this$0.o25(it.m25_1) + ': params[' + this$0.o25(it.m25_1) + ']';
3439
3444
  };
3440
3445
  }
3441
3446
  function TypeScriptEmitter$emitType$lambda_0(this$0) {
@@ -11576,7 +11581,11 @@ function extractRegex(_this__u8e3s4, source, regex, incompleteTokens) {
11576
11581
  tmp = tokenize_1(_this__u8e3s4, source, incompleteTokens.pk(token));
11577
11582
  } else {
11578
11583
  if (escapedForwardSlash.ub(source)) {
11579
- tmp = extractRegex(_this__u8e3s4, drop_0(source, 2), regex + toString_0(first(source)), incompleteTokens);
11584
+ var tmp_1 = drop_0(source, 2);
11585
+ // Inline function 'kotlin.text.substring' call
11586
+ // Inline function 'kotlin.js.asDynamic' call
11587
+ var tmp$ret$2 = source.substring(0, 2);
11588
+ tmp = extractRegex(_this__u8e3s4, tmp_1, regex + tmp$ret$2, incompleteTokens);
11580
11589
  } else {
11581
11590
  if (match == null) {
11582
11591
  tmp = extractRegex(_this__u8e3s4, drop_0(source, 1), regex + toString_0(first(source)), incompleteTokens);