@workos/oagen-emitters 0.18.4 → 0.19.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.
Files changed (43) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/dist/index.d.mts.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/{plugin-Cciic50q.mjs → plugin-BXDPA9pJ.mjs} +140 -75
  6. package/dist/plugin-BXDPA9pJ.mjs.map +1 -0
  7. package/dist/plugin.mjs +1 -1
  8. package/package.json +4 -4
  9. package/src/dotnet/enums.ts +11 -5
  10. package/src/dotnet/models.ts +11 -5
  11. package/src/dotnet/resources.ts +3 -3
  12. package/src/dotnet/tests.ts +3 -3
  13. package/src/go/resources.ts +3 -3
  14. package/src/go/tests.ts +3 -3
  15. package/src/kotlin/enums.ts +21 -11
  16. package/src/kotlin/models.ts +19 -7
  17. package/src/kotlin/resources.ts +2 -2
  18. package/src/kotlin/tests.ts +2 -2
  19. package/src/node/enums.ts +8 -5
  20. package/src/node/models.ts +29 -21
  21. package/src/node/resources.ts +12 -1
  22. package/src/node/tests.ts +7 -2
  23. package/src/php/enums.ts +18 -5
  24. package/src/php/index.ts +11 -3
  25. package/src/php/models.ts +11 -5
  26. package/src/php/resources.ts +6 -4
  27. package/src/php/tests.ts +6 -3
  28. package/src/python/enums.ts +39 -28
  29. package/src/python/models.ts +27 -18
  30. package/src/python/resources.ts +3 -3
  31. package/src/python/tests.ts +3 -3
  32. package/src/ruby/enums.ts +28 -19
  33. package/src/ruby/models.ts +23 -12
  34. package/src/ruby/rbi.ts +17 -6
  35. package/src/ruby/resources.ts +2 -2
  36. package/src/ruby/tests.ts +2 -2
  37. package/src/rust/enums.ts +9 -1
  38. package/src/rust/models.ts +18 -5
  39. package/src/rust/resources.ts +8 -1
  40. package/src/rust/tests.ts +2 -2
  41. package/src/shared/resolved-ops.ts +47 -0
  42. package/test/shared/synthetic-enum-seed.test.ts +79 -0
  43. package/dist/plugin-Cciic50q.mjs.map +0 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.18.4"
2
+ ".": "0.19.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.19.0](https://github.com/workos/oagen-emitters/compare/v0.18.4...v0.19.0) (2026-06-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * **emitters:** scope per-service emission for `--services` (all 8 emitters) ([#162](https://github.com/workos/oagen-emitters/issues/162)) ([651591b](https://github.com/workos/oagen-emitters/commit/651591bd0492b3160a12503e0a48a95b1d7ebbd7))
9
+
3
10
  ## [0.18.4](https://github.com/workos/oagen-emitters/compare/v0.18.3...v0.18.4) (2026-06-19)
4
11
 
5
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/node/index.ts","../src/python/index.ts","../src/php/index.ts","../src/go/index.ts","../src/dotnet/index.ts","../src/kotlin/index.ts","../src/ruby/index.ts","../src/rust/index.ts","../src/snippets/ruby.ts","../src/snippets/python.ts","../src/snippets/php.ts","../src/snippets/go.ts","../src/snippets/dotnet.ts","../src/snippets/kotlin.ts","../src/snippets/rust.ts","../src/snippets/plugin.ts"],"mappings":";;;;;cAkxBa,WAAA,EAAa,OAyHzB;;;cCn2BY,aAAA,EAAe,OA+D3B;;;cC5CY,UAAA,EAAY,OA4DxB;;;cCzFY,SAAA,EAAW,OAiFvB;;;cC3CY,aAAA,EAAe,OAiR3B;;;cCpTY,aAAA,EAAe,OAkF3B;;;cC9DY,WAAA,EAAa,OAmEzB;;;cC5DY,WAAA,EAAa,OA2DzB;;;cCjHY,kBAAA,EAAoB,cAkBhC;;;cClBY,oBAAA,EAAsB,cAkBlC;;;cClBY,iBAAA,EAAmB,cAyB/B;;;cCzBY,gBAAA,EAAkB,cAmB9B;;;cCbY,oBAAA,EAAsB,cAkBlC;;;;;;;AZovBD;;;carwBa,oBAAA,EAAsB,cAclC;;;cCrBY,kBAAA,EAAoB,cAahC;;;;;;;Ad+vBD;;;;AAyHC;;;;ACn2BD;;;;ccfa,oBAAA;EAAwB,QAAA,EAAU,cAAc;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/node/index.ts","../src/python/index.ts","../src/php/index.ts","../src/go/index.ts","../src/dotnet/index.ts","../src/kotlin/index.ts","../src/ruby/index.ts","../src/rust/index.ts","../src/snippets/ruby.ts","../src/snippets/python.ts","../src/snippets/php.ts","../src/snippets/go.ts","../src/snippets/dotnet.ts","../src/snippets/kotlin.ts","../src/snippets/rust.ts","../src/snippets/plugin.ts"],"mappings":";;;;;cAkxBa,WAAA,EAAa,OAyHzB;;;cCn2BY,aAAA,EAAe,OA+D3B;;;cCpCY,UAAA,EAAY,OA4DxB;;;cCjGY,SAAA,EAAW,OAiFvB;;;cC3CY,aAAA,EAAe,OAiR3B;;;cCpTY,aAAA,EAAe,OAkF3B;;;cC9DY,WAAA,EAAa,OAmEzB;;;cC5DY,WAAA,EAAa,OA2DzB;;;cCjHY,kBAAA,EAAoB,cAkBhC;;;cClBY,oBAAA,EAAsB,cAkBlC;;;cClBY,iBAAA,EAAmB,cAyB/B;;;cCzBY,gBAAA,EAAkB,cAmB9B;;;cCbY,oBAAA,EAAsB,cAkBlC;;;;;;;AZovBD;;;carwBa,oBAAA,EAAsB,cAclC;;;cCrBY,kBAAA,EAAoB,cAahC;;;;;;;Ad+vBD;;;;AAyHC;;;;ACn2BD;;;;ccfa,oBAAA;EAAwB,QAAA,EAAU,cAAc;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as fieldName$4, B as servicePropertyName, C as apiClassName, D as dotnetEmitter, E as propertyName, F as fieldName$3, H as fieldName$1, I as methodName, L as trimMountedResourceFromMethod, M as trimMountedResourceFromMethod$1, N as goEmitter, O as appendAsyncSuffix, P as className, R as phpEmitter, S as kotlinEmitter, T as packageSegment, U as safeParamName$1, V as pythonEmitter, W as nodeEmitter, _ as rubyEmitter, a as rustExtractor, b as resolveServiceTarget, c as pythonExtractor, d as rustEmitter, f as fieldName$5, g as typeName, h as resourceAccessorName, i as kotlinExtractor, j as methodName$1, k as className$1, l as rubyExtractor, m as moduleName, n as elixirExtractor, o as goExtractor, p as methodName$3, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor, v as buildExportedClassNameSet, w as methodName$2, x as safeParamName, y as fieldName, z as fieldName$2 } from "./plugin-Cciic50q.mjs";
1
+ import { A as fieldName$4, B as servicePropertyName, C as apiClassName, D as dotnetEmitter, E as propertyName, F as fieldName$3, H as fieldName$1, I as methodName, L as trimMountedResourceFromMethod, M as trimMountedResourceFromMethod$1, N as goEmitter, O as appendAsyncSuffix, P as className, R as phpEmitter, S as kotlinEmitter, T as packageSegment, U as safeParamName$1, V as pythonEmitter, W as nodeEmitter, _ as rubyEmitter, a as rustExtractor, b as resolveServiceTarget, c as pythonExtractor, d as rustEmitter, f as fieldName$5, g as typeName, h as resourceAccessorName, i as kotlinExtractor, j as methodName$1, k as className$1, l as rubyExtractor, m as moduleName, n as elixirExtractor, o as goExtractor, p as methodName$3, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor, v as buildExportedClassNameSet, w as methodName$2, x as safeParamName, y as fieldName, z as fieldName$2 } from "./plugin-BXDPA9pJ.mjs";
2
2
  import { collectSnippetArgs, collectWrapperArgs, toSnakeCase } from "@workos/oagen";
