@workos/oagen-emitters 0.6.5 → 0.6.7

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,3 +1,3 @@
1
1
  {
2
- ".": "0.6.5"
2
+ ".": "0.6.7"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.7](https://github.com/workos/oagen-emitters/compare/v0.6.6...v0.6.7) (2026-04-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * cross-domain aliases and minor emitter fixes ([#65](https://github.com/workos/oagen-emitters/issues/65)) ([9f305ce](https://github.com/workos/oagen-emitters/commit/9f305ce68c008d4341b254eafa0e0d5c0ce59598))
9
+ * **dotnet:** mark discriminator property as internal set on base class ([#63](https://github.com/workos/oagen-emitters/issues/63)) ([dcd32bc](https://github.com/workos/oagen-emitters/commit/dcd32bcc327b54995e078f7a3767198a4d87fa5b))
10
+
11
+ ## [0.6.6](https://github.com/workos/oagen-emitters/compare/v0.6.5...v0.6.6) (2026-04-28)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **dotnet:** prevent infinite recursion in discriminator converter WriteJson ([#59](https://github.com/workos/oagen-emitters/issues/59)) ([b2a2b7e](https://github.com/workos/oagen-emitters/commit/b2a2b7e1d18348423debb40ca6c331b4b7a34dc2))
17
+ * **go:** resolve test fixture paths through dedup rewrite map ([#58](https://github.com/workos/oagen-emitters/issues/58)) ([815750a](https://github.com/workos/oagen-emitters/commit/815750a9eef8d8c3883ab505848e585732a02a05))
18
+ * **python:** emit non-spec imports as plain imports instead of ignore block ([#60](https://github.com/workos/oagen-emitters/issues/60)) ([bf86e0c](https://github.com/workos/oagen-emitters/commit/bf86e0cfbb3ce7b48454be68d0f9fcfe5f6265c4))
19
+
3
20
  ## [0.6.5](https://github.com/workos/oagen-emitters/compare/v0.6.4...v0.6.5) (2026-04-28)
4
21
 
5
22
 
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as nodeEmitter, a as rustExtractor, c as pythonExtractor, d as rubyEmitter, f as kotlinEmitter, g as pythonEmitter, h as phpEmitter, i as kotlinExtractor, l as rubyExtractor, m as goEmitter, n as elixirExtractor, o as goExtractor, p as dotnetEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor } from "./plugin-BV_wDWDO.mjs";
1
+ import { _ as nodeEmitter, a as rustExtractor, c as pythonExtractor, d as rubyEmitter, f as kotlinEmitter, g as pythonEmitter, h as phpEmitter, i as kotlinExtractor, l as rubyExtractor, m as goEmitter, n as elixirExtractor, o as goExtractor, p as dotnetEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor } from "./plugin-Bk0xWTQC.mjs";
2
2
  export { dotnetEmitter, dotnetExtractor, elixirExtractor, goEmitter, goExtractor, kotlinEmitter, kotlinExtractor, nodeEmitter, nodeExtractor, phpEmitter, phpExtractor, pythonEmitter, pythonExtractor, rubyEmitter, rubyExtractor, rustExtractor, workosEmittersPlugin };
@@ -8863,13 +8863,10 @@ function generateWorkOSClient(spec, ctx) {
8863
8863
  lines.push(")");
8864
8864
  } else lines.push(importLine);
8865
8865
  }
8866
- lines.push("");
8867
- lines.push("# @oagen-ignore-start — non-spec service imports (hand-maintained)");
8868
8866
  for (const s of NON_SPEC_SERVICES) {
8869
8867
  const w = PYTHON_NON_SPEC_WIRING[s.id];
8870
8868
  if (w) lines.push(w.importLine);
8871
8869
  }
8872
- lines.push("# @oagen-ignore-end");
8873
8870
  lines.push("");
8874
8871
  lines.push("");
8875
8872
  lines.push("class WorkOSClient(_SyncBase):");
@@ -12398,7 +12395,21 @@ function makeOptional$1(goType) {
12398
12395
  return `*${goType}`;
12399
12396
  }
12400
12397
  function structuralHash$2(model) {
12401
- return model.fields.map((f) => `${f.name}:${JSON.stringify(f.type)}:${f.required}`).sort().join("|");
12398
+ const fieldHash = model.fields.map((f) => `${f.name}:${JSON.stringify(f.type)}:${f.required}`).sort().join("|");
12399
+ const domain = crudEntityDomain(model.name);
12400
+ return domain ? `${domain}::${fieldHash}` : fieldHash;
12401
+ }
12402
+ const CRUD_PREFIXES = [
12403
+ "Create",
12404
+ "Update",
12405
+ "Delete",
12406
+ "Get",
12407
+ "List"
12408
+ ];
12409
+ /** Strip CRUD verb prefix to get the entity name, or null if no prefix matches. */
12410
+ function crudEntityDomain(name) {
12411
+ for (const prefix of CRUD_PREFIXES) if (name.startsWith(prefix) && name.length > prefix.length) return name.slice(prefix.length);
12412
+ return null;
12402
12413
  }
12403
12414
  /** Known acronyms to preserve as single tokens during humanization. */
12404
12415
  const HUMANIZE_ACRONYMS$1 = [
@@ -13803,7 +13814,10 @@ const ID_PREFIXES$1 = {
13803
13814
  * Generate JSON fixture files for test data.
13804
13815
  */
13805
13816
  function generateFixtures$1(spec) {
13806
- if (spec.models.length === 0) return [];
13817
+ if (spec.models.length === 0) return {
13818
+ files: [],
13819
+ pathRewrites: /* @__PURE__ */ new Map()
13820
+ };
13807
13821
  const modelMap = new Map(spec.models.map((m) => [m.name, m]));
13808
13822
  const enumMap = new Map(spec.enums.map((e) => [e.name, e]));
13809
13823
  const files = [];
@@ -13847,7 +13861,10 @@ function generateFixtures$1(spec) {
13847
13861
  const canonical = sorted[0];
13848
13862
  for (let i = 1; i < sorted.length; i++) pathRewrites.set(sorted[i], canonical);
13849
13863
  }
13850
- return files.filter((f) => !pathRewrites.has(f.path));
13864
+ return {
13865
+ files: files.filter((f) => !pathRewrites.has(f.path)),
13866
+ pathRewrites
13867
+ };
13851
13868
  }
13852
13869
  function unwrapListModel$1(model, modelMap) {
13853
13870
  const dataField = model.fields.find((f) => f.name === "data");
@@ -13972,7 +13989,7 @@ function generateTests$3(spec, ctx) {
13972
13989
  content: helperLines.join("\n"),
13973
13990
  overwriteExisting: true
13974
13991
  });
13975
- const fixtures = generateFixtures$1(spec);
13992
+ const { files: fixtures, pathRewrites: fixtureRewrites } = generateFixtures$1(spec);
13976
13993
  for (const fixture of fixtures) files.push({
13977
13994
  path: fixture.path,
13978
13995
  content: fixture.content,
@@ -13992,12 +14009,12 @@ function generateTests$3(spec, ctx) {
13992
14009
  const testFile = generateServiceTest$1({
13993
14010
  name: mountName,
13994
14011
  operations
13995
- }, spec, ctx, accessPaths);
14012
+ }, spec, ctx, accessPaths, fixtureRewrites);
13996
14013
  if (testFile) files.push(testFile);
13997
14014
  }
13998
14015
  return files;
13999
14016
  }
14000
- function generateServiceTest$1(service, spec, ctx, _accessPaths) {
14017
+ function generateServiceTest$1(service, spec, ctx, _accessPaths, fixtureRewrites) {
14001
14018
  if (service.operations.length === 0) return null;
14002
14019
  const resolvedName = resolveResourceClassName$1(service, ctx);
14003
14020
  const accessorName = resolvedName;
@@ -14075,6 +14092,7 @@ function generateServiceTest$1(service, spec, ctx, _accessPaths) {
14075
14092
  }
14076
14093
  }
14077
14094
  fixturePath = `testdata/list_${fileName$1(resolved.name)}.json`;
14095
+ if (fixtureRewrites.has(fixturePath)) fixturePath = fixtureRewrites.get(fixturePath);
14078
14096
  }
14079
14097
  }
14080
14098
  const expectedPath = buildExpectedPath$1(op);
@@ -14146,7 +14164,8 @@ function generateServiceTest$1(service, spec, ctx, _accessPaths) {
14146
14164
  } else if (plan.responseModelName) {
14147
14165
  const respModel = plan.responseModelName;
14148
14166
  const isArrayResponse = !isPaginated && op.response?.kind === "array";
14149
- const fixturePath = `testdata/${fileName$1(respModel)}.json`;
14167
+ let fixturePath = `testdata/${fileName$1(respModel)}.json`;
14168
+ if (fixtureRewrites.has(fixturePath)) fixturePath = fixtureRewrites.get(fixturePath);
14150
14169
  const expectedPath = buildExpectedPath$1(op);
14151
14170
  const httpMethodUpper = op.httpMethod.toUpperCase();
14152
14171
  const isBodyMethod = httpMethodUpper === "POST" || httpMethodUpper === "PUT" || httpMethodUpper === "PATCH";
@@ -14227,7 +14246,8 @@ function generateServiceTest$1(service, spec, ctx, _accessPaths) {
14227
14246
  const wrapperParamsStruct = paramsStructName(resolvedName, wrapperMethod);
14228
14247
  const responseType = wrapper.responseModelName;
14229
14248
  const testName = `Test${accessorName}_${wrapperMethod}`;
14230
- const fixturePath = responseType ? `testdata/${fileName$1(responseType)}.json` : null;
14249
+ let fixturePath = responseType ? `testdata/${fileName$1(responseType)}.json` : null;
14250
+ if (fixturePath && fixtureRewrites.has(fixturePath)) fixturePath = fixtureRewrites.get(fixturePath);
14231
14251
  const wrapperCallArgs = ["context.Background()"];
14232
14252
  for (const p of sortPathParamsByTemplateOrder$2(op)) wrapperCallArgs.push(`"test_${p.name}"`);
14233
14253
  wrapperCallArgs.push(`&${ctx.namespace}.${wrapperParamsStruct}{}`);
@@ -14971,7 +14991,8 @@ function generateModels$2(models, ctx, discCtx) {
14971
14991
  const human = humanize$1(model.name);
14972
14992
  lines.push(` /// <summary>Represents ${articleFor(human)} ${human}.</summary>`);
14973
14993
  }
14974
- if (discCtx?.discriminatorBases.has(model.name) ?? false) lines.push(` [Newtonsoft.Json.JsonConverter(typeof(${csClassName}DiscriminatorConverter))]`);
14994
+ const isDiscBase = discCtx?.discriminatorBases.has(model.name) ?? false;
14995
+ if (isDiscBase) lines.push(` [Newtonsoft.Json.JsonConverter(typeof(${csClassName}DiscriminatorConverter))]`);
14975
14996
  const baseName = discCtx?.variantToBase.get(model.name);
14976
14997
  const baseClassName = baseName ? modelClassName(baseName) : null;
14977
14998
  const baseFields = baseName ? baseFieldLookup.get(baseName) : void 0;
@@ -14999,10 +15020,16 @@ function generateModels$2(models, ctx, discCtx) {
14999
15020
  let csType;
15000
15021
  let initializer = "";
15001
15022
  let setterModifier = "";
15023
+ const discProp = isDiscBase ? discCtx?.discriminatorProperties?.get(model.name) : void 0;
15024
+ const isDiscriminatorField = discProp !== void 0 && field.name === discProp;
15002
15025
  if (constInit !== null && !isOptional) {
15003
15026
  csType = baseType;
15004
15027
  initializer = ` = ${constInit};`;
15005
15028
  setterModifier = "internal ";
15029
+ } else if (isDiscriminatorField) {
15030
+ csType = baseType;
15031
+ if (!isAlreadyNullable && !isValueTypeRef(field.type)) initializer = " = default!;";
15032
+ setterModifier = "internal ";
15006
15033
  } else if (isOptional) if (isAlreadyNullable) csType = baseType;
15007
15034
  else if (isValueTypeRef(field.type)) csType = `${baseType}?`;
15008
15035
  else csType = `${baseType}?`;
@@ -15035,6 +15062,14 @@ function generateModels$2(models, ctx, discCtx) {
15035
15062
  lines.push(` /// <paramref name="key"/> coerced to <typeparamref name="T"/>, or the default`);
15036
15063
  lines.push(` /// value when the key is missing or the value is not convertible.`);
15037
15064
  lines.push(` /// </summary>`);
15065
+ if (isDiscBase) {
15066
+ lines.push(` /// <remarks>`);
15067
+ lines.push(` /// Variant subclasses provide strongly-typed <c>${dict.csName}</c> properties that`);
15068
+ lines.push(` /// shadow this dictionary. This accessor is intended for forward-compatible handling`);
15069
+ lines.push(` /// of types not yet known to this SDK version. For recognized types, cast to the`);
15070
+ lines.push(` /// specific subclass and access its typed <c>${dict.csName}</c> property directly.`);
15071
+ lines.push(` /// </remarks>`);
15072
+ }
15038
15073
  lines.push(` /// <typeparam name="T">Expected value type.</typeparam>`);
15039
15074
  lines.push(` /// <param name="key">The key to look up.</param>`);
15040
15075
  lines.push(` public T? Get${dict.csName}Attribute<T>(string key)`);
@@ -16857,7 +16892,7 @@ const dotnetEmitter = {
16857
16892
  const discriminatorBases = /* @__PURE__ */ new Set();
16858
16893
  const variantToBase = /* @__PURE__ */ new Map();
16859
16894
  const modelDiscriminators = /* @__PURE__ */ new Map();
16860
- const files = generateModels$2(enriched.map((m) => {
16895
+ const dotnetModels = enriched.map((m) => {
16861
16896
  const disc = m.discriminator;
16862
16897
  if (disc && m.fields.length === 0) {
16863
16898
  const original = originalByName.get(m.name);
@@ -16872,9 +16907,13 @@ const dotnetEmitter = {
16872
16907
  }
16873
16908
  }
16874
16909
  return m;
16875
- }), c, {
16910
+ });
16911
+ const discriminatorProperties = /* @__PURE__ */ new Map();
16912
+ for (const [baseName, disc] of modelDiscriminators) discriminatorProperties.set(baseName, disc.property);
16913
+ const files = generateModels$2(dotnetModels, c, {
16876
16914
  discriminatorBases,
16877
- variantToBase
16915
+ variantToBase,
16916
+ discriminatorProperties
16878
16917
  });
16879
16918
  if (discriminatedUnions$1.size > 0) for (const [baseName, disc] of discriminatedUnions$1) {
16880
16919
  const converterName = `${baseName}DiscriminatorConverter`;
@@ -16935,6 +16974,8 @@ const dotnetEmitter = {
16935
16974
  lines.push(` /// </summary>`);
16936
16975
  lines.push(` public class ${converterName} : Newtonsoft.Json.JsonConverter`);
16937
16976
  lines.push(" {");
16977
+ lines.push(" public override bool CanWrite => false;");
16978
+ lines.push("");
16938
16979
  lines.push(` public override bool CanConvert(Type objectType) => typeof(${baseClass}).IsAssignableFrom(objectType);`);
16939
16980
  lines.push("");
16940
16981
  lines.push(" public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
@@ -16958,7 +16999,7 @@ const dotnetEmitter = {
16958
16999
  lines.push("");
16959
17000
  lines.push(" public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object? value, Newtonsoft.Json.JsonSerializer serializer)");
16960
17001
  lines.push(" {");
16961
- lines.push(" serializer.Serialize(writer, value);");
17002
+ lines.push(" throw new NotImplementedException(\"Serialization is handled by the default serializer.\");");
16962
17003
  lines.push(" }");
16963
17004
  lines.push(" }");
16964
17005
  lines.push("}");
@@ -21589,4 +21630,4 @@ const workosEmittersPlugin = {
21589
21630
  //#endregion
21590
21631
  export { nodeEmitter as _, rustExtractor as a, pythonExtractor as c, rubyEmitter as d, kotlinEmitter as f, pythonEmitter as g, phpEmitter as h, kotlinExtractor as i, rubyExtractor as l, goEmitter as m, elixirExtractor as n, goExtractor as o, dotnetEmitter as p, dotnetExtractor as r, phpExtractor as s, workosEmittersPlugin as t, nodeExtractor as u };
21591
21632
 
21592
- //# sourceMappingURL=plugin-BV_wDWDO.mjs.map
21633
+ //# sourceMappingURL=plugin-Bk0xWTQC.mjs.map