@workos/oagen 0.17.3 → 0.18.1

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,5 +1,5 @@
1
- import { $ as BreakingChangeCategory, At as CompatSourceKind, Bt as CompatPolicyHints, Ct as OverlayLookup, Dt as CompatParameter, Et as ViolationSeverity, Ft as CompatVisibility, Ht as mergePolicy, It as LanguageId, Lt as ParameterSensitivity, Mt as CompatSymbol, Nt as CompatSymbolKind, Ot as CompatPassingStyle, Pt as CompatTypeRef, Q as AdditiveChangeCategory, Rt as apiSurfaceToSnapshot, St as MethodOverlay, Tt as ViolationCategory, Vt as getDefaultPolicy, _t as ApiSurface, at as CompatProvenance, bt as Extractor, ct as severityMeetsThreshold, dt as ApiEnum, et as CompatApproval, ft as ApiField, gt as ApiProperty, ht as ApiParam, it as CompatFailLevel, jt as CompatStability, kt as CompatSnapshot, lt as Addition, mt as ApiMethod, nt as CompatChangeSeverity, ot as SoftRiskChangeCategory, pt as ApiInterface, rt as CompatConfig, st as defaultSeverityForCategory, t as ApiSpec, tt as CompatChangeCategory, ut as ApiClass, vt as ApiTypeAlias, wt as Violation, xt as LanguageHints, yt as DiffResult, zt as ALL_LANGUAGE_IDS } from "../types-BL762XqW.mjs";
2
- import { a as specDerivedEnumValues, c as specDerivedMethodPaths, d as ClassifiedChange, f as classifyAddedSymbol, i as filterSurface, l as specDerivedNames, m as summarizeChanges, n as diffSnapshots, o as specDerivedFieldPaths, p as classifySymbolChanges, r as diffSurfaces, s as specDerivedHttpKeys, t as CompatDiffResult, u as ClassificationResult } from "../differ-fdF9qogA.mjs";
1
+ import { $ as BreakingChangeCategory, At as CompatSourceKind, Bt as CompatPolicyHints, Ct as OverlayLookup, Dt as CompatParameter, Et as ViolationSeverity, Ft as CompatVisibility, Ht as mergePolicy, It as LanguageId, Lt as ParameterSensitivity, Mt as CompatSymbol, Nt as CompatSymbolKind, Ot as CompatPassingStyle, Pt as CompatTypeRef, Q as AdditiveChangeCategory, Rt as apiSurfaceToSnapshot, St as MethodOverlay, Tt as ViolationCategory, Vt as getDefaultPolicy, _t as ApiSurface, at as CompatProvenance, bt as Extractor, ct as severityMeetsThreshold, dt as ApiEnum, et as CompatApproval, ft as ApiField, gt as ApiProperty, ht as ApiParam, it as CompatFailLevel, jt as CompatStability, kt as CompatSnapshot, lt as Addition, mt as ApiMethod, nt as CompatChangeSeverity, ot as SoftRiskChangeCategory, pt as ApiInterface, rt as CompatConfig, st as defaultSeverityForCategory, t as ApiSpec, tt as CompatChangeCategory, ut as ApiClass, vt as ApiTypeAlias, wt as Violation, xt as LanguageHints, yt as DiffResult, zt as ALL_LANGUAGE_IDS } from "../types-Cjh39AGQ.mjs";
2
+ import { a as specDerivedEnumValues, c as specDerivedMethodPaths, d as ClassifiedChange, f as classifyAddedSymbol, i as filterSurface, l as specDerivedNames, m as summarizeChanges, n as diffSnapshots, o as specDerivedFieldPaths, p as classifySymbolChanges, r as diffSurfaces, s as specDerivedHttpKeys, t as CompatDiffResult, u as ClassificationResult } from "../differ-CC65Efzt.mjs";
3
3
 
4
4
  //#region src/compat/schema.d.ts
5
5
  /** Current schema version for compatibility snapshots. */
@@ -2955,6 +2955,11 @@ function classifyFieldChange(kind, fieldName, isRequired) {
2955
2955
  fieldName,
2956
2956
  classification: "breaking"
2957
2957
  };
2958
+ case "field-format-changed": return {
2959
+ kind,
2960
+ fieldName,
2961
+ classification: "additive"
2962
+ };
2958
2963
  case "field-required-changed": return {
2959
2964
  kind,
2960
2965
  fieldName,
@@ -2985,11 +2990,21 @@ function classifyParamChange(kind, paramName, isRequired) {
2985
2990
  paramName,
2986
2991
  classification: "breaking"
2987
2992
  };
2993
+ case "param-format-changed": return {
2994
+ kind,
2995
+ paramName,
2996
+ classification: "additive"
2997
+ };
2988
2998
  case "param-required-changed": return {
2989
2999
  kind,
2990
3000
  paramName,
2991
3001
  classification: isRequired ? "breaking" : "additive"
2992
3002
  };
3003
+ case "param-default-changed": return {
3004
+ kind,
3005
+ paramName,
3006
+ classification: "breaking"
3007
+ };
2993
3008
  }