3
3
  //#region src/snippets/ruby.ts
4
4
  const INDENT$6 = " ";
@@ -75,6 +75,49 @@ function groupByMount(ctx) {
75
75
  return groups;
76
76
  }
77
77
  /**
78
+ * Like {@link groupByMount}, but for a scoped (`--services`) run returns ONLY the
79
+ * mount groups the run selected (`ctx.scopedServices`, POST-MOUNT names). When
80
+ * scoping is inactive the full set is returned unchanged.
81
+ *
82
+ * Use this for PER-SERVICE resource/test emission. Do NOT use it for
83
+ * aggregate/barrel files (Rust `mod.rs`, Ruby `client.rbi`, the root client) —
84
+ * those must continue to list every service, so they keep calling
85
+ * {@link groupByMount} over the full set; otherwise a scoped run would drop
86
+ * sibling modules and break the build/type-check.
87
+ */
88
+ function scopedMountGroups(ctx) {
89
+ const groups = groupByMount(ctx);
90
+ const scope = ctx.scopedServices;
91
+ if (!scope || scope.size === 0) return groups;
92
+ return new Map([...groups].filter(([mountName]) => scope.has(mountName)));
93
+ }
94
+ /**
95
+ * True when a POST-MOUNT service name should be emitted in the current run.
96
+ * Inactive scoping (no `ctx.scopedServices`) ⇒ everything is in scope. Use this
97
+ * for inline per-service gates (e.g. manifest loops keyed by `getMountTarget`).
98
+ */
99
+ function isMountInScope(mountName, ctx) {
100
+ const scope = ctx.scopedServices;
101
+ return !scope || scope.size === 0 || scope.has(mountName);
102
+ }
103
+ /**
104
+ * True when a MODEL's per-model FILE should be written in the current run (FR-1.4).
105
+ * A scoped run sets `ctx.scopedModelNames` to the models reachable from the
106
+ * selected services; out-of-scope models are left untouched on disk. Inactive
107
+ * scoping ⇒ everything is in scope. NOTE: gate only the per-model FILE write —
108
+ * the model must still appear in barrels/indexes (built from the full set) so the
109
+ * untouched on-disk file stays importable.
110
+ */
111
+ function isModelInScope(modelName, ctx) {
112
+ const scope = ctx.scopedModelNames;
113
+ return !scope || scope.has(modelName);
114
+ }
115
+ /** Like {@link isModelInScope} but for an ENUM's per-enum file (`ctx.scopedEnumNames`). */
116
+ function isEnumInScope(enumName, ctx) {
117
+ const scope = ctx.scopedEnumNames;
118
+ return !scope || scope.has(enumName);
119
+ }
120
+ /**
78
121
  * Get the mount target for an IR service.
79
122
  * Checks the first resolved operation that belongs to this service.
80
123
  * Falls back to PascalCase of the service name if no resolved ops exist.
@@ -4655,7 +4698,7 @@ function generateEnums$7(enums, ctx) {
4655
4698
  lines.push(`export type ${enumDef.name} =`);
4656
4699
  lines.push(` (typeof ${enumDef.name})[keyof typeof ${enumDef.name}];`);
4657
4700
  }
4658
- files.push({
4701
+ if (isEnumInScope(enumDef.name, ctx)) files.push({
4659
4702
  path: `src/${dirName}/interfaces/${fileName$3(enumDef.name)}.interface.ts`,
4660
4703
  content: lines.join("\n"),
4661
4704
  skipIfExists: !hasNewValues
@@ -5865,12 +5908,13 @@ function generateResources$7(services, ctx) {
5865
5908
  if (services.length === 0) return [];
5866
5909
  const files = [];
5867
5910
  const mountGroups = groupByMount(ctx);
5868
- const mergedServices = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
5911
+ const mergedServices = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
5869
5912
  name,
5870
5913
  operations: group.operations
5871
5914
  })) : services;
5872
5915
  const topLevelEnumNames = new Set(ctx.spec.enums.map((e) => e.name));
5873
5916
  for (const service of mergedServices) {
5917
+ if (!isMountInScope(service.name, ctx)) continue;
5874
5918
  const isOwnedService = isNodeOwnedService(ctx, service.name, resolveResourceClassName$3(service, ctx));
5875
5919
  if (!isOwnedService && isServiceCoveredByExisting(service, ctx)) {
5876
5920
  if (!hasMethodsAbsentFromBaseline(service, ctx)) continue;
@@ -5897,6 +5941,7 @@ function generateResources$7(services, ctx) {
5897
5941
  }
5898
5942
  }
5899
5943
  for (const service of mergedServices) {
5944
+ if (!isMountInScope(service.name, ctx)) continue;
5900
5945
  if (!isNodeOwnedService(ctx, service.name, resolveResourceClassName$3(service, ctx)) && isServiceCoveredByExisting(service, ctx) && !hasMethodsAbsentFromBaseline(service, ctx)) continue;
5901
5946
  files.push(...generateOptionsInterfaces(service, ctx, topLevelEnumNames));
5902
5947
  }
@@ -7455,7 +7500,7 @@ function generateModels$7(models, ctx, shared) {
7455
7500
  "",
7456
7501
  ...aliasExports
7457
7502
  ] : [...aliasExports];
7458
- files.push({
7503
+ if (isModelInScope(model.name, ctx)) files.push({
7459
7504
  path: aliasPath,
7460
7505
  content: aliasLines.join("\n"),
7461
7506
  overwriteExisting: true
@@ -7713,7 +7758,7 @@ function generateModels$7(models, ctx, shared) {
7713
7758
  for (const [alias, typeExpr] of typeDecls) if (new RegExp(`\\b${alias}\\b`).test(bodyText)) usedDecls.push(`type ${alias} = ${typeExpr};`);
7714
7759
  if (usedDecls.length > 0) lines.splice(typeDeclInsertIdx, 0, ...usedDecls, "");
7715
7760
  }
7716
- files.push({
7761
+ if (isModelInScope(model.name, ctx)) files.push({
7717
7762
  path: filePath,
7718
7763
  content: pruneUnusedImports(lines).join("\n"),
7719
7764
  overwriteExisting: true
@@ -7826,7 +7871,7 @@ function generateSerializers(models, ctx, shared) {
7826
7871
  if (!canonSkipDeserialize) parts.push(`deserialize${canonDomainName} as deserialize${domainName}`);
7827
7872
  if (!canonSkipSerialize) parts.push(`serialize${canonDomainName} as serialize${domainName}`);
7828
7873
  const reexportContent = `export { ${parts.join(", ")} } from '${rel}';`;
7829
- files.push({
7874
+ if (isModelInScope(model.name, ctx)) files.push({
7830
7875
  path: serializerPath,
7831
7876
  content: reexportContent,
7832
7877
  overwriteExisting: true
@@ -7854,7 +7899,7 @@ function generateSerializers(models, ctx, shared) {
7854
7899
  responseReachableModels,
7855
7900
  ctx
7856
7901
  }), ...emitSerializerBody(model, domainName, responseName, typeParams, baselineDomain, baselineResponse, skipFormatFields, shouldSkipSerialize, shouldSkipDeserialize, ctx)];
7857
- files.push({
7902
+ if (isModelInScope(model.name, ctx)) files.push({
7858
7903
  path: serializerPath,
7859
7904
  content: pruneUnusedImports(lines).join("\n"),
7860
7905
  overwriteExisting: true
@@ -8661,7 +8706,7 @@ function generateTests$7(spec, ctx) {
8661
8706
  const mountGroups = groupByMount(ctx);
8662
8707
  const mountAccessors = /* @__PURE__ */ new Map();
