@workos/oagen 0.18.2 → 0.19.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.
@@ -4983,6 +4983,7 @@ function buildEmitterContext(spec, options) {
4983
4983
  overlayLookup: options.overlayLookup,
4984
4984
  resolvedOperations: resolveOperations(spec, options.operationHints, options.mountRules),
4985
4985
  modelHints: options.modelHints,
4986
+ emitterOptions: options.emitterOptions,
4986
4987
  targetDir: options.target,
4987
4988
  priorTargetManifestPaths: options.priorTargetManifestPaths
4988
4989
  };
@@ -5421,8 +5422,9 @@ async function removeEmptyParents(startDir, stopDir) {
5421
5422
  //#endregion
5422
5423
  //#region src/engine/orchestrator.ts
5423
5424
  async function generate(spec, emitter, options) {
5425
+ const outputPrevManifestForCtx = options.noPrune ? null : await readManifest(options.outputDir);
5424
5426
  const targetManifestForCtx = options.target && !options.noPrune ? await readManifest(options.target) : null;
5425
- const priorTargetManifestPaths = targetManifestForCtx ? new Set(targetManifestForCtx.files) : void 0;
5427
+ const priorTargetManifestPaths = targetManifestForCtx ? new Set(targetManifestForCtx.files) : outputPrevManifestForCtx ? new Set(outputPrevManifestForCtx.files) : void 0;
5426
5428
  const { files: withHeaders, header, operations } = generateFiles(spec, emitter, {
5427
5429
  ...options,
5428
5430
  priorTargetManifestPaths
@@ -5434,7 +5436,7 @@ async function generate(spec, emitter, options) {
5434
5436
  }
5435
5437
  return withHeaders;
5436
5438
  }
5437
- const outputPrevManifest = options.noPrune ? null : await readManifest(options.outputDir);
5439
+ const outputPrevManifest = outputPrevManifestForCtx;
5438
5440
  const writeResult = await writeFiles(withHeaders, options.outputDir, {
5439
5441
  language: emitter.language,
5440
5442
  header
@@ -6217,6 +6219,7 @@ async function generateCommand(opts) {
6217
6219
  operationHints: opts.operationHints,
6218
6220
  mountRules: opts.mountRules,
6219
6221
  modelHints: opts.modelHints,
6222
+ emitterOptions: opts.emitterOptions,
6220
6223
  noPrune: opts.prune === false
6221
6224
  });
6222
6225
  if (opts.dryRun) for (const f of files) console.log(f.path);
@@ -6927,16 +6930,17 @@ function apiSurfaceToSnapshot(surface) {
6927
6930
  /** Convert a legacy ApiParam to a CompatParameter. */
6928
6931
  function apiParamToCompatParam(param, position, language) {
6929
6932
  const policy = getDefaultPolicy(language);
6933
+ const passing = param.passingStyle ?? inferPassingStyle(language);
6930
6934
  return {
6931
6935
  publicName: param.name,
6932
6936
  position,
6933
6937
  required: !param.optional,
6934
6938
  nullable: false,
6935
6939
  hasDefault: param.optional,
6936
- passing: param.passingStyle ?? inferPassingStyle(language),
6940
+ passing,
6937
6941
  type: { name: param.type },
6938
6942
  sensitivity: {
6939
- order: policy.constructorOrderMatters,
6943
+ order: passing === "positional",
6940
6944
  publicName: policy.methodParameterNamesArePublicApi,
6941
6945
  requiredness: true,
6942
6946
  type: true
@@ -7270,10 +7274,9 @@ function classifyParameterChanges(baseline, candidate, policy, specRef) {
7270
7274
  policy,
7271
7275
  specRef
7272
7276
  }));
7273
- if (baseParam.position !== candParam.position) if (isConstructor ? policy.constructorOrderMatters : baseParam.sensitivity.order) {
7274
- const category = isConstructor ? "constructor_position_changed_order_sensitive" : "parameter_position_changed_order_sensitive";
7275
- changes.push(makeChange({
7276
- category,
7277
+ if (baseParam.position !== candParam.position) {
7278
+ if (isConstructor) if (policy.constructorOrderMatters) changes.push(makeChange({
7279
+ category: "constructor_position_changed_order_sensitive",
7277
7280
  symbol: baseline.fqName,
7278
7281
  old: {
7279
7282
  parameter: baseParam.publicName,
@@ -7287,21 +7290,52 @@ function classifyParameterChanges(baseline, candidate, policy, specRef) {
7287
7290
  policy,
7288
7291
  specRef
7289
7292
  }));
7290
- } else changes.push(makeChange({
7291
- category: "constructor_reordered_named_friendly",
7292
- symbol: baseline.fqName,
7293
- old: {
7294
- parameter: baseParam.publicName,
7295
- position: String(baseParam.position)
7296
- },
7297
- new: {
7298
- parameter: candParam.publicName,
7299
- position: String(candParam.position)
7300
- },
7301
- message: `Parameter "${baseParam.publicName}" reordered on "${baseline.displayName}" (named-friendly language)`,
7302
- policy,
7303
- specRef
7304
- }));
7293
+ else changes.push(makeChange({
7294
+ category: "constructor_reordered_named_friendly",
7295
+ symbol: baseline.fqName,
7296
+ old: {
7297
+ parameter: baseParam.publicName,
7298
+ position: String(baseParam.position)
7299
+ },
7300
+ new: {
7301
+ parameter: candParam.publicName,
7302
+ position: String(candParam.position)
7303
+ },
7304
+ message: `Parameter "${baseParam.publicName}" reordered on "${baseline.displayName}" (named-friendly language)`,
7305
+ policy,
7306
+ specRef
7307
+ }));
7308
+ else if (baseParam.passing === "positional") changes.push(makeChange({
7309
+ category: "parameter_position_changed_order_sensitive",
7310
+ symbol: baseline.fqName,
7311
+ old: {
7312
+ parameter: baseParam.publicName,
7313
+ position: String(baseParam.position)
7314
+ },
7315
+ new: {
7316
+ parameter: candParam.publicName,
7317
+ position: String(candParam.position)
7318
+ },
7319
+ message: `Parameter "${baseParam.publicName}" moved from position ${baseParam.position} to ${candParam.position} on "${baseline.displayName}"`,
7320
+ policy,
7321
+ specRef
7322
+ }));
7323
+ else if (baseParam.passing === "named") changes.push(makeChange({
7324
+ category: "constructor_reordered_named_friendly",
7325
+ symbol: baseline.fqName,
7326
+ old: {
7327
+ parameter: baseParam.publicName,
7328
+ position: String(baseParam.position)
7329
+ },
7330
+ new: {
7331
+ parameter: candParam.publicName,
7332
+ position: String(candParam.position)
7333
+ },
7334
+ message: `Parameter "${baseParam.publicName}" reordered on "${baseline.displayName}" (named-friendly language)`,
7335
+ policy,
7336
+ specRef
7337
+ }));
7338
+ }
7305
7339
  }
7306
7340
  for (const candParam of candParams) if (!baseByName.has(candParam.publicName)) {
7307
7341
  if (changes.some((c) => c.category === "parameter_renamed" && c.new.parameter === candParam.publicName)) continue;
@@ -9133,6 +9167,7 @@ let configDocUrl;
9133
9167
  let configOperationHints;
9134
9168
  let configMountRules;
9135
9169
  let configModelHints;
9170
+ let configEmitterOptions;
9136
9171
  let configCompat;
9137
9172
  try {
9138
9173
  const config = await loadConfig(explicitConfigPath);
@@ -9146,6 +9181,7 @@ try {
9146
9181
  configOperationHints = config.operationHints;
9147
9182
  configMountRules = config.mountRules;
9148
9183
  configModelHints = config.modelHints;
9184
+ configEmitterOptions = config.emitterOptions;
9149
9185
  configCompat = config.compat;
9150
9186
  }
9151
9187
  } catch (err) {
@@ -9179,7 +9215,8 @@ program.command("generate").description("Run a registered emitter against an Ope
9179
9215
  docUrl: configDocUrl,
9180
9216
  operationHints: configOperationHints,
9181
9217
  mountRules: configMountRules,
9182
- modelHints: configModelHints
9218
+ modelHints: configModelHints,
9219
+ emitterOptions: configEmitterOptions?.[opts.lang]
9183
9220
  }).catch(handleError);
9184
9221
  });
9185
9222
  program.command("diff").description("Compare two OpenAPI specs and output a diff report").requiredOption("--old <path>", "Path to old spec").requiredOption("--new <path>", "Path to new spec").action((opts) => {