@workos/oagen 0.0.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/.claude-plugin/plugin.json +12 -0
- package/LICENSE.txt +21 -0
- package/README.md +197 -0
- package/dist/chunk-CIX5NOBF.js +263 -0
- package/dist/chunk-IJ5E5AE7.js +1040 -0
- package/dist/chunk-P5XUDUGY.js +1748 -0
- package/dist/cli/index.js +5603 -0
- package/dist/compat/index.d.ts +195 -0
- package/dist/compat/index.js +4453 -0
- package/dist/index.d.ts +300 -0
- package/dist/index.js +1733 -0
- package/dist/scripts/smoke/baseline.js +1751 -0
- package/dist/scripts/smoke/sdk-test.js +93 -0
- package/dist/smoke.js +1963 -0
- package/dist/types-B5t9O9Wm.d.ts +367 -0
- package/dist/verify/index.d.ts +76 -0
- package/dist/verify/index.js +336 -0
- package/docs/advanced/index.md +11 -0
- package/docs/advanced/oagen-ignore.md +144 -0
- package/docs/agents/architecture.md +53 -0
- package/docs/agents/emitters.md +69 -0
- package/docs/agents/testing.md +60 -0
- package/docs/architecture/dependency-layers.md +75 -0
- package/docs/architecture/emitter-contract.md +160 -0
- package/docs/architecture/extractor-contract.md +227 -0
- package/docs/architecture/ir-types.md +275 -0
- package/docs/architecture/non-additive-changes.md +76 -0
- package/docs/architecture/pipeline.md +110 -0
- package/docs/architecture/workflows.md +215 -0
- package/docs/cli.md +156 -0
- package/docs/contributor/index.md +10 -0
- package/docs/contributor/public-api.md +59 -0
- package/docs/contributor/versioning.md +48 -0
- package/docs/core/index.md +12 -0
- package/docs/core/minimal-emitter.md +134 -0
- package/docs/core/quickstart.md +142 -0
- package/docs/diagrams/generate-sdk-workflow.md +50 -0
- package/docs/index.md +40 -0
- package/examples/reference-emitter/README.md +41 -0
- package/examples/reference-emitter/oagen.config.ts +7 -0
- package/examples/reference-emitter/spec/github-subset.yml +400 -0
- package/examples/reference-emitter/src/emitter.ts +52 -0
- package/examples/reference-emitter/src/generators/client.ts +37 -0
- package/examples/reference-emitter/src/generators/config.ts +19 -0
- package/examples/reference-emitter/src/generators/enums.ts +16 -0
- package/examples/reference-emitter/src/generators/errors.ts +39 -0
- package/examples/reference-emitter/src/generators/models.ts +29 -0
- package/examples/reference-emitter/src/generators/resources.ts +60 -0
- package/examples/reference-emitter/src/generators/tests.ts +7 -0
- package/examples/reference-emitter/src/index.ts +1 -0
- package/examples/reference-emitter/src/naming.ts +21 -0
- package/examples/reference-emitter/src/type-mapper.ts +39 -0
- package/examples/reference-emitter/tsconfig.json +19 -0
- package/package.json +102 -0
- package/skills/generate-emitter/SKILL.md +393 -0
- package/skills/generate-emitter/references/common-pitfalls.md +23 -0
- package/skills/generate-emitter/references/generator-guide.md +201 -0
- package/skills/generate-emitter/references/project-scaffold.md +138 -0
- package/skills/generate-extractor/SKILL.md +200 -0
- package/skills/generate-sdk/SKILL.md +155 -0
- package/skills/generate-smoke-test/SKILL.md +185 -0
- package/skills/integrate/SKILL.md +108 -0
- package/skills/verify-compat/SKILL.md +151 -0
- package/skills/verify-smoke-test/SKILL.md +176 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { c as Extractor, a as ApiSurface, A as ApiSpec, r as LanguageHints, O as OverlayLookup, V as Violation, D as DiffResult } from '../types-B5t9O9Wm.js';
|
|
2
|
+
export { s as Addition, t as ApiClass, u as ApiEnum, v as ApiField, x as ApiInterface, y as ApiMethod, z as ApiParam, B as ApiProperty, C as ApiTypeAlias, G as MethodOverlay, I as ViolationCategory, J as ViolationSeverity } from '../types-B5t9O9Wm.js';
|
|
3
|
+
|
|
4
|
+
declare function registerExtractor(extractor: Extractor): void;
|
|
5
|
+
declare function getExtractor(language: string): Extractor;
|
|
6
|
+
|
|
7
|
+
interface ManifestEntry {
|
|
8
|
+
operationId: string;
|
|
9
|
+
sdkResourceProperty: string;
|
|
10
|
+
sdkMethodName: string;
|
|
11
|
+
httpMethod: string;
|
|
12
|
+
path: string;
|
|
13
|
+
pathParams: string[];
|
|
14
|
+
bodyFields: string[];
|
|
15
|
+
queryFields: string[];
|
|
16
|
+
}
|
|
17
|
+
declare function buildOverlayLookup(surface: ApiSurface, manifest?: ManifestEntry[], spec?: ApiSpec, hints?: LanguageHints, options?: {
|
|
18
|
+
strictModelMatch?: boolean;
|
|
19
|
+
}): OverlayLookup;
|
|
20
|
+
/**
|
|
21
|
+
* Patch overlay with violations from a failed verification.
|
|
22
|
+
* Adds explicit name mappings for symbols that were generated with wrong names.
|
|
23
|
+
* Returns a new OverlayLookup (immutable).
|
|
24
|
+
*/
|
|
25
|
+
declare function patchOverlay(overlay: OverlayLookup, violations: Violation[], baseline: ApiSurface): OverlayLookup;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Compute the set of symbol names that are derivable from the OpenAPI spec.
|
|
29
|
+
* Only these names should be compared during compat verification — everything
|
|
30
|
+
* else in the baseline is hand-written and out of scope for generation.
|
|
31
|
+
*/
|
|
32
|
+
declare function specDerivedNames(spec: ApiSpec, hints: LanguageHints): Set<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Compute a map of enum name → set of wire values that appear in the spec.
|
|
35
|
+
* Used by filterSurface to exclude hand-added enum members that aren't in the spec.
|
|
36
|
+
*/
|
|
37
|
+
declare function specDerivedEnumValues(spec: ApiSpec): Map<string, Set<string | number>>;
|
|
38
|
+
/**
|
|
39
|
+
* Compute the set of field paths (e.g., "Organization.name") that are defined
|
|
40
|
+
* in the OpenAPI spec's model schemas. Used by filterSurface to exclude
|
|
41
|
+
* hand-added SDK fields that reference spec-derived types.
|
|
42
|
+
*/
|
|
43
|
+
declare function specDerivedFieldPaths(spec: ApiSpec, hints: LanguageHints): Set<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Compute the set of method paths (e.g., "SSO.authorize") that are defined
|
|
46
|
+
* as operations in the OpenAPI spec's services. Used by filterSurface to
|
|
47
|
+
* exclude hand-written SDK methods that don't correspond to spec operations.
|
|
48
|
+
*/
|
|
49
|
+
declare function specDerivedMethodPaths(spec: ApiSpec): Set<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Compute the set of HTTP operation keys (e.g., "GET /sso/authorize") that
|
|
52
|
+
* exist in the spec. Used for overlay-based method matching.
|
|
53
|
+
*/
|
|
54
|
+
declare function specDerivedHttpKeys(spec: ApiSpec): Set<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Filter an ApiSurface to only include symbols whose names appear in the
|
|
57
|
+
* allowed set. Symbols not in the set are dropped entirely — they won't
|
|
58
|
+
* count toward the total or produce violations.
|
|
59
|
+
*
|
|
60
|
+
* For interfaces: when fieldPaths is provided, only keeps fields that appear
|
|
61
|
+
* in the spec-derived field paths. This prevents false positives from hand-added
|
|
62
|
+
* SDK fields that reference spec-derived types but aren't defined in the spec.
|
|
63
|
+
*
|
|
64
|
+
* For classes: when methodPaths is provided, only keeps methods whose names
|
|
65
|
+
* appear in the spec-derived method paths. This prevents false positives from
|
|
66
|
+
* hand-written SDK methods (e.g., SSO.authorization_url, Webhooks.construct_event)
|
|
67
|
+
* that don't correspond to spec operations. Properties on service classes are
|
|
68
|
+
* also filtered: only UPPER_CASE constants that are spec-derivable are kept.
|
|
69
|
+
*/
|
|
70
|
+
declare function filterSurface(surface: ApiSurface, allowedNames: Set<string>, opts?: {
|
|
71
|
+
fieldPaths?: Set<string>;
|
|
72
|
+
methodPaths?: Set<string>;
|
|
73
|
+
enumValues?: Map<string, Set<string | number>>;
|
|
74
|
+
}): ApiSurface;
|
|
75
|
+
|
|
76
|
+
declare function diffSurfaces(baseline: ApiSurface, candidate: ApiSurface, hints: LanguageHints): DiffResult;
|
|
77
|
+
|
|
78
|
+
declare const nodeExtractor: Extractor;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* PHP API surface extractor.
|
|
82
|
+
*
|
|
83
|
+
* Walks `.php` files under `lib/` (or `src/`), parses classes, interfaces,
|
|
84
|
+
* methods, properties, and constants, then builds an `ApiSurface`.
|
|
85
|
+
*
|
|
86
|
+
* Parser: `php-parser.ts` — tree-sitter-based PHP source analysis
|
|
87
|
+
* Surface: `php-surface.ts` — ApiSurface construction
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/** Default PHP extractor with generic language hints (no SDK-specific bases). */
|
|
91
|
+
declare const phpExtractor: Extractor;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Python API surface extractor.
|
|
95
|
+
*
|
|
96
|
+
* Walks `.py` files under `src/` (fallback to top-level package dirs),
|
|
97
|
+
* parses classes, type aliases, and module exports, then builds an
|
|
98
|
+
* `ApiSurface` with Protocol-based services, Pydantic model interfaces,
|
|
99
|
+
* Literal type enums, and exception classes.
|
|
100
|
+
*
|
|
101
|
+
* Parser: `python-parser.ts` — tree-sitter-based Python source analysis
|
|
102
|
+
* Surface: `python-surface.ts` — ApiSurface construction
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/** Default Python extractor with generic language hints (no SDK-specific bases). */
|
|
106
|
+
declare const pythonExtractor: Extractor;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Ruby API surface extractor.
|
|
110
|
+
*
|
|
111
|
+
* Walks `.rb` files under `lib/`, parses class/module declarations,
|
|
112
|
+
* and builds an `ApiSurface` with classes, service modules, and enum modules.
|
|
113
|
+
*
|
|
114
|
+
* Parser: `ruby-parser.ts` — tree-sitter-based class/module/enum extraction
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
declare const rubyExtractor: Extractor;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Go API surface extractor.
|
|
121
|
+
*
|
|
122
|
+
* Walks `.go` files (excluding `_test.go` and `internal/`), parses exported
|
|
123
|
+
* structs, functions, type declarations, and const blocks, then builds an
|
|
124
|
+
* `ApiSurface` with package-qualified names to avoid collisions when
|
|
125
|
+
* multiple packages define the same symbol (e.g., `Client`).
|
|
126
|
+
*
|
|
127
|
+
* Parser: `go-parser.ts` — regex-based Go source analysis
|
|
128
|
+
* Surface: `go-surface.ts` — ApiSurface construction & name qualification
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
declare const goExtractor: Extractor;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Rust API surface extractor.
|
|
135
|
+
*
|
|
136
|
+
* Walks `.rs` files under `src/`, parses pub structs, enums, impl blocks,
|
|
137
|
+
* traits, and type aliases, then builds an ApiSurface.
|
|
138
|
+
*
|
|
139
|
+
* Parser: `rust-parser.ts` — tree-sitter-based Rust source analysis
|
|
140
|
+
* Surface: `rust-surface.ts` — ApiSurface construction
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
declare const rustExtractor: Extractor;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Kotlin API surface extractor.
|
|
147
|
+
*
|
|
148
|
+
* Walks `.kt` files (excluding test files and build directories), parses
|
|
149
|
+
* data classes, classes, enum classes, and type aliases, then builds an
|
|
150
|
+
* `ApiSurface`.
|
|
151
|
+
*
|
|
152
|
+
* Parser: `kotlin-parser.ts` — regex-based Kotlin source analysis
|
|
153
|
+
* Surface: `kotlin-surface.ts` — ApiSurface construction
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
declare const kotlinExtractor: Extractor;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* DotNet (C#) API surface extractor.
|
|
160
|
+
*
|
|
161
|
+
* Walks `.cs` files (excluding test, bin, and obj directories), parses
|
|
162
|
+
* classes, enums, properties, and methods, then builds an `ApiSurface`.
|
|
163
|
+
*
|
|
164
|
+
* Parser: `dotnet-parser.ts` — regex-based C# source analysis
|
|
165
|
+
* Surface: `dotnet-surface.ts` — ApiSurface construction
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/** Default DotNet extractor with generic language hints. */
|
|
169
|
+
declare const dotnetExtractor: Extractor;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Elixir API surface extractor.
|
|
173
|
+
*
|
|
174
|
+
* Walks `.ex` files under `lib/` (the standard Elixir source directory),
|
|
175
|
+
* parses modules, structs, functions, and type specs, then builds an
|
|
176
|
+
* `ApiSurface`.
|
|
177
|
+
*
|
|
178
|
+
* Parser: `elixir-parser.ts` — regex-based Elixir source analysis
|
|
179
|
+
* Surface: `elixir-surface.ts` — ApiSurface construction
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
declare const elixirExtractor: Extractor;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Node/TypeScript language hints — reference implementation.
|
|
186
|
+
* Extracted from the hardcoded logic previously in differ.ts and overlay.ts.
|
|
187
|
+
*/
|
|
188
|
+
declare const nodeHints: LanguageHints;
|
|
189
|
+
/**
|
|
190
|
+
* Merge partial language hint overrides over nodeHints defaults.
|
|
191
|
+
* Any hint not provided falls back to the Node/TypeScript implementation.
|
|
192
|
+
*/
|
|
193
|
+
declare function resolveHints(overrides: Partial<LanguageHints>): LanguageHints;
|
|
194
|
+
|
|
195
|
+
export { ApiSurface, DiffResult, Extractor, LanguageHints, OverlayLookup, Violation, buildOverlayLookup, diffSurfaces, dotnetExtractor, elixirExtractor, filterSurface, getExtractor, goExtractor, kotlinExtractor, nodeExtractor, nodeHints, patchOverlay, phpExtractor, pythonExtractor, registerExtractor, resolveHints, rubyExtractor, rustExtractor, specDerivedEnumValues, specDerivedFieldPaths, specDerivedHttpKeys, specDerivedMethodPaths, specDerivedNames };
|