@workos/oagen 0.5.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-D84LjrVG.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;
@@ -164,11 +164,19 @@ function extractClass(sym, checker) {
164
164
  const methods = {};
165
165
  const properties = {};
166
166
  const constructorParams = [];
167
+ let deprecationMessage;
167
168
  const declarations = sym.getDeclarations();
168
169
  if (declarations) {
169
170
  for (const decl of declarations) if (ts.isClassDeclaration(decl)) {
171
+ const deprecatedTag = ts.getJSDocDeprecatedTag(decl);
172
+ if (deprecatedTag) {
173
+ const comment = deprecatedTag.comment;
174
+ if (typeof comment === "string") deprecationMessage = comment.trim() || "";
175
+ else if (Array.isArray(comment)) deprecationMessage = comment.map((c) => c.text).join("").trim() || "";
176
+ else deprecationMessage = "";
177
+ }
170
178
  for (const member of decl.members) if (ts.isConstructorDeclaration(member)) for (const param of member.parameters) {
171
- const paramName = param.name.getText();
179
+ const paramName = extractParameterName(param, param.name.getText());
172
180
  const paramType = param.type ? checker.typeToString(checker.getTypeFromTypeNode(param.type)) : "any";
173
181
  constructorParams.push({
174
182
  name: paramName,
@@ -210,7 +218,8 @@ function extractClass(sym, checker) {
210
218
  name: sym.name,
211
219
  methods: sortRecord(methods),
212
220
  properties: sortRecord(properties),
213
- constructorParams
221
+ constructorParams,
222
+ ...deprecationMessage !== void 0 && { deprecationMessage }
214
223
  };
215
224
  }
216
225
  function extractParam(sym, checker) {
@@ -218,11 +227,20 @@ function extractParam(sym, checker) {
218
227
  const isOptional = decl && ts.isParameter(decl) ? !!decl.questionToken || !!decl.initializer : false;
219
228
  const type = checker.getTypeOfSymbolAtLocation(sym, decl);
220
229
  return {
221
- name: sym.name,
230
+ name: extractParameterName(decl, sym.name),
222
231
  type: checker.typeToString(type),
223
232
  optional: isOptional
224
233
  };
225
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
+ }
226
244
  function extractInterface(sym, checker) {
227
245
  const type = checker.getDeclaredTypeOfSymbol(sym);
228
246
  const fields = {};