2994
3009
  }
2995
3010
  //#endregion
@@ -3033,7 +3048,11 @@ function diffFields(oldModel, newModel) {
3033
3048
  for (const [name, newField] of newByName) {
3034
3049
  const oldField = oldByName.get(name);
3035
3050
  if (!oldField) continue;
3036
- if (!typeRefsEqual(oldField.type, newField.type)) changes.push({
3051
+ if (!typeRefsEqual(oldField.type, newField.type)) if (primitivesDifferOnlyByFormat(oldField.type, newField.type)) changes.push({
3052
+ ...classifyFieldChange("field-format-changed", name),
3053
+ details: formatChangeDetails(oldField.type, newField.type)
3054
+ });
3055
+ else changes.push({
3037
3056
  kind: "field-type-changed",
3038
3057
  fieldName: name,
3039
3058
  classification: "breaking",
@@ -3044,6 +3063,23 @@ function diffFields(oldModel, newModel) {
3044
3063
  }
3045
3064
  return changes;
3046
3065
  }
3066
+ /**
3067
+ * True when both refs are primitives with the same base `type` but different
3068
+ * `format`. Used to downgrade format-only diffs from breaking type changes to
3069
+ * additive `field-format-changed` / `param-format-changed` events: the wire
3070
+ * base type is unchanged, so the diff is a hint to language emitters rather
3071
+ * than a source-level break.
3072
+ */
3073
+ function primitivesDifferOnlyByFormat(a, b) {
3074
+ if (a.kind !== "primitive" || b.kind !== "primitive") return false;
3075
+ if (a.type !== b.type) return false;
3076
+ return (a.format ?? "") !== (b.format ?? "");
3077
+ }
3078
+ function formatChangeDetails(a, b) {
3079
+ const oldFmt = a.kind === "primitive" ? a.format : void 0;
3080
+ const newFmt = b.kind === "primitive" ? b.format : void 0;
3081
+ return `format ${oldFmt ?? "<unset>"} → ${newFmt ?? "<unset>"}`;
3082
+ }
3047
3083
  function typeRefsEqual(a, b) {
3048
3084
  if (a.kind !== b.kind) return false;
3049
3085
  switch (a.kind) {
@@ -3145,28 +3181,57 @@ function classifyErrorsChange(oldErrors, newErrors) {
3145
3181
  }
3146
3182
  function diffParams(oldOp, newOp) {
3147
3183
  const changes = [];
3184
+ const tagged = (loc, params) => params.map((p) => ({
3185
+ p,
3186
+ loc
3187
+ }));
3148
3188
  const allOldParams = [
3149
- ...oldOp.pathParams,
3150
- ...oldOp.queryParams,
3151
- ...oldOp.headerParams
3189
+ ...tagged("path", oldOp.pathParams),
3190
+ ...tagged("query", oldOp.queryParams),
3191
+ ...tagged("header", oldOp.headerParams)
3152
3192
  ];
3153
3193
  const allNewParams = [
3154
- ...newOp.pathParams,
3155
- ...newOp.queryParams,
3156
- ...newOp.headerParams
3194
+ ...tagged("path", newOp.pathParams),
3195
+ ...tagged("query", newOp.queryParams),
3196
+ ...tagged("header", newOp.headerParams)
3157
3197
  ];
3158
- const oldByName = new Map(allOldParams.map((p) => [p.name, p]));
3159
- const newByName = new Map(allNewParams.map((p) => [p.name, p]));
3160
- for (const [name, param] of newByName) if (!oldByName.has(name)) changes.push(classifyParamChange("param-added", name, param.required));
3198
+ const oldByName = new Map(allOldParams.map((e) => [e.p.name, e]));
3199
+ const newByName = new Map(allNewParams.map((e) => [e.p.name, e]));
3200
+ for (const [name, entry] of newByName) if (!oldByName.has(name)) changes.push(classifyParamChange("param-added", name, entry.p.required));
3161
3201
  for (const [name] of oldByName) if (!newByName.has(name)) changes.push(classifyParamChange("param-removed", name));
3162
- for (const [name, newParam] of newByName) {
3163
- const oldParam = oldByName.get(name);
3164
- if (!oldParam) continue;
3165
- if (!typeRefsEqual(oldParam.type, newParam.type)) changes.push(classifyParamChange("param-type-changed", name));
3166
- if (oldParam.required !== newParam.required) changes.push(classifyParamChange("param-required-changed", name, newParam.required));
3202
+ for (const [name, newEntry] of newByName) {
3203
+ const oldEntry = oldByName.get(name);
3204
+ if (!oldEntry) continue;
3205
+ if (!typeRefsEqual(oldEntry.p.type, newEntry.p.type)) if (primitivesDifferOnlyByFormat(oldEntry.p.type, newEntry.p.type)) {
3206
+ const change = classifyParamChange("param-format-changed", name);
3207
+ change.details = formatChangeDetails(oldEntry.p.type, newEntry.p.type);
3208
+ changes.push(change);
3209
+ } else changes.push(classifyParamChange("param-type-changed", name));
3210
+ if (oldEntry.p.required !== newEntry.p.required) changes.push(classifyParamChange("param-required-changed", name, newEntry.p.required));
3211
+ const oldDefault = serializeDefault(oldEntry.p.default);
3212
+ const newDefault = serializeDefault(newEntry.p.default);
3213
+ if (oldDefault !== newDefault) {
3214
+ const change = classifyParamChange("param-default-changed", name);
3215
+ change.oldDefault = oldDefault;
3216
+ change.newDefault = newDefault;
3217
+ change.paramLocation = newEntry.loc;
3218
+ change.details = `default ${oldDefault ?? "<unset>"} → ${newDefault ?? "<unset>"}`;
3219
+ changes.push(change);
3220
+ }
3167
3221
  }
3168
3222
  return changes;
3169
3223
  }
3224
+ function serializeDefault(value) {
3225
+ if (value === void 0) return null;
3226
+ if (value === null) return "null";
3227
+ if (typeof value === "string") return value;
3228
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
3229
+ try {
3230
+ return JSON.stringify(value);
3231
+ } catch {
3232
+ return String(value);
3233
+ }
3234
+ }
3170
3235
  //#endregion
3171
3236
  //#region src/differ/services.ts
3172
3237
  function diffServices(oldServices, newServices) {
@@ -3198,13 +3263,38 @@ function diffSpecs(oldSpec, newSpec) {
3198
3263
  ...diffEnums(oldSpec.enums, newSpec.enums),
3199
3264
  ...diffServices(oldSpec.services, newSpec.services)
3200
3265
  ];
3266
+ const behaviorChanges = collectBehaviorChanges(changes);
3201
3267
  return {
3202
3268
  oldVersion: oldSpec.version,
3203
3269
  newVersion: newSpec.version,
3204
3270
  changes,
3205
- summary: summarize(changes)
3271
+ behaviorChanges,
3272
+ summary: {
3273
+ ...summarize(changes),
3274
+ behaviorChanges: behaviorChanges.length
3275
+ }
3206
3276
  };
3207
3277
  }
3278
+ function collectBehaviorChanges(changes) {
3279
+ const out = [];
3280
+ for (const c of changes) {
3281
+ if (c.kind !== "operation-modified") continue;
3282
+ for (const pc of c.paramChanges) {
3283
+ if (pc.kind !== "param-default-changed") continue;
3284
+ out.push({
3285
+ kind: "param-default-changed",
3286
+ serviceName: c.serviceName,
3287
+ operationName: c.operationName,
3288
+ paramName: pc.paramName,
3289
+ paramLocation: pc.paramLocation ?? "query",
3290
+ oldDefault: pc.oldDefault ?? null,
3291
+ newDefault: pc.newDefault ?? null,
3292
+ classification: "breaking"
3293
+ });
3294
+ }
3295
+ }
3296
+ return out;
3297
+ }
3208
3298
  function diffEnums(oldEnums, newEnums) {
3209
3299
  const changes = [];
3210
3300
  const oldByName = new Map(oldEnums.map((e) => [e.name, e]));
@@ -3285,4 +3375,4 @@ function summarize(changes) {
3285
3375
  //#endregion
3286
3376
  export { MANIFEST_FILENAME as a, treeShakeFiles as c, collectReferencedNames as d, generateAllFiles as f, resolveOperations as h, generate as i, applyFileHeaders as l, deriveMethodName as m, getEmitter as n, integrateGeneratedFiles as o, generateFiles as p, registerEmitter as r, mapFilesForTargetIntegration as s, diffSpecs as t, buildEmitterContext as u };
3287
3377
 
3288
- //# sourceMappingURL=diff-DLqJSVYR.mjs.map
3378
+ //# sourceMappingURL=diff-JU1bdT5_.mjs.map