@ps-aux/api-client-gen 0.7.0-rc.3 → 0.7.0-rc.4

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.
@@ -722,6 +722,7 @@ const string$1 = (params) => {
722
722
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
723
723
  return new RegExp(`^${regex}$`);
724
724
  };
725
+ const number = /^-?\d+(?:\.\d+)?$/;
725
726
  const boolean$1 = /^(?:true|false)$/i;
726
727
  // regex for string with no uppercase letters
727
728
  const lowercase = /^[^A-Z]*$/;
@@ -1918,6 +1919,122 @@ function handleIntersectionResults(result, left, right) {
1918
1919
  result.value = merged.data;
1919
1920
  return result;
1920
1921
  }
1922
+ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
1923
+ $ZodType.init(inst, def);
1924
+ inst._zod.parse = (payload, ctx) => {
1925
+ const input = payload.value;
1926
+ if (!isPlainObject(input)) {
1927
+ payload.issues.push({
1928
+ expected: "record",
1929
+ code: "invalid_type",
1930
+ input,
1931
+ inst,
1932
+ });
1933
+ return payload;
1934
+ }
1935
+ const proms = [];
1936
+ const values = def.keyType._zod.values;
1937
+ if (values) {
1938
+ payload.value = {};
1939
+ const recordKeys = new Set();
1940
+ for (const key of values) {
1941
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1942
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1943
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1944
+ if (result instanceof Promise) {
1945
+ proms.push(result.then((result) => {
1946
+ if (result.issues.length) {
1947
+ payload.issues.push(...prefixIssues(key, result.issues));
1948
+ }
1949
+ payload.value[key] = result.value;
1950
+ }));
1951
+ }
1952
+ else {
1953
+ if (result.issues.length) {
1954
+ payload.issues.push(...prefixIssues(key, result.issues));
1955
+ }
1956
+ payload.value[key] = result.value;
1957
+ }
1958
+ }
1959
+ }
1960
+ let unrecognized;
1961
+ for (const key in input) {
1962
+ if (!recordKeys.has(key)) {
1963
+ unrecognized = unrecognized ?? [];
1964
+ unrecognized.push(key);
1965
+ }
1966
+ }
1967
+ if (unrecognized && unrecognized.length > 0) {
1968
+ payload.issues.push({
1969
+ code: "unrecognized_keys",
1970
+ input,
1971
+ inst,
1972
+ keys: unrecognized,
1973
+ });
1974
+ }
1975
+ }
1976
+ else {
1977
+ payload.value = {};
1978
+ for (const key of Reflect.ownKeys(input)) {
1979
+ if (key === "__proto__")
1980
+ continue;
1981
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1982
+ if (keyResult instanceof Promise) {
1983
+ throw new Error("Async schemas not supported in object keys currently");
1984
+ }
1985
+ // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
1986
+ // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
1987
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
1988
+ if (checkNumericKey) {
1989
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
1990
+ if (retryResult instanceof Promise) {
1991
+ throw new Error("Async schemas not supported in object keys currently");
1992
+ }
1993
+ if (retryResult.issues.length === 0) {
1994
+ keyResult = retryResult;
1995
+ }
1996
+ }
1997
+ if (keyResult.issues.length) {
1998
+ if (def.mode === "loose") {
1999
+ // Pass through unchanged
2000
+ payload.value[key] = input[key];
2001
+ }
2002
+ else {
2003
+ // Default "strict" behavior: error on invalid key
2004
+ payload.issues.push({
2005
+ code: "invalid_key",
2006
+ origin: "record",
2007
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2008
+ input: key,
2009
+ path: [key],
2010
+ inst,
2011
+ });
2012
+ }
2013
+ continue;
2014
+ }
2015
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2016
+ if (result instanceof Promise) {
2017
+ proms.push(result.then((result) => {
2018
+ if (result.issues.length) {
2019
+ payload.issues.push(...prefixIssues(key, result.issues));
2020
+ }
2021
+ payload.value[keyResult.value] = result.value;
2022
+ }));
2023
+ }
2024
+ else {
2025
+ if (result.issues.length) {
2026
+ payload.issues.push(...prefixIssues(key, result.issues));
2027
+ }
2028
+ payload.value[keyResult.value] = result.value;
2029
+ }
2030
+ }
2031
+ }
2032
+ if (proms.length) {
2033
+ return Promise.all(proms).then(() => payload);
2034
+ }
2035
+ return payload;
2036
+ };
2037
+ });
1921
2038
  const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1922
2039
  $ZodType.init(inst, def);
1923
2040
  const values = getEnumValues(def.entries);
@@ -3314,6 +3431,49 @@ const intersectionProcessor = (schema, ctx, json, params) => {
3314
3431
  ];
3315
3432
  json.allOf = allOf;
3316
3433
  };
