@workos/oagen 0.10.4 → 0.12.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.
package/README.md CHANGED
@@ -196,6 +196,11 @@ export default {
196
196
  Connections: 'SSO', // All Connections ops mount on SSO
197
197
  DirectoryGroups: 'DirectorySync',
198
198
  },
199
+ modelHints: {
200
+ // Pin a model's placement when "first service to reference it wins"
201
+ // would otherwise drift as the spec evolves.
202
+ User: 'UserManagementUsers',
203
+ },
199
204
  };
200
205
  ```
201
206
 
@@ -4700,6 +4700,7 @@ function buildEmitterContext(spec, options) {
4700
4700
  apiSurface: options.apiSurface,
4701
4701
  overlayLookup: options.overlayLookup,
4702
4702
  resolvedOperations: resolveOperations(spec, options.operationHints, options.mountRules),
4703
+ modelHints: options.modelHints,
4703
4704
  targetDir: options.target,
4704
4705
  priorTargetManifestPaths: options.priorTargetManifestPaths
4705
4706
  };
@@ -5932,6 +5933,7 @@ async function generateCommand(opts) {
5932
5933
  overlayLookup,
5933
5934
  operationHints: opts.operationHints,
5934
5935
  mountRules: opts.mountRules,
5936
+ modelHints: opts.modelHints,
5935
5937
  noPrune: opts.prune === false
5936
5938
  });
5937
5939
  if (opts.dryRun) for (const f of files) console.log(f.path);
@@ -6427,7 +6429,8 @@ function apiSurfaceToSnapshot(surface) {
6427
6429
  displayName: className,
6428
6430
  visibility: "public",
6429
6431
  stability: cls.deprecationMessage ? "deprecated" : "stable",
6430
- sourceKind: "generated_service_wrapper"
6432
+ sourceKind: "generated_service_wrapper",
6433
+ ...cls.sourceFile ? { sourceFile: cls.sourceFile } : {}
6431
6434
  });
6432
6435
  if (cls.constructorParams.length > 0) symbols.push({
6433
6436
  id: `ctor:${className}`,
@@ -6438,7 +6441,8 @@ function apiSurfaceToSnapshot(surface) {
6438
6441
  visibility: "public",
6439
6442
  stability: "stable",
6440
6443
  sourceKind: "generated_resource_constructor",
6441
- parameters: cls.constructorParams.map((p, i) => apiParamToCompatParam(p, i, language))
6444
+ parameters: cls.constructorParams.map((p, i) => apiParamToCompatParam(p, i, language)),
6445
+ ...cls.sourceFile ? { sourceFile: cls.sourceFile } : {}
6442
6446
  });
6443
6447
  for (const [methodName, overloads] of Object.entries(cls.methods)) for (let oi = 0; oi < overloads.length; oi++) {
6444
6448
  const method = overloads[oi];
@@ -6453,7 +6457,8 @@ function apiSurfaceToSnapshot(surface) {
6453
6457
  stability: "stable",
6454
6458
  sourceKind: "generated_service_wrapper",
6455
6459
  parameters: method.params.map((p, i) => apiParamToCompatParam(p, i, language)),
6456
- returns: { name: method.returnType }
6460
+ returns: { name: method.returnType },
6461
+ ...cls.sourceFile ? { sourceFile: cls.sourceFile } : {}
6457
6462
  });
6458
6463
  }
6459
6464
  for (const [propName, prop] of Object.entries(cls.properties)) symbols.push({
@@ -6465,7 +6470,8 @@ function apiSurfaceToSnapshot(surface) {
6465
6470
  visibility: "public",
6466
6471
  stability: "stable",
6467
6472
  sourceKind: "generated_service_wrapper",
6468
- typeRef: { name: prop.type }
6473
+ typeRef: { name: prop.type },
6474
+ ...cls.sourceFile ? { sourceFile: cls.sourceFile } : {}
6469
6475
  });
6470
6476
  }
6471
6477
  for (const [ifaceName, iface] of Object.entries(surface.interfaces)) {
@@ -6476,7 +6482,8 @@ function apiSurfaceToSnapshot(surface) {
6476
6482
  displayName: ifaceName,
6477
6483
  visibility: "public",
6478
6484
  stability: "stable",
6479
- sourceKind: "generated_resource_constructor"
6485
+ sourceKind: "generated_resource_constructor",
6486
+ ...iface.sourceFile ? { sourceFile: iface.sourceFile } : {}
6480
6487
  });
6481
6488
  for (const [fieldName, field] of Object.entries(iface.fields)) symbols.push({
6482
6489
  id: `field:${ifaceName}.${fieldName}`,
@@ -6487,7 +6494,8 @@ function apiSurfaceToSnapshot(surface) {
6487
6494
  visibility: "public",
6488
6495
  stability: "stable",
6489
6496
  sourceKind: "generated_resource_constructor",
6490
- typeRef: { name: field.type }
6497
+ typeRef: { name: field.type },
6498
+ ...iface.sourceFile ? { sourceFile: iface.sourceFile } : {}
6491
6499
  });
6492
6500
  if (iface.hasCustomConstructor) symbols.push({
6493
6501
  id: `ctor:${ifaceName}`,
@@ -6497,17 +6505,19 @@ function apiSurfaceToSnapshot(surface) {
6497
6505
  displayName: `new ${ifaceName}`,
6498
6506
  visibility: "public",
6499
6507
  stability: "stable",
6500
- sourceKind: "generated_resource_constructor"
6508
+ sourceKind: "generated_resource_constructor",
6509
+ ...iface.sourceFile ? { sourceFile: iface.sourceFile } : {}
6501
6510
  });
6502
6511
  }
6503
- for (const [aliasName] of Object.entries(surface.typeAliases)) symbols.push({
6512
+ for (const [aliasName, alias] of Object.entries(surface.typeAliases)) symbols.push({
6504
6513
  id: `alias:${aliasName}`,
6505
6514
  kind: "alias",
6506
6515
  fqName: aliasName,
6507
6516
  displayName: aliasName,
6508
6517
  visibility: "public",
6509
6518
  stability: "stable",
6510
- sourceKind: "generated_resource_constructor"
6519
+ sourceKind: "generated_resource_constructor",
6520
+ ...alias.sourceFile ? { sourceFile: alias.sourceFile } : {}
6511
6521
  });
6512
6522
  for (const [enumName, enumDef] of Object.entries(surface.enums)) {
6513
6523
  symbols.push({
@@ -6517,7 +6527,8 @@ function apiSurfaceToSnapshot(surface) {
6517
6527
  displayName: enumName,
6518
6528
  visibility: "public",
6519
6529
  stability: "stable",
6520
- sourceKind: "generated_enum"
6530
+ sourceKind: "generated_enum",
6531
+ ...enumDef.sourceFile ? { sourceFile: enumDef.sourceFile } : {}
6521
6532
  });
6522
6533
  for (const [memberName, memberValue] of Object.entries(enumDef.members)) symbols.push({
6523
6534
  id: `enum_member:${enumName}.${memberName}`,
@@ -6528,7 +6539,8 @@ function apiSurfaceToSnapshot(surface) {
6528
6539
  visibility: "public",
6529
6540
  stability: "stable",
6530
6541
  sourceKind: "generated_enum",
6531
- value: memberValue
6542
+ value: memberValue,
6543
+ ...enumDef.sourceFile ? { sourceFile: enumDef.sourceFile } : {}
6532
6544
  });
6533
6545
  }
6534
6546
  return {
@@ -8368,6 +8380,7 @@ let configSchemaNameTransform;
8368
8380
  let configDocUrl;
8369
8381
  let configOperationHints;
8370
8382
  let configMountRules;
8383
+ let configModelHints;
8371
8384
  let configCompat;
8372
8385
  try {
8373
8386
  const config = await loadConfig(explicitConfigPath);
@@ -8379,6 +8392,7 @@ try {
8379
8392
  configDocUrl = config.docUrl;
8380
8393
  configOperationHints = config.operationHints;
8381
8394
  configMountRules = config.mountRules;
8395
+ configModelHints = config.modelHints;
8382
8396
  configCompat = config.compat;
8383
8397
  }
8384
8398
  } catch (err) {
@@ -8405,7 +8419,8 @@ program.command("generate").description("Run a registered emitter against an Ope
8405
8419
  schemaNameTransform: configSchemaNameTransform,
8406
8420
  docUrl: configDocUrl,
8407
8421
  operationHints: configOperationHints,
8408
- mountRules: configMountRules
8422
+ mountRules: configMountRules,
8423
+ modelHints: configModelHints
8409
8424
  }).catch(handleError);
8410
8425
  });
8411
8426
  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) => {