@workos/oagen-emitters 0.15.1 → 0.16.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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +48 -1
- package/dist/index.d.mts +51 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +852 -2
- package/dist/index.mjs.map +1 -0
- package/dist/{plugin-C2Hp2Vs2.mjs → plugin-DuB1UozS.mjs} +62 -7
- package/dist/plugin-DuB1UozS.mjs.map +1 -0
- package/dist/plugin.mjs +1 -1
- package/package.json +4 -4
- package/src/dotnet/naming.ts +1 -1
- package/src/go/naming.ts +1 -1
- package/src/index.ts +15 -0
- package/src/node/resources.ts +7 -3
- package/src/node/tests.ts +29 -3
- package/src/snippets/dotnet.ts +159 -0
- package/src/snippets/go.ts +148 -0
- package/src/snippets/index.ts +8 -0
- package/src/snippets/kotlin.ts +144 -0
- package/src/snippets/php.ts +149 -0
- package/src/snippets/plugin.ts +36 -0
- package/src/snippets/python.ts +135 -0
- package/src/snippets/ruby.ts +152 -0
- package/src/snippets/rust.ts +189 -0
- package/test/snippets/_helpers.ts +67 -0
- package/test/snippets/dotnet.test.ts +49 -0
- package/test/snippets/go.test.ts +94 -0
- package/test/snippets/kotlin.test.ts +53 -0
- package/test/snippets/php.test.ts +48 -0
- package/test/snippets/python.test.ts +73 -0
- package/test/snippets/ruby.test.ts +339 -0
- package/test/snippets/rust.test.ts +76 -0
- package/dist/plugin-C2Hp2Vs2.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.16.0](https://github.com/workos/oagen-emitters/compare/v0.15.2...v0.16.0) (2026-06-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **snippets:** add snippet emitter family for seven languages ([#137](https://github.com/workos/oagen-emitters/issues/137)) ([1b4ee64](https://github.com/workos/oagen-emitters/commit/1b4ee640d47e8353726005b3fc953ffa0d160973))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **node:** improve test generation for owned services with hand-owned types ([#136](https://github.com/workos/oagen-emitters/issues/136)) ([3307621](https://github.com/workos/oagen-emitters/commit/3307621fbdfc3e719893a7691997fcbfc4a107d4))
|
|
14
|
+
|
|
15
|
+
## [0.15.2](https://github.com/workos/oagen-emitters/compare/v0.15.1...v0.15.2) (2026-06-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **node:** align AutoPaginatable type param with serialized runtime shape ([#134](https://github.com/workos/oagen-emitters/issues/134)) ([43ddd64](https://github.com/workos/oagen-emitters/commit/43ddd64d5d56b4ff2e7ae19bfa1ee895d24cb60d))
|
|
21
|
+
|
|
3
22
|
## [0.15.1](https://github.com/workos/oagen-emitters/compare/v0.15.0...v0.15.1) (2026-06-01)
|
|
4
23
|
|
|
5
24
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# oagen-emitters
|
|
2
2
|
|
|
3
|
-
Language emitters, extractors,
|
|
3
|
+
Language emitters, extractors, smoke runners, and documentation snippet emitters for [oagen](../oagen). This package is a **plugin library** -- it provides SDK generation and call-site snippet rendering capabilities but does not own the consumer config. The canonical generation policy lives in the spec-consuming project (e.g. https://github.com/workos/openapi-spec/blob/main/src/policy.ts).
|
|
4
4
|
|
|
5
5
|
## Plugin export
|
|
6
6
|
|
|
@@ -21,6 +21,53 @@ const config: OagenConfig = {
|
|
|
21
21
|
|
|
22
22
|
The plugin bundle registers all emitters, extractors, and smoke runners provided by this package.
|
|
23
23
|
|
|
24
|
+
## Snippet emitters
|
|
25
|
+
|
|
26
|
+
Snippet emitters render one short, runnable call-site sample per resolved SDK operation. They are intentionally a separate runtime from the full SDK emitters: snippet emitters do not generate models, clients, or tests, and they are not invoked by `oagen generate`. Consumers import them directly and write the results wherever they need.
|
|
27
|
+
|
|
28
|
+
The framework plumbing lives upstream in `@workos/oagen`:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
parseSpec,
|
|
33
|
+
resolveOperations,
|
|
34
|
+
runSnippetEmitters,
|
|
35
|
+
snippetResultsToFiles,
|
|
36
|
+
} from "@workos/oagen";
|
|
37
|
+
import {
|
|
38
|
+
operationHints,
|
|
39
|
+
mountRules,
|
|
40
|
+
modelHints,
|
|
41
|
+
schemaNameTransform,
|
|
42
|
+
transformSpec,
|
|
43
|
+
nestjsOperationIdTransform,
|
|
44
|
+
} from "@workos/openapi-spec/policy";
|
|
45
|
+
import { workosSnippetsPlugin } from "@workos/oagen-emitters";
|
|
46
|
+
|
|
47
|
+
const spec = await parseSpec("spec/open-api-spec.yaml", {
|
|
48
|
+
operationIdTransform: nestjsOperationIdTransform,
|
|
49
|
+
schemaNameTransform,
|
|
50
|
+
transformSpec,
|
|
51
|
+
});
|
|
52
|
+
const ctx = {
|
|
53
|
+
namespace: "workos",
|
|
54
|
+
namespacePascal: "WorkOS",
|
|
55
|
+
spec,
|
|
56
|
+
modelHints,
|
|
57
|
+
resolvedOperations: resolveOperations(spec, operationHints, mountRules),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const results = runSnippetEmitters(workosSnippetsPlugin.snippets, ctx);
|
|
61
|
+
// results[i] = { language, fileExtension, operationId, mountTarget, methodName, content }
|
|
62
|
+
|
|
63
|
+
// Optional: write `<outputDir>/<language>/<methodName>-request.<ext>` files.
|
|
64
|
+
const files = snippetResultsToFiles(results, "snippets");
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Each snippet emitter reuses its sibling SDK emitter's naming helpers (`src/<lang>/naming.ts`), so generated samples stay in lockstep with the SDK they document. Method names, mount-target casing, parameter names, and reserved-word handling all match what the real SDK exposes.
|
|
68
|
+
|
|
69
|
+
When adding a snippet emitter for a new language, mirror an existing one (`src/snippets/python.ts` is the smallest reference) and add focused tests in `test/snippets/<lang>.test.ts` using the shared scaffolding in `test/snippets/_helpers.ts`.
|
|
70
|
+
|
|
24
71
|
## Development
|
|
25
72
|
|
|
26
73
|
```bash
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { workosEmittersPlugin } from "./plugin.mjs";
|
|
2
|
-
import { Emitter } from "@workos/oagen";
|
|
2
|
+
import { Emitter, SnippetEmitter } from "@workos/oagen";
|
|
3
3
|
import { dotnetExtractor, elixirExtractor, goExtractor, kotlinExtractor, nodeExtractor, phpExtractor, pythonExtractor, rubyExtractor, rustExtractor } from "@workos/oagen/compat";
|
|
4
4
|
|
|
5
5
|
//#region src/node/index.d.ts
|
|
@@ -26,5 +26,54 @@ declare const rubyEmitter: Emitter;
|
|
|
26
26
|
//#region src/rust/index.d.ts
|
|
27
27
|
declare const rustEmitter: Emitter;
|
|
28
28
|
//#endregion
|
|
29
|
-
|
|
29
|
+
//#region src/snippets/ruby.d.ts
|
|
30
|
+
declare const rubySnippetEmitter: SnippetEmitter;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/snippets/python.d.ts
|
|
33
|
+
declare const pythonSnippetEmitter: SnippetEmitter;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/snippets/php.d.ts
|
|
36
|
+
declare const phpSnippetEmitter: SnippetEmitter;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/snippets/go.d.ts
|
|
39
|
+
declare const goSnippetEmitter: SnippetEmitter;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/snippets/dotnet.d.ts
|
|
42
|
+
declare const dotnetSnippetEmitter: SnippetEmitter;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/snippets/kotlin.d.ts
|
|
45
|
+
/**
|
|
46
|
+
* Emits Java-syntax snippets (rendered as `.java`) backed by the Kotlin SDK's
|
|
47
|
+
* naming so JVM callers see the same method and options names whether they
|
|
48
|
+
* write Kotlin or Java. The WorkOS docs render the `.java` extension because
|
|
49
|
+
* Java is the most common JVM consumer; Kotlin call sites would look almost
|
|
50
|
+
* identical apart from `var`/`val` and named-argument syntax.
|
|
51
|
+
*/
|
|
52
|
+
declare const kotlinSnippetEmitter: SnippetEmitter;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/snippets/rust.d.ts
|
|
55
|
+
declare const rustSnippetEmitter: SnippetEmitter;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/snippets/plugin.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* Bundle of snippet emitters for every WorkOS SDK language we currently
|
|
60
|
+
* generate call-site samples for. Node is intentionally absent — the docs
|
|
61
|
+
* pipeline still owns hand-authored TypeScript samples there.
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { runSnippetEmitters, workosSnippetsPlugin } from '@workos/oagen-emitters';
|
|
65
|
+
*
|
|
66
|
+
* const snippets = runSnippetEmitters(workosSnippetsPlugin.snippets, ctx);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Each entry mirrors a published WorkOS SDK and reuses that emitter's naming
|
|
70
|
+
* helpers (`src/<lang>/naming.ts`), so generated samples stay in lockstep
|
|
71
|
+
* with the SDK they document — method names, mount-target casing, parameter
|
|
72
|
+
* names, and reserved-word handling all match what the real SDK exposes.
|
|
73
|
+
*/
|
|
74
|
+
declare const workosSnippetsPlugin: {
|
|
75
|
+
snippets: SnippetEmitter[];
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { dotnetEmitter, dotnetExtractor, dotnetSnippetEmitter, elixirExtractor, goEmitter, goExtractor, goSnippetEmitter, kotlinEmitter, kotlinExtractor, kotlinSnippetEmitter, nodeEmitter, nodeExtractor, phpEmitter, phpExtractor, phpSnippetEmitter, pythonEmitter, pythonExtractor, pythonSnippetEmitter, rubyEmitter, rubyExtractor, rubySnippetEmitter, rustEmitter, rustExtractor, rustSnippetEmitter, workosEmittersPlugin, workosSnippetsPlugin };
|
|
30
79
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -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"],"mappings":";;;;;cAkhBa,WAAA,EAAa,OA8GzB;;;cCzlBY,aAAA,EAAe,OA+D3B;;;cC5CY,UAAA,EAAY,OA4DxB;;;cCzFY,SAAA,EAAW,OAyEvB;;;cCnCY,aAAA,EAAe,OAiR3B;;;cCrTY,aAAA,EAAe,OA6E3B;;;cCxDY,WAAA,EAAa,OAmEzB;;;cC5DY,WAAA,EAAa,OA2DzB"}
|
|
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":";;;;;cAkhBa,WAAA,EAAa,OA8GzB;;;cCzlBY,aAAA,EAAe,OA+D3B;;;cC5CY,UAAA,EAAY,OA4DxB;;;cCzFY,SAAA,EAAW,OAyEvB;;;cCnCY,aAAA,EAAe,OAiR3B;;;cCrTY,aAAA,EAAe,OA6E3B;;;cCxDY,WAAA,EAAa,OAmEzB;;;cC5DY,WAAA,EAAa,OA2DzB;;;cChHY,kBAAA,EAAoB,cAkBhC;;;cClBY,oBAAA,EAAsB,cAkBlC;;;cClBY,iBAAA,EAAmB,cAyB/B;;;cCzBY,gBAAA,EAAkB,cAmB9B;;;cCbY,oBAAA,EAAsB,cAkBlC;;;;;;;AZofD;;;cargBa,oBAAA,EAAsB,cAclC;;;cCrBY,kBAAA,EAAoB,cAahC;;;;;;;Ad+fD;;;;AA8GC;;;;ACzlBD;;;;ccda,oBAAA;EAAwB,QAAA,EAAU,cAAc;AAAA"}
|