3434
+ const recordProcessor = (schema, ctx, _json, params) => {
3435
+ const json = _json;
3436
+ const def = schema._zod.def;
3437
+ json.type = "object";
3438
+ // For looseRecord with regex patterns, use patternProperties
3439
+ // This correctly represents "only validate keys matching the pattern" semantics
3440
+ // and composes well with allOf (intersections)
3441
+ const keyType = def.keyType;
3442
+ const keyBag = keyType._zod.bag;
3443
+ const patterns = keyBag?.patterns;
3444
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
3445
+ // Use patternProperties for looseRecord with regex patterns
3446
+ const valueSchema = process(def.valueType, ctx, {
3447
+ ...params,
3448
+ path: [...params.path, "patternProperties", "*"],
3449
+ });
3450
+ json.patternProperties = {};
3451
+ for (const pattern of patterns) {
3452
+ json.patternProperties[pattern.source] = valueSchema;
3453
+ }
3454
+ }
3455
+ else {
3456
+ // Default behavior: use propertyNames + additionalProperties
3457
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
3458
+ json.propertyNames = process(def.keyType, ctx, {
3459
+ ...params,
3460
+ path: [...params.path, "propertyNames"],
3461
+ });
3462
+ }
3463
+ json.additionalProperties = process(def.valueType, ctx, {
3464
+ ...params,
3465
+ path: [...params.path, "additionalProperties"],
3466
+ });
3467
+ }
3468
+ // Add required for keys with discrete values (enum, literal, etc.)
3469
+ const keyValues = keyType._zod.values;
3470
+ if (keyValues) {
3471
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
3472
+ if (validKeyValues.length > 0) {
3473
+ json.required = validKeyValues;
3474
+ }
3475
+ }
3476
+ };
3317
3477
  const nullableProcessor = (schema, ctx, json, params) => {
3318
3478
  const def = schema._zod.def;
3319
3479
  const inner = process(def.innerType, ctx, params);
@@ -3817,6 +3977,21 @@ function intersection(left, right) {
3817
3977
  right: right,
3818
3978
  });
3819
3979
  }
3980
+ const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
3981
+ $ZodRecord.init(inst, def);
3982
+ ZodType.init(inst, def);
3983
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
3984
+ inst.keyType = def.keyType;
3985
+ inst.valueType = def.valueType;
3986
+ });
3987
+ function record(keyType, valueType, params) {
3988
+ return new ZodRecord({
3989
+ type: "record",
3990
+ keyType,
3991
+ valueType: valueType,
3992
+ ...normalizeParams(params),
3993
+ });
3994
+ }
3820
3995
  const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
3821
3996
  $ZodEnum.init(inst, def);
3822
3997
  ZodType.init(inst, def);
@@ -4049,8 +4224,19 @@ const vNextOasGeneratorSchema = strictObject({
4049
4224
  unwrap: boolean().default(true),
4050
4225
  withRequestParams: boolean().default(false),
4051
4226
  pathParamsStyle: _enum(["object", "positional"]).default("positional"),
4052
- enumStyle: _enum(["enum", "union"]).default("enum")
4053
- }),
4227
+ enumStyle: _enum(["enum", "union"]).default("enum"),
4228
+ comments: strictObject({
4229
+ enabled: boolean().default(true),
4230
+ operation: strictObject({
4231
+ tags: boolean().default(true),
4232
+ summary: boolean().default(true),
4233
+ description: boolean().default(true)
4234
+ }).prefault({}),
4235
+ schema: strictObject({
4236
+ metadata: boolean().default(true)
4237
+ }).prefault({})
4238
+ }).prefault({})
4239
+ }).prefault({}),
4054
4240
  compat: strictObject({
4055
4241
  uppercaseEnumKeys: boolean(),
4056
4242
  swaggerTsApiRequiredBooleans: boolean()
@@ -4061,7 +4247,7 @@ const legacyOasGeneratorSchema = strictObject({
4061
4247
  ignoreOperationsWithTags: array(string()).optional()
4062
4248
  })
4063
4249
  });
