@workos/oagen-emitters 0.6.6 → 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.6"
2
+ ".": "0.6.7"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## [0.6.6](https://github.com/workos/oagen-emitters/compare/v0.6.5...v0.6.6) (2026-04-28)
4
12
 
5
13
 
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-BgVrq-hM.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 };
@@ -12395,7 +12395,21 @@ function makeOptional$1(goType) {
12395
12395
  return `*${goType}`;
12396
12396
  }
12397
12397
  function structuralHash$2(model) {
12398
- 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;
12399
12413
  }
12400
12414
  /** Known acronyms to preserve as single tokens during humanization. */
12401
12415
  const HUMANIZE_ACRONYMS$1 = [
@@ -14150,7 +14164,8 @@ function generateServiceTest$1(service, spec, ctx, _accessPaths, fixtureRewrites
14150
14164
  } else if (plan.responseModelName) {
14151
14165
  const respModel = plan.responseModelName;
14152
14166
  const isArrayResponse = !isPaginated && op.response?.kind === "array";
14153
- const fixturePath = `testdata/${fileName$1(respModel)}.json`;
14167
+ let fixturePath = `testdata/${fileName$1(respModel)}.json`;
14168
+ if (fixtureRewrites.has(fixturePath)) fixturePath = fixtureRewrites.get(fixturePath);
14154
14169
  const expectedPath = buildExpectedPath$1(op);
14155
14170
  const httpMethodUpper = op.httpMethod.toUpperCase();
14156
14171
  const isBodyMethod = httpMethodUpper === "POST" || httpMethodUpper === "PUT" || httpMethodUpper === "PATCH";
@@ -14231,7 +14246,8 @@ function generateServiceTest$1(service, spec, ctx, _accessPaths, fixtureRewrites
14231
14246
  const wrapperParamsStruct = paramsStructName(resolvedName, wrapperMethod);
14232
14247
  const responseType = wrapper.responseModelName;
14233
14248
  const testName = `Test${accessorName}_${wrapperMethod}`;
14234
- 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);
14235
14251
  const wrapperCallArgs = ["context.Background()"];
14236
14252
  for (const p of sortPathParamsByTemplateOrder$2(op)) wrapperCallArgs.push(`"test_${p.name}"`);
14237
14253
  wrapperCallArgs.push(`&${ctx.namespace}.${wrapperParamsStruct}{}`);
@@ -14975,7 +14991,8 @@ function generateModels$2(models, ctx, discCtx) {
14975
14991
  const human = humanize$1(model.name);
14976
14992
  lines.push(` /// <summary>Represents ${articleFor(human)} ${human}.</summary>`);
14977
14993
  }
14978
- 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))]`);
14979
14996
  const baseName = discCtx?.variantToBase.get(model.name);
14980
14997
  const baseClassName = baseName ? modelClassName(baseName) : null;
14981
14998
  const baseFields = baseName ? baseFieldLookup.get(baseName) : void 0;
@@ -15003,10 +15020,16 @@ function generateModels$2(models, ctx, discCtx) {
15003
15020
  let csType;
15004
15021
  let initializer = "";
15005
15022
  let setterModifier = "";
15023
+ const discProp = isDiscBase ? discCtx?.discriminatorProperties?.get(model.name) : void 0;
15024
+ const isDiscriminatorField = discProp !== void 0 && field.name === discProp;
15006
15025
  if (constInit !== null && !isOptional) {
15007
15026
  csType = baseType;
15008
15027
  initializer = ` = ${constInit};`;
15009
15028
  setterModifier = "internal ";
15029
+ } else if (isDiscriminatorField) {
15030
+ csType = baseType;
15031
+ if (!isAlreadyNullable && !isValueTypeRef(field.type)) initializer = " = default!;";
15032
+ setterModifier = "internal ";
15010
15033
  } else if (isOptional) if (isAlreadyNullable) csType = baseType;
15011
15034
  else if (isValueTypeRef(field.type)) csType = `${baseType}?`;
15012
15035
  else csType = `${baseType}?`;
@@ -15039,6 +15062,14 @@ function generateModels$2(models, ctx, discCtx) {
15039
15062
  lines.push(` /// <paramref name="key"/> coerced to <typeparamref name="T"/>, or the default`);
15040
15063
  lines.push(` /// value when the key is missing or the value is not convertible.`);
15041
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
+ }
15042
15073
  lines.push(` /// <typeparam name="T">Expected value type.</typeparam>`);
15043
15074
  lines.push(` /// <param name="key">The key to look up.</param>`);
15044
15075
  lines.push(` public T? Get${dict.csName}Attribute<T>(string key)`);
@@ -16861,7 +16892,7 @@ const dotnetEmitter = {
16861
16892
  const discriminatorBases = /* @__PURE__ */ new Set();
16862
16893
  const variantToBase = /* @__PURE__ */ new Map();
16863
16894
  const modelDiscriminators = /* @__PURE__ */ new Map();
16864
- const files = generateModels$2(enriched.map((m) => {
16895
+ const dotnetModels = enriched.map((m) => {
16865
16896
  const disc = m.discriminator;
16866
16897
  if (disc && m.fields.length === 0) {
16867
16898
  const original = originalByName.get(m.name);
@@ -16876,9 +16907,13 @@ const dotnetEmitter = {
16876
16907
  }
16877
16908
  }
16878
16909
  return m;
16879
- }), 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, {
16880
16914
  discriminatorBases,
16881
- variantToBase
16915
+ variantToBase,
16916
+ discriminatorProperties
16882
16917
  });
16883
16918
  if (discriminatedUnions$1.size > 0) for (const [baseName, disc] of discriminatedUnions$1) {
16884
16919
  const converterName = `${baseName}DiscriminatorConverter`;
@@ -16939,6 +16974,8 @@ const dotnetEmitter = {
16939
16974
  lines.push(` /// </summary>`);
16940
16975
  lines.push(` public class ${converterName} : Newtonsoft.Json.JsonConverter`);
16941
16976
  lines.push(" {");
16977
+ lines.push(" public override bool CanWrite => false;");
16978
+ lines.push("");
16942
16979
  lines.push(` public override bool CanConvert(Type objectType) => typeof(${baseClass}).IsAssignableFrom(objectType);`);
16943
16980
  lines.push("");
16944
16981
  lines.push(" public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
@@ -16960,8 +16997,6 @@ const dotnetEmitter = {
16960
16997
  lines.push(" return target;");
16961
16998
  lines.push(" }");
16962
16999
  lines.push("");
16963
- lines.push(" public override bool CanWrite => false;");
16964
- lines.push("");
16965
17000
  lines.push(" public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object? value, Newtonsoft.Json.JsonSerializer serializer)");
16966
17001
  lines.push(" {");
16967
17002
  lines.push(" throw new NotImplementedException(\"Serialization is handled by the default serializer.\");");
@@ -21595,4 +21630,4 @@ const workosEmittersPlugin = {
21595
21630
  //#endregion
21596
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 };
21597
21632
 
21598
- //# sourceMappingURL=plugin-BgVrq-hM.mjs.map
21633
+ //# sourceMappingURL=plugin-Bk0xWTQC.mjs.map