@workos/oagen 0.10.2 → 0.10.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.
@@ -6621,17 +6621,11 @@ function filterSurfaceByManifest(surface, manifest) {
6621
6621
  filesExcluded++;
6622
6622
  continue;
6623
6623
  }
6624
- const generatedMethods = serviceMethodMap.get(normalize(name));
6625
- if (generatedMethods) {
6626
- const methods = {};
6627
- for (const [methodName, overloads] of Object.entries(cls.methods)) if (generatedMethods.has(methodName)) methods[methodName] = overloads;
6628
- else methodsExcluded++;
6629
- filteredClasses[name] = {
6630
- ...cls,
6631
- methods,
6632
- constructorParams: []
6633
- };
6634
- } else filteredClasses[name] = cls;
6624
+ if (serviceMethodMap.get(normalize(name))) filteredClasses[name] = {
6625
+ ...cls,
6626
+ constructorParams: []
6627
+ };
6628
+ else filteredClasses[name] = cls;
6635
6629
  }
6636
6630
  const filteredExports = {};
6637
6631
  for (const [filePath, symbols] of Object.entries(surface.exports)) if (manifestFiles.has(filePath)) filteredExports[filePath] = symbols;
@@ -6654,9 +6648,9 @@ async function compatExtractCommand(opts) {
6654
6648
  let surface = await extractor.extract(opts.sdkPath);
6655
6649
  const manifest = await readManifest(opts.sdkPath);
6656
6650
  if (manifest) {
6657
- const { filtered, filesExcluded, methodsExcluded } = filterSurfaceByManifest(surface, manifest);
6651
+ const { filtered, filesExcluded } = filterSurfaceByManifest(surface, manifest);
6658
6652
  surface = filtered;
6659
- if (filesExcluded > 0 || methodsExcluded > 0) console.log(`Manifest filter: excluded ${filesExcluded} hand-written file(s), ${methodsExcluded} hand-written method(s)`);
6653
+ if (filesExcluded > 0) console.log(`Manifest filter: excluded ${filesExcluded} hand-written file(s)`);
6660
6654
  }
6661
6655
  const snapshot = apiSurfaceToSnapshot(surface);
6662
6656
  if (opts.spec) {
@@ -7185,6 +7179,9 @@ function filterSurface(surface, allowedNames, opts) {
7185
7179
  function diffSnapshots(baseline, candidate, policy) {
7186
7180
  const effectivePolicy = policy ?? baseline.policies;
7187
7181
  const changes = [];
7182
+ const serviceAccessors = /* @__PURE__ */ new Set();
7183
+ for (const sym of baseline.symbols) if (sym.kind === "service_accessor") serviceAccessors.add(sym.fqName);
7184
+ for (const sym of candidate.symbols) if (sym.kind === "service_accessor") serviceAccessors.add(sym.fqName);
7188
7185
  const candById = /* @__PURE__ */ new Map();
7189
7186
  const candByFqName = /* @__PURE__ */ new Map();
7190
7187
  for (const sym of candidate.symbols) {
@@ -7194,15 +7191,37 @@ function diffSnapshots(baseline, candidate, policy) {
7194
7191
  const baseByFqName = /* @__PURE__ */ new Set();
7195
7192
  for (const sym of baseline.symbols) baseByFqName.add(sym.fqName);
7196
7193
  for (const baseSym of baseline.symbols) {
7194
+ if (isServiceWrapperConstructor(baseSym, serviceAccessors)) continue;
7197
7195
  const candSym = candById.get(baseSym.id) ?? candByFqName.get(baseSym.fqName);
7198
7196
  changes.push(...classifySymbolChanges(baseSym, candSym, effectivePolicy));
7199
7197
  }
7200
- for (const candSym of candidate.symbols) if (!baseByFqName.has(candSym.fqName)) changes.push(classifyAddedSymbol(candSym));
7198
+ for (const candSym of candidate.symbols) if (!baseByFqName.has(candSym.fqName)) {
7199
+ if (isServiceWrapperConstructor(candSym, serviceAccessors)) continue;
7200
+ changes.push(classifyAddedSymbol(candSym));
7201
+ }
7201
7202
  return {
7202
7203
  changes,
7203
7204
  summary: summarizeChanges(changes)
7204
7205
  };
7205
7206
  }
7207
+ /**
7208
+ * Check if a symbol is a constructor belonging to a service wrapper class.
7209
+ *
7210
+ * Service wrapper constructors are internal plumbing (taking a client/config
7211
+ * object) — users interact with services via `client.admin_portal`, not
7212
+ * `new AdminPortal(...)`. Changes to these constructors should not be
7213
+ * reported as breaking.
7214
+ *
7215
+ * Catches two patterns:
7216
+ * - Ruby: kind === 'constructor', ownerFqName is a service_accessor
7217
+ * - PHP: kind === 'callable' with fqName ending in '.__construct'
7218
+ */
7219
+ function isServiceWrapperConstructor(sym, serviceAccessors) {
7220
+ if (!sym.ownerFqName || !serviceAccessors.has(sym.ownerFqName)) return false;
7221
+ if (sym.kind === "constructor") return true;
7222
+ if (sym.kind === "callable" && sym.fqName.endsWith(".__construct")) return true;
7223
+ return false;
7224
+ }
7206
7225
  //#endregion
7207
7226
  //#region src/compat/concepts.ts
7208
7227
  /**