@orval/core 6.31.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/index.d.ts +35 -2
- package/dist/index.js +6232 -3110
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://badge.fury.io/js/orval)
|
|
2
2
|
[](https://opensource.org/licenses/MIT)
|
|
3
|
-
[](https://github.com/orval-labs/orval/actions/workflows/tests.yaml)
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="./logo/orval-logo-horizontal.svg?raw=true" width="500" height="160" alt="orval - Restfull Client Generator" />
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
You can find below some samples
|
|
21
21
|
|
|
22
|
-
- [react app](https://github.com/
|
|
23
|
-
- [react query](https://github.com/
|
|
24
|
-
- [svelte query](https://github.com/
|
|
25
|
-
- [vue query](https://github.com/
|
|
26
|
-
- [react app with swr](https://github.com/
|
|
27
|
-
- [angular app](https://github.com/
|
|
28
|
-
- [hono](https://github.com/
|
|
29
|
-
- [next app with fetch](https://github.com/
|
|
22
|
+
- [react app](https://github.com/orval-labs/orval/tree/master/samples/react-app)
|
|
23
|
+
- [react query](https://github.com/orval-labs/orval/tree/master/samples/react-query)
|
|
24
|
+
- [svelte query](https://github.com/orval-labs/orval/tree/master/samples/svelte-query)
|
|
25
|
+
- [vue query](https://github.com/orval-labs/orval/tree/master/samples/vue-query)
|
|
26
|
+
- [react app with swr](https://github.com/orval-labs/orval/tree/master/samples/react-app-with-swr)
|
|
27
|
+
- [angular app](https://github.com/orval-labs/orval/tree/master/samples/angular-app)
|
|
28
|
+
- [hono](https://github.com/orval-labs/orval/tree/master/samples/hono)
|
|
29
|
+
- [next app with fetch](https://github.com/orval-labs/orval/tree/master/samples/next-app-with-fetch)
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ type NormalizedOutputOptions = {
|
|
|
36
36
|
mock?: GlobalMockOptions | ClientMockBuilder;
|
|
37
37
|
override: NormalizedOverrideOutput;
|
|
38
38
|
client: OutputClient | OutputClientFunc;
|
|
39
|
+
httpClient: OutputHttpClient;
|
|
39
40
|
clean: boolean | string[];
|
|
40
41
|
prettier: boolean;
|
|
41
42
|
tslint: boolean;
|
|
@@ -90,6 +91,7 @@ type NormalizedOverrideOutput = {
|
|
|
90
91
|
angular: Required<AngularOptions>;
|
|
91
92
|
swr: SwrOptions;
|
|
92
93
|
zod: NormalizedZodOptions;
|
|
94
|
+
fetch: FetchOptions;
|
|
93
95
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
94
96
|
requestOptions: Record<string, any> | boolean;
|
|
95
97
|
useDates?: boolean;
|
|
@@ -120,6 +122,7 @@ type NormalizedOperationOptions = {
|
|
|
120
122
|
swr?: SwrOptions;
|
|
121
123
|
zod?: NormalizedZodOptions;
|
|
122
124
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
125
|
+
fetch?: FetchOptions;
|
|
123
126
|
formData?: boolean | NormalizedMutator;
|
|
124
127
|
formUrlEncoded?: boolean | NormalizedMutator;
|
|
125
128
|
paramsSerializer?: NormalizedMutator;
|
|
@@ -143,6 +146,7 @@ type OutputOptions = {
|
|
|
143
146
|
mock?: boolean | GlobalMockOptions | ClientMockBuilder;
|
|
144
147
|
override?: OverrideOutput;
|
|
145
148
|
client?: OutputClient | OutputClientFunc;
|
|
149
|
+
httpClient?: OutputHttpClient;
|
|
146
150
|
clean?: boolean | string[];
|
|
147
151
|
prettier?: boolean;
|
|
148
152
|
tslint?: boolean;
|
|
@@ -185,6 +189,11 @@ declare const OutputClient: {
|
|
|
185
189
|
readonly FETCH: "fetch";
|
|
186
190
|
};
|
|
187
191
|
type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];
|
|
192
|
+
declare const OutputHttpClient: {
|
|
193
|
+
readonly AXIOS: "axios";
|
|
194
|
+
readonly FETCH: "fetch";
|
|
195
|
+
};
|
|
196
|
+
type OutputHttpClient = (typeof OutputHttpClient)[keyof typeof OutputHttpClient];
|
|
188
197
|
declare const OutputMode: {
|
|
189
198
|
readonly SINGLE: "single";
|
|
190
199
|
readonly SPLIT: "split";
|
|
@@ -283,6 +292,7 @@ type OverrideOutput = {
|
|
|
283
292
|
angular?: AngularOptions;
|
|
284
293
|
zod?: ZodOptions;
|
|
285
294
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
295
|
+
fetch?: FetchOptions;
|
|
286
296
|
requestOptions?: Record<string, any> | boolean;
|
|
287
297
|
useDates?: boolean;
|
|
288
298
|
useTypeOverInterfaces?: boolean;
|
|
@@ -308,6 +318,13 @@ type ZodOptions = {
|
|
|
308
318
|
body?: boolean;
|
|
309
319
|
response?: boolean;
|
|
310
320
|
};
|
|
321
|
+
generate: {
|
|
322
|
+
param: boolean;
|
|
323
|
+
query: boolean;
|
|
324
|
+
header: boolean;
|
|
325
|
+
body: boolean;
|
|
326
|
+
response: boolean;
|
|
327
|
+
};
|
|
311
328
|
coerce?: {
|
|
312
329
|
param?: boolean | ZodCoerceType[];
|
|
313
330
|
query?: boolean | ZodCoerceType[];
|
|
@@ -333,6 +350,13 @@ type NormalizedZodOptions = {
|
|
|
333
350
|
body: boolean;
|
|
334
351
|
response: boolean;
|
|
335
352
|
};
|
|
353
|
+
generate: {
|
|
354
|
+
param: boolean;
|
|
355
|
+
query: boolean;
|
|
356
|
+
header: boolean;
|
|
357
|
+
body: boolean;
|
|
358
|
+
response: boolean;
|
|
359
|
+
};
|
|
336
360
|
coerce: {
|
|
337
361
|
param: boolean | ZodCoerceType[];
|
|
338
362
|
query: boolean | ZodCoerceType[];
|
|
@@ -398,6 +422,9 @@ type SwrOptions = {
|
|
|
398
422
|
swrMutationOptions?: any;
|
|
399
423
|
swrInfiniteOptions?: any;
|
|
400
424
|
};
|
|
425
|
+
type FetchOptions = {
|
|
426
|
+
includeHttpStatusReturnType: boolean;
|
|
427
|
+
};
|
|
401
428
|
type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
|
|
402
429
|
type InputTransformer = string | InputTransformerFn;
|
|
403
430
|
type OverrideInput = {
|
|
@@ -415,6 +442,7 @@ type OperationOptions = {
|
|
|
415
442
|
swr?: SwrOptions;
|
|
416
443
|
zod?: ZodOptions;
|
|
417
444
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
445
|
+
fetch?: FetchOptions;
|
|
418
446
|
formData?: boolean | Mutator;
|
|
419
447
|
formUrlEncoded?: boolean | Mutator;
|
|
420
448
|
paramsSerializer?: Mutator;
|
|
@@ -463,6 +491,7 @@ interface GlobalOptions {
|
|
|
463
491
|
biome?: boolean;
|
|
464
492
|
mock?: boolean | GlobalMockOptions;
|
|
465
493
|
client?: OutputClient;
|
|
494
|
+
httpClient?: OutputHttpClient;
|
|
466
495
|
mode?: OutputMode;
|
|
467
496
|
tsconfig?: string | Tsconfig;
|
|
468
497
|
packageJson?: string;
|
|
@@ -483,6 +512,7 @@ type TsConfigTarget = 'es3' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | '
|
|
|
483
512
|
interface PackageJson {
|
|
484
513
|
dependencies?: Record<string, string>;
|
|
485
514
|
devDependencies?: Record<string, string>;
|
|
515
|
+
peerDependencies?: Record<string, string>;
|
|
486
516
|
}
|
|
487
517
|
type GeneratorSchema = {
|
|
488
518
|
name: string;
|
|
@@ -634,7 +664,7 @@ type ClientFooterBuilder = (params: {
|
|
|
634
664
|
hasMutator: boolean;
|
|
635
665
|
}) => string;
|
|
636
666
|
type ClientTitleBuilder = (title: string) => string;
|
|
637
|
-
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson) => GeneratorDependency[];
|
|
667
|
+
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson, httpClient?: OutputHttpClient) => GeneratorDependency[];
|
|
638
668
|
type ClientMockGeneratorImplementation = {
|
|
639
669
|
function: string;
|
|
640
670
|
handlerName: string;
|
|
@@ -858,6 +888,9 @@ type GeneratorApiBuilder = GeneratorApiOperations & {
|
|
|
858
888
|
importsMock: GenerateMockImports;
|
|
859
889
|
extraFiles: ClientFileBuilder[];
|
|
860
890
|
};
|
|
891
|
+
interface SchemaWithConst extends SchemaObject {
|
|
892
|
+
const: string;
|
|
893
|
+
}
|
|
861
894
|
|
|
862
895
|
declare const generalJSTypes: string[];
|
|
863
896
|
declare const generalJSTypesWithArray: string[];
|
|
@@ -1385,4 +1418,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
|
|
|
1385
1418
|
|
|
1386
1419
|
declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
|
|
1387
1420
|
|
|
1388
|
-
export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|
|
1421
|
+
export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type FetchOptions, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, OutputHttpClient, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SchemaWithConst, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
|