@workos/oagen-emitters 0.18.1 → 0.18.3
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/index.mjs +1 -1
- package/dist/{plugin-CtU_wbid.mjs → plugin-1ckLMpgo.mjs} +36 -3
- package/dist/plugin-1ckLMpgo.mjs.map +1 -0
- package/dist/plugin.mjs +1 -1
- package/package.json +1 -1
- package/src/dotnet/fixtures.ts +12 -1
- package/src/node/enums.ts +23 -0
- package/src/node/resources.ts +47 -1
- package/test/node/enums.test.ts +138 -2
- package/test/node/resources.test.ts +130 -65
- package/dist/plugin-CtU_wbid.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.18.3](https://github.com/workos/oagen-emitters/compare/v0.18.2...v0.18.3) (2026-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **dotnet:** emit envelope fixture for list-wrappers returned by non-paginated ops ([#157](https://github.com/workos/oagen-emitters/issues/157)) ([76e89b5](https://github.com/workos/oagen-emitters/commit/76e89b58592cfab9af07bdfc34f93d8569c9d220))
|
|
9
|
+
* **node:** only adopt named request interface for pure object-literal params ([#156](https://github.com/workos/oagen-emitters/issues/156)) ([50116e3](https://github.com/workos/oagen-emitters/commit/50116e320a9faa67691b89f97dc732f8b66405c5))
|
|
10
|
+
|
|
11
|
+
## [0.18.2](https://github.com/workos/oagen-emitters/compare/v0.18.1...v0.18.2) (2026-06-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **node:** adopt spec request interface for owned inline-literal params; dedupe common enums ([#154](https://github.com/workos/oagen-emitters/issues/154)) ([71e2d4f](https://github.com/workos/oagen-emitters/commit/71e2d4f4e05441a41217286b92a555237c3fd794))
|
|
17
|
+
|
|
3
18
|
## [0.18.1](https://github.com/workos/oagen-emitters/compare/v0.18.0...v0.18.1) (2026-06-17)
|
|
4
19
|
|
|
5
20
|
|
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-
|
|
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-1ckLMpgo.mjs";
|
|
2
2
|
import { collectSnippetArgs, collectWrapperArgs, toSnakeCase } from "@workos/oagen";
|
|
3
3
|
//#region src/snippets/ruby.ts
|
|
4
4
|
const INDENT$6 = " ";
|
|
@@ -4673,6 +4673,16 @@ function assignEnumsToServices(enums, services, models = [], ctx) {
|
|
|
4673
4673
|
for (const name of collectFieldDependencies(model).enums) if (enumNames.has(name) && !enumToService.has(name)) enumToService.set(name, service);
|
|
4674
4674
|
}
|
|
4675
4675
|
}
|
|
4676
|
+
if (ctx) {
|
|
4677
|
+
const serviceNameMap = buildServiceNameMap(services, ctx);
|
|
4678
|
+
const toUnassign = [];
|
|
4679
|
+
for (const [name, service] of enumToService) {
|
|
4680
|
+
if (!isNodeOwnedService(ctx, service, serviceNameMap.get(service))) continue;
|
|
4681
|
+
const home = (ctx.apiSurface?.enums?.[name])?.sourceFile ?? (ctx.apiSurface?.typeAliases?.[name])?.sourceFile ?? liveSurfaceInterfacePath(name);
|
|
4682
|
+
if (home && home.startsWith("src/common/")) toUnassign.push(name);
|
|
4683
|
+
}
|
|
4684
|
+
for (const name of toUnassign) enumToService.delete(name);
|
|
4685
|
+
}
|
|
4676
4686
|
return enumToService;
|
|
4677
4687
|
}
|
|
4678
4688
|
//#endregion
|
|
@@ -5582,9 +5592,31 @@ function optionsObjectShouldBeOptional(op, plan, resolvedOp) {
|
|
|
5582
5592
|
function operationHasOptionsInput(op, plan, resolvedOp) {
|
|
5583
5593
|
return op.pathParams.length > 0 || plan.hasBody || plan.isPaginated || visibleQueryParamsForOptions(op, plan, resolvedOp).length > 0;
|
|
5584
5594
|
}
|
|
5595
|
+
function isClosedObjectLiteral(type) {
|
|
5596
|
+
const t = type.trim();
|
|
5597
|
+
if (!t.startsWith("{")) return false;
|
|
5598
|
+
let depth = 0;
|
|
5599
|
+
for (let i = 0; i < t.length; i++) {
|
|
5600
|
+
const ch = t[i];
|
|
5601
|
+
if (ch === "{") depth++;
|
|
5602
|
+
else if (ch === "}" && --depth === 0) return i === t.length - 1;
|
|
5603
|
+
}
|
|
5604
|
+
return false;
|
|
5605
|
+
}
|
|
5585
5606
|
function optionsObjectInfo(service, method, op, plan, ctx, baselineMethod, resolvedOp) {
|
|
5586
5607
|
const baseline = optionsObjectParam$1(baselineMethod);
|
|
5587
|
-
if (baseline)
|
|
5608
|
+
if (baseline) {
|
|
5609
|
+
if (isClosedObjectLiteral(baseline.type) && isNodeOwnedService(ctx, service.name, resolveResourceClassName$3(service, ctx))) {
|
|
5610
|
+
const body = extractRequestBodyType(op, ctx);
|
|
5611
|
+
if (body?.kind === "model") return {
|
|
5612
|
+
name: "options",
|
|
5613
|
+
type: resolveInterfaceName(body.name, ctx),
|
|
5614
|
+
optional: optionsObjectShouldBeOptional(op, plan, resolvedOp),
|
|
5615
|
+
generated: false
|
|
5616
|
+
};
|
|
5617
|
+
}
|
|
5618
|
+
return baseline;
|
|
5619
|
+
}
|
|
5588
5620
|
const overrideType = operationOverrideFor$1(ctx, op)?.optionsType;
|
|
5589
5621
|
if (overrideType) return {
|
|
5590
5622
|
name: "options",
|
|
@@ -21115,9 +21147,10 @@ function generateFixtures$1(spec) {
|
|
|
21115
21147
|
const modelMap = new Map(spec.models.map((m) => [m.name, m]));
|
|
21116
21148
|
const enumMap = new Map(spec.enums.map((e) => [e.name, e]));
|
|
21117
21149
|
const files = [];
|
|
21150
|
+
const nonPaginatedWrapperRefs = collectNonPaginatedResponseModelNames(spec.services);
|
|
21118
21151
|
for (const model of spec.models) {
|
|
21119
21152
|
if (isListMetadataModel(model)) continue;
|
|
21120
|
-
if (isListWrapperModel(model)) continue;
|
|
21153
|
+
if (isListWrapperModel(model) && !nonPaginatedWrapperRefs.has(model.name)) continue;
|
|
21121
21154
|
const fixture = model.fields.length === 0 ? {} : generateModelFixture$1(model, modelMap, enumMap);
|
|
21122
21155
|
files.push({
|
|
21123
21156
|
path: `testdata/${fixtureFileName(model.name)}.json`,
|
|
@@ -29897,4 +29930,4 @@ const workosEmittersPlugin = {
|
|
|
29897
29930
|
//#endregion
|
|
29898
29931
|
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 };
|
|
29899
29932
|
|
|
29900
|
-
//# sourceMappingURL=plugin-
|
|
29933
|
+
//# sourceMappingURL=plugin-1ckLMpgo.mjs.map
|