8663
8708
  for (const r of ctx.resolvedOperations ?? []) if (!mountAccessors.has(r.mountOn)) mountAccessors.set(r.mountOn, servicePropertyName$4(r.mountOn));
8664
- const testEntries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
8709
+ const testEntries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
8665
8710
  name,
8666
8711
  operations: group.operations
8667
8712
  })) : spec.services.map((s) => ({
@@ -8672,6 +8717,7 @@ function generateTests$7(spec, ctx) {
8672
8717
  if (ctx.apiSurface?.classes?.["WorkOS"]?.methods) for (const name of Object.keys(ctx.apiSurface.classes["WorkOS"].methods)) baselineWorkOSProps.add(name);
8673
8718
  if (ctx.apiSurface?.classes?.["WorkOS"]?.properties) for (const name of Object.keys(ctx.apiSurface.classes["WorkOS"].properties)) baselineWorkOSProps.add(name);
8674
8719
  for (const { name: mountName, operations } of testEntries) {
8720
+ if (!isMountInScope(mountName, ctx)) continue;
8675
8721
  if (operations.length === 0) continue;
8676
8722
  const mergedService = {
8677
8723
  name: mountName,
@@ -11471,6 +11517,7 @@ function generateEnums$6(enums, ctx) {
11471
11517
  const aliasOf = placement.enumAliases;
11472
11518
  for (const enumDef of enums) {
11473
11519
  const dirName = resolveDir(enumToService.get(enumDef.name));
11520
+ const enumInScope = isEnumInScope(enumDef.name, ctx);
11474
11521
  const canonicalName = aliasOf.get(enumDef.name);
11475
11522
  if (canonicalName) {
11476
11523
  if (fileName$2(enumDef.name) === fileName$2(canonicalName)) continue;
@@ -11497,7 +11544,7 @@ function generateEnums$6(enums, ctx) {
11497
11544
  lines.push(" raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")");
11498
11545
  }
11499
11546
  lines.push(`__all__ = ["${aliasCls}"]`);
11500
- files.push({
11547
+ if (enumInScope) files.push({
11501
11548
  path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(enumDef.name)}.py`,
11502
11549
  content: lines.join("\n"),
11503
11550
  integrateTarget: true,
@@ -11528,7 +11575,7 @@ function generateEnums$6(enums, ctx) {
11528
11575
  `__all__ = ["${aliasName}"]`
11529
11576
  ].join("\n");
11530
11577
  }
11531
- files.push({
11578
+ if (enumInScope) files.push({
11532
11579
  path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(aliasName)}.py`,
11533
11580
  content: compatContent,
11534
11581
  integrateTarget: true,
@@ -11627,24 +11674,26 @@ function generateEnums$6(enums, ctx) {
11627
11674
  lines.push("");
11628
11675
  lines.push(`${cls}Literal: TypeAlias = Literal[${uniqueValues.map((v) => typeof v.value === "string" ? `"${v.value}"` : typeof v.value === "boolean" ? v.value ? "True" : "False" : String(v.value)).join(", ")}]`);
11629
11676
  }
11630
- files.push({
11631
- path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(enumDef.name)}.py`,
11632
- content: lines.join("\n"),
11633
- integrateTarget: true,
11634
- overwriteExisting: true
11635
- });
11636
- for (const aliasName of compatAliases.get(enumDef.name) ?? []) files.push({
11637
- path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(aliasName)}.py`,
11638
- content: [
11639
- "from typing import TypeAlias",
11640
- `from .${fileName$2(enumDef.name)} import ${cls}`,
11641
- "",
11642
- `${aliasName}: TypeAlias = ${cls}`,
11643
- `__all__ = ["${aliasName}"]`
11644
- ].join("\n"),
11645
- integrateTarget: true,
11646
- overwriteExisting: true
11647
- });
11677
+ if (enumInScope) {
11678
+ files.push({
11679
+ path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(enumDef.name)}.py`,
11680
+ content: lines.join("\n"),
11681
+ integrateTarget: true,
11682
+ overwriteExisting: true
11683
+ });
11684
+ for (const aliasName of compatAliases.get(enumDef.name) ?? []) files.push({
11685
+ path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(aliasName)}.py`,
11686
+ content: [
11687
+ "from typing import TypeAlias",
11688
+ `from .${fileName$2(enumDef.name)} import ${cls}`,
11689
+ "",
11690
+ `${aliasName}: TypeAlias = ${cls}`,
11691
+ `__all__ = ["${aliasName}"]`
11692
+ ].join("\n"),
11693
+ integrateTarget: true,
11694
+ overwriteExisting: true
11695
+ });
11696
+ }
11648
11697
  }
11649
11698
  return files;
11650
11699
  }
@@ -11781,7 +11830,7 @@ function generateModels$6(models, ctx) {
11781
11830
  dispLines.push(" if dispatch_cls is not None:");
11782
11831
  dispLines.push(` return cast("${variantTypeName}", dispatch_cls.from_dict(data))`);
11783
11832
  dispLines.push(` return ${unknownClassName}.from_dict(data)`);
11784
- files.push({
11833
+ if (isModelInScope(model.name, ctx)) files.push({
11785
11834
  path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(model.name)}.py`,
11786
11835
  content: dispLines.join("\n"),
11787
11836
  integrateTarget: true,
@@ -11812,7 +11861,7 @@ function generateModels$6(models, ctx) {
11812
11861
  else lines.push(`from ${ctx.namespace}.${dirToModule(canonicalDir)}.models.${fileName$2(canonicalName)} import ${canonicalClassName}`);
11813
11862
  lines.push("");
11814
11863
  lines.push(`${modelClassName}: TypeAlias = ${canonicalClassName}`);
11815
- files.push({
11864
+ if (isModelInScope(model.name, ctx)) files.push({
11816
11865
  path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(model.name)}.py`,
11817
11866
  content: lines.join("\n"),
11818
11867
  integrateTarget: true,
@@ -11966,7 +12015,7 @@ function generateModels$6(models, ctx) {
11966
12015
  }
11967
12016
  }
11968
12017
  lines.push(" return result");
11969
- files.push({
12018
+ if (isModelInScope(model.name, ctx)) files.push({
11970
12019
  path: `src/${ctx.namespace}/${dirName}/models/${fileName$2(model.name)}.py`,
11971
12020
  content: lines.join("\n"),
11972
12021
  integrateTarget: true,
@@ -13134,8 +13183,8 @@ function generateResources$6(services, ctx) {
13134
13183
  const resolvedLookup = buildResolvedLookup(ctx);
13135
13184
  const files = [];
13136
13185
  const mountDirMap = buildMountDirMap$1(ctx);
13137
- const mountGroups = groupByMount(ctx);
13138
- const entries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
13186
+ const mountGroups = scopedMountGroups(ctx);
13187
+ const entries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
13139
13188
  name,
13140
13189
  operations: group.operations
13141
13190
  })) : services.map((s) => ({
@@ -13944,8 +13993,8 @@ function generateTests$6(spec, ctx) {
13944
13993
  overwriteExisting: true
13945
13994
  });
13946
13995
  const accessPaths = buildServiceAccessPaths$3(spec.services, ctx);
13947
- const mountGroups = groupByMount(ctx);
13948
- const testEntries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
13996
+ const mountGroups = scopedMountGroups(ctx);
13997
+ const testEntries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
13949
13998
  name,
13950
13999
  operations: group.operations,
13951
14000
  resolvedOps: group.resolvedOps
@@ -15436,7 +15485,7 @@ function generateModels$5(models, ctx) {
15436
15485
  lines.push(" ];");
15437
15486
  lines.push(" }");
15438
15487
  lines.push("}");
15439
- files.push({
15488
+ if (isModelInScope(model.name, ctx)) files.push({
15440
15489
  path: `lib/Resource/${name}.php`,
15441
15490
  content: lines.join("\n"),
15442
15491
  overwriteExisting: true
@@ -15594,6 +15643,7 @@ function generateEnums$5(enums, ctx) {
15594
15643
  const canonical = resolveEnumName$1(e.name);
15595
15644
  if (emittedCanonical.has(canonical)) continue;
15596
15645
  emittedCanonical.add(canonical);
15646
+ const enumInScope = enums.some((other) => resolveEnumName$1(other.name) === canonical && isEnumInScope(other.name, ctx));
15597
15647
  const name = className$4(canonical);
15598
15648
  e.values.every((v) => typeof v.value === "string");
15599
15649
  const backingType = e.values.every((v) => typeof v.value === "number" && Number.isInteger(v.value)) ? "int" : "string";
@@ -15619,7 +15669,7 @@ function generateEnums$5(enums, ctx) {
15619
15669
  else lines.push(` case ${caseName} = ${val.value};`);
15620
15670
  }
15621
15671
  lines.push("}");
15622
- files.push({
15672
+ if (enumInScope) files.push({
15623
15673
  path: `lib/Resource/${name}.php`,
15624
15674
  content: lines.join("\n"),
15625
15675
  overwriteExisting: true
@@ -15760,8 +15810,8 @@ function generateResources$5(services, ctx) {
15760
15810
  if (services.length === 0) return [];
15761
15811
  const files = [];
15762
15812
  const modelMap = new Map(ctx.spec.models.map((m) => [m.name, m]));
15763
- const mountGroups = groupByMount(ctx);
15764
- const entries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
15813
+ const mountGroups = scopedMountGroups(ctx);
15814
+ const entries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
15765
15815
  name,
15766
15816
  operations: group.operations
15767
15817
  })) : services.map((s) => ({
@@ -16531,9 +16581,9 @@ function generatePrimitiveValue$2(type, format, name, modelName) {
16531
16581
  */
16532
16582
  function generateTests$5(spec, ctx) {
16533
16583
  const files = [];
16534
- const mountGroupsFromResolved = groupByMount(ctx);
16584
+ const mountGroupsFromResolved = scopedMountGroups(ctx);
16535
16585
  const mountGroups = /* @__PURE__ */ new Map();
16536
- if (mountGroupsFromResolved.size > 0) for (const [target, group] of mountGroupsFromResolved) mountGroups.set(target, group.resolvedOps.map((r) => ({
16586
+ if (mountGroupsFromResolved.size > 0 || ctx.scopedServices?.size) for (const [target, group] of mountGroupsFromResolved) mountGroups.set(target, group.resolvedOps.map((r) => ({
16537
16587
  op: r.operation,
16538
16588
  service: r.service,
16539
16589
  resolvedOp: r
@@ -16983,9 +17033,17 @@ function ensureTrailingNewlines$5(files) {
16983
17033
  * classes (no sum types), so a discriminated base whose IR fields the
16984
17034
  * parser stripped (post-allOf-aware detection) gets its original fields
16985
17035
  * restored to avoid silently dropping variant data.
16986
- */
16987
- function enrichModelsForPhp(models) {
16988
- const enriched = enrichModelsFromSpec(models);
17036
+ *
17037
+ * `enums` is forwarded to seed `enrichModelsFromSpec`'s collision set: an
17038
+ * inline oneOf enum whose synthetic name (`Parent_field`) snake-collapses
17039
+ * onto an existing IR enum (e.g. `DataIntegrationAccessTokenResponse_error`
17040
+ * vs `DataIntegrationAccessTokenResponseError`) must NOT spawn a duplicate
17041
+ * synthetic. Otherwise both collapse to the same `lib/Resource/X.php` path
17042
+ * and the later writer wins by array order — which differs between a full
17043
+ * and a scoped (`--services`) run, producing a non-deterministic case order.
17044
+ */
17045
+ function enrichModelsForPhp(models, enums) {
17046
+ const enriched = enrichModelsFromSpec(models, enums);
16989
17047
  const originalByName = new Map(models.map((m) => [m.name, m]));
16990
17048
  return enriched.map((m) => {
16991
17049
  if (m.discriminator && m.fields.length === 0) {
@@ -17002,7 +17060,7 @@ const phpEmitter = {
17002
17060
  language: "php",
17003
17061
  generateModels(models, ctx) {
17004
17062
  ensureNamingInitialized(ctx);
17005
- return ensureTrailingNewlines$5(generateModels$5(enrichModelsForPhp(models), ctx));
17063
+ return ensureTrailingNewlines$5(generateModels$5(enrichModelsForPhp(models, ctx.spec.enums), ctx));
17006
17064
  },
17007
17065
  generateEnums(enums, ctx) {
17008
17066
  ensureNamingInitialized(ctx);
@@ -17939,8 +17997,8 @@ function resolveResourceClassName$1(service, ctx) {
17939
17997
  function generateResources$4(services, ctx) {
17940
17998
  if (services.length === 0) return [];
17941
17999
  const files = [];
17942
- const mountGroups = groupByMount(ctx);
17943
- const entries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
18000
+ const mountGroups = scopedMountGroups(ctx);
18001
+ const entries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
17944
18002
  name,
17945
18003
  operations: group.operations
17946
18004
  })) : services.map((s) => ({
@@ -19100,8 +19158,8 @@ function generateTests$4(spec, ctx) {
19100
19158
  headerPlacement: "skip"
19101
19159
  });
19102
19160
  const accessPaths = buildServiceAccessPaths$1(spec.services, ctx);
19103
- const mountGroups = groupByMount(ctx);
19104
- const testEntries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
19161
+ const mountGroups = scopedMountGroups(ctx);
19162
+ const testEntries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
19105
19163
  name,
19106
19164
  operations: group.operations
19107
19165
  })) : spec.services.map((s) => ({
@@ -20244,7 +20302,7 @@ function generateModels$3(models, ctx, discCtx) {
20244
20302
  }
20245
20303
  lines.push(" }");
20246
20304
  lines.push("}");
20247
- files.push({
20305
+ if (isModelInScope(model.name, ctx)) files.push({
20248
20306
  path: `Entities/${csClassName}.cs`,
20249
20307
  content: lines.join("\n"),
20250
20308
  overwriteExisting: true
@@ -20488,7 +20546,7 @@ function generateEnums$3(enums, ctx) {
20488
20546
  }
20489
20547
  lines.push(" }");
20490
20548
  lines.push("}");
20491
- files.push({
20549
+ if (isEnumInScope(enumDef.name, ctx)) files.push({
20492
20550
  path: `Enums/${typeName}.cs`,
20493
20551
  content: lines.join("\n"),
20494
20552
  overwriteExisting: true
@@ -20745,8 +20803,8 @@ function resolveResourceClassName(service, ctx) {
20745
20803
  function generateResources$3(services, ctx) {
20746
20804
  if (services.length === 0) return [];
20747
20805
  const files = [];
20748
- const mountGroups = groupByMount(ctx);
20749
- const entries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
20806
+ const mountGroups = scopedMountGroups(ctx);
20807
+ const entries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
20750
20808
  name,
20751
20809
  operations: group.operations
20752
20810
  })) : services.map((s) => ({
@@ -21557,8 +21615,8 @@ function generateTests$3(spec, ctx) {
21557
21615
  content: fixture.content,
21558
21616
  headerPlacement: "skip"
21559
21617
  });
21560
- const mountGroups = groupByMount(ctx);
21561
- const testEntries = mountGroups.size > 0 ? [...mountGroups].map(([name, group]) => ({
21618
+ const mountGroups = scopedMountGroups(ctx);
21619
+ const testEntries = mountGroups.size > 0 || ctx.scopedServices?.size ? [...mountGroups].map(([name, group]) => ({
21562
21620
  name,
21563
21621
  operations: group.operations
21564
21622
  })) : spec.services.map((s) => ({
@@ -22536,7 +22594,7 @@ const enumCanonicalMap = /* @__PURE__ */ new Map();
22536
22594
  * shortest PascalCase name becomes canonical and the rest emit `typealias`
22537
22595
  * files pointing at the canonical class.
22538
22596
  */
22539
- function generateEnums$2(enums, _ctx) {
22597
+ function generateEnums$2(enums, ctx) {
22540
22598
  if (enums.length === 0) return [];
22541
22599
  enumCanonicalMap.clear();
22542
22600
  const hashGroups = /* @__PURE__ */ new Map();
@@ -22573,6 +22631,7 @@ function generateEnums$2(enums, _ctx) {
22573
22631
  for (const enumDef of enums) {
22574
22632
  if (enumDef.values.length === 0) continue;
22575
22633
  const typeName = canonicalEnumTypeName(enumDef);
22634
+ const enumInScope = isEnumInScope(enumDef.name, ctx);
22576
22635
  const canonicalName = sharedSortEmitters.has(enumDef.name) ? void 0 : aliasOf.get(enumDef.name) ?? enumCanonicalMap.get(enumDef.name);
22577
22636
  if (canonicalName) {
22578
22637
  const canonicalType = className$1(canonicalName);
@@ -22585,7 +22644,7 @@ function generateEnums$2(enums, _ctx) {
22585
22644
  aliasLine,
22586
22645
  ""
22587
22646
  ].join("\n");
22588
- files.push({
22647
+ if (enumInScope) files.push({
22589
22648
  path: `${KOTLIN_SRC_PREFIX$3}${ENUMS_DIR}/${typeName}.kt`,
22590
22649
  content: aliasContent,
22591
22650
  overwriteExisting: true
@@ -22641,7 +22700,7 @@ function generateEnums$2(enums, _ctx) {
22641
22700
  }
22642
22701
  lines.push("}");
22643
22702
  lines.push("");
22644
- files.push({
22703
+ if (enumInScope) files.push({
22645
22704
  path: `${KOTLIN_SRC_PREFIX$3}${ENUMS_DIR}/${typeName}.kt`,
22646
22705
  content: lines.join("\n"),
22647
22706
  overwriteExisting: true
@@ -22838,8 +22897,9 @@ function generateModels$2(models, ctx) {
22838
22897
  for (const model of models) {
22839
22898
  if (skipAsListWrapper(model) || skipAsListMetadata(model)) continue;
22840
22899
  const typeName = className$1(model.name);
22900
+ const modelInScope = isModelInScope(model.name, ctx);
22841
22901
  if (model.fields.length === 0 && discriminatedUnions.has(typeName)) {
22842
- files.push(emitSealedUnion(typeName, discriminatedUnions.get(typeName)));
22902
+ if (modelInScope) files.push(emitSealedUnion(typeName, discriminatedUnions.get(typeName)));
22843
22903
  continue;
22844
22904
  }
22845
22905
  const canonical = aliasOf.get(model.name);
@@ -22853,14 +22913,14 @@ function generateModels$2(models, ctx) {
22853
22913
  `typealias ${typeName} = ${canonicalType}`,
22854
22914
  ""
22855
22915
  ].join("\n");
22856
- files.push({
22916
+ if (modelInScope) files.push({
22857
22917
  path: `${KOTLIN_SRC_PREFIX$2}${MODELS_DIR}/${typeName}.kt`,
22858
22918
  content: aliasContent,
22859
22919
  overwriteExisting: true
22860
22920
  });
22861
22921
  continue;
22862
22922
  }
22863
- files.push(emitDataClass(model));
22923
+ if (modelInScope) files.push(emitDataClass(model));
22864
22924
  }
22865
22925
  const eventMapping = [];
22866
22926
  for (const model of models) {
@@ -23554,7 +23614,7 @@ function promoteFieldType(f) {
23554
23614
  */
23555
23615
  function generateResources$2(services, ctx) {
23556
23616
  if (services.length === 0) return [];
23557
- const mountGroups = groupByMount(ctx);
23617
+ const mountGroups = scopedMountGroups(ctx);
23558
23618
  if (mountGroups.size === 0) return [];
23559
23619
  const files = [];
23560
23620
  const resolvedLookup = buildResolvedLookup(ctx);
@@ -24462,7 +24522,7 @@ function promoteIso8601TypeRef(type, description) {
24462
24522
  */
24463
24523
  function generateTests$2(spec, ctx) {
24464
24524
  const files = [];
24465
- const mountGroups = groupByMount(ctx);
24525
+ const mountGroups = scopedMountGroups(ctx);
24466
24526
  const resolvedLookup = buildResolvedLookup(ctx);
24467
24527
  const exportedClasses = buildExportedClassNameSet$1(ctx);
24468
24528
  for (const [mountName, group] of mountGroups) {
@@ -25624,7 +25684,7 @@ function generateModels$1(models, ctx) {
25624
25684
  lines.push("module WorkOS");
25625
25685
  lines.push(` ${cls} = ${canonCls}`);
25626
25686
  lines.push("end");
25627
- files.push({
25687
+ if (isModelInScope(model.name, ctx)) files.push({
25628
25688
  path: `lib/workos/${dirFor(model.name)}/${file}.rb`,
25629
25689
  content: lines.join("\n"),
25630
25690
  integrateTarget: true,
@@ -25696,7 +25756,7 @@ function generateModels$1(models, ctx) {
25696
25756
  lines.push(" end");
25697
25757
  lines.push(" end");
25698
25758
  lines.push("end");
25699
- files.push({
25759
+ if (isModelInScope(model.name, ctx)) files.push({
25700
25760
  path: `lib/workos/${dirFor(model.name)}/${file}.rb`,
25701
25761
  content: lines.join("\n"),
25702
25762
  integrateTarget: true,
@@ -25805,6 +25865,7 @@ function generateEnums$1(enums, ctx) {
25805
25865
  const aliasOf = collectEnumAliasOf(enums);
25806
25866
  for (const enumDef of enums) {
25807
25867
  const cls = className(enumDef.name);
25868
+ const enumInScope = isEnumInScope(enumDef.name, ctx);
25808
25869
  const canonicalName = aliasOf.get(enumDef.name);
25809
25870
  if (canonicalName) {
25810
25871
  const canonicalCls = className(canonicalName);
@@ -25814,7 +25875,7 @@ function generateEnums$1(enums, ctx) {
25814
25875
  lines.push(` ${cls} = ${canonicalCls}`);
25815
25876
  lines.push(" end");
25816
25877
  lines.push("end");
25817
- files.push({
25878
+ if (enumInScope) files.push({
25818
25879
  path: `lib/workos/types/${fileName(enumDef.name)}.rb`,
25819
25880
  content: lines.join("\n"),
25820
25881
  integrateTarget: true,
@@ -25843,7 +25904,7 @@ function generateEnums$1(enums, ctx) {
25843
25904
  lines.push(" end");
25844
25905
  lines.push(" end");
25845
25906
  lines.push("end");
25846
- files.push({
25907
+ if (enumInScope) files.push({
25847
25908
  path: `lib/workos/types/${fileName(enumDef.name)}.rb`,
25848
25909
  content: lines.join("\n"),
25849
25910
  integrateTarget: true,
@@ -25880,7 +25941,7 @@ function generateEnums$1(enums, ctx) {
25880
25941
  lines.push(" end");
25881
25942
  lines.push(" end");
25882
25943
  lines.push("end");
25883
- files.push({
25944
+ if (enumInScope) files.push({
25884
25945
  path: `lib/workos/types/${fileName(enumDef.name)}.rb`,
25885
25946
  content: lines.join("\n"),
25886
25947
  integrateTarget: true,
@@ -26258,7 +26319,7 @@ function emitInlineVariantRbi(v) {
26258
26319
  */
26259
26320
  function generateResources$1(services, ctx) {
26260
26321
  const files = [];
26261
- const groups = groupByMount(ctx);
26322
+ const groups = scopedMountGroups(ctx);
26262
26323
  const lookup = buildResolvedLookup(ctx);
26263
26324
  const modelNames = new Set(ctx.spec.models.map((m) => m.name));
26264
26325
  const enumNames = new Set(ctx.spec.enums.map((e) => e.name));
@@ -27036,7 +27097,7 @@ function generateClientClass(spec, ctx) {
27036
27097
  */
27037
27098
  function generateTests$1(spec, ctx) {
27038
27099
  const files = [];
27039
- const groups = groupByMount(ctx);
27100
+ const groups = scopedMountGroups(ctx);
27040
27101
  const models = spec.models;
27041
27102
  const modelByName = /* @__PURE__ */ new Map();
27042
27103
  for (const m of models) modelByName.set(m.name, m);
@@ -27532,7 +27593,7 @@ function generateRbiFiles(spec, ctx) {
27532
27593
  lines.push(" def to_json(*args); end");
27533
27594
  lines.push(" end");
27534
27595
  lines.push("end");
27535
- files.push({
27596
+ if (isModelInScope(model.name, ctx)) files.push({
27536
27597
  path: `rbi/workos/${fileName(model.name)}.rbi`,
27537
27598
  content: lines.join("\n"),
27538
27599
  integrateTarget: true,
@@ -27548,6 +27609,7 @@ function generateRbiFiles(spec, ctx) {
27548
27609
  const groupOwners = buildGroupOwnerMap(ctx);
27549
27610
  const exportedClasses = buildExportedClassNameSet(ctx);
27550
27611
  for (const [mountTarget, group] of groups) {
27612
+ if (!isMountInScope(mountTarget, ctx)) continue;
27551
27613
  const resolvedTarget = resolveServiceTarget(mountTarget, exportedClasses);
27552
27614
  const cls = className(resolvedTarget);
27553
27615
  const lines = [];
@@ -28164,9 +28226,10 @@ function generateModels(models, ctx, registry) {
28164
28226
  seen.add(mod);
28165
28227
  moduleNames.push(mod);
28166
28228
  const path = ctx.overlayLookup?.fileBySymbol?.get(model.name) ?? `src/models/${mod}.rs`;
28167
- files.push({
28229
+ const content = renderModel(model, registry, taggedVariantFields.get(model.name));
28230
+ if (isModelInScope(model.name, ctx)) files.push({
28168
28231
  path,
28169
- content: renderModel(model, registry, taggedVariantFields.get(model.name)),
28232
+ content,
28170
28233
  overwriteExisting: true
28171
28234
  });
28172
28235
  }
@@ -28325,7 +28388,7 @@ function formatDefault$1(value) {
28325
28388
  * variant and re-serialize as the canonical wire string.
28326
28389
  * - `Display`, `FromStr`, and `AsRef<str>` are implemented for ergonomics.
28327
28390
  */
28328
- function generateEnums(enums, _ctx) {
28391
+ function generateEnums(enums, ctx) {
28329
28392
  const files = [];
28330
28393
  const seen = /* @__PURE__ */ new Set();
28331
28394
  const moduleNames = [];
@@ -28335,6 +28398,7 @@ function generateEnums(enums, _ctx) {
28335
28398
  if (seen.has(mod)) continue;
28336
28399
  seen.add(mod);
28337
28400
  moduleNames.push(mod);
28401
+ if (!isEnumInScope(e.name, ctx)) continue;
28338
28402
  files.push({
28339
28403
  path: `src/enums/${mod}.rs`,
28340
28404
  content: renderEnum(e),
@@ -28494,6 +28558,7 @@ function generateResources(_services, ctx, registry) {
28494
28558
  module: basename,
28495
28559
  struct
28496
28560
  });
28561
+ if (!isMountInScope(mountName, ctx)) continue;
28497
28562
  files.push({
28498
28563
  path: `src/resources/${basename}.rs`,
28499
28564
  content: renderMountGroup(mountName, group.resolvedOps, ctx, registry, lookup),
@@ -29642,7 +29707,7 @@ function generateTests(spec, ctx) {
29642
29707
  content: renderCommon(ctx),
29643
29708
  overwriteExisting: true
29644
29709
  });
29645
- const groups = groupByMount(ctx);
29710
+ const groups = scopedMountGroups(ctx);
29646
29711
  const modelMap = new Map(spec.models.map((m) => [m.name, m]));
29647
29712
  const enumMap = new Map(spec.enums.map((e) => [e.name, e]));
29648
29713
  for (const [mountName, group] of groups) {
@@ -30274,4 +30339,4 @@ const workosEmittersPlugin = {
30274
30339
  //#endregion
30275
30340
  export { fieldName$2 as A, servicePropertyName$2 as B, apiClassName as C, dotnetEmitter as D, propertyName as E, fieldName$3 as F, fieldName$5 as H, methodName$3 as I, trimMountedResourceFromMethod$2 as L, trimMountedResourceFromMethod$1 as M, goEmitter as N, appendAsyncSuffix as O, className$3 as P, phpEmitter as R, kotlinEmitter as S, packageSegment as T, safeParamName$1 as U, pythonEmitter as V, nodeEmitter as W, rubyEmitter as _, rustExtractor as a, resolveServiceTarget as b, pythonExtractor as c, rustEmitter as d, fieldName as f, typeName as g, resourceAccessorName as h, kotlinExtractor as i, methodName$2 as j, className$2 as k, rubyExtractor as l, moduleName as m, elixirExtractor as n, goExtractor as o, methodName as p, dotnetExtractor as r, phpExtractor as s, workosEmittersPlugin as t, nodeExtractor as u, buildExportedClassNameSet as v, methodName$1 as w, safeParamName as x, fieldName$1 as y, fieldName$4 as z };
30276
30341
 
30277
- //# sourceMappingURL=plugin-Cciic50q.mjs.map
30342
+ //# sourceMappingURL=plugin-BXDPA9pJ.mjs.map