@orval/core 6.23.0 → 6.24.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.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import SwaggerParser from '@apidevtools/swagger-parser';
2
- import * as openapi3_ts from 'openapi3-ts';
3
- import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts';
2
+ import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
3
+ import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts/oas30';
4
4
  import swagger2openapi from 'swagger2openapi';
5
5
  import { allLocales } from '@faker-js/faker';
6
6
  import { CompareOperator } from 'compare-versions';
@@ -44,6 +44,7 @@ type NormalizedOutputOptions = {
44
44
  baseUrl?: string;
45
45
  allParamsOptional: boolean;
46
46
  urlEncodeParameters: boolean;
47
+ unionAddMissingProperties: boolean;
47
48
  };
48
49
  type NormalizedParamsSerializerOptions = {
49
50
  qs?: Record<string, any>;
@@ -82,9 +83,7 @@ type NormalizedOverrideOutput = {
82
83
  };
83
84
  query: NormalizedQueryOptions;
84
85
  angular: Required<AngularOptions>;
85
- swr: {
86
- options?: any;
87
- };
86
+ swr: SwrOptions;
88
87
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
89
88
  requestOptions: Record<string, any> | boolean;
90
89
  useDates?: boolean;
@@ -149,6 +148,7 @@ type OutputOptions = {
149
148
  baseUrl?: string;
150
149
  allParamsOptional?: boolean;
151
150
  urlEncodeParameters?: boolean;
151
+ unionAddMissingProperties?: boolean;
152
152
  };
153
153
  type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
154
154
  validate?: boolean;
@@ -173,18 +173,18 @@ declare const OutputClient: {
173
173
  readonly SWR: "swr";
174
174
  readonly ZOD: "zod";
175
175
  };
176
- type OutputClient = typeof OutputClient[keyof typeof OutputClient];
176
+ type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];
177
177
  declare const OutputMode: {
178
178
  readonly SINGLE: "single";
179
179
  readonly SPLIT: "split";
180
180
  readonly TAGS: "tags";
181
181
  readonly TAGS_SPLIT: "tags-split";
182
182
  };
183
- type OutputMode = typeof OutputMode[keyof typeof OutputMode];
183
+ type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];
184
184
  declare const OutputMockType: {
185
185
  readonly MSW: "msw";
186
186
  };
187
- type OutputMockType = typeof OutputMockType[keyof typeof OutputMockType];
187
+ type OutputMockType = (typeof OutputMockType)[keyof typeof OutputMockType];
188
188
  type GlobalMockOptions = {
189
189
  type: OutputMockType;
190
190
  useExamples?: boolean;
@@ -258,9 +258,7 @@ type OverrideOutput = {
258
258
  };
259
259
  };
260
260
  query?: QueryOptions;
261
- swr?: {
262
- options?: any;
263
- };
261
+ swr?: SwrOptions;
264
262
  angular?: AngularOptions;
265
263
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
266
264
  requestOptions?: Record<string, any> | boolean;
@@ -287,6 +285,7 @@ type NormalizedQueryOptions = {
287
285
  queryKey?: NormalizedMutator;
288
286
  queryOptions?: NormalizedMutator;
289
287
  mutationOptions?: NormalizedMutator;
288
+ shouldExportMutatorHooks?: boolean;
290
289
  signal?: boolean;
291
290
  version?: 3 | 4 | 5;
292
291
  };
@@ -302,12 +301,17 @@ type QueryOptions = {
302
301
  queryKey?: Mutator;
303
302
  queryOptions?: Mutator;
304
303
  mutationOptions?: Mutator;
304
+ shouldExportMutatorHooks?: boolean;
305
305
  signal?: boolean;
306
306
  version?: 3 | 4 | 5;
307
307
  };
308
308
  type AngularOptions = {
309
309
  provideIn?: 'root' | 'any' | boolean;
310
310
  };
311
+ type SwrOptions = {
312
+ options?: any;
313
+ useInfinite?: boolean;
314
+ };
311
315
  type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
312
316
  type InputTransformer = string | InputTransformerFn;
313
317
  type OverrideInput = {
@@ -322,9 +326,7 @@ type OperationOptions = {
322
326
  };
323
327
  query?: QueryOptions;
324
328
  angular?: Required<AngularOptions>;
325
- swr?: {
326
- options?: any;
327
- };
329
+ swr?: SwrOptions;
328
330
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
329
331
  formData?: boolean | Mutator;
330
332
  formUrlEncoded?: boolean | Mutator;
@@ -333,7 +335,11 @@ type OperationOptions = {
333
335
  };
334
336
  type Hook = 'afterAllFilesWrite';
335
337
  type HookFunction = (...args: any[]) => void | Promise<void>;
336
- type HookCommand = string | HookFunction | (string | HookFunction)[];
338
+ interface HookOption {
339
+ command: string | HookFunction;
340
+ injectGeneratedDirsAndFiles?: boolean;
341
+ }
342
+ type HookCommand = string | HookFunction | HookOption | (string | HookFunction | HookOption)[];
337
343
  type NormalizedHookCommand = HookCommand[];
338
344
  type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
339
345
  type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
@@ -357,12 +363,9 @@ interface ContextSpecs {
357
363
  specKey: string;
358
364
  target: string;
359
365
  workspace: string;
360
- tslint: boolean;
361
366
  specs: Record<string, OpenAPIObject>;
362
- override: NormalizedOverrideOutput;
363
- tsconfig?: Tsconfig;
364
- packageJson?: PackageJson;
365
367
  parents?: string[];
368
+ output: NormalizedOutputOptions;
366
369
  }
367
370
  interface GlobalOptions {
368
371
  projectName?: string;
@@ -435,6 +438,7 @@ type GeneratorTargetFull = {
435
438
  implementationMock: {
436
439
  function: string;
437
440
  handler: string;
441
+ handlerName: string;
438
442
  };
439
443
  importsMock: GeneratorImport[];
440
444
  mutators?: GeneratorMutator[];
@@ -449,6 +453,7 @@ type GeneratorOperation = {
449
453
  implementationMock: {
450
454
  function: string;
451
455
  handler: string;
456
+ handlerName: string;
452
457
  };
453
458
  importsMock: GeneratorImport[];
454
459
  tags: string[];
@@ -924,7 +929,7 @@ declare const getParamsInPath: (path: string) => string[];
924
929
  declare const getParams: ({ route, pathParams, operationId, context, output, }: {
925
930
  route: string;
926
931
  pathParams?: {
927
- parameter: openapi3_ts.ParameterObject;
932
+ parameter: openapi3_ts_oas30.ParameterObject;
928
933
  imports: GeneratorImport[];
929
934
  }[] | undefined;
930
935
  operationId: string;
@@ -1073,7 +1078,7 @@ declare const startMessage: ({ name, version, description, }: {
1073
1078
  version: string;
1074
1079
  description: string;
1075
1080
  }) => void;
1076
- declare const errorMessage: (err: string) => void;
1081
+ declare const logError: (err: unknown, tag?: string) => void;
1077
1082
  declare const mismatchArgsMessage: (mismatchArgs: string[]) => void;
1078
1083
  declare const createSuccessMessage: (backend?: string) => void;
1079
1084
  declare const ibmOpenapiValidatorWarnings: (warnings: {
@@ -1252,4 +1257,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
1252
1257
 
1253
1258
  declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
1254
1259
 
1255
- export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, 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 Hook, type HookCommand, type HookFunction, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockOptions, type MockProperties, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, 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 TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, errorMessage, 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, 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 };
1260
+ export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, 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 Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockOptions, type MockProperties, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, 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, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, _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 };