4064
- const configSchema = strictObject({
4250
+ const profileConfigSchema = strictObject({
4065
4251
  srcSpec: string().trim().min(1),
4066
4252
  dstDir: string().trim().min(1),
4067
4253
  apiName: string().trim().min(1),
@@ -4079,6 +4265,8 @@ const configSchema = strictObject({
4079
4265
  localDateTimes: boolean().optional()
4080
4266
  }).optional()
4081
4267
  });
4268
+ const configSchema = record(string(), profileConfigSchema);
4269
+ const defineConfig = (config) => config;
4082
4270
  const parseConfig = (userConfig, filePath) => {
4083
4271
  const parsed = configSchema.safeParse(userConfig);
4084
4272
  if (parsed.success) return parsed.data;
@@ -4086,6 +4274,13 @@ const parseConfig = (userConfig, filePath) => {
4086
4274
  cause: parsed.error
4087
4275
  });
4088
4276
  };
4277
+ const parseProfileConfig = (userConfig, filePath) => {
4278
+ const parsed = profileConfigSchema.safeParse(userConfig);
4279
+ if (parsed.success) return parsed.data;
4280
+ throw new Error(`Invalid config at ${filePath}: ${parsed.error.message}`, {
4281
+ cause: parsed.error
4282
+ });
4283
+ };
4089
4284
 
4090
4285
  const downloadSpec = async (path, url) => {
4091
4286
  let response;
@@ -4240,9 +4435,9 @@ const resolveLocalRef = (root, ref) => {
4240
4435
  return current;
4241
4436
  };
4242
4437
 
4243
- var __defProp$9 = Object.defineProperty;
4244
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4245
- var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
4438
+ var __defProp$a = Object.defineProperty;
4439
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4440
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
4246
4441
  const PARAMETER_LOCATIONS = [
4247
4442
  "path",
4248
4443
  "query",
@@ -4268,7 +4463,7 @@ const mergeParameters = (base, override) => {
4268
4463
  class OpenApiNormalizer {
4269
4464
  constructor(doc) {
4270
4465
  this.doc = doc;
4271
- __publicField$9(this, "problems", []);
4466
+ __publicField$a(this, "problems", []);
4272
4467
  }
4273
4468
  load() {
4274
4469
  const info = readRecord(this.doc, "info");
@@ -4611,23 +4806,24 @@ const syntheticOperationId = (method, path) => {
4611
4806
  return `_${compact}`;
4612
4807
  };
4613
4808
 
4614
- var __defProp$8 = Object.defineProperty;
4615
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4616
- var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
4809
+ var __defProp$9 = Object.defineProperty;
4810
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4811
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
4617
4812
  class TsCodegen {
4618
- constructor(typeExprCodegen) {
4813
+ constructor(typeExprCodegen, docRenderer) {
4619
4814
  this.typeExprCodegen = typeExprCodegen;
4620
- __publicField$8(this, "usedTypeRefs", []);
4621
- __publicField$8(this, "usedTypeRefKeys", /* @__PURE__ */ new Set());
4622
- __publicField$8(this, "typeExpr", (typeExpr) => {
4815
+ __publicField$9(this, "usedTypeRefs", []);
4816
+ __publicField$9(this, "usedTypeRefKeys", /* @__PURE__ */ new Set());
4817
+ __publicField$9(this, "docRenderer");
4818
+ __publicField$9(this, "typeExpr", (typeExpr) => {
4623
4819
  this.collectTypeRefsFromExpr(typeExpr);
4624
4820
  return this.typeExprCodegen.toCode(typeExpr).code;
4625
4821
  });
4626
- __publicField$8(this, "declaration", (name, declaration) => {
4822
+ __publicField$9(this, "declaration", (name, declaration, options = {}) => {
4627
4823
  this.collectTypeRefsFromDeclaration(declaration);
4628
- return this.toDeclarationCode(name, declaration);
4824
+ return this.toDeclarationCode(name, declaration, options);
4629
4825
  });
4630
- __publicField$8(this, "toChunk", (name, code, exports$1) => {
4826
+ __publicField$9(this, "toChunk", (name, code, exports$1) => {
4631
4827
  const exportedSymbols = new Set(exports$1);
4632
4828
  const refs = this.getTypeRefs().filter((ref) => {
4633
4829
  return ref.kind !== "internal" || !exportedSymbols.has(ref.name);
@@ -4639,17 +4835,25 @@ class TsCodegen {
4639
4835
  refs
4640
4836
  };
4641
4837
  });
4642
- __publicField$8(this, "getTypeRefs", () => {
4838
+ __publicField$9(this, "getTypeRefs", () => {
4643
4839
  return this.usedTypeRefs.map((ref) => ({ ...ref }));
4644
4840
  });
4645
- __publicField$8(this, "toDeclarationCode", (name, declaration) => {
4841
+ __publicField$9(this, "toDeclarationCode", (name, d, o) => {
4842
+ let code = this.toDeclarationBodyCode(name, d);
4843
+ if (o.exported) {
4844
+ code = `export ${code}`;
4845
+ }
4846
+ return this.addDoc(code, d.doc);
4847
+ });
4848
+ __publicField$9(this, "toDeclarationBodyCode", (name, declaration) => {
4646
4849
  switch (declaration.kind) {
4647
4850
  case "typeAlias":
4648
4851
  return `type ${name} = ${this.typeExprCodegen.toCode(declaration.typeExpr).code}`;
4649
4852
  case "enum": {
4650
- const members = declaration.members.map(
4651
- (member) => ` ${member.name} = ${JSON.stringify(member.value)}`
4652
- ).join(",\n");
4853
+ const members = declaration.members.map((member) => {
4854
+ const code = `${member.name} = ${JSON.stringify(member.value)}`;
4855
+ return this.addDoc(code, member.doc);
4856
+ }).join(",\n");
4653
4857
  return `enum ${name} {
4654
4858
  ${members}
4655
4859
  }`;
@@ -4662,6 +4866,13 @@ ${members}
4662
4866
  }
4663
4867
  }
4664
4868
  });
4869
+ __publicField$9(this, "addDoc", (code, doc) => {
4870
+ if (!doc) return code;
4871
+ const rendered = this.docRenderer.render(doc);
4872
+ return rendered ? `${rendered}
4873
+ ${code}` : code;
4874
+ });
4875
+ this.docRenderer = docRenderer;
4665
4876
  }
4666
4877
  collectTypeRef(typeRef) {
4667
4878
  if (typeRef.kind === "builtin") return;
@@ -4787,12 +4998,13 @@ const toTsPropertyKey = (value) => {
4787
4998
  return isTsIdentifier(value) ? value : JSON.stringify(value);
4788
4999
  };
4789
5000
 
4790
- var __defProp$7 = Object.defineProperty;
4791
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4792
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
5001
+ var __defProp$8 = Object.defineProperty;
5002
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5003
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
4793
5004
  class TypeExprCodegen {
4794
- constructor() {
4795
- __publicField$7(this, "toCode", (typeExpr) => {
5005
+ constructor(docRenderer) {
5006
+ __publicField$8(this, "docRenderer");
5007
+ __publicField$8(this, "toCode", (typeExpr) => {
4796
5008
  switch (typeExpr.kind) {
4797
5009
  case "reference":
4798
5010
  return this.toReferenceCode(typeExpr);
@@ -4808,7 +5020,7 @@ class TypeExprCodegen {
4808
5020
  }
4809
5021
  }
4810
5022
  });
4811
- __publicField$7(this, "toReferenceCode", (typeExpr) => {
5023
+ __publicField$8(this, "toReferenceCode", (typeExpr) => {
4812
5024
  if (!typeExpr.typeArgs?.length) {
4813
5025
  return {
4814
5026
  code: typeExpr.ref.name,
@@ -4821,7 +5033,7 @@ class TypeExprCodegen {
4821
5033
  ref: typeExpr.ref
4822
5034
  };
4823
5035
  });
4824
- __publicField$7(this, "toInlineCode", (expr) => {
5036
+ __publicField$8(this, "toInlineCode", (expr) => {
4825
5037
  switch (expr.node) {
4826
5038
  case "scalar":
4827
5039
  return expr.name === "integer" ? "number" : expr.name;
@@ -4846,55 +5058,66 @@ class TypeExprCodegen {
4846
5058
  }
4847
5059
  }
4848
5060
  });
4849
- __publicField$7(this, "toIntersectionMemberCode", (typeExpr) => {
5061
+ __publicField$8(this, "toIntersectionMemberCode", (typeExpr) => {
4850
5062
  const rendered = this.toCode(typeExpr).code;
4851
5063
  return this.isUnion(typeExpr) ? `(${rendered})` : rendered;
4852
5064
  });
4853
- __publicField$7(this, "toArrayElementCode", (typeExpr) => {
5065
+ __publicField$8(this, "toArrayElementCode", (typeExpr) => {
4854
5066
  const rendered = this.toCode(typeExpr).code;
4855
5067
  return this.needsGroupingForArrayElement(typeExpr) ? `(${rendered})` : rendered;
4856
5068
  });
4857
- __publicField$7(this, "isUnion", (typeExpr) => {
5069
+ __publicField$8(this, "isUnion", (typeExpr) => {
4858
5070
  return typeExpr.kind === "inline" && typeExpr.expr.node === "union";
4859
5071
  });
4860
- __publicField$7(this, "needsGroupingForArrayElement", (typeExpr) => {
5072
+ __publicField$8(this, "needsGroupingForArrayElement", (typeExpr) => {
4861
5073
  return typeExpr.kind === "inline" && (typeExpr.expr.node === "union" || typeExpr.expr.node === "intersection");
4862
5074
  });
4863
- __publicField$7(this, "toLiteralCode", (value) => {
5075
+ __publicField$8(this, "toLiteralCode", (value) => {
4864
5076
  if (value === null) return "null";
4865
5077
  return JSON.stringify(value);
4866
5078
  });
4867
- __publicField$7(this, "toObjectCode", (properties, additionalProperties) => {
5079
+ __publicField$8(this, "toObjectCode", (properties, additionalProperties) => {
4868
5080
  const members = properties.map(
4869
5081
  (property) => this.toPropertyCode(property)
4870
5082
  );
4871
5083
  if (additionalProperties === true) {
4872
- members.push("[key: string]: unknown");
5084
+ members.push("[key: string]: unknown;");
4873
5085
  } else if (additionalProperties !== void 0 && additionalProperties !== false) {
4874
5086
  members.push(
4875
- `[key: string]: ${this.toCode(additionalProperties).code}`
5087
+ `[key: string]: ${this.toCode(additionalProperties).code};`
4876
5088
  );
4877
5089
  }
4878
- if (!members.length) return "{}";
4879
- return `{ ${members.join("; ")} }`;
5090
+ return `{
5091
+ ${members.join("\n")}
5092
+ }`;
4880
5093
  });
4881
- __publicField$7(this, "toPropertyCode", (property) => {
5094
+ __publicField$8(this, "toPropertyCode", (property) => {
4882
5095
  const name = toTsPropertyKey(property.name);
4883
5096
  const optional = property.required ? "" : "?";
4884
- return `${name}${optional}: ${this.toCode(property.typeExpr).code}`;
4885
- });
5097
+ const propertyCode = `${name}${optional}: ${this.toCode(property.typeExpr).code}`;
5098
+ const docCode = property.doc ? this.docRenderer.render(property.doc, {
5099
+ compactText: true
5100
+ }) : "";
5101
+ const renderedProperty = `${propertyCode};`;
5102
+ return docCode ? `${docCode}
5103
+ ${renderedProperty}` : renderedProperty;
5104
+ });
5105
+ this.docRenderer = docRenderer;
4886
5106
  }
4887
5107
  }
4888
5108
 
4889
- var __defProp$6 = Object.defineProperty;
4890
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4891
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
5109
+ var __defProp$7 = Object.defineProperty;
5110
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5111
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
4892
5112
  class TsCodegenFactory {
4893
- constructor() {
4894
- __publicField$6(this, "typeExprCodegen", new TypeExprCodegen());
4895
- __publicField$6(this, "forNewChunk", () => {
4896
- return new TsCodegen(this.typeExprCodegen);
4897
- });
5113
+ constructor(docRenderer) {
5114
+ __publicField$7(this, "typeExprCodegen");
5115
+ __publicField$7(this, "docRenderer");
5116
+ __publicField$7(this, "forNewChunk", () => {
5117
+ return new TsCodegen(this.typeExprCodegen, this.docRenderer);
5118
+ });
5119
+ this.docRenderer = docRenderer;
5120
+ this.typeExprCodegen = new TypeExprCodegen(this.docRenderer);
4898
5121
  }
4899
5122
  }
4900
5123
 
@@ -4943,13 +5166,13 @@ const isReservedWord = (value) => {
4943
5166
  return RESERVED_WORDS.has(value);
4944
5167
  };
4945
5168
 
4946
- var __defProp$5 = Object.defineProperty;
4947
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4948
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
5169
+ var __defProp$6 = Object.defineProperty;
5170
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5171
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
4949
5172
  class ParamsConstructor {
4950
5173
  constructor(options) {
4951
5174
  this.options = options;
4952
- __publicField$5(this, "process", (params, httpPath) => {
5175
+ __publicField$6(this, "process", (params, httpPath) => {
4953
5176
  const pathParamSpec = validatePathParams(params, httpPath);
4954
5177
  const pathParamBindings = pathParamSpec?.bindings;
4955
5178
  const funParams = params.flatMap(
@@ -4969,7 +5192,7 @@ class ParamsConstructor {
4969
5192
  hasQuery
4970
5193
  };
4971
5194
  });
4972
- __publicField$5(this, "renderOperationParams", (param, pathParamSpec) => {
5195
+ __publicField$6(this, "renderOperationParams", (param, pathParamSpec) => {
4973
5196
  if (param.kind !== "path" || !pathParamSpec) {
4974
5197
  return [
4975
5198
  {
@@ -4993,7 +5216,7 @@ class ParamsConstructor {
4993
5216
  }
4994
5217
  ];
4995
5218
  });
4996
- __publicField$5(this, "renderPathTemplateLiteral", (path, pathParamVarName, pathParamBindings) => {
5219
+ __publicField$6(this, "renderPathTemplateLiteral", (path, pathParamVarName, pathParamBindings) => {
4997
5220
  const escapedPath = path.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
4998
5221
  const pathWithParams = escapedPath.replace(
4999
5222
  /\{([^}]+)\}/g,
@@ -5007,7 +5230,7 @@ class ParamsConstructor {
5007
5230
  );
5008
5231
  return `\`${pathWithParams}\``;
5009
5232
  });
5010
- __publicField$5(this, "renderPathParamDestructuring", (pathParamBindings) => {
5233
+ __publicField$6(this, "renderPathParamDestructuring", (pathParamBindings) => {
5011
5234
  const members = Object.entries(pathParamBindings).map(
5012
5235
  ([paramName, binding]) => {
5013
5236
  const key = toTsPropertyKey(paramName);
@@ -5016,7 +5239,7 @@ class ParamsConstructor {
5016
5239
  );
5017
5240
  return `{ ${members.join(", ")} }`;
5018
5241
  });
5019
- __publicField$5(this, "paramName", (p) => {
5242
+ __publicField$6(this, "paramName", (p) => {
5020
5243
  switch (p.kind) {
5021
5244
  case "body":
5022
5245
  return this.options.paramNames.body;
@@ -5128,19 +5351,27 @@ const validatePathParams = (params, httpPath) => {
5128
5351
  };
5129
5352
  };
5130
5353
 
5354
+ const indentBlock = (value, indent) => {
5355
+ if (!value || !indent) {
5356
+ return value;
5357
+ }
5358
+ return value.split("\n").map((line) => `${indent}${line}`).join("\n");
5359
+ };
5360
+
5131
5361
  const EMPTY_LINE_MARKER = "/*__EMPTY_LINE_MARKER__*/";
5132
5362
 
5133
- var __defProp$4 = Object.defineProperty;
5134
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5135
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
5363
+ var __defProp$5 = Object.defineProperty;
5364
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5365
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
5136
5366
  const REQUEST_PARAMS_TYPE = "RequestParams";
5137
5367
  const REQUEST_PARAMS_DEFAULT = "never";
5138
5368
  const REQUEST_PARAMS_ARG = "params";
5139
5369
  class ApiClientCodegen {
5140
- constructor(opts, tsCodegenFactory) {
5370
+ constructor(opts, tsCodegenFactory, docRenderer) {
5141
5371
  this.opts = opts;
5142
5372
  this.tsCodegenFactory = tsCodegenFactory;
5143
- __publicField$4(this, "generate", (apiName, operations) => {
5373
+ this.docRenderer = docRenderer;
5374
+ __publicField$5(this, "generate", (apiName, operations, doc) => {
5144
5375
  const tsCodegen = this.tsCodegenFactory.forNewChunk();
5145
5376
  const httpClientType = tsCodegen.typeExpr(this.opts.httpClient.typeName);
5146
5377
  let clientType = httpClientType;
@@ -5150,16 +5381,18 @@ class ApiClientCodegen {
5150
5381
  classTypeParams = `<${REQUEST_PARAMS_TYPE} = ${REQUEST_PARAMS_DEFAULT}>`;
5151
5382
  }
5152
5383
  const methodsCode = Array.isArray(operations) ? this.opsCode(tsCodegen, operations) : this.groupsOpsCode(tsCodegen, operations);
5384
+ const classDocCode = this.renderApiClientDoc(doc, "");
5153
5385
  const code = `
5154
- export class ${apiName}${classTypeParams} {
5155
- constructor(private readonly client: ${clientType}) {}
5386
+ ${classDocCode ? `${classDocCode}
5387
+ ` : ""}export class ${apiName}${classTypeParams} {
5388
+ constructor(private readonly http: ${clientType}) {}
5156
5389
 
5157
5390
  ${methodsCode}
5158
5391
  }
5159
5392
  `;
5160
5393
  return tsCodegen.toChunk("api", code, [apiName]);
5161
5394
  });
5162
- __publicField$4(this, "groupsOpsCode", (codegen, groupedOps) => Object.entries(groupedOps).map(([groupName, ops]) => {
5395
+ __publicField$5(this, "groupsOpsCode", (codegen, groupedOps) => Object.entries(groupedOps).map(([groupName, ops]) => {
5163
5396
  const methodsCode = this.opsCode(codegen, ops, "object");
5164
5397
  return `
5165
5398
  ${toTsPropertyKey(groupName)} = {
@@ -5167,14 +5400,14 @@ class ApiClientCodegen {
5167
5400
  }
5168
5401
  `;
5169
5402
  }).join("\n\n"));
5170
- __publicField$4(this, "opsCode", (codegen, operations, target = "class") => {
5403
+ __publicField$5(this, "opsCode", (codegen, operations, target = "class") => {
5171
5404
  const separator = target === "object" ? `,
5172
5405
  ${EMPTY_LINE_MARKER}
5173
5406
  ` : "\n\n";
5174
5407
  const methodsCode = operations.map((op) => this.renderOp(op, codegen, target)).join(separator);
5175
5408
  return methodsCode;
5176
5409
  });
5177
- __publicField$4(this, "renderOp", (op, tsCodegen, target) => {
5410
+ __publicField$5(this, "renderOp", (op, tsCodegen, target) => {
5178
5411
  const { signature: sig, http } = op;
5179
5412
  const invocationVars = this.opts.httpClient.invocation.vars;
5180
5413
  const paramNames = {
@@ -5200,6 +5433,7 @@ ${EMPTY_LINE_MARKER}
5200
5433
  const responseType = tsCodegen.typeExpr(sig.returnType);
5201
5434
  const returnType = this.wrapInResponseWrapper(sig.returnType, tsCodegen);
5202
5435
  return this.renderFunctionCode({
5436
+ doc: sig.doc,
5203
5437
  funName: sig.name,
5204
5438
  responseType,
5205
5439
  returnType,
@@ -5215,13 +5449,14 @@ ${EMPTY_LINE_MARKER}
5215
5449
  target
5216
5450
  });
5217
5451
  });
5218
- __publicField$4(this, "wrapInResponseWrapper", (typeExpr, tsCodegen) => {
5452
+ __publicField$5(this, "wrapInResponseWrapper", (typeExpr, tsCodegen) => {
5219
5453
  return tsCodegen.typeExpr({
5220
5454
  ...this.opts.httpClient.responseWrapper,
5221
5455
  typeArgs: [typeExpr]
5222
5456
  });
5223
5457
  });
5224
- __publicField$4(this, "renderFunctionCode", ({
5458
+ __publicField$5(this, "renderFunctionCode", ({
5459
+ doc,
5225
5460
  funName,
5226
5461
  responseType,
5227
5462
  returnType,
@@ -5253,9 +5488,74 @@ ${EMPTY_LINE_MARKER}
5253
5488
  invocation = invocation.replaceAll("\n", "");
5254
5489
  const operator = target === "object" ? ":" : "=";
5255
5490
  const returnTypeCode = this.opts.httpClient.inferMethodReturnType ? "" : `:${returnType}`;
5256
- return `${funName} ${operator} (${params})${returnTypeCode} =>
5257
- this.client${invocation}
5491
+ const functionCode = `${funName} ${operator} (${params})${returnTypeCode} =>
5492
+ this.http${invocation}
5258
5493
  `;
5494
+ const docCode = this.renderOperationDoc(
5495
+ doc,
5496
+ this.opts.comments,
5497
+ target === "object" ? " " : " "
5498
+ );
5499
+ return docCode ? `${docCode}
5500
+ ${functionCode}` : functionCode;
5501
+ });
5502
+ __publicField$5(this, "renderOperationDoc", (doc, comments, indent = "") => {
5503
+ if (!doc) return null;
5504
+ return indentBlock(this.docRenderer.render(this.toTsDoc(doc)), indent);
5505
+ });
5506
+ __publicField$5(this, "renderApiClientDoc", (doc, indent = "") => {
5507
+ if (!doc) return "";
5508
+ return indentBlock(
5509
+ this.docRenderer.render({
5510
+ nodes: [
5511
+ {
5512
+ key: "title",
5513
+ value: doc.title
5514
+ },
5515
+ {
5516
+ key: "version",
5517
+ value: doc.version
5518
+ },
5519
+ ...doc.description ? [doc.description] : []
5520
+ ]
5521
+ }),
5522
+ indent
5523
+ );
5524
+ });
5525
+ __publicField$5(this, "toTsDoc", (doc) => {
5526
+ const nodes = [
5527
+ {
5528
+ key: "id",
5529
+ value: doc.id
5530
+ }
5531
+ ];
5532
+ const comms = this.opts.comments;
5533
+ if ((comms.summary ?? true) && doc.summary) {
5534
+ nodes.push({
5535
+ key: "summary",
5536
+ value: doc.summary
5537
+ });
5538
+ }
5539
+ if ((comms.description ?? true) && doc.description) {
5540
+ nodes.push({
5541
+ key: "description",
5542
+ value: doc.description
5543
+ });
5544
+ }
5545
+ nodes.push({
5546
+ key: "request",
5547
+ value: doc.request
5548
+ });
5549
+ if ((comms.tags ?? true) && doc.tags.length) {
5550
+ nodes.push({
5551
+ key: "tags",
5552
+ value: doc.tags.join(", ")
5553
+ });
5554
+ }
5555
+ return {
5556
+ deprecated: doc.deprecated,
5557
+ nodes
5558
+ };
5259
5559
  });
5260
5560
  }
5261
5561
  }
@@ -5424,21 +5724,102 @@ const provideHttpClientCode = (gen, opts) => gen.toChunk(
5424
5724
  ["HttpRequest", "HttpResponse", "HttpClient"]
5425
5725
  );
5426
5726
 
5727
+ var __defProp$4 = Object.defineProperty;
5728
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5729
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
5730
+ class TsDocRenderer {
5731
+ constructor(options) {
5732
+ this.options = options;
5733
+ __publicField$4(this, "render", (doc, options = {}) => {
5734
+ if (!this.options.enabled) return "";
5735
+ const lines = [];
5736
+ this.appendNodes(lines, doc.nodes, options);
5737
+ if (doc.deprecated) {
5738
+ this.appendDeprecated(lines, { separate: lines.length > 0 });
5739
+ }
5740
+ return this.renderComment(lines);
5741
+ });
5742
+ __publicField$4(this, "renderComment", (lines) => {
5743
+ if (!this.options.enabled) return "";
5744
+ if (!lines.length) return "";
5745
+ if (lines.length === 1) {
5746
+ return `/** ${lines[0]} */`;
5747
+ }
5748
+ const body = lines.map((line) => line ? ` * ${line}` : " *").join("\n");
5749
+ return `/**
5750
+ ${body}
5751
+ */`;
5752
+ });
5753
+ __publicField$4(this, "appendDocText", (lines, value) => {
5754
+ const normalized = this.normalizeLines(value);
5755
+ if (!normalized.length) return;
5756
+ if (lines.length > 0) {
5757
+ lines.push("");
5758
+ }
5759
+ lines.push(...normalized);
5760
+ });
5761
+ __publicField$4(this, "appendField", (lines, key, value) => {
5762
+ const normalized = this.normalizeLines(value);
5763
+ if (!normalized.length) return;
5764
+ lines.push(`@${key} ${normalized[0]}`.trimEnd());
5765
+ lines.push(...normalized.slice(1));
5766
+ });
5767
+ __publicField$4(this, "appendDeprecated", (lines, options) => {
5768
+ if (options.separate) {
5769
+ lines.push("");
5770
+ }
5771
+ lines.push("@deprecated");
5772
+ });
5773
+ __publicField$4(this, "appendNodes", (lines, nodes = [], options = {}) => {
5774
+ nodes.forEach((node) => {
5775
+ if (typeof node === "string") {
5776
+ if (options.compactText) {
5777
+ lines.push(...this.normalizeNonEmptyLines(node));
5778
+ return;
5779
+ }
5780
+ this.appendDocText(lines, node);
5781
+ return;
5782
+ }
5783
+ this.appendField(lines, node.key, node.value);
5784
+ });
5785
+ });
5786
+ __publicField$4(this, "normalizeLines", (value) => {
5787
+ const trimmed = value?.trim();
5788
+ if (!trimmed) return [];
5789
+ return trimmed.split(/\r?\n/u).map((line) => line.trimEnd().replaceAll("*/", "*\\/"));
5790
+ });
5791
+ __publicField$4(this, "normalizeNonEmptyLines", (value) => this.normalizeLines(value).filter((line) => line.length > 0));
5792
+ }
5793
+ }
5794
+
5427
5795
  const generateTsCode = (clientName, projectResult, opts) => {
5428
- const tsCodegenFac = new TsCodegenFactory();
5796
+ const docRenderer = new TsDocRenderer({
5797
+ enabled: opts.comments.enabled
5798
+ });
5799
+ const tsCodegenFac = new TsCodegenFactory(docRenderer);
5429
5800
  const { schemaDefinitions } = projectResult;
5430
5801
  const types = [...schemaDefinitions].sort((a, b) => a.name.localeCompare(b.name)).map((def) => {
5431
5802
  const cg = tsCodegenFac.forNewChunk();
5432
- const code = `export ${cg.declaration(def.name, def.declaration)}`;
5803
+ const code = cg.declaration(def.name, def.declaration, {
5804
+ exported: true
5805
+ });
5433
5806
  return cg.toChunk(def.name, code, [def.name]);
5434
5807
  });
5435
5808
  const clientCodegen = new ApiClientCodegen(
5436
- { httpClient: promiseHttpClientCodegenSpec(), ...opts },
5437
- tsCodegenFac
5809
+ {
5810
+ httpClient: promiseHttpClientCodegenSpec(),
5811
+ comments: opts.comments.operation,
5812
+ unwrap: opts.unwrap,
5813
+ pathParamsStyle: opts.pathParamsStyle,
5814
+ withRequestParams: opts.withRequestParams
5815
+ },
5816
+ tsCodegenFac,
5817
+ docRenderer
5438
5818
  );
5439
5819
  const generated = clientCodegen.generate(
5440
5820
  clientName,
5441
- groupsOpsByTag(projectResult.operations)
5821
+ groupsOpsByTag(projectResult.operations),
5822
+ projectResult.api
5442
5823
  );
5443
5824
  const clientChunk = {
5444
5825
  ...generated,
@@ -5648,6 +6029,7 @@ class ToTypeExprConverter {
5648
6029
  }
5649
6030
  return {
5650
6031
  kind: "typeAlias",
6032
+ doc: this.getSchemaDoc(schema),
5651
6033
  typeExpr: this.fromTypeExpr(schema)
5652
6034
  };
5653
6035
  });
@@ -5661,6 +6043,7 @@ class ToTypeExprConverter {
5661
6043
  }
5662
6044
  return {
5663
6045
  kind: "enum",
6046
+ doc: this.getSchemaDoc(schema),
5664
6047
  valueType,
5665
6048
  members: this.toEnumMembers(schema.enum)
5666
6049
  };
@@ -5776,6 +6159,7 @@ class ToTypeExprConverter {
5776
6159
  );
5777
6160
  }
5778
6161
  return {
6162
+ doc: this.getSchemaDoc(propertySchema),
5779
6163
  name,
5780
6164
  required: this.isRequiredProperty(
5781
6165
  name,
@@ -5836,6 +6220,71 @@ class ToTypeExprConverter {
5836
6220
  __publicField$3(this, "isBinaryFileSchema", (schema) => {
5837
6221
  return schema.type === "string" && schema.format === "binary";
5838
6222
  });
6223
+ __publicField$3(this, "getSchemaDoc", (schema) => {
6224
+ const summary = typeof schema.summary === "string" ? schema.summary : void 0;
6225
+ const description = typeof schema.description === "string" ? schema.description : void 0;
6226
+ const deprecated = typeof schema.deprecated === "boolean" ? schema.deprecated : void 0;
6227
+ const annotations = this.getSchemaAnnotations(schema);
6228
+ if (!summary && !description && !deprecated && !annotations.length) {
6229
+ return void 0;
6230
+ }
6231
+ const nodes = [];
6232
+ if (summary) {
6233
+ nodes.push(summary);
6234
+ }
6235
+ if (description) {
6236
+ nodes.push(description);
6237
+ }
6238
+ nodes.push(...annotations);
6239
+ return {
6240
+ deprecated,
6241
+ nodes
6242
+ };
6243
+ });
6244
+ __publicField$3(this, "getSchemaAnnotations", (schema) => {
6245
+ if (this.options.comments?.metadata === false) return [];
6246
+ return [
6247
+ this.annotationNode("format", schema.format),
6248
+ this.annotationNode("min", schema.minimum),
6249
+ this.annotationNode("multipleOf", schema.multipleOf),
6250
+ this.annotationNode("exclusiveMin", schema.exclusiveMinimum),
6251
+ this.annotationNode("max", schema.maximum),
6252
+ this.annotationNode("minLength", schema.minLength),
6253
+ this.annotationNode("maxLength", schema.maxLength),
6254
+ this.annotationNode("exclusiveMax", schema.exclusiveMaximum),
6255
+ this.annotationNode("maxItems", schema.maxItems),
6256
+ this.annotationNode("minItems", schema.minItems),
6257
+ this.annotationNode("uniqueItems", schema.uniqueItems),
6258
+ this.annotationNode(
6259
+ "default",
6260
+ this.stringifyAnnotationValue(schema.default)
6261
+ ),
6262
+ this.annotationNode("pattern", schema.pattern),
6263
+ this.annotationNode(
6264
+ "example",
6265
+ this.stringifyAnnotationValue(schema.example)
6266
+ )
6267
+ ].filter(
6268
+ (value) => value !== void 0
6269
+ );
6270
+ });
6271
+ __publicField$3(this, "annotationNode", (name, value) => {
6272
+ if (value === void 0) return void 0;
6273
+ return {
6274
+ key: name,
6275
+ value: String(value)
6276
+ };
6277
+ });
6278
+ __publicField$3(this, "stringifyAnnotationValue", (value) => {
6279
+ if (value === void 0) return void 0;
6280
+ if (value && typeof value === "object") {
6281
+ return JSON.stringify(value);
6282
+ }
6283
+ if (typeof value === "string") {
6284
+ return JSON.stringify(value);
6285
+ }
6286
+ return String(value);
6287
+ });
5839
6288
  __publicField$3(this, "fromSchemaCore", (schema) => {
5840
6289
  if (this.isUnconstrainedSchema(schema)) {
5841
6290
  return this.scalar("unknown");
@@ -6022,6 +6471,11 @@ class OperationProjector {
6022
6471
  return this.projectOne(operationName, operation);
6023
6472
  });
6024
6473
  return {
6474
+ api: {
6475
+ title: openApi.info.title,
6476
+ version: openApi.info.version,
6477
+ description: openApi.info.description
6478
+ },
6025
6479
  operations,
6026
6480
  schemaDefinitions: this.typeExprConverter.getSchemaDefinitions()
6027
6481
  };
@@ -6038,6 +6492,7 @@ class OperationProjector {
6038
6492
  return {
6039
6493
  op: {
6040
6494
  signature: {
6495
+ doc: this.toOperationDoc(operationName, operation),
6041
6496
  name: operationName,
6042
6497
  parameters,
6043
6498
  returnType: this.projectReturnType(operation)
@@ -6086,6 +6541,7 @@ class OperationProjector {
6086
6541
  });
6087
6542
  __publicField$2(this, "projectParameterGroupTypeExpr", (params) => {
6088
6543
  const properties = Object.entries(params).map(([name, parameter]) => ({
6544
+ doc: this.toParameterDoc(parameter),
6089
6545
  name,
6090
6546
  required: parameter.required,
6091
6547
  typeExpr: this.typeExprConverter.fromTypeExpr(
@@ -6158,6 +6614,25 @@ class OperationProjector {
6158
6614
  __publicField$2(this, "selectResponseSchema", (response) => {
6159
6615
  return getPreferredMediaTypeEntry(response.content).media?.schema;
6160
6616
  });
6617
+ __publicField$2(this, "toParameterDoc", (parameter) => {
6618
+ if (!parameter.description && !parameter.deprecated) {
6619
+ return void 0;
6620
+ }
6621
+ return {
6622
+ deprecated: parameter.deprecated,
6623
+ nodes: parameter.description ? [parameter.description] : []
6624
+ };
6625
+ });
6626
+ __publicField$2(this, "toOperationDoc", (operationName, operation) => {
6627
+ return {
6628
+ id: operationName,
6629
+ request: `${toHttpMethodUpper(operation.method)}:${operation.path}`,
6630
+ summary: operation.summary,
6631
+ description: operation.description,
6632
+ deprecated: operation.deprecated,
6633
+ tags: operation.tags.map((tag) => tag.trim()).filter(Boolean)
6634
+ };
6635
+ });
6161
6636
  }
6162
6637
  }
6163
6638
 
@@ -6283,6 +6758,7 @@ class VNextOasClientGenerator {
6283
6758
  const projectResult = new OperationProjector({
6284
6759
  includeAllSchema: this.options.selection?.allSchemas === true,
6285
6760
  typeExtraction: {
6761
+ comments: this.options.codegen.comments.schema,
6286
6762
  enumStyle: this.options.codegen.enumStyle,
6287
6763
  uppercaseEnumKeys: this.options.compat?.uppercaseEnumKeys,
6288
6764
  swaggerTsApiRequiredBooleans: this.options.compat?.swaggerTsApiRequiredBooleans
@@ -6505,7 +6981,10 @@ const getModuleImportPath = (inputFile, outputFile) => {
6505
6981
  };
6506
6982
 
6507
6983
  const generateApiClient = async (params, configFilePath, log = console.log) => {
6508
- const config = parseConfig(params, configFilePath);
6984
+ const config = parseProfileConfig(params, configFilePath);
6985
+ return generateApiClientFromConfig(config, log);
6986
+ };
6987
+ const generateApiClientFromConfig = async (config, log = console.log) => {
6509
6988
  const { dstDir, apiName, srcSpec, zodSchemas } = config;
6510
6989
  const dir = Path.resolve(dstDir, apiName);
6511
6990
  if (!fs__namespace.existsSync(dir)) {
@@ -6552,4 +7031,7 @@ const getSpecPath = async (urlOrPath, dir, log) => {
6552
7031
  return specPath;
6553
7032
  };
6554
7033
 
7034
+ exports.defineConfig = defineConfig;
6555
7035
  exports.generateApiClient = generateApiClient;
7036
+ exports.generateApiClientFromConfig = generateApiClientFromConfig;
7037
+ exports.parseConfig = parseConfig;