@workos/oagen-emitters 0.6.8 → 0.7.1
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 +14 -0
- package/README.md +1 -0
- package/dist/index.mjs +1 -1
- package/dist/{plugin-Cmg_LFtm.mjs → plugin-h8Onp2Ma.mjs} +12 -12
- package/dist/plugin-h8Onp2Ma.mjs.map +1 -0
- package/dist/plugin.mjs +1 -1
- package/package.json +2 -2
- package/src/node/tests.ts +1 -1
- package/src/node/utils.ts +1 -1
- package/src/python/client.ts +6 -1
- package/src/python/models.ts +1 -1
- package/src/python/resources.ts +1 -1
- package/src/python/tests.ts +2 -2
- package/src/ruby/client.ts +1 -1
- package/src/ruby/models.ts +1 -1
- package/test/python/client.test.ts +4 -2
- package/dist/plugin-Cmg_LFtm.mjs.map +0 -1
package/dist/plugin.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as workosEmittersPlugin } from "./plugin-
|
|
1
|
+
import { t as workosEmittersPlugin } from "./plugin-h8Onp2Ma.mjs";
|
|
2
2
|
export { workosEmittersPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workos/oagen-emitters",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "WorkOS' oagen emitters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "WorkOS",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"node": ">=24.10.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@workos/oagen": "^0.
|
|
57
|
+
"@workos/oagen": "^0.12.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/node/tests.ts
CHANGED
|
@@ -854,7 +854,7 @@ function modelNeedsRoundTripTest(model: Model): boolean {
|
|
|
854
854
|
*/
|
|
855
855
|
function generateSerializerTests(spec: ApiSpec, ctx: EmitterContext): GeneratedFile[] {
|
|
856
856
|
const files: GeneratedFile[] = [];
|
|
857
|
-
const modelToService = assignModelsToServices(spec.models, spec.services);
|
|
857
|
+
const modelToService = assignModelsToServices(spec.models, spec.services, ctx.modelHints);
|
|
858
858
|
const serviceNameMap = new Map<string, string>();
|
|
859
859
|
for (const service of spec.services) {
|
|
860
860
|
serviceNameMap.set(service.name, resolveResourceClassName(service, ctx));
|
package/src/node/utils.ts
CHANGED
|
@@ -223,7 +223,7 @@ export function createServiceDirResolver(
|
|
|
223
223
|
serviceNameMap: Map<string, string>;
|
|
224
224
|
resolveDir: (irService: string | undefined) => string;
|
|
225
225
|
} {
|
|
226
|
-
const modelToService = assignModelsToServices(models, services);
|
|
226
|
+
const modelToService = assignModelsToServices(models, services, ctx.modelHints);
|
|
227
227
|
const serviceNameMap = buildServiceNameMap(services, ctx);
|
|
228
228
|
const resolveDir = (irService: string | undefined) =>
|
|
229
229
|
irService ? resolveServiceDir(serviceNameMap.get(irService) ?? irService) : 'common';
|
package/src/python/client.ts
CHANGED
|
@@ -270,8 +270,13 @@ function generateServiceInits(spec: ApiSpec, ctx: EmitterContext): GeneratedFile
|
|
|
270
270
|
const ops = mountGroups.get(mountTarget)?.operations ?? service.operations;
|
|
271
271
|
const groupClassNames = collectParameterGroupClassNames(ops);
|
|
272
272
|
|
|
273
|
+
// Use `X as X` re-export form (PEP 484) so pyright recognizes these as
|
|
274
|
+
// public re-exports. Otherwise consumers importing
|
|
275
|
+
// `from workos.user_management import RoleSingle` get a private-import
|
|
276
|
+
// warning under strict mode. Models barrel uses the same convention.
|
|
273
277
|
const resourceImports = [resolvedName, `Async${resolvedName}`, ...groupClassNames];
|
|
274
|
-
|
|
278
|
+
const aliasedImports = resourceImports.map((n) => `${n} as ${n}`);
|
|
279
|
+
lines.push(`from ._resource import ${aliasedImports.join(', ')}`);
|
|
275
280
|
lines.push('from .models import *');
|
|
276
281
|
|
|
277
282
|
files.push({
|
package/src/python/models.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { assignEnumsToServices, collectGeneratedEnumSymbolsByDir } from './enums
|
|
|
11
11
|
export function generateModels(models: Model[], ctx: EmitterContext): GeneratedFile[] {
|
|
12
12
|
if (models.length === 0) return [];
|
|
13
13
|
|
|
14
|
-
const modelToService = assignModelsToServices(models, ctx.spec.services);
|
|
14
|
+
const modelToService = assignModelsToServices(models, ctx.spec.services, ctx.modelHints);
|
|
15
15
|
const enumToService = assignEnumsToServices(ctx.spec.enums, ctx.spec.services);
|
|
16
16
|
const mountDirMap = buildMountDirMap(ctx);
|
|
17
17
|
const resolveDir = (irService: string | undefined) =>
|
package/src/python/resources.ts
CHANGED
|
@@ -1116,7 +1116,7 @@ export function generateResources(services: Service[], ctx: EmitterContext): Gen
|
|
|
1116
1116
|
const actualModelImports = [...modelImports];
|
|
1117
1117
|
|
|
1118
1118
|
// Split imports into same-service and cross-service (using mount-based dirs)
|
|
1119
|
-
const modelToServiceMap = assignModelsToServices(ctx.spec.models, ctx.spec.services);
|
|
1119
|
+
const modelToServiceMap = assignModelsToServices(ctx.spec.models, ctx.spec.services, ctx.modelHints);
|
|
1120
1120
|
// Discriminator variant type aliases (e.g. EventSchemaVariant) live in the same
|
|
1121
1121
|
// service as their dispatcher model, so ensure they resolve to the same directory.
|
|
1122
1122
|
for (const model of ctx.spec.models) {
|
package/src/python/tests.ts
CHANGED
|
@@ -227,7 +227,7 @@ function generateServiceTest(
|
|
|
227
227
|
});
|
|
228
228
|
|
|
229
229
|
// Group imports by their actual service directory (models may live in different services)
|
|
230
|
-
const modelToServiceMap = assignModelsToServices(spec.models, spec.services);
|
|
230
|
+
const modelToServiceMap = assignModelsToServices(spec.models, spec.services, ctx.modelHints);
|
|
231
231
|
const mountDirMap = buildMountDirMap(ctx);
|
|
232
232
|
const resolveModelDir = (modelName: string) => {
|
|
233
233
|
const svc = modelToServiceMap.get(modelName);
|
|
@@ -1402,7 +1402,7 @@ function generateModelRoundTripTests(spec: ApiSpec, ctx: EmitterContext): Genera
|
|
|
1402
1402
|
);
|
|
1403
1403
|
if (models.length === 0) return null;
|
|
1404
1404
|
|
|
1405
|
-
const modelToService = assignModelsToServices(spec.models, spec.services);
|
|
1405
|
+
const modelToService = assignModelsToServices(spec.models, spec.services, ctx.modelHints);
|
|
1406
1406
|
const roundTripDirMap = buildMountDirMap(ctx);
|
|
1407
1407
|
const resolveDir = (irService: string | undefined) =>
|
|
1408
1408
|
irService ? (roundTripDirMap.get(irService) ?? 'common') : 'common';
|
package/src/ruby/client.ts
CHANGED
|
@@ -182,7 +182,7 @@ function generateMainEntryFile(spec: ApiSpec, ctx: EmitterContext): GeneratedFil
|
|
|
182
182
|
* keep the generated namespace flat while the filesystem is grouped.
|
|
183
183
|
*/
|
|
184
184
|
function collectModelSubdirs(spec: ApiSpec, ctx: EmitterContext): string[] {
|
|
185
|
-
const modelToService = assignModelsToServices(spec.models as Model[], spec.services);
|
|
185
|
+
const modelToService = assignModelsToServices(spec.models as Model[], spec.services, ctx.modelHints);
|
|
186
186
|
const mountDirMap = buildMountDirMap(ctx);
|
|
187
187
|
const subdirs = new Set<string>();
|
|
188
188
|
for (const model of spec.models as Model[]) {
|
package/src/ruby/models.ts
CHANGED
|
@@ -67,7 +67,7 @@ export function generateModels(models: Model[], ctx: EmitterContext): GeneratedF
|
|
|
67
67
|
// Model → mount target directory. Each model is assigned to the first service
|
|
68
68
|
// that references it (transitively). Orphans land in `shared/`. Zeitwerk is
|
|
69
69
|
// told to collapse each subfolder (in client.ts) so the namespace stays flat.
|
|
70
|
-
const modelToService = assignModelsToServices(models, ctx.spec.services);
|
|
70
|
+
const modelToService = assignModelsToServices(models, ctx.spec.services, ctx.modelHints);
|
|
71
71
|
const mountDirMap = buildMountDirMap(ctx);
|
|
72
72
|
const dirFor = (modelName: string): string => {
|
|
73
73
|
const service = modelToService.get(modelName);
|
|
@@ -103,7 +103,9 @@ describe('generateClient', () => {
|
|
|
103
103
|
|
|
104
104
|
const serviceInit = files.find((f) => f.path === 'src/workos/organizations/__init__.py');
|
|
105
105
|
expect(serviceInit).toBeDefined();
|
|
106
|
-
expect(serviceInit!.content).toContain(
|
|
106
|
+
expect(serviceInit!.content).toContain(
|
|
107
|
+
'from ._resource import Organizations as Organizations, AsyncOrganizations as AsyncOrganizations',
|
|
108
|
+
);
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
it('generates flat directory structure for services (no nested namespaces)', () => {
|
|
@@ -193,7 +195,7 @@ describe('generateClient', () => {
|
|
|
193
195
|
expect(serviceInit!.content).toContain('RoleSingle');
|
|
194
196
|
expect(serviceInit!.content).toContain('RoleMultiple');
|
|
195
197
|
expect(serviceInit!.content).toContain(
|
|
196
|
-
'from ._resource import UserManagement, AsyncUserManagement, RoleSingle, RoleMultiple',
|
|
198
|
+
'from ._resource import UserManagement as UserManagement, AsyncUserManagement as AsyncUserManagement, RoleSingle as RoleSingle, RoleMultiple as RoleMultiple',
|
|
197
199
|
);
|
|
198
200
|
});
|
|
199
201
|
|