@orval/core 8.1.0 → 8.3.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 +150 -74
- package/dist/index.mjs +1524 -1332
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isBoolean, isFunction, isNullish, isNumber, isString } from "remeda";
|
|
1
2
|
import { CompareOperator } from "compare-versions";
|
|
2
3
|
import debug from "debug";
|
|
3
4
|
import { allLocales } from "@faker-js/faker";
|
|
@@ -49,7 +50,7 @@ type NormalizedOutputOptions = {
|
|
|
49
50
|
propertySortOrder: PropertySortOrder;
|
|
50
51
|
};
|
|
51
52
|
type NormalizedParamsSerializerOptions = {
|
|
52
|
-
qs?: Record<string,
|
|
53
|
+
qs?: Record<string, unknown>;
|
|
53
54
|
};
|
|
54
55
|
type NormalizedOverrideOutput = {
|
|
55
56
|
title?: (title: string) => string;
|
|
@@ -89,7 +90,7 @@ type NormalizedOverrideOutput = {
|
|
|
89
90
|
zod: NormalizedZodOptions;
|
|
90
91
|
fetch: NormalizedFetchOptions;
|
|
91
92
|
operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
|
|
92
|
-
requestOptions: Record<string,
|
|
93
|
+
requestOptions: Record<string, unknown> | boolean;
|
|
93
94
|
useDates?: boolean;
|
|
94
95
|
useTypeOverInterfaces?: boolean;
|
|
95
96
|
useDeprecatedOperations?: boolean;
|
|
@@ -319,7 +320,7 @@ type MutatorObject = {
|
|
|
319
320
|
};
|
|
320
321
|
type Mutator = string | MutatorObject;
|
|
321
322
|
type ParamsSerializerOptions = {
|
|
322
|
-
qs?: Record<string,
|
|
323
|
+
qs?: Record<string, unknown>;
|
|
323
324
|
};
|
|
324
325
|
declare const FormDataArrayHandling: {
|
|
325
326
|
readonly SERIALIZE: "serialize";
|
|
@@ -381,7 +382,7 @@ type OverrideOutput = {
|
|
|
381
382
|
zod?: ZodOptions;
|
|
382
383
|
operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
|
|
383
384
|
fetch?: FetchOptions;
|
|
384
|
-
requestOptions?: Record<string,
|
|
385
|
+
requestOptions?: Record<string, unknown> | boolean;
|
|
385
386
|
useDates?: boolean;
|
|
386
387
|
useTypeOverInterfaces?: boolean;
|
|
387
388
|
useDeprecatedOperations?: boolean;
|
|
@@ -398,13 +399,13 @@ type OverrideOutput = {
|
|
|
398
399
|
useNullForOptional?: boolean;
|
|
399
400
|
};
|
|
400
401
|
type JsDocOptions = {
|
|
401
|
-
filter?: (schema: Record<string,
|
|
402
|
+
filter?: (schema: Record<string, unknown>) => {
|
|
402
403
|
key: string;
|
|
403
404
|
value: string;
|
|
404
405
|
}[];
|
|
405
406
|
};
|
|
406
407
|
type NormalizedJsDocOptions = {
|
|
407
|
-
filter?: (schema: Record<string,
|
|
408
|
+
filter?: (schema: Record<string, unknown>) => {
|
|
408
409
|
key: string;
|
|
409
410
|
value: string;
|
|
410
411
|
}[];
|
|
@@ -496,7 +497,8 @@ type NormalizedZodOptions = {
|
|
|
496
497
|
};
|
|
497
498
|
type InvalidateTarget = string | {
|
|
498
499
|
query: string;
|
|
499
|
-
params
|
|
500
|
+
params?: string[] | Record<string, string>;
|
|
501
|
+
invalidateMode?: 'invalidate' | 'reset';
|
|
500
502
|
};
|
|
501
503
|
type MutationInvalidatesRule = {
|
|
502
504
|
onMutations: string[];
|
|
@@ -518,7 +520,7 @@ type NormalizedQueryOptions = {
|
|
|
518
520
|
useInfiniteQueryParam?: string;
|
|
519
521
|
usePrefetch?: boolean;
|
|
520
522
|
useInvalidate?: boolean;
|
|
521
|
-
options?:
|
|
523
|
+
options?: Record<string, unknown>;
|
|
522
524
|
queryKey?: NormalizedMutator;
|
|
523
525
|
queryOptions?: NormalizedMutator;
|
|
524
526
|
mutationOptions?: NormalizedMutator;
|
|
@@ -530,6 +532,7 @@ type NormalizedQueryOptions = {
|
|
|
530
532
|
signal?: boolean;
|
|
531
533
|
version?: 3 | 4 | 5;
|
|
532
534
|
mutationInvalidates?: MutationInvalidatesConfig;
|
|
535
|
+
runtimeValidation?: boolean;
|
|
533
536
|
};
|
|
534
537
|
type QueryOptions = {
|
|
535
538
|
useQuery?: boolean;
|
|
@@ -540,7 +543,7 @@ type QueryOptions = {
|
|
|
540
543
|
useInfiniteQueryParam?: string;
|
|
541
544
|
usePrefetch?: boolean;
|
|
542
545
|
useInvalidate?: boolean;
|
|
543
|
-
options?:
|
|
546
|
+
options?: Record<string, unknown>;
|
|
544
547
|
queryKey?: Mutator;
|
|
545
548
|
queryOptions?: Mutator;
|
|
546
549
|
mutationOptions?: Mutator;
|
|
@@ -552,6 +555,7 @@ type QueryOptions = {
|
|
|
552
555
|
signal?: boolean;
|
|
553
556
|
version?: 3 | 4 | 5;
|
|
554
557
|
mutationInvalidates?: MutationInvalidatesConfig;
|
|
558
|
+
runtimeValidation?: boolean;
|
|
555
559
|
};
|
|
556
560
|
type AngularOptions = {
|
|
557
561
|
provideIn?: 'root' | 'any' | boolean;
|
|
@@ -601,7 +605,7 @@ type OperationOptions = {
|
|
|
601
605
|
requestOptions?: object | boolean;
|
|
602
606
|
};
|
|
603
607
|
type Hook = 'afterAllFilesWrite';
|
|
604
|
-
type HookFunction = (...args:
|
|
608
|
+
type HookFunction = (...args: unknown[]) => void | Promise<void>;
|
|
605
609
|
interface HookOption {
|
|
606
610
|
command: string | HookFunction;
|
|
607
611
|
injectGeneratedDirsAndFiles?: boolean;
|
|
@@ -944,8 +948,8 @@ type ScalarValue = {
|
|
|
944
948
|
schemas: GeneratorSchema[];
|
|
945
949
|
isRef: boolean;
|
|
946
950
|
dependencies: string[];
|
|
947
|
-
example?:
|
|
948
|
-
examples?: Record<string,
|
|
951
|
+
example?: unknown;
|
|
952
|
+
examples?: Record<string, unknown>;
|
|
949
953
|
};
|
|
950
954
|
type ResolverValue = ScalarValue & {
|
|
951
955
|
originalSchema: OpenApiSchemaObject;
|
|
@@ -1120,7 +1124,6 @@ declare function addDependency({
|
|
|
1120
1124
|
exports,
|
|
1121
1125
|
dependency,
|
|
1122
1126
|
projectName,
|
|
1123
|
-
hasSchemaDir,
|
|
1124
1127
|
isAllowSyntheticDefaultImports
|
|
1125
1128
|
}: AddDependencyOptions): string | undefined;
|
|
1126
1129
|
declare function generateDependencyImports(implementation: string, imports: {
|
|
@@ -1286,6 +1289,7 @@ interface GenerateVerbOptionsParams {
|
|
|
1286
1289
|
verbParameters?: OpenApiPathItemObject['parameters'];
|
|
1287
1290
|
components?: OpenApiComponentsObject;
|
|
1288
1291
|
context: ContextSpec;
|
|
1292
|
+
contentType?: string;
|
|
1289
1293
|
}
|
|
1290
1294
|
declare function generateVerbOptions({
|
|
1291
1295
|
verb,
|
|
@@ -1294,7 +1298,8 @@ declare function generateVerbOptions({
|
|
|
1294
1298
|
route,
|
|
1295
1299
|
pathRoute,
|
|
1296
1300
|
verbParameters,
|
|
1297
|
-
context
|
|
1301
|
+
context,
|
|
1302
|
+
contentType
|
|
1298
1303
|
}: GenerateVerbOptionsParams): Promise<GeneratorVerbOptions>;
|
|
1299
1304
|
interface GenerateVerbsOptionsParams {
|
|
1300
1305
|
verbs: OpenApiPathItemObject;
|
|
@@ -1314,11 +1319,61 @@ declare function generateVerbsOptions({
|
|
|
1314
1319
|
}: GenerateVerbsOptionsParams): Promise<GeneratorVerbsOptions>;
|
|
1315
1320
|
declare function _filteredVerbs(verbs: OpenApiPathItemObject, filters: NormalizedInputOptions['filters']): [string, any][];
|
|
1316
1321
|
//#endregion
|
|
1322
|
+
//#region src/getters/object.d.ts
|
|
1323
|
+
/**
|
|
1324
|
+
* Context for multipart/form-data type generation.
|
|
1325
|
+
* Discriminated union with two states:
|
|
1326
|
+
*
|
|
1327
|
+
* 1. `{ atPart: false, encoding }` - At form-data root, before property iteration
|
|
1328
|
+
* - May traverse through allOf/anyOf/oneOf to reach properties
|
|
1329
|
+
* - Carries encoding map so getObject can look up `encoding[key]`
|
|
1330
|
+
*
|
|
1331
|
+
* 2. `{ atPart: true, partContentType }` - At a multipart part (top-level property)
|
|
1332
|
+
* - `partContentType` = Encoding Object's `contentType` for this part
|
|
1333
|
+
* - Used by getScalar for file type detection (precedence over contentMediaType)
|
|
1334
|
+
* - Arrays pass this through to items; combiners inside arrays also get context
|
|
1335
|
+
*
|
|
1336
|
+
* `undefined` means not in form-data context (or nested inside plain object field = JSON)
|
|
1337
|
+
*/
|
|
1338
|
+
type FormDataContext = {
|
|
1339
|
+
atPart: false;
|
|
1340
|
+
encoding: Record<string, {
|
|
1341
|
+
contentType?: string;
|
|
1342
|
+
}>;
|
|
1343
|
+
} | {
|
|
1344
|
+
atPart: true;
|
|
1345
|
+
partContentType?: string;
|
|
1346
|
+
};
|
|
1347
|
+
interface GetObjectOptions {
|
|
1348
|
+
item: OpenApiSchemaObject;
|
|
1349
|
+
name?: string;
|
|
1350
|
+
context: ContextSpec;
|
|
1351
|
+
nullable: string;
|
|
1352
|
+
/**
|
|
1353
|
+
* Multipart/form-data context for file type handling.
|
|
1354
|
+
* @see FormDataContext
|
|
1355
|
+
*/
|
|
1356
|
+
formDataContext?: FormDataContext;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Return the output type from an object
|
|
1360
|
+
*
|
|
1361
|
+
* @param item item with type === "object"
|
|
1362
|
+
*/
|
|
1363
|
+
declare function getObject({
|
|
1364
|
+
item,
|
|
1365
|
+
name,
|
|
1366
|
+
context,
|
|
1367
|
+
nullable,
|
|
1368
|
+
formDataContext
|
|
1369
|
+
}: GetObjectOptions): ScalarValue;
|
|
1370
|
+
//#endregion
|
|
1317
1371
|
//#region src/getters/array.d.ts
|
|
1318
1372
|
interface GetArrayOptions {
|
|
1319
1373
|
schema: OpenApiSchemaObject;
|
|
1320
1374
|
name?: string;
|
|
1321
1375
|
context: ContextSpec;
|
|
1376
|
+
formDataContext?: FormDataContext;
|
|
1322
1377
|
}
|
|
1323
1378
|
/**
|
|
1324
1379
|
* Return the output type from an array
|
|
@@ -1328,7 +1383,8 @@ interface GetArrayOptions {
|
|
|
1328
1383
|
declare function getArray({
|
|
1329
1384
|
schema,
|
|
1330
1385
|
name,
|
|
1331
|
-
context
|
|
1386
|
+
context,
|
|
1387
|
+
formDataContext
|
|
1332
1388
|
}: GetArrayOptions): ScalarValue;
|
|
1333
1389
|
//#endregion
|
|
1334
1390
|
//#region src/getters/body.d.ts
|
|
@@ -1338,6 +1394,10 @@ interface GetBodyOptions {
|
|
|
1338
1394
|
context: ContextSpec;
|
|
1339
1395
|
contentType?: OverrideOutputContentType;
|
|
1340
1396
|
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Extract all content types from a requestBody (#2812)
|
|
1399
|
+
*/
|
|
1400
|
+
declare function getRequestBodyContentTypes(requestBody: OpenApiOperationObject['requestBody'], context: ContextSpec): string[];
|
|
1341
1401
|
declare function getBody({
|
|
1342
1402
|
requestBody,
|
|
1343
1403
|
operationName,
|
|
@@ -1352,13 +1412,15 @@ declare function combineSchemas({
|
|
|
1352
1412
|
schema,
|
|
1353
1413
|
separator,
|
|
1354
1414
|
context,
|
|
1355
|
-
nullable
|
|
1415
|
+
nullable,
|
|
1416
|
+
formDataContext
|
|
1356
1417
|
}: {
|
|
1357
1418
|
name?: string;
|
|
1358
1419
|
schema: OpenApiSchemaObject;
|
|
1359
1420
|
separator: Separator;
|
|
1360
1421
|
context: ContextSpec;
|
|
1361
1422
|
nullable: string;
|
|
1423
|
+
formDataContext?: FormDataContext;
|
|
1362
1424
|
}): ScalarValue;
|
|
1363
1425
|
//#endregion
|
|
1364
1426
|
//#region src/getters/discriminators.d.ts
|
|
@@ -1379,37 +1441,12 @@ type CombinedEnumValue = {
|
|
|
1379
1441
|
valueImports: string[];
|
|
1380
1442
|
hasNull: boolean;
|
|
1381
1443
|
};
|
|
1382
|
-
declare function getEnumUnionFromSchema(schema: OpenApiSchemaObject | undefined):
|
|
1444
|
+
declare function getEnumUnionFromSchema(schema: OpenApiSchemaObject | undefined): string;
|
|
1383
1445
|
declare function getCombinedEnumValue(inputs: CombinedEnumInput[]): CombinedEnumValue;
|
|
1384
1446
|
//#endregion
|
|
1385
1447
|
//#region src/getters/keys.d.ts
|
|
1386
1448
|
declare function getKey(key: string): string;
|
|
1387
1449
|
//#endregion
|
|
1388
|
-
//#region src/getters/object.d.ts
|
|
1389
|
-
interface GetObjectOptions {
|
|
1390
|
-
item: OpenApiSchemaObject;
|
|
1391
|
-
name?: string;
|
|
1392
|
-
context: ContextSpec;
|
|
1393
|
-
nullable: string;
|
|
1394
|
-
/**
|
|
1395
|
-
* Override resolved values for properties at THIS level only.
|
|
1396
|
-
* Not passed to nested schemas. Used by form-data for file type handling.
|
|
1397
|
-
*/
|
|
1398
|
-
propertyOverrides?: Record<string, ScalarValue>;
|
|
1399
|
-
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Return the output type from an object
|
|
1402
|
-
*
|
|
1403
|
-
* @param item item with type === "object"
|
|
1404
|
-
*/
|
|
1405
|
-
declare function getObject({
|
|
1406
|
-
item,
|
|
1407
|
-
name,
|
|
1408
|
-
context,
|
|
1409
|
-
nullable,
|
|
1410
|
-
propertyOverrides
|
|
1411
|
-
}: GetObjectOptions): ScalarValue;
|
|
1412
|
-
//#endregion
|
|
1413
1450
|
//#region src/getters/operation.d.ts
|
|
1414
1451
|
declare function getOperationId(operation: OpenApiOperationObject, route: string, verb: Verbs): string;
|
|
1415
1452
|
//#endregion
|
|
@@ -1505,7 +1542,6 @@ declare function getRefInfo($ref: string, context: ContextSpec): RefInfo;
|
|
|
1505
1542
|
//#endregion
|
|
1506
1543
|
//#region src/getters/res-req-types.d.ts
|
|
1507
1544
|
declare function getResReqTypes(responsesOrRequests: [string, OpenApiReferenceObject | OpenApiResponseObject | OpenApiRequestBodyObject][], name: string, context: ContextSpec, defaultType?: string, uniqueKey?: (item: ResReqTypesValue, index: number, data: ResReqTypesValue[]) => unknown): ResReqTypesValue[];
|
|
1508
|
-
declare function isBinaryContentType(contentType: string): boolean;
|
|
1509
1545
|
/**
|
|
1510
1546
|
* Response type categories for HTTP client response parsing.
|
|
1511
1547
|
* Maps to Angular HttpClient's responseType, Axios responseType, and Fetch response methods.
|
|
@@ -1527,16 +1563,6 @@ declare function getResponseTypeCategory(contentType: string): ResponseTypeCateg
|
|
|
1527
1563
|
* @returns The default content type to use
|
|
1528
1564
|
*/
|
|
1529
1565
|
declare function getDefaultContentType(contentTypes: string[]): string;
|
|
1530
|
-
/**
|
|
1531
|
-
* Determine if a form-data root field should be treated as binary or text file
|
|
1532
|
-
* based on encoding.contentType or contentMediaType.
|
|
1533
|
-
*
|
|
1534
|
-
* Returns:
|
|
1535
|
-
* - 'binary': field is a binary file (Blob in types, File in zod)
|
|
1536
|
-
* - 'text': field is a text file that can accept string (Blob | string in types, File | string in zod)
|
|
1537
|
-
* - undefined: no override, use standard resolution
|
|
1538
|
-
*/
|
|
1539
|
-
declare function getFormDataFieldFileType(resolvedSchema: OpenApiSchemaObject, encodingContentType: string | undefined): 'binary' | 'text' | undefined;
|
|
1540
1566
|
//#endregion
|
|
1541
1567
|
//#region src/getters/response.d.ts
|
|
1542
1568
|
interface GetResponseOptions {
|
|
@@ -1562,6 +1588,7 @@ interface GetScalarOptions {
|
|
|
1562
1588
|
item: OpenApiSchemaObject;
|
|
1563
1589
|
name?: string;
|
|
1564
1590
|
context: ContextSpec;
|
|
1591
|
+
formDataContext?: FormDataContext;
|
|
1565
1592
|
}
|
|
1566
1593
|
/**
|
|
1567
1594
|
* Return the typescript equivalent of open-api data type
|
|
@@ -1572,7 +1599,8 @@ interface GetScalarOptions {
|
|
|
1572
1599
|
declare function getScalar({
|
|
1573
1600
|
item,
|
|
1574
1601
|
name,
|
|
1575
|
-
context
|
|
1602
|
+
context,
|
|
1603
|
+
formDataContext
|
|
1576
1604
|
}: GetScalarOptions): ScalarValue;
|
|
1577
1605
|
//#endregion
|
|
1578
1606
|
//#region src/resolvers/object.d.ts
|
|
@@ -1581,6 +1609,7 @@ interface ResolveOptions {
|
|
|
1581
1609
|
propName?: string;
|
|
1582
1610
|
combined?: boolean;
|
|
1583
1611
|
context: ContextSpec;
|
|
1612
|
+
formDataContext?: FormDataContext;
|
|
1584
1613
|
}
|
|
1585
1614
|
interface CreateTypeAliasOptions {
|
|
1586
1615
|
resolvedValue: ResolverValue;
|
|
@@ -1600,7 +1629,8 @@ declare function resolveObject({
|
|
|
1600
1629
|
schema,
|
|
1601
1630
|
propName,
|
|
1602
1631
|
combined,
|
|
1603
|
-
context
|
|
1632
|
+
context,
|
|
1633
|
+
formDataContext
|
|
1604
1634
|
}: ResolveOptions): ResolverValue;
|
|
1605
1635
|
//#endregion
|
|
1606
1636
|
//#region src/resolvers/ref.d.ts
|
|
@@ -1617,11 +1647,13 @@ interface ResolveValueOptions {
|
|
|
1617
1647
|
schema: OpenApiSchemaObject | OpenApiReferenceObject;
|
|
1618
1648
|
name?: string;
|
|
1619
1649
|
context: ContextSpec;
|
|
1650
|
+
formDataContext?: FormDataContext;
|
|
1620
1651
|
}
|
|
1621
1652
|
declare function resolveValue({
|
|
1622
1653
|
schema,
|
|
1623
1654
|
name,
|
|
1624
|
-
context
|
|
1655
|
+
context,
|
|
1656
|
+
formDataContext
|
|
1625
1657
|
}: ResolveValueOptions): ResolverValue;
|
|
1626
1658
|
//#endregion
|
|
1627
1659
|
//#region src/utils/assertion.d.ts
|
|
@@ -1631,16 +1663,11 @@ declare function resolveValue({
|
|
|
1631
1663
|
* @param property
|
|
1632
1664
|
*/
|
|
1633
1665
|
declare function isReference(obj: object): obj is OpenApiReferenceObject;
|
|
1634
|
-
declare function isDirectory(
|
|
1635
|
-
declare function isObject(x:
|
|
1636
|
-
declare function
|
|
1637
|
-
declare function
|
|
1638
|
-
declare function
|
|
1639
|
-
declare function isNumeric(x: any): x is number;
|
|
1640
|
-
declare function isBoolean(x: any): x is boolean;
|
|
1641
|
-
declare function isFunction(x: any): x is Function;
|
|
1642
|
-
declare function isUndefined(x: any): x is undefined;
|
|
1643
|
-
declare function isNull(x: any): x is null;
|
|
1666
|
+
declare function isDirectory(pathValue: string): boolean;
|
|
1667
|
+
declare function isObject(x: unknown): x is Record<string, unknown>;
|
|
1668
|
+
declare function isStringLike(val: unknown): val is string;
|
|
1669
|
+
declare function isModule(x: unknown): x is Record<string, unknown>;
|
|
1670
|
+
declare function isNumeric(x: unknown): x is number;
|
|
1644
1671
|
declare function isSchema(x: unknown): x is OpenApiSchemaObject;
|
|
1645
1672
|
declare function isVerb(verb: string): verb is Verbs;
|
|
1646
1673
|
declare function isUrl(str: string): boolean;
|
|
@@ -1649,8 +1676,8 @@ declare function isUrl(str: string): boolean;
|
|
|
1649
1676
|
declare function asyncReduce<IterationItem, AccValue>(array: IterationItem[], reducer: (accumulate: AccValue, current: IterationItem) => AccValue | Promise<AccValue>, initValue: AccValue): Promise<AccValue>;
|
|
1650
1677
|
//#endregion
|
|
1651
1678
|
//#region src/utils/case.d.ts
|
|
1652
|
-
declare function pascal(s
|
|
1653
|
-
declare function camel(s
|
|
1679
|
+
declare function pascal(s?: string): string;
|
|
1680
|
+
declare function camel(s?: string): string;
|
|
1654
1681
|
declare function snake(s: string): string;
|
|
1655
1682
|
declare function kebab(s: string): string;
|
|
1656
1683
|
declare function upper(s: string, fillWith: string, isDeapostrophe?: boolean): string;
|
|
@@ -1659,6 +1686,54 @@ declare function conventionName(name: string, convention: NamingConvention): str
|
|
|
1659
1686
|
//#region src/utils/compare-version.d.ts
|
|
1660
1687
|
declare function compareVersions(firstVersion: string, secondVersions: string, operator?: CompareOperator): boolean;
|
|
1661
1688
|
//#endregion
|
|
1689
|
+
//#region src/utils/content-type.d.ts
|
|
1690
|
+
/**
|
|
1691
|
+
* Determine if a content type is binary (vs text-based).
|
|
1692
|
+
*/
|
|
1693
|
+
declare function isBinaryContentType(contentType: string): boolean;
|
|
1694
|
+
/**
|
|
1695
|
+
* Determine if a form-data field should be treated as a file (binary or text).
|
|
1696
|
+
*
|
|
1697
|
+
* Precedence (per OAS 3.1): encoding.contentType > schema.contentMediaType
|
|
1698
|
+
*
|
|
1699
|
+
* Returns:
|
|
1700
|
+
* - 'binary': binary file (Blob)
|
|
1701
|
+
* - 'text': text file (Blob | string)
|
|
1702
|
+
* - undefined: not a file, use standard string resolution
|
|
1703
|
+
*/
|
|
1704
|
+
declare function getFormDataFieldFileType(resolvedSchema: OpenApiSchemaObject, partContentType: string | undefined): 'binary' | 'text' | undefined;
|
|
1705
|
+
/**
|
|
1706
|
+
* Filter configuration for content types
|
|
1707
|
+
*/
|
|
1708
|
+
interface ContentTypeFilter {
|
|
1709
|
+
include?: string[];
|
|
1710
|
+
exclude?: string[];
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Filters items by content type based on include/exclude rules
|
|
1714
|
+
*
|
|
1715
|
+
* @param items - Array of items with contentType property
|
|
1716
|
+
* @param filter - Optional filter configuration
|
|
1717
|
+
* @returns Filtered array
|
|
1718
|
+
*
|
|
1719
|
+
* @example
|
|
1720
|
+
* ```ts
|
|
1721
|
+
* const types = [
|
|
1722
|
+
* { contentType: 'application/json', value: '...' },
|
|
1723
|
+
* { contentType: 'text/xml', value: '...' }
|
|
1724
|
+
* ];
|
|
1725
|
+
*
|
|
1726
|
+
* // Include only JSON
|
|
1727
|
+
* filterByContentType(types, { include: ['application/json'] });
|
|
1728
|
+
*
|
|
1729
|
+
* // Exclude XML
|
|
1730
|
+
* filterByContentType(types, { exclude: ['text/xml'] });
|
|
1731
|
+
* ```
|
|
1732
|
+
*/
|
|
1733
|
+
declare function filterByContentType<T extends {
|
|
1734
|
+
contentType: string;
|
|
1735
|
+
}>(items: T[], filter?: ContentTypeFilter): T[];
|
|
1736
|
+
//#endregion
|
|
1662
1737
|
//#region src/utils/debug.d.ts
|
|
1663
1738
|
interface DebuggerOptions {
|
|
1664
1739
|
onlyWhenFocused?: boolean | string;
|
|
@@ -1666,7 +1741,7 @@ interface DebuggerOptions {
|
|
|
1666
1741
|
declare function createDebugger(ns: string, options?: DebuggerOptions): debug.Debugger['log'];
|
|
1667
1742
|
//#endregion
|
|
1668
1743
|
//#region src/utils/deep-non-nullable.d.ts
|
|
1669
|
-
type DeepNonNullable<T> = T extends
|
|
1744
|
+
type DeepNonNullable<T> = T extends ((...args: never[]) => unknown) ? T : T extends readonly (infer U)[] ? DeepNonNullable<NonNullable<U>>[] : T extends object ? { [K in keyof T]: DeepNonNullable<NonNullable<T[K]>> } : NonNullable<T>;
|
|
1670
1745
|
//#endregion
|
|
1671
1746
|
//#region src/utils/doc.d.ts
|
|
1672
1747
|
declare function jsDoc(schema: {
|
|
@@ -1772,7 +1847,7 @@ interface LoggerOptions {
|
|
|
1772
1847
|
declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
1773
1848
|
//#endregion
|
|
1774
1849
|
//#region src/utils/merge-deep.d.ts
|
|
1775
|
-
declare function mergeDeep<T extends Record<string,
|
|
1850
|
+
declare function mergeDeep<T extends Record<string, unknown>, U$1 extends Record<string, unknown>>(source: T, target: U$1): T & U$1;
|
|
1776
1851
|
//#endregion
|
|
1777
1852
|
//#region src/utils/occurrence.d.ts
|
|
1778
1853
|
declare function count(str: string | undefined, key: string): number;
|
|
@@ -1811,7 +1886,7 @@ declare const sortByPriority: <T>(arr: (T & {
|
|
|
1811
1886
|
* stringify([1, 2, 3]) // returns "[1, 2, 3]"
|
|
1812
1887
|
* stringify({ a: 1, b: 'test' }) // returns "{ a: 1, b: 'test', }"
|
|
1813
1888
|
*/
|
|
1814
|
-
declare function stringify(data?: string |
|
|
1889
|
+
declare function stringify(data?: string | unknown[] | Record<string, unknown>): string | undefined;
|
|
1815
1890
|
/**
|
|
1816
1891
|
* Sanitizes a string value by removing or replacing special characters and ensuring
|
|
1817
1892
|
* it conforms to JavaScript identifier naming rules if needed.
|
|
@@ -1888,6 +1963,7 @@ declare function jsStringEscape(input: string): string;
|
|
|
1888
1963
|
/**
|
|
1889
1964
|
* Deduplicates a TypeScript union type string.
|
|
1890
1965
|
* Handles types like "A | B | B" → "A | B" and "null | null" → "null".
|
|
1966
|
+
* Only splits on top-level | (not inside {} () [] <> or string literals).
|
|
1891
1967
|
*/
|
|
1892
1968
|
declare function dedupeUnionType(unionType: string): string;
|
|
1893
1969
|
//#endregion
|
|
@@ -1905,11 +1981,11 @@ declare function splitSchemasByType(schemas: GeneratorSchema[]): {
|
|
|
1905
1981
|
/**
|
|
1906
1982
|
* Fix imports in operation schemas that reference regular schemas.
|
|
1907
1983
|
*/
|
|
1908
|
-
declare function fixCrossDirectoryImports(operationSchemas: GeneratorSchema[], regularSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention): void;
|
|
1984
|
+
declare function fixCrossDirectoryImports(operationSchemas: GeneratorSchema[], regularSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention, fileExtension: string): void;
|
|
1909
1985
|
/**
|
|
1910
1986
|
* Fix imports in regular schemas that reference operation schemas.
|
|
1911
1987
|
*/
|
|
1912
|
-
declare function fixRegularSchemaImports(regularSchemas: GeneratorSchema[], operationSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention): void;
|
|
1988
|
+
declare function fixRegularSchemaImports(regularSchemas: GeneratorSchema[], operationSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention, fileExtension: string): void;
|
|
1913
1989
|
declare function writeModelInline(acc: string, model: string): string;
|
|
1914
1990
|
declare function writeModelsInline(array: GeneratorSchema[]): string;
|
|
1915
1991
|
interface WriteSchemaOptions {
|
|
@@ -1993,5 +2069,5 @@ declare function generateTargetForTags(builder: WriteSpecBuilder, options: Norma
|
|
|
1993
2069
|
declare function getOrvalGeneratedTypes(): string;
|
|
1994
2070
|
declare function getTypedResponse(): string;
|
|
1995
2071
|
//#endregion
|
|
1996
|
-
export { AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, Config, ConfigExternal, ConfigFn, ContextSpec, DeepNonNullable, EnumGeneration, ErrorWithTag, FetchOptions, FormDataArrayHandling, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NamingConvention, NormalizedConfig, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, 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, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PropertySortOrder, QueryOptions, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, ScalarValue, SchemaGenerationType, SchemaOptions, SchemaType, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicImport, escape, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getArray, getBody, getCombinedEnumValue, getDefaultContentType, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getTypedResponse, isBinaryContentType, isBoolean, isDirectory, isFunction, isModule,
|
|
2072
|
+
export { AngularOptions, BODY_TYPE_NAME, BaseUrlFromConstant, BaseUrlFromSpec, ClientBuilder, ClientDependenciesBuilder, ClientExtraFilesBuilder, ClientFileBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMockBuilder, ClientMockGeneratorBuilder, ClientMockGeneratorImplementation, ClientTitleBuilder, Config, ConfigExternal, ConfigFn, ContentTypeFilter, ContextSpec, DeepNonNullable, EnumGeneration, ErrorWithTag, FetchOptions, FormDataArrayHandling, FormDataContext, FormDataType, GenerateMockImports, GenerateVerbOptionsParams, GenerateVerbsOptionsParams, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalMockOptions, GlobalOptions, HonoOptions, Hook, HookCommand, HookFunction, HookOption, HooksOptions, ImportOpenApi, InputFiltersOptions, InputOptions, InputTransformerFn, InvalidateTarget, JsDocOptions, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, MockData, MockDataArray, MockDataArrayFn, MockDataObject, MockDataObjectFn, MockOptions, MockProperties, MockPropertiesObject, MockPropertiesObjectFn, MutationInvalidatesConfig, MutationInvalidatesRule, Mutator, MutatorObject, NamingConvention, NormalizedConfig, NormalizedFetchOptions, NormalizedFormDataType, NormalizedHonoOptions, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedJsDocOptions, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, NormalizedSchemaOptions, NormalizedZodOptions, OpenApiComponentsObject, OpenApiDocument, 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, OutputMode, OutputOptions, OverrideInput, OverrideMockOptions, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, PropertySortOrder, QueryOptions, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ResponseTypeCategory, ScalarValue, SchemaGenerationType, SchemaOptions, SchemaType, SwrOptions, TEMPLATE_TAG_REGEX, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, WriteSpecBuilder, ZodCoerceType, ZodDateTimeOptions, ZodOptions, ZodTimeOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, createTypeAliasIfNeeded, dedupeUnionType, dynamicImport, escape, filterByContentType, fixCrossDirectoryImports, fixRegularSchemaImports, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbOptions, generateVerbsOptions, getArray, getBody, getCombinedEnumValue, getDefaultContentType, getEnum, getEnumDescriptions, getEnumImplementation, getEnumNames, getEnumUnionFromSchema, getExtension, getFileInfo, getFormDataFieldFileType, getFullRoute, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getPropertySafe, getProps, getQueryParams, getRefInfo, getRequestBodyContentTypes, getResReqTypes, getResponse, getResponseTypeCategory, getRoute, getRouteAsArray, getScalar, getTypedResponse, isBinaryContentType, isBoolean, isDirectory, isFunction, isModule, isNullish, isNumber, isNumeric, isObject, isReference, isSchema, isString, isStringLike, isSyntheticDefaultImportsAllow, isUrl, isVerb, jsDoc, jsStringEscape, kebab, keyValuePairsToJsDoc, log, logError, mergeDeep, mismatchArgsMessage, pascal, removeFilesAndEmptyFolders, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
1997
2073
|
//# sourceMappingURL=index.d.mts.map
|