@workos/oagen 0.11.0 → 0.13.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/README.md +5 -0
- package/dist/cli/index.mjs +131 -15
- package/dist/cli/index.mjs.map +1 -1
- package/dist/compat/index.d.mts +4 -2
- package/dist/compat/index.d.mts.map +1 -1
- package/dist/compat/index.mjs +6 -3
- package/dist/compat/index.mjs.map +1 -1
- package/dist/{diff-DZvzV9p3.mjs → diff-C38px0NK.mjs} +4 -3
- package/dist/diff-C38px0NK.mjs.map +1 -0
- package/dist/{differ-8emGtevH.d.mts → differ-fdF9qogA.d.mts} +9 -2
- package/dist/differ-fdF9qogA.d.mts.map +1 -0
- package/dist/index.d.mts +61 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{overlay-Dddz3Awz.mjs → overlay-xp7F8_dW.mjs} +85 -2
- package/dist/overlay-xp7F8_dW.mjs.map +1 -0
- package/dist/scripts/smoke/baseline.mjs +1 -1
- package/dist/scripts/smoke/baseline.mjs.map +1 -1
- package/dist/smoke.d.mts +24 -0
- package/dist/smoke.d.mts.map +1 -1
- package/dist/smoke.mjs +1 -1
- package/dist/smoke.mjs.map +1 -1
- package/dist/{tree-sitter-C53w_0WE.mjs → tree-sitter-DcUvm0KA.mjs} +23 -2
- package/dist/tree-sitter-DcUvm0KA.mjs.map +1 -0
- package/dist/{types-DpD1SBY_.d.mts → types-BL762XqW.d.mts} +7 -2
- package/dist/{types-DpD1SBY_.d.mts.map → types-BL762XqW.d.mts.map} +1 -1
- package/dist/verify/index.d.mts +2 -2
- package/dist/verify/index.mjs +3 -3
- package/docs/advanced/index.md +1 -0
- package/docs/advanced/transform-spec.md +124 -0
- package/docs/cli.md +13 -11
- package/docs/core/compatibility-policy.md +26 -0
- package/docs/core/compatibility.md +6 -0
- package/docs/index.md +1 -0
- package/package.json +1 -1
- package/dist/diff-DZvzV9p3.mjs.map +0 -1
- package/dist/differ-8emGtevH.d.mts.map +0 -1
- package/dist/overlay-Dddz3Awz.mjs.map +0 -1
- package/dist/tree-sitter-C53w_0WE.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as CompatPolicyHints, Mt as CompatSymbol, _t as ApiSurface, at as CompatProvenance, kt as CompatSnapshot, nt as CompatChangeSeverity, t as ApiSpec, tt as CompatChangeCategory, xt as LanguageHints, yt as DiffResult } from "./types-
|
|
1
|
+
import { Bt as CompatPolicyHints, Mt as CompatSymbol, _t as ApiSurface, at as CompatProvenance, kt as CompatSnapshot, nt as CompatChangeSeverity, t as ApiSpec, tt as CompatChangeCategory, xt as LanguageHints, yt as DiffResult } from "./types-BL762XqW.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/classify.d.ts
|
|
4
4
|
/** A single classified compatibility change. */
|
|
@@ -19,6 +19,13 @@ interface ClassifiedChange {
|
|
|
19
19
|
new: Record<string, string>;
|
|
20
20
|
/** Human-readable explanation. */
|
|
21
21
|
message: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional spec-level remediation hint. Set by post-classification rules
|
|
24
|
+
* (see `detectForkedSchemas` in differ.ts) when a change has a recognized
|
|
25
|
+
* upstream root cause that the spec author can fix. Surfaces in both the
|
|
26
|
+
* machine-readable report and the human-readable summary.
|
|
27
|
+
*/
|
|
28
|
+
remediation?: string;
|
|
22
29
|
}
|
|
23
30
|
/** Result of classifying all changes between two snapshots. */
|
|
24
31
|
interface ClassificationResult {
|
|
@@ -113,4 +120,4 @@ declare function diffSnapshots(baseline: CompatSnapshot, candidate: CompatSnapsh
|
|
|
113
120
|
declare function diffSurfaces(baseline: ApiSurface, candidate: ApiSurface, hints: LanguageHints): DiffResult;
|
|
114
121
|
//#endregion
|
|
115
122
|
export { specDerivedEnumValues as a, specDerivedMethodPaths as c, ClassifiedChange as d, classifyAddedSymbol as f, filterSurface as i, specDerivedNames as l, summarizeChanges as m, diffSnapshots as n, specDerivedFieldPaths as o, classifySymbolChanges as p, diffSurfaces as r, specDerivedHttpKeys as s, CompatDiffResult as t, ClassificationResult as u };
|
|
116
|
-
//# sourceMappingURL=differ-
|
|
123
|
+
//# sourceMappingURL=differ-fdF9qogA.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differ-fdF9qogA.d.mts","names":[],"sources":["../src/compat/classify.ts","../src/compat/spec-filter.ts","../src/compat/differ.ts"],"mappings":";;;;UAaiB,gBAAA;EAcJ;EAZX,QAAA,EAAU,oBAAA;EAAV;EAEA,QAAA,EAAU,oBAAA;EAAV;EAEA,MAAA;EAAA;EAEA,kBAAA;EAEA;EAAA,UAAA,EAAY,gBAAA;EAEZ;EAAA,GAAA,EAAK,MAAA;EAEL;EAAA,GAAA,EAAK,MAAA;EAEL;EAAA,OAAA;EAOW;;AAIb;;;;EAJE,WAAA;AAAA;;UAIe,oBAAA;EACf,OAAA,EAAS,gBAAA;EACT,OAAA;IACE,QAAA;IACA,QAAA;IACA,QAAA;EAAA;AAAA;;;;;iBAYY,qBAAA,CACd,QAAA,EAAU,YAAA,EACV,SAAA,EAAW,YAAA,cACX,MAAA,EAAQ,iBAAA,GACP,gBAAA;;;;iBAkUa,mBAAA,CAAoB,MAAA,EAAQ,YAAA,GAAe,gBAAA;;iBAc3C,gBAAA,CAAiB,OAAA,EAAS,gBAAA,KAAqB,oBAAA;;;;AAhY/D;;;;iBCJgB,gBAAA,CAAiB,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,aAAA,GAAgB,GAAA;;;;;iBA0CvD,qBAAA,CAAsB,IAAA,EAAM,OAAA,GAAU,GAAA,SAAY,GAAA;;;;;;iBAalD,qBAAA,CAAsB,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,aAAA,GAAgB,GAAA;;;;;;iBAqB5D,sBAAA,CAAuB,IAAA,EAAM,OAAA,GAAU,GAAA;;;;;iBAcvC,mBAAA,CAAoB,IAAA,EAAM,OAAA,GAAU,GAAA;;;;;;;;;;;;AD1CpD;;;;iBC8FgB,aAAA,CACd,OAAA,EAAS,UAAA,EACT,YAAA,EAAc,GAAA,UACd,IAAA;EACE,UAAA,GAAa,GAAA;EACb,WAAA,GAAc,GAAA;EACd,UAAA,GAAa,GAAA,SAAY,GAAA;AAAA,IAE1B,UAAA;;;;UChIc,gBAAA;EACf,OAAA,EAAS,gBAAA;EACT,OAAA,EAAS,oBAAA;AAAA;;;;;iBAOK,aAAA,CACd,QAAA,EAAU,cAAA,EACV,SAAA,EAAW,cAAA,EACX,MAAA,GAAS,iBAAA,GACR,gBAAA;;;;;;AFJH;;;iBEsMgB,YAAA,CAAa,QAAA,EAAU,UAAA,EAAY,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,aAAA,GAAgB,UAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as collectEnumRefs, B as IdempotencyPolicy, C as Service, Ct as OverlayLookup, D as UnionType, E as TypeRef, F as walkTypeRef, G as RetryPolicy, H as LoggingPolicy, I as AiAgentEnvVar, J as TimeoutPolicy, K as SdkBehavior, L as BackoffStrategy, M as collectModelRefs, N as collectRequestBodyModels, O as assertNever, P as mapTypeRef, R as DeepPartial, S as ServerEntry, T as TypeParam, U as PaginationPolicy, V as LogEvent, W as RequestGuardPolicy, X as defaultSdkBehavior, Y as UserAgentPolicy, Z as mergeSdkBehavior, _ as Parameter, _t as ApiSurface, a as EnumRef, b as PrimitiveType, bt as Extractor, c as Field, d as MapType, f as Model, g as PaginationMeta, h as Operation, i as Enum, j as collectFieldDependencies, k as assignModelsToServices, l as HttpMethod, m as NullableType, n as ArrayType, o as EnumValue, p as ModelRef, q as TelemetryPolicy, r as AuthScheme, rt as CompatConfig, s as ErrorResponse, t as ApiSpec, u as LiteralType, v as ParameterGroup, w as SuccessResponse, x as SecurityRequirement, y as ParameterGroupVariant, z as ErrorPolicy } from "./types-
|
|
1
|
+
import { A as collectEnumRefs, B as IdempotencyPolicy, C as Service, Ct as OverlayLookup, D as UnionType, E as TypeRef, F as walkTypeRef, G as RetryPolicy, H as LoggingPolicy, I as AiAgentEnvVar, J as TimeoutPolicy, K as SdkBehavior, L as BackoffStrategy, M as collectModelRefs, N as collectRequestBodyModels, O as assertNever, P as mapTypeRef, R as DeepPartial, S as ServerEntry, T as TypeParam, U as PaginationPolicy, V as LogEvent, W as RequestGuardPolicy, X as defaultSdkBehavior, Y as UserAgentPolicy, Z as mergeSdkBehavior, _ as Parameter, _t as ApiSurface, a as EnumRef, b as PrimitiveType, bt as Extractor, c as Field, d as MapType, f as Model, g as PaginationMeta, h as Operation, i as Enum, j as collectFieldDependencies, k as assignModelsToServices, l as HttpMethod, m as NullableType, n as ArrayType, o as EnumValue, p as ModelRef, q as TelemetryPolicy, r as AuthScheme, rt as CompatConfig, s as ErrorResponse, t as ApiSpec, u as LiteralType, v as ParameterGroup, w as SuccessResponse, x as SecurityRequirement, y as ParameterGroupVariant, z as ErrorPolicy } from "./types-BL762XqW.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/ir/operation-hints.d.ts
|
|
4
4
|
/** Per-operation override keyed by "METHOD /path" (e.g. "POST /sso/token"). */
|
|
@@ -161,6 +161,12 @@ interface EmitterContext {
|
|
|
161
161
|
overlayLookup?: OverlayLookup;
|
|
162
162
|
/** Resolved operations from the hint-aware resolver. Populated by buildEmitterContext(). */
|
|
163
163
|
resolvedOperations?: ResolvedOperation[];
|
|
164
|
+
/**
|
|
165
|
+
* Model-placement pins from `OagenConfig.modelHints`. Emitters that call
|
|
166
|
+
* `assignModelsToServices` should pass this through so hinted models land in
|
|
167
|
+
* the configured service instead of the default first-reference winner.
|
|
168
|
+
*/
|
|
169
|
+
modelHints?: Record<string, string>;
|
|
164
170
|
/** Absolute path to the integration target directory (when --target is used). */
|
|
165
171
|
targetDir?: string;
|
|
166
172
|
/**
|
|
@@ -308,9 +314,33 @@ interface ParamChange {
|
|
|
308
314
|
}
|
|
309
315
|
//#endregion
|
|
310
316
|
//#region src/parser/parse.d.ts
|
|
317
|
+
/**
|
|
318
|
+
* A bundled OpenAPI document, post-`$ref` resolution but pre-IR extraction.
|
|
319
|
+
*
|
|
320
|
+
* This is the shape the spec author wrote, with external refs inlined and
|
|
321
|
+
* internal refs left intact. It is intentionally loose (`Record<string,
|
|
322
|
+
* unknown>`) so `transformSpec` can reach arbitrary spec extensions without
|
|
323
|
+
* fighting types — narrow with `as` at use sites.
|
|
324
|
+
*/
|
|
325
|
+
type OpenApiDocument = Record<string, unknown>;
|
|
311
326
|
interface ParseOptions {
|
|
312
327
|
operationIdTransform?: (id: string) => string;
|
|
313
328
|
schemaNameTransform?: (name: string) => string;
|
|
329
|
+
/**
|
|
330
|
+
* Pre-IR overlay applied to the bundled OpenAPI document before any IR
|
|
331
|
+
* extraction runs. Use this when the upstream spec can't be changed but you
|
|
332
|
+
* need to patch around a spec quirk that would otherwise emit a breaking SDK
|
|
333
|
+
* change — e.g. rewriting a path's response `$ref` back to its prior schema,
|
|
334
|
+
* merging the new fields onto the prior schema, and dropping the fork.
|
|
335
|
+
*
|
|
336
|
+
* The function may mutate the document in place and return it, or return a
|
|
337
|
+
* new object; the returned value is what the rest of oagen sees.
|
|
338
|
+
*
|
|
339
|
+
* Runs once, after `$ref` bundling and before schema/operation extraction.
|
|
340
|
+
* If you need to inspect the resulting IR instead, post-process the
|
|
341
|
+
* `ApiSpec` returned by `parseSpec`.
|
|
342
|
+
*/
|
|
343
|
+
transformSpec?: (spec: OpenApiDocument) => OpenApiDocument;
|
|
314
344
|
}
|
|
315
345
|
declare function parseSpec(specPath: string, options?: ParseOptions): Promise<ApiSpec>;
|
|
316
346
|
//#endregion
|
|
@@ -323,7 +353,8 @@ declare function generate(spec: ApiSpec, emitter: Emitter, options: {
|
|
|
323
353
|
apiSurface?: ApiSurface;
|
|
324
354
|
overlayLookup?: OverlayLookup;
|
|
325
355
|
operationHints?: Record<string, OperationHint>;
|
|
326
|
-
mountRules?: Record<string, string>;
|
|
356
|
+
mountRules?: Record<string, string>;
|
|
357
|
+
modelHints?: Record<string, string>; /** When true, skip deletion of files recorded in the previous manifest but not in the current emission. */
|
|
327
358
|
noPrune?: boolean;
|
|
328
359
|
}): Promise<GeneratedFile[]>;
|
|
329
360
|
//#endregion
|
|
@@ -335,6 +366,7 @@ declare function buildEmitterContext(spec: ApiSpec, options: {
|
|
|
335
366
|
overlayLookup?: OverlayLookup;
|
|
336
367
|
operationHints?: Record<string, OperationHint>;
|
|
337
368
|
mountRules?: Record<string, string>;
|
|
369
|
+
modelHints?: Record<string, string>;
|
|
338
370
|
target?: string;
|
|
339
371
|
priorTargetManifestPaths?: Set<string>;
|
|
340
372
|
}): EmitterContext;
|
|
@@ -358,6 +390,7 @@ declare function generateFiles(spec: ApiSpec, emitter: Emitter, options: {
|
|
|
358
390
|
overlayLookup?: OverlayLookup;
|
|
359
391
|
operationHints?: Record<string, OperationHint>;
|
|
360
392
|
mountRules?: Record<string, string>;
|
|
393
|
+
modelHints?: Record<string, string>;
|
|
361
394
|
target?: string;
|
|
362
395
|
priorTargetManifestPaths?: Set<string>;
|
|
363
396
|
}): {
|
|
@@ -460,6 +493,18 @@ interface OagenConfig {
|
|
|
460
493
|
/** Base URL for documentation links. When set, relative paths in descriptions
|
|
461
494
|
* (e.g. `/reference/authkit/user`) are expanded to full URLs. */
|
|
462
495
|
docUrl?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Pre-IR overlay applied to the bundled OpenAPI document before any IR
|
|
498
|
+
* extraction. Use this when the upstream spec can't be changed but a quirk
|
|
499
|
+
* in it would otherwise emit a breaking SDK change — e.g. rewriting a
|
|
500
|
+
* path's response `$ref` back to its prior schema, merging the new fields
|
|
501
|
+
* onto the prior schema, and dropping the fork schema.
|
|
502
|
+
*
|
|
503
|
+
* The function may mutate the document in place and return it, or return a
|
|
504
|
+
* new object. Runs once, after `$ref` bundling and before schema/operation
|
|
505
|
+
* extraction. See `docs/advanced/transform-spec.md` for examples.
|
|
506
|
+
*/
|
|
507
|
+
transformSpec?: (spec: OpenApiDocument) => OpenApiDocument;
|
|
463
508
|
/**
|
|
464
509
|
* Per-operation overrides keyed by "METHOD /path" (e.g. "POST /sso/token").
|
|
465
510
|
* Used by the operation resolver to override derived method names, mount
|
|
@@ -473,7 +518,20 @@ interface OagenConfig {
|
|
|
473
518
|
* takes priority.
|
|
474
519
|
*/
|
|
475
520
|
mountRules?: Record<string, string>;
|
|
521
|
+
/**
|
|
522
|
+
* Pin specific models to a specific IR service for placement, overriding the
|
|
523
|
+
* default "first service to reference the model wins" assignment.
|
|
524
|
+
*
|
|
525
|
+
* Maps IR model name → IR service name (both PascalCase). Useful when a model
|
|
526
|
+
* is shared across services and the natural ordering would place it in a
|
|
527
|
+
* service that's wrong for the public API.
|
|
528
|
+
*
|
|
529
|
+
* Both names must exist in the parsed spec; unknown names throw at generation
|
|
530
|
+
* time so typos fail loud. Note that keys are post-cleanSchemaName /
|
|
531
|
+
* post-schemaNameTransform model names (e.g. `User`, not `UserlandUser`).
|
|
532
|
+
*/
|
|
533
|
+
modelHints?: Record<string, string>;
|
|
476
534
|
}
|
|
477
535
|
//#endregion
|
|
478
|
-
export { ACRONYM_SET, type AiAgentEnvVar, type ApiSpec, type ArrayType, type AuthScheme, type BackoffStrategy, type Change, CommandError, ConfigError, ConfigLoadError, ConfigVersionMismatchError, type DeepPartial, type DiffReport, type Emitter, type EmitterContext, type Enum, type EnumAdded, type EnumModified, type EnumRef, type EnumRemoved, type EnumValue, type EnumValueChange, type ErrorPolicy, type ErrorResponse, ExtractorError, type Field, type FieldChange, type FormatCommand, type GeneratedFile, type HttpMethod, type IdempotencyPolicy, InternalError, type LiteralType, type LogEvent, type LoggingPolicy, type MapType, type Model, type ModelAdded, type ModelModified, type ModelRef, type ModelRemoved, type NullableType, type OagenConfig, OagenError, type Operation, type OperationAdded, type OperationHint, type OperationModified, type OperationPlan, type OperationRemoved, type OperationsMap, type OperationsMapEntry, type PaginationMeta, type PaginationPolicy, type ParamChange, type Parameter, type ParameterGroup, type ParameterGroupVariant, type PrimitiveType, RegistryError, type RequestGuardPolicy, type ResolvedOperation, type ResolvedWrapper, type RetryPolicy, type SdkBehavior, type SecurityRequirement, type ServerEntry, type Service, type ServiceAdded, type ServiceRemoved, SpecParseError, type SplitHint, type SuccessResponse, type TelemetryPolicy, type TimeoutPolicy, type TypeParam, type TypeRef, type UnionType, type UserAgentPolicy, applyFileHeaders, assertNever, assignModelsToServices, buildEmitterContext, cleanSchemaName, collectEnumRefs, collectFieldDependencies, collectModelRefs, collectReferencedNames, collectRequestBodyModels, defaultSdkBehavior, deriveMethodName, diffSpecs, generate, generateAllFiles, generateFiles, getEmitter, integrateGeneratedFiles, mapFilesForTargetIntegration, mapTypeRef, mergeSdkBehavior, parseSpec, planOperation, registerEmitter, resolveOperations, stripBackendPrefixes, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toUpperSnakeCase, treeShakeFiles, walkTypeRef };
|
|
536
|
+
export { ACRONYM_SET, type AiAgentEnvVar, type ApiSpec, type ArrayType, type AuthScheme, type BackoffStrategy, type Change, CommandError, ConfigError, ConfigLoadError, ConfigVersionMismatchError, type DeepPartial, type DiffReport, type Emitter, type EmitterContext, type Enum, type EnumAdded, type EnumModified, type EnumRef, type EnumRemoved, type EnumValue, type EnumValueChange, type ErrorPolicy, type ErrorResponse, ExtractorError, type Field, type FieldChange, type FormatCommand, type GeneratedFile, type HttpMethod, type IdempotencyPolicy, InternalError, type LiteralType, type LogEvent, type LoggingPolicy, type MapType, type Model, type ModelAdded, type ModelModified, type ModelRef, type ModelRemoved, type NullableType, type OagenConfig, OagenError, type OpenApiDocument, type Operation, type OperationAdded, type OperationHint, type OperationModified, type OperationPlan, type OperationRemoved, type OperationsMap, type OperationsMapEntry, type PaginationMeta, type PaginationPolicy, type ParamChange, type Parameter, type ParameterGroup, type ParameterGroupVariant, type ParseOptions, type PrimitiveType, RegistryError, type RequestGuardPolicy, type ResolvedOperation, type ResolvedWrapper, type RetryPolicy, type SdkBehavior, type SecurityRequirement, type ServerEntry, type Service, type ServiceAdded, type ServiceRemoved, SpecParseError, type SplitHint, type SuccessResponse, type TelemetryPolicy, type TimeoutPolicy, type TypeParam, type TypeRef, type UnionType, type UserAgentPolicy, applyFileHeaders, assertNever, assignModelsToServices, buildEmitterContext, cleanSchemaName, collectEnumRefs, collectFieldDependencies, collectModelRefs, collectReferencedNames, collectRequestBodyModels, defaultSdkBehavior, deriveMethodName, diffSpecs, generate, generateAllFiles, generateFiles, getEmitter, integrateGeneratedFiles, mapFilesForTargetIntegration, mapTypeRef, mergeSdkBehavior, parseSpec, planOperation, registerEmitter, resolveOperations, stripBackendPrefixes, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toUpperSnakeCase, treeShakeFiles, walkTypeRef };
|
|
479
537
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ir/operation-hints.ts","../src/errors.ts","../src/engine/types.ts","../src/differ/types.ts","../src/parser/parse.ts","../src/engine/orchestrator.ts","../src/engine/generate-files.ts","../src/engine/writer.ts","../src/engine/integrate.ts","../src/engine/registry.ts","../src/differ/diff.ts","../src/utils/naming.ts","../src/engine/operation-plan.ts","../src/cli/config-loader.ts"],"mappings":";;;;UAeiB,aAAA;EAAA;EAEf,IAAA;;EAEA,OAAA;EAFA;EAIA,KAAA,GAAQ,SAAA;EAAR;EAEA,QAAA,GAAW,MAAA;EAAX;EAEA,eAAA;EAAA;;;;AAUF;;EAHE,UAAA;AAAA;AAAA,UAGe,SAAA;EAIf;EAFA,IAAA;EAIW;EAFX,aAAA;EAMA;EAJA,QAAA,GAAW,MAAA;EAUG;EARd,eAAA;EAee;EAbf,aAAA;;;;;;EAMA,cAAA;AAAA;AAAA,UAOe,iBAAA;EAEJ;EAAX,SAAA,EAAW,SAAA;EAEF;EAAT,OAAA,EAAS,OAAA;EAI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A;EACf,SAAA;EACA,eAAA;EACA,IAAA,EAAM,OAAA;EACN,SAAA;EACA,UAAA,GAAa,UAAA;EACb,aAAA,GAAgB,aAAA;EFoBC;EElBjB,kBAAA,GAAqB,iBAAA;EFgBrB;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ir/operation-hints.ts","../src/errors.ts","../src/engine/types.ts","../src/differ/types.ts","../src/parser/parse.ts","../src/engine/orchestrator.ts","../src/engine/generate-files.ts","../src/engine/writer.ts","../src/engine/integrate.ts","../src/engine/registry.ts","../src/differ/diff.ts","../src/utils/naming.ts","../src/engine/operation-plan.ts","../src/cli/config-loader.ts"],"mappings":";;;;UAeiB,aAAA;EAAA;EAEf,IAAA;;EAEA,OAAA;EAFA;EAIA,KAAA,GAAQ,SAAA;EAAR;EAEA,QAAA,GAAW,MAAA;EAAX;EAEA,eAAA;EAAA;;;;AAUF;;EAHE,UAAA;AAAA;AAAA,UAGe,SAAA;EAIf;EAFA,IAAA;EAIW;EAFX,aAAA;EAMA;EAJA,QAAA,GAAW,MAAA;EAUG;EARd,eAAA;EAee;EAbf,aAAA;;;;;;EAMA,cAAA;AAAA;AAAA,UAOe,iBAAA;EAEJ;EAAX,SAAA,EAAW,SAAA;EAEF;EAAT,OAAA,EAAS,OAAA;EAIT;EAFA,UAAA;EAIW;EAFX,OAAA;EAIU;EAFV,QAAA,GAAW,eAAA;EAMX;EAJA,QAAA,EAAU,MAAA;EAIA;EAFV,eAAA;EAK8B;EAH9B,UAAA;AAAA;AAAA,UAGe,eAAA;EAIf;EAFA,IAAA;EAIU;EAFV,aAAA;EAMA;EAJA,QAAA,EAAU,MAAA;EAQV;EANA,eAAA;EAMiB;EAJjB,aAAA;EAgF8B;EA9E9B,cAAA;EA8E+D;EA5E/D,iBAAA;AAAA;;;;;AA2JF;;;;;;;iBA/EgB,gBAAA,CAAiB,EAAA,EAAI,SAAA,EAAW,QAAA,EAAU,OAAA;;;;;;;;;iBA+E1C,iBAAA,CACd,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,eAAA,KAAoB,eAAA;EbiB3C;;;;;EaXA,cAAA,GAAiB,MAAA,SAAe,aAAA;EbmBhC;;;;AAKF;;EajBE,UAAA,GAAa,MAAA;EbuBG;;;;;;;;;;;AAoFlB;Ea9FE,UAAA,GAAa,MAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as walkTypeRef, C as assertNever, D as collectModelRefs, E as collectFieldDependencies, O as collectRequestBodyModels, S as SpecParseError, T as collectEnumRefs, _ as ConfigVersionMismatchError, a as singularize, b as OagenError, c as stripListItemMarkers, d as toPascalCase, f as toSnakeCase, g as ConfigLoadError, h as ConfigError, k as mapTypeRef, l as toCamelCase, m as CommandError, n as ACRONYM_SET, p as toUpperSnakeCase, r as cleanSchemaName, s as stripBackendPrefixes, u as toKebabCase, v as ExtractorError, w as assignModelsToServices, x as RegistryError, y as InternalError } from "./tree-sitter-
|
|
2
|
-
import { c as treeShakeFiles, d as collectReferencedNames, f as generateAllFiles, h as resolveOperations, i as generate, l as applyFileHeaders, m as deriveMethodName, n as getEmitter, o as integrateGeneratedFiles, p as generateFiles, r as registerEmitter, s as mapFilesForTargetIntegration, t as diffSpecs, u as buildEmitterContext } from "./diff-
|
|
1
|
+
import { A as walkTypeRef, C as assertNever, D as collectModelRefs, E as collectFieldDependencies, O as collectRequestBodyModels, S as SpecParseError, T as collectEnumRefs, _ as ConfigVersionMismatchError, a as singularize, b as OagenError, c as stripListItemMarkers, d as toPascalCase, f as toSnakeCase, g as ConfigLoadError, h as ConfigError, k as mapTypeRef, l as toCamelCase, m as CommandError, n as ACRONYM_SET, p as toUpperSnakeCase, r as cleanSchemaName, s as stripBackendPrefixes, u as toKebabCase, v as ExtractorError, w as assignModelsToServices, x as RegistryError, y as InternalError } from "./tree-sitter-DcUvm0KA.mjs";
|
|
2
|
+
import { c as treeShakeFiles, d as collectReferencedNames, f as generateAllFiles, h as resolveOperations, i as generate, l as applyFileHeaders, m as deriveMethodName, n as getEmitter, o as integrateGeneratedFiles, p as generateFiles, r as registerEmitter, s as mapFilesForTargetIntegration, t as diffSpecs, u as buildEmitterContext } from "./diff-C38px0NK.mjs";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -2030,7 +2030,7 @@ function validateModelRefs(spec) {
|
|
|
2030
2030
|
//#region src/parser/parse.ts
|
|
2031
2031
|
async function parseSpec(specPath, options) {
|
|
2032
2032
|
const { parsed } = await loadAndBundleSpec(specPath);
|
|
2033
|
-
const spec = parsed;
|
|
2033
|
+
const spec = options?.transformSpec ? options.transformSpec(parsed) : parsed;
|
|
2034
2034
|
const version = spec.openapi ?? "";
|
|
2035
2035
|
if (!version.startsWith("3.")) throw new SpecParseError(`Unsupported OpenAPI version: ${version}. oagen requires OpenAPI 3.x`, `Update the spec to OpenAPI 3.0 or 3.1. If you are using Swagger 2.x, convert it first with \`npx swagger2openapi ${specPath}\`.`);
|
|
2036
2036
|
const { models, enums } = extractSchemas(spec.components?.schemas, { schemaNameTransform: options?.schemaNameTransform });
|