@orval/core 8.18.0 → 8.19.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/dist/index.d.mts +203 -19
- package/dist/index.mjs +414 -164
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ interface NormalizedOptions {
|
|
|
31
31
|
interface NormalizedOutputOptions {
|
|
32
32
|
workspace?: string;
|
|
33
33
|
target: string;
|
|
34
|
-
schemas?: string |
|
|
34
|
+
schemas?: string | NormalizedSchemaOptions;
|
|
35
35
|
operationSchemas?: string;
|
|
36
36
|
namingConvention: NamingConvention;
|
|
37
37
|
fileExtension: string;
|
|
@@ -61,6 +61,8 @@ interface NormalizedOutputOptions {
|
|
|
61
61
|
optionsParamRequired: boolean;
|
|
62
62
|
propertySortOrder: PropertySortOrder;
|
|
63
63
|
factoryMethods?: NormalizedFactoryMethodsOptions;
|
|
64
|
+
tagsSplitDeduplication: boolean;
|
|
65
|
+
commonTypesFileName: string;
|
|
64
66
|
}
|
|
65
67
|
interface NormalizedParamsSerializerOptions {
|
|
66
68
|
qs?: Record<string, unknown>;
|
|
@@ -185,7 +187,7 @@ interface NormalizedOperationOptions {
|
|
|
185
187
|
query?: NormalizedQueryOptions;
|
|
186
188
|
angular?: NormalizedAngularOptions;
|
|
187
189
|
swr?: SwrOptions;
|
|
188
|
-
zod?:
|
|
190
|
+
zod?: NormalizedOperationZodOptions;
|
|
189
191
|
effect?: NormalizedEffectOptions;
|
|
190
192
|
operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
|
|
191
193
|
fetch?: FetchOptions;
|
|
@@ -267,11 +269,20 @@ interface SchemaOptions {
|
|
|
267
269
|
path: string;
|
|
268
270
|
type?: SchemaGenerationType;
|
|
269
271
|
importPath?: string;
|
|
272
|
+
/**
|
|
273
|
+
* When `true`, schemas are organized into per-tag subdirectories instead of
|
|
274
|
+
* a single flat directory. Schemas referenced by multiple tags remain at the
|
|
275
|
+
* root of the schema directory.
|
|
276
|
+
*
|
|
277
|
+
* @default false
|
|
278
|
+
*/
|
|
279
|
+
splitByTags?: boolean;
|
|
270
280
|
}
|
|
271
281
|
interface NormalizedSchemaOptions {
|
|
272
282
|
path: string;
|
|
273
283
|
type: SchemaGenerationType;
|
|
274
284
|
importPath?: string;
|
|
285
|
+
splitByTags: boolean;
|
|
275
286
|
}
|
|
276
287
|
interface OutputOptions {
|
|
277
288
|
workspace?: string;
|
|
@@ -312,6 +323,8 @@ interface OutputOptions {
|
|
|
312
323
|
optionsParamRequired?: boolean;
|
|
313
324
|
propertySortOrder?: PropertySortOrder;
|
|
314
325
|
factoryMethods?: FactoryMethodsOptions;
|
|
326
|
+
tagsSplitDeduplication?: boolean;
|
|
327
|
+
commonTypesFileName?: string;
|
|
315
328
|
}
|
|
316
329
|
interface InputFiltersOptions {
|
|
317
330
|
mode?: 'include' | 'exclude';
|
|
@@ -433,10 +446,13 @@ type OverrideMockOptions = Partial<GlobalMockOptions> & {
|
|
|
433
446
|
required?: boolean;
|
|
434
447
|
nonNullable?: boolean;
|
|
435
448
|
properties?: MockProperties;
|
|
449
|
+
schemas?: Record<string, {
|
|
450
|
+
properties: MockProperties;
|
|
451
|
+
}>;
|
|
436
452
|
format?: Record<string, unknown>;
|
|
437
453
|
fractionDigits?: number;
|
|
438
454
|
};
|
|
439
|
-
type MockOptions = Omit<OverrideMockOptions, 'properties'> & {
|
|
455
|
+
type MockOptions = Omit<OverrideMockOptions, 'properties' | 'schemas'> & {
|
|
440
456
|
properties?: Record<string, unknown>;
|
|
441
457
|
operations?: Record<string, {
|
|
442
458
|
properties: Record<string, unknown>;
|
|
@@ -444,6 +460,9 @@ type MockOptions = Omit<OverrideMockOptions, 'properties'> & {
|
|
|
444
460
|
tags?: Record<string, {
|
|
445
461
|
properties: Record<string, unknown>;
|
|
446
462
|
}>;
|
|
463
|
+
schemas?: Record<string, {
|
|
464
|
+
properties: Record<string, unknown>;
|
|
465
|
+
}>;
|
|
447
466
|
};
|
|
448
467
|
type MockPropertiesObject = Record<string, unknown>;
|
|
449
468
|
type MockPropertiesObjectFn = (specs: OpenApiDocument) => MockPropertiesObject;
|
|
@@ -606,7 +625,19 @@ interface ZodDateTimeOptions {
|
|
|
606
625
|
interface ZodTimeOptions {
|
|
607
626
|
precision?: -1 | 0 | 1 | 2 | 3;
|
|
608
627
|
}
|
|
609
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Target Zod major version for generated output.
|
|
630
|
+
*
|
|
631
|
+
* - `4` — always emit Zod 4-style output (`z.strictObject`, `z.looseObject`,
|
|
632
|
+
* `z.iso.datetime()`, `.meta()`, …) regardless of the installed `zod` version.
|
|
633
|
+
* - `3` — always emit Zod 3-compatible output (`.strict()`/`.passthrough()`,
|
|
634
|
+
* `z.string().datetime()`, …) regardless of the installed `zod` version.
|
|
635
|
+
* - `'auto'` — infer the target from the `zod` version resolved in the output
|
|
636
|
+
* project's `package.json`; when no `zod` package can be detected, fall back
|
|
637
|
+
* to Zod 4 output.
|
|
638
|
+
*/
|
|
639
|
+
type ZodVersionOption = 3 | 4 | 'auto';
|
|
640
|
+
interface BaseZodOptions {
|
|
610
641
|
strict?: {
|
|
611
642
|
param?: boolean;
|
|
612
643
|
query?: boolean;
|
|
@@ -647,10 +678,19 @@ interface ZodOptions {
|
|
|
647
678
|
* location.
|
|
648
679
|
*/
|
|
649
680
|
params?: Mutator;
|
|
681
|
+
useBrandedTypes?: boolean;
|
|
682
|
+
}
|
|
683
|
+
interface ZodOptions extends BaseZodOptions {
|
|
684
|
+
/**
|
|
685
|
+
* Pin the Zod output target so generation is deterministic instead of
|
|
686
|
+
* inferred from the installed `zod` version. Defaults to `'auto'`, which
|
|
687
|
+
* infers from the detected package and otherwise falls back to Zod 4 output.
|
|
688
|
+
* See {@link ZodVersionOption}.
|
|
689
|
+
*/
|
|
690
|
+
version?: ZodVersionOption;
|
|
650
691
|
dateTimeOptions?: ZodDateTimeOptions;
|
|
651
692
|
timeOptions?: ZodTimeOptions;
|
|
652
693
|
generateEachHttpStatus?: boolean;
|
|
653
|
-
useBrandedTypes?: boolean;
|
|
654
694
|
/**
|
|
655
695
|
* When true, emits one reusable Zod schema per `#/components/schemas/*` `$ref`
|
|
656
696
|
* (with `namingConvention` applied to the name) and references it everywhere
|
|
@@ -666,6 +706,13 @@ interface ZodOptions {
|
|
|
666
706
|
*/
|
|
667
707
|
generateMeta?: boolean;
|
|
668
708
|
}
|
|
709
|
+
/**
|
|
710
|
+
* Per-operation/tag Zod overrides only include settings that are actually
|
|
711
|
+
* merged into the operation-specific generator path. Output-wide target and
|
|
712
|
+
* schema-layout settings belong on `override.zod`, not `override.operations.*`
|
|
713
|
+
* / `override.tags.*`.
|
|
714
|
+
*/
|
|
715
|
+
type OperationZodOptions = BaseZodOptions;
|
|
669
716
|
interface EffectOptions {
|
|
670
717
|
strict?: ZodOptions['strict'];
|
|
671
718
|
generate?: ZodOptions['generate'];
|
|
@@ -674,6 +721,7 @@ interface EffectOptions {
|
|
|
674
721
|
}
|
|
675
722
|
type ZodCoerceType = 'string' | 'number' | 'boolean' | 'bigint' | 'date' | 'array';
|
|
676
723
|
interface NormalizedZodOptions {
|
|
724
|
+
version: ZodVersionOption;
|
|
677
725
|
strict: {
|
|
678
726
|
param: boolean;
|
|
679
727
|
query: boolean;
|
|
@@ -710,6 +758,7 @@ interface NormalizedZodOptions {
|
|
|
710
758
|
dateTimeOptions: ZodDateTimeOptions;
|
|
711
759
|
timeOptions: ZodTimeOptions;
|
|
712
760
|
}
|
|
761
|
+
type NormalizedOperationZodOptions = Pick<NormalizedZodOptions, 'strict' | 'generate' | 'coerce' | 'preprocess' | 'params' | 'useBrandedTypes'>;
|
|
713
762
|
interface NormalizedEffectOptions {
|
|
714
763
|
strict: NormalizedZodOptions['strict'];
|
|
715
764
|
generate: NormalizedZodOptions['generate'];
|
|
@@ -878,6 +927,15 @@ interface NormalizedFetchOptions {
|
|
|
878
927
|
jsonReviver?: Mutator;
|
|
879
928
|
runtimeValidation: boolean;
|
|
880
929
|
useRuntimeFetcher: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* Serialization format for array query parameters that do not have an explicit
|
|
932
|
+
* `explode` setting in the OpenAPI spec.
|
|
933
|
+
*
|
|
934
|
+
* - `repeat` — repeat the key for each value: `foo=1&foo=2`
|
|
935
|
+
* - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`
|
|
936
|
+
* - `comma` — join values with a comma: `foo=1,2`
|
|
937
|
+
*/
|
|
938
|
+
arrayFormat?: 'repeat' | 'brackets' | 'comma';
|
|
881
939
|
}
|
|
882
940
|
interface FetchOptions {
|
|
883
941
|
includeHttpResponseReturnType?: boolean;
|
|
@@ -885,6 +943,15 @@ interface FetchOptions {
|
|
|
885
943
|
jsonReviver?: Mutator;
|
|
886
944
|
runtimeValidation?: boolean;
|
|
887
945
|
useRuntimeFetcher?: boolean;
|
|
946
|
+
/**
|
|
947
|
+
* Serialization format for array query parameters that do not have an explicit
|
|
948
|
+
* `explode` setting in the OpenAPI spec.
|
|
949
|
+
*
|
|
950
|
+
* - `repeat` — repeat the key for each value: `foo=1&foo=2`
|
|
951
|
+
* - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`
|
|
952
|
+
* - `comma` — join values with a comma: `foo=1,2`
|
|
953
|
+
*/
|
|
954
|
+
arrayFormat?: 'repeat' | 'brackets' | 'comma';
|
|
888
955
|
}
|
|
889
956
|
type InputTransformerFn = (spec: OpenApiDocument) => OpenApiDocument | Promise<OpenApiDocument>;
|
|
890
957
|
type InputTransformer = string | InputTransformerFn;
|
|
@@ -901,7 +968,7 @@ interface OperationOptions {
|
|
|
901
968
|
query?: QueryOptions;
|
|
902
969
|
angular?: AngularOptions;
|
|
903
970
|
swr?: SwrOptions;
|
|
904
|
-
zod?:
|
|
971
|
+
zod?: OperationZodOptions;
|
|
905
972
|
effect?: EffectOptions;
|
|
906
973
|
operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
|
|
907
974
|
fetch?: FetchOptions;
|
|
@@ -980,11 +1047,18 @@ interface ContextSpec {
|
|
|
980
1047
|
* - `isParameter` — `true`, signals this is a generic type parameter
|
|
981
1048
|
* - `name` — the `$dynamicAnchor` name used as the type parameter (e.g. `itemType`)
|
|
982
1049
|
* - `schemaName` — same as `name` for parameters
|
|
1050
|
+
*
|
|
1051
|
+
* Inline entry (anonymous subschema overriding an anchor without a `$ref`):
|
|
1052
|
+
* - `inlineSchema` — the concrete schema object to resolve `$dynamicRef` against.
|
|
1053
|
+
* Takes precedence over the component lookup in `resolveDynamicRef`, so an
|
|
1054
|
+
* inline `$dynamicAnchor` (e.g. inside `allOf` / `items`) correctly shadows
|
|
1055
|
+
* the outer/global anchor. `schemaName` is the anchor name itself.
|
|
983
1056
|
*/
|
|
984
1057
|
interface DynamicScopeEntry {
|
|
985
1058
|
name: string;
|
|
986
1059
|
schemaName: string;
|
|
987
1060
|
isParameter?: boolean;
|
|
1061
|
+
inlineSchema?: OpenApiSchemaObject;
|
|
988
1062
|
}
|
|
989
1063
|
interface GlobalOptions {
|
|
990
1064
|
watch?: boolean | string | string[];
|
|
@@ -1105,6 +1179,7 @@ interface GeneratorTarget {
|
|
|
1105
1179
|
paramsSerializer?: GeneratorMutator[];
|
|
1106
1180
|
paramsFilter?: GeneratorMutator[];
|
|
1107
1181
|
fetchReviver?: GeneratorMutator[];
|
|
1182
|
+
sharedTypes?: SharedTypeDeclaration[];
|
|
1108
1183
|
}
|
|
1109
1184
|
interface GeneratorTargetFull {
|
|
1110
1185
|
imports: GeneratorImport[];
|
|
@@ -1117,6 +1192,7 @@ interface GeneratorTargetFull {
|
|
|
1117
1192
|
paramsSerializer?: GeneratorMutator[];
|
|
1118
1193
|
paramsFilter?: GeneratorMutator[];
|
|
1119
1194
|
fetchReviver?: GeneratorMutator[];
|
|
1195
|
+
sharedTypes?: SharedTypeDeclaration[];
|
|
1120
1196
|
}
|
|
1121
1197
|
interface GeneratorOperation {
|
|
1122
1198
|
imports: GeneratorImport[];
|
|
@@ -1197,6 +1273,15 @@ interface ClientFileBuilder {
|
|
|
1197
1273
|
content: string;
|
|
1198
1274
|
}
|
|
1199
1275
|
type ClientExtraFilesBuilder = (verbOptions: Record<string, GeneratorVerbOptions>, output: NormalizedOutputOptions, context: ContextSpec) => Promise<ClientFileBuilder[]>;
|
|
1276
|
+
interface SharedTypeDeclaration {
|
|
1277
|
+
name: string;
|
|
1278
|
+
exported: boolean;
|
|
1279
|
+
code: string;
|
|
1280
|
+
}
|
|
1281
|
+
type HeaderResult = {
|
|
1282
|
+
implementation: string;
|
|
1283
|
+
sharedTypes?: SharedTypeDeclaration[];
|
|
1284
|
+
};
|
|
1200
1285
|
type ClientHeaderBuilder = (params: {
|
|
1201
1286
|
title: string;
|
|
1202
1287
|
isRequestOptions: boolean;
|
|
@@ -1210,7 +1295,7 @@ type ClientHeaderBuilder = (params: {
|
|
|
1210
1295
|
tag?: string;
|
|
1211
1296
|
isDefaultTagBucket?: boolean;
|
|
1212
1297
|
clientImplementation: string;
|
|
1213
|
-
}) => string;
|
|
1298
|
+
}) => string | HeaderResult;
|
|
1214
1299
|
type ClientFooterBuilder = (params: {
|
|
1215
1300
|
noFunction?: boolean | undefined;
|
|
1216
1301
|
operationNames: string[];
|
|
@@ -1395,6 +1480,7 @@ interface WriteModeProps {
|
|
|
1395
1480
|
header: string;
|
|
1396
1481
|
needSchema: boolean;
|
|
1397
1482
|
generateSchemasInline?: () => string;
|
|
1483
|
+
schemaTagMap?: Map<string, string>;
|
|
1398
1484
|
}
|
|
1399
1485
|
interface GeneratorApiOperations {
|
|
1400
1486
|
verbOptions: Record<string, GeneratorVerbOptions>;
|
|
@@ -1404,6 +1490,7 @@ interface GeneratorApiOperations {
|
|
|
1404
1490
|
interface GeneratorClientExtra {
|
|
1405
1491
|
implementation: string;
|
|
1406
1492
|
implementationMock: string;
|
|
1493
|
+
sharedTypes?: SharedTypeDeclaration[];
|
|
1407
1494
|
}
|
|
1408
1495
|
type GeneratorClientTitle = (data: {
|
|
1409
1496
|
outputClient?: OutputClient | OutputClientFunc;
|
|
@@ -1650,7 +1737,6 @@ interface GenerateAxiosOptions {
|
|
|
1650
1737
|
requestOptions?: object | boolean;
|
|
1651
1738
|
hasSignal: boolean;
|
|
1652
1739
|
hasSignalParam?: boolean;
|
|
1653
|
-
isVue: boolean;
|
|
1654
1740
|
isAngular: boolean;
|
|
1655
1741
|
paramsSerializer?: GeneratorMutator;
|
|
1656
1742
|
paramsSerializerOptions?: ParamsSerializerOptions;
|
|
@@ -1668,7 +1754,6 @@ declare function generateAxiosOptions({
|
|
|
1668
1754
|
requestOptions,
|
|
1669
1755
|
hasSignal,
|
|
1670
1756
|
hasSignalParam,
|
|
1671
|
-
isVue,
|
|
1672
1757
|
isAngular,
|
|
1673
1758
|
paramsSerializer,
|
|
1674
1759
|
paramsSerializerOptions,
|
|
@@ -1690,7 +1775,6 @@ interface GenerateOptionsOptions {
|
|
|
1690
1775
|
isExactOptionalPropertyTypes: boolean;
|
|
1691
1776
|
hasSignal: boolean;
|
|
1692
1777
|
hasSignalParam?: boolean;
|
|
1693
|
-
isVue?: boolean;
|
|
1694
1778
|
paramsSerializer?: GeneratorMutator;
|
|
1695
1779
|
paramsSerializerOptions?: ParamsSerializerOptions;
|
|
1696
1780
|
paramsFilter?: GeneratorMutator;
|
|
@@ -1711,13 +1795,12 @@ declare function generateOptions({
|
|
|
1711
1795
|
isExactOptionalPropertyTypes,
|
|
1712
1796
|
hasSignal,
|
|
1713
1797
|
hasSignalParam,
|
|
1714
|
-
isVue,
|
|
1715
1798
|
paramsSerializer,
|
|
1716
1799
|
paramsSerializerOptions,
|
|
1717
1800
|
paramsFilter
|
|
1718
1801
|
}: GenerateOptionsOptions): string;
|
|
1719
1802
|
declare function generateBodyMutatorConfig(body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean): string;
|
|
1720
|
-
declare function generateQueryParamsAxiosConfig(response: GetterResponse,
|
|
1803
|
+
declare function generateQueryParamsAxiosConfig(response: GetterResponse, isAngular: boolean, requiredNullableQueryParamKeys?: string[], queryParams?: GetterQueryParam, paramsFilter?: GeneratorMutator): string;
|
|
1721
1804
|
interface GenerateMutatorConfigOptions {
|
|
1722
1805
|
route: string;
|
|
1723
1806
|
body: GetterBody;
|
|
@@ -1730,7 +1813,6 @@ interface GenerateMutatorConfigOptions {
|
|
|
1730
1813
|
hasSignal: boolean;
|
|
1731
1814
|
hasSignalParam?: boolean;
|
|
1732
1815
|
isExactOptionalPropertyTypes: boolean;
|
|
1733
|
-
isVue?: boolean;
|
|
1734
1816
|
isAngular?: boolean;
|
|
1735
1817
|
paramsFilter?: GeneratorMutator;
|
|
1736
1818
|
}
|
|
@@ -1746,7 +1828,6 @@ declare function generateMutatorConfig({
|
|
|
1746
1828
|
hasSignal,
|
|
1747
1829
|
hasSignalParam,
|
|
1748
1830
|
isExactOptionalPropertyTypes,
|
|
1749
|
-
isVue,
|
|
1750
1831
|
isAngular,
|
|
1751
1832
|
paramsFilter
|
|
1752
1833
|
}: GenerateMutatorConfigOptions): string;
|
|
@@ -2224,6 +2305,27 @@ declare function extractBoundAliasInfo(schema: OpenApiSchemaObject | OpenApiRefe
|
|
|
2224
2305
|
* type entries for self-referential resolution, `$defs` bindings, and sibling anchors.
|
|
2225
2306
|
*/
|
|
2226
2307
|
declare function buildDynamicScope(schemaName: string, schema: OpenApiSchemaObject, context: ContextSpec): Record<string, DynamicScopeEntry>;
|
|
2308
|
+
/**
|
|
2309
|
+
* Build dynamic scope entries for an **anonymous inline** subschema that declares
|
|
2310
|
+
* `$dynamicAnchor` without a `$ref` (e.g. inside `allOf`, `items`, nested props).
|
|
2311
|
+
*
|
|
2312
|
+
* Unlike {@link buildDynamicScope}, entries carry the concrete `inlineSchema` so
|
|
2313
|
+
* that a descendant `$dynamicRef` resolves to the inline override rather than the
|
|
2314
|
+
* outer/global component. Used when `dereference` enters a subschema without a
|
|
2315
|
+
* named component `$ref`.
|
|
2316
|
+
*
|
|
2317
|
+
* Scope of handling (deliberate, see #3492):
|
|
2318
|
+
* - Direct `$dynamicAnchor` on the subschema → inline entry.
|
|
2319
|
+
* - `$defs` `$dynamicAnchor` *without* a `$ref` → inline entry. Note this
|
|
2320
|
+
* differs from `buildDynamicScope`, which treats unbound `$defs` anchors as
|
|
2321
|
+
* generic parameters (`isParameter`); inline subschemas are concrete
|
|
2322
|
+
* instances, so the anchor resolves to the inline schema object itself.
|
|
2323
|
+
* - `$defs` `$dynamicAnchor` *with* a `$ref` → intentionally NOT collected
|
|
2324
|
+
* here. Such anchors rely on `resolveDynamicRef`'s global fallback (which
|
|
2325
|
+
* finds them when the `$ref` target declares the same anchor). Fully
|
|
2326
|
+
* resolving them would duplicate `buildDynamicScope`'s `$defs` logic.
|
|
2327
|
+
*/
|
|
2328
|
+
declare function buildInlineDynamicScope(schema: OpenApiSchemaObject): Record<string, DynamicScopeEntry>;
|
|
2227
2329
|
/**
|
|
2228
2330
|
* Resolve a `$dynamicRef` anchor to its concrete type using the current dynamic scope.
|
|
2229
2331
|
* Returns `{ schema: {}, resolvedTypeName: 'unknown' }` when no scope override exists.
|
|
@@ -2757,6 +2859,51 @@ declare function jsStringLiteralEscape(input: string): string;
|
|
|
2757
2859
|
*/
|
|
2758
2860
|
declare function dedupeUnionType(unionType: string): string;
|
|
2759
2861
|
//#endregion
|
|
2862
|
+
//#region src/utils/tags.d.ts
|
|
2863
|
+
/**
|
|
2864
|
+
* Canonical bucket key for a single OpenAPI tag.
|
|
2865
|
+
*
|
|
2866
|
+
* In `tags` / `tags-split` mode operations are routed into files by their first
|
|
2867
|
+
* tag. This function is the **single source of truth** for turning a tag (or a
|
|
2868
|
+
* missing tag) into the key that identifies that file bucket. Every place that
|
|
2869
|
+
* groups operations by tag, derives a per-tag file/directory name, or checks
|
|
2870
|
+
* whether an operation belongs to a tag MUST go through here so that the
|
|
2871
|
+
* "build the key" side and the "look the key up" side can never disagree.
|
|
2872
|
+
*
|
|
2873
|
+
* The result is `kebab`-cased. `kebab` is idempotent
|
|
2874
|
+
* (`kebab(kebab(x)) === kebab(x)`), so it is always safe to call this on a value
|
|
2875
|
+
* that is already a canonical key. Other case functions (`camel`, `pascal`) are
|
|
2876
|
+
* NOT safe here: they do not round-trip through the bucket key for tags
|
|
2877
|
+
* containing acronyms or spaces (e.g. `"AB Widget"`), which is exactly the class
|
|
2878
|
+
* of bug this module exists to prevent.
|
|
2879
|
+
*
|
|
2880
|
+
* Missing or empty tags map to the implicit {@link DefaultTag} bucket.
|
|
2881
|
+
*/
|
|
2882
|
+
declare function getTagKey(tag?: string): string;
|
|
2883
|
+
/**
|
|
2884
|
+
* Canonical bucket key for an operation, derived from its primary (first) tag.
|
|
2885
|
+
*
|
|
2886
|
+
* Untagged operations resolve to the {@link DefaultTag} bucket.
|
|
2887
|
+
*/
|
|
2888
|
+
declare function getOperationTagKey(operation: {
|
|
2889
|
+
tags: string[];
|
|
2890
|
+
}): string;
|
|
2891
|
+
/**
|
|
2892
|
+
* Whether an operation belongs to the given tag bucket.
|
|
2893
|
+
*
|
|
2894
|
+
* Both sides are normalised through {@link getTagKey}, so the comparison is
|
|
2895
|
+
* correct regardless of how `tagKey` was spelled or cased by the caller. An
|
|
2896
|
+
* absent (`undefined`) `tagKey` matches every operation (the "no tag filter"
|
|
2897
|
+
* case); an empty/whitespace `tagKey` is normalised to the {@link DefaultTag}
|
|
2898
|
+
* bucket like any other tag.
|
|
2899
|
+
*
|
|
2900
|
+
* Prefer this over hand-rolling `operation.tags[0] === tagKey`: a raw tag
|
|
2901
|
+
* compared against a canonical key silently fails for multi-word/acronym tags.
|
|
2902
|
+
*/
|
|
2903
|
+
declare function isOperationInTagBucket(operation: {
|
|
2904
|
+
tags: string[];
|
|
2905
|
+
}, tagKey?: string): boolean;
|
|
2906
|
+
//#endregion
|
|
2760
2907
|
//#region src/utils/tsconfig.d.ts
|
|
2761
2908
|
declare function isSyntheticDefaultImportsAllow(config?: Tsconfig): boolean;
|
|
2762
2909
|
declare function getImportExtension(fileExtension: string, tsconfig?: Tsconfig): string;
|
|
@@ -2771,6 +2918,10 @@ declare function getImportExtension(fileExtension: string, tsconfig?: Tsconfig):
|
|
|
2771
2918
|
*/
|
|
2772
2919
|
declare function writeGeneratedFile(filePath: string, content: string): Promise<void>;
|
|
2773
2920
|
//#endregion
|
|
2921
|
+
//#region src/writers/schema-tag-mapper.d.ts
|
|
2922
|
+
declare const SHARED_DIR = ".";
|
|
2923
|
+
declare function buildSchemaTagMap(operations: ReadonlyArray<Pick<GeneratorOperation, 'imports' | 'tags'>>, schemas: GeneratorSchema[]): Map<string, string>;
|
|
2924
|
+
//#endregion
|
|
2774
2925
|
//#region src/writers/schemas.d.ts
|
|
2775
2926
|
/**
|
|
2776
2927
|
* Split schemas into regular and operation types.
|
|
@@ -2830,6 +2981,35 @@ declare function writeSchemas({
|
|
|
2830
2981
|
factoryOutputDirectory
|
|
2831
2982
|
}: WriteSchemasOptions): Promise<void>;
|
|
2832
2983
|
//#endregion
|
|
2984
|
+
//#region src/writers/schemas-tags-split.d.ts
|
|
2985
|
+
interface WriteSchemasTagsSplitOptions {
|
|
2986
|
+
schemaPath: string;
|
|
2987
|
+
schemas: GeneratorSchema[];
|
|
2988
|
+
target: string;
|
|
2989
|
+
namingConvention: NamingConvention;
|
|
2990
|
+
fileExtension: string;
|
|
2991
|
+
header: string;
|
|
2992
|
+
indexFiles: boolean;
|
|
2993
|
+
tsconfig?: Tsconfig;
|
|
2994
|
+
factoryOutputDirectory?: string;
|
|
2995
|
+
operations: ReadonlyArray<{
|
|
2996
|
+
imports: GeneratorImport[];
|
|
2997
|
+
tags: string[];
|
|
2998
|
+
}>;
|
|
2999
|
+
}
|
|
3000
|
+
declare function writeSchemasTagsSplit({
|
|
3001
|
+
schemaPath,
|
|
3002
|
+
schemas,
|
|
3003
|
+
target,
|
|
3004
|
+
namingConvention,
|
|
3005
|
+
fileExtension,
|
|
3006
|
+
header,
|
|
3007
|
+
indexFiles,
|
|
3008
|
+
tsconfig,
|
|
3009
|
+
factoryOutputDirectory,
|
|
3010
|
+
operations
|
|
3011
|
+
}: WriteSchemasTagsSplitOptions): Promise<void>;
|
|
3012
|
+
//#endregion
|
|
2833
3013
|
//#region src/writers/single-mode.d.ts
|
|
2834
3014
|
declare function writeSingleMode({
|
|
2835
3015
|
builder,
|
|
@@ -2837,7 +3017,8 @@ declare function writeSingleMode({
|
|
|
2837
3017
|
projectName,
|
|
2838
3018
|
header,
|
|
2839
3019
|
needSchema,
|
|
2840
|
-
generateSchemasInline
|
|
3020
|
+
generateSchemasInline,
|
|
3021
|
+
schemaTagMap
|
|
2841
3022
|
}: WriteModeProps): Promise<string[]>;
|
|
2842
3023
|
//#endregion
|
|
2843
3024
|
//#region src/writers/split-mode.d.ts
|
|
@@ -2847,7 +3028,8 @@ declare function writeSplitMode({
|
|
|
2847
3028
|
projectName,
|
|
2848
3029
|
header,
|
|
2849
3030
|
needSchema,
|
|
2850
|
-
generateSchemasInline
|
|
3031
|
+
generateSchemasInline,
|
|
3032
|
+
schemaTagMap
|
|
2851
3033
|
}: WriteModeProps): Promise<string[]>;
|
|
2852
3034
|
//#endregion
|
|
2853
3035
|
//#region src/writers/split-tags-mode.d.ts
|
|
@@ -2857,7 +3039,8 @@ declare function writeSplitTagsMode({
|
|
|
2857
3039
|
projectName,
|
|
2858
3040
|
header,
|
|
2859
3041
|
needSchema,
|
|
2860
|
-
generateSchemasInline
|
|
3042
|
+
generateSchemasInline,
|
|
3043
|
+
schemaTagMap
|
|
2861
3044
|
}: WriteModeProps): Promise<string[]>;
|
|
2862
3045
|
//#endregion
|
|
2863
3046
|
//#region src/writers/tags-mode.d.ts
|
|
@@ -2867,7 +3050,8 @@ declare function writeTagsMode({
|
|
|
2867
3050
|
projectName,
|
|
2868
3051
|
header,
|
|
2869
3052
|
needSchema,
|
|
2870
|
-
generateSchemasInline
|
|
3053
|
+
generateSchemasInline,
|
|
3054
|
+
schemaTagMap
|
|
2871
3055
|
}: WriteModeProps): Promise<string[]>;
|
|
2872
3056
|
//#endregion
|
|
2873
3057
|
//#region src/writers/target.d.ts
|
|
@@ -2880,5 +3064,5 @@ declare function generateTargetForTags(builder: WriteSpecBuilder, options: Norma
|
|
|
2880
3064
|
declare function getOrvalGeneratedTypes(): string;
|
|
2881
3065
|
declare function getTypedResponse(): string;
|
|
2882
3066
|
//#endregion
|
|
2883
|
-
export { AngularHttpResourceOptions, AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, BaseUrlRuntime, BoundAliasInfo, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, CommonMockOptions, Config, ConfigExternal, ConfigFn, ContentTypeFilter, ContextSpec, DeepNonNullable, DefaultTag, DynamicScopeEntry, EffectOptions, EnumGeneration, ErrorWithTag, FactoryMethodsMode, FactoryMethodsOptions, FakerMockOptions, FetchOptions, FinalizeMockImplementationOptions, FormDataArrayHandling, FormDataContext, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMockOutput, GeneratorMockOutputFull, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HonoHandlerStrategy, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, InvalidateTargetParam, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, McpOptions, McpServerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MswMockOptions, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NAMED_COMPONENT_SECTIONS, NamingConvention, NormalizedAngularOptions, NormalizedConfig, NormalizedEffectOptions, NormalizedFactoryMethodsOptions, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMcpOptions, NormalizedMcpServerOptions, NormalizedMocksConfig, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, OpenApiDynamicReferenceObject, OpenApiEncodingObject, OpenApiExampleObject, OpenApiInfoObject, OpenApiMediaTypeObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiPathItemObject, OpenApiPathsObject, OpenApiReferenceObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiResponsesObject, OpenApiSchemaObject, OpenApiSchemaObjectType, OpenApiSchemasObject, OpenApiServerObject, OperationOptions, Options, OptionsExport, OptionsFn, OutputClient, OutputClientFunc, OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMocksConfig, OutputMocksOption, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PreferredContentType, PropertySortOrder, QueryOptions, ReadonlyRequestBodiesMode, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, ScalarValue, SchemaGenerationType, SchemaOptionLike, SchemaOptions, SchemaType, StrictMockSchemaKind, SupportedFormatter, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigModule, TsConfigModuleResolution, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, addDependency, asyncReduce, buildAngularParamsFilterExpression, buildDynamicScope, camel, collectReferencedComponents, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicAnchorToParamName, dynamicAnchorsToUniqueParamNames, dynamicImport, escape, escapeRegExp, extractBoundAliasInfo, filterByContentType, filteredVerbs, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFactory, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getAngularFilteredParamsCallExpression, getAngularFilteredParamsExpression, getAngularFilteredParamsHelperBody, getArray, getBaseUrlRuntimeImports, getBodiesByContentType, getBody, getCombinedEnumValue, getDefaultContentType, getDynamicAnchorName, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getImportExtension, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getSchemasImportPath, getSuccessResponseType, getTypedResponse, getWarningCount, isBinaryContentType, isBinaryScalarSchema, isBoolean, isComponentRef, isDirectory, isDynamicReference, isFakerMock, isFunction, isModule, isMswMock, isNullish, isNumber, isNumeric, isObject, isReference, isSchema, isString, isStringLike, isSyntheticDefaultImportsAllow, isUrl, isVerb, isVerbose, jsDoc, jsStringEscape, jsStringLiteralEscape, kebab, keyValuePairsToJsDoc, log, logError, logVerbose, logWarning, makeRouteSafe, mergeDeep, mismatchArgsMessage, pascal, removeFilesAndEmptyFolders, resetWarnings, resolveDiscriminators, resolveDynamicRef, resolveExampleRefs, resolveInstalledVersion, resolveInstalledVersions, resolveObject, resolveRef, resolveValue, sanitize, setVerbose, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, wrapRouteParameters, writeGeneratedFile, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
3067
|
+
export { AngularHttpResourceOptions, AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, BaseUrlRuntime, BoundAliasInfo, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, CommonMockOptions, Config, ConfigExternal, ConfigFn, ContentTypeFilter, ContextSpec, DeepNonNullable, DefaultTag, DynamicScopeEntry, EffectOptions, EnumGeneration, ErrorWithTag, FactoryMethodsMode, FactoryMethodsOptions, FakerMockOptions, FetchOptions, FinalizeMockImplementationOptions, FormDataArrayHandling, FormDataContext, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMockOutput, GeneratorMockOutputFull, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HeaderResult, HonoHandlerStrategy, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, InvalidateTargetParam, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, McpOptions, McpServerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MswMockOptions, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NAMED_COMPONENT_SECTIONS, NamingConvention, NormalizedAngularOptions, NormalizedConfig, NormalizedEffectOptions, NormalizedFactoryMethodsOptions, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMcpOptions, NormalizedMcpServerOptions, NormalizedMocksConfig, NormalizedMutator, NormalizedOperationOptions, NormalizedOperationZodOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, OpenApiDynamicReferenceObject, OpenApiEncodingObject, OpenApiExampleObject, OpenApiInfoObject, OpenApiMediaTypeObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiPathItemObject, OpenApiPathsObject, OpenApiReferenceObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiResponsesObject, OpenApiSchemaObject, OpenApiSchemaObjectType, OpenApiSchemasObject, OpenApiServerObject, OperationOptions, OperationZodOptions, Options, OptionsExport, OptionsFn, OutputClient, OutputClientFunc, OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMocksConfig, OutputMocksOption, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PreferredContentType, PropertySortOrder, QueryOptions, ReadonlyRequestBodiesMode, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, SHARED_DIR, ScalarValue, SchemaGenerationType, SchemaOptionLike, SchemaOptions, SchemaType, SharedTypeDeclaration, StrictMockSchemaKind, SupportedFormatter, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigModule, TsConfigModuleResolution, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, ZodVersionOption, addDependency, asyncReduce, buildAngularParamsFilterExpression, buildDynamicScope, buildInlineDynamicScope, buildSchemaTagMap, camel, collectReferencedComponents, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicAnchorToParamName, dynamicAnchorsToUniqueParamNames, dynamicImport, escape, escapeRegExp, extractBoundAliasInfo, filterByContentType, filteredVerbs, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFactory, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getAngularFilteredParamsCallExpression, getAngularFilteredParamsExpression, getAngularFilteredParamsHelperBody, getArray, getBaseUrlRuntimeImports, getBodiesByContentType, getBody, getCombinedEnumValue, getDefaultContentType, getDynamicAnchorName, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getImportExtension, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOperationTagKey, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getSchemasImportPath, getSuccessResponseType, getTagKey, getTypedResponse, getWarningCount, isBinaryContentType, isBinaryScalarSchema, isBoolean, isComponentRef, isDirectory, isDynamicReference, isFakerMock, isFunction, isModule, isMswMock, isNullish, isNumber, isNumeric, isObject, isOperationInTagBucket, isReference, isSchema, isString, isStringLike, isSyntheticDefaultImportsAllow, isUrl, isVerb, isVerbose, jsDoc, jsStringEscape, jsStringLiteralEscape, kebab, keyValuePairsToJsDoc, log, logError, logVerbose, logWarning, makeRouteSafe, mergeDeep, mismatchArgsMessage, pascal, removeFilesAndEmptyFolders, resetWarnings, resolveDiscriminators, resolveDynamicRef, resolveExampleRefs, resolveInstalledVersion, resolveInstalledVersions, resolveObject, resolveRef, resolveValue, sanitize, setVerbose, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, wrapRouteParameters, writeGeneratedFile, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSchemasTagsSplit, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
2884
3068
|
//# sourceMappingURL=index.d.mts.map
|