@workos/oagen 0.6.0 → 0.7.0

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.
@@ -1,4 +1,4 @@
1
- import { $ as ApiField, Q as ApiEnum, X as Addition, Z as ApiClass, at as ApiTypeAlias, ct as LanguageHints, dt as Violation, et as ApiInterface, ft as ViolationCategory, it as ApiSurface, lt as MethodOverlay, nt as ApiParam, ot as DiffResult, pt as ViolationSeverity, rt as ApiProperty, st as Extractor, t as ApiSpec, tt as ApiMethod, ut as OverlayLookup } from "../types-C7g5sLuX.mjs";
1
+ import { $ as ApiClass, Q as Addition, at as ApiProperty, ct as DiffResult, dt as MethodOverlay, et as ApiEnum, ft as OverlayLookup, ht as ViolationSeverity, it as ApiParam, lt as Extractor, mt as ViolationCategory, nt as ApiInterface, ot as ApiSurface, pt as Violation, rt as ApiMethod, st as ApiTypeAlias, t as ApiSpec, tt as ApiField, ut as LanguageHints } from "../types-DJMbCtIO.mjs";
2
2
 
3
3
  //#region src/compat/extractor-registry.d.ts
4
4
  declare function registerExtractor(extractor: Extractor): void;
@@ -176,7 +176,7 @@ function extractClass(sym, checker) {
176
176
  else deprecationMessage = "";
177
177
  }
178
178
  for (const member of decl.members) if (ts.isConstructorDeclaration(member)) for (const param of member.parameters) {
179
- const paramName = param.name.getText();
179
+ const paramName = extractParameterName(param, param.name.getText());
180
180
  const paramType = param.type ? checker.typeToString(checker.getTypeFromTypeNode(param.type)) : "any";
181
181
  constructorParams.push({
182
182
  name: paramName,
@@ -227,11 +227,20 @@ function extractParam(sym, checker) {
227
227
  const isOptional = decl && ts.isParameter(decl) ? !!decl.questionToken || !!decl.initializer : false;
228
228
  const type = checker.getTypeOfSymbolAtLocation(sym, decl);
229
229
  return {
230
- name: sym.name,
230
+ name: extractParameterName(decl, sym.name),
231
231
  type: checker.typeToString(type),
232
232
  optional: isOptional
233
233
  };
234
234
  }
235
+ function extractParameterName(decl, fallback) {
236
+ if (!decl || !ts.isParameter(decl)) return fallback;
237
+ if (ts.isIdentifier(decl.name)) return decl.name.text;
238
+ const index = decl.parent.parameters?.indexOf(decl) ?? -1;
239
+ const suffix = index > 0 ? String(index) : "";
240
+ if (ts.isObjectBindingPattern(decl.name)) return `options${suffix}`;
241
+ if (ts.isArrayBindingPattern(decl.name)) return `args${suffix}`;
242
+ return fallback;
243
+ }
235
244
  function extractInterface(sym, checker) {
236
245
  const type = checker.getDeclaredTypeOfSymbol(sym);
237
246
  const fields = {};