@orval/core 8.2.0 → 8.4.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/{chunk-C6wwvPpM.mjs → chunk-1-as6MWF.mjs} +2 -0
- package/dist/index.d.mts +139 -54
- package/dist/index.mjs +1089 -704
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -7
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;
|
|
@@ -268,6 +269,7 @@ declare const OutputMockType: {
|
|
|
268
269
|
readonly MSW: "msw";
|
|
269
270
|
};
|
|
270
271
|
type OutputMockType = (typeof OutputMockType)[keyof typeof OutputMockType];
|
|
272
|
+
type PreferredContentType = 'application/json' | 'application/xml' | 'text/plain' | 'text/html' | 'application/octet-stream' | (string & {});
|
|
271
273
|
type GlobalMockOptions = {
|
|
272
274
|
type: OutputMockType;
|
|
273
275
|
useExamples?: boolean;
|
|
@@ -276,6 +278,7 @@ type GlobalMockOptions = {
|
|
|
276
278
|
delayFunctionLazyExecute?: boolean;
|
|
277
279
|
baseUrl?: string;
|
|
278
280
|
locale?: keyof typeof allLocales;
|
|
281
|
+
preferredContentType?: PreferredContentType;
|
|
279
282
|
indexMockFiles?: boolean;
|
|
280
283
|
};
|
|
281
284
|
type OverrideMockOptions = Partial<GlobalMockOptions> & {
|
|
@@ -319,7 +322,7 @@ type MutatorObject = {
|
|
|
319
322
|
};
|
|
320
323
|
type Mutator = string | MutatorObject;
|
|
321
324
|
type ParamsSerializerOptions = {
|
|
322
|
-
qs?: Record<string,
|
|
325
|
+
qs?: Record<string, unknown>;
|
|
323
326
|
};
|
|
324
327
|
declare const FormDataArrayHandling: {
|
|
325
328
|
readonly SERIALIZE: "serialize";
|
|
@@ -381,7 +384,7 @@ type OverrideOutput = {
|
|
|
381
384
|
zod?: ZodOptions;
|
|
382
385
|
operationName?: (operation: OpenApiOperationObject, route: string, verb: Verbs) => string;
|
|
383
386
|
fetch?: FetchOptions;
|
|
384
|
-
requestOptions?: Record<string,
|
|
387
|
+
requestOptions?: Record<string, unknown> | boolean;
|
|
385
388
|
useDates?: boolean;
|
|
386
389
|
useTypeOverInterfaces?: boolean;
|
|
387
390
|
useDeprecatedOperations?: boolean;
|
|
@@ -398,13 +401,13 @@ type OverrideOutput = {
|
|
|
398
401
|
useNullForOptional?: boolean;
|
|
399
402
|
};
|
|
400
403
|
type JsDocOptions = {
|
|
401
|
-
filter?: (schema: Record<string,
|
|
404
|
+
filter?: (schema: Record<string, unknown>) => {
|
|
402
405
|
key: string;
|
|
403
406
|
value: string;
|
|
404
407
|
}[];
|
|
405
408
|
};
|
|
406
409
|
type NormalizedJsDocOptions = {
|
|
407
|
-
filter?: (schema: Record<string,
|
|
410
|
+
filter?: (schema: Record<string, unknown>) => {
|
|
408
411
|
key: string;
|
|
409
412
|
value: string;
|
|
410
413
|
}[];
|
|
@@ -496,7 +499,9 @@ type NormalizedZodOptions = {
|
|
|
496
499
|
};
|
|
497
500
|
type InvalidateTarget = string | {
|
|
498
501
|
query: string;
|
|
499
|
-
params
|
|
502
|
+
params?: string[] | Record<string, string>;
|
|
503
|
+
invalidateMode?: 'invalidate' | 'reset';
|
|
504
|
+
file?: string;
|
|
500
505
|
};
|
|
501
506
|
type MutationInvalidatesRule = {
|
|
502
507
|
onMutations: string[];
|
|
@@ -518,7 +523,7 @@ type NormalizedQueryOptions = {
|
|
|
518
523
|
useInfiniteQueryParam?: string;
|
|
519
524
|
usePrefetch?: boolean;
|
|
520
525
|
useInvalidate?: boolean;
|
|
521
|
-
options?:
|
|
526
|
+
options?: Record<string, unknown>;
|
|
522
527
|
queryKey?: NormalizedMutator;
|
|
523
528
|
queryOptions?: NormalizedMutator;
|
|
524
529
|
mutationOptions?: NormalizedMutator;
|
|
@@ -530,6 +535,7 @@ type NormalizedQueryOptions = {
|
|
|
530
535
|
signal?: boolean;
|
|
531
536
|
version?: 3 | 4 | 5;
|
|
532
537
|
mutationInvalidates?: MutationInvalidatesConfig;
|
|
538
|
+
runtimeValidation?: boolean;
|
|
533
539
|
};
|
|
534
540
|
type QueryOptions = {
|
|
535
541
|
useQuery?: boolean;
|
|
@@ -540,7 +546,7 @@ type QueryOptions = {
|
|
|
540
546
|
useInfiniteQueryParam?: string;
|
|
541
547
|
usePrefetch?: boolean;
|
|
542
548
|
useInvalidate?: boolean;
|
|
543
|
-
options?:
|
|
549
|
+
options?: Record<string, unknown>;
|
|
544
550
|
queryKey?: Mutator;
|
|
545
551
|
queryOptions?: Mutator;
|
|
546
552
|
mutationOptions?: Mutator;
|
|
@@ -552,6 +558,7 @@ type QueryOptions = {
|
|
|
552
558
|
signal?: boolean;
|
|
553
559
|
version?: 3 | 4 | 5;
|
|
554
560
|
mutationInvalidates?: MutationInvalidatesConfig;
|
|
561
|
+
runtimeValidation?: boolean;
|
|
555
562
|
};
|
|
556
563
|
type AngularOptions = {
|
|
557
564
|
provideIn?: 'root' | 'any' | boolean;
|
|
@@ -601,7 +608,7 @@ type OperationOptions = {
|
|
|
601
608
|
requestOptions?: object | boolean;
|
|
602
609
|
};
|
|
603
610
|
type Hook = 'afterAllFilesWrite';
|
|
604
|
-
type HookFunction = (...args:
|
|
611
|
+
type HookFunction = (...args: unknown[]) => void | Promise<void>;
|
|
605
612
|
interface HookOption {
|
|
606
613
|
command: string | HookFunction;
|
|
607
614
|
injectGeneratedDirsAndFiles?: boolean;
|
|
@@ -666,6 +673,7 @@ interface PackageJson {
|
|
|
666
673
|
peerDependencies?: Record<string, string>;
|
|
667
674
|
catalog?: Record<string, string>;
|
|
668
675
|
catalogs?: Record<string, Record<string, string>>;
|
|
676
|
+
resolvedVersions?: Record<string, string>;
|
|
669
677
|
}
|
|
670
678
|
type GeneratorSchema = {
|
|
671
679
|
name: string;
|
|
@@ -675,20 +683,20 @@ type GeneratorSchema = {
|
|
|
675
683
|
schema?: OpenApiSchemaObject;
|
|
676
684
|
};
|
|
677
685
|
type GeneratorImport = {
|
|
678
|
-
name: string;
|
|
679
|
-
schemaName?: string;
|
|
680
|
-
isZodSchema?: boolean;
|
|
681
|
-
isConstant?: boolean;
|
|
682
|
-
alias?: string;
|
|
683
|
-
default?: boolean;
|
|
684
|
-
values?: boolean;
|
|
685
|
-
syntheticDefaultImport?: boolean;
|
|
686
|
-
namespaceImport?: boolean;
|
|
687
|
-
importPath?: string;
|
|
686
|
+
readonly name: string;
|
|
687
|
+
readonly schemaName?: string;
|
|
688
|
+
readonly isZodSchema?: boolean;
|
|
689
|
+
readonly isConstant?: boolean;
|
|
690
|
+
readonly alias?: string;
|
|
691
|
+
readonly default?: boolean;
|
|
692
|
+
readonly values?: boolean;
|
|
693
|
+
readonly syntheticDefaultImport?: boolean;
|
|
694
|
+
readonly namespaceImport?: boolean;
|
|
695
|
+
readonly importPath?: string;
|
|
688
696
|
};
|
|
689
697
|
type GeneratorDependency = {
|
|
690
|
-
exports: GeneratorImport[];
|
|
691
|
-
dependency: string;
|
|
698
|
+
readonly exports: readonly GeneratorImport[];
|
|
699
|
+
readonly dependency: string;
|
|
692
700
|
};
|
|
693
701
|
type GeneratorApiResponse = {
|
|
694
702
|
operations: GeneratorOperations;
|
|
@@ -824,7 +832,7 @@ type ClientFooterBuilder = (params: {
|
|
|
824
832
|
hasMutator: boolean;
|
|
825
833
|
}) => string;
|
|
826
834
|
type ClientTitleBuilder = (title: string) => string;
|
|
827
|
-
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson, httpClient?: OutputHttpClient, hasTagsMutator?: boolean, override?: NormalizedOverrideOutput) => GeneratorDependency[];
|
|
835
|
+
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson, httpClient?: OutputHttpClient, hasTagsMutator?: boolean, override?: NormalizedOverrideOutput) => readonly GeneratorDependency[];
|
|
828
836
|
type ClientMockGeneratorImplementation = {
|
|
829
837
|
function: string;
|
|
830
838
|
handlerName: string;
|
|
@@ -897,6 +905,7 @@ type GetterQueryParam = {
|
|
|
897
905
|
schema: GeneratorSchema;
|
|
898
906
|
deps: GeneratorSchema[];
|
|
899
907
|
isOptional: boolean;
|
|
908
|
+
requiredNullableKeys?: string[];
|
|
900
909
|
originalSchema?: OpenApiSchemaObject;
|
|
901
910
|
};
|
|
902
911
|
type GetterPropType = 'param' | 'body' | 'queryParam' | 'header' | 'namedPathParams';
|
|
@@ -944,8 +953,8 @@ type ScalarValue = {
|
|
|
944
953
|
schemas: GeneratorSchema[];
|
|
945
954
|
isRef: boolean;
|
|
946
955
|
dependencies: string[];
|
|
947
|
-
example?:
|
|
948
|
-
examples?: Record<string,
|
|
956
|
+
example?: unknown;
|
|
957
|
+
examples?: Record<string, unknown>;
|
|
949
958
|
};
|
|
950
959
|
type ResolverValue = ScalarValue & {
|
|
951
960
|
originalSchema: OpenApiSchemaObject;
|
|
@@ -1089,7 +1098,7 @@ declare function generateComponentDefinition(responses: OpenApiComponentsObject[
|
|
|
1089
1098
|
//#endregion
|
|
1090
1099
|
//#region src/generators/imports.d.ts
|
|
1091
1100
|
interface GenerateImportsOptions {
|
|
1092
|
-
imports: GeneratorImport[];
|
|
1101
|
+
imports: readonly GeneratorImport[];
|
|
1093
1102
|
target: string;
|
|
1094
1103
|
namingConvention?: NamingConvention;
|
|
1095
1104
|
}
|
|
@@ -1109,7 +1118,7 @@ declare function generateMutatorImports({
|
|
|
1109
1118
|
}: GenerateMutatorImportsOptions): string;
|
|
1110
1119
|
interface AddDependencyOptions {
|
|
1111
1120
|
implementation: string;
|
|
1112
|
-
exports: GeneratorImport[];
|
|
1121
|
+
exports: readonly GeneratorImport[];
|
|
1113
1122
|
dependency: string;
|
|
1114
1123
|
projectName?: string;
|
|
1115
1124
|
hasSchemaDir: boolean;
|
|
@@ -1120,11 +1129,10 @@ declare function addDependency({
|
|
|
1120
1129
|
exports,
|
|
1121
1130
|
dependency,
|
|
1122
1131
|
projectName,
|
|
1123
|
-
hasSchemaDir,
|
|
1124
1132
|
isAllowSyntheticDefaultImports
|
|
1125
1133
|
}: AddDependencyOptions): string | undefined;
|
|
1126
1134
|
declare function generateDependencyImports(implementation: string, imports: {
|
|
1127
|
-
exports: GeneratorImport[];
|
|
1135
|
+
exports: readonly GeneratorImport[];
|
|
1128
1136
|
dependency: string;
|
|
1129
1137
|
}[], projectName: string | undefined, hasSchemaDir: boolean, isAllowSyntheticDefaultImports: boolean): string;
|
|
1130
1138
|
declare function generateVerbImports({
|
|
@@ -1158,6 +1166,30 @@ declare function generateMutator({
|
|
|
1158
1166
|
}: GenerateMutatorOptions): Promise<GeneratorMutator | undefined>;
|
|
1159
1167
|
//#endregion
|
|
1160
1168
|
//#region src/generators/options.d.ts
|
|
1169
|
+
/**
|
|
1170
|
+
* Filters query params for Angular's HttpClient.
|
|
1171
|
+
*
|
|
1172
|
+
* Why: Angular's HttpParams / HttpClient `params` type does not accept `null` or
|
|
1173
|
+
* `undefined` values, and arrays must only contain string/number/boolean.
|
|
1174
|
+
* Orval models often include nullable query params, so we remove nullish values
|
|
1175
|
+
* (including nulls inside arrays) before passing params to HttpClient or a
|
|
1176
|
+
* paramsSerializer to avoid runtime and type issues.
|
|
1177
|
+
*
|
|
1178
|
+
* Returns an inline IIFE expression. For paths that benefit from a shared helper
|
|
1179
|
+
* (e.g. observe-mode branches), prefer getAngularFilteredParamsCallExpression +
|
|
1180
|
+
* getAngularFilteredParamsHelperBody instead.
|
|
1181
|
+
*/
|
|
1182
|
+
declare const getAngularFilteredParamsExpression: (paramsExpression: string, requiredNullableParamKeys?: string[]) => string;
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns the body of a standalone `filterParams` helper function
|
|
1185
|
+
* to be emitted once in the generated file header, replacing the
|
|
1186
|
+
* inline IIFE that was previously duplicated in every method.
|
|
1187
|
+
*/
|
|
1188
|
+
declare const getAngularFilteredParamsHelperBody: () => string;
|
|
1189
|
+
/**
|
|
1190
|
+
* Returns a call expression to the `filterParams` helper function.
|
|
1191
|
+
*/
|
|
1192
|
+
declare const getAngularFilteredParamsCallExpression: (paramsExpression: string, requiredNullableParamKeys?: string[]) => string;
|
|
1161
1193
|
interface GenerateFormDataAndUrlEncodedFunctionOptions {
|
|
1162
1194
|
body: GetterBody;
|
|
1163
1195
|
formData?: GeneratorMutator;
|
|
@@ -1169,6 +1201,9 @@ declare function generateBodyOptions(body: GetterBody, isFormData: boolean, isFo
|
|
|
1169
1201
|
interface GenerateAxiosOptions {
|
|
1170
1202
|
response: GetterResponse;
|
|
1171
1203
|
isExactOptionalPropertyTypes: boolean;
|
|
1204
|
+
angularObserve?: 'body' | 'events' | 'response';
|
|
1205
|
+
angularParamsRef?: string;
|
|
1206
|
+
requiredNullableQueryParamKeys?: string[];
|
|
1172
1207
|
queryParams?: GeneratorSchema;
|
|
1173
1208
|
headers?: GeneratorSchema;
|
|
1174
1209
|
requestOptions?: object | boolean;
|
|
@@ -1182,6 +1217,9 @@ interface GenerateAxiosOptions {
|
|
|
1182
1217
|
declare function generateAxiosOptions({
|
|
1183
1218
|
response,
|
|
1184
1219
|
isExactOptionalPropertyTypes,
|
|
1220
|
+
angularObserve,
|
|
1221
|
+
angularParamsRef,
|
|
1222
|
+
requiredNullableQueryParamKeys,
|
|
1185
1223
|
queryParams,
|
|
1186
1224
|
headers,
|
|
1187
1225
|
requestOptions,
|
|
@@ -1195,6 +1233,8 @@ declare function generateAxiosOptions({
|
|
|
1195
1233
|
interface GenerateOptionsOptions {
|
|
1196
1234
|
route: string;
|
|
1197
1235
|
body: GetterBody;
|
|
1236
|
+
angularObserve?: 'body' | 'events' | 'response';
|
|
1237
|
+
angularParamsRef?: string;
|
|
1198
1238
|
headers?: GetterQueryParam;
|
|
1199
1239
|
queryParams?: GetterQueryParam;
|
|
1200
1240
|
response: GetterResponse;
|
|
@@ -1213,6 +1253,8 @@ interface GenerateOptionsOptions {
|
|
|
1213
1253
|
declare function generateOptions({
|
|
1214
1254
|
route,
|
|
1215
1255
|
body,
|
|
1256
|
+
angularObserve,
|
|
1257
|
+
angularParamsRef,
|
|
1216
1258
|
headers,
|
|
1217
1259
|
queryParams,
|
|
1218
1260
|
response,
|
|
@@ -1229,7 +1271,7 @@ declare function generateOptions({
|
|
|
1229
1271
|
paramsSerializerOptions
|
|
1230
1272
|
}: GenerateOptionsOptions): string;
|
|
1231
1273
|
declare function generateBodyMutatorConfig(body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean): string;
|
|
1232
|
-
declare function generateQueryParamsAxiosConfig(response: GetterResponse, isVue: boolean, queryParams?: GetterQueryParam): string;
|
|
1274
|
+
declare function generateQueryParamsAxiosConfig(response: GetterResponse, isVue: boolean, isAngular: boolean, requiredNullableQueryParamKeys?: string[], queryParams?: GetterQueryParam): string;
|
|
1233
1275
|
interface GenerateMutatorConfigOptions {
|
|
1234
1276
|
route: string;
|
|
1235
1277
|
body: GetterBody;
|
|
@@ -1243,6 +1285,7 @@ interface GenerateMutatorConfigOptions {
|
|
|
1243
1285
|
hasSignalParam?: boolean;
|
|
1244
1286
|
isExactOptionalPropertyTypes: boolean;
|
|
1245
1287
|
isVue?: boolean;
|
|
1288
|
+
isAngular?: boolean;
|
|
1246
1289
|
}
|
|
1247
1290
|
declare function generateMutatorConfig({
|
|
1248
1291
|
route,
|
|
@@ -1256,7 +1299,8 @@ declare function generateMutatorConfig({
|
|
|
1256
1299
|
hasSignal,
|
|
1257
1300
|
hasSignalParam,
|
|
1258
1301
|
isExactOptionalPropertyTypes,
|
|
1259
|
-
isVue
|
|
1302
|
+
isVue,
|
|
1303
|
+
isAngular
|
|
1260
1304
|
}: GenerateMutatorConfigOptions): string;
|
|
1261
1305
|
declare function generateMutatorRequestOptions(requestOptions: boolean | object | undefined, hasSecondArgument: boolean): string;
|
|
1262
1306
|
declare function generateFormDataAndUrlEncodedFunction({
|
|
@@ -1286,6 +1330,7 @@ interface GenerateVerbOptionsParams {
|
|
|
1286
1330
|
verbParameters?: OpenApiPathItemObject['parameters'];
|
|
1287
1331
|
components?: OpenApiComponentsObject;
|
|
1288
1332
|
context: ContextSpec;
|
|
1333
|
+
contentType?: string;
|
|
1289
1334
|
}
|
|
1290
1335
|
declare function generateVerbOptions({
|
|
1291
1336
|
verb,
|
|
@@ -1294,7 +1339,8 @@ declare function generateVerbOptions({
|
|
|
1294
1339
|
route,
|
|
1295
1340
|
pathRoute,
|
|
1296
1341
|
verbParameters,
|
|
1297
|
-
context
|
|
1342
|
+
context,
|
|
1343
|
+
contentType
|
|
1298
1344
|
}: GenerateVerbOptionsParams): Promise<GeneratorVerbOptions>;
|
|
1299
1345
|
interface GenerateVerbsOptionsParams {
|
|
1300
1346
|
verbs: OpenApiPathItemObject;
|
|
@@ -1389,6 +1435,10 @@ interface GetBodyOptions {
|
|
|
1389
1435
|
context: ContextSpec;
|
|
1390
1436
|
contentType?: OverrideOutputContentType;
|
|
1391
1437
|
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Extract all content types from a requestBody (#2812)
|
|
1440
|
+
*/
|
|
1441
|
+
declare function getRequestBodyContentTypes(requestBody: OpenApiOperationObject['requestBody'], context: ContextSpec): string[];
|
|
1392
1442
|
declare function getBody({
|
|
1393
1443
|
requestBody,
|
|
1394
1444
|
operationName,
|
|
@@ -1432,7 +1482,7 @@ type CombinedEnumValue = {
|
|
|
1432
1482
|
valueImports: string[];
|
|
1433
1483
|
hasNull: boolean;
|
|
1434
1484
|
};
|
|
1435
|
-
declare function getEnumUnionFromSchema(schema: OpenApiSchemaObject | undefined):
|
|
1485
|
+
declare function getEnumUnionFromSchema(schema: OpenApiSchemaObject | undefined): string;
|
|
1436
1486
|
declare function getCombinedEnumValue(inputs: CombinedEnumInput[]): CombinedEnumValue;
|
|
1437
1487
|
//#endregion
|
|
1438
1488
|
//#region src/getters/keys.d.ts
|
|
@@ -1538,6 +1588,11 @@ declare function getResReqTypes(responsesOrRequests: [string, OpenApiReferenceOb
|
|
|
1538
1588
|
* Maps to Angular HttpClient's responseType, Axios responseType, and Fetch response methods.
|
|
1539
1589
|
*/
|
|
1540
1590
|
type ResponseTypeCategory = 'json' | 'text' | 'blob' | 'arraybuffer';
|
|
1591
|
+
/**
|
|
1592
|
+
* Determine the responseType option based on success content types only.
|
|
1593
|
+
* This avoids error-response content types influencing the responseType.
|
|
1594
|
+
*/
|
|
1595
|
+
declare function getSuccessResponseType(response: GetterResponse): 'blob' | 'text' | undefined;
|
|
1541
1596
|
/**
|
|
1542
1597
|
* Determine the response type category for a given content type.
|
|
1543
1598
|
* Used to set the correct responseType option in HTTP clients.
|
|
@@ -1654,16 +1709,11 @@ declare function resolveValue({
|
|
|
1654
1709
|
* @param property
|
|
1655
1710
|
*/
|
|
1656
1711
|
declare function isReference(obj: object): obj is OpenApiReferenceObject;
|
|
1657
|
-
declare function isDirectory(
|
|
1658
|
-
declare function isObject(x:
|
|
1659
|
-
declare function
|
|
1660
|
-
declare function
|
|
1661
|
-
declare function
|
|
1662
|
-
declare function isNumeric(x: any): x is number;
|
|
1663
|
-
declare function isBoolean(x: any): x is boolean;
|
|
1664
|
-
declare function isFunction(x: any): x is Function;
|
|
1665
|
-
declare function isUndefined(x: any): x is undefined;
|
|
1666
|
-
declare function isNull(x: any): x is null;
|
|
1712
|
+
declare function isDirectory(pathValue: string): boolean;
|
|
1713
|
+
declare function isObject(x: unknown): x is Record<string, unknown>;
|
|
1714
|
+
declare function isStringLike(val: unknown): val is string;
|
|
1715
|
+
declare function isModule(x: unknown): x is Record<string, unknown>;
|
|
1716
|
+
declare function isNumeric(x: unknown): x is number;
|
|
1667
1717
|
declare function isSchema(x: unknown): x is OpenApiSchemaObject;
|
|
1668
1718
|
declare function isVerb(verb: string): verb is Verbs;
|
|
1669
1719
|
declare function isUrl(str: string): boolean;
|
|
@@ -1672,13 +1722,16 @@ declare function isUrl(str: string): boolean;
|
|
|
1672
1722
|
declare function asyncReduce<IterationItem, AccValue>(array: IterationItem[], reducer: (accumulate: AccValue, current: IterationItem) => AccValue | Promise<AccValue>, initValue: AccValue): Promise<AccValue>;
|
|
1673
1723
|
//#endregion
|
|
1674
1724
|
//#region src/utils/case.d.ts
|
|
1675
|
-
declare function pascal(s
|
|
1676
|
-
declare function camel(s
|
|
1725
|
+
declare function pascal(s?: string): string;
|
|
1726
|
+
declare function camel(s?: string): string;
|
|
1677
1727
|
declare function snake(s: string): string;
|
|
1678
1728
|
declare function kebab(s: string): string;
|
|
1679
1729
|
declare function upper(s: string, fillWith: string, isDeapostrophe?: boolean): string;
|
|
1680
1730
|
declare function conventionName(name: string, convention: NamingConvention): string;
|
|
1681
1731
|
//#endregion
|
|
1732
|
+
//#region src/utils/compare-version.d.ts
|
|
1733
|
+
declare function compareVersions(firstVersion: string, secondVersions: string, operator?: CompareOperator): boolean;
|
|
1734
|
+
//#endregion
|
|
1682
1735
|
//#region src/utils/content-type.d.ts
|
|
1683
1736
|
/**
|
|
1684
1737
|
* Determine if a content type is binary (vs text-based).
|
|
@@ -1695,9 +1748,37 @@ declare function isBinaryContentType(contentType: string): boolean;
|
|
|
1695
1748
|
* - undefined: not a file, use standard string resolution
|
|
1696
1749
|
*/
|
|
1697
1750
|
declare function getFormDataFieldFileType(resolvedSchema: OpenApiSchemaObject, partContentType: string | undefined): 'binary' | 'text' | undefined;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1751
|
+
/**
|
|
1752
|
+
* Filter configuration for content types
|
|
1753
|
+
*/
|
|
1754
|
+
interface ContentTypeFilter {
|
|
1755
|
+
include?: string[];
|
|
1756
|
+
exclude?: string[];
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Filters items by content type based on include/exclude rules
|
|
1760
|
+
*
|
|
1761
|
+
* @param items - Array of items with contentType property
|
|
1762
|
+
* @param filter - Optional filter configuration
|
|
1763
|
+
* @returns Filtered array
|
|
1764
|
+
*
|
|
1765
|
+
* @example
|
|
1766
|
+
* ```ts
|
|
1767
|
+
* const types = [
|
|
1768
|
+
* { contentType: 'application/json', value: '...' },
|
|
1769
|
+
* { contentType: 'text/xml', value: '...' }
|
|
1770
|
+
* ];
|
|
1771
|
+
*
|
|
1772
|
+
* // Include only JSON
|
|
1773
|
+
* filterByContentType(types, { include: ['application/json'] });
|
|
1774
|
+
*
|
|
1775
|
+
* // Exclude XML
|
|
1776
|
+
* filterByContentType(types, { exclude: ['text/xml'] });
|
|
1777
|
+
* ```
|
|
1778
|
+
*/
|
|
1779
|
+
declare function filterByContentType<T extends {
|
|
1780
|
+
contentType: string;
|
|
1781
|
+
}>(items: T[], filter?: ContentTypeFilter): T[];
|
|
1701
1782
|
//#endregion
|
|
1702
1783
|
//#region src/utils/debug.d.ts
|
|
1703
1784
|
interface DebuggerOptions {
|
|
@@ -1706,7 +1787,7 @@ interface DebuggerOptions {
|
|
|
1706
1787
|
declare function createDebugger(ns: string, options?: DebuggerOptions): debug.Debugger['log'];
|
|
1707
1788
|
//#endregion
|
|
1708
1789
|
//#region src/utils/deep-non-nullable.d.ts
|
|
1709
|
-
type DeepNonNullable<T> = T extends
|
|
1790
|
+
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>;
|
|
1710
1791
|
//#endregion
|
|
1711
1792
|
//#region src/utils/doc.d.ts
|
|
1712
1793
|
declare function jsDoc(schema: {
|
|
@@ -1812,7 +1893,7 @@ interface LoggerOptions {
|
|
|
1812
1893
|
declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
1813
1894
|
//#endregion
|
|
1814
1895
|
//#region src/utils/merge-deep.d.ts
|
|
1815
|
-
declare function mergeDeep<T extends Record<string,
|
|
1896
|
+
declare function mergeDeep<T extends Record<string, unknown>, U$1 extends Record<string, unknown>>(source: T, target: U$1): T & U$1;
|
|
1816
1897
|
//#endregion
|
|
1817
1898
|
//#region src/utils/occurrence.d.ts
|
|
1818
1899
|
declare function count(str: string | undefined, key: string): number;
|
|
@@ -1829,6 +1910,10 @@ declare const separator$1 = "/";
|
|
|
1829
1910
|
declare function normalizeSafe(value: string): string;
|
|
1830
1911
|
declare function joinSafe(...values: string[]): string;
|
|
1831
1912
|
//#endregion
|
|
1913
|
+
//#region src/utils/resolve-version.d.ts
|
|
1914
|
+
declare function resolveInstalledVersion(packageName: string, fromDir: string): string | undefined;
|
|
1915
|
+
declare function resolveInstalledVersions(packageJson: PackageJson, fromDir: string): Record<string, string>;
|
|
1916
|
+
//#endregion
|
|
1832
1917
|
//#region src/utils/sort.d.ts
|
|
1833
1918
|
declare const sortByPriority: <T>(arr: (T & {
|
|
1834
1919
|
default?: boolean;
|
|
@@ -1851,7 +1936,7 @@ declare const sortByPriority: <T>(arr: (T & {
|
|
|
1851
1936
|
* stringify([1, 2, 3]) // returns "[1, 2, 3]"
|
|
1852
1937
|
* stringify({ a: 1, b: 'test' }) // returns "{ a: 1, b: 'test', }"
|
|
1853
1938
|
*/
|
|
1854
|
-
declare function stringify(data?: string |
|
|
1939
|
+
declare function stringify(data?: string | unknown[] | Record<string, unknown>): string | undefined;
|
|
1855
1940
|
/**
|
|
1856
1941
|
* Sanitizes a string value by removing or replacing special characters and ensuring
|
|
1857
1942
|
* it conforms to JavaScript identifier naming rules if needed.
|
|
@@ -1946,11 +2031,11 @@ declare function splitSchemasByType(schemas: GeneratorSchema[]): {
|
|
|
1946
2031
|
/**
|
|
1947
2032
|
* Fix imports in operation schemas that reference regular schemas.
|
|
1948
2033
|
*/
|
|
1949
|
-
declare function fixCrossDirectoryImports(operationSchemas: GeneratorSchema[], regularSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention): void;
|
|
2034
|
+
declare function fixCrossDirectoryImports(operationSchemas: GeneratorSchema[], regularSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention, fileExtension: string): void;
|
|
1950
2035
|
/**
|
|
1951
2036
|
* Fix imports in regular schemas that reference operation schemas.
|
|
1952
2037
|
*/
|
|
1953
|
-
declare function fixRegularSchemaImports(regularSchemas: GeneratorSchema[], operationSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention): void;
|
|
2038
|
+
declare function fixRegularSchemaImports(regularSchemas: GeneratorSchema[], operationSchemaNames: Set<string>, schemaPath: string, operationSchemaPath: string, namingConvention: NamingConvention, fileExtension: string): void;
|
|
1954
2039
|
declare function writeModelInline(acc: string, model: string): string;
|
|
1955
2040
|
declare function writeModelsInline(array: GeneratorSchema[]): string;
|
|
1956
2041
|
interface WriteSchemaOptions {
|
|
@@ -2034,5 +2119,5 @@ declare function generateTargetForTags(builder: WriteSpecBuilder, options: Norma
|
|
|
2034
2119
|
declare function getOrvalGeneratedTypes(): string;
|
|
2035
2120
|
declare function getTypedResponse(): string;
|
|
2036
2121
|
//#endregion
|
|
2037
|
-
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, 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, 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,
|
|
2122
|
+
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, PreferredContentType, 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, getAngularFilteredParamsCallExpression, getAngularFilteredParamsExpression, getAngularFilteredParamsHelperBody, 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, getSuccessResponseType, 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, resolveInstalledVersion, resolveInstalledVersions, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, splitSchemasByType, startMessage, stringify, toObjectString, path_d_exports as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
2038
2123
|
//# sourceMappingURL=index.d.mts.map
|