@tim-smart/openapi-gen 0.3.12 → 0.3.14

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 (2) hide show
  1. package/main.js +991 -571
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -68,8 +68,8 @@ var __commonJS = (cb, mod) => function __require2() {
68
68
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
69
69
  };
70
70
  var __export = (target, all9) => {
71
- for (var name in all9)
72
- __defProp(target, name, { get: all9[name], enumerable: true });
71
+ for (var name2 in all9)
72
+ __defProp(target, name2, { get: all9[name2], enumerable: true });
73
73
  };
74
74
  var __copyProps = (to, from, except, desc) => {
75
75
  if (from && typeof from === "object" || typeof from === "function") {
@@ -330,16 +330,16 @@ var require_parser = __commonJS({
330
330
  function parse8(input) {
331
331
  var options3 = arguments.length > 1 ? arguments[1] : {}, peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c1 = function() {
332
332
  return nodes;
333
- }, peg$c2 = peg$FAILED, peg$c3 = "#", peg$c4 = { type: "literal", value: "#", description: '"#"' }, peg$c5 = void 0, peg$c6 = { type: "any", description: "any character" }, peg$c7 = "[", peg$c8 = { type: "literal", value: "[", description: '"["' }, peg$c9 = "]", peg$c10 = { type: "literal", value: "]", description: '"]"' }, peg$c11 = function(name) {
334
- addNode(node("ObjectPath", name, line4, column3));
335
- }, peg$c12 = function(name) {
336
- addNode(node("ArrayPath", name, line4, column3));
337
- }, peg$c13 = function(parts2, name) {
338
- return parts2.concat(name);
339
- }, peg$c14 = function(name) {
340
- return [name];
341
- }, peg$c15 = function(name) {
342
- return name;
333
+ }, peg$c2 = peg$FAILED, peg$c3 = "#", peg$c4 = { type: "literal", value: "#", description: '"#"' }, peg$c5 = void 0, peg$c6 = { type: "any", description: "any character" }, peg$c7 = "[", peg$c8 = { type: "literal", value: "[", description: '"["' }, peg$c9 = "]", peg$c10 = { type: "literal", value: "]", description: '"]"' }, peg$c11 = function(name2) {
334
+ addNode(node("ObjectPath", name2, line4, column3));
335
+ }, peg$c12 = function(name2) {
336
+ addNode(node("ArrayPath", name2, line4, column3));
337
+ }, peg$c13 = function(parts2, name2) {
338
+ return parts2.concat(name2);
339
+ }, peg$c14 = function(name2) {
340
+ return [name2];
341
+ }, peg$c15 = function(name2) {
342
+ return name2;
343
343
  }, peg$c16 = ".", peg$c17 = { type: "literal", value: ".", description: '"."' }, peg$c18 = "=", peg$c19 = { type: "literal", value: "=", description: '"="' }, peg$c20 = function(key, value5) {
344
344
  addNode(node("Assign", value5, line4, column3, key));
345
345
  }, peg$c21 = function(chars) {
@@ -356,14 +356,14 @@ var require_parser = __commonJS({
356
356
  return "";
357
357
  }, peg$c38 = "e", peg$c39 = { type: "literal", value: "e", description: '"e"' }, peg$c40 = "E", peg$c41 = { type: "literal", value: "E", description: '"E"' }, peg$c42 = function(left3, right3) {
358
358
  return node("Float", parseFloat(left3 + "e" + right3), line4, column3);
359
- }, peg$c43 = function(text9) {
360
- return node("Float", parseFloat(text9), line4, column3);
359
+ }, peg$c43 = function(text10) {
360
+ return node("Float", parseFloat(text10), line4, column3);
361
361
  }, peg$c44 = "+", peg$c45 = { type: "literal", value: "+", description: '"+"' }, peg$c46 = function(digits) {
362
362
  return digits.join("");
363
363
  }, peg$c47 = "-", peg$c48 = { type: "literal", value: "-", description: '"-"' }, peg$c49 = function(digits) {
364
364
  return "-" + digits.join("");
365
- }, peg$c50 = function(text9) {
366
- return node("Integer", parseInt(text9, 10), line4, column3);
365
+ }, peg$c50 = function(text10) {
366
+ return node("Integer", parseInt(text10, 10), line4, column3);
367
367
  }, peg$c51 = "true", peg$c52 = { type: "literal", value: "true", description: '"true"' }, peg$c53 = function() {
368
368
  return node("Boolean", true, line4, column3);
369
369
  }, peg$c54 = "false", peg$c55 = { type: "literal", value: "false", description: '"false"' }, peg$c56 = function() {
@@ -4116,13 +4116,13 @@ var require_utils = __commonJS({
4116
4116
  }
4117
4117
  };
4118
4118
  var ERR_INVALID_ARG_TYPE = class extends TypeError {
4119
- constructor(name, expected, actual) {
4120
- name.includes(".") ? "property" : "argument";
4119
+ constructor(name2, expected, actual) {
4120
+ name2.includes(".") ? "property" : "argument";
4121
4121
  }
4122
4122
  };
4123
- function assertIsObject(value5, name, types = "Object") {
4123
+ function assertIsObject(value5, name2, types = "Object") {
4124
4124
  if (value5 !== void 0 && (value5 === null || typeof value5 !== "object" || Array.isArray(value5))) {
4125
- const err = new ERR_INVALID_ARG_TYPE(name, types, value5);
4125
+ const err = new ERR_INVALID_ARG_TYPE(name2, types, value5);
4126
4126
  Error.captureStackTrace(err, assertIsObject);
4127
4127
  throw err;
4128
4128
  }
@@ -4182,11 +4182,11 @@ var require_request = __commonJS({
4182
4182
  var { Stream: Stream2 } = __require("stream");
4183
4183
  function addFunctions(container, obj) {
4184
4184
  const proto25 = obj.prototype;
4185
- Object.keys(proto25).forEach((name) => {
4186
- if (container.indexOf(name) != -1)
4185
+ Object.keys(proto25).forEach((name2) => {
4186
+ if (container.indexOf(name2) != -1)
4187
4187
  return;
4188
- if (name.indexOf("_") != 0 && typeof proto25[name] == "function") {
4189
- container.push(name);
4188
+ if (name2.indexOf("_") != 0 && typeof proto25[name2] == "function") {
4189
+ container.push(name2);
4190
4190
  }
4191
4191
  });
4192
4192
  }
@@ -4206,10 +4206,10 @@ var require_request = __commonJS({
4206
4206
  this.http2Mimic = true;
4207
4207
  this[$stubs] = [];
4208
4208
  for (var i = 0; i < STUBBED_METHODS_NAME.length; i++) {
4209
- let name = STUBBED_METHODS_NAME[i];
4210
- if (!ClientRequest.prototype[name]) {
4211
- this[name] = function method() {
4212
- return this.genericStubber(name, arguments);
4209
+ let name2 = STUBBED_METHODS_NAME[i];
4210
+ if (!ClientRequest.prototype[name2]) {
4211
+ this[name2] = function method() {
4212
+ return this.genericStubber(name2, arguments);
4213
4213
  }.bind(this);
4214
4214
  }
4215
4215
  }
@@ -4316,9 +4316,9 @@ var require_request = __commonJS({
4316
4316
  },
4317
4317
  take(stream3) {
4318
4318
  for (var i = 0; i < STUBBED_METHODS_NAME.length; i++) {
4319
- let name = STUBBED_METHODS_NAME[i];
4320
- if (stream3[name]) {
4321
- this[name] = stream3[name].bind(stream3);
4319
+ let name2 = STUBBED_METHODS_NAME[i];
4320
+ if (stream3[name2]) {
4321
+ this[name2] = stream3[name2].bind(stream3);
4322
4322
  }
4323
4323
  }
4324
4324
  this._on = stream3.on.bind(stream3);
@@ -4347,18 +4347,18 @@ var require_request = __commonJS({
4347
4347
  });
4348
4348
  const properties = Object.getOwnPropertyDescriptors(http2Stream);
4349
4349
  for (var i = 0; i < keysToProxy.length; i++) {
4350
- let name = keysToProxy[i];
4351
- const propConfig = properties[name];
4350
+ let name2 = keysToProxy[i];
4351
+ const propConfig = properties[name2];
4352
4352
  let shouldCopyValue;
4353
4353
  if (!propConfig)
4354
4354
  shouldCopyValue = true;
4355
4355
  if (propConfig && (propConfig.writable || propConfig))
4356
4356
  shouldCopyValue = true;
4357
4357
  if (shouldCopyValue)
4358
- http2Stream[name] = this[name];
4359
- Object.defineProperty(this, name, {
4360
- get: getter.bind(name),
4361
- set: setter.bind(name)
4358
+ http2Stream[name2] = this[name2];
4359
+ Object.defineProperty(this, name2, {
4360
+ get: getter.bind(name2),
4361
+ set: setter.bind(name2)
4362
4362
  });
4363
4363
  }
4364
4364
  }
@@ -4970,10 +4970,10 @@ function writeToStream(dest, instance) {
4970
4970
  body.pipe(dest);
4971
4971
  }
4972
4972
  }
4973
- function validateName(name) {
4974
- name = `${name}`;
4975
- if (invalidTokenRegex.test(name)) {
4976
- throw new TypeError(`${name} is not a legal HTTP header name`);
4973
+ function validateName(name2) {
4974
+ name2 = `${name2}`;
4975
+ if (invalidTokenRegex.test(name2)) {
4976
+ throw new TypeError(`${name2} is not a legal HTTP header name`);
4977
4977
  }
4978
4978
  }
4979
4979
  function validateValue(value5) {
@@ -4982,10 +4982,10 @@ function validateValue(value5) {
4982
4982
  throw new TypeError(`${value5} is not a legal HTTP header value`);
4983
4983
  }
4984
4984
  }
4985
- function find3(map33, name) {
4986
- name = name.toLowerCase();
4985
+ function find3(map33, name2) {
4986
+ name2 = name2.toLowerCase();
4987
4987
  for (const key in map33) {
4988
- if (key.toLowerCase() === name) {
4988
+ if (key.toLowerCase() === name2) {
4989
4989
  return key;
4990
4990
  }
4991
4991
  }
@@ -5021,23 +5021,23 @@ function exportNodeCompatibleHeaders(headers) {
5021
5021
  }
5022
5022
  function createHeadersLenient(obj) {
5023
5023
  const headers = new Headers();
5024
- for (const name of Object.keys(obj)) {
5025
- if (invalidTokenRegex.test(name)) {
5024
+ for (const name2 of Object.keys(obj)) {
5025
+ if (invalidTokenRegex.test(name2)) {
5026
5026
  continue;
5027
5027
  }
5028
- if (Array.isArray(obj[name])) {
5029
- for (const val of obj[name]) {
5028
+ if (Array.isArray(obj[name2])) {
5029
+ for (const val of obj[name2]) {
5030
5030
  if (invalidHeaderCharRegex.test(val)) {
5031
5031
  continue;
5032
5032
  }
5033
- if (headers[MAP][name] === void 0) {
5034
- headers[MAP][name] = [val];
5033
+ if (headers[MAP][name2] === void 0) {
5034
+ headers[MAP][name2] = [val];
5035
5035
  } else {
5036
- headers[MAP][name].push(val);
5036
+ headers[MAP][name2].push(val);
5037
5037
  }
5038
5038
  }
5039
- } else if (!invalidHeaderCharRegex.test(obj[name])) {
5040
- headers[MAP][name] = [obj[name]];
5039
+ } else if (!invalidHeaderCharRegex.test(obj[name2])) {
5040
+ headers[MAP][name2] = [obj[name2]];
5041
5041
  }
5042
5042
  }
5043
5043
  return headers;
@@ -5431,10 +5431,10 @@ var init_lib = __esm({
5431
5431
  text: { enumerable: true }
5432
5432
  });
5433
5433
  Body.mixIn = function(proto25) {
5434
- for (const name of Object.getOwnPropertyNames(Body.prototype)) {
5435
- if (!(name in proto25)) {
5436
- const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
5437
- Object.defineProperty(proto25, name, desc);
5434
+ for (const name2 of Object.getOwnPropertyNames(Body.prototype)) {
5435
+ if (!(name2 in proto25)) {
5436
+ const desc = Object.getOwnPropertyDescriptor(Body.prototype, name2);
5437
+ Object.defineProperty(proto25, name2, desc);
5438
5438
  }
5439
5439
  }
5440
5440
  };
@@ -5498,10 +5498,10 @@ var init_lib = __esm({
5498
5498
  * @param String name Header name
5499
5499
  * @return Mixed
5500
5500
  */
5501
- get(name) {
5502
- name = `${name}`;
5503
- validateName(name);
5504
- const key = find3(this[MAP], name);
5501
+ get(name2) {
5502
+ name2 = `${name2}`;
5503
+ validateName(name2);
5504
+ const key = find3(this[MAP], name2);
5505
5505
  if (key === void 0) {
5506
5506
  return null;
5507
5507
  }
@@ -5520,8 +5520,8 @@ var init_lib = __esm({
5520
5520
  let i = 0;
5521
5521
  while (i < pairs.length) {
5522
5522
  var _pairs$i = pairs[i];
5523
- const name = _pairs$i[0], value5 = _pairs$i[1];
5524
- callback.call(thisArg, value5, name, this);
5523
+ const name2 = _pairs$i[0], value5 = _pairs$i[1];
5524
+ callback.call(thisArg, value5, name2, this);
5525
5525
  pairs = getHeaders(this);
5526
5526
  i++;
5527
5527
  }
@@ -5533,13 +5533,13 @@ var init_lib = __esm({
5533
5533
  * @param String value Header value
5534
5534
  * @return Void
5535
5535
  */
5536
- set(name, value5) {
5537
- name = `${name}`;
5536
+ set(name2, value5) {
5537
+ name2 = `${name2}`;
5538
5538
  value5 = `${value5}`;
5539
- validateName(name);
5539
+ validateName(name2);
5540
5540
  validateValue(value5);
5541
- const key = find3(this[MAP], name);
5542
- this[MAP][key !== void 0 ? key : name] = [value5];
5541
+ const key = find3(this[MAP], name2);
5542
+ this[MAP][key !== void 0 ? key : name2] = [value5];
5543
5543
  }
5544
5544
  /**
5545
5545
  * Append a value onto existing header
@@ -5548,16 +5548,16 @@ var init_lib = __esm({
5548
5548
  * @param String value Header value
5549
5549
  * @return Void
5550
5550
  */
5551
- append(name, value5) {
5552
- name = `${name}`;
5551
+ append(name2, value5) {
5552
+ name2 = `${name2}`;
5553
5553
  value5 = `${value5}`;
5554
- validateName(name);
5554
+ validateName(name2);
5555
5555
  validateValue(value5);
5556
- const key = find3(this[MAP], name);
5556
+ const key = find3(this[MAP], name2);
5557
5557
  if (key !== void 0) {
5558
5558
  this[MAP][key].push(value5);
5559
5559
  } else {
5560
- this[MAP][name] = [value5];
5560
+ this[MAP][name2] = [value5];
5561
5561
  }
5562
5562
  }
5563
5563
  /**
@@ -5566,10 +5566,10 @@ var init_lib = __esm({
5566
5566
  * @param String name Header name
5567
5567
  * @return Boolean
5568
5568
  */
5569
- has(name) {
5570
- name = `${name}`;
5571
- validateName(name);
5572
- return find3(this[MAP], name) !== void 0;
5569
+ has(name2) {
5570
+ name2 = `${name2}`;
5571
+ validateName(name2);
5572
+ return find3(this[MAP], name2) !== void 0;
5573
5573
  }
5574
5574
  /**
5575
5575
  * Delete all header values given name
@@ -5577,10 +5577,10 @@ var init_lib = __esm({
5577
5577
  * @param String name Header name
5578
5578
  * @return Void
5579
5579
  */
5580
- delete(name) {
5581
- name = `${name}`;
5582
- validateName(name);
5583
- const key = find3(this[MAP], name);
5580
+ delete(name2) {
5581
+ name2 = `${name2}`;
5582
+ validateName(name2);
5583
+ const key = find3(this[MAP], name2);
5584
5584
  if (key !== void 0) {
5585
5585
  delete this[MAP][key];
5586
5586
  }
@@ -7716,7 +7716,7 @@ var require_swagger2openapi = __commonJS({
7716
7716
  }
7717
7717
  }
7718
7718
  }
7719
- function processResponse(response, name, op, openapi, options3) {
7719
+ function processResponse(response, name2, op, openapi, options3) {
7720
7720
  if (!response) return false;
7721
7721
  if (response.$ref && typeof response.$ref === "string") {
7722
7722
  if (response.$ref.indexOf("#/definitions/") >= 0) {
@@ -8524,6 +8524,7 @@ var identity = (a) => a;
8524
8524
  var constant = (value5) => () => value5;
8525
8525
  var constTrue = /* @__PURE__ */ constant(true);
8526
8526
  var constFalse = /* @__PURE__ */ constant(false);
8527
+ var constNull = /* @__PURE__ */ constant(null);
8527
8528
  var constUndefined = /* @__PURE__ */ constant(void 0);
8528
8529
  var constVoid = constUndefined;
8529
8530
  function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
@@ -9360,6 +9361,7 @@ var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone
9360
9361
  var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
9361
9362
  var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some2(onNone()) : self);
9362
9363
  var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
9364
+ var getOrNull = /* @__PURE__ */ getOrElse(constNull);
9363
9365
  var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
9364
9366
  var liftThrowable = (f) => (...a) => {
9365
9367
  try {
@@ -14270,8 +14272,8 @@ var fromFlatLoop = (flat, prefix, config2, split2) => {
14270
14272
  case OP_PRIMITIVE: {
14271
14273
  return pipe(patch5(prefix, flat.patch), flatMap7((prefix2) => pipe(flat.load(prefix2, op, split2), flatMap7((values3) => {
14272
14274
  if (values3.length === 0) {
14273
- const name = pipe(last(prefix2), getOrElse(() => "<n/a>"));
14274
- return fail2(MissingData([], `Expected ${op.description} with name ${name}`));
14275
+ const name2 = pipe(last(prefix2), getOrElse(() => "<n/a>"));
14276
+ return fail2(MissingData([], `Expected ${op.description} with name ${name2}`));
14275
14277
  }
14276
14278
  return succeed(values3);
14277
14279
  }))));
@@ -14323,18 +14325,18 @@ var fromFlatLoop = (flat, prefix, config2, split2) => {
14323
14325
  }
14324
14326
  };
14325
14327
  var fromFlatLoopFail = (prefix, path2) => (index) => left2(MissingData(prefix, `The element at index ${index} in a sequence at path "${path2}" was missing`));
14326
- var splitPathString = (text8, delim) => {
14327
- const split2 = text8.split(new RegExp(`\\s*${escape(delim)}\\s*`));
14328
+ var splitPathString = (text9, delim) => {
14329
+ const split2 = text9.split(new RegExp(`\\s*${escape(delim)}\\s*`));
14328
14330
  return split2;
14329
14331
  };
14330
- var parsePrimitive = (text8, path2, primitive2, delimiter, split2) => {
14332
+ var parsePrimitive = (text9, path2, primitive2, delimiter, split2) => {
14331
14333
  if (!split2) {
14332
- return pipe(primitive2.parse(text8), mapBoth2({
14334
+ return pipe(primitive2.parse(text9), mapBoth2({
14333
14335
  onFailure: prefixed(path2),
14334
14336
  onSuccess: of
14335
14337
  }));
14336
14338
  }
14337
- return pipe(splitPathString(text8, delimiter), forEachSequential((char4) => primitive2.parse(char4.trim())), mapError(prefixed(path2)));
14339
+ return pipe(splitPathString(text9, delimiter), forEachSequential((char4) => primitive2.parse(char4.trim())), mapError(prefixed(path2)));
14338
14340
  };
14339
14341
  var transpose = (array7) => {
14340
14342
  return Object.keys(array7[0]).map((column3) => array7.map((row) => row[column3]));
@@ -14515,7 +14517,7 @@ var randomHexString = /* @__PURE__ */ function() {
14515
14517
  };
14516
14518
  }();
14517
14519
  var NativeSpan = class {
14518
- constructor(name, parent, context7, links, startTime, kind) {
14520
+ constructor(name2, parent, context7, links, startTime, kind) {
14519
14521
  __publicField(this, "name");
14520
14522
  __publicField(this, "parent");
14521
14523
  __publicField(this, "context");
@@ -14529,7 +14531,7 @@ var NativeSpan = class {
14529
14531
  __publicField(this, "attributes");
14530
14532
  __publicField(this, "events", []);
14531
14533
  __publicField(this, "links");
14532
- this.name = name;
14534
+ this.name = name2;
14533
14535
  this.parent = parent;
14534
14536
  this.context = context7;
14535
14537
  this.startTime = startTime;
@@ -14554,15 +14556,15 @@ var NativeSpan = class {
14554
14556
  attribute(key, value5) {
14555
14557
  this.attributes.set(key, value5);
14556
14558
  }
14557
- event(name, startTime, attributes) {
14558
- this.events.push([name, startTime, attributes ?? {}]);
14559
+ event(name2, startTime, attributes) {
14560
+ this.events.push([name2, startTime, attributes ?? {}]);
14559
14561
  }
14560
14562
  addLinks(links) {
14561
14563
  this.links.push(...links);
14562
14564
  }
14563
14565
  };
14564
14566
  var nativeTracer = /* @__PURE__ */ make23({
14565
- span: (name, parent, context7, links, startTime, kind) => new NativeSpan(name, parent, context7, links, startTime, kind),
14567
+ span: (name2, parent, context7, links, startTime, kind) => new NativeSpan(name2, parent, context7, links, startTime, kind),
14566
14568
  context: (f) => f()
14567
14569
  });
14568
14570
  var addSpanStackTrace = (options3) => {
@@ -14669,8 +14671,8 @@ var make25 = (bytes) => {
14669
14671
  redactedRegistry.set(secret4, bytes.map((byte) => String.fromCharCode(byte)).join(""));
14670
14672
  return secret4;
14671
14673
  };
14672
- var fromString = (text8) => {
14673
- return make25(text8.split("").map((char4) => char4.charCodeAt(0)));
14674
+ var fromString = (text9) => {
14675
+ return make25(text9.split("").map((char4) => char4.charCodeAt(0)));
14674
14676
  };
14675
14677
 
14676
14678
  // node_modules/.pnpm/effect@3.15.0/node_modules/effect/dist/esm/internal/config.js
@@ -15103,18 +15105,18 @@ var _a18;
15103
15105
  var MicroCauseImpl = class extends globalThis.Error {
15104
15106
  constructor(_tag, originalError, traces) {
15105
15107
  const causeName = `MicroCause.${_tag}`;
15106
- let name;
15108
+ let name2;
15107
15109
  let message;
15108
15110
  let stack;
15109
15111
  if (originalError instanceof globalThis.Error) {
15110
- name = `(${causeName}) ${originalError.name}`;
15112
+ name2 = `(${causeName}) ${originalError.name}`;
15111
15113
  message = originalError.message;
15112
15114
  const messageLines = message.split("\n").length;
15113
- stack = originalError.stack ? `(${causeName}) ${originalError.stack.split("\n").slice(0, messageLines + 3).join("\n")}` : `${name}: ${message}`;
15115
+ stack = originalError.stack ? `(${causeName}) ${originalError.stack.split("\n").slice(0, messageLines + 3).join("\n")}` : `${name2}: ${message}`;
15114
15116
  } else {
15115
- name = causeName;
15117
+ name2 = causeName;
15116
15118
  message = toStringUnknown(originalError, 0);
15117
- stack = `${name}: ${message}`;
15119
+ stack = `${name2}: ${message}`;
15118
15120
  }
15119
15121
  if (traces.length > 0) {
15120
15122
  stack += `
@@ -15127,7 +15129,7 @@ var MicroCauseImpl = class extends globalThis.Error {
15127
15129
  this._tag = _tag;
15128
15130
  this.traces = traces;
15129
15131
  this[MicroCauseTypeId] = microCauseVariance;
15130
- this.name = name;
15132
+ this.name = name2;
15131
15133
  this.stack = stack;
15132
15134
  }
15133
15135
  pipe() {
@@ -15940,14 +15942,14 @@ var when = /* @__PURE__ */ dual(2, (self, condition) => suspend(() => condition(
15940
15942
  var serviceOption = (tag4) => map10(context(), getOption2(tag4));
15941
15943
  var bigint02 = /* @__PURE__ */ BigInt(0);
15942
15944
  var filterDisablePropagation = /* @__PURE__ */ flatMap((span2) => get5(span2.context, DisablePropagation) ? span2._tag === "Span" ? filterDisablePropagation(span2.parent) : none2() : some2(span2));
15943
- var unsafeMakeSpan = (fiber, name, options3) => {
15945
+ var unsafeMakeSpan = (fiber, name2, options3) => {
15944
15946
  const disablePropagation = !fiber.getFiberRef(currentTracerEnabled) || options3.context && get5(options3.context, DisablePropagation);
15945
15947
  const context7 = fiber.getFiberRef(currentContext);
15946
15948
  const parent = options3.parent ? some2(options3.parent) : options3.root ? none2() : filterDisablePropagation(getOption2(context7, spanTag));
15947
15949
  let span2;
15948
15950
  if (disablePropagation) {
15949
15951
  span2 = noopSpan({
15950
- name,
15952
+ name: name2,
15951
15953
  parent,
15952
15954
  context: add4(options3.context ?? empty8(), DisablePropagation, true)
15953
15955
  });
@@ -15960,7 +15962,7 @@ var unsafeMakeSpan = (fiber, name, options3) => {
15960
15962
  const annotationsFromEnv = get9(fiberRefs3, currentTracerSpanAnnotations);
15961
15963
  const linksFromEnv = get9(fiberRefs3, currentTracerSpanLinks);
15962
15964
  const links = linksFromEnv._tag === "Some" ? options3.links !== void 0 ? [...toReadonlyArray(linksFromEnv.value), ...options3.links ?? []] : toReadonlyArray(linksFromEnv.value) : options3.links ?? empty2();
15963
- span2 = tracer2.span(name, parent, options3.context ?? empty8(), links, timingEnabled ? clock3.unsafeCurrentTimeNanos() : bigint02, options3.kind ?? "internal");
15965
+ span2 = tracer2.span(name2, parent, options3.context ?? empty8(), links, timingEnabled ? clock3.unsafeCurrentTimeNanos() : bigint02, options3.kind ?? "internal");
15964
15966
  if (annotationsFromEnv._tag === "Some") {
15965
15967
  forEach3(annotationsFromEnv.value, (value5, key) => span2.attribute(key, value5));
15966
15968
  }
@@ -15982,11 +15984,11 @@ var endSpan = (span2, exit4, clock3, timingEnabled) => sync(() => {
15982
15984
  }
15983
15985
  span2.end(timingEnabled ? clock3.unsafeCurrentTimeNanos() : bigint02, exit4);
15984
15986
  });
15985
- var useSpan = (name, ...args2) => {
15987
+ var useSpan = (name2, ...args2) => {
15986
15988
  const options3 = addSpanStackTrace(args2.length === 1 ? void 0 : args2[0]);
15987
15989
  const evaluate2 = args2[args2.length - 1];
15988
15990
  return withFiberRuntime((fiber) => {
15989
- const span2 = unsafeMakeSpan(fiber, name, options3);
15991
+ const span2 = unsafeMakeSpan(fiber, name2, options3);
15990
15992
  const timingEnabled = fiber.getFiberRef(currentTracerTimingEnabled);
15991
15993
  const clock3 = get5(fiber.getFiberRef(currentServices), clockTag);
15992
15994
  return onExit(evaluate2(span2), (exit4) => endSpan(span2, exit4, clock3, timingEnabled));
@@ -15995,13 +15997,13 @@ var useSpan = (name, ...args2) => {
15995
15997
  var withParentSpan = /* @__PURE__ */ dual(2, (self, span2) => provideService(self, spanTag, span2));
15996
15998
  var withSpan = function() {
15997
15999
  const dataFirst = typeof arguments[0] !== "string";
15998
- const name = dataFirst ? arguments[1] : arguments[0];
16000
+ const name2 = dataFirst ? arguments[1] : arguments[0];
15999
16001
  const options3 = addSpanStackTrace(dataFirst ? arguments[2] : arguments[1]);
16000
16002
  if (dataFirst) {
16001
16003
  const self = arguments[0];
16002
- return useSpan(name, options3, (span2) => withParentSpan(self, span2));
16004
+ return useSpan(name2, options3, (span2) => withParentSpan(self, span2));
16003
16005
  }
16004
- return (self) => useSpan(name, options3, (span2) => withParentSpan(self, span2));
16006
+ return (self) => useSpan(name2, options3, (span2) => withParentSpan(self, span2));
16005
16007
  };
16006
16008
 
16007
16009
  // node_modules/.pnpm/effect@3.15.0/node_modules/effect/dist/esm/Exit.js
@@ -16163,14 +16165,14 @@ var structuredMessage = (u) => {
16163
16165
  }
16164
16166
  }
16165
16167
  };
16166
- var withColor = (text8, ...colors2) => {
16168
+ var withColor = (text9, ...colors2) => {
16167
16169
  let out = "";
16168
16170
  for (let i = 0; i < colors2.length; i++) {
16169
16171
  out += `\x1B[${colors2[i]}m`;
16170
16172
  }
16171
- return out + text8 + "\x1B[0m";
16173
+ return out + text9 + "\x1B[0m";
16172
16174
  };
16173
- var withColorNoop = (text8, ..._colors) => text8;
16175
+ var withColorNoop = (text9, ..._colors) => text9;
16174
16176
  var colors = {
16175
16177
  bold: "1",
16176
16178
  red: "31",
@@ -16454,14 +16456,14 @@ var metricKeyVariance = {
16454
16456
  var arrayEquivilence = /* @__PURE__ */ getEquivalence(equals);
16455
16457
  var _a31;
16456
16458
  var MetricKeyImpl = class {
16457
- constructor(name, keyType, description, tags2 = []) {
16459
+ constructor(name2, keyType, description, tags2 = []) {
16458
16460
  __publicField(this, "name");
16459
16461
  __publicField(this, "keyType");
16460
16462
  __publicField(this, "description");
16461
16463
  __publicField(this, "tags");
16462
16464
  __publicField(this, _a31, metricKeyVariance);
16463
16465
  __publicField(this, "_hash");
16464
- this.name = name;
16466
+ this.name = name2;
16465
16467
  this.keyType = keyType;
16466
16468
  this.description = description;
16467
16469
  this.tags = tags2;
@@ -16478,8 +16480,8 @@ var MetricKeyImpl = class {
16478
16480
  }
16479
16481
  };
16480
16482
  var isMetricKey = (u) => hasProperty(u, MetricKeyTypeId);
16481
- var counter2 = (name, options3) => new MetricKeyImpl(name, counter(options3), fromNullable(options3?.description));
16482
- var histogram2 = (name, boundaries, description) => new MetricKeyImpl(name, histogram(boundaries), fromNullable(description));
16483
+ var counter2 = (name2, options3) => new MetricKeyImpl(name2, counter(options3), fromNullable(options3?.description));
16484
+ var histogram2 = (name2, boundaries, description) => new MetricKeyImpl(name2, histogram(boundaries), fromNullable(description));
16483
16485
  var taggedWithLabels = /* @__PURE__ */ dual(2, (self, extraTags) => extraTags.length === 0 ? self : new MetricKeyImpl(self.name, self.keyType, self.description, union(self.tags, extraTags)));
16484
16486
 
16485
16487
  // node_modules/.pnpm/effect@3.15.0/node_modules/effect/dist/esm/MutableHashMap.js
@@ -17195,7 +17197,7 @@ var make32 = function(keyType, unsafeUpdate, unsafeValue, unsafeModify) {
17195
17197
  });
17196
17198
  return metric;
17197
17199
  };
17198
- var counter5 = (name, options3) => fromMetricKey(counter2(name, options3));
17200
+ var counter5 = (name2, options3) => fromMetricKey(counter2(name2, options3));
17199
17201
  var fromMetricKey = (key) => {
17200
17202
  let untaggedHook;
17201
17203
  const hookCache = /* @__PURE__ */ new WeakMap();
@@ -17217,7 +17219,7 @@ var fromMetricKey = (key) => {
17217
17219
  };
17218
17220
  return make32(key.keyType, (input, extraTags) => hook(extraTags).update(input), (extraTags) => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
17219
17221
  };
17220
- var histogram5 = (name, boundaries, description) => fromMetricKey(histogram2(name, boundaries, description));
17222
+ var histogram5 = (name2, boundaries, description) => fromMetricKey(histogram2(name2, boundaries, description));
17221
17223
  var tagged = /* @__PURE__ */ dual(3, (self, key, value5) => taggedWithLabels2(self, [make29(key, value5)]));
17222
17224
  var taggedWithLabels2 = /* @__PURE__ */ dual(2, (self, extraTags) => {
17223
17225
  return make32(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union(extraTags, extraTags1)), (extraTags1) => self.unsafeValue(union(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union(extraTags, extraTags1)));
@@ -20057,6 +20059,12 @@ var suspend4 = (evaluate2) => {
20057
20059
  suspend11.evaluate = evaluate2;
20058
20060
  return suspend11;
20059
20061
  };
20062
+ var sync4 = /* @__PURE__ */ dual(2, (a, b) => {
20063
+ const tagFirst = isTag2(a);
20064
+ const tag4 = tagFirst ? a : b;
20065
+ const evaluate2 = tagFirst ? b : a;
20066
+ return fromEffectContext(sync(() => make12(tag4, evaluate2())));
20067
+ });
20060
20068
  var provide = /* @__PURE__ */ dual(2, (self, that) => suspend4(() => {
20061
20069
  const provideTo = Object.create(proto5);
20062
20070
  provideTo._op_layer = OP_PROVIDE;
@@ -20472,7 +20480,7 @@ var fn = function(nameOrBody, ...pipeables) {
20472
20480
  Error.stackTraceLimit = 2;
20473
20481
  const errorDef = new Error();
20474
20482
  Error.stackTraceLimit = limit;
20475
- const name = nameOrBody;
20483
+ const name2 = nameOrBody;
20476
20484
  const options3 = pipeables[0];
20477
20485
  return (body, ...pipeables2) => defineLength(body.length, function(...args2) {
20478
20486
  const limit2 = Error.stackTraceLimit;
@@ -20484,7 +20492,7 @@ var fn = function(nameOrBody, ...pipeables) {
20484
20492
  body,
20485
20493
  args: args2,
20486
20494
  pipeables: pipeables2,
20487
- spanName: name,
20495
+ spanName: name2,
20488
20496
  spanOptions: options3,
20489
20497
  errorDef,
20490
20498
  errorCall
@@ -20607,13 +20615,13 @@ var formatUnknown = (u, checkCircular = true) => {
20607
20615
  JSON.stringify(u);
20608
20616
  }
20609
20617
  const pojo = `{${ownKeys(u).map((k) => `${isString(k) ? JSON.stringify(k) : String(k)}:${formatUnknown(u[k], false)}`).join(",")}}`;
20610
- const name = u.constructor.name;
20611
- return u.constructor !== Object.prototype.constructor ? `${name}(${pojo})` : pojo;
20618
+ const name2 = u.constructor.name;
20619
+ return u.constructor !== Object.prototype.constructor ? `${name2}(${pojo})` : pojo;
20612
20620
  } catch (e) {
20613
20621
  return "<circular structure>";
20614
20622
  }
20615
20623
  };
20616
- var formatPropertyKey = (name) => typeof name === "string" ? JSON.stringify(name) : String(name);
20624
+ var formatPropertyKey = (name2) => typeof name2 === "string" ? JSON.stringify(name2) : String(name2);
20617
20625
  var isNonEmpty5 = (x) => Array.isArray(x);
20618
20626
  var isSingle = (x) => !Array.isArray(x);
20619
20627
  var formatPathKey = (key) => `[${formatPropertyKey(key)}]`;
@@ -21071,11 +21079,11 @@ var formatTuple = (ast) => {
21071
21079
  });
21072
21080
  };
21073
21081
  var PropertySignature = class extends OptionalType {
21074
- constructor(name, type2, isOptional, isReadonly, annotations2) {
21082
+ constructor(name2, type2, isOptional, isReadonly, annotations2) {
21075
21083
  super(type2, isOptional, annotations2);
21076
21084
  __publicField(this, "name");
21077
21085
  __publicField(this, "isReadonly");
21078
- this.name = name;
21086
+ this.name = name2;
21079
21087
  this.isReadonly = isReadonly;
21080
21088
  }
21081
21089
  /**
@@ -21159,11 +21167,11 @@ var TypeLiteral = class {
21159
21167
  this.annotations = annotations2;
21160
21168
  const keys5 = {};
21161
21169
  for (let i = 0; i < propertySignatures.length; i++) {
21162
- const name = propertySignatures[i].name;
21163
- if (Object.prototype.hasOwnProperty.call(keys5, name)) {
21164
- throw new Error(getASTDuplicatePropertySignatureErrorMessage(name));
21170
+ const name2 = propertySignatures[i].name;
21171
+ if (Object.prototype.hasOwnProperty.call(keys5, name2)) {
21172
+ throw new Error(getASTDuplicatePropertySignatureErrorMessage(name2));
21165
21173
  }
21166
- keys5[name] = null;
21174
+ keys5[name2] = null;
21167
21175
  }
21168
21176
  const parameters = {
21169
21177
  string: false,
@@ -21609,8 +21617,8 @@ var record = (key, value5) => {
21609
21617
  }
21610
21618
  break;
21611
21619
  case "Enums": {
21612
- for (const [_, name] of key2.enums) {
21613
- propertySignatures.push(new PropertySignature(name, value5, false, true));
21620
+ for (const [_, name2] of key2.enums) {
21621
+ propertySignatures.push(new PropertySignature(name2, value5, false, true));
21614
21622
  }
21615
21623
  break;
21616
21624
  }
@@ -22345,13 +22353,13 @@ var go = (ast, isDecoding) => {
22345
22353
  const isExact = options3?.exact === true;
22346
22354
  for (let i = 0; i < propertySignatures.length; i++) {
22347
22355
  const ps = propertySignatures[i][1];
22348
- const name = ps.name;
22349
- const hasKey = Object.prototype.hasOwnProperty.call(input, name);
22356
+ const name2 = ps.name;
22357
+ const hasKey = Object.prototype.hasOwnProperty.call(input, name2);
22350
22358
  if (!hasKey) {
22351
22359
  if (ps.isOptional) {
22352
22360
  continue;
22353
22361
  } else if (isExact) {
22354
- const e = new Pointer(name, input, new Missing(ps));
22362
+ const e = new Pointer(name2, input, new Missing(ps));
22355
22363
  if (allErrors) {
22356
22364
  es.push([stepKey++, e]);
22357
22365
  continue;
@@ -22361,10 +22369,10 @@ var go = (ast, isDecoding) => {
22361
22369
  }
22362
22370
  }
22363
22371
  const parser = propertySignatures[i][0];
22364
- const te = parser(input[name], options3);
22372
+ const te = parser(input[name2], options3);
22365
22373
  if (isEither3(te)) {
22366
22374
  if (isLeft2(te)) {
22367
- const e = new Pointer(name, input, hasKey ? te.left : new Missing(ps));
22375
+ const e = new Pointer(name2, input, hasKey ? te.left : new Missing(ps));
22368
22376
  if (allErrors) {
22369
22377
  es.push([stepKey++, e]);
22370
22378
  continue;
@@ -22372,10 +22380,10 @@ var go = (ast, isDecoding) => {
22372
22380
  return left2(new Composite2(ast, input, e, output));
22373
22381
  }
22374
22382
  }
22375
- output[name] = te.right;
22383
+ output[name2] = te.right;
22376
22384
  } else {
22377
22385
  const nk = stepKey++;
22378
- const index = name;
22386
+ const index = name2;
22379
22387
  if (!queue) {
22380
22388
  queue = [];
22381
22389
  }
@@ -22458,9 +22466,9 @@ var go = (ast, isDecoding) => {
22458
22466
  }
22459
22467
  if (options3?.propertyOrder === "original") {
22460
22468
  const keys5 = inputKeys || ownKeys(input);
22461
- for (const name of expectedKeys) {
22462
- if (keys5.indexOf(name) === -1) {
22463
- keys5.push(name);
22469
+ for (const name2 of expectedKeys) {
22470
+ if (keys5.indexOf(name2) === -1) {
22471
+ keys5.push(name2);
22464
22472
  }
22465
22473
  }
22466
22474
  const out = {};
@@ -22511,29 +22519,29 @@ var go = (ast, isDecoding) => {
22511
22519
  if (ownKeysLen > 0) {
22512
22520
  if (isRecordOrArray(input)) {
22513
22521
  for (let i = 0; i < ownKeysLen; i++) {
22514
- const name = ownKeys2[i];
22515
- const buckets = searchTree.keys[name].buckets;
22516
- if (Object.prototype.hasOwnProperty.call(input, name)) {
22517
- const literal2 = String(input[name]);
22522
+ const name2 = ownKeys2[i];
22523
+ const buckets = searchTree.keys[name2].buckets;
22524
+ if (Object.prototype.hasOwnProperty.call(input, name2)) {
22525
+ const literal2 = String(input[name2]);
22518
22526
  if (Object.prototype.hasOwnProperty.call(buckets, literal2)) {
22519
22527
  candidates = candidates.concat(buckets[literal2]);
22520
22528
  } else {
22521
22529
  const {
22522
22530
  candidates: candidates2,
22523
22531
  literals
22524
- } = searchTree.keys[name];
22532
+ } = searchTree.keys[name2];
22525
22533
  const literalsUnion = Union.make(literals);
22526
- const errorAst = candidates2.length === astTypesLen ? new TypeLiteral([new PropertySignature(name, literalsUnion, false, true)], []) : Union.make(candidates2);
22527
- es.push([stepKey++, new Composite2(errorAst, input, new Pointer(name, input, new Type2(literalsUnion, input[name])))]);
22534
+ const errorAst = candidates2.length === astTypesLen ? new TypeLiteral([new PropertySignature(name2, literalsUnion, false, true)], []) : Union.make(candidates2);
22535
+ es.push([stepKey++, new Composite2(errorAst, input, new Pointer(name2, input, new Type2(literalsUnion, input[name2])))]);
22528
22536
  }
22529
22537
  } else {
22530
22538
  const {
22531
22539
  candidates: candidates2,
22532
22540
  literals
22533
- } = searchTree.keys[name];
22534
- const fakePropertySignature = new PropertySignature(name, Union.make(literals), false, true);
22541
+ } = searchTree.keys[name2];
22542
+ const fakePropertySignature = new PropertySignature(name2, Union.make(literals), false, true);
22535
22543
  const errorAst = candidates2.length === astTypesLen ? new TypeLiteral([fakePropertySignature], []) : Union.make(candidates2);
22536
- es.push([stepKey++, new Composite2(errorAst, input, new Pointer(name, input, new Missing(fakePropertySignature)))]);
22544
+ es.push([stepKey++, new Composite2(errorAst, input, new Pointer(name2, input, new Missing(fakePropertySignature)))]);
22537
22545
  }
22538
22546
  }
22539
22547
  } else {
@@ -22895,9 +22903,11 @@ var withMinimumLogLevel = /* @__PURE__ */ dual(2, (self, level) => fiberRefLocal
22895
22903
 
22896
22904
  // node_modules/.pnpm/effect@3.15.0/node_modules/effect/dist/esm/Layer.js
22897
22905
  var effect = fromEffect3;
22906
+ var merge7 = merge5;
22898
22907
  var mergeAll4 = mergeAll2;
22899
22908
  var scoped3 = scoped;
22900
22909
  var succeed10 = succeed7;
22910
+ var sync6 = sync4;
22901
22911
  var provide3 = provide;
22902
22912
  var provideMerge2 = provideMerge;
22903
22913
 
@@ -22911,7 +22921,7 @@ var defaultConfig = {
22911
22921
  showBuiltIns: true,
22912
22922
  showTypes: true
22913
22923
  };
22914
- var normalizeCase = /* @__PURE__ */ dual(2, (self, text8) => self.isCaseSensitive ? text8 : text8.toLowerCase());
22924
+ var normalizeCase = /* @__PURE__ */ dual(2, (self, text9) => self.isCaseSensitive ? text9 : text9.toLowerCase());
22915
22925
 
22916
22926
  // node_modules/.pnpm/@effect+cli@0.61.0_@effect+platform@0.82.0_effect@3.15.0__@effect+printer-ansi@0.43.0_@effect_47yie6mzjhwbbrbs5cq7mqvkpe/node_modules/@effect/cli/dist/esm/internal/autoCorrect.js
22917
22927
  var levensteinDistance = (first3, second, config2) => {
@@ -23521,11 +23531,11 @@ var acquireReleaseOut = /* @__PURE__ */ dual(2, (self, release) => {
23521
23531
  var collectElements = (self) => {
23522
23532
  return suspend6(() => {
23523
23533
  const builder = [];
23524
- return flatMap12(pipeTo(self, collectElementsReader(builder)), (value5) => sync6(() => [fromIterable2(builder), value5]));
23534
+ return flatMap12(pipeTo(self, collectElementsReader(builder)), (value5) => sync7(() => [fromIterable2(builder), value5]));
23525
23535
  });
23526
23536
  };
23527
23537
  var collectElementsReader = (builder) => readWith({
23528
- onInput: (outElem) => flatMap12(sync6(() => {
23538
+ onInput: (outElem) => flatMap12(sync7(() => {
23529
23539
  builder.push(outElem);
23530
23540
  }), () => collectElementsReader(builder)),
23531
23541
  onFailure: fail11,
@@ -23610,7 +23620,7 @@ var readWithCause = (options3) => {
23610
23620
  op.done = new ContinuationKImpl(options3.onDone, options3.onFailure);
23611
23621
  return op;
23612
23622
  };
23613
- var succeed11 = (value5) => sync6(() => value5);
23623
+ var succeed11 = (value5) => sync7(() => value5);
23614
23624
  var succeedNow = (result) => {
23615
23625
  const op = Object.create(proto8);
23616
23626
  op._tag = OP_SUCCEED_NOW;
@@ -23623,7 +23633,7 @@ var suspend6 = (evaluate2) => {
23623
23633
  op.channel = evaluate2;
23624
23634
  return op;
23625
23635
  };
23626
- var sync6 = (evaluate2) => {
23636
+ var sync7 = (evaluate2) => {
23627
23637
  const op = Object.create(proto8);
23628
23638
  op._tag = OP_SUCCEED;
23629
23639
  op.evaluate = evaluate2;
@@ -24699,7 +24709,7 @@ var identityChannel = () => readWith({
24699
24709
  onFailure: fail11,
24700
24710
  onDone: succeedNow
24701
24711
  });
24702
- var map20 = /* @__PURE__ */ dual(2, (self, f) => flatMap12(self, (a) => sync6(() => f(a))));
24712
+ var map20 = /* @__PURE__ */ dual(2, (self, f) => flatMap12(self, (a) => sync7(() => f(a))));
24703
24713
  var mapOut = /* @__PURE__ */ dual(2, (self, f) => {
24704
24714
  const reader = readWith({
24705
24715
  onInput: (outElem) => flatMap12(write(f(outElem)), () => reader),
@@ -25342,7 +25352,7 @@ var transduce = /* @__PURE__ */ dual(2, (self, sink) => {
25342
25352
  const upstreamMarker = readWith({
25343
25353
  onInput: (input) => flatMap12(write(input), () => upstreamMarker),
25344
25354
  onFailure: fail11,
25345
- onDone: (done8) => zipRight4(sync6(() => {
25355
+ onDone: (done8) => zipRight4(sync7(() => {
25346
25356
  upstreamDone.ref = true;
25347
25357
  }), succeedNow(done8))
25348
25358
  });
@@ -25970,10 +25980,10 @@ var char = (char4) => {
25970
25980
  op.char = char4;
25971
25981
  return op;
25972
25982
  };
25973
- var text = (text8) => {
25983
+ var text = (text9) => {
25974
25984
  const op = Object.create(proto15);
25975
25985
  op._tag = "Text";
25976
- op.text = text8;
25986
+ op.text = text9;
25977
25987
  return op;
25978
25988
  };
25979
25989
  var flatAlt = /* @__PURE__ */ dual(2, (self, that) => {
@@ -26262,10 +26272,10 @@ var char2 = /* @__PURE__ */ dual(2, (self, char4) => {
26262
26272
  op.stream = self;
26263
26273
  return op;
26264
26274
  });
26265
- var text2 = /* @__PURE__ */ dual(2, (self, text8) => {
26275
+ var text2 = /* @__PURE__ */ dual(2, (self, text9) => {
26266
26276
  const op = Object.create(proto16);
26267
26277
  op._tag = "TextStream";
26268
- op.text = text8;
26278
+ op.text = text9;
26269
26279
  op.stream = self;
26270
26280
  return op;
26271
26281
  });
@@ -27423,8 +27433,8 @@ var intersectTypeLiterals = (x, y, path2) => {
27423
27433
  if (isTypeLiteral(x) && isTypeLiteral(y)) {
27424
27434
  const propertySignatures = [...x.propertySignatures];
27425
27435
  for (const ps of y.propertySignatures) {
27426
- const name = ps.name;
27427
- const i = propertySignatures.findIndex((ps2) => ps2.name === name);
27436
+ const name2 = ps.name;
27437
+ const i = propertySignatures.findIndex((ps2) => ps2.name === name2);
27428
27438
  if (i === -1) {
27429
27439
  propertySignatures.push(ps);
27430
27440
  } else {
@@ -27432,7 +27442,7 @@ var intersectTypeLiterals = (x, y, path2) => {
27432
27442
  isOptional,
27433
27443
  type: type2
27434
27444
  } = propertySignatures[i];
27435
- propertySignatures[i] = new PropertySignature(name, extendAST(type2, ps.type, path2.concat(name)), isOptional, true);
27445
+ propertySignatures[i] = new PropertySignature(name2, extendAST(type2, ps.type, path2.concat(name2)), isOptional, true);
27436
27446
  }
27437
27447
  }
27438
27448
  return new TypeLiteral(propertySignatures, x.indexSignatures.concat(y.indexSignatures));
@@ -28388,12 +28398,12 @@ var windowsFigures = {
28388
28398
  pointer: /* @__PURE__ */ text3(">")
28389
28399
  };
28390
28400
  var figures = /* @__PURE__ */ map17(/* @__PURE__ */ sync5(() => process.platform === "win32"), (isWindows) => isWindows ? windowsFigures : defaultFigures);
28391
- function eraseText(text8, columns) {
28401
+ function eraseText(text9, columns) {
28392
28402
  if (columns === 0) {
28393
28403
  return cat2(eraseLine3, cursorTo3(0));
28394
28404
  }
28395
28405
  let rows = 0;
28396
- const lines3 = text8.split(/\r?\n/);
28406
+ const lines3 = text9.split(/\r?\n/);
28397
28407
  for (const line4 of lines3) {
28398
28408
  rows += 1 + Math.floor(Math.max(line4.length - 1, 0) / columns);
28399
28409
  }
@@ -28947,12 +28957,12 @@ function handleClear2(options3) {
28947
28957
  const terminal = yield* Terminal;
28948
28958
  const columns = yield* terminal.columns;
28949
28959
  const currentPath = yield* resolveCurrentPath(state.path, options3);
28950
- const text8 = "\n".repeat(Math.min(state.files.length, options3.maxPerPage));
28960
+ const text9 = "\n".repeat(Math.min(state.files.length, options3.maxPerPage));
28951
28961
  const clearPath = eraseText(currentPath, columns);
28952
28962
  const message = showConfirmation(state.confirm) ? CONFIRM_MESSAGE : options3.message;
28953
28963
  const clearPrompt = eraseText(`
28954
28964
  ${message}`, columns);
28955
- const clearOptions = eraseText(text8, columns);
28965
+ const clearOptions = eraseText(text9, columns);
28956
28966
  return clearOptions.pipe(cat2(clearPath), cat2(clearPrompt), optimize3(Deep), render3({
28957
28967
  style: "pretty",
28958
28968
  options: {
@@ -29662,8 +29672,8 @@ function handleClear4(options3) {
29662
29672
  const terminal = yield* Terminal;
29663
29673
  const columns = yield* terminal.columns;
29664
29674
  const clearPrompt = cat2(eraseLine3, cursorLeft3);
29665
- const text8 = "\n".repeat(Math.min(options3.choices.length, options3.maxPerPage)) + options3.message;
29666
- const clearOutput = eraseText(text8, columns);
29675
+ const text9 = "\n".repeat(Math.min(options3.choices.length, options3.maxPerPage)) + options3.message;
29676
+ const clearOutput = eraseText(text9, columns);
29667
29677
  return clearOutput.pipe(cat2(clearPrompt), optimize3(Deep), render3({
29668
29678
  style: "pretty",
29669
29679
  options: {
@@ -29749,7 +29759,7 @@ ${error4}`, columns))
29749
29759
  });
29750
29760
  }
29751
29761
  function renderInput2(nextState, options3, submitted) {
29752
- const text8 = getValue(nextState, options3);
29762
+ const text9 = getValue(nextState, options3);
29753
29763
  const annotation = match2(nextState.error, {
29754
29764
  onNone: () => {
29755
29765
  if (submitted) {
@@ -29767,10 +29777,10 @@ function renderInput2(nextState, options3, submitted) {
29767
29777
  return empty34;
29768
29778
  }
29769
29779
  case "password": {
29770
- return annotate2(text3("*".repeat(text8.length)), annotation);
29780
+ return annotate2(text3("*".repeat(text9.length)), annotation);
29771
29781
  }
29772
29782
  case "text": {
29773
- return annotate2(text3(text8), annotation);
29783
+ return annotate2(text3(text9), annotation);
29774
29784
  }
29775
29785
  }
29776
29786
  }
@@ -30154,6 +30164,11 @@ var path = (pathType, pathExists) => {
30154
30164
  op.pathExists = pathExists;
30155
30165
  return op;
30156
30166
  };
30167
+ var text6 = /* @__PURE__ */ (() => {
30168
+ const op = /* @__PURE__ */ Object.create(proto19);
30169
+ op._tag = "Text";
30170
+ return op;
30171
+ })();
30157
30172
  var getChoices = (self) => getChoicesInternal(self);
30158
30173
  var getHelp = (self) => getHelpInternal(self);
30159
30174
  var getTypeName = (self) => getTypeNameInternal(self);
@@ -30487,7 +30502,7 @@ var getZshCompletions = (self) => {
30487
30502
  return "";
30488
30503
  }
30489
30504
  case "Choice": {
30490
- const choices = pipe(map3(self.alternatives, ([name]) => name), join(" "));
30505
+ const choices = pipe(map3(self.alternatives, ([name2]) => name2), join(" "));
30491
30506
  return `:CHOICE:(${choices})`;
30492
30507
  }
30493
30508
  case "DateTime": {
@@ -30616,7 +30631,7 @@ var render4 = (self, config2) => {
30616
30631
  onNone: () => empty35,
30617
30632
  onSome: (s) => concat3(space3, text4(s))
30618
30633
  }) : empty35;
30619
- const namesToShow = config2.showAllNames ? self.names : self.names.length > 1 ? pipe(filter2(self.names, (name) => name.startsWith("--")), head, map2(of), getOrElse(() => self.names)) : self.names;
30634
+ const namesToShow = config2.showAllNames ? self.names : self.names.length > 1 ? pipe(filter2(self.names, (name2) => name2.startsWith("--")), head, map2(of), getOrElse(() => self.names)) : self.names;
30620
30635
  const nameInfo = text4(join(namesToShow, ", "));
30621
30636
  return config2.showAllNames && self.names.length > 1 ? of(spans([text4("("), nameInfo, typeInfo, text4(")")])) : of(concat3(nameInfo, typeInfo));
30622
30637
  }
@@ -30755,7 +30770,7 @@ var defaultBooleanOptions = {
30755
30770
  negationNames: [],
30756
30771
  aliases: []
30757
30772
  };
30758
- var boolean4 = (name, options3) => {
30773
+ var boolean4 = (name2, options3) => {
30759
30774
  const {
30760
30775
  aliases,
30761
30776
  ifPresent,
@@ -30764,7 +30779,7 @@ var boolean4 = (name, options3) => {
30764
30779
  ...defaultBooleanOptions,
30765
30780
  ...options3
30766
30781
  };
30767
- const option4 = makeSingle(name, aliases, boolean3(some2(ifPresent)));
30782
+ const option4 = makeSingle(name2, aliases, boolean3(some2(ifPresent)));
30768
30783
  if (isNonEmptyReadonlyArray(negationNames)) {
30769
30784
  const head5 = headNonEmpty(negationNames);
30770
30785
  const tail = tailNonEmpty(negationNames);
@@ -30773,10 +30788,10 @@ var boolean4 = (name, options3) => {
30773
30788
  }
30774
30789
  return withDefault2(option4, !ifPresent);
30775
30790
  };
30776
- var choiceWithValue = (name, choices) => makeSingle(name, empty2(), choice(choices));
30777
- var file2 = (name, config2) => makeSingle(name, empty2(), path("file", config2?.exists));
30778
- var fileParse = (name, format6) => mapEffect5(fileText(name), ([path2, content]) => mapError2(parse5(path2, content, format6), (error4) => invalidValue(p(error4))));
30779
- var fileText = (name) => mapEffect5(file2(name, {
30791
+ var choiceWithValue = (name2, choices) => makeSingle(name2, empty2(), choice(choices));
30792
+ var file2 = (name2, config2) => makeSingle(name2, empty2(), path("file", config2?.exists));
30793
+ var fileParse = (name2, format6) => mapEffect5(fileText(name2), ([path2, content]) => mapError2(parse5(path2, content, format6), (error4) => invalidValue(p(error4))));
30794
+ var fileText = (name2) => mapEffect5(file2(name2, {
30780
30795
  exists: "yes"
30781
30796
  }), (path2) => mapError2(readString(path2), (error4) => invalidValue(p(error4))));
30782
30797
  var none10 = /* @__PURE__ */ (() => {
@@ -30784,6 +30799,7 @@ var none10 = /* @__PURE__ */ (() => {
30784
30799
  op._tag = "Empty";
30785
30800
  return op;
30786
30801
  })();
30802
+ var text7 = (name2) => makeSingle(name2, empty2(), text6);
30787
30803
  var getHelp3 = (self) => getHelpInternal2(self);
30788
30804
  var getUsage = (self) => getUsageInternal(self);
30789
30805
  var map28 = /* @__PURE__ */ dual(2, (self, f) => makeMap(self, (a) => right2(f(a))));
@@ -31039,11 +31055,11 @@ var makeOrElse = (left3, right3) => {
31039
31055
  op.right = right3;
31040
31056
  return op;
31041
31057
  };
31042
- var makeSingle = (name, aliases, primitiveType, description = empty36, pseudoName = none2()) => {
31058
+ var makeSingle = (name2, aliases, primitiveType, description = empty36, pseudoName = none2()) => {
31043
31059
  const op = Object.create(proto21);
31044
31060
  op._tag = "Single";
31045
- op.name = name;
31046
- op.fullName = makeFullName(name)[1];
31061
+ op.name = name2;
31062
+ op.fullName = makeFullName(name2)[1];
31047
31063
  op.placeholder = `${getOrElse(pseudoName, () => getTypeName(primitiveType))}`;
31048
31064
  op.aliases = aliases;
31049
31065
  op.primitiveType = primitiveType;
@@ -31164,7 +31180,7 @@ var parseInternal = (self, args2, config2) => {
31164
31180
  return _void;
31165
31181
  }
31166
31182
  case "Single": {
31167
- const singleNames = filterMap2(getNames(self), (name) => get7(args2, name));
31183
+ const singleNames = filterMap2(getNames(self), (name2) => get7(args2, name2));
31168
31184
  if (isNonEmptyReadonlyArray(singleNames)) {
31169
31185
  const head5 = headNonEmpty(singleNames);
31170
31186
  const tail = tailNonEmpty(singleNames);
@@ -31233,16 +31249,16 @@ var parseInternal = (self, args2, config2) => {
31233
31249
  case "Variadic": {
31234
31250
  const min4 = getOrElse(self.min, () => 0);
31235
31251
  const max6 = getOrElse(self.max, () => Number.MAX_SAFE_INTEGER);
31236
- const matchedArgument = filterMap2(getNames(self), (name) => get7(args2, name));
31252
+ const matchedArgument = filterMap2(getNames(self), (name2) => get7(args2, name2));
31237
31253
  const validateMinMax = (values3) => {
31238
31254
  if (values3.length < min4) {
31239
- const name = self.argumentOption.fullName;
31240
- const error4 = `Expected at least ${min4} value(s) for option: '${name}'`;
31255
+ const name2 = self.argumentOption.fullName;
31256
+ const error4 = `Expected at least ${min4} value(s) for option: '${name2}'`;
31241
31257
  return fail8(invalidValue(p(error4)));
31242
31258
  }
31243
31259
  if (values3.length > max6) {
31244
- const name = self.argumentOption.fullName;
31245
- const error4 = `Expected at most ${max6} value(s) for option: '${name}'`;
31260
+ const name2 = self.argumentOption.fullName;
31261
+ const error4 = `Expected at most ${max6} value(s) for option: '${name2}'`;
31246
31262
  return fail8(invalidValue(p(error4)));
31247
31263
  }
31248
31264
  const primitive2 = self.argumentOption.primitiveType;
@@ -31375,7 +31391,7 @@ var matchOptions = (input, options3, config2) => {
31375
31391
  if (isEmpty3(map1)) {
31376
31392
  return succeed8([none2(), input, map1]);
31377
31393
  }
31378
- return matchOptions(otherArgs, otherOptions, config2).pipe(map17(([error4, otherArgs2, map210]) => [error4, otherArgs2, merge8(map1, fromIterable(map210))]));
31394
+ return matchOptions(otherArgs, otherOptions, config2).pipe(map17(([error4, otherArgs2, map210]) => [error4, otherArgs2, merge9(map1, fromIterable(map210))]));
31379
31395
  }), catchAll2((e) => succeed8([some2(e), input, empty9()])));
31380
31396
  }
31381
31397
  return isEmptyReadonlyArray(input) ? succeed8([none2(), empty2(), empty9()]) : succeed8([none2(), input, empty9()]);
@@ -31388,9 +31404,9 @@ var findOptions = (input, options3, config2) => matchLeft(options3, {
31388
31404
  }) => match2(parsed, {
31389
31405
  onNone: () => findOptions(leftover2, tail, config2).pipe(map17(([nextArgs, nextOptions, map33]) => [nextArgs, prepend(nextOptions, head5), map33])),
31390
31406
  onSome: ({
31391
- name,
31407
+ name: name2,
31392
31408
  values: values3
31393
- }) => succeed8([leftover2, tail, make16([name, values3])])
31409
+ }) => succeed8([leftover2, tail, make16([name2, values3])])
31394
31410
  })), catchTags2({
31395
31411
  CorrectedFlag: (e) => findOptions(input, tail, config2).pipe(catchSome2(() => some2(fail8(e))), flatMap9(([otherArgs, otherOptions, map33]) => fail8(e).pipe(when2(() => isEmpty3(map33)), as4([otherArgs, prepend(otherOptions, head5), map33])))),
31396
31412
  MissingFlag: () => findOptions(input, tail, config2).pipe(map17(([otherArgs, otherOptions, map33]) => [otherArgs, prepend(otherOptions, head5), map33])),
@@ -31427,7 +31443,7 @@ var parseCommandLine = (self, args2, config2) => {
31427
31443
  onNonEmpty: (head5, tail) => {
31428
31444
  const normalize = (value5) => normalizeCase(config2, value5);
31429
31445
  const normalizedHead = normalize(head5);
31430
- const normalizedNames = map3(getNames(self), (name) => normalize(name));
31446
+ const normalizedNames = map3(getNames(self), (name2) => normalize(name2));
31431
31447
  if (contains2(normalizedNames, normalizedHead)) {
31432
31448
  if (isBool(self.primitiveType)) {
31433
31449
  return matchLeft(tail, {
@@ -31500,7 +31516,7 @@ var parseCommandLine = (self, args2, config2) => {
31500
31516
  })));
31501
31517
  }
31502
31518
  case "KeyValueMap": {
31503
- const normalizedNames = map3(getNames(self.argumentOption), (name) => normalizeCase(config2, name));
31519
+ const normalizedNames = map3(getNames(self.argumentOption), (name2) => normalizeCase(config2, name2));
31504
31520
  return matchLeft(args2, {
31505
31521
  onEmpty: () => succeed8({
31506
31522
  parsed: none2(),
@@ -31511,8 +31527,8 @@ var parseCommandLine = (self, args2, config2) => {
31511
31527
  let keyValues = empty2();
31512
31528
  let leftover2 = args3;
31513
31529
  while (isNonEmptyReadonlyArray(leftover2)) {
31514
- const name = headNonEmpty(leftover2).trim();
31515
- const normalizedName2 = normalizeCase(config2, name);
31530
+ const name2 = headNonEmpty(leftover2).trim();
31531
+ const normalizedName2 = normalizeCase(config2, name2);
31516
31532
  if (leftover2.length >= 2 && contains2(normalizedNames, normalizedName2)) {
31517
31533
  const keyValue = leftover2[1].trim();
31518
31534
  const [key, value5] = keyValue.split("=");
@@ -31522,10 +31538,10 @@ var parseCommandLine = (self, args2, config2) => {
31522
31538
  continue;
31523
31539
  }
31524
31540
  }
31525
- if (name.includes("=")) {
31526
- const [key, value5] = name.split("=");
31541
+ if (name2.includes("=")) {
31542
+ const [key, value5] = name2.split("=");
31527
31543
  if (key !== void 0 && value5 !== void 0 && value5.length > 0) {
31528
- keyValues = append(keyValues, name);
31544
+ keyValues = append(keyValues, name2);
31529
31545
  leftover2 = leftover2.slice(1);
31530
31546
  continue;
31531
31547
  }
@@ -31553,17 +31569,17 @@ var parseCommandLine = (self, args2, config2) => {
31553
31569
  });
31554
31570
  }
31555
31571
  case "Variadic": {
31556
- const normalizedNames = map3(getNames(self.argumentOption), (name) => normalizeCase(config2, name));
31572
+ const normalizedNames = map3(getNames(self.argumentOption), (name2) => normalizeCase(config2, name2));
31557
31573
  let optionName = void 0;
31558
31574
  let values3 = empty2();
31559
31575
  let unparsed = args2;
31560
31576
  let leftover2 = empty2();
31561
31577
  while (isNonEmptyReadonlyArray(unparsed)) {
31562
- const name = headNonEmpty(unparsed);
31563
- const normalizedName = normalizeCase(config2, name);
31578
+ const name2 = headNonEmpty(unparsed);
31579
+ const normalizedName = normalizeCase(config2, name2);
31564
31580
  if (contains2(normalizedNames, normalizedName)) {
31565
31581
  if (optionName === void 0) {
31566
- optionName = name;
31582
+ optionName = name2;
31567
31583
  }
31568
31584
  const value5 = unparsed[1];
31569
31585
  if (value5 !== void 0 && value5.length > 0) {
@@ -31575,8 +31591,8 @@ var parseCommandLine = (self, args2, config2) => {
31575
31591
  unparsed = unparsed.slice(1);
31576
31592
  }
31577
31593
  }
31578
- const parsed = fromNullable(optionName).pipe(orElse(() => some2(self.argumentOption.fullName)), map2((name) => ({
31579
- name,
31594
+ const parsed = fromNullable(optionName).pipe(orElse(() => some2(self.argumentOption.fullName)), map2((name2) => ({
31595
+ name: name2,
31580
31596
  values: values3
31581
31597
  })));
31582
31598
  return succeed8({
@@ -31594,12 +31610,12 @@ var matchUnclustered = (input, tail, options3, config2) => {
31594
31610
  if (isEmpty3(map1)) {
31595
31611
  return fail8(unclusteredFlag(empty36, empty2(), tail));
31596
31612
  }
31597
- return matchUnclustered(otherFlags, tail, opts1, config2).pipe(map17(([_2, opts2, map210]) => [tail, opts2, merge8(map1, fromIterable(map210))]));
31613
+ return matchUnclustered(otherFlags, tail, opts1, config2).pipe(map17(([_2, opts2, map210]) => [tail, opts2, merge9(map1, fromIterable(map210))]));
31598
31614
  }));
31599
31615
  }
31600
31616
  return succeed8([tail, options3, empty9()]);
31601
31617
  };
31602
- var merge8 = (map1, map210) => {
31618
+ var merge9 = (map1, map210) => {
31603
31619
  if (isNonEmptyReadonlyArray(map210)) {
31604
31620
  const head5 = headNonEmpty(map210);
31605
31621
  const tail = tailNonEmpty(map210);
@@ -31607,7 +31623,7 @@ var merge8 = (map1, map210) => {
31607
31623
  onNone: () => set3(map1, head5[0], head5[1]),
31608
31624
  onSome: (elems) => set3(map1, head5[0], appendAll(elems, head5[1]))
31609
31625
  });
31610
- return merge8(newMap, tail);
31626
+ return merge9(newMap, tail);
31611
31627
  }
31612
31628
  return map1;
31613
31629
  };
@@ -31669,7 +31685,7 @@ var getFishCompletions2 = (self) => {
31669
31685
  case "Single": {
31670
31686
  const description = getShortDescription(self);
31671
31687
  const order = mapInput2(boolean, (tuple3) => !tuple3[0]);
31672
- return pipe(prepend(self.aliases, self.name), map3((name) => [name.length === 1, name]), sort(order), flatMap2(([isShort, name]) => make4(isShort ? "-s" : "-l", name)), appendAll(getFishCompletions(self.primitiveType)), appendAll(description.length === 0 ? empty2() : of(`-d '${description}'`)), join(" "), of);
31688
+ return pipe(prepend(self.aliases, self.name), map3((name2) => [name2.length === 1, name2]), sort(order), flatMap2(([isShort, name2]) => make4(isShort ? "-s" : "-l", name2)), appendAll(getFishCompletions(self.primitiveType)), appendAll(description.length === 0 ? empty2() : of(`-d '${description}'`)), join(" "), of);
31673
31689
  }
31674
31690
  case "KeyValueMap":
31675
31691
  case "Variadic": {
@@ -31700,7 +31716,7 @@ var getZshCompletions2 = (self, state = {
31700
31716
  const possibleValues = getZshCompletions(self.primitiveType);
31701
31717
  const multiple = state.multiple ? "*" : "";
31702
31718
  const conflicts = isNonEmptyReadonlyArray(state.conflicts) ? `(${join(state.conflicts, " ")})` : "";
31703
- return map3(names, (name) => `${conflicts}${multiple}${name}[${escape2(description)}]${possibleValues}`);
31719
+ return map3(names, (name2) => `${conflicts}${multiple}${name2}[${escape2(description)}]${possibleValues}`);
31704
31720
  }
31705
31721
  case "KeyValueMap": {
31706
31722
  return getZshCompletions2(self.argumentOption, {
@@ -31744,7 +31760,9 @@ var getZshCompletions2 = (self, state = {
31744
31760
  var all7 = all6;
31745
31761
  var boolean5 = boolean4;
31746
31762
  var fileParse2 = fileParse;
31763
+ var text8 = text7;
31747
31764
  var withAlias2 = withAlias;
31765
+ var withDefault3 = withDefault2;
31748
31766
  var withDescription3 = withDescription2;
31749
31767
 
31750
31768
  // node_modules/.pnpm/@effect+platform@0.82.0_effect@3.15.0/node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
@@ -33661,7 +33679,7 @@ var validateInternal2 = (self, args2, config2) => {
33661
33679
  return fail8(missingValue(p(`Missing argument ${getTypeName(self.primitiveType)}`)));
33662
33680
  },
33663
33681
  onNonEmpty: (head5, tail) => validate4(self.primitiveType, some2(head5), config2).pipe(mapBoth4({
33664
- onFailure: (text8) => invalidArgument(p(text8)),
33682
+ onFailure: (text9) => invalidArgument(p(text9)),
33665
33683
  onSuccess: (a) => [tail, a]
33666
33684
  }))
33667
33685
  });
@@ -33920,10 +33938,10 @@ var proto23 = {
33920
33938
  };
33921
33939
  var isCommand2 = (u) => typeof u === "object" && u != null && TypeId24 in u;
33922
33940
  var isStandard = (self) => self._tag === "Standard";
33923
- var make59 = (name, options3 = none10, args2 = none11) => {
33941
+ var make59 = (name2, options3 = none10, args2 = none11) => {
33924
33942
  const op = Object.create(proto23);
33925
33943
  op._tag = "Standard";
33926
- op.name = name;
33944
+ op.name = name2;
33927
33945
  op.description = empty36;
33928
33946
  op.options = options3;
33929
33947
  op.args = args2;
@@ -34138,7 +34156,7 @@ var parseInternal2 = (self, args2, config2) => {
34138
34156
  case "Subcommands": {
34139
34157
  const names = getNamesInternal(self);
34140
34158
  const subcommands = getSubcommandsInternal(self);
34141
- const [parentArgs, childArgs] = span(args2, (arg) => !some3(subcommands, ([name]) => name === arg));
34159
+ const [parentArgs, childArgs] = span(args2, (arg) => !some3(subcommands, ([name2]) => name2 === arg));
34142
34160
  const parseChildren = suspend5(() => {
34143
34161
  const iterator = self.children[Symbol.iterator]();
34144
34162
  const loop2 = (next) => {
@@ -34185,7 +34203,7 @@ var parseInternal2 = (self, args2, config2) => {
34185
34203
  onFailure: (err) => {
34186
34204
  if (isCommandMismatch(err)) {
34187
34205
  const parentName = getOrElse(head(names), () => "");
34188
- const childNames = map3(subcommands, ([name]) => `'${name}'`);
34206
+ const childNames = map3(subcommands, ([name2]) => `'${name2}'`);
34189
34207
  const oneOf = childNames.length === 1 ? "" : " one of";
34190
34208
  const error4 = p(`Invalid subcommand for ${parentName} - use${oneOf} ${join(childNames, ", ")}`);
34191
34209
  return commandMismatch(error4);
@@ -34255,11 +34273,11 @@ var wizardInternal4 = (self, prefix, config2) => {
34255
34273
  title,
34256
34274
  value: [title, index]
34257
34275
  });
34258
- const choices = pipe(getSubcommandsInternal(self2), map3(([name], index) => makeChoice(name, index)));
34276
+ const choices = pipe(getSubcommandsInternal(self2), map3(([name2], index) => makeChoice(name2, index)));
34259
34277
  return loop2(self2.parent, commandLineRef).pipe(zipRight3(select({
34260
34278
  message,
34261
34279
  choices
34262
- }).pipe(tap2(([name]) => update3(commandLineRef, append(name))), zipLeft2(log2()), flatMap9(([, nextIndex]) => loop2(self2.children[nextIndex], commandLineRef)))));
34280
+ }).pipe(tap2(([name2]) => update3(commandLineRef, append(name2))), zipLeft2(log2()), flatMap9(([, nextIndex]) => loop2(self2.children[nextIndex], commandLineRef)))));
34263
34281
  }
34264
34282
  }
34265
34283
  };
@@ -34326,7 +34344,7 @@ var getBashCompletionsInternal = (self, executable) => traverseCommand(self, emp
34326
34344
  const options3 = isStandard(info2.command) ? all7([info2.command.options, builtIns]) : builtIns;
34327
34345
  const optionNames = getNames(options3);
34328
34346
  const optionCases = isStandard(info2.command) ? getBashCompletions2(info2.command.options) : empty2();
34329
- const subcommandNames = pipe(info2.subcommands, map3(([name]) => name), sort(string2));
34347
+ const subcommandNames = pipe(info2.subcommands, map3(([name2]) => name2), sort(string2));
34330
34348
  const wordList = appendAll(optionNames, subcommandNames);
34331
34349
  const preformatted = isEmptyReadonlyArray(info2.parentCommands) ? of(info2.command.name) : pipe(info2.parentCommands, append(info2.command.name), map3((command) => command.replace("-", "__")));
34332
34350
  const caseName = join(preformatted, ",");
@@ -34348,9 +34366,9 @@ var getFishCompletionsInternal = (self, executable) => traverseCommand(self, emp
34348
34366
  const optionsCompletions = getFishCompletions2(options3);
34349
34367
  const argsCompletions = isStandard(info2.command) ? getFishCompletions3(info2.command.args) : empty2();
34350
34368
  const rootCompletions = (conditionals2) => pipe(map3(optionsCompletions, (option4) => pipe(baseTemplate, appendAll(conditionals2), append(option4), join(" "))), appendAll(map3(argsCompletions, (option4) => pipe(baseTemplate, appendAll(conditionals2), append(option4), join(" ")))));
34351
- const subcommandCompletions = (conditionals2) => map3(info2.subcommands, ([name, subcommand]) => {
34369
+ const subcommandCompletions = (conditionals2) => map3(info2.subcommands, ([name2, subcommand]) => {
34352
34370
  const description = getShortDescription3(subcommand);
34353
- return pipe(baseTemplate, appendAll(conditionals2), appendAll(make4("-f", "-a", `"${name}"`)), appendAll(description.length === 0 ? empty2() : make4("-d", `'${description}'`)), join(" "));
34371
+ return pipe(baseTemplate, appendAll(conditionals2), appendAll(make4("-f", "-a", `"${name2}"`)), appendAll(description.length === 0 ? empty2() : make4("-d", `'${description}'`)), join(" "));
34354
34372
  });
34355
34373
  if (isEmptyReadonlyArray(info2.parentCommands)) {
34356
34374
  const conditionals2 = make4("-n", '"__fish_use_subcommand"');
@@ -34363,7 +34381,7 @@ var getFishCompletionsInternal = (self, executable) => traverseCommand(self, emp
34363
34381
  append(info2.command.name),
34364
34382
  map3((command) => `__fish_seen_subcommand_from ${command}`)
34365
34383
  );
34366
- const subcommandConditionals = map3(info2.subcommands, ([name]) => `not __fish_seen_subcommand_from ${name}`);
34384
+ const subcommandConditionals = map3(info2.subcommands, ([name2]) => `not __fish_seen_subcommand_from ${name2}`);
34367
34385
  const baseConditionals = pipe(appendAll(parentConditionals, subcommandConditionals), join("; and "));
34368
34386
  const conditionals = make4("-n", `"${baseConditionals}"`);
34369
34387
  return succeed8(pipe(state, appendAll(rootCompletions(conditionals)), appendAll(subcommandCompletions(conditionals))));
@@ -34372,9 +34390,9 @@ var getZshCompletionsInternal = (self, executable) => traverseCommand(self, empt
34372
34390
  const preformatted = isEmptyReadonlyArray(info2.parentCommands) ? of(info2.command.name) : pipe(info2.parentCommands, append(info2.command.name), map3((command) => command.replace("-", "__")));
34373
34391
  const underscoreName = join(preformatted, "__");
34374
34392
  const spaceName = join(preformatted, " ");
34375
- const subcommands = pipe(info2.subcommands, map3(([name, subcommand]) => {
34393
+ const subcommands = pipe(info2.subcommands, map3(([name2, subcommand]) => {
34376
34394
  const desc = getShortDescription3(subcommand);
34377
- return `'${name}:${desc}' \\`;
34395
+ return `'${name2}:${desc}' \\`;
34378
34396
  }));
34379
34397
  const commands = isEmptyReadonlyArray(subcommands) ? `commands=()` : `commands=(
34380
34398
  ${join(indentAll(subcommands, 8), "\n")}
@@ -34518,10 +34536,10 @@ var handleBuiltInOption = (self, executable, args2, builtIn2, execute2, config2)
34518
34536
  const description = descriptionList([[text4("Instructions"), instructions]]);
34519
34537
  const header = h1(spans([code("Wizard Mode for CLI Application:"), space3, code(self.name), space3, code(`(${self.version})`), summary5]));
34520
34538
  const help = sequence(header, description);
34521
- const text8 = toAnsiText(help);
34539
+ const text9 = toAnsiText(help);
34522
34540
  const command = fromIterable(getNames2(self.command))[0];
34523
34541
  const wizardPrefix = getWizardPrefix(builtIn2, command, args2);
34524
- return log2(text8).pipe(zipRight3(wizard4(builtIn2.command, wizardPrefix, config2)), tap2((args3) => log2(toAnsiText(renderWizardArgs(args3)))), flatMap9((args3) => toggle2({
34542
+ return log2(text9).pipe(zipRight3(wizard4(builtIn2.command, wizardPrefix, config2)), tap2((args3) => log2(toAnsiText(renderWizardArgs(args3)))), flatMap9((args3) => toggle2({
34525
34543
  message: "Would you like to run the command?",
34526
34544
  initial: true,
34527
34545
  active: "yes",
@@ -34572,7 +34590,7 @@ var prefixCommand = (self) => {
34572
34590
  };
34573
34591
  var getWizardPrefix = (builtIn2, rootCommand, commandLineArgs) => {
34574
34592
  const subcommands = getSubcommands(builtIn2.command);
34575
- const [parentArgs, childArgs] = span(commandLineArgs, (name) => !has4(subcommands, name));
34593
+ const [parentArgs, childArgs] = span(commandLineArgs, (name2) => !has4(subcommands, name2));
34576
34594
  const args2 = matchLeft(childArgs, {
34577
34595
  onEmpty: () => filter2(parentArgs, (arg) => arg !== "--wizard"),
34578
34596
  onNonEmpty: (head5) => append(parentArgs, head5)
@@ -34681,18 +34699,18 @@ var fromDescriptor = /* @__PURE__ */ dual((args2) => isCommand2(args2[0]), (desc
34681
34699
  const self = makeProto(descriptor2, handler ?? ((_) => failSync2(() => helpRequested(getDescriptor(self)))), GenericTag(`@effect/cli/Command/(${fromIterable(getNames2(descriptor2)).join("|")})`));
34682
34700
  return self;
34683
34701
  });
34684
- var makeDescriptor = (name, config2) => {
34702
+ var makeDescriptor = (name2, config2) => {
34685
34703
  const {
34686
34704
  args: args2,
34687
34705
  options: options3,
34688
34706
  tree
34689
34707
  } = parseConfig(config2);
34690
- return map32(make59(name, all6(options3), all8(args2)), ({
34708
+ return map32(make59(name2, all6(options3), all8(args2)), ({
34691
34709
  args: args3,
34692
34710
  options: options4
34693
34711
  }) => reconstructConfigTree(tree, args3, options4));
34694
34712
  };
34695
- var make61 = (name, config2 = {}, handler) => fromDescriptor(makeDescriptor(name, config2), handler);
34713
+ var make61 = (name2, config2 = {}, handler) => fromDescriptor(makeDescriptor(name2, config2), handler);
34696
34714
  var withHandler = /* @__PURE__ */ dual(2, (self, handler) => makeDerive(self, {
34697
34715
  handler,
34698
34716
  transform: identity
@@ -34740,8 +34758,20 @@ var make63 = gen2(function* () {
34740
34758
  const classes = /* @__PURE__ */ new Set();
34741
34759
  const enums = /* @__PURE__ */ new Set();
34742
34760
  const refStore = /* @__PURE__ */ new Map();
34743
- const addSchema = (name, root2, context7, asStruct = false) => {
34761
+ function cleanupSchema(schema) {
34762
+ if ("type" in schema && Array.isArray(schema.type) && schema.type.includes("null")) {
34763
+ schema.type = schema.type.filter((_) => _ !== "null")[0];
34764
+ schema.nullable = true;
34765
+ }
34766
+ if ("type" in schema && "oneOf" in schema && Array.isArray(schema.oneOf) && schema.oneOf.length === 0) {
34767
+ delete schema.oneOf;
34768
+ }
34769
+ return schema;
34770
+ }
34771
+ const addSchema = (name2, root2, context7, asStruct = false) => {
34772
+ cleanupSchema(root2);
34744
34773
  function addRefs(schema, childName, asStruct2 = true) {
34774
+ cleanupSchema(schema);
34745
34775
  if ("$ref" in schema) {
34746
34776
  const resolved = resolveRef(schema, {
34747
34777
  ...root2,
@@ -34761,7 +34791,7 @@ var make63 = gen2(function* () {
34761
34791
  }
34762
34792
  } else if ("properties" in schema) {
34763
34793
  Object.entries(schema.properties).forEach(
34764
- ([name2, s]) => addRefs(s, childName ? childName + identifier2(name2) : void 0)
34794
+ ([name3, s]) => addRefs(s, childName ? childName + identifier2(name3) : void 0)
34765
34795
  );
34766
34796
  } else if ("type" in schema && schema.type === "array") {
34767
34797
  if (Array.isArray(schema.items)) {
@@ -34805,25 +34835,36 @@ var make63 = gen2(function* () {
34805
34835
  addRefs(root2, void 0, false);
34806
34836
  return identifier2(root2.$ref.split("/").pop());
34807
34837
  } else {
34808
- addRefs(root2, "properties" in root2 ? name : void 0);
34809
- store.set(name, root2);
34838
+ addRefs(root2, "properties" in root2 ? name2 : void 0);
34839
+ store.set(name2, root2);
34810
34840
  if (!asStruct) {
34811
- classes.add(name);
34841
+ classes.add(name2);
34812
34842
  }
34813
34843
  }
34814
- return name;
34844
+ return name2;
34815
34845
  };
34816
- const topLevelSource = (S, name, schema) => {
34817
- const isClass = classes.has(name);
34818
- const isEnum = enums.has(name);
34819
- return toSource(S, schema, name, isClass || isEnum).pipe(
34820
- map2((source) => {
34821
- const isObject2 = "properties" in schema;
34822
- if (!isObject2 || !isClass) {
34823
- return `export class ${name} extends ${source} {}`;
34824
- }
34825
- return `export class ${name} extends ${S}.Class<${name}>("${name}")(${source}) {}`;
34826
- })
34846
+ const topLevelSource = (importName, name2, schema) => {
34847
+ const isClass = classes.has(name2);
34848
+ const isEnum = enums.has(name2);
34849
+ const topLevel = transformer.supportsTopLevel({
34850
+ importName,
34851
+ schema,
34852
+ name: name2,
34853
+ isClass,
34854
+ isEnum
34855
+ });
34856
+ return toSource(importName, schema, name2, topLevel).pipe(
34857
+ map2(
34858
+ (source) => transformer.onTopLevel({
34859
+ importName,
34860
+ schema,
34861
+ description: fromNullable(schema.description),
34862
+ name: name2,
34863
+ source,
34864
+ isClass,
34865
+ isEnum
34866
+ })
34867
+ )
34827
34868
  );
34828
34869
  };
34829
34870
  const getSchema = (raw) => {
@@ -34846,7 +34887,8 @@ var make63 = gen2(function* () {
34846
34887
  }
34847
34888
  return getSchema(schema);
34848
34889
  };
34849
- const toSource = (S, schema, currentIdentifier, topLevel = false) => {
34890
+ const transformer = yield* JsonSchemaTransformer;
34891
+ const toSource = (importName, schema, currentIdentifier, topLevel = false) => {
34850
34892
  if ("properties" in schema) {
34851
34893
  const obj = schema;
34852
34894
  const required2 = obj.required ?? [];
@@ -34855,145 +34897,153 @@ var make63 = gen2(function* () {
34855
34897
  filterMap2(([key, schema2]) => {
34856
34898
  const fullSchema = getSchema(schema2);
34857
34899
  const isOptional = !required2.includes(key);
34858
- return toSource(S, schema2, currentIdentifier + identifier2(key)).pipe(
34900
+ return toSource(
34901
+ importName,
34902
+ schema2,
34903
+ currentIdentifier + identifier2(key)
34904
+ ).pipe(
34859
34905
  map2(
34860
- applyAnnotations(S, {
34906
+ (source) => transformer.onProperty({
34907
+ importName,
34908
+ description: fromNullable(schema2.description),
34909
+ key,
34910
+ source,
34861
34911
  isOptional,
34862
- isNullable: "nullable" in fullSchema && fullSchema.nullable === true || "default" in fullSchema && fullSchema.default === null,
34863
- default: fullSchema.default
34912
+ isNullable: "nullable" in fullSchema && fullSchema.nullable === true || "default" in fullSchema && fullSchema.default === null
34864
34913
  })
34865
- ),
34866
- map2((source) => `"${key}": ${source}`)
34914
+ )
34867
34915
  );
34868
34916
  }),
34869
- join(",\n ")
34917
+ join(transformer.propertySeparator)
34870
34918
  );
34871
34919
  return some2(
34872
- `${topLevel ? "" : `${S}.Struct(`}{
34873
- ${properties}
34874
- }${topLevel ? "" : ")"}`
34920
+ transformer.onObject({ importName, properties, topLevel })
34875
34921
  );
34876
34922
  } else if ("type" in schema && schema.type === "null") {
34877
- return some2(`${S}.Null`);
34923
+ return some2(transformer.onNull({ importName }));
34878
34924
  } else if ("type" in schema && schema.type === "object") {
34879
- return some2(
34880
- `${S}.Record({ key: ${S}.String, value: ${S}.Unknown })`
34881
- );
34925
+ return some2(transformer.onRecord({ importName }));
34882
34926
  } else if ("enum" in schema) {
34883
34927
  if (!topLevel && enums.has(currentIdentifier)) {
34884
- return some2(currentIdentifier);
34885
- }
34886
- const items = schema.enum.map((_) => JSON.stringify(_)).join(", ");
34887
- return some2(`${S}.Literal(${items})`);
34888
- } else if ("type" in schema && schema.type) {
34889
- switch (schema.type) {
34890
- case "string": {
34891
- const modifiers = [];
34892
- if ("minLength" in schema) {
34893
- modifiers.push(`${S}.minLength(${schema.minLength})`);
34894
- }
34895
- if ("maxLength" in schema) {
34896
- modifiers.push(`${S}.maxLength(${schema.maxLength})`);
34897
- }
34898
- if ("pattern" in schema) {
34899
- modifiers.push(
34900
- `${S}.pattern(new RegExp(${JSON.stringify(schema.pattern)}))`
34901
- );
34902
- }
34903
- return some2(`${S}.String${pipeSource(modifiers)}`);
34904
- }
34905
- case "integer":
34906
- case "number": {
34907
- const modifiers = [];
34908
- const minimum = typeof schema.exclusiveMinimum === "number" ? schema.exclusiveMinimum : schema.minimum;
34909
- const exclusiveMinimum = typeof schema.exclusiveMinimum === "boolean" ? schema.exclusiveMinimum : typeof schema.exclusiveMinimum === "number";
34910
- const maximum = typeof schema.exclusiveMaximum === "number" ? schema.exclusiveMaximum : schema.maximum;
34911
- const exclusiveMaximum = typeof schema.exclusiveMaximum === "boolean" ? schema.exclusiveMaximum : typeof schema.exclusiveMaximum === "number";
34912
- if (minimum !== void 0) {
34913
- modifiers.push(
34914
- `${S}.greaterThan${exclusiveMinimum ? "" : "OrEqualTo"}(${schema.minimum})`
34915
- );
34916
- }
34917
- if (maximum !== void 0) {
34918
- modifiers.push(
34919
- `${S}.lessThan${exclusiveMaximum ? "" : "OrEqualTo"}(${schema.maximum})`
34920
- );
34921
- }
34922
- return some2(
34923
- `${S}.${schema.type === "integer" ? "Int" : "Number"}${pipeSource(modifiers)}`
34924
- );
34925
- }
34926
- case "boolean": {
34927
- return some2(`${S}.Boolean`);
34928
- }
34929
- case "array": {
34930
- const modifiers = [];
34931
- const nonEmpty = typeof schema.minItems === "number" && schema.minItems === 1 && schema.maxItems === void 0;
34932
- if ("minItems" in schema && !nonEmpty) {
34933
- modifiers.push(`${S}.minItems(${schema.minItems})`);
34934
- }
34935
- if ("maxItems" in schema) {
34936
- modifiers.push(`${S}.maxItems(${schema.maxItems})`);
34937
- }
34938
- return toSource(S, itemsSchema(schema.items), currentIdentifier).pipe(
34939
- map2(
34940
- (source) => `${S}.${nonEmpty ? "NonEmpty" : ""}Array(${source})${pipeSource(modifiers)}`
34941
- )
34942
- );
34943
- }
34928
+ return some2(
34929
+ transformer.onRef({ importName, name: currentIdentifier })
34930
+ );
34944
34931
  }
34932
+ const items = schema.enum.map((_) => JSON.stringify(_));
34933
+ return some2(
34934
+ transformer.onEnum({
34935
+ importName,
34936
+ items
34937
+ })
34938
+ );
34945
34939
  } else if ("$ref" in schema) {
34946
34940
  if (!schema.$ref.startsWith("#")) {
34947
34941
  return none2();
34948
34942
  }
34949
- const name = identifier2(schema.$ref.split("/").pop());
34950
- return some2(name);
34943
+ const name2 = identifier2(schema.$ref.split("/").pop());
34944
+ return some2(transformer.onRef({ importName, name: name2 }));
34951
34945
  } else if ("properties" in schema) {
34952
34946
  return toSource(
34953
- S,
34947
+ importName,
34954
34948
  { type: "object", ...schema },
34955
34949
  currentIdentifier,
34956
34950
  topLevel
34957
34951
  );
34958
34952
  } else if ("allOf" in schema) {
34959
34953
  if (store.has(currentIdentifier)) {
34960
- return some2(currentIdentifier);
34954
+ return some2(
34955
+ transformer.onRef({ importName, name: currentIdentifier })
34956
+ );
34961
34957
  }
34962
34958
  const sources = schema.allOf;
34963
34959
  if (sources.length === 0) {
34964
34960
  return none2();
34965
34961
  } else if (sources.length === 1) {
34966
- return toSource(S, sources[0], currentIdentifier + "Enum", topLevel);
34962
+ return toSource(
34963
+ importName,
34964
+ sources[0],
34965
+ currentIdentifier + "Enum",
34966
+ topLevel
34967
+ );
34967
34968
  }
34968
34969
  const flattened2 = flattenAllOf(schema);
34969
- return toSource(S, flattened2, currentIdentifier + "Enum", topLevel);
34970
+ return toSource(
34971
+ importName,
34972
+ flattened2,
34973
+ currentIdentifier + "Enum",
34974
+ topLevel
34975
+ );
34970
34976
  } else if ("anyOf" in schema || "oneOf" in schema) {
34971
- const sources = pipe(
34977
+ const items = pipe(
34972
34978
  "anyOf" in schema ? schema.anyOf : schema.oneOf,
34973
- filterMap2((_) => toSource(S, _, currentIdentifier + "Enum"))
34979
+ filterMap2(
34980
+ (_) => toSource(importName, _, currentIdentifier + "Enum").pipe(
34981
+ map2(
34982
+ (source) => ({
34983
+ description: fromNullable(_.description),
34984
+ title: fromNullable(_.title),
34985
+ source
34986
+ })
34987
+ )
34988
+ )
34989
+ )
34974
34990
  );
34975
- if (sources.length === 0) return none2();
34976
- else if (sources.length === 1) return some2(sources[0]);
34977
- return some2(`${S}.Union(${sources.join(", ")})`);
34991
+ if (items.length === 0) return none2();
34992
+ else if (items.length === 1) return some2(items[0].source);
34993
+ return some2(transformer.onUnion({ importName, items, topLevel }));
34978
34994
  } else if ("const" in schema) {
34979
- return some2(`${S}.Literal(${JSON.stringify(schema.const)})`);
34995
+ return some2(
34996
+ transformer.onEnum({
34997
+ importName,
34998
+ items: [JSON.stringify(schema.const)]
34999
+ })
35000
+ );
35001
+ } else if ("type" in schema && schema.type) {
35002
+ switch (schema.type) {
35003
+ case "string": {
35004
+ return some2(transformer.onString({ importName, schema }));
35005
+ }
35006
+ case "integer":
35007
+ case "number": {
35008
+ const minimum = typeof schema.exclusiveMinimum === "number" ? schema.exclusiveMinimum : schema.minimum;
35009
+ const exclusiveMinimum = typeof schema.exclusiveMinimum === "boolean" ? schema.exclusiveMinimum : typeof schema.exclusiveMinimum === "number";
35010
+ const maximum = typeof schema.exclusiveMaximum === "number" ? schema.exclusiveMaximum : schema.maximum;
35011
+ const exclusiveMaximum = typeof schema.exclusiveMaximum === "boolean" ? schema.exclusiveMaximum : typeof schema.exclusiveMaximum === "number";
35012
+ return some2(
35013
+ transformer.onNumber({
35014
+ importName,
35015
+ schema,
35016
+ minimum,
35017
+ exclusiveMinimum,
35018
+ maximum,
35019
+ exclusiveMaximum
35020
+ })
35021
+ );
35022
+ }
35023
+ case "boolean": {
35024
+ return some2(transformer.onBoolean({ importName }));
35025
+ }
35026
+ case "array": {
35027
+ const nonEmpty = typeof schema.minItems === "number" && schema.minItems === 1 && schema.maxItems === void 0;
35028
+ return toSource(
35029
+ importName,
35030
+ itemsSchema(schema.items),
35031
+ currentIdentifier
35032
+ ).pipe(
35033
+ map2(
35034
+ (item) => transformer.onArray({
35035
+ importName,
35036
+ schema,
35037
+ item,
35038
+ nonEmpty
35039
+ })
35040
+ )
35041
+ );
35042
+ }
35043
+ }
34980
35044
  }
34981
35045
  return none2();
34982
35046
  };
34983
- const applyAnnotations = (S, options3) => (source) => {
34984
- if (options3.isNullable && options3.default === null) {
34985
- return `${S}.optionalWith(${S}.NullOr(${source}), { default: () => null })`;
34986
- }
34987
- const defaultSource = options3.default !== void 0 && options3.default !== null ? `() => ${JSON.stringify(options3.default)} as const` : void 0;
34988
- if (options3.isOptional) {
34989
- return defaultSource ? `${S}.optionalWith(${source}, { nullable: true, default: ${defaultSource} })` : `${S}.optionalWith(${source}, { nullable: true })`;
34990
- }
34991
- const newSource = options3.isNullable ? `${S}.NullOr(${source})` : source;
34992
- if (defaultSource) {
34993
- return `${newSource}.pipe(${S}.propertySignature, ${S}.withConstructorDefault(${defaultSource}))`;
34994
- }
34995
- return newSource;
34996
- };
34997
35047
  const itemsSchema = (schema) => {
34998
35048
  if (schema === void 0) {
34999
35049
  return { $id: "/schemas/any" };
@@ -35002,22 +35052,186 @@ var make63 = gen2(function* () {
35002
35052
  }
35003
35053
  return schema;
35004
35054
  };
35005
- const pipeSource = (modifers) => modifers.length === 0 ? "" : `.pipe(${modifers.join(", ")})`;
35006
35055
  const generate = (importName) => sync5(
35007
35056
  () => pipe(
35008
35057
  store.entries(),
35009
35058
  filterMap2(
35010
- ([name, schema]) => topLevelSource(importName, name, schema)
35059
+ ([name2, schema]) => topLevelSource(importName, name2, schema)
35011
35060
  ),
35012
35061
  join("\n\n")
35013
35062
  )
35014
35063
  );
35015
35064
  return { addSchema, generate };
35016
35065
  });
35017
- var _JsonSchemaGen = class _JsonSchemaGen extends Tag2("JsonSchemaGen")() {
35066
+ var JsonSchemaGen = class extends Tag2("JsonSchemaGen")() {
35067
+ };
35068
+ var with_ = provideServiceEffect2(JsonSchemaGen, make63);
35069
+ var JsonSchemaTransformer = class extends Tag2("JsonSchemaTransformer")() {
35018
35070
  };
35019
- _JsonSchemaGen.with = provideServiceEffect2(_JsonSchemaGen, make63);
35020
- var JsonSchemaGen = _JsonSchemaGen;
35071
+ var layerTransformerSchema = sync6(JsonSchemaTransformer, () => {
35072
+ const applyAnnotations = (S, options3) => (source) => {
35073
+ if (options3.isNullable && options3.default === null) {
35074
+ return `${S}.optionalWith(${S}.NullOr(${source}), { default: () => null })`;
35075
+ }
35076
+ const defaultSource = options3.default !== void 0 && options3.default !== null ? `() => ${JSON.stringify(options3.default)} as const` : void 0;
35077
+ if (options3.isOptional) {
35078
+ return defaultSource ? `${S}.optionalWith(${source}, { nullable: true, default: ${defaultSource} })` : `${S}.optionalWith(${source}, { nullable: true })`;
35079
+ }
35080
+ const newSource = options3.isNullable ? `${S}.NullOr(${source})` : source;
35081
+ if (defaultSource) {
35082
+ return `${newSource}.pipe(${S}.propertySignature, ${S}.withConstructorDefault(${defaultSource}))`;
35083
+ }
35084
+ return newSource;
35085
+ };
35086
+ const pipeSource = (modifers) => modifers.length === 0 ? "" : `.pipe(${modifers.join(", ")})`;
35087
+ return JsonSchemaTransformer.of({
35088
+ supportsTopLevel({ isClass, isEnum }) {
35089
+ return isClass || isEnum;
35090
+ },
35091
+ onTopLevel({ importName, schema, name: name2, source, isClass }) {
35092
+ const isObject2 = "properties" in schema;
35093
+ if (!isObject2 || !isClass) {
35094
+ return `export class ${name2} extends ${source} {}`;
35095
+ }
35096
+ return `export class ${name2} extends ${importName}.Class<${name2}>("${name2}")(${source}) {}`;
35097
+ },
35098
+ propertySeparator: ",\n ",
35099
+ onProperty: (options3) => {
35100
+ const source = applyAnnotations(
35101
+ options3.importName,
35102
+ options3
35103
+ )(options3.source);
35104
+ return `"${options3.key}": ${source}`;
35105
+ },
35106
+ onRef({ name: name2 }) {
35107
+ return name2;
35108
+ },
35109
+ onObject({ importName, properties, topLevel }) {
35110
+ return `${topLevel ? "" : `${importName}.Struct(`}{
35111
+ ${properties}
35112
+ }${topLevel ? "" : ")"}`;
35113
+ },
35114
+ onNull({ importName }) {
35115
+ return `${importName}.Null`;
35116
+ },
35117
+ onBoolean({ importName }) {
35118
+ return `${importName}.Boolean`;
35119
+ },
35120
+ onRecord({ importName }) {
35121
+ return `${importName}.Record({ key: ${importName}.String, value: ${importName}.Unknown })`;
35122
+ },
35123
+ onEnum({ importName, items }) {
35124
+ return `${importName}.Literal(${items.join(", ")})`;
35125
+ },
35126
+ onString({ importName, schema }) {
35127
+ const modifiers = [];
35128
+ if ("minLength" in schema) {
35129
+ modifiers.push(`${importName}.minLength(${schema.minLength})`);
35130
+ }
35131
+ if ("maxLength" in schema) {
35132
+ modifiers.push(`${importName}.maxLength(${schema.maxLength})`);
35133
+ }
35134
+ if ("pattern" in schema) {
35135
+ modifiers.push(
35136
+ `${importName}.pattern(new RegExp(${JSON.stringify(schema.pattern)}))`
35137
+ );
35138
+ }
35139
+ return `${importName}.String${pipeSource(modifiers)}`;
35140
+ },
35141
+ onNumber({
35142
+ importName,
35143
+ schema,
35144
+ minimum,
35145
+ exclusiveMinimum,
35146
+ maximum,
35147
+ exclusiveMaximum
35148
+ }) {
35149
+ const modifiers = [];
35150
+ if (minimum !== void 0) {
35151
+ modifiers.push(
35152
+ `${importName}.greaterThan${exclusiveMinimum ? "" : "OrEqualTo"}(${schema.minimum})`
35153
+ );
35154
+ }
35155
+ if (maximum !== void 0) {
35156
+ modifiers.push(
35157
+ `${importName}.lessThan${exclusiveMaximum ? "" : "OrEqualTo"}(${schema.maximum})`
35158
+ );
35159
+ }
35160
+ return `${importName}.${schema.type === "integer" ? "Int" : "Number"}${pipeSource(modifiers)}`;
35161
+ },
35162
+ onArray({ importName, schema, item, nonEmpty }) {
35163
+ const modifiers = [];
35164
+ if ("minItems" in schema && !nonEmpty) {
35165
+ modifiers.push(`${importName}.minItems(${schema.minItems})`);
35166
+ }
35167
+ if ("maxItems" in schema) {
35168
+ modifiers.push(`${importName}.maxItems(${schema.maxItems})`);
35169
+ }
35170
+ return `${importName}.${nonEmpty ? "NonEmpty" : ""}Array(${item})${pipeSource(modifiers)}`;
35171
+ },
35172
+ onUnion({ importName, items }) {
35173
+ return `${importName}.Union(${items.map((_) => _.source).join(", ")})`;
35174
+ }
35175
+ });
35176
+ });
35177
+ var layerTransformerTs = succeed10(
35178
+ JsonSchemaTransformer,
35179
+ JsonSchemaTransformer.of({
35180
+ supportsTopLevel() {
35181
+ return true;
35182
+ },
35183
+ onTopLevel({ name: name2, source, schema, description }) {
35184
+ return source[0] === "{" ? "oneOf" in schema ? `${toComment(description)}export enum ${name2} ${source}` : `${toComment(description)}export interface ${name2} ${source}` : `${toComment(description)}export type ${name2} = ${source}`;
35185
+ },
35186
+ propertySeparator: ";\n ",
35187
+ onProperty(options3) {
35188
+ return `${toComment(options3.description)}readonly "${options3.key}"${options3.isOptional ? "?" : ""}: ${options3.source}${options3.isNullable ? " | null" : ""}`;
35189
+ },
35190
+ onRef({ name: name2 }) {
35191
+ return name2;
35192
+ },
35193
+ onObject({ properties }) {
35194
+ return `{
35195
+ ${properties}
35196
+ }`;
35197
+ },
35198
+ onNull() {
35199
+ return "null";
35200
+ },
35201
+ onBoolean() {
35202
+ return "boolean";
35203
+ },
35204
+ onRecord() {
35205
+ return "Record<string, unknown>";
35206
+ },
35207
+ onEnum({ items }) {
35208
+ return items.join(" | ");
35209
+ },
35210
+ onString() {
35211
+ return "string";
35212
+ },
35213
+ onNumber() {
35214
+ return "number";
35215
+ },
35216
+ onArray({ item }) {
35217
+ return `ReadonlyArray<${item}>`;
35218
+ },
35219
+ onUnion({ items, topLevel }) {
35220
+ const useEnum = topLevel && !items.some((_) => isNone2(_.title));
35221
+ if (!useEnum) {
35222
+ return items.map((_) => _.source).join(" | ");
35223
+ }
35224
+ return `{
35225
+ ${items.map(({ description, title, source }) => `${toComment(description)}${JSON.stringify(getOrNull(title))} = ${source}`).join(",\n ")}}
35226
+ `;
35227
+ }
35228
+ })
35229
+ );
35230
+ var toComment = match2({
35231
+ onNone: () => "",
35232
+ onSome: (description) => `/** ${description} */
35233
+ `
35234
+ });
35021
35235
  function mergeSchemas(self, other) {
35022
35236
  if ("properties" in self && "properties" in other) {
35023
35237
  return {
@@ -35071,13 +35285,13 @@ function resolveRef(schema, context7, recursive = false) {
35071
35285
  return;
35072
35286
  }
35073
35287
  const path2 = schema.$ref.slice(2).split("/");
35074
- const name = identifier2(path2[path2.length - 1]);
35288
+ const name2 = identifier2(path2[path2.length - 1]);
35075
35289
  let current = context7;
35076
35290
  for (const key of path2) {
35077
35291
  if (!current) return;
35078
35292
  current = current[key];
35079
35293
  }
35080
- return { name, schema: resolveAllOf(current, context7, recursive) };
35294
+ return { name: name2, schema: resolveAllOf(current, context7, recursive) };
35081
35295
  }
35082
35296
 
35083
35297
  // src/OpenApi.ts
@@ -35104,198 +35318,190 @@ var make64 = gen2(function* () {
35104
35318
  });
35105
35319
  })
35106
35320
  );
35107
- const generate = fnUntraced2(function* (spec2) {
35108
- const gen3 = yield* JsonSchemaGen;
35109
- const components = spec2.components ? { ...spec2.components } : { schemas: {} };
35110
- const context7 = { components };
35111
- const operations = [];
35112
- function resolveRef2(ref) {
35113
- const parts2 = ref.split("/").slice(1);
35114
- let current = spec2;
35115
- for (const part of parts2) {
35116
- current = current[part];
35117
- }
35118
- return current;
35119
- }
35120
- const handlePath = (path2, methods) => methodNames.filter((method) => !!methods[method] && !!methods[method].operationId).forEach((method) => {
35121
- const { ids: pathIds, path: pathTemplate } = processPath(path2);
35122
- const operation = methods[method];
35123
- const op = {
35124
- id: camelize(operation.operationId),
35125
- method,
35126
- pathIds,
35127
- pathTemplate,
35128
- urlParams: [],
35129
- headers: [],
35130
- cookies: [],
35131
- successSchemas: /* @__PURE__ */ new Map(),
35132
- errorSchemas: /* @__PURE__ */ new Map()
35133
- };
35134
- const schemaId = identifier2(operation.operationId);
35135
- const validParameters = operation.parameters?.filter(
35136
- (_) => _.in !== "path" && _.in !== "cookie"
35137
- ) ?? [];
35138
- if (validParameters.length > 0) {
35139
- const schema = {
35140
- type: "object",
35141
- properties: {},
35142
- required: []
35321
+ const generate = fnUntraced2(
35322
+ function* (spec2, options3) {
35323
+ const gen3 = yield* JsonSchemaGen;
35324
+ const components = spec2.components ? { ...spec2.components } : { schemas: {} };
35325
+ const context7 = { components };
35326
+ const operations = [];
35327
+ function resolveRef2(ref) {
35328
+ const parts2 = ref.split("/").slice(1);
35329
+ let current = spec2;
35330
+ for (const part of parts2) {
35331
+ current = current[part];
35332
+ }
35333
+ return current;
35334
+ }
35335
+ const handlePath = (path2, methods) => methodNames.filter(
35336
+ (method) => !!methods[method] && !!methods[method].operationId
35337
+ ).forEach((method) => {
35338
+ const { ids: pathIds, path: pathTemplate } = processPath(path2);
35339
+ const operation = methods[method];
35340
+ const op = {
35341
+ id: camelize(operation.operationId),
35342
+ method,
35343
+ pathIds,
35344
+ pathTemplate,
35345
+ urlParams: [],
35346
+ headers: [],
35347
+ cookies: [],
35348
+ successSchemas: /* @__PURE__ */ new Map(),
35349
+ errorSchemas: /* @__PURE__ */ new Map()
35143
35350
  };
35144
- validParameters.forEach((parameter) => {
35145
- if ("$ref" in parameter) {
35146
- parameter = resolveRef2(parameter.$ref);
35147
- }
35148
- if (parameter.in === "path") {
35149
- return;
35150
- }
35151
- const paramSchema = parameter.schema;
35152
- const added = [];
35153
- if ("properties" in paramSchema) {
35154
- const required2 = paramSchema.required ?? [];
35155
- Object.entries(paramSchema.properties).forEach(
35156
- ([name, propSchema]) => {
35157
- const adjustedName = `${parameter.name}[${name}]`;
35158
- schema.properties[adjustedName] = propSchema;
35159
- if (required2.includes(name)) {
35160
- schema.required.push(adjustedName);
35351
+ const schemaId = identifier2(operation.operationId);
35352
+ const validParameters = operation.parameters?.filter(
35353
+ (_) => _.in !== "path" && _.in !== "cookie"
35354
+ ) ?? [];
35355
+ if (validParameters.length > 0) {
35356
+ const schema = {
35357
+ type: "object",
35358
+ properties: {},
35359
+ required: []
35360
+ };
35361
+ validParameters.forEach((parameter) => {
35362
+ if ("$ref" in parameter) {
35363
+ parameter = resolveRef2(parameter.$ref);
35364
+ }
35365
+ if (parameter.in === "path") {
35366
+ return;
35367
+ }
35368
+ const paramSchema = parameter.schema;
35369
+ const added = [];
35370
+ if ("properties" in paramSchema) {
35371
+ const required2 = paramSchema.required ?? [];
35372
+ Object.entries(paramSchema.properties).forEach(
35373
+ ([name2, propSchema]) => {
35374
+ const adjustedName = `${parameter.name}[${name2}]`;
35375
+ schema.properties[adjustedName] = propSchema;
35376
+ if (required2.includes(name2)) {
35377
+ schema.required.push(adjustedName);
35378
+ }
35379
+ added.push(adjustedName);
35161
35380
  }
35162
- added.push(adjustedName);
35163
- }
35164
- );
35165
- } else {
35166
- schema.properties[parameter.name] = parameter.schema;
35167
- parameter.required && schema.required.push(parameter.name);
35168
- added.push(parameter.name);
35169
- }
35170
- if (parameter.in === "query") {
35171
- op.urlParams.push(...added);
35172
- } else if (parameter.in === "header") {
35173
- op.headers.push(...added);
35174
- } else if (parameter.in === "cookie") {
35175
- op.cookies.push(...added);
35176
- }
35177
- });
35178
- op.params = gen3.addSchema(
35179
- `${schemaId}Params`,
35180
- schema,
35181
- context7,
35182
- true
35183
- );
35184
- }
35185
- if (operation.requestBody?.content?.["application/json"]?.schema) {
35186
- op.payload = gen3.addSchema(
35187
- `${schemaId}Request`,
35188
- operation.requestBody.content["application/json"].schema,
35189
- context7
35190
- );
35191
- } else if (operation.requestBody?.content?.["multipart/form-data"]) {
35192
- op.payload = "FormData";
35193
- }
35194
- Object.entries(operation.responses ?? {}).forEach(
35195
- ([status2, response]) => {
35196
- if (response.content?.["application/json"]?.schema) {
35197
- const schemaName = gen3.addSchema(
35198
- `${schemaId}${status2}`,
35199
- response.content["application/json"].schema,
35200
- context7,
35201
- true
35202
- );
35203
- const statusLower = status2.toLowerCase();
35204
- const statusMajorNumber = Number(status2[0]);
35205
- if (statusMajorNumber < 4) {
35206
- op.successSchemas.set(statusLower, schemaName);
35381
+ );
35207
35382
  } else {
35208
- op.errorSchemas.set(statusLower, schemaName);
35383
+ schema.properties[parameter.name] = parameter.schema;
35384
+ parameter.required && schema.required.push(parameter.name);
35385
+ added.push(parameter.name);
35209
35386
  }
35210
- }
35387
+ if (parameter.in === "query") {
35388
+ op.urlParams.push(...added);
35389
+ } else if (parameter.in === "header") {
35390
+ op.headers.push(...added);
35391
+ } else if (parameter.in === "cookie") {
35392
+ op.cookies.push(...added);
35393
+ }
35394
+ });
35395
+ op.params = gen3.addSchema(
35396
+ `${schemaId}Params`,
35397
+ schema,
35398
+ context7,
35399
+ true
35400
+ );
35211
35401
  }
35402
+ if (operation.requestBody?.content?.["application/json"]?.schema) {
35403
+ op.payload = gen3.addSchema(
35404
+ `${schemaId}Request`,
35405
+ operation.requestBody.content["application/json"].schema,
35406
+ context7
35407
+ );
35408
+ } else if (operation.requestBody?.content?.["multipart/form-data"]) {
35409
+ op.payload = "FormData";
35410
+ }
35411
+ Object.entries(operation.responses ?? {}).forEach(
35412
+ ([status2, response]) => {
35413
+ if (response.content?.["application/json"]?.schema) {
35414
+ const schemaName = gen3.addSchema(
35415
+ `${schemaId}${status2}`,
35416
+ response.content["application/json"].schema,
35417
+ context7,
35418
+ true
35419
+ );
35420
+ const statusLower = status2.toLowerCase();
35421
+ const statusMajorNumber = Number(status2[0]);
35422
+ if (statusMajorNumber < 4) {
35423
+ op.successSchemas.set(statusLower, schemaName);
35424
+ } else {
35425
+ op.errorSchemas.set(statusLower, schemaName);
35426
+ }
35427
+ }
35428
+ }
35429
+ );
35430
+ operations.push(op);
35431
+ });
35432
+ Object.entries(spec2.paths).forEach(
35433
+ ([path2, methods]) => handlePath(path2, methods)
35212
35434
  );
35213
- operations.push(op);
35214
- });
35215
- Object.entries(spec2.paths).forEach(
35216
- ([path2, methods]) => handlePath(path2, methods)
35217
- );
35218
- const imports = [
35219
- 'import type * as HttpClient from "@effect/platform/HttpClient"',
35220
- 'import * as HttpClientError from "@effect/platform/HttpClientError"',
35221
- 'import * as HttpClientRequest from "@effect/platform/HttpClientRequest"',
35222
- 'import * as HttpClientResponse from "@effect/platform/HttpClientResponse"',
35223
- 'import * as UrlParams from "@effect/platform/UrlParams"',
35224
- 'import * as Effect from "effect/Effect"',
35225
- 'import type { ParseError } from "effect/ParseResult"',
35226
- 'import * as S from "effect/Schema"'
35227
- ].join("\n");
35228
- const schemas = yield* gen3.generate("S");
35229
- const clientInterface = operationsToInterface("Client", operations);
35230
- const clientImpl = operationsToImpl("Client", operations);
35231
- return `${imports}
35435
+ const transformer = yield* OpenApiTransformer;
35436
+ const schemas = yield* gen3.generate("S");
35437
+ return `${transformer.imports}
35232
35438
 
35233
35439
  ${schemas}
35234
35440
 
35235
- ${clientImpl}
35441
+ ${transformer.toImplementation(options3.name, operations)}
35236
35442
 
35237
- ${clientInterface}`;
35238
- }, JsonSchemaGen.with);
35443
+ ${transformer.toTypes(options3.name, operations)}`;
35444
+ },
35445
+ with_,
35446
+ (effect3, _, options3) => provide2(
35447
+ effect3,
35448
+ options3?.typeOnly ? layerTransformerTs2 : layerTransformerSchema2
35449
+ )
35450
+ );
35239
35451
  return { convert: convert3, generate };
35240
35452
  });
35241
35453
  var _OpenApi = class _OpenApi extends Tag3("OpenApi")() {
35242
35454
  };
35243
35455
  _OpenApi.Live = effect(_OpenApi, make64);
35244
35456
  var OpenApi = _OpenApi;
35245
- var processPath = (path2) => {
35246
- const ids3 = [];
35247
- path2 = path2.replace(/{([^}]+)}/g, (_, name) => {
35248
- const id2 = camelize(name);
35249
- ids3.push(id2);
35250
- return "${" + id2 + "}";
35251
- });
35252
- return { path: "`" + path2 + "`", ids: ids3 };
35457
+ var OpenApiTransformer = class extends Tag2("OpenApiTransformer")() {
35253
35458
  };
35254
- var operationsToInterface = (name, operations) => `export interface ${name} {
35459
+ var layerTransformerSchema2 = sync6(OpenApiTransformer, () => {
35460
+ const operationsToInterface = (name2, operations) => `export interface ${name2} {
35255
35461
  ${operations.map(operationToMethod).join("\n ")}
35256
35462
  }`;
35257
- var operationToMethod = (operation) => {
35258
- const args2 = [];
35259
- if (operation.pathIds.length > 0) {
35260
- args2.push(...operation.pathIds.map((id2) => `${id2}: string`));
35261
- }
35262
- let options3 = [];
35263
- if (operation.params && !operation.payload) {
35264
- args2.push(`options: typeof ${operation.params}.Encoded`);
35265
- } else if (operation.params) {
35266
- options3.push(`readonly params: typeof ${operation.params}.Encoded`);
35267
- }
35268
- if (operation.payload) {
35269
- const type2 = operation.payload === "FormData" ? "globalThis.FormData" : `typeof ${operation.payload}.Encoded`;
35270
- if (!operation.params) {
35271
- args2.push(`options: ${type2}`);
35272
- } else {
35273
- options3.push(`readonly payload: ${type2}`);
35463
+ const operationToMethod = (operation) => {
35464
+ const args2 = [];
35465
+ if (operation.pathIds.length > 0) {
35466
+ args2.push(...operation.pathIds.map((id2) => `${id2}: string`));
35467
+ }
35468
+ let options3 = [];
35469
+ if (operation.params && !operation.payload) {
35470
+ args2.push(`options: typeof ${operation.params}.Encoded`);
35471
+ } else if (operation.params) {
35472
+ options3.push(`readonly params: typeof ${operation.params}.Encoded`);
35473
+ }
35474
+ if (operation.payload) {
35475
+ const type2 = operation.payload === "FormData" ? "globalThis.FormData" : `typeof ${operation.payload}.Encoded`;
35476
+ if (!operation.params) {
35477
+ args2.push(`options: ${type2}`);
35478
+ } else {
35479
+ options3.push(`readonly payload: ${type2}`);
35480
+ }
35274
35481
  }
35275
- }
35276
- if (options3.length > 0) {
35277
- args2.push(`options: { ${options3.join("; ")} }`);
35278
- }
35279
- let success = "void";
35280
- if (operation.successSchemas.size > 0) {
35281
- success = Array.from(operation.successSchemas.values()).map((schema) => `typeof ${schema}.Type`).join(" | ");
35282
- }
35283
- const errors = ["HttpClientError.HttpClientError", "ParseError"];
35284
- if (operation.errorSchemas.size > 0) {
35285
- errors.push(
35286
- ...Array.from(operation.errorSchemas.values()).map(
35287
- (schema) => `typeof ${schema}.Type`
35288
- )
35289
- );
35290
- }
35291
- return `readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35292
- };
35293
- var operationsToImpl = (name, operations) => `export const make = (
35482
+ if (options3.length > 0) {
35483
+ args2.push(`options: { ${options3.join("; ")} }`);
35484
+ }
35485
+ let success = "void";
35486
+ if (operation.successSchemas.size > 0) {
35487
+ success = Array.from(operation.successSchemas.values()).map((schema) => `typeof ${schema}.Type`).join(" | ");
35488
+ }
35489
+ const errors = ["HttpClientError.HttpClientError", "ParseError"];
35490
+ if (operation.errorSchemas.size > 0) {
35491
+ errors.push(
35492
+ ...Array.from(operation.errorSchemas.values()).map(
35493
+ (schema) => `typeof ${schema}.Type`
35494
+ )
35495
+ );
35496
+ }
35497
+ return `readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35498
+ };
35499
+ const operationsToImpl = (name2, operations) => `export const make = (
35294
35500
  httpClient: HttpClient.HttpClient,
35295
35501
  options: {
35296
35502
  readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect<HttpClient.HttpClient>) | undefined
35297
35503
  } = {}
35298
- ): ${name} => {
35504
+ ): ${name2} => {
35299
35505
  const unexpectedStatus = (request: HttpClientRequest.HttpClientRequest, response: HttpClientResponse.HttpClientResponse) =>
35300
35506
  Effect.flatMap(
35301
35507
  Effect.orElseSucceed(response.text, () => "Unexpected status code"),
@@ -35314,58 +35520,263 @@ var operationsToImpl = (name, operations) => `export const make = (
35314
35520
  ${operations.map(operationToImpl).join(",\n ")}
35315
35521
  }
35316
35522
  }`;
35317
- var operationToImpl = (operation) => {
35318
- const args2 = [...operation.pathIds];
35319
- const hasOptions = operation.params || operation.payload;
35320
- if (hasOptions) {
35321
- args2.push("options");
35322
- }
35323
- const params = `${args2.join(", ")}`;
35324
- const pipeline = [];
35325
- if (operation.params) {
35326
- const varName = operation.payload ? "options.params" : "options";
35327
- if (operation.urlParams.length > 0) {
35328
- const props = operation.urlParams.map(
35329
- (param) => `"${param}": ${varName}["${param}"] as UrlParams.Coercible`
35523
+ const operationToImpl = (operation) => {
35524
+ const args2 = [...operation.pathIds];
35525
+ const hasOptions = operation.params || operation.payload;
35526
+ if (hasOptions) {
35527
+ args2.push("options");
35528
+ }
35529
+ const params = `${args2.join(", ")}`;
35530
+ const pipeline = [];
35531
+ if (operation.params) {
35532
+ const varName = operation.payload ? "options.params" : "options";
35533
+ if (operation.urlParams.length > 0) {
35534
+ const props = operation.urlParams.map(
35535
+ (param) => `"${param}": ${varName}["${param}"] as UrlParams.Coercible`
35536
+ );
35537
+ pipeline.push(`HttpClientRequest.setUrlParams({ ${props.join(", ")} })`);
35538
+ }
35539
+ if (operation.headers.length > 0) {
35540
+ const props = operation.headers.map(
35541
+ (param) => `"${param}": ${varName}["${param}"] ?? undefined`
35542
+ );
35543
+ pipeline.push(`HttpClientRequest.setHeaders({ ${props.join(", ")} })`);
35544
+ }
35545
+ }
35546
+ const payloadVarName = operation.params ? "options.payload" : "options";
35547
+ if (operation.payload === "FormData") {
35548
+ pipeline.push(
35549
+ `HttpClientRequest.bodyFormData(${payloadVarName})`,
35550
+ "Effect.succeed"
35330
35551
  );
35331
- pipeline.push(`HttpClientRequest.setUrlParams({ ${props.join(", ")} })`);
35552
+ } else if (operation.payload) {
35553
+ pipeline.push(
35554
+ `(req) => Effect.orDie(HttpClientRequest.bodyJson(req, ${payloadVarName}))`
35555
+ );
35556
+ } else {
35557
+ pipeline.push("Effect.succeed");
35332
35558
  }
35333
- if (operation.headers.length > 0) {
35334
- const props = operation.headers.map(
35335
- (param) => `"${param}": ${varName}["${param}"] ?? undefined`
35559
+ const decodes = [];
35560
+ operation.successSchemas.forEach((schema, status2) => {
35561
+ decodes.push(
35562
+ `"${status2}": r => HttpClientResponse.schemaBodyJson(${schema})(r)`
35336
35563
  );
35337
- pipeline.push(`HttpClientRequest.setHeaders({ ${props.join(", ")} })`);
35564
+ });
35565
+ operation.errorSchemas.forEach((schema, status2) => {
35566
+ decodes.push(`"${status2}": r => decodeError(r, ${schema})`);
35567
+ });
35568
+ decodes.push(`orElse: (response) => unexpectedStatus(request, response)`);
35569
+ pipeline.push(`Effect.flatMap(request => Effect.flatMap(applyClientTransform(httpClient), (httpClient) => Effect.flatMap(httpClient.execute(request), HttpClientResponse.matchStatus({
35570
+ ${decodes.join(",\n ")}
35571
+ }))))`);
35572
+ return `"${operation.id}": (${params}) => HttpClientRequest.make("${operation.method.toUpperCase()}")(${operation.pathTemplate}).pipe(
35573
+ ${pipeline.join(",\n ")}
35574
+ )`;
35575
+ };
35576
+ return OpenApiTransformer.of({
35577
+ imports: [
35578
+ 'import type * as HttpClient from "@effect/platform/HttpClient"',
35579
+ 'import * as HttpClientError from "@effect/platform/HttpClientError"',
35580
+ 'import * as HttpClientRequest from "@effect/platform/HttpClientRequest"',
35581
+ 'import * as HttpClientResponse from "@effect/platform/HttpClientResponse"',
35582
+ 'import * as UrlParams from "@effect/platform/UrlParams"',
35583
+ 'import * as Effect from "effect/Effect"',
35584
+ 'import type { ParseError } from "effect/ParseResult"',
35585
+ 'import * as S from "effect/Schema"'
35586
+ ].join("\n"),
35587
+ toTypes: operationsToInterface,
35588
+ toImplementation: operationsToImpl
35589
+ });
35590
+ }).pipe(merge7(layerTransformerSchema));
35591
+ var layerTransformerTs2 = sync6(OpenApiTransformer, () => {
35592
+ const operationsToInterface = (name2, operations) => `export interface ${name2} {
35593
+ ${operations.map((s) => operationToMethod(name2, s)).join("\n ")}
35594
+ }
35595
+
35596
+ export interface ${name2}Error<Tag extends string, E> {
35597
+ readonly _tag: Tag
35598
+ readonly cause: E
35599
+ }
35600
+
35601
+ class ${name2}ErrorImpl extends Data.Error<{ _tag: string; cause: any }> {}
35602
+
35603
+ export const ${name2}Error = <Tag extends string, E>(
35604
+ tag: Tag,
35605
+ cause: E,
35606
+ ): ${name2}Error<Tag, E> => new ${name2}ErrorImpl({ _tag: tag, cause }) as any`;
35607
+ const operationToMethod = (name2, operation) => {
35608
+ const args2 = [];
35609
+ if (operation.pathIds.length > 0) {
35610
+ args2.push(...operation.pathIds.map((id2) => `${id2}: string`));
35611
+ }
35612
+ let options3 = [];
35613
+ if (operation.params && !operation.payload) {
35614
+ args2.push(`options: ${operation.params}`);
35615
+ } else if (operation.params) {
35616
+ options3.push(`readonly params: ${operation.params}`);
35617
+ }
35618
+ if (operation.payload) {
35619
+ const type2 = operation.payload === "FormData" ? "globalThis.FormData" : operation.payload;
35620
+ if (!operation.params) {
35621
+ args2.push(`options: ${type2}`);
35622
+ } else {
35623
+ options3.push(`readonly payload: ${type2}`);
35624
+ }
35625
+ }
35626
+ if (options3.length > 0) {
35627
+ args2.push(`options: { ${options3.join("; ")} }`);
35628
+ }
35629
+ let success = "void";
35630
+ if (operation.successSchemas.size > 0) {
35631
+ success = Array.from(operation.successSchemas.values()).join(" | ");
35632
+ }
35633
+ const errors = ["HttpClientError.HttpClientError"];
35634
+ if (operation.errorSchemas.size > 0) {
35635
+ for (const schema of operation.errorSchemas.values()) {
35636
+ errors.push(`${name2}Error<"${schema}", ${schema}>`);
35637
+ }
35338
35638
  }
35639
+ return `readonly "${operation.id}": (${args2.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
35640
+ };
35641
+ const operationsToImpl = (name2, operations) => `export const make = (
35642
+ httpClient: HttpClient.HttpClient,
35643
+ options: {
35644
+ readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect<HttpClient.HttpClient>) | undefined
35645
+ } = {}
35646
+ ): ${name2} => {
35647
+ const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) =>
35648
+ Effect.flatMap(
35649
+ Effect.orElseSucceed(response.text, () => "Unexpected status code"),
35650
+ (description) =>
35651
+ Effect.fail(
35652
+ new HttpClientError.ResponseError({
35653
+ request: response.request,
35654
+ response,
35655
+ reason: "StatusCode",
35656
+ description,
35657
+ }),
35658
+ ),
35659
+ )
35660
+ const applyClientTransform = (
35661
+ client: HttpClient.HttpClient,
35662
+ ): Effect.Effect<HttpClient.HttpClient> =>
35663
+ options.transformClient
35664
+ ? options.transformClient(client)
35665
+ : Effect.succeed(client)
35666
+ const decodeSuccess = <A>(response: HttpClientResponse.HttpClientResponse) =>
35667
+ response.json as Effect.Effect<A, HttpClientError.ResponseError>
35668
+ const decodeVoid = (_response: HttpClientResponse.HttpClientResponse) =>
35669
+ Effect.void
35670
+ const decodeError =
35671
+ <Tag extends string, E>(tag: Tag) =>
35672
+ (
35673
+ response: HttpClientResponse.HttpClientResponse,
35674
+ ): Effect.Effect<
35675
+ never,
35676
+ ${name2}Error<Tag, E> | HttpClientError.ResponseError
35677
+ > =>
35678
+ Effect.flatMap(
35679
+ response.json as Effect.Effect<E, HttpClientError.ResponseError>,
35680
+ (cause) => Effect.fail(${name2}Error(tag, cause)),
35681
+ )
35682
+ const onRequest = (
35683
+ successCodes: ReadonlyArray<string>,
35684
+ errorCodes: Record<string, string>,
35685
+ ) => {
35686
+ const cases: any = { orElse: unexpectedStatus }
35687
+ for (const code of successCodes) {
35688
+ cases[code] = decodeSuccess
35689
+ }
35690
+ for (const [code, tag] of Object.entries(errorCodes)) {
35691
+ cases[code] = decodeError(tag)
35692
+ }
35693
+ if (successCodes.length === 0) {
35694
+ cases["2xx"] = decodeVoid
35695
+ }
35696
+ return (
35697
+ request: HttpClientRequest.HttpClientRequest,
35698
+ ): Effect.Effect<any, any> =>
35699
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
35700
+ Effect.flatMap(
35701
+ httpClient.execute(request),
35702
+ HttpClientResponse.matchStatus(cases) as any,
35703
+ ),
35704
+ )
35339
35705
  }
35340
- const payloadVarName = operation.params ? "options.payload" : "options";
35341
- if (operation.payload === "FormData") {
35342
- pipeline.push(
35343
- `HttpClientRequest.bodyFormData(${payloadVarName})`,
35344
- "Effect.succeed"
35345
- );
35346
- } else if (operation.payload) {
35347
- pipeline.push(
35348
- `(req) => Effect.orDie(HttpClientRequest.bodyJson(req, ${payloadVarName}))`
35349
- );
35350
- } else {
35351
- pipeline.push("Effect.succeed");
35706
+ return {
35707
+ ${operations.map(operationToImpl).join(",\n ")}
35352
35708
  }
35353
- const decodes = [];
35354
- operation.successSchemas.forEach((schema, status2) => {
35355
- decodes.push(
35356
- `"${status2}": r => HttpClientResponse.schemaBodyJson(${schema})(r)`
35709
+ }`;
35710
+ const operationToImpl = (operation) => {
35711
+ const args2 = [...operation.pathIds];
35712
+ const hasOptions = operation.params || operation.payload;
35713
+ if (hasOptions) {
35714
+ args2.push("options");
35715
+ }
35716
+ const params = `${args2.join(", ")}`;
35717
+ const pipeline = [];
35718
+ if (operation.params) {
35719
+ const varName = operation.payload ? "options.params" : "options";
35720
+ if (operation.urlParams.length > 0) {
35721
+ const props = operation.urlParams.map(
35722
+ (param) => `"${param}": ${varName}["${param}"] as UrlParams.Coercible`
35723
+ );
35724
+ pipeline.push(`HttpClientRequest.setUrlParams({ ${props.join(", ")} })`);
35725
+ }
35726
+ if (operation.headers.length > 0) {
35727
+ const props = operation.headers.map(
35728
+ (param) => `"${param}": ${varName}["${param}"] ?? undefined`
35729
+ );
35730
+ pipeline.push(`HttpClientRequest.setHeaders({ ${props.join(", ")} })`);
35731
+ }
35732
+ }
35733
+ const payloadVarName = operation.params ? "options.payload" : "options";
35734
+ if (operation.payload === "FormData") {
35735
+ pipeline.push(
35736
+ `HttpClientRequest.bodyFormData(${payloadVarName})`,
35737
+ "Effect.succeed"
35738
+ );
35739
+ } else if (operation.payload) {
35740
+ pipeline.push(
35741
+ `(req) => Effect.orDie(HttpClientRequest.bodyJson(req, ${payloadVarName}))`
35742
+ );
35743
+ } else {
35744
+ pipeline.push("Effect.succeed");
35745
+ }
35746
+ const successCodes = Array.from(
35747
+ operation.successSchemas.keys(),
35748
+ (_) => JSON.stringify(_)
35749
+ ).join(", ");
35750
+ const errorCodes = Object.fromEntries(operation.errorSchemas.entries());
35751
+ pipeline.push(
35752
+ `Effect.flatMap(onRequest([${successCodes}], ${JSON.stringify(errorCodes)}))`
35357
35753
  );
35358
- });
35359
- operation.errorSchemas.forEach((schema, status2) => {
35360
- decodes.push(`"${status2}": r => decodeError(r, ${schema})`);
35361
- });
35362
- decodes.push(`orElse: (response) => unexpectedStatus(request, response)`);
35363
- pipeline.push(`Effect.flatMap(request => Effect.flatMap(applyClientTransform(httpClient), (httpClient) => Effect.flatMap(httpClient.execute(request), HttpClientResponse.matchStatus({
35364
- ${decodes.join(",\n ")}
35365
- }))))`);
35366
- return `"${operation.id}": (${params}) => HttpClientRequest.make("${operation.method.toUpperCase()}")(${operation.pathTemplate}).pipe(
35754
+ return `"${operation.id}": (${params}) => HttpClientRequest.make("${operation.method.toUpperCase()}")(${operation.pathTemplate}).pipe(
35367
35755
  ${pipeline.join(",\n ")}
35368
35756
  )`;
35757
+ };
35758
+ return OpenApiTransformer.of({
35759
+ imports: [
35760
+ 'import type * as HttpClient from "@effect/platform/HttpClient"',
35761
+ 'import * as HttpClientError from "@effect/platform/HttpClientError"',
35762
+ 'import * as HttpClientRequest from "@effect/platform/HttpClientRequest"',
35763
+ 'import * as HttpClientResponse from "@effect/platform/HttpClientResponse"',
35764
+ 'import * as UrlParams from "@effect/platform/UrlParams"',
35765
+ 'import * as Data from "effect/Data"',
35766
+ 'import * as Effect from "effect/Effect"'
35767
+ ].join("\n"),
35768
+ toTypes: operationsToInterface,
35769
+ toImplementation: operationsToImpl
35770
+ });
35771
+ }).pipe(merge7(layerTransformerTs));
35772
+ var processPath = (path2) => {
35773
+ const ids3 = [];
35774
+ path2 = path2.replace(/{([^}]+)}/g, (_, name2) => {
35775
+ const id2 = camelize(name2);
35776
+ ids3.push(id2);
35777
+ return "${" + id2 + "}";
35778
+ });
35779
+ return { path: "`" + path2 + "`", ids: ids3 };
35369
35780
  };
35370
35781
 
35371
35782
  // src/main.ts
@@ -35373,17 +35784,26 @@ var spec = fileParse2("spec").pipe(
35373
35784
  withAlias2("s"),
35374
35785
  withDescription3("The OpenAPI spec file to generate the client from")
35375
35786
  );
35787
+ var name = text8("name").pipe(
35788
+ withAlias2("n"),
35789
+ withDescription3("The name of the generated client"),
35790
+ withDefault3("Client")
35791
+ );
35376
35792
  var convert2 = boolean5("convert").pipe(
35377
35793
  withAlias2("c"),
35378
35794
  withDescription3("Convert from OpenAPI 2 to OpenAPI 3 first")
35379
35795
  );
35380
- var root = make62("openapigen", { spec, convert: convert2 }).pipe(
35796
+ var typeOnly = boolean5("type-only").pipe(
35797
+ withAlias2("t"),
35798
+ withDescription3("Generate a type-only client without schemas")
35799
+ );
35800
+ var root = make62("openapigen", { spec, convert: convert2, typeOnly, name }).pipe(
35381
35801
  withHandler2(
35382
- fnUntraced2(function* ({ spec: spec2, convert: convert3 }) {
35802
+ fnUntraced2(function* ({ spec: spec2, convert: convert3, typeOnly: typeOnly2, name: name2 }) {
35383
35803
  if (convert3) {
35384
35804
  spec2 = yield* OpenApi.convert(spec2);
35385
35805
  }
35386
- return yield* OpenApi.generate(spec2).pipe(
35806
+ return yield* OpenApi.generate(spec2, { name: name2, typeOnly: typeOnly2 }).pipe(
35387
35807
  flatMap9(log2)
35388
35808
  );
35389
35809
  })